Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 8e039c6e authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

use si class in hvac constants, make it serializable; extend tests for aaux

parent c8881991
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment