Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit ea60de4e authored by Harald Martini's avatar Harald Martini
Browse files

set powerdemand to 0.Si<Watt> if powerdemand is null

parent f817afc9
No related branches found
No related tags found
No related merge requests found
......@@ -28,9 +28,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
public IElectricSystemResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun = false)
{
powerDemand = powerDemand ?? 0.SI<Watt>();
var auxDemand = Consumers.Sum(x => x.PowerDemand(absTime, dt, dryRun)).DefaultIfNull(0);
var chargePower = Charger.Count == 0 ? 0.SI<Watt>() : Charger.Sum(x => x.PowerDemand(absTime, dt, powerDemand, auxDemand, dryRun));
var chargePower = Charger.Count == 0 ? 0.SI<Watt>() : Charger.Sum(x => x.PowerDemand(absTime, dt, powerDemand, auxDemand, dryRun));
var totalPowerDemand = powerDemand + chargePower - auxDemand;
var batResponse = Battery.MainBatteryPort.Request(absTime, dt, totalPowerDemand, dryRun);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment