diff --git a/VECTO/MODcalc/cPower.vb b/VECTO/MODcalc/cPower.vb index 1221aff9a1a9c005787502a3573585609f82a604..627cffe9004150903ec6c5d7a288a7ac1752f2d3 100644 --- a/VECTO/MODcalc/cPower.vb +++ b/VECTO/MODcalc/cPower.vb @@ -2760,7 +2760,7 @@ lb10: mAAUX_Global.advancedAuxModel.Signals.InternalEnginePower = (mAAUX_Global.Internal_Engine_Power * 1000).SI(Of Watt)() 'Power coming out of Advanced Model is in Watts. - power = PreExistingAuxPower + (advancedAuxModel.AuxiliaryPowerAtCrankWatts / 1000) + power = PreExistingAuxPower + (advancedAuxModel.AuxiliaryPowerAtCrankWatts.Value() / 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) diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb index dbe43d9244320fbcc9578f7b805116e8ea5977ed..51fb2270763d201c5f004ef8b4a9c37098c1258e 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb @@ -8,37 +8,43 @@ ' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ' ' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports Newtonsoft.Json Imports TUGraz.VectoCommon.Utils Namespace Hvac Public Class HVACConstants Implements IHVACConstants - Private _fuelDensity As KilogramPerCubicMeter + <JsonProperty("FuelDensity")> ReadOnly _fuelDensity As Double + <JsonProperty("DieselGCVJperGram")> ReadOnly _dieselGcvJperGram As Double = 44800 Public Sub New() - _fuelDensity = 835.SI(Of KilogramPerCubicMeter)() + _fuelDensity = 835 '.SI(Of KilogramPerCubicMeter)() End Sub Public Sub New(fuelDensitySingle As KilogramPerCubicMeter) - _fuelDensity = fuelDensitySingle + _fuelDensity = fuelDensitySingle.Value() End Sub + + <JsonIgnore> Public ReadOnly Property DieselGCVJperGram As JoulePerKilogramm Implements IHVACConstants.DieselGCVJperGram Get - Return 44800.SI().Joule.Per.Gramm.Cast(Of JoulePerKilogramm)() + Return _dieselGcvJperGram.SI().Joule.Per.Gramm.Cast(Of JoulePerKilogramm)() End Get End Property + <JsonIgnore()> Public ReadOnly Property FuelDensity As KilogramPerCubicMeter Implements IHVACConstants.FuelDensity Get - Return _fuelDensity + Return _fuelDensity.SI(Of KilogramPerCubicMeter)() End Get End Property + <JsonIgnore()> Public ReadOnly Property FuelDensityAsGramPerLiter As Double Implements IHVACConstants.FuelDensityAsGramPerLiter Get - Return _fuelDensity.Value() * 1000 + Return _fuelDensity * 1000 End Get End Property End Class diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb index 30dc6b4560deb72206a5d403cc5f3f1b9521e8db..568ab56168241e1d61e2458d3992c5e595cf835d 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb @@ -525,10 +525,12 @@ Namespace UnitTests Public Sub SaveAndRetreiveTest() Const filePath As String = "SSMTOOLTestSaveRetreive.json" + Dim success As Boolean Dim target As SSMTOOL = New SSMTOOL(filePath, New HVACConstants(), False, True) - target.Save(filePath) + success = target.Save(filePath) + Assert.IsTrue(success) 'change something target.GenInputs.BP_BusLength = 202.202 @@ -536,7 +538,8 @@ Namespace UnitTests Assert.AreEqual(target.GenInputs.BP_BusLength, 202.202) 'Retreive - target.Load(filePath) + success = target.Load(filePath) + Assert.IsTrue(success) Assert.AreEqual(target.GenInputs.BP_BusLength, 10.655) End Sub diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs index 24545662c6e54e6e2bd6e1ccca690d6f21789b8f..bf4c4bbbec54988e2dbca7f1ba0c142bdf57b625 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs @@ -147,7 +147,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Auxiliaries.CycleStep(CurrentState.dt, ref message); Log.Warn(message); - CurrentState.TotalFuelConsumption = Auxiliaries.TotalFuelGRAMS.SI().Gramm.Cast<Kilogram>(); + CurrentState.TotalFuelConsumption = Auxiliaries.TotalFuelGRAMS; container[ModalResultField.P_aux] = CurrentState.PowerDemand; container[ModalResultField.AA_NonSmartAlternatorsEfficiency] = Auxiliaries.AA_NonSmartAlternatorsEfficiency; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs index 9b4a86ad46a2d3d7e68286e3539351a6deac4e5f..5613ee510e1f3e8f5d610829815fb867771519bd 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs @@ -33,6 +33,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; using NUnit.Framework; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index 483a3af3a20772e610a1ca3eceb46c3a15cd1ebc..592ab83e12ef2136fc1af20e562890a4f8066851 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -195,7 +195,13 @@ <None Include="TestData\Components\12t Delivery Truck Efficiency.vgbx"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="TestData\Components\40t_Long_Haul_Truck Efficiency.vgbx"> + <None Include="TestData\Components\24t Coach_smallLossMap.vgbx"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="TestData\Components\40t_Long_Haul_Truck AxleEfficiency.vgbx"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="TestData\Components\40t_Long_Haul_Truck GearEfficiency.vgbx"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="TestData\Components\AxleInvalid.vtlm"> @@ -923,7 +929,10 @@ <None Include="TestData\Jobs\24t Coach Efficiency.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="TestData\Jobs\40t_Long_Haul_Truck with Efficiency.vecto"> + <None Include="TestData\Jobs\40t_Long_Haul_Truck with AxleEfficiency.vecto"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="TestData\Jobs\40t_Long_Haul_Truck with GearEfficiency.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="TestData\Jobs\40t_Long_Haul_Truck_wrong_AUX.vecto">