Parallelize BatteryRampPegSolver (#12351)

This commit is contained in:
Leon Friedrich
2022-11-09 14:43:45 +13:00
committed by GitHub
parent 4a68db4eb2
commit eebb31493c
11 changed files with 546 additions and 250 deletions

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using Content.Server.Power.Pow3r;
using static Content.Server.Power.Pow3r.PowerState;
@@ -45,7 +45,7 @@ namespace Pow3r
_simStopwatch.Restart();
_tickDataIdx = (_tickDataIdx + 1) % MaxTickData;
_solvers[_currentSolver].Tick(frameTime, _state);
_solvers[_currentSolver].Tick(frameTime, _state, 1);
// Update tick history.
foreach (var load in _state.Loads.Values)
@@ -111,13 +111,13 @@ namespace Pow3r
supply.LinkedNetwork = network.Id;
}
foreach (var batteryId in network.BatteriesCharging)
foreach (var batteryId in network.BatteryLoads)
{
var battery = _state.Batteries[batteryId];
battery.LinkedNetworkCharging = network.Id;
}
foreach (var batteryId in network.BatteriesDischarging)
foreach (var batteryId in network.BatterySupplies)
{
var battery = _state.Batteries[batteryId];
battery.LinkedNetworkDischarging = network.Id;