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

Skip to content
Snippets Groups Projects
Commit 5bf82210 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Merge branch...

Merge branch 'feature/CodeEU-48_Consider-JunctionBox-ConnectorsSubsystemsIncluded' into 'amdm2/develop'

extend electric system response to contain parameters needed to calculate...

See merge request vecto/vecto!17
parents 96761b31 3728cd04
No related branches found
No related tags found
No related merge requests found
......@@ -229,6 +229,8 @@ namespace TUGraz.VectoCommon.Models
double StateOfCharge { get; set; }
Volt InternalVoltage { get; set; }
object Source { get; }
}
......
......@@ -24,6 +24,7 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
public Watt LossPower { get; set; }
public double StateOfCharge { get; set; }
public Volt InternalVoltage { get; set; }
public object Source { get; }
}
......@@ -73,18 +74,41 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
public IRESSResponse RESSResponse { get; set; }
public Watt MaxPowerDrive =>
(RESSResponse != null && RESSResponse.MaxDischargePower != null ? RESSResponse.MaxDischargePower : 0.SI<Watt>()) -
(ChargingPower != null ? ChargingPower : 0.SI<Watt>()) +
(AuxPower != null ? AuxPower : 0.SI<Watt>());
CalculateMaxEMPower(RESSResponse != null && RESSResponse.MaxDischargePower != null
? RESSResponse.MaxDischargePower
: 0.SI<Watt>(), RESSResponse.InternalVoltage);
public Watt MaxPowerDrag =>
(RESSResponse != null && RESSResponse.MaxChargePower != null ? RESSResponse.MaxChargePower : 0.SI<Watt>()) -
(ChargingPower != null ? ChargingPower : 0.SI<Watt>()) +
(AuxPower != null ? AuxPower : 0.SI<Watt>());
CalculateMaxEMPower(RESSResponse != null && RESSResponse.MaxChargePower != null
? RESSResponse.MaxChargePower
: 0.SI<Watt>(), RESSResponse.InternalVoltage);
protected Watt CalculateMaxEMPower(Watt P_batMax, Volt U_int)
{
//Note: consider losses of electric system (cables, junction box) when calculating max drive power
// see ElectricSystem implementation...
// I_est = P_EM / U_Int
// P_Conn = I_est ^ 2 * R_Conn = (P_EM / U_Int) ^ 2 * R_Conn
// P_EM_max = P_Bat_max - P_Chg + P_aux +P_Conn(P_EM)
// P_EM_max + P_Conn = P_Bat_max - P_Chg + P_aux
// P_EM_max + ((P_EM_max + P_Chg - P_aux) / U_Int) ^ 2 * R_Conn = P_Bat_max - P_Chg + P_aux
// P_EM_max^2 * R_Conn / U_Int^2 + P_EM_max - (P_Bat_max - P_Chg + P_aux) = 0
// Px = P_Bat_max - P_Chg + P_aux
var Px = P_batMax -
(ChargingPower != null ? ChargingPower : 0.SI<Watt>()) +
(AuxPower != null ? AuxPower : 0.SI<Watt>());
var a = (ConnectionSystemResistance / U_int / U_int).Value();
var b = 1.0;
var c = -Px.Value();
var solutions = VectoMath.QuadraticEquationSolver(a, b, c);
return solutions.First().SI<Watt>();
}
public Watt RESSPowerDemand { get; set; }
public object Source { get; }
public Ohm ConnectionSystemResistance { get; set; }
public override string ToString()
{
......
......@@ -62,6 +62,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
response.SimulationInterval = dt;
response.RESSResponse = batResponse;
response.RESSPowerDemand = totalPowerDemand;
response.ConnectionSystemResistance = ModelData?.ConnectionSystemResistance ?? 0.SI<Ohm>();
response.ConsumerPower = powerDemand;
response.AuxPower = auxDemand;
response.ChargingPower = chargePower;
......
......@@ -81,8 +81,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
MaxDischargePower = maxDischargePower,
PowerDemand = powerDemand,
LossPower = batteryLoss,
StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity
StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity,
InternalVoltage = InternalVoltage
};
}
CurrentState.SimulationInterval = dt;
......@@ -105,6 +105,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
PowerDemand = powerDemand,
LossPower = batteryLoss,
StateOfCharge = soc,
InternalVoltage = InternalVoltage
};
}
......
......@@ -314,6 +314,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
PowerDemand = powerDemand,
LossPower = responses.Sum(x => x.Value.Sum(b => b.LossPower)),
//StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity
InternalVoltage = InternalVoltage,
StateOfCharge = StateOfCharge,
};
}
......@@ -334,8 +336,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
MaxDischargePower = maxDischargePower,
PowerDemand = powerDemand,
LossPower = responses.Sum(x => x.Value.Sum(b => b.LossPower)),
//StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity
};
//StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity
InternalVoltage = InternalVoltage,
StateOfCharge = StateOfCharge,
};
}
throw new NotImplementedException("batterypack no success");
}
......
......@@ -453,7 +453,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// has to be positive for recuperation - battery is full
return null;
}
var maxBatRecuperationTorque = maxBatPower.IsEqual(0, 1e-3)
? ModelData.DragCurveLookup(avgSpeed, gear)
: ModelData.EfficiencyData.EfficiencyMapLookupTorque(volt, maxBatPower, avgSpeed, maxEmTorque, gear);
......
......@@ -104,8 +104,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
MaxDischargePower = maxDischargePower,
PowerDemand = powerDemand,
LossPower = internalLoss,
StateOfCharge = (currentCharge + current * dt) / (ModelData.Capacity * ModelData.MaxVoltage)
StateOfCharge = (currentCharge + current * dt) / (ModelData.Capacity * ModelData.MaxVoltage),
InternalVoltage = InternalVoltage
};
}
CurrentState.SimulationInterval = dt;
......@@ -125,7 +125,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
MaxDischargePower = maxDischargePower,
PowerDemand = powerDemand,
LossPower = internalLoss,
StateOfCharge = (currentCharge + current * dt) / (ModelData.Capacity * ModelData.MaxVoltage)
StateOfCharge = (currentCharge + current * dt) / (ModelData.Capacity * ModelData.MaxVoltage),
InternalVoltage = InternalVoltage
};
}
......
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