From a60f7bcd60569ad31077edc182bd4dde9093ecc0 Mon Sep 17 00:00:00 2001 From: "Burns, Terry" <Terry.Burns@ricardo.com> Date: Wed, 14 Jan 2015 11:17:33 +0000 Subject: [PATCH] Fixes To M3 Total Cycle Time Divisor and Test Suite Changes for M3 test to account for that. git-tfs-id: [http://tfs00.element.root.com:8080/tfs/TFSCollection]$/VECTO;C1715 --- .../IAdvancedAuxiliaries.vb | 13 +++ AuxillaryTestHarness/Dashboard.Designer.vb | 22 ++--- AuxillaryTestHarness/Dashboard.resx | 2 +- AuxillaryTestHarness/Dashboard.vb | 19 ++++- VECTO/MODcalc/cMOD.vb | 46 ++++++++++- VECTO/MODcalc/cPower.vb | 11 +++ VECTO/My Project/app.manifest | 2 +- .../VectoAuxiliaries/AdvancedAuxiliaries.vb | 69 ++++++++++++++-- .../DownstreamModules/IM10.vb | 22 +++++ .../VectoAuxiliaries/DownstreamModules/M10.vb | 80 +++++++++++++++++-- .../VectoAuxiliaries/DownstreamModules/M6.vb | 40 +++++++++- .../VectoAuxiliaries/DownstreamModules/M9.vb | 11 ++- .../M3_AveragePneumaticLoadDemand.vb | 5 +- .../AveragePneumaticLoadDemandTests.vb | 29 +++---- .../UnitTests/M10Tests.vb | 1 + 15 files changed, 325 insertions(+), 47 deletions(-) diff --git a/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb b/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb index a8c868eee9..403389a828 100644 --- a/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb +++ b/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb @@ -10,6 +10,18 @@ ReadOnly Property Running As boolean ReadOnly Property AuxiliaryName As String ReadOnly Property AuxiliaryVersion As String +readonly property AA_D_M10_P1X as single +readonly property AA_D_M10_P1Y as single +readonly property AA_D_M10_P2X as single +readonly property AA_D_M10_P2Y as single +readonly property AA_D_M10_P3X as single +readonly property AA_D_M10_P3Y as single +readonly property AA_D_M10_XTAIN as single +readonly property AA_D_M10_INTERP1 as single +readonly property AA_D_M10_INTERP2 as single + + + ReadOnly Property AA_NonSmartAlternatorsEfficiency As single? Readonly Property AA_SmartIdleCurrent_Amps As single? Readonly Property AA_SmartIdleAlternatorsEfficiency As single? @@ -24,6 +36,7 @@ ReadOnly Property AA_CompressorFlag As integer? Readonly Property AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams As single? ReadOnly Property AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres As single? + Readonly Property TotalFuelGRAMS As Single Readonly Property TotalFuelLITRES As single ReadOnly Property AuxiliaryPowerAtCrankWatts As single diff --git a/AuxillaryTestHarness/Dashboard.Designer.vb b/AuxillaryTestHarness/Dashboard.Designer.vb index 5a31f19c1f..1f213419bc 100644 --- a/AuxillaryTestHarness/Dashboard.Designer.vb +++ b/AuxillaryTestHarness/Dashboard.Designer.vb @@ -129,6 +129,7 @@ Partial Class Dashboard Me.txtHVACElectricalLoadPowerWatts = New System.Windows.Forms.TextBox() Me.lblHVACElectricalLoadPowerWatts = New System.Windows.Forms.Label() Me.tabPlayground = New System.Windows.Forms.TabPage() + Me.chkEngineStopped = New System.Windows.Forms.CheckBox() Me.pnlM13 = New System.Windows.Forms.Panel() Me.txtM13_out_TotalCycleFuelCalculationGramsLITRES = New System.Windows.Forms.TextBox() Me.lblM13TotalFuelConsumptionTotalCycleLitres = New System.Windows.Forms.Label() @@ -289,7 +290,6 @@ Partial Class Dashboard Me.DeleteToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ErrorProvider = New System.Windows.Forms.ErrorProvider(Me.components) Me.Timer1 = New System.Windows.Forms.Timer(Me.components) - Me.chkEngineStopped = New System.Windows.Forms.CheckBox() Me.pnlMain.SuspendLayout Me.tabMain.SuspendLayout Me.tabGeneralConfig.SuspendLayout @@ -1382,6 +1382,16 @@ Partial Class Dashboard Me.tabPlayground.Text = "Playground" Me.tabPlayground.UseVisualStyleBackColor = true ' + 'chkEngineStopped + ' + Me.chkEngineStopped.AutoSize = true + Me.chkEngineStopped.Location = New System.Drawing.Point(10, 144) + Me.chkEngineStopped.Name = "chkEngineStopped" + Me.chkEngineStopped.Size = New System.Drawing.Size(102, 17) + Me.chkEngineStopped.TabIndex = 60 + Me.chkEngineStopped.Text = "Engine Stopped" + Me.chkEngineStopped.UseVisualStyleBackColor = true + ' 'pnlM13 ' Me.pnlM13.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle @@ -2882,16 +2892,6 @@ Partial Class Dashboard ' Me.Timer1.Interval = 1000 ' - 'chkEngineStopped - ' - Me.chkEngineStopped.AutoSize = true - Me.chkEngineStopped.Location = New System.Drawing.Point(10, 144) - Me.chkEngineStopped.Name = "chkEngineStopped" - Me.chkEngineStopped.Size = New System.Drawing.Size(102, 17) - Me.chkEngineStopped.TabIndex = 60 - Me.chkEngineStopped.Text = "Engine Stopped" - Me.chkEngineStopped.UseVisualStyleBackColor = true - ' 'Dashboard ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) diff --git a/AuxillaryTestHarness/Dashboard.resx b/AuxillaryTestHarness/Dashboard.resx index 9591f90d7f..6097662b73 100644 --- a/AuxillaryTestHarness/Dashboard.resx +++ b/AuxillaryTestHarness/Dashboard.resx @@ -124,7 +124,7 @@ <value>168, 17</value> </metadata> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>25</value> + <value>105</value> </metadata> <metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>543, 19</value> diff --git a/AuxillaryTestHarness/Dashboard.vb b/AuxillaryTestHarness/Dashboard.vb index 7964444e14..e05b166c7e 100644 --- a/AuxillaryTestHarness/Dashboard.vb +++ b/AuxillaryTestHarness/Dashboard.vb @@ -906,12 +906,29 @@ Exit sub End If +If processing then + +auxEnvironment.M9.CycleStep(1) +auxEnvironment.M10.CycleStep(1) +auxEnvironment.M11.CycleStep(1) + + + +RefreshDisplays() +SecondsIntoCycle+=1 + +return + +End If + + + try SecondsIntoCycle=0 auxEnvironment.Initialise() processing=true SetProcessingStatus - Timer1.Start + 'Timer1.Start Catch ex As Exception diff --git a/VECTO/MODcalc/cMOD.vb b/VECTO/MODcalc/cMOD.vb index 33270d5b64..1baaed1c11 100644 --- a/VECTO/MODcalc/cMOD.vb +++ b/VECTO/MODcalc/cMOD.vb @@ -56,6 +56,18 @@ Public Class cMOD public AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams As List(Of single? ) public AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres As List(Of single? ) + public AA_D_M10_P1X as list( of single ) + public AA_D_M10_P1Y as list( of single ) + public AA_D_M10_P2X as list( of single ) + public AA_D_M10_P2Y as list( of single ) + public AA_D_M10_P3X as list( of single ) + public AA_D_M10_P3Y as list( of single ) + public AA_D_M10_XTAIN as list( of single ) + public AA_D_M10_INTERP1 as list( of single ) + public AA_D_M10_INTERP2 as list( of single ) + + + '*********************************************************** Public EngState As List(Of tEngState) @@ -110,6 +122,17 @@ Public Class cMOD AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams = new List(Of single? ) AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres = new List(Of single? ) + AA_D_M10_P1X = new List(Of single ) + AA_D_M10_P1Y = new List(Of single ) + AA_D_M10_P2X = new List(Of single ) + AA_D_M10_P2Y = new List(Of single ) + AA_D_M10_P3X = new List(Of single ) + AA_D_M10_P3Y = new List(Of single ) + AA_D_M10_XTAIN = new List(Of single ) + AA_D_M10_INTERP1 = new List(Of single ) + AA_D_M10_INTERP2 = new List(Of single ) + + '************************************************************************* Proll = New List(Of Single) Psum = New List(Of Single) @@ -579,6 +602,15 @@ Public Class cMOD s.Append(",AA_CompressorFlag [Integer 0/1]") s.Append(",AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams") s.Append(",AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres") + s.Append(",AA_D_M10_P1X [Single]") + s.Append(",AA_D_M10_P1Y [Single]") + s.Append(",AA_D_M10_P2X [Single]") + s.Append(",AA_D_M10_P2Y [Single]") + s.Append(",AA_D_M10_P3X [Single]") + s.Append(",AA_D_M10_P3Y [Single]") + s.Append(",AA_D_M10_XTAIN [Single]") + s.Append(",AA_D_M10_INTERP1 [Single]") + s.Append(",AA_D_M10_INTERP2 [Single]") @@ -756,8 +788,20 @@ Public Class cMOD s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC",AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams(t).ToString(),"")) s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC",AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres(t).ToString(),"")) - End If + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_P1X (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_P1Y (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_P2X (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_P2Y (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_P3X (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_P3Y (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_XTAIN (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_INTERP1 (t).toString(),"")) + s.Append(Sepp & if(vecto_global.VEC.AuxiliaryAssembly<>"CLASSIC", AA_D_M10_INTERP2 (t).toString(),"")) + + + end if + 'FC If .lFC(t) > -0.0001 Then s.Append(Sepp & .lFC(t)) diff --git a/VECTO/MODcalc/cPower.vb b/VECTO/MODcalc/cPower.vb index 90b2b42639..a1cc5e3b1f 100644 --- a/VECTO/MODcalc/cPower.vb +++ b/VECTO/MODcalc/cPower.vb @@ -1475,6 +1475,17 @@ lb_nOK: ModData.AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams .Add( advancedAuxModel.AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams) ModData.AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres .Add( advancedAuxModel.AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres) + ModData.AA_D_M10_P1X .Add( advancedAuxModel.AA_D_M10_P1X) + ModData.AA_D_M10_P1Y .Add( advancedAuxModel.AA_D_M10_P1Y) + ModData.AA_D_M10_P2X .Add( advancedAuxModel.AA_D_M10_P2X) + ModData.AA_D_M10_P2Y .Add( advancedAuxModel.AA_D_M10_P2Y) + ModData.AA_D_M10_P3X .Add( advancedAuxModel.AA_D_M10_P3X) + ModData.AA_D_M10_P3Y .Add( advancedAuxModel.AA_D_M10_P3Y) + ModData.AA_D_M10_XTAIN .Add( advancedAuxModel.AA_D_M10_XTAIN) + ModData.AA_D_M10_INTERP1 .Add( advancedAuxModel.AA_D_M10_INTERP1) + ModData.AA_D_M10_INTERP2 .Add( advancedAuxModel.AA_D_M10_INTERP2) + + Catch ex as Exception Dim dummy = 0 diff --git a/VECTO/My Project/app.manifest b/VECTO/My Project/app.manifest index ce3465ea6d..7ca715c9eb 100644 --- a/VECTO/My Project/app.manifest +++ b/VECTO/My Project/app.manifest @@ -20,7 +20,7 @@ </requestedPrivileges> <applicationRequestMinimum> <defaultAssemblyRequest permissionSetReference="Custom" /> - <PermissionSet Unrestricted="true" ID="Custom" SameSite="site" /> + <PermissionSet ID="Custom" SameSite="site" Unrestricted="true" /> </applicationRequestMinimum> </security> </trustInfo> diff --git a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb index 668658a806..0a5a2b1454 100644 --- a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb +++ b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb @@ -12,6 +12,7 @@ Public Class AdvancedAuxiliaries + Private auxConfig As AuxiliaryConfig @@ -191,18 +192,18 @@ End Sub Public Function CycleStep(seconds As Integer, ByRef message As String) As Boolean Implements VectoAuxiliaries.IAdvancedAuxiliaries.CycleStep - M9.CycleStep( seconds ) - M11.CycleStep( seconds ) - - 'Used in the fuel aggregated output on M13 ( Sum 5 ) - + try + M9.CycleStep( seconds ) + M10.CycleStep( seconds ) + M11.CycleStep( seconds ) + Signals.CurrentCycleTimeInSeconds+=1 Catch ex As Exception - + 'TODO: Should this raise an event ? MessageBox.Show("Im an exception") Return false @@ -396,11 +397,63 @@ End Sub - - Public ReadOnly Property AuxiliaryPowerAtCrankWatts As Single Implements IAdvancedAuxiliaries.AuxiliaryPowerAtCrankWatts Get Return M8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries End Get End Property + + + + + 'PURE DIAGNOSTICS SHOULD ONLY BE USED IN MOD FOR ENGINEERING TESTS + + Public ReadOnly Property AA_D_M10_INTERP1 As Single Implements IAdvancedAuxiliaries.AA_D_M10_INTERP1 + Get + Return M10.INTRP1 + End Get + End Property + Public ReadOnly Property AA_D_M10_INTERP2 As Single Implements IAdvancedAuxiliaries.AA_D_M10_INTERP2 + Get + Return M10.INTRP2 + End Get + End Property + Public ReadOnly Property AA_D_M10_P1X As Single Implements IAdvancedAuxiliaries.AA_D_M10_P1X + Get + Return M10.P1X + End Get + End Property + Public ReadOnly Property AA_D_M10_P1Y As Single Implements IAdvancedAuxiliaries.AA_D_M10_P1Y + Get + Return M10.P1Y + End Get + End Property + Public ReadOnly Property AA_D_M10_P2X As Single Implements IAdvancedAuxiliaries.AA_D_M10_P2X + Get + Return M10.P2X + End Get + End Property + Public ReadOnly Property AA_D_M10_P2Y As Single Implements IAdvancedAuxiliaries.AA_D_M10_P2Y + Get + Return M10.P2Y + End Get + End Property + Public ReadOnly Property AA_D_M10_P3X As Single Implements IAdvancedAuxiliaries.AA_D_M10_P3X + Get + Return M10.P3X + End Get + End Property + Public ReadOnly Property AA_D_M10_P3Y As Single Implements IAdvancedAuxiliaries.AA_D_M10_P3Y + Get + Return M10.P3Y + End Get + End Property + Public ReadOnly Property AA_D_M10_XTAIN As Single Implements IAdvancedAuxiliaries.AA_D_M10_XTAIN + Get + Return M10.XTAIN + End Get + End Property + + + End Class diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb index 9cc3d54d37..2418baccd3 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb @@ -21,6 +21,28 @@ ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Single 'Interpolated FC between points 2-3-1 Representing smart Pneumatics = Fuel consumption with smart Pneumatics and average electrical power demand ReadOnly Property FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand As Single + Sub CycleStep( Optional stepTimeInSeconds As Single = nothing) + + +ReadOnly Property P1X as single + +ReadOnly Property P1Y as single + +ReadOnly Property P2X as single + +ReadOnly Property P2Y as single + +ReadOnly Property P3X as single + +ReadOnly Property P3Y as single + +ReadOnly Property XTAIN as single + +ReadOnly Property INTRP1 as single + +ReadOnly Property INTRP2 as single + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb index 7c1fc8987d..a051f583ff 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb @@ -7,6 +7,61 @@ Namespace DownstreamModules Public Class M10 Implements IM10 + + + 'Aggregators + Private _AverageAirConsumedPerSecondLitre As Single + + 'Diagnostics + Private Dim x1,y1,x2,y2,x3,y3, xTA,interp1,interp2 As single + + Public ReadOnly Property P1X as single Implements IM10.P1X + Get + Return x1 + End Get + End Property + Public ReadOnly Property P1Y as single Implements IM10.P1Y + Get + Return y1 + End Get + End Property + Public ReadOnly Property P2X as single Implements IM10.P2X + Get + Return x2 + End Get + End Property + Public ReadOnly Property P2Y as single Implements IM10.P2Y + Get + Return y2 + End Get + End Property + Public ReadOnly Property P3X as single Implements IM10.P3X + Get + Return x3 + End Get + End Property + Public ReadOnly Property P3Y as single Implements IM10.P3Y + Get + Return y3 + End Get + End Property + Public ReadOnly Property XTAIN as single Implements IM10.XTAIN + Get + Return xTA + End Get + End Property + Public ReadOnly Property INTRP1 as single Implements IM10.INTRP1 + Get + Return interp1 + End Get + End Property + Public ReadOnly Property INTRP2 as single Implements IM10.INTRP2 + Get + Return interp2 + End Get + End Property + + 'Private #Region "Private Fields = > Constructor Requirements" @@ -26,7 +81,7 @@ End Enum Private Function Interpolate( interpType As InterpolationType) As Single Dim returnValue As Single - Dim x1,y1,x2,y2,x3,y3, xTA As Single + ' Dim x1,y1,x2,y2,x3,y3, xTA As Single x1=m9.LitresOfAirCompressorOnContinually y1=m9.TotalCycleFuelConsumptionCompressorOnContinuously @@ -35,20 +90,24 @@ End Enum x3=m9.LitresOfAirCompressorOnOnlyInOverrun y3=m9.TotalCycleFuelConsumptionCompressorOffContinuously - xTA = m3.AverageAirConsumedPerSecondLitre + xTA = _AverageAirConsumedPerSecondLitre 'm3.AverageAirConsumedPerSecondLitre - + + + Select Case interpType - 'Non-Smart Pneumatics + 'Non-Smart Pneumatics ( OUT 1 ) Case InterpolationType.NonSmartPneumtaics returnValue = y2 + ( ((y1-y2) * xTA) / x1) + interp1=returnValue - 'Smart Pneumatics + 'Smart Pneumatics ( OUT 2 ) Case InterpolationType.SmartPneumtaics ReturnValue = y3 + (((y1-y3) /( x1-x3)) * ( xTA - x3)) + interp2= returnValue @@ -62,7 +121,7 @@ End Function 'Public #Region "Public Properties" - Public ReadOnly Property BaseFuelConsumptionWithAverageAuxiliaryLoads As Single Implements IM10.AverageLoadsFuelConsumptionInterpolatedForPneumatics + Public ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Single Implements IM10.AverageLoadsFuelConsumptionInterpolatedForPneumatics Get Return If( Single.IsNaN( Interpolate(InterpolationType.NonSmartPneumtaics)),0,Interpolate(InterpolationType.NonSmartPneumtaics)) End Get @@ -86,6 +145,15 @@ End Sub #end region + Public Sub CycleStep(Optional stepTimeInSeconds As Single = 0.0) Implements IM10.CycleStep + + _AverageAirConsumedPerSecondLitre+= If( Single.IsNaN(m3.AverageAirConsumedPerSecondLitre),0,m3.AverageAirConsumedPerSecondLitre ) + + End Sub + + + + End Class diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb index 74daff9134..e2fa8a0d56 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb @@ -21,7 +21,45 @@ Implements IM6 Public ReadOnly Property OverrunFlag As Integer Implements IM6.OverrunFlag Get - Return VC0 + + 'TODO : Diagnostic stuff to be removed once mike is happy. + 'If ovrCount<10 andalso VC0=1 then + + ' ovrCount+=1 + + ' Console.WriteLine((String.Format("OVERRUN : EMP {0}, EDLP {1}, PRAUXP {2}, M1.AvPcrankMech {3},M1.AvPCrnkElec {4}, M2.AvPCrnPneu{5},M3.AvPPneum{6},M5.MaxAltP_tract{7}, ", + ' _signals.EngineMotoringPower, + ' _signals.EngineDrivelinePower, + ' _signals.PreExistingAuxPower, + ' _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts, + ' _m1.AveragePowerDemandAtAlternatorFromHVACElectricsWatts, + ' _m2.GetAveragePowerAtCrankFromElectrics, + ' _m3.GetAveragePowerDemandAtCrankFromPneumatics, + ' _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts ))) + + ' Else + + ' If( urnCount<10 ) then + + ' urnCount+=1 + + ' Console.WriteLine((String.Format("OVERRUN-OFF : EMP {0}, EDLP {1}, PRAUXP {2}, M1.AvPcrankMech {3},M1.AvPCrnkElec {4}, M2.AvPCrnPneu{5},M3.AvPPneum{6},M5.MaxAltP_tract{7}, ", + ' _signals.EngineMotoringPower, + ' _signals.EngineDrivelinePower, + ' _signals.PreExistingAuxPower, + ' _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts, + ' _m1.AveragePowerDemandAtAlternatorFromHVACElectricsWatts, + ' _m2.GetAveragePowerAtCrankFromElectrics, + ' _m3.GetAveragePowerDemandAtCrankFromPneumatics, + ' _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts ))) + + ' end if + + 'End If + + + Return VC0 + End Get End Property 'OUT2 diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb index 4ac176cf9c..51b19b2cc2 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb @@ -132,7 +132,16 @@ End Property private ReadOnly Property S11 As Single Get 'Divide by 3600 to get grams per second. - Return FMAP.fFCdelaunay_Intp(Signals.EngineSpeed,s7) / 3600 + + Dim int1 As Single = FMAP.fFCdelaunay_Intp(Signals.EngineSpeed,s7) /3600 + + int1 = If( int1 >0 Andalso Not Single.IsNaN(int1), int1,0) + + + Return FMAP.fFCdelaunay_Intp(Signals.EngineSpeed,s7) / 3600 + + 'Return int1 + End Get End Property private ReadOnly Property S12 As Single diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb index ada875a299..108fe482bf 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb @@ -6,6 +6,7 @@ Namespace Pneumatics Implements IM3_AveragePneumaticLoadDemand + Private _pneumaticUserInputsConfig As IPneumaticUserInputsConfig Private _pneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig Private _pneumaticsActuationsMap As IPneumaticActuationsMAP @@ -138,9 +139,9 @@ Namespace Pneumatics End Function 'Get Total Required Air Delivery Rate - Public Function TotalAirConsumedPerCycle() As Single Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumedPerSecondLitre + Public Function AverageAirConsumedPerSecondLitre() As Single Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumedPerSecondLitre - Return TotalAirDemand + Return TotalAirDemand / ( _cycleDurationMinutes * 60 ) End Function diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb index a11bc58a48..088ce6d097 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb @@ -52,6 +52,7 @@ Namespace UnitTests + End Sub @@ -155,8 +156,8 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _signals) - Dim expected As Single = 7664.94 - Dim actual As Single = target.TotalAirConsumedPerCycle() + Dim expected As Single = Math.Round( 7664.94/_Signals.TotalCycleTimeSeconds,4) + Dim actual As Single = Math.Round(target.AverageAirConsumedPerSecondLitre(),4) Assert.AreEqual(expected, actual) @@ -178,8 +179,8 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _signals) - Dim expected As Single = 8545.207 - Dim actual As Single = target.TotalAirConsumedPerCycle() + Dim expected As Single = Math.Round( 8545.207/_Signals.TotalCycleTimeSeconds,4) + Dim actual As Single = Math.Round(target.AverageAirConsumedPerSecondLitre(),4) Assert.AreEqual(expected, actual) @@ -201,9 +202,9 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _signals) - Dim expected As Single = 8541.45 + Dim expected As Single = Math.round(8541.45 / _Signals.TotalCycleTimeSeconds,4) - Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) + Dim actual As Single = Math.Round(target.AverageAirConsumedPerSecondLitre(), 4) Assert.AreEqual(expected, actual) @@ -225,9 +226,9 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _signals) - Dim expected As Single = 8274.78 + Dim expected As Single = 8274.78 / _Signals.TotalCycleTimeSeconds - Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) + Dim actual As Single = Math.Round(target.AverageAirConsumedPerSecondLitre(), 8) Assert.AreEqual(expected, actual) @@ -249,9 +250,9 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _signals) - Dim expected As Single = 8443.44 + Dim expected As Single = 8443.44 / _Signals.TotalCycleTimeSeconds - Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) + Dim actual As Single = Math.Round(target.AverageAirConsumedPerSecondLitre(), 6) Assert.AreEqual(expected, actual) @@ -273,9 +274,9 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _signals) - Dim expected As Single = 7664.94 + Dim expected As Single = 7664.94 / _Signals.TotalCycleTimeSeconds - Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) + Dim actual As Single = Math.Round(target.AverageAirConsumedPerSecondLitre(), 6) Assert.AreEqual(expected, actual) @@ -297,9 +298,9 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _signals) - Dim expected As Single = 6598.14 + Dim expected As Single = 6598.14 / _Signals.TotalCycleTimeSeconds - Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) + Dim actual As Single = Math.Round(target.AverageAirConsumedPerSecondLitre(), 6) Assert.AreEqual(expected, actual) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb index 06bada69ca..83b1355303 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb @@ -32,6 +32,7 @@ m9.Setup( Function(x) x.TotalCycleFuelConsumptionCompressorOffContinuously).Retu Dim target As IM10 = New M10(m3.Object,m9.Object,Signals) +target.CycleStep(1) Assert.AreEqual(out1, target.AverageLoadsFuelConsumptionInterpolatedForPneumatics ) Assert.AreEqual(out2, target.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand ) -- GitLab