Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

more cleanup: rename properites and methods - remove type/unit info; use SI units for alternator

parent 82b7c8f3
Branches
Tags
No related merge requests found
Showing
with 362 additions and 403 deletions
...@@ -6,6 +6,7 @@ Imports System.Windows.Forms ...@@ -6,6 +6,7 @@ Imports System.Windows.Forms
Imports VectoAuxiliaries.Electrics Imports VectoAuxiliaries.Electrics
Imports System.ComponentModel Imports System.ComponentModel
Imports System.Linq Imports System.Linq
Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics
Imports TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics Imports TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics
Imports TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Imports TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics
...@@ -356,25 +357,25 @@ Public Class frmCombinedAlternators ...@@ -356,25 +357,25 @@ Public Class frmCombinedAlternators
Dim newAlt As New List(Of ICombinedAlternatorMapRow) Dim newAlt As New List(Of ICombinedAlternatorMapRow)
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2K10Amps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000.RPMtoRad(), txt2K10Amps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt2K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt2K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMax2Amps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000.RPMtoRad(), txt2KMax2Amps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt2KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt2KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMaxAmps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000.RPMtoRad(), txt2KMaxAmps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt2KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt2KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4K10Amps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000.RPMtoRad(), txt4K10Amps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt4K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt4K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMax2Amps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000.RPMtoRad(),txt4KMax2Amps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt4KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt4KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMaxAmps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000.RPMtoRad(), txt4KMaxAmps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt4KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt4KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6K10Amps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000.RPMtoRad(),txt6K10Amps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt6K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt6K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMax2Amps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000.RPMtoRad(), txt6KMax2Amps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt6KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt6KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMaxAmps.Text), newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000.RPMtoRad(), txt6KMaxAmps.Text.ToDouble().si(Of Ampere),
Convert.ToSingle(txt6KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) Convert.ToSingle(txt6KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text)))
Return newAlt Return newAlt
......
...@@ -26,7 +26,7 @@ Namespace Mocks ...@@ -26,7 +26,7 @@ Namespace Mocks
End If End If
End Function End Function
Public Function GetEfficiency(rpm1 As Double, amps1 As Ampere) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency Public Function GetEfficiency(rpm1 As PerSecond, amps1 As Ampere) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency
Return New AlternatorMapValues() Return New AlternatorMapValues()
End Function End Function
......
...@@ -22,8 +22,8 @@ Public Class M3_Mock ...@@ -22,8 +22,8 @@ Public Class M3_Mock
End Get End Get
End Property End Property
Public Function TotalAirConsumedPerCycle() As NormLiterPerSecond _ Public Function AverageAirConsumed() As NormLiterPerSecond _
Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumedPerSecondLitre Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumed
Return _TotalAirConsumedPerCycle Return _TotalAirConsumedPerCycle
End Function End Function
......
...@@ -11,18 +11,18 @@ Public Class M5_Mock ...@@ -11,18 +11,18 @@ Public Class M5_Mock
Public Property _AlternatorsGenerationPowerAtCrankTractionOnWatts As Watt Public Property _AlternatorsGenerationPowerAtCrankTractionOnWatts As Watt
Public Function AlternatorsGenerationPowerAtCrankIdleWatts() As Watt _ Public Function AlternatorsGenerationPowerAtCrankIdle() As Watt _
Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankIdleWatts Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankIdle
Return _AlternatorsGenerationPowerAtCrankIdleWatts Return _AlternatorsGenerationPowerAtCrankIdleWatts
End Function End Function
Public Function AlternatorsGenerationPowerAtCrankOverrunWatts() As Watt _ Public Function AlternatorsGenerationPowerAtCrankOverrun() As Watt _
Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankOverrunWatts Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankOverrun
Return _AlternatorsGenerationPowerAtCrankOverrunWatts Return _AlternatorsGenerationPowerAtCrankOverrunWatts
End Function End Function
Public Function AlternatorsGenerationPowerAtCrankTractionOnWatts() As Watt _ Public Function AlternatorsGenerationPowerAtCrankTractionOn() As Watt _
Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankTractionOnWatts Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankTractionOn
Return _AlternatorsGenerationPowerAtCrankTractionOnWatts Return _AlternatorsGenerationPowerAtCrankTractionOnWatts
End Function End Function
......
...@@ -39,7 +39,7 @@ Namespace UnitTests ...@@ -39,7 +39,7 @@ Namespace UnitTests
Dim map As IAlternatorMap = GetInitialisedMap() Dim map As IAlternatorMap = GetInitialisedMap()
Dim target As IAlternatorMap = GetInitialisedMap() Dim target As IAlternatorMap = GetInitialisedMap()
Dim actual As Single = map.GetEfficiency(rpm, amps.SI(Of Ampere)).Efficiency Dim actual As Single = map.GetEfficiency(rpm.RPMtoRad(), amps.SI(Of Ampere)).Efficiency
Assert.AreEqual(expected, actual) Assert.AreEqual(expected, actual)
End Sub End Sub
...@@ -52,7 +52,7 @@ Namespace UnitTests ...@@ -52,7 +52,7 @@ Namespace UnitTests
Dim map As IAlternatorMap = GetInitialisedMap() Dim map As IAlternatorMap = GetInitialisedMap()
Dim target As IAlternatorMap = GetInitialisedMap() Dim target As IAlternatorMap = GetInitialisedMap()
Dim actual As Single = map.GetEfficiency(rpm, amps.SI(Of Ampere)).Efficiency Dim actual As Single = map.GetEfficiency(rpm.RPMtoRad(), amps.SI(Of Ampere)).Efficiency
Assert.AreEqual(expected, actual) Assert.AreEqual(expected, actual)
End Sub End Sub
...@@ -66,7 +66,7 @@ Namespace UnitTests ...@@ -66,7 +66,7 @@ Namespace UnitTests
Dim map As IAlternatorMap = GetInitialisedMap() Dim map As IAlternatorMap = GetInitialisedMap()
Dim target As IAlternatorMap = GetInitialisedMap() Dim target As IAlternatorMap = GetInitialisedMap()
Dim actual As Single = map.GetEfficiency(rpm, amps.SI(Of Ampere)).Efficiency Dim actual As Single = map.GetEfficiency(rpm.RPMtoRad(), amps.SI(Of Ampere)).Efficiency
Assert.AreEqual(expected, actual) Assert.AreEqual(expected, actual)
End Sub End Sub
...@@ -103,7 +103,7 @@ Namespace UnitTests ...@@ -103,7 +103,7 @@ Namespace UnitTests
Dim map As IAlternatorMap = GetInitialisedMap() Dim map As IAlternatorMap = GetInitialisedMap()
Dim target As IAlternatorMap = GetInitialisedMap() Dim target As IAlternatorMap = GetInitialisedMap()
Dim actual As Single = map.GetEfficiency(rpm, amps.SI(Of Ampere)).Efficiency Dim actual As Single = map.GetEfficiency(rpm.RPMtoRad(), amps.SI(Of Ampere)).Efficiency
Assert.AreEqual(expected, CType(Math.Round(actual, 6), Single)) Assert.AreEqual(expected, CType(Math.Round(actual, 6), Single))
End Sub End Sub
......
...@@ -167,7 +167,7 @@ Namespace UnitTests ...@@ -167,7 +167,7 @@ Namespace UnitTests
Dim expected As Single = 7947.55127 / _Signals.TotalCycleTimeSeconds Dim expected As Single = 7947.55127 / _Signals.TotalCycleTimeSeconds
Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) Assert.AreEqual(expected, target.AverageAirConsumed().Value(), 0.001)
End Sub End Sub
'SmartRegeneration = False 'SmartRegeneration = False
...@@ -191,7 +191,7 @@ Namespace UnitTests ...@@ -191,7 +191,7 @@ Namespace UnitTests
Dim expected As Double = 8863.378 / _Signals.TotalCycleTimeSeconds Dim expected As Double = 8863.378 / _Signals.TotalCycleTimeSeconds
Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) Assert.AreEqual(expected, target.AverageAirConsumed().Value(), 0.001)
End Sub End Sub
'RetarderBrake = False 'RetarderBrake = False
...@@ -216,7 +216,7 @@ Namespace UnitTests ...@@ -216,7 +216,7 @@ Namespace UnitTests
Dim expected As Double = 8541.45 / _Signals.TotalCycleTimeSeconds Dim expected As Double = 8541.45 / _Signals.TotalCycleTimeSeconds
Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) Assert.AreEqual(expected, target.AverageAirConsumed().Value(), 0.001)
End Sub End Sub
'KneelingHeightMilimeters = 100 'KneelingHeightMilimeters = 100
...@@ -240,7 +240,7 @@ Namespace UnitTests ...@@ -240,7 +240,7 @@ Namespace UnitTests
Dim expected As Double = 8557.524 / _Signals.TotalCycleTimeSeconds Dim expected As Double = 8557.524 / _Signals.TotalCycleTimeSeconds
Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) Assert.AreEqual(expected, target.AverageAirConsumed().Value(), 0.001)
End Sub End Sub
'AirSuspensionControl = "mechanically" 'AirSuspensionControl = "mechanically"
...@@ -264,7 +264,7 @@ Namespace UnitTests ...@@ -264,7 +264,7 @@ Namespace UnitTests
Dim expected As Double = 8726.1840 / _Signals.TotalCycleTimeSeconds Dim expected As Double = 8726.1840 / _Signals.TotalCycleTimeSeconds
Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) Assert.AreEqual(expected, target.AverageAirConsumed().Value(), 0.001)
End Sub End Sub
'AdBlueDosing = "electric" 'AdBlueDosing = "electric"
...@@ -288,7 +288,7 @@ Namespace UnitTests ...@@ -288,7 +288,7 @@ Namespace UnitTests
Dim expected As Double = 7947.68457 / _Signals.TotalCycleTimeSeconds Dim expected As Double = 7947.68457 / _Signals.TotalCycleTimeSeconds
Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) Assert.AreEqual(expected, target.AverageAirConsumed().Value(), 0.001)
End Sub End Sub
'Doors = "Electric" 'Doors = "Electric"
...@@ -312,7 +312,7 @@ Namespace UnitTests ...@@ -312,7 +312,7 @@ Namespace UnitTests
Dim expected As Double = 6880.88428 / _Signals.TotalCycleTimeSeconds Dim expected As Double = 6880.88428 / _Signals.TotalCycleTimeSeconds
Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) Assert.AreEqual(expected, target.AverageAirConsumed().Value(), 0.001)
End Sub End Sub
End Class End Class
End Namespace End Namespace
......
...@@ -21,7 +21,7 @@ Namespace UnitTests ...@@ -21,7 +21,7 @@ Namespace UnitTests
Dim m9 As New Mock(Of IM9) Dim m9 As New Mock(Of IM9)
Dim signals As New Signals() ' Not required , here for expansion only. Dim signals As New Signals() ' Not required , here for expansion only.
m3.Setup(Function(x) x.AverageAirConsumedPerSecondLitre).Returns(xTAir.SI(Of NormLiterPerSecond)) m3.Setup(Function(x) x.AverageAirConsumed).Returns(xTAir.SI(Of NormLiterPerSecond))
m9.Setup(Function(x) x.LitresOfAirCompressorOnContinually).Returns(x1.SI(Of NormLiter)) m9.Setup(Function(x) x.LitresOfAirCompressorOnContinually).Returns(x1.SI(Of NormLiter))
m9.Setup(Function(x) x.TotalCycleFuelConsumptionCompressorOnContinuously).Returns((y1 / 1000).SI(Of Kilogram)) m9.Setup(Function(x) x.TotalCycleFuelConsumptionCompressorOnContinuously).Returns((y1 / 1000).SI(Of Kilogram))
'x2 is not an output of m9, an is allways zero, but to keep in line with schematic, is represented anyway although it is a constant. 'x2 is not an output of m9, an is allways zero, but to keep in line with schematic, is represented anyway although it is a constant.
......
...@@ -56,7 +56,7 @@ Namespace UnitTests ...@@ -56,7 +56,7 @@ Namespace UnitTests
Dim target = New M13Impl(m10.Object, m11.Object, m12.Object, Signals.Object) Dim target = New M13Impl(m10.Object, m11.Object, m12.Object, Signals.Object)
'Assert 'Assert
Assert.AreEqual(OUT1.SI(Unit.SI.Gramm).Value(), target.WHTCTotalCycleFuelConsumptionGrams.Value(), 0.001) Assert.AreEqual(OUT1.SI(Unit.SI.Gramm).Value(), target.WHTCTotalCycleFuelConsumption.Value(), 0.001)
End Sub End Sub
End Class End Class
End Namespace End Namespace
......
...@@ -116,7 +116,7 @@ Namespace UnitTests ...@@ -116,7 +116,7 @@ Namespace UnitTests
Dim constants As IHVACConstants = New HVACConstants(835.SI(Of KilogramPerCubicMeter)) Dim constants As IHVACConstants = New HVACConstants(835.SI(Of KilogramPerCubicMeter))
'Moq' Arrangements 'Moq' Arrangements
m13.Setup(Function(x) x.WHTCTotalCycleFuelConsumptionGrams).Returns((ip1 / 1000).SI(Of Kilogram)) m13.Setup(Function(x) x.WHTCTotalCycleFuelConsumption).Returns((ip1 / 1000).SI(Of Kilogram))
signals.Setup(Function(x) x.CurrentCycleTimeInSeconds).Returns(ip5) signals.Setup(Function(x) x.CurrentCycleTimeInSeconds).Returns(ip5)
...@@ -124,8 +124,8 @@ Namespace UnitTests ...@@ -124,8 +124,8 @@ Namespace UnitTests
Dim m14 As New M14Impl(m13.Object, ssmMock, constants, signals.Object) Dim m14 As New M14Impl(m13.Object, ssmMock, constants, signals.Object)
'Assert 'Assert
Assert.AreEqual(expectedOut1.SI(Unit.SI.Gramm).Value(), m14.TotalCycleFCGrams.Value(), 0.1) Assert.AreEqual(expectedOut1.SI(Unit.SI.Gramm).Value(), m14.TotalCycleFC.Value(), 0.1)
Assert.AreEqual(expectedOut2.SI(Of Liter).Value(), m14.TotalCycleFCLitres.Value(), 0.00001) 'Assert.AreEqual(expectedOut2.SI(Of Liter).Value(), m14.TotalCycleFCLitres.Value(), 0.00001)
End Sub End Sub
End Class End Class
End Namespace End Namespace
......
...@@ -93,7 +93,7 @@ Namespace UnitTests ...@@ -93,7 +93,7 @@ Namespace UnitTests
Initialise() Initialise()
_target = New M05Impl(_m05, _powerNetVoltage, _altGearPullyEfficiency) _target = New M05Impl(_m05, _powerNetVoltage, _altGearPullyEfficiency)
Dim expected As Single = 1641.35791 Dim expected As Single = 1641.35791
Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankIdleWatts() Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankIdle()
Assert.AreEqual(expected, actual.Value(), 0.001) Assert.AreEqual(expected, actual.Value(), 0.001)
End Sub End Sub
...@@ -104,7 +104,7 @@ Namespace UnitTests ...@@ -104,7 +104,7 @@ Namespace UnitTests
Initialise() Initialise()
_target = New M05Impl(_m05, _powerNetVoltage, _altGearPullyEfficiency) _target = New M05Impl(_m05, _powerNetVoltage, _altGearPullyEfficiency)
Dim expected As Single = 1641.35791 Dim expected As Single = 1641.35791
Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankTractionOnWatts() Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankTractionOn()
Assert.AreEqual(expected, actual.Value(), 0.001) Assert.AreEqual(expected, actual.Value(), 0.001)
End Sub End Sub
...@@ -116,7 +116,7 @@ Namespace UnitTests ...@@ -116,7 +116,7 @@ Namespace UnitTests
_target = New M05Impl(_m05, _powerNetVoltage, _altGearPullyEfficiency) _target = New M05Impl(_m05, _powerNetVoltage, _altGearPullyEfficiency)
Dim expected As Single = 1641.35791F Dim expected As Single = 1641.35791F
Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankOverrunWatts() Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankOverrun()
Assert.AreEqual(expected, actual.Value(), 0.001) Assert.AreEqual(expected, actual.Value(), 0.001)
End Sub End Sub
......
...@@ -252,25 +252,25 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries { ...@@ -252,25 +252,25 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries {
moduel.ResetCalculations(); moduel.ResetCalculations();
} }
public Kilogram TotalFuelGRAMS public Kilogram TotalFuel
{ {
get { get {
if (M13 != null) if (M13 != null)
return M14.TotalCycleFCGrams; return M14.TotalCycleFC;
else else
return 0.SI<Kilogram>(); return 0.SI<Kilogram>();
} }
} }
public Liter TotalFuelLITRES //public Liter TotalFuelLITRES
{ //{
get { // get {
if (M14 != null) // if (M14 != null)
return M14.TotalCycleFCLitres; // return M14.TotalCycleFCLitres;
else // else
return 0.SI<Liter>(); // return 0.SI<Liter>();
} // }
} //}
public string AuxiliaryName public string AuxiliaryName
{ {
...@@ -391,16 +391,16 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries { ...@@ -391,16 +391,16 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries {
public Kilogram AA_TotalCycleFC_Grams public Kilogram AA_TotalCycleFC_Grams
{ {
get { get {
return M14.TotalCycleFCGrams; return M14.TotalCycleFC;
} }
} }
public Liter AA_TotalCycleFC_Litres //public Liter AA_TotalCycleFC_Litres
{ //{
get { // get {
return M14.TotalCycleFCLitres; // return M14.TotalCycleFCLitres;
} // }
} //}
public Watt AuxiliaryPowerAtCrankWatts public Watt AuxiliaryPowerAtCrankWatts
{ {
......
...@@ -26,157 +26,116 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl ...@@ -26,157 +26,116 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl
private readonly string filePath; private readonly string filePath;
private List<MapPoint> _map = new List<MapPoint>(); private List<MapPoint> _map = new List<MapPoint>();
private List<double> _yRange; private List<Ampere> _yRange;
private List<double> _xRange; private List<PerSecond> _xRange;
private double _minX, _minY, _maxX, _maxY; private PerSecond _minX;
private Ampere _minY;
private PerSecond _maxX;
private Ampere _maxY;
// Required Action Test or Interpolation Type // Required Action Test or Interpolation Type
public bool OnBoundaryYInterpolatedX(double x, double y) public bool OnBoundaryYInterpolatedX(PerSecond x, Ampere y)
{ {
return _yRange.Contains(y) && !_xRange.Contains(x); return _yRange.Contains(y) && !_xRange.Contains(x);
} }
public bool OnBoundaryXInterpolatedY(double x, double y) public bool OnBoundaryXInterpolatedY(PerSecond x, Ampere y)
{ {
return !_yRange.Contains(y) && _xRange.Contains(x); return !_yRange.Contains(y) && _xRange.Contains(x);
} }
public bool ONBoundaryXY(double x, double y) public bool ONBoundaryXY(PerSecond x, Ampere y)
{ {
return (from sector in _map return (from sector in _map
where sector.Y == y && sector.x == x where sector.Y == y && sector.X == x
select sector).Count() == 1; select sector).Count() == 1;
} }
// Determine Value Methods // Determine Value Methods
private double GetOnBoundaryXY(double x, double y) private double GetOnBoundaryXY(PerSecond x, Ampere y)
{ {
return (from sector in _map return (from sector in _map
where sector.Y == y && sector.x == x where sector.Y == y && sector.X == x
select sector).First().v; select sector).First().V;
} }
private double GetOnBoundaryYInterpolatedX(double x, double y) private double GetOnBoundaryYInterpolatedX(PerSecond x, Ampere y)
{ {
double x0, x1, v0, v1, slope, dx; //double x0, x1, v0, v1, slope, dx;
x0 = (from p in _xRange var x0 = (from p in _xRange
orderby p orderby p
where p < x where p < x
select p).Last(); select p).Last();
x1 = (from p in _xRange var x1 = (from p in _xRange
orderby p orderby p
where p > x where p > x
select p).First(); select p).First();
dx = x1 - x0; var dx = x1 - x0;
v0 = GetOnBoundaryXY(x0, y); var v0 = GetOnBoundaryXY(x0, y);
v1 = GetOnBoundaryXY(x1, y); var v1 = GetOnBoundaryXY(x1, y);
slope = (v1 - v0) / (x1 - x0); return v0 + (x - x0) * (v1 - v0) / (x1 - x0);
return v0 + ((x - x0) * slope);
} }
private double GetOnBoundaryXInterpolatedY(double x, double y) private double GetOnBoundaryXInterpolatedY(PerSecond x, Ampere y)
{ {
double y0, y1, v0, v1, dy, v, slope; //double y0, y1, v0, v1, dy, v, slope;
y0 = (from p in _yRange var y0 = (from p in _yRange
orderby p orderby p
where p < y where p < y
select p).Last(); select p).Last();
y1 = (from p in _yRange var y1 = (from p in _yRange
orderby p orderby p
where p > y where p > y
select p).First(); select p).First();
dy = y1 - y0; var dy = y1 - y0;
v0 = GetOnBoundaryXY(x, y0);
v1 = GetOnBoundaryXY(x, y1);
slope = (v1 - v0) / (y1 - y0); var v0 = GetOnBoundaryXY(x, y0);
var v1 = GetOnBoundaryXY(x, y1);
v = v0 + ((y - y0) * slope); var v = v0 + (y - y0) * (v1 - v0) / (y1 - y0);
return v; return v;
} }
private double GetBiLinearInterpolatedValue(double x, double y) private double GetBiLinearInterpolatedValue(PerSecond x, Ampere y)
{ {
double q11, q12, q21, q22, x1, x2, y1, y2, r1, r2, p; //double q11, q12, q21, q22, x1, x2, y1, y2, r1, r2, p;
y1 = (from mapSector in _map var y1 = (from mapSector in _map
where mapSector.Y < y where mapSector.Y < y
select mapSector).Last().Y; select mapSector).Last().Y;
y2 = (from mapSector in _map var y2 = (from mapSector in _map
where mapSector.Y > y where mapSector.Y > y
select mapSector).First().Y; select mapSector).First().Y;
x1 = (from mapSector in _map var x1 = (from mapSector in _map
where mapSector.x < x where mapSector.X < x
select mapSector).Last().x; select mapSector).Last().X;
x2 = (from mapSector in _map var x2 = (from mapSector in _map
where mapSector.x > x where mapSector.X > x
select mapSector).First().x; select mapSector).First().X;
q11 = GetOnBoundaryXY(x1, y1); var q11 = GetOnBoundaryXY(x1, y1);
q12 = GetOnBoundaryXY(x1, y2); var q12 = GetOnBoundaryXY(x1, y2);
q21 = GetOnBoundaryXY(x2, y1); var q21 = GetOnBoundaryXY(x2, y1);
q22 = GetOnBoundaryXY(x2, y2); var q22 = GetOnBoundaryXY(x2, y2);
r1 = ((x2 - x) / (x2 - x1)) * q11 + ((x - x1) / (x2 - x1)) * q21; var r1 = ((x2 - x) / (x2 - x1)) * q11 + ((x - x1) / (x2 - x1)).Value() * q21;
r2 = ((x2 - x) / (x2 - x1)) * q12 + ((x - x1) / (x2 - x1)) * q22; var r2 = ((x2 - x) / (x2 - x1)) * q12 + ((x - x1) / (x2 - x1)).Value() * q22;
p = ((y2 - y) / (y2 - y1)) * r1 + ((y - y1) / (y2 - y1)) * r2; var p = ((y2 - y) / (y2 - y1)).Value() * r1 + ((y - y1) / (y2 - y1)).Value() * r2;
return p; return p;
} }
// Utilities
private void fillMapWithDefaults()
{
_map.Add(new MapPoint(10, 1500, 0.615));
_map.Add(new MapPoint(27, 1500, 0.7));
_map.Add(new MapPoint(53, 1500, 0.1947));
_map.Add(new MapPoint(63, 1500, 0.0));
_map.Add(new MapPoint(68, 1500, 0.0));
_map.Add(new MapPoint(125, 1500, 0.0));
_map.Add(new MapPoint(136, 1500, 0.0));
_map.Add(new MapPoint(10, 2000, 0.62));
_map.Add(new MapPoint(27, 2000, 0.7));
_map.Add(new MapPoint(53, 2000, 0.3));
_map.Add(new MapPoint(63, 2000, 0.1462));
_map.Add(new MapPoint(68, 2000, 0.692));
_map.Add(new MapPoint(125, 2000, 0.0));
_map.Add(new MapPoint(136, 2000, 0.0));
_map.Add(new MapPoint(10, 4000, 0.64));
_map.Add(new MapPoint(27, 4000, 0.6721));
_map.Add(new MapPoint(53, 4000, 0.7211));
_map.Add(new MapPoint(63, 4000, 0.74));
_map.Add(new MapPoint(68, 4000, 0.7352));
_map.Add(new MapPoint(125, 4000, 0.68));
_map.Add(new MapPoint(136, 4000, 0.6694));
_map.Add(new MapPoint(10, 6000, 0.53));
_map.Add(new MapPoint(27, 6000, 0.5798));
_map.Add(new MapPoint(53, 6000, 0.656));
_map.Add(new MapPoint(63, 6000, 0.6853));
_map.Add(new MapPoint(68, 6000, 0.7));
_map.Add(new MapPoint(125, 6000, 0.6329));
_map.Add(new MapPoint(136, 6000, 0.62));
_map.Add(new MapPoint(10, 7000, 0.475));
_map.Add(new MapPoint(27, 7000, 0.5337));
_map.Add(new MapPoint(53, 7000, 0.6235));
_map.Add(new MapPoint(63, 7000, 0.658));
_map.Add(new MapPoint(68, 7000, 0.6824));
_map.Add(new MapPoint(125, 7000, 0.6094));
_map.Add(new MapPoint(136, 7000, 0.5953));
}
private void getMapRanges() private void getMapRanges()
{ {
;/* ;/*
...@@ -189,7 +148,7 @@ Input: ...@@ -189,7 +148,7 @@ Input:
_xRange = (From coords As MapPoint In _map Order By coords.x Select coords.x Distinct).ToList() _xRange = (From coords As MapPoint In _map Order By coords.x Select coords.x Distinct).ToList()
*/ */
_yRange = _map.Select(x => x.Y).Distinct().OrderBy(x => x).ToList(); _yRange = _map.Select(x => x.Y).Distinct().OrderBy(x => x).ToList();
_xRange = _map.Select(x => x.x).Distinct().OrderBy(x => x).ToList(); _xRange = _map.Select(x => x.X).Distinct().OrderBy(x => x).ToList();
_minX = _xRange.First(); _minX = _xRange.First();
_maxX = _xRange.Last(); _maxX = _xRange.Last();
...@@ -198,7 +157,7 @@ Input: ...@@ -198,7 +157,7 @@ Input:
} }
// Single entry point to determine Value on map // Single entry point to determine Value on map
public double GetValue(double x, double y) public double GetValue(PerSecond x, Ampere y)
{ {
if (x < _minX || x > _maxX || y < _minY || y > _maxY) { if (x < _minX || x > _maxX || y < _minY || y > _maxY) {
...@@ -206,26 +165,33 @@ Input: ...@@ -206,26 +165,33 @@ Input:
// Limiting // Limiting
if (x < _minX) if (x < _minX) {
x = _minX; x = _minX;
if (x > _maxX) }
if (x > _maxX) {
x = _maxX; x = _maxX;
if (y < _minY) }
if (y < _minY) {
y = _minY; y = _minY;
if (y > _maxY) }
if (y > _maxY) {
y = _maxY; y = _maxY;
} }
}
// Satisfies both data points - non interpolated value // Satisfies both data points - non interpolated value
if (ONBoundaryXY(x, y)) if (ONBoundaryXY(x, y)) {
return GetOnBoundaryXY(x, y); return GetOnBoundaryXY(x, y);
}
// Satisfies only x or y - single interpolation value // Satisfies only x or y - single interpolation value
if (OnBoundaryXInterpolatedY(x, y)) if (OnBoundaryXInterpolatedY(x, y)) {
return GetOnBoundaryXInterpolatedY(x, y); return GetOnBoundaryXInterpolatedY(x, y);
if (OnBoundaryYInterpolatedX(x, y)) }
if (OnBoundaryYInterpolatedX(x, y)) {
return GetOnBoundaryYInterpolatedX(x, y); return GetOnBoundaryYInterpolatedX(x, y);
}
// satisfies no data points - Bi-Linear interpolation // satisfies no data points - Bi-Linear interpolation
return GetBiLinearInterpolatedValue(x, y); return GetBiLinearInterpolatedValue(x, y);
...@@ -246,39 +212,39 @@ Input: ...@@ -246,39 +212,39 @@ Input:
sb.AppendLine(""); sb.AppendLine("");
sb.AppendLine("Four Corners with interpolated other"); sb.AppendLine("Four Corners with interpolated other");
sb.AppendLine("-------------------"); sb.AppendLine("-------------------");
var x = 1500.0; var x = 1500.0.RPMtoRad();
var y = 18.5; var y = 18.5.SI<Ampere>();
sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y)));
x = 7000; x = 7000.RPMtoRad();
y = 96.5; y = 96.5.SI<Ampere>();
sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y)));
x = 1750; x = 1750.RPMtoRad();
y = 10; y = 10.SI<Ampere>();
sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y)));
x = 6500; x = 6500.RPMtoRad();
y = 10; y = 10.SI<Ampere>();
sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y)));
sb.AppendLine(""); sb.AppendLine("");
sb.AppendLine("Interpolated both"); sb.AppendLine("Interpolated both");
sb.AppendLine("-------------------"); sb.AppendLine("-------------------");
double mx, my; //double mx, my;
int x2, y2; int x2, y2;
for (x2 = 0; x2 <= _xRange.Count - 2; x2++) { for (x2 = 0; x2 <= _xRange.Count - 2; x2++) {
for (y2 = 0; y2 <= _yRange.Count - 2; y2++) { for (y2 = 0; y2 <= _yRange.Count - 2; y2++) {
mx = _xRange[x2] + (_xRange[x2 + 1] - _xRange[x2]) / 2; var mx = _xRange[x2] + (_xRange[x2 + 1] - _xRange[x2]) / 2;
my = _yRange[y2] + (_yRange[y2 + 1] - _yRange[y2]) / 2; var my = _yRange[y2] + (_yRange[y2 + 1] - _yRange[y2]) / 2;
sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", mx, my, GetValue(mx, my))); sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", mx.AsRPM, my.Value(), GetValue(mx, my)));
} }
} }
sb.AppendLine(""); sb.AppendLine("");
sb.AppendLine("MIKE -> 40 & 1000"); sb.AppendLine("MIKE -> 40 & 1000");
sb.AppendLine("-------------------"); sb.AppendLine("-------------------");
x = 1000; x = 1000.RPMtoRad();
y = 40; y = 40.SI<Ampere>();
sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y)));
...@@ -297,22 +263,22 @@ Input: ...@@ -297,22 +263,22 @@ Input:
private class MapPoint private class MapPoint
{ {
public double Y; public Ampere Y;
public double x; public PerSecond X;
public double v; public double V;
public MapPoint(double y, double x, double v) public MapPoint(Ampere y, PerSecond x, double v)
{ {
this.Y = y; Y = y;
this.x = x; X = x;
this.v = v; V = v;
} }
} }
// Get Alternator Efficiency // Get Alternator Efficiency
public AlternatorMapValues GetEfficiency(double rpm, Ampere amps) public AlternatorMapValues GetEfficiency(PerSecond rpm, Ampere amps)
{ {
return new AlternatorMapValues(GetValue(rpm, amps.Value())); return new AlternatorMapValues(GetValue(rpm, amps));
} }
// Initialises the map. // Initialises the map.
...@@ -345,7 +311,7 @@ Input: ...@@ -345,7 +311,7 @@ Input:
// add values to map // add values to map
// Create AlternatorKey // Create AlternatorKey
var newPoint = new MapPoint(float.Parse(elements[0], CultureInfo.InvariantCulture), float.Parse(elements[1], CultureInfo.InvariantCulture), float.Parse(elements[2], CultureInfo.InvariantCulture)); var newPoint = new MapPoint(elements[0].ToDouble().SI<Ampere>(), elements[1].ToDouble().RPMtoRad(), elements[2].ToDouble());
_map.Add(newPoint); _map.Add(newPoint);
} }
firstline = false; firstline = false;
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics;
namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics
...@@ -17,19 +18,19 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -17,19 +18,19 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
public double PulleyRatio { get; set; } public double PulleyRatio { get; set; }
// C10-D15 // C10-D15
public List<AltUserInput> InputTable2000 { get; set; } = new List<AltUserInput>(); public List<AltUserInput<Ampere>> InputTable2000 { get; set; } = new List<AltUserInput<Ampere>>();
// F10-G15 // F10-G15
public List<AltUserInput> InputTable4000 { get; set; } = new List<AltUserInput>(); public List<AltUserInput<Ampere>> InputTable4000 { get; set; } = new List<AltUserInput<Ampere>>();
// I10-J15 // I10-J15
public List<AltUserInput> InputTable6000 { get; set; } = new List<AltUserInput>(); public List<AltUserInput<Ampere>> InputTable6000 { get; set; } = new List<AltUserInput<Ampere>>();
// M10-N15 // M10-N15
public List<Table4Row> RangeTable { get; set; } = new List<Table4Row>(); public List<Table4Row> RangeTable { get; set; } = new List<Table4Row>();
// S9 // S9
public double SpindleSpeed public PerSecond SpindleSpeed
{ {
get { return signals.CrankRPM * PulleyRatio; } get { return signals.CrankRPM * PulleyRatio; }
} }
...@@ -43,9 +44,9 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -43,9 +44,9 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
CalculateRangeTable(); CalculateRangeTable();
// Calculate ( Interpolate ) Efficiency // Calculate ( Interpolate ) Efficiency
var range = RangeTable.Select(s => new AltUserInput(s.RPM, s.Efficiency)).ToList(); var range = RangeTable.Select(s => new AltUserInput<PerSecond>(s.RPM, s.Efficiency)).ToList();
return Alternator.Iterpolate(range, Convert.ToSingle(SpindleSpeed)); return Alternator.Iterpolate(range, SpindleSpeed);
} }
} }
...@@ -63,14 +64,14 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -63,14 +64,14 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
AlternatorName = inputs.First().AlternatorName; AlternatorName = inputs.First().AlternatorName;
PulleyRatio = inputs.First().PulleyRatio; PulleyRatio = inputs.First().PulleyRatio;
var values2k = inputs.Where(x => x.RPM == 2000) var values2k = inputs.Where(x => x.RPM.AsRPM.IsEqual(2000))
.Select(x => new KeyValuePair<double, double>(x.Amps, x.Efficiency)) .Select(x => new KeyValuePair<Ampere, double>(x.Amps, x.Efficiency))
.ToDictionary(x => x.Key, x => x.Value); .ToDictionary(x => x.Key, x => x.Value);
var values4k = inputs.Where(x => x.RPM == 4000) var values4k = inputs.Where(x => x.RPM.AsRPM.IsEqual(4000))
.Select(x => new KeyValuePair<double, double>(x.Amps, x.Efficiency)) .Select(x => new KeyValuePair<Ampere, double>(x.Amps, x.Efficiency))
.ToDictionary(x => x.Key, x => x.Value); .ToDictionary(x => x.Key, x => x.Value);
var values6k = inputs.Where(x => x.RPM == 6000) var values6k = inputs.Where(x => x.RPM.AsRPM.IsEqual(6000))
.Select(x => new KeyValuePair<double, double>(x.Amps, x.Efficiency)) .Select(x => new KeyValuePair<Ampere, double>(x.Amps, x.Efficiency))
.ToDictionary(x => x.Key, x => x.Value); .ToDictionary(x => x.Key, x => x.Value);
BuildInputTable(values2k, InputTable2000); BuildInputTable(values2k, InputTable2000);
...@@ -80,7 +81,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -80,7 +81,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
CreateRangeTable(); CreateRangeTable();
} }
public static double Iterpolate(List<AltUserInput> values, double x) public static double Iterpolate<T>(List<AltUserInput<T>> values, T x) where T:SI
{ {
var lowestX = values.Min(m => m.Amps); var lowestX = values.Min(m => m.Amps);
var highestX = values.Max(m => m.Amps); var highestX = values.Max(m => m.Amps);
...@@ -106,10 +107,8 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -106,10 +107,8 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
var deltaX = postKey - preKey; var deltaX = postKey - preKey;
var deltaEff = postEff - preEff; var deltaEff = postEff - preEff;
// slopes
var effSlope = deltaEff / deltaX;
var retVal = ((x - preKey) * effSlope) + preEff; var retVal = ((x - preKey) / deltaX).Value() * deltaEff + preEff;
return retVal; return retVal;
} }
...@@ -124,155 +123,147 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -124,155 +123,147 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
// M15=Row5-Rpm - N15=Row5-Eff // M15=Row5-Rpm - N15=Row5-Eff
// M16=Row6-Rpm - N16=Row6-Eff // M16=Row6-Rpm - N16=Row6-Eff
double N10, N11, N12, N13, N14, N15, N16;
double M10, M11, M12, M13, M14, M15, M16;
// EFFICIENCY // EFFICIENCY
// 2000 // 2000
N12 = Alternator.Iterpolate(InputTable2000, signals.CurrentDemandAmps.Value()); var N12 = Alternator.Iterpolate(InputTable2000, signals.CurrentDemandAmps);
RangeTable[2].Efficiency = N12; RangeTable[2].Efficiency = N12;
// 4000 // 4000
N13 = Alternator.Iterpolate(InputTable4000, signals.CurrentDemandAmps.Value()); var N13 = Alternator.Iterpolate(InputTable4000, signals.CurrentDemandAmps);
RangeTable[3].Efficiency = N13; RangeTable[3].Efficiency = N13;
// 6000 // 6000
N14 = Alternator.Iterpolate(InputTable6000, signals.CurrentDemandAmps.Value()); var N14 = Alternator.Iterpolate(InputTable6000, signals.CurrentDemandAmps);
RangeTable[4].Efficiency = N14; RangeTable[4].Efficiency = N14;
// Row0 & Row1 Efficiency =IF(N13>N12,0,MAX(N12:N14)) - Example Alt 1 N13= // Row0 & Row1 Efficiency =IF(N13>N12,0,MAX(N12:N14)) - Example Alt 1 N13=
N11 = N13 > N12 ? 0 : Math.Max(Math.Max(N12, N13), N14); var N11 = N13 > N12 ? 0 : Math.Max(Math.Max(N12, N13), N14);
RangeTable[1].Efficiency = N11; RangeTable[1].Efficiency = N11;
N10 = N11; var N10 = N11;
RangeTable[0].Efficiency = N10; RangeTable[0].Efficiency = N10;
// Row 5 Efficiency // Row 5 Efficiency
N15 = N13 > N14 ? 0 : Math.Max(Math.Max(N12, N13), N14); var N15 = N13 > N14 ? 0 : Math.Max(Math.Max(N12, N13), N14);
RangeTable[5].Efficiency = N15; RangeTable[5].Efficiency = N15;
// Row 6 - Efficiency // Row 6 - Efficiency
N16 = N15; var N16 = N15;
RangeTable[6].Efficiency = N16; RangeTable[6].Efficiency = N16;
// RPM // RPM
// 2000 Row 2 - RPM // 2000 Row 2 - RPM
M12 = 2000; var M12 = 2000.RPMtoRad();
RangeTable[2].RPM = M12; RangeTable[2].RPM = M12;
// 4000 Row 3 - RPM // 4000 Row 3 - RPM
M13 = 4000; var M13 = 4000.RPMtoRad();
RangeTable[3].RPM = M13; RangeTable[3].RPM = M13;
// 6000 Row 4 - RPM // 6000 Row 4 - RPM
M14 = 6000; var M14 = 6000.RPMtoRad();
RangeTable[4].RPM = M14; RangeTable[4].RPM = M14;
// Row 1 - RPM // Row 1 - RPM
// NOTE: Update to reflect CombineALternatorSchematicV02 20150429 // NOTE: Update to reflect CombineALternatorSchematicV02 20150429
// IF(M12=IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11)), M12-0.01, IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11))) // IF(M12=IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11)), M12-0.01, IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11)))
M11 = var M11 = N12 - N13 == 0
Convert.ToSingle( ? 0.RPMtoRad()
N12 - N13 == 0
? 0
: ( : (
M12 == (N12 > N13 M12 == (N12 > N13
? M12 - (M12 - M13) / (N12 - N13) * (N12 - N11) ? M12 - (M12 - M13) / (N12 - N13) * (N12 - N11)
: M12 - (M12 - M13) / (N12 - N13) * (N12 - N11)) : M12 - (M12 - M13) / (N12 - N13) * (N12 - N11))
? M12 - 0.01 ? M12 - 0.01.RPMtoRad()
: (N12 > N13 : (N12 > N13
? M12 - (M12 - M13) / (N12 - N13) * (N12 - N11) ? M12 - (M12 - M13) / (N12 - N13) * (N12 - N11)
: M12 - (M12 - M13) / (N12 - N13) * (N12 - N11)))); : M12 - (M12 - M13) / (N12 - N13) * (N12 - N11)));
RangeTable[1].RPM = M11; RangeTable[1].RPM = M11;
// Row 0 - RPM // Row 0 - RPM
M10 = M11 < 1500 ? M11 - 1 : 1500; var M10 = M11 < 1500 ? M11 - 1.RPMtoRad() : 1500.RPMtoRad();
RangeTable[0].RPM = M10; RangeTable[0].RPM = M10;
// Row 5 - RPM // Row 5 - RPM
M15 = var M15 = M14 == (N14 == 0 || N14 == N13
Convert.ToSingle( ? M14 + 1.RPMtoRad()
M14 == (N14 == 0 || N14 == N13
? M14 + 1
: (N13 > N14 ? (M14 - M13) / (N13 - N14) * N14 + M14 : (M14 - M13) / (N13 - N14) * (N14 - N15) + M14) : (N13 > N14 ? (M14 - M13) / (N13 - N14) * N14 + M14 : (M14 - M13) / (N13 - N14) * (N14 - N15) + M14)
) )
? M14 + 0.01 ? M14 + 0.01.RPMtoRad()
: (N14 == 0 || N14 == N13 : (N14 == 0 || N14 == N13
? M14 + 1 ? M14 + 1.RPMtoRad()
: (N13 > N14 ? (M14 - M13) / (N13 - N14) * N14 + M14 : (M14 - M13) / (N13 - N14) * (N14 - N15) + M14))); : (N13 > N14 ? (M14 - M13) / (N13 - N14) * N14 + M14 : (M14 - M13) / (N13 - N14) * (N14 - N15) + M14));
RangeTable[5].RPM = M15; RangeTable[5].RPM = M15;
// Row 6 - RPM // Row 6 - RPM
M16 = M15 > 10000 ? M15 + 1 : 10000; var M16 = M15 > 10000 ? M15 + 1.RPMtoRad() : 10000.RPMtoRad();
RangeTable[6].RPM = M16; RangeTable[6].RPM = M16;
} }
private void InitialiseRangeTable() private void InitialiseRangeTable()
{ {
RangeTable[0].RPM = 0; RangeTable[0].RPM = 0.RPMtoRad();
RangeTable[0].Efficiency = 0;
RangeTable[1].RPM = 0;
RangeTable[0].Efficiency = 0;
RangeTable[2].RPM = 2000;
RangeTable[0].Efficiency = 0;
RangeTable[3].RPM = 4000;
RangeTable[0].Efficiency = 0;
RangeTable[4].RPM = 6000;
RangeTable[0].Efficiency = 0;
RangeTable[5].RPM = 0;
RangeTable[0].Efficiency = 0;
RangeTable[6].RPM = 0;
RangeTable[0].Efficiency = 0; RangeTable[0].Efficiency = 0;
RangeTable[1].RPM = 0.RPMtoRad();
RangeTable[1].Efficiency = 0;
RangeTable[2].RPM = 2000.RPMtoRad();
RangeTable[2].Efficiency = 0;
RangeTable[3].RPM = 4000.RPMtoRad();
RangeTable[3].Efficiency = 0;
RangeTable[4].RPM = 6000.RPMtoRad();
RangeTable[4].Efficiency = 0;
RangeTable[5].RPM = 0.RPMtoRad();
RangeTable[5].Efficiency = 0;
RangeTable[6].RPM = 0.RPMtoRad();
RangeTable[6].Efficiency = 0;
} }
private void CreateRangeTable() private void CreateRangeTable()
{ {
RangeTable.Clear(); RangeTable.Clear();
RangeTable.Add(new Table4Row(0, 0)); RangeTable.Add(new Table4Row(0.RPMtoRad(), 0));
RangeTable.Add(new Table4Row(0, 0)); RangeTable.Add(new Table4Row(0.RPMtoRad(), 0));
RangeTable.Add(new Table4Row(0, 0)); RangeTable.Add(new Table4Row(0.RPMtoRad(), 0));
RangeTable.Add(new Table4Row(0, 0)); RangeTable.Add(new Table4Row(0.RPMtoRad(), 0));
RangeTable.Add(new Table4Row(0, 0)); RangeTable.Add(new Table4Row(0.RPMtoRad(), 0));
RangeTable.Add(new Table4Row(0, 0)); RangeTable.Add(new Table4Row(0.RPMtoRad(), 0));
RangeTable.Add(new Table4Row(0, 0)); RangeTable.Add(new Table4Row(0.RPMtoRad(), 0));
} }
public void BuildInputTable(Dictionary<double, double> inputs, List<AltUserInput> targetTable) public void BuildInputTable(Dictionary<Ampere, double> inputs, List<AltUserInput<Ampere>> targetTable)
{ {
double C11, C12, C13, C14, C15, D11, D12, D13, D14, D15;
targetTable.Clear(); targetTable.Clear();
// Row0 // Row0
D14 = 0; var D14 = 0.0;
targetTable.Add(new AltUserInput(0, D14)); targetTable.Add(new AltUserInput<Ampere>(0.SI<Ampere>(), D14));
// Row1 // Row1
targetTable.Add(new AltUserInput(inputs.OrderBy(x => x.Key).First().Key, inputs.OrderBy(x => x.Key).First().Value)); targetTable.Add(new AltUserInput<Ampere>(inputs.OrderBy(x => x.Key).First().Key, inputs.OrderBy(x => x.Key).First().Value));
// Row2 // Row2
targetTable.Add( targetTable.Add(
new AltUserInput(inputs.OrderBy(x => x.Key).Skip(1).First().Key, inputs.OrderBy(x => x.Key).Skip(1).First().Value)); new AltUserInput<Ampere>(inputs.OrderBy(x => x.Key).Skip(1).First().Key, inputs.OrderBy(x => x.Key).Skip(1).First().Value));
// Row3 // Row3
targetTable.Add( targetTable.Add(
new AltUserInput(inputs.OrderBy(x => x.Key).Skip(2).First().Key, inputs.OrderBy(x => x.Key).Skip(2).First().Value)); new AltUserInput<Ampere>(inputs.OrderBy(x => x.Key).Skip(2).First().Key, inputs.OrderBy(x => x.Key).Skip(2).First().Value));
C11 = targetTable[1].Amps; var C11 = targetTable[1].Amps;
C12 = targetTable[2].Amps; var C12 = targetTable[2].Amps;
C13 = targetTable[3].Amps; var C13 = targetTable[3].Amps;
D11 = targetTable[1].Eff; var D11 = targetTable[1].Eff;
D12 = targetTable[2].Eff; var D12 = targetTable[2].Eff;
D13 = targetTable[3].Eff; var D13 = targetTable[3].Eff;
D14 = D12 > D13 ? 0 : Math.Max(Math.Max(D11, D12), D13); D14 = D12 > D13 ? 0 : Math.Max(Math.Max(D11, D12), D13);
// Row4 - Eff // Row4 - Eff
targetTable.Add(new AltUserInput(0, D14)); targetTable.Add(new AltUserInput<Ampere>(0.SI<Ampere>(), D14));
// Row4 - Amps // Row4 - Amps
// Should probably refactor this into some sort of helper/extension method // Should probably refactor this into some sort of helper/extension method
...@@ -280,17 +271,17 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -280,17 +271,17 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
var maxD11_D13 = numarray.Max(); var maxD11_D13 = numarray.Max();
// =IF(OR(D13=0,D13=D12),C13+1,IF(D12>D13,((((C13-C12)/(D12-D13))*D13)+C13),((((C13-C12)/(D12-D13))*(D13-D14))+C13))) // =IF(OR(D13=0,D13=D12),C13+1,IF(D12>D13,((((C13-C12)/(D12-D13))*D13)+C13),((((C13-C12)/(D12-D13))*(D13-D14))+C13)))
C14 = (D13 == 0 || D13 == D12 || D13 == maxD11_D13) var C14 = (D13 == 0 || D13 == D12 || D13 == maxD11_D13)
? C13 + 1 ? C13 + 1.SI<Ampere>()
: D12 > D13 : D12 > D13
? ((((C13 - C12) / (D12 - D13)) * D13) + C13) ? ((((C13 - C12) / (D12 - D13)) * D13) + C13)
: ((((C13 - C12) / (D12 - D13)) * (D13 - D14)) + C13); : ((((C13 - C12) / (D12 - D13)) * (D13 - D14)) + C13);
targetTable[4].Amps = C14; targetTable[4].Amps = C14;
// Row5 // Row5
C15 = C14 > 200 ? C14 + 1 : 200; var C15 = C14 > 200 ? C14 + 1.SI<Ampere>() : 200.SI<Ampere>();
D15 = D14; var D15 = D14;
targetTable.Add(new AltUserInput(C15, D15)); targetTable.Add(new AltUserInput<Ampere>(C15, D15));
// Row0 // Row0
targetTable[0].Eff = D11; targetTable[0].Eff = D11;
......
...@@ -22,7 +22,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -22,7 +22,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
private AlternatorMapValues AverageAlternatorsEfficiency; private AlternatorMapValues AverageAlternatorsEfficiency;
// Interface Implementation // Interface Implementation
public AlternatorMapValues GetEfficiency(double CrankRPM, Ampere Amps) public AlternatorMapValues GetEfficiency(PerSecond CrankRPM, Ampere Amps)
{ {
altSignals.CrankRPM = CrankRPM; altSignals.CrankRPM = CrankRPM;
altSignals.CurrentDemandAmps = (Amps.Value() / (double)Alternators.Count).SI<Ampere>(); altSignals.CurrentDemandAmps = (Amps.Value() / (double)Alternators.Count).SI<Ampere>();
...@@ -126,29 +126,29 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -126,29 +126,29 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
{ {
map.Clear(); map.Clear();
map.Add(new CombinedAlternatorMapRow("Alt1", 2000, 10, 62, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 2000.RPMtoRad(), 10.SI<Ampere>(), 62, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 2000, 27, 70, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 2000.RPMtoRad(), 27.SI<Ampere>(), 70, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 2000, 53, 30, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 2000.RPMtoRad(), 53.SI<Ampere>(), 30, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 4000, 10, 64, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 4000.RPMtoRad(), 10.SI<Ampere>(), 64, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 4000, 63, 74, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 4000.RPMtoRad(), 63.SI<Ampere>(), 74, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 4000, 125, 68, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 4000.RPMtoRad(), 125.SI<Ampere>(), 68, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 6000, 10, 53, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 6000.RPMtoRad(), 10.SI<Ampere>(), 53, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 6000, 68, 70, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 6000.RPMtoRad(), 68.SI<Ampere>(), 70, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt1", 6000, 136, 62, 3.6)); map.Add(new CombinedAlternatorMapRow("Alt1", 6000.RPMtoRad(), 136.SI<Ampere>(), 62, 3.6));
map.Add(new CombinedAlternatorMapRow("Alt2", 2000, 10, 62, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 2000.RPMtoRad(), 10.SI<Ampere>(), 62, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 2000, 27, 70, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 2000.RPMtoRad(), 27.SI<Ampere>(), 70, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 2000, 53, 30, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 2000.RPMtoRad(), 53.SI<Ampere>(), 30, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 4000, 10, 64, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 4000.RPMtoRad(), 10.SI<Ampere>(), 64, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 4000, 63, 74, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 4000.RPMtoRad(), 63.SI<Ampere>(), 74, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 4000, 125, 68, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 4000.RPMtoRad(), 125.SI<Ampere>(), 68, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 6000, 10, 53, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 6000.RPMtoRad(), 10.SI<Ampere>(), 53, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 6000, 68, 70, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 6000.RPMtoRad(), 68.SI<Ampere>(), 70, 3));
map.Add(new CombinedAlternatorMapRow("Alt2", 6000, 136, 62, 3)); map.Add(new CombinedAlternatorMapRow("Alt2", 6000.RPMtoRad(), 136.SI<Ampere>(), 62, 3));
} }
// Grid Management // Grid Management
...@@ -222,7 +222,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -222,7 +222,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
for (var row = 1; row <= 3; row++) { for (var row = 1; row <= 3; row++) {
var amps = alt.InputTable2000[row].Amps; var amps = alt.InputTable2000[row].Amps;
var eff = alt.InputTable2000[row].Eff; var eff = alt.InputTable2000[row].Eff;
sb.Append(alt.AlternatorName + ",2000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")); sb.Append(alt.AlternatorName + ",2000," + amps.Value().ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000"));
sb.AppendLine(""); sb.AppendLine("");
} }
...@@ -230,7 +230,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -230,7 +230,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
for (var row = 1; row <= 3; row++) { for (var row = 1; row <= 3; row++) {
var amps = alt.InputTable4000[row].Amps; var amps = alt.InputTable4000[row].Amps;
var eff = alt.InputTable4000[row].Eff; var eff = alt.InputTable4000[row].Eff;
sb.Append(alt.AlternatorName + ",4000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")); sb.Append(alt.AlternatorName + ",4000," + amps.Value().ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000"));
sb.AppendLine(""); sb.AppendLine("");
} }
...@@ -238,7 +238,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -238,7 +238,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
for (var row = 1; row <= 3; row++) { for (var row = 1; row <= 3; row++) {
var amps = alt.InputTable6000[row].Amps; var amps = alt.InputTable6000[row].Amps;
var eff = alt.InputTable6000[row].Eff; var eff = alt.InputTable6000[row].Eff;
sb.Append(alt.AlternatorName + ",6000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")); sb.Append(alt.AlternatorName + ",6000," + amps.Value().ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000"));
sb.AppendLine(""); sb.AppendLine("");
} }
} }
...@@ -297,7 +297,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -297,7 +297,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
throw new ArgumentException("Incorrect number of values in csv file"); throw new ArgumentException("Incorrect number of values in csv file");
// add values to map // add values to map
map.Add(new CombinedAlternatorMapRow(elements[0], float.Parse(elements[1], CultureInfo.InvariantCulture), float.Parse(elements[2], CultureInfo.InvariantCulture), float.Parse(elements[3], CultureInfo.InvariantCulture), float.Parse(elements[4], CultureInfo.InvariantCulture))); map.Add(new CombinedAlternatorMapRow(elements[0], elements[1].ToDouble().RPMtoRad(), elements[2].ToDouble().SI<Ampere>(), float.Parse(elements[3], CultureInfo.InvariantCulture), elements[4].ToDouble()));
} else { } else {
firstline = false; firstline = false;
} }
...@@ -337,11 +337,11 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -337,11 +337,11 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
sb.AppendLine("Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab); sb.AppendLine("Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab);
sb.AppendLine(""); sb.AppendLine("");
for (i = 1; i <= 3; i++) { for (i = 1; i <= 3; i++) {
a1 = alt.InputTable2000[i].Amps.ToString("0"); a1 = alt.InputTable2000[i].Amps.Value().ToString("0");
e1 = alt.InputTable2000[i].Eff.ToString("0.000"); e1 = alt.InputTable2000[i].Eff.ToString("0.000");
a2 = alt.InputTable4000[i].Amps.ToString("0"); a2 = alt.InputTable4000[i].Amps.Value().ToString("0");
e2 = alt.InputTable4000[i].Eff.ToString("0.000"); e2 = alt.InputTable4000[i].Eff.ToString("0.000");
a3 = alt.InputTable6000[i].Amps.ToString("0"); a3 = alt.InputTable6000[i].Amps.Value().ToString("0");
e3 = alt.InputTable6000[i].Eff.ToString("0.000"); e3 = alt.InputTable6000[i].Eff.ToString("0.000");
sb.AppendLine(a1 + vbTab + e1 + vbTab + a2 + vbTab + e2 + vbTab + a3 + vbTab + e3 + vbTab); sb.AppendLine(a1 + vbTab + e1 + vbTab + a2 + vbTab + e2 + vbTab + a3 + vbTab + e3 + vbTab);
} }
......
using System; using System;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics;
namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics
...@@ -9,8 +10,8 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -9,8 +10,8 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
public class CombinedAlternatorMapRow : ICombinedAlternatorMapRow public class CombinedAlternatorMapRow : ICombinedAlternatorMapRow
{ {
public string AlternatorName { get; set; } public string AlternatorName { get; set; }
public double RPM { get; set; } public PerSecond RPM { get; set; }
public double Amps { get; set; } public Ampere Amps { get; set; }
public double Efficiency { get; set; } public double Efficiency { get; set; }
public double PulleyRatio { get; set; } public double PulleyRatio { get; set; }
...@@ -19,7 +20,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -19,7 +20,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
{ {
} }
public CombinedAlternatorMapRow(string alternatorName, double rpm, double amps, double efficiency, double pulleyRatio) public CombinedAlternatorMapRow(string alternatorName, PerSecond rpm, Ampere amps, double efficiency, double pulleyRatio)
{ {
// Sanity Check // Sanity Check
......
...@@ -6,7 +6,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -6,7 +6,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
// Used by the CombinedAlternator class and any other related classes. // Used by the CombinedAlternator class and any other related classes.
public class CombinedAlternatorSignals : ICombinedAlternatorSignals public class CombinedAlternatorSignals : ICombinedAlternatorSignals
{ {
public double CrankRPM { get; set; } public PerSecond CrankRPM { get; set; }
public Ampere CurrentDemandAmps { get; set; } public Ampere CurrentDemandAmps { get; set; }
......
...@@ -70,7 +70,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -70,7 +70,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
get { get {
var baseCurrentDemandAmps = _electricalConsumersList.GetTotalAverageDemandAmps(false); var baseCurrentDemandAmps = _electricalConsumersList.GetTotalAverageDemandAmps(false);
var totalDemandAmps = baseCurrentDemandAmps + GetHVACElectricalPowerDemandAmps; var totalDemandAmps = baseCurrentDemandAmps + GetHVACElectricalPowerDemandAmps;
return _alternatorEfficiencyMap.GetEfficiency(_signals.EngineSpeed.AsRPM, totalDemandAmps).Efficiency; return _alternatorEfficiencyMap.GetEfficiency(_signals.EngineSpeed, totalDemandAmps).Efficiency;
} }
} }
......
...@@ -32,19 +32,19 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -32,19 +32,19 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
#region Implementation of IM5_SmartAlternatorSetGeneration #region Implementation of IM5_SmartAlternatorSetGeneration
public Watt AlternatorsGenerationPowerAtCrankIdleWatts() public Watt AlternatorsGenerationPowerAtCrankIdle()
{ {
return _m05.SmartIdleCurrent * _powerNetVoltage * return _m05.SmartIdleCurrent * _powerNetVoltage *
(1 / (_m05.AlternatorsEfficiencyIdleResultCard * _alternatorGearEfficiency)); (1 / (_m05.AlternatorsEfficiencyIdleResultCard * _alternatorGearEfficiency));
} }
public Watt AlternatorsGenerationPowerAtCrankTractionOnWatts() public Watt AlternatorsGenerationPowerAtCrankTractionOn()
{ {
return _m05.SmartTractionCurrent * _powerNetVoltage * return _m05.SmartTractionCurrent * _powerNetVoltage *
(1 / (_m05.AlternatorsEfficiencyTractionOnResultCard * _alternatorGearEfficiency)); (1 / (_m05.AlternatorsEfficiencyTractionOnResultCard * _alternatorGearEfficiency));
} }
public Watt AlternatorsGenerationPowerAtCrankOverrunWatts() public Watt AlternatorsGenerationPowerAtCrankOverrun()
{ {
return _m05.SmartOverrunCurrent * _powerNetVoltage * return _m05.SmartOverrunCurrent * _powerNetVoltage *
(1 / (_m05.AlternatorsEfficiencyOverrunResultCard * _alternatorGearEfficiency)); (1 / (_m05.AlternatorsEfficiencyOverrunResultCard * _alternatorGearEfficiency));
......
...@@ -78,7 +78,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -78,7 +78,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
public double AlternatorsEfficiencyIdleResultCard public double AlternatorsEfficiencyIdleResultCard
{ {
get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartIdleCurrent).Efficiency; } get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed, SmartIdleCurrent).Efficiency; }
} }
public Ampere SmartTractionCurrent public Ampere SmartTractionCurrent
...@@ -88,7 +88,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -88,7 +88,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
public double AlternatorsEfficiencyTractionOnResultCard public double AlternatorsEfficiencyTractionOnResultCard
{ {
get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartTractionCurrent).Efficiency; } get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed, SmartTractionCurrent).Efficiency; }
} }
public Ampere SmartOverrunCurrent public Ampere SmartOverrunCurrent
...@@ -98,7 +98,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ...@@ -98,7 +98,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
public double AlternatorsEfficiencyOverrunResultCard public double AlternatorsEfficiencyOverrunResultCard
{ {
get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartOverrunCurrent).Efficiency; } get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed, SmartOverrunCurrent).Efficiency; }
} }
#endregion #endregion
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment