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 ed459dea authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

re-add Padd in fPaux (after merge with aaux code from ricardo) [+code formatting]

parent cdb8dff0
No related branches found
No related tags found
No related merge requests found
......@@ -12,14 +12,13 @@
Imports System.Collections.Generic
Public Class cVECTO
Private Const FormatVersion As Short = 2
Private FileVersion As Short
'AA-TB
'STORES THE Type and version of the chosen or default Auxiliary Type ( Classic/Original or other )
public AuxiliaryAssembly As String
public AuxiliaryVersion As String
Public AuxiliaryAssembly As String
Public AuxiliaryVersion As String
Public AdvancedAuxiliaryFilePath As String
......@@ -44,7 +43,8 @@ Public Class cVECTO
Private DesMaxDim As Integer
Public AuxPaths As Dictionary(Of String, cAuxEntry)
Public AuxRefs As Dictionary(Of String, cAux) 'Alle Nebenverbraucher die in der Veh-Datei UND im Zyklus definiert sind
Public AuxRefs As Dictionary(Of String, cAux) _
'Alle Nebenverbraucher die in der Veh-Datei UND im Zyklus definiert sind
Public AuxDef As Boolean 'True wenn ein oder mehrere Nebenverbraucher definiert sind
Public EStechs As List(Of String)
......@@ -74,7 +74,6 @@ Public Class cVECTO
Public Sub New()
Path = New cSubPath
End Sub
End Class
Public Function CreateFileList() As Boolean
......@@ -134,7 +133,6 @@ Public Class cVECTO
Return True
End Function
Public Sub New()
......@@ -158,7 +156,6 @@ Public Class cVECTO
EStechs = New List(Of String)
CycleFiles = New List(Of cSubPath)
End Sub
Public Function SaveFile() As Boolean
......@@ -264,7 +261,6 @@ Public Class cVECTO
JSON.Content.Add("Body", dic0)
Return JSON.WriteFile(sFilePath)
End Function
Public Function ReadFile() As Boolean
......@@ -277,9 +273,6 @@ Public Class cVECTO
Dim dic As Object
MsgSrc = "Main/ReadInp/GEN"
SetDefault()
......@@ -296,11 +289,13 @@ Public Class cVECTO
SavedInDeclMode = Cfg.DeclMode
End If
If Not JSON.Content("Body")("VehicleFile") Is Nothing Then stPathVEH.Init(MyPath, JSON.Content("Body")("VehicleFile"))
If Not JSON.Content("Body")("VehicleFile") Is Nothing Then _
stPathVEH.Init(MyPath, JSON.Content("Body")("VehicleFile"))
stPathENG.Init(MyPath, JSON.Content("Body")("EngineFile"))
If Not JSON.Content("Body")("GearboxFile") Is Nothing Then stPathGBX.Init(MyPath, JSON.Content("Body")("GearboxFile"))
If Not JSON.Content("Body")("GearboxFile") Is Nothing Then _
stPathGBX.Init(MyPath, JSON.Content("Body")("GearboxFile"))
If Not JSON.Content("Body")("Cycles") Is Nothing Then
For Each str In JSON.Content("Body")("Cycles")
......@@ -312,17 +307,16 @@ Public Class cVECTO
'AA-TB
'ADVANCED AUXILIARIES
If Not JSON.Content("Body")("AuxiliaryAssembly") is Nothing AndAlso
NOT JSON.Content("Body")("AuxiliaryVersion") is nothing
If Not JSON.Content("Body")("AuxiliaryAssembly") Is Nothing AndAlso
Not JSON.Content("Body")("AuxiliaryVersion") Is Nothing Then
AuxiliaryAssembly = JSON.Content("Body")("AuxiliaryAssembly").ToString()
AuxiliaryVersion = JSON.Content("Body")("AuxiliaryVersion").ToString()
End If
If NOT JSON.Content("Body")("AdvancedAuxiliaryFilePath") is nothing then
If Not JSON.Content("Body")("AdvancedAuxiliaryFilePath") Is Nothing Then
AdvancedAuxiliaryFilePath = JSON.Content("Body")("AdvancedAuxiliaryFilePath").ToString()
end if
End If
If Not JSON.Content("Body")("Aux") Is Nothing Then
......@@ -412,9 +406,6 @@ Public Class cVECTO
End If
Catch ex As Exception
WorkerMsg(tMsgID.Err, "Failed to read VECTO file! " & ex.Message, MsgSrc)
Return False
......@@ -422,8 +413,6 @@ Public Class cVECTO
Return True
End Function
Private Sub SetDefault()
......@@ -467,7 +456,6 @@ Public Class cVECTO
vMinLA = 0
SavedInDeclMode = False
End Sub
Public Function DeclInit() As Boolean
......@@ -510,7 +498,6 @@ Public Class cVECTO
'No need to check Aux (AuxDef). Will be checked in cDeclaration.CalcInitLoad
Return True
End Function
'This Sub reads those Input-files that do not have their own class, etc.
......@@ -555,7 +542,8 @@ Public Class cVECTO
Catch ex As Exception
file.Close()
WorkerMsg(tMsgID.Err, "Error in .vacc file. " & ex.Message & " (" & stDesMaxFile.FullPath & ")", MsgSrc, stDesMaxFile.FullPath)
WorkerMsg(tMsgID.Err, "Error in .vacc file. " & ex.Message & " (" & stDesMaxFile.FullPath & ")", MsgSrc,
stDesMaxFile.FullPath)
Return False
End Try
......@@ -565,7 +553,6 @@ Public Class cVECTO
End If
Return True
End Function
#Region "Aux"
......@@ -639,11 +626,11 @@ Public Class cVECTO
MsgSrc = "VEH/AuxInit"
For Each AuxID In DRI.AuxComponents.Keys
If Not DRIauxcheck(AuxID) Then WorkerMsg(tMsgID.Warn, "Auxiliary '" & AuxID & "' not found! Psupply input will be ignored!", MsgSrc)
If Not DRIauxcheck(AuxID) Then _
WorkerMsg(tMsgID.Warn, "Auxiliary '" & AuxID & "' not found! Psupply input will be ignored!", MsgSrc)
Next
Return True
End Function
Public Function Paux(ByVal AuxID As String, ByVal t As Integer, ByVal nU As Single) As Single
......@@ -681,8 +668,6 @@ Public Class cVECTO
lbAuxError:
MODdata.ModErrors.AuxNegative = AuxID
Return 0
End Function
Public Function PauxSum(ByVal t As Integer, ByVal nU As Single) As Single
......@@ -710,7 +695,6 @@ lbAuxError:
Return 0
End If
End Function
#End Region
......@@ -845,7 +829,6 @@ lbAuxError:
lbInt:
'Interpolation
Return (v - laDesV(i - 1)) * (laDesMax(i) - laDesMax(i - 1)) / (laDesV(i) - laDesV(i - 1)) + laDesMax(i - 1)
End Function
Public Function aDesMin(ByVal v As Single) As Single
......@@ -871,9 +854,6 @@ lbInt:
lbInt:
'Interpolation
Return (v - laDesV(i - 1)) * (laDesMin(i) - laDesMin(i - 1)) / (laDesV(i) - laDesV(i - 1)) + laDesMin(i - 1)
End Function
End Class
......@@ -296,7 +296,7 @@ Public Class cPower
'Total aux power
'[kW]
Paux = PreExistingAuxPower + fPaux(t, EngineSpeed)
Paux = fPaux(t, EngineSpeed)
'Internal Engine Power (Pclutch plus Aux plus Inertia)
P = Pkup + Paux + PaMot
......@@ -1094,7 +1094,7 @@ lb_nOK:
'Total aux power
'[kW]
Paux = PreExistingAuxPower + fPaux(jz, EngineSpeed)
Paux = fPaux(jz, EngineSpeed)
'***************** ADVANCED AUXILIARIES END ********************************************************
'ICE-inertia
......@@ -2735,7 +2735,7 @@ lb10:
If VECTO_Global.VEC.AuxiliaryAssembly = "CLASSIC" Then
Return CSng(VEC.PauxSum(t, nU))
Return CSng(MODdata.Vh.Padd(t) + VEC.PauxSum(t, nU))
Else
......@@ -2753,7 +2753,7 @@ lb10:
mAAUX_Global.advancedAuxModel.Signals.Internal_Engine_Power = mAAUX_Global.Internal_Engine_Power
'Power coming out of Advanced Model is in Watts.
power = (advancedAuxModel.AuxiliaryPowerAtCrankWatts / 1000)
power = PreExistingAuxPower + (advancedAuxModel.AuxiliaryPowerAtCrankWatts / 1000)
'Glenn: Comment the previous line and uncomment the next line to include the classic auxilaries power togeher with the advanced auxiliary power.
'power = VEC.PauxSum(t, nU) + (advancedAuxModel.AuxiliaryPowerAtCrankWatts / 1000)
......
......@@ -7,10 +7,8 @@ Imports VectoAuxiliaries
Imports Moq
Namespace UnitTests
<TestFixture()>
Public Class M6Test
Private M1 As New M1_Mock(100, 200, 300, 50)
Private M2 As New M2_Mock(120, 130)
Private M3 As New M3_Mock(200, 5000)
......@@ -27,16 +25,13 @@ Private Function GetStandardInstanceM6() As IM6
M5 = New M5_Mock(200, 50, 80)
Return New M6(M1, M2, M3, M4, M5, Signals)
End Function
Public Sub new ()
Public Sub New()
Signals.EngineMotoringPower = 100
Signals.EngineDrivelinePower = 150
Signals.PreExistingAuxPower = 30
End Sub
<Test()>
......@@ -45,35 +40,34 @@ Public Sub CreateNewM6Instance()
Dim target As IM6 = GetStandardInstanceM6()
Assert.IsNotNull(target)
End Sub
'Test Cases Supplied by Mike Preston.
<Test()> _
<TestCase(100, 100, 100, 100, 20, 20, 40, 100, 100, 100, 0.1F, -0.55F, False, 0, 0, 0, 20, 0, 100, 20, 200, 0)> _
<TestCase(100, 100, 100, 100, 20, 20, 40, 100, 100, 100, 100, -550, True, 0, 0, 0, 20, 0, 100, 20, 200, 0)> _
Public Sub MikesConditionsTest(M1_1 As Single, _
M1_2 As Single, _
M2_1 As Single, _
M3_1 As Single, _
M4_1 As Single, _
M4_2 As Single, _
M4_3 As Single, _
M5_1 As Single, _
M5_2 As Single, _
AUX As Single, _
EMP As Single, _
EDP As Single, _
SM As Boolean, _
OUT1 As Single, _
OUT2 As Single, _
OUT3 As Single, _
OUT4 As Single, _
OUT5 As Single, _
OUT6 As Single, _
OUT7 As Single, _
OUT8 As Single, _
<TestCase(100, 100, 100, 100, 20, 20, 40, 100, 100, 100, 100, -550, True, 0, 0, 0, 20, 0, 100, 20, 200, 0)>
Public Sub MikesConditionsTest(M1_1 As Single,
M1_2 As Single,
M2_1 As Single,
M3_1 As Single,
M4_1 As Single,
M4_2 As Single,
M4_3 As Single,
M5_1 As Single,
M5_2 As Single,
AUX As Single,
EMP As Single,
EDP As Single,
SM As Boolean,
OUT1 As Single,
OUT2 As Single,
OUT3 As Single,
OUT4 As Single,
OUT5 As Single,
OUT6 As Single,
OUT7 As Single,
OUT8 As Single,
OUT9 As Single)
......@@ -97,7 +91,6 @@ End Sub
M5._AlternatorsGenerationPowerAtCrankOverrunWatts = M5_2
signals.EngineMotoringPower = EMP
signals.PreExistingAuxPower = AUX
signals.EngineDrivelinePower = EDP
......@@ -115,18 +108,8 @@ End Sub
Assert.AreEqual(OUT7, target.SmartElecAndPneumaticAirCompPowerGenAtCrank)
Assert.AreEqual(OUT8, target.AvgPowerDemandAtCrankFromElectricsIncHVAC)
Assert.AreEqual(OUT9, target.SmartPneumaticsOnlyCompressorFlag)
End Sub
End Class
End Namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment