From 517ddb3abde4438ddca184c11249fdd6ddbe3546 Mon Sep 17 00:00:00 2001 From: "Burns, Terry" <Terry.Burns@ricardo.com> Date: Tue, 11 Nov 2014 09:22:35 +0000 Subject: [PATCH] Work In Progress Checkin git-tfs-id: [http://tfs00.element.root.com:8080/tfs/TFSCollection]$/VECTO;C1665 --- .../DownstreamModules/IFUEL.vb | 19 ++ .../VectoAuxiliaries/DownstreamModules/IM9.vb | 33 ++++ .../VectoAuxiliaries/DownstreamModules/M9.vb | 167 ++++++++++++++++++ .../VectoAuxiliaries/VectoAuxiliaries.vbproj | 4 + .../UnitTests/M9Tests.vb | 35 ++++ .../VectoAuxiliariesTests.vbproj | 1 + 6 files changed, 259 insertions(+) create mode 100644 VECTOAux/VectoAuxiliaries/DownstreamModules/IFUEL.vb create mode 100644 VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb create mode 100644 VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb create mode 100644 VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IFUEL.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IFUEL.vb new file mode 100644 index 0000000000..27225911e9 --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IFUEL.vb @@ -0,0 +1,19 @@ +Public Interface IFUELMAP + + Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean + Function Pdrag(ByVal nU As Single) As Single + Function Pfull(ByVal nU As Single, ByVal LastPe As Single) As Single + Function Pfull(ByVal nU As Single) As Single + Function Tq(ByVal nU As Single) As Single + Function fNpref(ByVal Nidle As Single) As Single + Function fnUrated() As Single + Function fnUofPfull(ByVal PeTarget As Single, ByVal FromLeft As Boolean) As Single + Function Tmax() As Single + + Sub Init(ByVal Nidle As Single) + Sub DeclInit() + + Property FilePath() As String + + +End Interface diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb new file mode 100644 index 0000000000..dccdff34bf --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb @@ -0,0 +1,33 @@ +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + + +Public Interface IM9 + + + sub ClearAggregates() + Sub CycleStep( Optional stepTimeInSeconds As Single = nothing) + + ReadOnly Property LitresOfAirCompressorOnContinually As Single + ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As Single + readonly property TotalCycleFuelConsumptionCompressorOnContinuously as single + readonly property TotalCycleFuelConsumptionCompressorOffContinuously as single + + + + + +End Interface + + +End Namespace + + + + + + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb new file mode 100644 index 0000000000..1d23b1921d --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb @@ -0,0 +1,167 @@ +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + +Public Class M9 +Implements IM9 + + + + #Region "Aggregates" + +'AG1 +Private _LitresOfAirCompressorOnContinuallyAggregate As Single +'AG2 +Private _LitresOfAirCompressorOnOnlyInOverrunAggregate As Single +'AG3 +Private _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate As Single +'AG4 +Private _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate As Single + +#End Region + + #Region "Constructor Requirements" +Private M1 As IM1_AverageHVACLoadDemand +Private M4 As IM4_AirCompressor +Private M6 As IM6 +Private M8 As IM8 +Private Signals As ISignals +Private FMAP As IFUELMAP +Private PSAC As IPneumaticsAuxilliariesConfig +#end region + + #Region "Public Readonly Properties" + 'OUT 1 + Public ReadOnly Property LitresOfAirCompressorOnContinually As Single Implements IM9.LitresOfAirCompressorOnContinually + Get + Return _LitresOfAirCompressorOnContinuallyAggregate + End Get + End Property + 'OUT 2 + Public ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As Single Implements IM9.LitresOfAirCompressorOnOnlyInOverrun + Get + Return _LitresOfAirCompressorOnOnlyInOverrunAggregate + End Get + End Property + 'OUT 3 + Public ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Single Implements IM9.TotalCycleFuelConsumptionCompressorOffContinuously + Get + Return _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate + End Get + End Property + 'OUT 4 + Public ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Single Implements IM9.TotalCycleFuelConsumptionCompressorOnContinuously + Get + Return _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate + End Get + End Property + +#End Region + + 'Staging Calculations + Private readonly Property S1 As single + Get + Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + End Get +End Property + Private readonly Property S2 As single + Get + If Signals.EngineSpeed=0 then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") + Return M4.GetPowerCompressorOn/signals.EngineSpeed + End Get +End Property + Private readonly Property S3 As single + Get + If Signals.EngineSpeed=0 then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") + Return M4.GetPowerCompressorOff/ Signals.EngineSpeed + End Get +End Property + Private readonly Property S4 As single + Get + If Signals.EngineSpeed=0 then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") + Return S1/Signals.EngineSpeed + End Get +End Property + Private readonly Property S5 As single + Get + Return S2 + Signals.EngineDrivelineTorque + End Get +End Property + Private readonly Property S6 As single + Get + Return Signals.EngineDrivelineTorque + s3 + End Get +End Property + Private readonly Property S7 As single + Get + Return S4 + S5 + End Get +End Property + Private readonly Property S8 As single + Get + Return S4 + S6 + End Get +End Property + Private readonly Property S9 As single + Get + Return M4.GetAveragePowerDemandPerCompressorUnitFlowRate * M6.OverrunFlag * M8.CompressorFlag + End Get +End Property + Private ReadOnly Property S10 As Single + Get + Return S9 * PSAC.OverrunUtilisationForCompressionFraction + End Get + End Property + + private ReadOnly Property S11 As Single + Get + + End Get + End Property + private ReadOnly Property S12 As Single + Get + + End Get + End Property + + + 'Public Utility Methods. + Public Sub ClearAggregates() Implements IM9.ClearAggregates + _LitresOfAirCompressorOnContinuallyAggregate =0 + _LitresOfAirCompressorOnOnlyInOverrunAggregate =0 + _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate =0 + _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate=0 + End Sub + + 'Clear down at the beginning of a cycle. + Public Sub CycleStep(Optional stepTimeInSeconds As Single = 0.0) Implements IM9.CycleStep + + _LitresOfAirCompressorOnContinuallyAggregate +=stepTimeInSeconds* M4.GetAveragePowerDemandPerCompressorUnitFlowRate + _LitresOfAirCompressorOnOnlyInOverrunAggregate +=stepTimeInSeconds * s10 + _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate +=stepTimeInSeconds * 1 + _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate+= stepTimeInSeconds * 1 + + End Sub + + 'Constructor + Public Sub new ( m1 As IM1_AverageHVACLoadDemand, m4 As IM4_AirCompressor, m6 As IM6, m8 As IM8, fmap As IFUELMAP, psac As IPneumaticsAuxilliariesConfig, signals As ISignals) + Me.M1=m1 + Me.M4=m4 + Me.M6=m6 + Me.M8=m8 + Me.FMAP=fmap + Me.PSAC= psac + Me.Signals=signals + + End Sub + + + +End Class + +End Namespace + + + diff --git a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj index 02c2bc149b..a0e78c86f5 100644 --- a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj +++ b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj @@ -73,11 +73,15 @@ </ItemGroup> <ItemGroup> <Compile Include="AuxillaryEnvironment.vb" /> + <Compile Include="DownstreamModules\cMAP.vb" /> + <Compile Include="DownstreamModules\IFUEL.vb" /> <Compile Include="DownstreamModules\IM6.vb" /> <Compile Include="DownstreamModules\IM7.vb" /> <Compile Include="DownstreamModules\IM8.vb" /> + <Compile Include="DownstreamModules\IM9.vb" /> <Compile Include="DownstreamModules\M7.vb" /> <Compile Include="DownstreamModules\M8.vb" /> + <Compile Include="DownstreamModules\M9.vb" /> <Compile Include="Electrics\AlternatorMapValues.vb" /> <Compile Include="Electrics\AlternatorMap.vb" /> <Compile Include="Electrics\ElectricsUserInputsConfig.vb" /> diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb new file mode 100644 index 0000000000..c987b173aa --- /dev/null +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb @@ -0,0 +1,35 @@ +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac +Imports VectoAuxiliaries.DownstreamModules +Imports NUnit.Framework +Imports VectoAuxiliaries +Imports Moq + +Namespace UnitTests +<TestFixture()> +Public Class M9Tests + +Private M1 As IM1_AverageHVACLoadDemand +Private M4 As IM4_AirCompressor +Private M6 As IM6 +Private M8 As IM8 + + +<Test()> +Public sub CreateNewInstanceTest() + +Dim m1Mock As New Mock(Of IM1_AverageHVACLoadDemand) +Dim m4Mock As New Mock(Of IM4_AirCompressor) +Dim m6Mock As New Mock(Of IM6) +Dim m8Mock As New Mock(Of IM8) + + +End Sub + +End Class + +End Namespace + + + diff --git a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj index 66903600d7..dd11003841 100644 --- a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj +++ b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj @@ -109,6 +109,7 @@ <Compile Include="UnitTests\M6Tests.vb" /> <Compile Include="UnitTests\M7Tests.vb" /> <Compile Include="UnitTests\M8Tests.vb" /> + <Compile Include="UnitTests\M9Tests.vb" /> <Compile Include="UnitTests\PneumaticActuationsMapTests.vb" /> <Compile Include="UnitTests\AirCompressorTests.vb" /> <Compile Include="UnitTests\AlternatorMapTests.vb" /> -- GitLab