diff --git a/HVACTOOL/Module1.vb b/HVACTOOL/Module1.vb index 948558c22abd03aef89430b183657a9f8646e17a..240793e7d2c6fb2f2e1cd1890fcf70156f9d1a4b 100644 --- a/HVACTOOL/Module1.vb +++ b/HVACTOOL/Module1.vb @@ -13,8 +13,8 @@ Sub main() Dim altSignals As New CombinedAlternatorSignals() - 'Dim frm As New frmHVACTool("BusDatabase.abdb", "ssm.ahsm") - Dim frm As New frmCombinedAlternators("ABCDEFG.aalt",altSignals) + Dim frm As New frmHVACTool("BusDatabase.abdb", "ssm.ahsm") + ' Dim frm As New frmCombinedAlternators("ABCDEFG.aalt",altSignals) frm.ShowDialog() diff --git a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb index bc0445269beadc0beb5bac994660f508de6c1f1b..b26b673c254447a2ac698f936a63582b23e1eec6 100644 --- a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb +++ b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb @@ -47,6 +47,8 @@ Public Class AdvancedAuxiliaries private WithEvents M11 As IM11 private WithEvents M12 As IM12 private WithEvents M13 As IM13 + Private WithEvents M14 As IM14 + private vectoDirectory As String 'Event Handler top level bubble. @@ -114,11 +116,18 @@ Public Class AdvancedAuxiliaries Dim ssmPath as string = FilePathUtils.ResolveFilePath(vectoDirectory,auxConfig.HvacUserInputsConfig.SSMFilePath) Dim BusDatabase as String = FilePathUtils.ResolveFilePath(vectoDirectory,auxConfig.HvacUserInputsConfig.BusDatabasePath) Dim ssmTool As New SSMTOOL( ssmPath) - If( ssmTool.Load(ssmPath)=False ) + + 'This duplicate SSM is being created for use in M14 as its properties will be dynamically changed at that point + 'to honour EngineWaste Heat Usage in Fueling calculations. + Dim ssmToolModule14 As New SSMTOOL( ssmPath) + + + If( ssmTool.Load(ssmPath)=False OrElse ssmToolModule14.Load(ssmPath)=False) Throw New Exception(String.Format("Unable to load the ssmTOOL with file {0}", ssmPath)) End If + M0 = New M0_NonSmart_AlternatorsSetEfficiency( auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, alternatorMap, @@ -169,6 +178,7 @@ Public Class AdvancedAuxiliaries M11 = New M11(M1,M3,M6,M8,fuelMap,Signals) M12 = New M12(M10, M11, Signals ) M13 = New M13(M1,M10,M12,Signals) + M14 = New M14(M13,ssmToolModule14, New HVACConstants(), Signals) End Sub @@ -267,10 +277,10 @@ End Sub Get If Not M13 is Nothing then - Return M13.TotalCycleFuelConsumptionGrams + Return M14.TotalCycleFCGrams Else - 'TODO:Issue a message + Return 0 End If @@ -281,12 +291,12 @@ End Sub Public ReadOnly Property TotalFuelLITRES As Single Implements VectoAuxiliaries.IAdvancedAuxiliaries.TotalFuelLITRES Get - If Not M13 is Nothing then + If Not M14 is Nothing then - Return M13.TotalCycleFuelConsumptionLitres + Return M14.TotalCycleFCLitres Else - 'TODO:Issue a message + Return 0 End If @@ -335,7 +345,8 @@ End Sub End Function - 'MOD + 'Dialgnostics outputs for testing purposes in Vecto. + 'Eventually this can be removed or rendered non effective to reduce calculation load on the model. Public ReadOnly Property AA_NonSmartAlternatorsEfficiency As Single? Implements IAdvancedAuxiliaries.AA_NonSmartAlternatorsEfficiency Get Return M0.AlternatorsEfficiency @@ -404,18 +415,16 @@ End Sub Public ReadOnly Property AA_TotalCycleFC_Grams As Single? Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Grams Get - Return M13.TotalCycleFuelConsumptionGrams + Return M14.TotalCycleFCGrams End Get End Property Public ReadOnly Property AA_TotalCycleFC_Litres As Single? Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Litres Get - Return M13.TotalCycleFuelConsumptionLitres + Return M14.TotalCycleFCLitres End Get End Property - - Public ReadOnly Property AuxiliaryPowerAtCrankWatts As Single Implements IAdvancedAuxiliaries.AuxiliaryPowerAtCrankWatts Get Return M8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries @@ -423,7 +432,6 @@ End Sub End Property - 'TODO:REMOVE WHEN TESTING IS COMPLETE 'PURE DIAGNOSTICS SHOULD ONLY BE USED IN MOD FOR ENGINEERING TESTS diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb index e97157f9bff0cb7626f25dfd3877889e5b66c87f..33cb7bfa44b61b9f1be766bf38ec315bb4a8dd28 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb @@ -24,15 +24,8 @@ Namespace DownstreamModules ''' <value></value> ''' <returns></returns> ''' <remarks>WHTC and Start Stop Adjusted</remarks> - ReadOnly Property TotalCycleFuelConsumptionGrams As Single + ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Single - ''' <summary> - ''' Total Cycle Fuel Consumption Litres - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>WHTC and Start Stop Adjusted</remarks> - ReadOnly Property TotalCycleFuelConsumptionLitres As Single End Interface diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM14.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM14.vb new file mode 100644 index 0000000000000000000000000000000000000000..db521cbf7f6622f2fd8ce904fe409e65ab3f3ac6 --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM14.vb @@ -0,0 +1,18 @@ + +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + +Public Interface IM14 + + Readonly property TotalCycleFCGrams as single + + ReadOnly Property TotalCycleFCLitres As single + + + +End Interface + +End Namespace diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb index 2a8d587ad70e78002087c06ba32ef8eb9b34ebb8..8d83147eebb1fd6fd8a53ee2fcfbdec71df324a2 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb @@ -46,26 +46,13 @@ End Property Return -Sum1+Sum3 End Get End Property - Private readonly Property Sum5 As Single - Get - Return ( m1.HVACFuelingLitresPerHour * ( signals.CurrentCycleTimeInSeconds/3600)) * FUEL_DENSITY_L3 - End Get -End Property - Private ReadOnly Property Sum6 As Single - Get - Return SW3 + Sum5 - End Get -End Property - Private ReadOnly Property Sum7 As Single - Get - Return Sum8/ FUEL_DENSITY_L3 - End Get -End Property + + 'Sums 5, 6 and 7 removed during V06 implementation of the model Private ReadOnly Property Sum8 As Single - Get - Return SW4 * sum6 - End Get -End Property + Get + Return SW4 * SW3 + End Get + End Property 'Internal Staging Switches Private readonly Property SW1 As Single @@ -100,16 +87,11 @@ End Property End Sub 'Public class outputs - Public ReadOnly Property TotalCycleFuelConsumptionGrams As Single Implements IM13.TotalCycleFuelConsumptionGrams + Public ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Single Implements IM13.WHTCTotalCycleFuelConsumptionGrams Get Return Sum8 End Get End Property - Public ReadOnly Property TotalCycleFuelConsumptionLitres As Single Implements IM13.TotalCycleFuelConsumptionLitres - Get - Return Sum7 - End Get - End Property End Class diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M14.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M14.vb new file mode 100644 index 0000000000000000000000000000000000000000..a5dd7004436f2d7b2acf15bf98f5bb84ccec62f5 --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M14.vb @@ -0,0 +1,95 @@ +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + +Public Class M14 + Implements IM14 + + + Private m13 As IM13 + Private signals As ISignals + Private constants As IHVACConstants + Private ssm As ISSMTOOL + + + Public Sub new ( m13 As IM13 , hvacSSM As ISSMTOOL, constants As IHVACConstants, signals As ISignals) + + If m13 is Nothing then Throw New ArgumentException("M14, No M13 Supplied in arguments") + If hvacSSM is Nothing then Throw New ArgumentException("M14, No SSMTOOL constants Supplied in arguments") + If constants is Nothing then Throw New ArgumentException("M14, No signals Supplied in arguments") + If signals is Nothing then Throw New ArgumentException("M14, No signals constants Supplied in arguments") + + + Me.m13 = m13 + Me.signals = signals + Me.constants = constants + Me.ssm= hvacSSM + + + End Sub + + 'Staging Calculations + Private ReadOnly Property S1 As Single + Get + Return m13.WHTCTotalCycleFuelConsumptionGrams * constants.DieselGCVJperGram + End Get + End Property + Private ReadOnly Property S2 As Single + Get + Return constants.FuelEnergyToHeatToCoolant * s1 + End Get + End Property + Private ReadOnly Property S3 As Single + Get + Return S2 * constants.CoolantHeatTransferredToAirCabinHeater + End Get + End Property + Private ReadOnly Property S4 As Single + Get + Return (S3 / signals.TotalCycleTimeSeconds )/1000 + End Get + End Property + + + Private ReadOnly Property S5 As Single + Get + Return signals.CurrentCycleTimeInSeconds/3600 + End Get + End Property + Private ReadOnly Property S6 As Single + Get + Return S5 * ssm.FuelPerHBaseAsjusted(S4) * constants.FuelDensity835GramsPerLitre + End Get + End Property + Private ReadOnly Property S7 As Single + Get + Return m13.WHTCTotalCycleFuelConsumptionGrams + s6 + End Get + End Property + + Private ReadOnly Property S8 As Single + Get + Return S7 / constants.FuelDensity835GramsPerLitre + End Get + End Property + Public ReadOnly Property TotalCycleFCGrams As Single Implements IM14.TotalCycleFCGrams + Get + Return S7 + End Get + End Property + + Public ReadOnly Property TotalCycleFCLitres As Single Implements IM14.TotalCycleFCLitres + Get + Return S8 + End Get + End Property + + + +End Class + + + +End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb index 8df7d654d167a4c3d278ea796b8f34f48380cb48..e972b3944570fbe3dc33ae9653624327ec0fd46a 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb @@ -43,7 +43,7 @@ Namespace Electrics _ElectricalPowerW= ssmHvac.ElectricalWAdjusted _MechanicalPowerW= ssmHvac.MechanicalWBaseAdjusted - _FuelingLPerH = ssmHvac.FuelLPerHBaseAdjusted + _FuelingLPerH = ssmHvac.FuelPerHBaseAdjusted diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb index ecbb05b1d2cf2a717802cbef0b44b601f9afccf0..fdeba396dd67221421830c95b7a6b8a714b17843 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb @@ -12,8 +12,32 @@ Namespace Hvac Public Class HVACConstants - - + Implements IHVACConstants + + + Public ReadOnly Property CoolantHeatTransferredToAirCabinHeater As Single Implements IHVACConstants.CoolantHeatTransferredToAirCabinHeater + Get + Return 0.75 + End Get + End Property + + Public ReadOnly Property DieselGCVJperGram As Single Implements IHVACConstants.DieselGCVJperGram + Get + Return 44800 + End Get + End Property + + Public ReadOnly Property FuelDensity835GramsPerLitre As Single Implements IHVACConstants.FuelDensity835GramsPerLitre + Get + Return 835 + End Get + End Property + + Public ReadOnly Property FuelEnergyToHeatToCoolant As Single Implements IHVACConstants.FuelEnergyToHeatToCoolant + Get + Return 0.2 + End Get + End Property End Class End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACConstants.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACConstants.vb new file mode 100644 index 0000000000000000000000000000000000000000..d8525d439d79ac46423f998528c1b31e4ed30d6c --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/Hvac/IHVACConstants.vb @@ -0,0 +1,18 @@ + +Namespace Hvac + + +Public Interface IHVACConstants + + readonly property FuelEnergyToHeatToCoolant as single + readonly property CoolantHeatTransferredToAirCabinHeater as single + readonly property DieselGCVJperGram as single + readonly property FuelDensity835GramsPerLitre as single + + +End Interface + + +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ISSMCalculate.vb b/VECTOAux/VectoAuxiliaries/Hvac/ISSMCalculate.vb index 0be483a35038208fd5bf89e42492f061a4574a3f..32327190e6afc9b7bfea0766c5035ef51cf5a187 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/ISSMCalculate.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/ISSMCalculate.vb @@ -8,11 +8,11 @@ ReadOnly Property ElectricalWBase As Single ReadOnly Property MechanicalWBase As Single - ReadOnly Property FuelLPerHBase As Single + ReadOnly Property FuelPerHBase As Single ReadOnly Property ElectricalWAdjusted As Single ReadOnly Property MechanicalWBaseAdjusted As Single - ReadOnly Property FuelLPerHBaseAdjusted As Single + ReadOnly Property FuelPerHBaseAdjusted As Single 'BaseValues diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ISSMTOOL.vb b/VECTOAux/VectoAuxiliaries/Hvac/ISSMTOOL.vb index f3f90394bfe3e47d50c85cc5401b29174f7f4daf..30e969ed7bea41c8afd45abf0a1bb248737b9805 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/ISSMTOOL.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/ISSMTOOL.vb @@ -11,11 +11,11 @@ Public Interface ISSMTOOL ReadOnly Property ElectricalWBase As Single ReadOnly Property MechanicalWBase As Single -ReadOnly Property FuelLPerHBase As Single +ReadOnly Property FuelPerHBase As Single ReadOnly Property ElectricalWAdjusted As Single ReadOnly Property MechanicalWBaseAdjusted As Single -ReadOnly Property FuelLPerHBaseAdjusted As Single +ReadOnly Property FuelPerHBaseAdjusted As Single Sub Clone(from As ISSMTOOL) @@ -27,6 +27,13 @@ Function Save(filePath As String) As Boolean Function IsEqualTo(source As ISSMTOOL) As Boolean +''' <summary> +''' This alters the waste heat and returns an adjusted fueling value +''' </summary> +''' <param name="AverageUseableEngineWasteHeatKW"></param> +''' <returns></returns> +''' <remarks></remarks> +Function FuelPerHBaseAsjusted( AverageUseableEngineWasteHeatKW As Single ) As Single diff --git a/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb index a912d715a426ca537dda9443b9afaffd8d223670..1eff8cc66d627310215202c2b03c21c5a30889f2 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb @@ -61,7 +61,7 @@ Namespace Hvac _ElectricalPowerW = ssm.ElectricalWAdjusted _MechanicalPowerW = ssm.MechanicalWBaseAdjusted - _FuelingLPerH = ssm.FuelLPerHBaseAdjusted + _FuelingLPerH = ssm.FuelPerHBaseAdjusted End Sub diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb index fc32c4ac15c7bf77d1d0ed67a00fd024b81dafb6..36039e4247caa16cd501092aca7161f14db3c3d6 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb @@ -51,7 +51,7 @@ Public Class SSMCalculate End Get End Property - Public ReadOnly Property FuelLPerHBase As Single Implements ISSMCalculate.FuelLPerHBase + Public ReadOnly Property FuelLPerHBase As Single Implements ISSMCalculate.FuelPerHBase Get '=ABS((J83/1000)*(1/(C36*C35))/C34) @@ -116,7 +116,7 @@ Public Class SSMCalculate End Get End Property - Public ReadOnly Property FuelLPerHBaseAdjusted As Single Implements ISSMCalculate.FuelLPerHBaseAdjusted + Public ReadOnly Property FuelLPerHBaseAdjusted As Single Implements ISSMCalculate.FuelPerHBaseAdjusted Get '=ABS((IF(AND(M79<0,M80<0),VLOOKUP(MAX(M79:M80),M79:P80,4),0)/1000)*(1/(C36*C35))/C34) diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMTOOL.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMTOOL.vb index 9450530676ff59861ec69a346b9520a5d75c8b2d..de86d2a8ad94aa1399bb8e1b3ea970608a8e011a 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMTOOL.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/SSMTOOL.vb @@ -11,6 +11,7 @@ Public Class SSMTOOL Implements ISSMTOOL + Private filePath As String Public Property GenInputs As ISSMGenInputs Implements ISSMTOOL.GenInputs Public Property TechList As ISSMTechList Implements ISSMTOOL.TechList @@ -27,9 +28,9 @@ Implements ISSMTOOL Return Calculate.MechanicalWBase End Get End Property - Public ReadOnly Property FuelLPerHBase As Single Implements ISSMTOOL.FuelLPerHBase + Public ReadOnly Property FuelPerHBase As Single Implements ISSMTOOL.FuelPerHBase Get - Return Calculate.FuelLPerHBase + Return Calculate.FuelPerHBase End Get End Property 'Adjusted Values @@ -43,9 +44,9 @@ Implements ISSMTOOL Return Calculate.MechanicalWBaseAdjusted End Get End Property - Public ReadOnly Property FuelLPerHBaseAdjusted As Single Implements ISSMTOOL.FuelLPerHBaseAdjusted + Public ReadOnly Property FuelPerHBaseAdjusted As Single Implements ISSMTOOL.FuelPerHBaseAdjusted Get - Return Calculate.FuelLPerHBaseAdjusted + Return Calculate.FuelPerHBaseAdjusted End Get End Property @@ -232,6 +233,16 @@ End Function End Function + Public Function FuelPerHBaseAsjusted(AverageUseableEngineWasteHeatKW As Single) As Single Implements ISSMTOOL.FuelPerHBaseAsjusted + + 'Set Engine Waste Heat + GenInputs.AH_EngineWasteHeatkW= AverageUseableEngineWasteHeatKW + Return FuelPerHBaseAdjusted + + End Function + + + End Class diff --git a/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb b/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb index 5b422cd05dd19b7bab5b3383b5e3d038be1e54ba..8e36048ca653bf90f01ef4677feb5470a0442526 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb @@ -1049,11 +1049,11 @@ End Sub txtBasElectrical.Text = ssmTOOL.ElectricalWBase txtBaseMechanical.Text = ssmTOOL.MechanicalWBase - txtBaseFuel.Text = ssmTOOL.FuelLPerHBase + txtBaseFuel.Text = ssmTOOL.FuelPerHBase txtAdjElectrical.Text = ssmTOOL.ElectricalWAdjusted txtAdjMechanical.Text = ssmTOOL.MechanicalWBaseAdjusted - txtAdjFuel.Text = ssmTOOL.FuelLPerHBaseAdjusted + txtAdjFuel.Text = ssmTOOL.FuelPerHBaseAdjusted If captureDiagnostics then diff --git a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj index 307f1880c663e8c1d388adc01feae70061fb6d6f..c2e461d598c0b086426f4a3685160d079be4b44b 100644 --- a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj +++ b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj @@ -97,6 +97,7 @@ <Compile Include="DownstreamModules\IM11.vb" /> <Compile Include="DownstreamModules\IM12.vb" /> <Compile Include="DownstreamModules\IM13.vb" /> + <Compile Include="DownstreamModules\IM14.vb" /> <Compile Include="DownstreamModules\IM6.vb" /> <Compile Include="DownstreamModules\IM7.vb" /> <Compile Include="DownstreamModules\IM8.vb" /> @@ -105,6 +106,7 @@ <Compile Include="DownstreamModules\M11.vb" /> <Compile Include="DownstreamModules\M12.vb" /> <Compile Include="DownstreamModules\M13.vb" /> + <Compile Include="DownstreamModules\M14.vb" /> <Compile Include="DownstreamModules\M7.vb" /> <Compile Include="DownstreamModules\M8.vb" /> <Compile Include="DownstreamModules\M9.vb" /> @@ -147,6 +149,7 @@ <Compile Include="Hvac\HVACUserInputsConfig.vb" /> <Compile Include="Hvac\IBus.vb" /> <Compile Include="Hvac\IBusDatabase.vb" /> + <Compile Include="Hvac\IHVACConstants.vb" /> <Compile Include="Hvac\IHVACSteadyStateModel.vb" /> <Compile Include="Hvac\IHVACUserInputsConfig.vb" /> <Compile Include="Hvac\IM1_AverageHVACLoadDemand.vb" /> diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb index 8fa47f55a1c0b119b71b28946bfd524df766b8f6..94316693e8643fb360e2781567e93a3c6b54b24a 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb @@ -17,11 +17,11 @@ Private Const FUEL_DENSITY_percm3 As Single = 0.835 '<TestCase(50, 60, 70, TRUE, TRUE ,100, 1,False, 72287.5f , 86.57185629f )> _ <Test()> _ -<TestCase(50, 60, 70, FALSE, FALSE,100, 1,False, 72287.5f , 86.57185629f )> _ -<TestCase(50, 60, 70, FALSE, TRUE ,100, 1,False, 72277.5f , 86.55988024f )> _ -<TestCase(50, 60, 70, TRUE, FALSE,100, 1,False, 72297.5f , 86.58383234f )> _ -<TestCase(50, 60, 70, TRUE, TRUE ,100, 1,False, 72287.5f , 86.57185629f )> _ -<TestCase(50, 60, 70, TRUE, TRUE ,100, 2,True, 144575.0f ,173.14371258f )> _ +<TestCase(50, 60, 70, FALSE, FALSE,100, 1,False, 60f , 86.57185629f )> _ +<TestCase(50, 60, 70, FALSE, TRUE ,100, 1,False, 50f , 86.55988024f )> _ +<TestCase(50, 60, 70, TRUE, FALSE,100, 1,False, 70f , 86.58383234f )> _ +<TestCase(50, 60, 70, TRUE, TRUE ,100, 1,False, 60f , 86.57185629f )> _ +<TestCase(50, 60, 70, TRUE, TRUE ,100, 2,True, 120f ,173.14371258f )> _ Public Sub InputOutputValues( IP1 As single, IP2 As single, IP3 As single, @@ -53,9 +53,9 @@ Signals.Setup ( Function(x) x.CurrentCycleTimeInSeconds) 'Act Dim target = New M13( m1.Object, m10.Object, M12.Object, Signals.Object) -'Assert -Assert.AreEqual( OUT1, target.TotalCycleFuelConsumptionGrams ) -Assert.AreEqual( OUT2, target.TotalCycleFuelConsumptionLitres ) + 'Assert + Assert.AreEqual( OUT1, target.WHTCTotalCycleFuelConsumptionGrams ) + End Sub End Class diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb new file mode 100644 index 0000000000000000000000000000000000000000..87fcb92670fed29991acac46f1797cb94dfd6de8 --- /dev/null +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb @@ -0,0 +1,125 @@ +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac +Imports VectoAuxiliaries.DownstreamModules +Imports NUnit.Framework +Imports VectoAuxiliaries +Imports Moq + + +Namespace UnitTests + + +'This implements the ISSMTOOL and returns 50% of the EngineHeatWaste as a Fueling Value +'for the purpose of this test. +public class SSMToolMock + implements ISSMTOOL + + + + Public Property Calculate As ISSMCalculate Implements ISSMTOOL.Calculate + + Public Sub Clone(from As ISSMTOOL) Implements ISSMTOOL.Clone + + End Sub + + Public ReadOnly Property ElectricalWAdjusted As Single Implements ISSMTOOL.ElectricalWAdjusted + Get + + End Get + End Property + + Public ReadOnly Property ElectricalWBase As Single Implements ISSMTOOL.ElectricalWBase + Get + + End Get + End Property + + Public ReadOnly Property FuelPerHBase As Single Implements ISSMTOOL.FuelPerHBase + Get + + End Get + End Property + + Public ReadOnly Property FuelPerHBaseAdjusted As Single Implements ISSMTOOL.FuelPerHBaseAdjusted + Get + + End Get + End Property + + Public Function FuelPerHBaseAsjusted(AverageUseableEngineWasteHeatKW As Single) As Single Implements ISSMTOOL.FuelPerHBaseAsjusted + + Return 0.5 * AverageUseableEngineWasteHeatKW + + End Function + + Public Property GenInputs As ISSMGenInputs Implements ISSMTOOL.GenInputs + + Public Function IsEqualTo(source As ISSMTOOL) As Boolean Implements ISSMTOOL.IsEqualTo + + End Function + + Public Function Load(filePath As String) As Boolean Implements ISSMTOOL.Load + + End Function + + Public ReadOnly Property MechanicalWBase As Single Implements ISSMTOOL.MechanicalWBase + Get + + End Get + End Property + + Public ReadOnly Property MechanicalWBaseAdjusted As Single Implements ISSMTOOL.MechanicalWBaseAdjusted + Get + + End Get + End Property + + Public Function Save(filePath As String) As Boolean Implements ISSMTOOL.Save + + End Function + + Public Property TechList As ISSMTechList Implements ISSMTOOL.TechList +End Class + + +<TestFixture()> _ +Public Class M14Tests + + <Test()> _ + Public sub ValuesTest() + + 'Arrange + Dim ip1 As Single = 1000f + Dim ip5 As Single = 3114 + Dim ip6 As Single = 1500 + + Dim expectedOut1 As Single=1375.40137 + Dim expectedOut2 As Single=1.64718723 + + Dim m13 As New Mock(Of IM13) + Dim hvacSSM As New Mock(Of ISSMTOOL) + Dim signals As new Mock( Of ISignals) + Dim ssmMock As ISSMTOOL = New SSMToolMock() + Dim constants As IHVACConstants = New HVACConstants() + + 'Moq' Arrangements + m13.Setup ( Function(x) x.WHTCTotalCycleFuelConsumptionGrams).Returns(ip1) + signals.Setup( Function(x) x.TotalCycleTimeSeconds) .Returns(ip5) + signals.Setup( Function(x) x.CurrentCycleTimeInSeconds) .Returns(1500) + + 'Act + Dim m14 As New M14(m13.Object,ssmMock,constants,signals.Object) + + 'Assert + Assert.AreEqual( expectedOut1, m14.TotalCycleFCGrams) + Assert.AreEqual( expectedOut2, m14.TotalCycleFCLitres) + + End sub + + +End Class + +End Namespace + + diff --git a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj index fdf5db6305cdf40cc387eae4d96b723cd7e7c235..a1e730700bf35eafdede713df9a20692b67a5fcb 100644 --- a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj +++ b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj @@ -121,6 +121,7 @@ <Compile Include="UnitTests\M13Tests.vb" /> <Compile Include="UnitTests\M12Tests.vb" /> <Compile Include="UnitTests\M11Tests.vb" /> + <Compile Include="UnitTests\M14Tests.vb" /> <Compile Include="UnitTests\M1_AverageHVACLoadDemandTests.vb" /> <Compile Include="UnitTests\M1_HVACAverageLoadDemandTests.vb" /> <Compile Include="UnitTests\M5_SmartAlternatorSetGenerationTests.vb" />