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

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

removing files not part of the project

parent 982f1f7e
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1610 deletions
' Copyright 2015 European Union.
' Licensed under the EUPL (the 'Licence');
'
' * You may not use this work except in compliance with the Licence.
' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
' * Unless required by applicable law or agreed to in writing,
' software distributed under the Licence is distributed on an "AS IS" basis,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'
' See the LICENSE.txt for the specific language governing permissions and limitations.
Imports VectoAuxiliaries.Electrics
Imports VectoAuxiliaries.Pneumatics
Imports VectoAuxiliaries.Hvac
Imports System.IO
Imports VectoAuxiliaries.DownstreamModules
Imports System.Windows.Forms
Imports Newtonsoft.Json
<Serializable()>
Public Class AuxillaryEnvironment
'Vecto
Public Property VectoInputs As IVectoInputs
'Electrical
Public property ElectricalUserInputsConfig As IElectricsUserInputsConfig
'Pneumatics
public Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig
public Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig
'Hvac
Public Property HvacUserInputsConfig As IHVACUserInputsConfig
'Vecto Signals
public Property Signals As ISignals
'Test instantiations
Public M0 As IM0_NonSmart_AlternatorsSetEfficiency
Public M05 As IM0_5_SmartAlternatorSetEfficiency
Public M1 As IM1_AverageHVACLoadDemand
Public M2 As IM2_AverageElectricalLoadDemand
Public M3 As IM3_AveragePneumaticLoadDemand
Public M4 As IM4_AirCompressor
Public M5 As IM5_SmartAlternatorSetGeneration
Public M6 As IM6
Public M7 As IM7
Public M8 As IM8
Public M9 As IM9
Public M10 As IM10
Public M11 As IM11
Public M12 As IM12
Public M13 As IM13
Protected WithEvents compressorMap As ICompressorMap
'Constructors
Sub new()
Call Me.New("EMPTY")
End Sub
Public Sub new(auxConfigFile As String)
'Special Condid
If auxConfigFile="EMPTY" then
ElectricalUserInputsConfig = New ElectricsUserInputsConfig() With { .PowerNetVoltage= 26.3}
ElectricalUserInputsConfig.ElectricalConsumers= New ElectricalConsumerList(26.3,0.096,false)
ElectricalUserInputsConfig.ResultCardIdle = new ResultCard( New List(Of SmartResult ))
ElectricalUserInputsConfig.ResultCardOverrun= new ResultCard( New List(Of SmartResult ))
ElectricalUserInputsConfig.ResultCardTraction= new ResultCard( New List(Of SmartResult ))
PneumaticAuxillariesConfig= New PneumaticsAuxilliariesConfig(False)
PneumaticUserInputsConfig= New PneumaticUserInputsConfig(False)
HvacUserInputsConfig = New HVACUserInputsConfig(New HVACSteadyStateModel(), String.Empty)
Exit sub
End If
If auxConfigFile is Nothing orelse auxConfigFile.Trim().Length=0 orelse Not FILE.Exists(auxConfigFile) then
setdefaults()
Else
setDefaults()
'ElectricalUserInputsConfig.ElectricalConsumers.Items.Clear
If Not Load(auxConfigFile)
MessageBox.Show(String.Format("Unable to load file {0}", auxConfigFile))
End If
End If
End Sub
'Setup
Public Sub ClearDown()
M0 = Nothing
M05 = Nothing
M1 = Nothing
M2 = Nothing
M3 = Nothing
M4 = Nothing
M5 = Nothing
M6 = Nothing
M7 = Nothing
M8 = Nothing
M9 = Nothing
M10 = Nothing
M11 = Nothing
M12 = Nothing
M13 = Nothing
End Sub
Public Sub Initialise()
Dim alternatoMap As IAlternatorMap = New AlternatorMap(ElectricalUserInputsConfig.AlternatorMap)
alternatoMap.Initialise()
Dim actuationsMap As IPneumaticActuationsMAP = New PneumaticActuationsMAP( PneumaticUserInputsConfig.ActuationsMap)
compressorMap = New CompressorMap( PneumaticUserInputsConfig.CompressorMap)
compressorMap.Initialise()
Dim fuelMap As IFUELMAP = New cMAP()
fuelMap.FilePath= VectoInputs.FuelMap
If Not fuelMap.ReadFile() then
MessageBox.Show("Unable to read fuel map, aborting.")
return
End If
fuelMap.Triangulate()
ElectricalUserInputsConfig.ElectricalConsumers.DoorDutyCycleFraction = GetDoorActuationTimeFraction()
M0 = New M0_NonSmart_AlternatorsSetEfficiency( ElectricalUserInputsConfig.ElectricalConsumers,
alternatoMap,
ElectricalUserInputsConfig.PowerNetVoltage,
Signals,
HvacUserInputsConfig.SteadyStateModel)
M05 = New M0_5_SmartAlternatorSetEfficiency(M0,
ElectricalUserInputsConfig.ElectricalConsumers,
alternatoMap,
ElectricalUserInputsConfig.ResultCardIdle,
ElectricalUserInputsConfig.ResultCardTraction,
ElectricalUserInputsConfig.ResultCardOverrun,Signals)
M1 = New M1_AverageHVACLoadDemand(M0,
ElectricalUserInputsConfig.AlternatorGearEfficiency,
PneumaticUserInputsConfig.CompressorGearEfficiency,
ElectricalUserInputsConfig.PowerNetVoltage,
Signals,
HvacUserInputsConfig.SteadyStateModel)
M2 = New M2_AverageElectricalLoadDemand(ElectricalUserInputsConfig.ElectricalConsumers,
M0,
ElectricalUserInputsConfig.AlternatorGearEfficiency,
ElectricalUserInputsConfig.PowerNetVoltage,Signals )
M3 = New M3_AveragePneumaticLoadDemand(PneumaticUserInputsConfig,
PneumaticAuxillariesConfig,
actuationsMap,
compressorMap,
VectoInputs.VehicleWeightKG,
VectoInputs.Cycle,
Signals)
M4 = New M4_AirCompressor(compressorMap,PneumaticUserInputsConfig.CompressorGearRatio,PneumaticUserInputsConfig.CompressorGearEfficiency,Signals)
M5 = New M5__SmartAlternatorSetGeneration( M05, VectoInputs.PowerNetVoltage,ElectricalUserInputsConfig.AlternatorGearEfficiency)
M6 = New M6(M1,M2,M3,M4,M5,Signals)
M7 = New M7(M5,M6,Signals)
M8 = New M8(M1,M6,M7,Signals)
M9 = New M9(M1,M4,M6,M8,fuelMap,PneumaticAuxillariesConfig,Signals)
M10 = New M10(M3,M9,Signals)
M11 = New M11(M1,M3,M6,M8,fuelMap,Signals)
M12 = New M12( M10,M11, Signals )
M13 = New M13(M1,M10,M12,Signals)
End Sub
'Default Values
Private Sub setDefaults()
VectoInputs = New VectoInputs With {.Cycle="Urban", .VehicleWeightKG=16500, .PowerNetVoltage=26.3,.FuelMap="testFuelGoodMap.vmap"}
'Pneumatics
PneumaticUserInputsConfig = New PneumaticUserInputsConfig(true)
PneumaticAuxillariesConfig = New PneumaticsAuxilliariesConfig(true)
ElectricalUserInputsConfig = New ElectricsUserInputsConfig() With {.DoorActuationTimeSecond=4,
.AlternatorGearEfficiency=0.8,
.PowerNetVoltage= VectoInputs.PowerNetVoltage,
.ResultCardIdle= New ResultCard( New List(Of SmartResult)),
.ResultCardOverrun= New ResultCard(New List(Of SmartResult)),
.ResultCardTraction=New ResultCard(New List(Of SmartResult)),
.SmartElectrical=True,
.AlternatorMap="testAlternatorMap.aalt"
}
HvacUserInputsConfig = New HVACUserInputsConfig( New HVACSteadyStateModel(100,100,100), String.Empty)
Signals = New Signals With { .EngineSpeed=2000, .TotalCycleTimeSeconds=3114, .ClutchEngaged=False}
ElectricalUserInputsConfig.ElectricalConsumers= New ElectricalConsumerList(26.3,0.096,true)
End Sub
Private Function GetDoorActuationTimeFraction()As Single
Dim actuationsMap as PneumaticActuationsMAP = New PneumaticActuationsMAP( PneumaticUserInputsConfig.ActuationsMap )
Dim actuationsKey As ActuationsKey = New ActuationsKey( "Park brake + 2 doors",VectoInputs.Cycle)
Dim numActuations as single = actuationsMap.GetNumActuations( actuationsKey)
Dim secondsPerActuation As single = ElectricalUserInputsConfig.DoorActuationTimeSecond
Dim doorDutyCycleFraction as Single = (numActuations * secondsPerActuation)/Signals.TotalCycleTimeSeconds
Return doorDutyCycleFraction
End Function
#Region "Comparison - Compares Configuration Values Are Same"
Private function CompareElectricalConfiguration( other as AuxillaryEnvironment) as boolean
'AlternatorGearEfficiency
If Me.ElectricalUserInputsConfig.AlternatorGearEfficiency<> other.ElectricalUserInputsConfig.AlternatorGearEfficiency then return false
'AlternatorMap
If Me.ElectricalUserInputsConfig.AlternatorMap<> other.ElectricalUserInputsConfig.AlternatorMap then return false
'DoorActuationTimeSecond
If Me.ElectricalUserInputsConfig.DoorActuationTimeSecond<> other.ElectricalUserInputsConfig.DoorActuationTimeSecond then return false
'Consumer list
If Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count<> other.ElectricalUserInputsConfig.ElectricalConsumers.Items.count then return false
Dim i As integer
For i=0 to Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count-1
Dim thisConsumer, otherConsumer As IElectricalConsumer
thisConsumer = Me.ElectricalUserInputsConfig.ElectricalConsumers.Items(i)
otherConsumer = other.ElectricalUserInputsConfig.ElectricalConsumers.Items(i)
If thisConsumer.AvgConsumptionAmps <> otherConsumer.AvgConsumptionAmps OrElse _
thisConsumer.BaseVehicle <> otherConsumer.BaseVehicle OrElse _
thisConsumer.Category <> otherConsumer.Category OrElse _
thisConsumer.ConsumerName <> otherConsumer.ConsumerName OrElse _
thisConsumer.NominalConsumptionAmps <> otherConsumer.NominalConsumptionAmps OrElse _
thisConsumer.NumberInActualVehicle <> otherConsumer.NumberInActualVehicle OrElse _
thisConsumer.PhaseIdle_TractionOn <> otherConsumer.PhaseIdle_TractionOn OrElse _
thisConsumer.TotalAvgConsumptionInWatts <> otherConsumer.TotalAvgConsumptionInWatts OrElse _
thisConsumer.TotalAvgConumptionAmps <> otherConsumer.TotalAvgConumptionAmps Then Return False
Next
'PowerNetVoltage
If Me.ElectricalUserInputsConfig.PowerNetVoltage <> other.ElectricalUserInputsConfig.PowerNetVoltage then Return False
'ResultCardIdle
If Me.ElectricalUserInputsConfig.ResultCardIdle.Results.count <> other.ElectricalUserInputsConfig.ResultCardIdle.Results.Count then Return False
For i = 0 to Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Count-1
If Me.ElectricalUserInputsConfig.ResultCardIdle.Results(i).Amps <> other .ElectricalUserInputsConfig.ResultCardIdle.Results(i).Amps OrElse _
Me.ElectricalUserInputsConfig.ResultCardIdle.Results(i).SmartAmps <> other .ElectricalUserInputsConfig.ResultCardIdle.Results(i).SmartAmps Then Return False
Next
'ResultCardOverrun
If Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.count <> other.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count then Return False
For i = 0 to Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count-1
If Me.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).Amps <> other .ElectricalUserInputsConfig.ResultCardOverrun.Results(i).Amps OrElse _
Me.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).SmartAmps <> other .ElectricalUserInputsConfig.ResultCardOverrun.Results(i).SmartAmps Then Return False
Next
'ResultCardTraction
If Me.ElectricalUserInputsConfig.ResultCardTraction.Results.count <> other.ElectricalUserInputsConfig.ResultCardTraction.Results.Count then Return False
For i = 0 to Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Count-1
If Me.ElectricalUserInputsConfig.ResultCardTraction.Results(i).Amps <> other .ElectricalUserInputsConfig.ResultCardTraction.Results(i).Amps OrElse _
Me.ElectricalUserInputsConfig.ResultCardTraction.Results(i).SmartAmps <> other .ElectricalUserInputsConfig.ResultCardTraction.Results(i).SmartAmps Then Return False
Next
'SmartElectrical
If Me.ElectricalUserInputsConfig.SmartElectrical <> other.ElectricalUserInputsConfig.SmartElectrical then Return False
Return true
End Function
Private Function ComparePneumaticAuxiliariesConfig( other As AuxillaryEnvironment ) As Boolean
If Me.PneumaticAuxillariesConfig.AdBlueNIperMinute <> other.PneumaticAuxillariesConfig.AdBlueNIperMinute then Return False
If Me.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute <> other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute then Return False
If Me.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG <> other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG then Return False
If Me.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG <> other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG then Return False
If Me.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM <> other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM then Return False
If Me.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour <> other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour then Return False
If Me.PneumaticAuxillariesConfig.DeadVolumeLitres <> other.PneumaticAuxillariesConfig.DeadVolumeLitres then Return False
If Me.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand <> other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand then Return False
If Me.PneumaticAuxillariesConfig.PerDoorOpeningNI <> other.PneumaticAuxillariesConfig.PerDoorOpeningNI then Return False
If Me.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG <> other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG then Return False
If Me.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand <> other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand then Return False
If Me.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction <> other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction then Return False
Return true
End Function
Private Function ComparePneumaticUserConfig( other As AuxillaryEnvironment ) As Boolean
If Me.PneumaticUserInputsConfig.ActuationsMap <> other.PneumaticUserInputsConfig.ActuationsMap then Return False
If Me.PneumaticUserInputsConfig.AdBlueDosing <> other.PneumaticUserInputsConfig.AdBlueDosing then Return False
If Me.PneumaticUserInputsConfig.AirSuspensionControl <> other.PneumaticUserInputsConfig.AirSuspensionControl then Return False
If Me.PneumaticUserInputsConfig.CompressorGearEfficiency <> other.PneumaticUserInputsConfig.CompressorGearEfficiency then Return False
If Me.PneumaticUserInputsConfig.CompressorGearRatio <> other.PneumaticUserInputsConfig.CompressorGearRatio then Return False
If Me.PneumaticUserInputsConfig.CompressorMap <> other.PneumaticUserInputsConfig.CompressorMap then Return False
If Me.PneumaticUserInputsConfig.Doors <> other.PneumaticUserInputsConfig.Doors then Return False
If Me.PneumaticUserInputsConfig.KneelingHeightMillimeters <> other.PneumaticUserInputsConfig.KneelingHeightMillimeters then Return False
If Me.PneumaticUserInputsConfig.RetarderBrake <> other.PneumaticUserInputsConfig.RetarderBrake then Return False
If Me.PneumaticUserInputsConfig.SmartAirCompression <> other.PneumaticUserInputsConfig.SmartAirCompression then Return False
If Me.PneumaticUserInputsConfig.SmartRegeneration <> other.PneumaticUserInputsConfig.SmartRegeneration then Return False
Return true
End Function
Private Function CompareHVACConfig( other As AuxillaryEnvironment) As Boolean
If Me.HvacUserInputsConfig.SteadyStateModel.HVACElectricalLoadPowerWatts <> other.HvacUserInputsConfig.SteadyStateModel.HVACElectricalLoadPowerWatts then Return false
If Me.HvacUserInputsConfig.SteadyStateModel.HVACFuellingLitresPerHour <> other.HvacUserInputsConfig.SteadyStateModel.HVACFuellingLitresPerHour then Return false
If Me.HvacUserInputsConfig.SteadyStateModel.HVACMechanicalLoadPowerWatts <> other.HvacUserInputsConfig.SteadyStateModel.HVACMechanicalLoadPowerWatts then Return false
If Me.HvacUserInputsConfig.SSMFilePath <> other.HvacUserInputsConfig.SSMFilePath then Return false
Return true
End Function
Public Function ConfigValuesAreTheSameAs( other As AuxillaryEnvironment) As Boolean
If Not CompareElectricalConfiguration ( other ) then Return False
If Not ComparePneumaticAuxiliariesConfig ( other ) then Return False
If Not ComparePneumaticUserConfig ( other ) then Return False
If Not CompareHVACConfig ( other ) then Return False
Return true
End Function
#End Region
#Region "Persistance - Storage and Retreival of configuration files (.AAUX)"
'Persistance Functions
Public Function Save( filePath As String ) As Boolean
Dim returnValue As Boolean = true
Dim settings As JsonSerializerSettings = new JsonSerializerSettings()
settings.TypeNameHandling = TypeNameHandling.Objects
'JSON METHOD
try
Dim output As string = JsonConvert.SerializeObject(me, Formatting.Indented, settings)
File.WriteAllText(filePath, output)
Catch ex as Exception
'TODO:Do something meaningfull here perhaps logging
returnValue= False
End Try
Return returnValue
End Function
Public Function Load( filePath As String ) As Boolean
Dim returnValue As Boolean = true
Dim settings As JsonSerializerSettings = new JsonSerializerSettings()
Dim tmpAux As AuxillaryEnvironment
settings.TypeNameHandling = TypeNameHandling.Objects
'JSON METHOD
try
me.ClearDown()
Dim output As String = File.ReadAllText(filePath)
tmpAux = JsonConvert.DeserializeObject( Of AuxillaryEnvironment)(output,settings)
'This is where we Assume values of loaded( Deserialized ) object.
AssumeValuesOfOther( tmpAux )
Catch ex as Exception
'TODO:Do something meaningfull here perhaps logging
returnValue= False
End Try
Return returnValue
End Function
'Persistance Helpers
Private sub AssumeValuesOfOther( other As AuxillaryEnvironment )
CloneElectricaConfiguration( other )
ClonePneumaticsAuxiliariesConfig( other )
ClonePneumaticsUserInputsConfig(other)
CloneHVAC(other)
End sub
Private sub CloneElectricaConfiguration( other as AuxillaryEnvironment)
'AlternatorGearEfficiency
me.ElectricalUserInputsConfig.AlternatorGearEfficiency = other.ElectricalUserInputsConfig.AlternatorGearEfficiency
'AlternatorMap
me.ElectricalUserInputsConfig.AlternatorMap = other.ElectricalUserInputsConfig.AlternatorMap
'DoorActuationTimeSecond
me.ElectricalUserInputsConfig.DoorActuationTimeSecond = other.ElectricalUserInputsConfig.DoorActuationTimeSecond
'Electrical Consumer list
Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Clear
For Each otherConsumer As IElectricalConsumer In other.ElectricalUserInputsConfig.ElectricalConsumers.Items
Dim newConsumer As ElectricalConsumer = New ElectricalConsumer( otherConsumer.BaseVehicle, _
otherConsumer.Category, _
otherConsumer.ConsumerName, _
otherConsumer.NominalConsumptionAmps, _
otherConsumer.PhaseIdle_TractionOn, _
otherConsumer.PowerNetVoltage, _
otherConsumer.NumberInActualVehicle )
Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Add( newConsumer )
Next
'PowerNetVoltage
Me.ElectricalUserInputsConfig.PowerNetVoltage = other.ElectricalUserInputsConfig.PowerNetVoltage
'ResultCardIdle
Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Clear
For each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardIdle.Results
Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Add( New SmartResult(result.Amps,result.SmartAmps))
Next
'ResultCardOverrun
For each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardOverrun.Results
Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Add( New SmartResult(result.Amps,result.SmartAmps))
Next
'ResultCardTraction
For each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardTraction.Results
Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Add( New SmartResult(result.Amps,result.SmartAmps))
Next
'SmartElectrical
Me.ElectricalUserInputsConfig.SmartElectrical = other.ElectricalUserInputsConfig.SmartElectrical
End Sub
Private sub ClonePneumaticsAuxiliariesConfig( other as AuxillaryEnvironment)
Me.PneumaticAuxillariesConfig.AdBlueNIperMinute =other.PneumaticAuxillariesConfig.AdBlueNIperMinute
Me.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute =other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute
Me.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG =other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG
Me.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG =other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG
Me.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM =other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM
Me.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour =other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour
Me.PneumaticAuxillariesConfig.DeadVolumeLitres =other.PneumaticAuxillariesConfig.DeadVolumeLitres
Me.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand =other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand
Me.PneumaticAuxillariesConfig.PerDoorOpeningNI =other.PneumaticAuxillariesConfig.PerDoorOpeningNI
Me.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG =other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG
Me.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand =other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand
Me.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction =other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction
End Sub
Private Sub ClonePneumaticsUserInputsConfig ( other As AuxillaryEnvironment )
Me.PneumaticUserInputsConfig.ActuationsMap = other.PneumaticUserInputsConfig.ActuationsMap
Me.PneumaticUserInputsConfig.AdBlueDosing = other.PneumaticUserInputsConfig.AdBlueDosing
Me.PneumaticUserInputsConfig.AirSuspensionControl = other.PneumaticUserInputsConfig.AirSuspensionControl
Me.PneumaticUserInputsConfig.CompressorGearEfficiency = other.PneumaticUserInputsConfig.CompressorGearEfficiency
Me.PneumaticUserInputsConfig.CompressorGearRatio = other.PneumaticUserInputsConfig.CompressorGearRatio
Me.PneumaticUserInputsConfig.CompressorMap = other.PneumaticUserInputsConfig.CompressorMap
Me.PneumaticUserInputsConfig.Doors = other.PneumaticUserInputsConfig.Doors
Me.PneumaticUserInputsConfig.KneelingHeightMillimeters = other.PneumaticUserInputsConfig.KneelingHeightMillimeters
Me.PneumaticUserInputsConfig.RetarderBrake = other.PneumaticUserInputsConfig.RetarderBrake
Me.PneumaticUserInputsConfig.SmartAirCompression = other.PneumaticUserInputsConfig.SmartAirCompression
Me.PneumaticUserInputsConfig.SmartRegeneration = other.PneumaticUserInputsConfig.SmartRegeneration
End Sub
Private Sub CloneHVAC( other As AuxillaryEnvironment)
Me.HvacUserInputsConfig.SteadyStateModel.HVACElectricalLoadPowerWatts = other.HvacUserInputsConfig.SteadyStateModel.HVACElectricalLoadPowerWatts
Me.HvacUserInputsConfig.SteadyStateModel.HVACFuellingLitresPerHour = other.HvacUserInputsConfig.SteadyStateModel.HVACFuellingLitresPerHour
Me.HvacUserInputsConfig.SteadyStateModel.HVACMechanicalLoadPowerWatts = other.HvacUserInputsConfig.SteadyStateModel.HVACMechanicalLoadPowerWatts
Me.HvacUserInputsConfig.SSMFilePath = other.HvacUserInputsConfig.SSMFilePath
End Sub
#End Region
Public Sub VectoEventHandler( byref sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) handles compressorMap.AuxiliaryEvent
End Sub
End Class
Imports System.IO
Namespace Electrics
''' <summary>
''' Alternator Efficiency Map -
''' </summary>
''' <remarks></remarks>
Public Class AlternatorMapX
Implements IAlternatorMap
''' <summary>
''' path to csv file containing map data
''' expects header row
''' Columns - [rpm - integer], [efficiency float, range 0-1], [max regen power float]
''' </summary>
''' <remarks></remarks>
Private ReadOnly filePath As String
Private map As Dictionary(Of AlternatorMapKey, AlternatorMapValues)
''' <summary>
''' Creates a new instance of AlternatorMap class
''' </summary>
''' <param name="filePath">full path to csv data</param>
''' <remarks></remarks>
Public Sub New(ByVal filePath As String)
Me.filePath = filePath
End Sub
''' <summary>
''' Initialise the map from supplied csv data
''' </summary>
''' <returns>Boolean - true if map is created successfully</returns>
''' <remarks></remarks>
Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise
If File.Exists(filePath) Then
Using sr As StreamReader = New StreamReader(filePath)
'get array og lines fron csv
Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), StringSplitOptions.RemoveEmptyEntries)
'Must have at least 2 entries in map to make it usable [dont forget the header row]
If (lines.Count() < 3) Then
Throw New ArgumentException("Insufficient rows in csv to build a usable map")
End If
map = New Dictionary(Of AlternatorMapKey, AlternatorMapValues)()
Dim firstline As Boolean = True
For Each line As String In lines
If Not firstline Then
'split the line
Dim elements() As String = line.Split(New Char() {","}, StringSplitOptions.RemoveEmptyEntries)
'3 entries per line required
If (elements.Length <> 3) Then
Throw New ArgumentException("Incorrect number of values in csv file")
End If
'add values to map
'Create AlternatorKey
Dim aKey As AlternatorMapKey = New AlternatorMapKey(elements(0), elements(1))
Dim aValue As AlternatorMapValues = New AlternatorMapValues()
'Add Efficiency Value to Key.
map.Add(aKey, New AlternatorMapValues(elements(2)))
Else
firstline = False
End If
Next line
End Using
Return True
Else
Throw New ArgumentException("Supplied input file does not exist")
End If
End Function
''' <summary>
''' Returns the alternator efficiency at given rpm
''' </summary>
''' <param name="rpm">alternator rotation speed</param>
''' <returns>Single</returns>
''' <remarks></remarks>
Public Function GetEfficiency(ByVal rpm As single, ByVal amps As single) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency
Dim key As New AlternatorMapKey(amps, rpm)
Return GetValueOrInterpolate(key)
End Function
''' <summary>
''' Returns a AlternatorMapValues instance containing the entries at a given key, or new interpolated values
''' </summary>
''' <returns>AlternatorMapValues</returns>
''' <remarks>Throws exception if Rpm or Amps are outside the map </remarks>
Private Function GetValueOrInterpolate(mapKey As AlternatorMapKey) As AlternatorMapValues
'check the rpm is within the map
Dim min As AlternatorMapKey = map.Keys.Min()
Dim max As AlternatorMapKey = map.Keys.Max()
'If mapKey.amps < min.amps Or mapKey.amps > max.amps Or mapKey.rpm < min.rpm Or mapKey.rpm > max.rpm Then
' Throw New ArgumentOutOfRangeException(String.Format("Extrapolation - Amp/Rpm Values should should be in the range {0} to {1}", min.ToString(), max.ToString()))
'End If
'LIMITING
If mapKey.amps < min.amps then mapKey.amps=min.amps
If mapKey.amps > max.amps then mapKey.amps = max.amps
If mapKey.rpm < min.rpm then mapKey.rpm = min.rpm
If mapKey.rpm > max.rpm then mapKey.rpm= max.rpm
'Check if the rpm is in the current memo
'If supplied present key, we can just return the values
If map.ContainsKey(mapKey) Then
Return map(mapKey)
End If
'Get Pre and Post Keys
Dim rpmPre As AlternatorMapValues
Dim rpmPost As AlternatorMapValues
Dim ampsPre As AlternatorMapValues
Dim ampsPost As AlternatorMapValues
'Pre and Post Data Points
Dim intRpmPre As Integer
Dim intRpmPost As Integer
Dim intAmpsPre As Integer
Dim intAmpsPost As Integer
intRpmPre = (From m In map Where m.Key.rpm <= mapKey.rpm Select m.Key.rpm).Last()
intRpmPost = (From m In map Where m.Key.rpm => mapKey.rpm Select m.Key.rpm).First()
intAmpsPre = (From m In map Where m.Key.amps <= mapKey.amps Select m.Key.amps).Last()
intAmpsPost = (From m In map Where m.Key.amps => mapKey.amps Select m.Key.amps).First()
Dim dAmps As Single
dim dAmpEfficiency as single
Dim ampsEfficiencySlope as single
Dim dRpm As Integer
Dim dRpmEfficiency as single
Dim rpmEfficiencySlope As Single
Dim interpolatedEfficiency As single
Dim ampPreEfficiency As Single
Dim ampPostEfficiency As Single
Dim rpmPreEfficiency As Single
Dim rpmPostEfficiency As Single
'*********** IF PRE AND POST RPM OR PRE AND POST AMPS are the same, the calculation is different. ***********
'SO
'Case RPM is the same
If intRpmPre = intRpmPost then
dAmps = intAmpsPost - intAmpsPre
ampPreEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPre)).Efficiency
ampPostEfficiency = map( New AlternatorMapKey( intAmpsPost, intRpmPre)).Efficiency
interpolatedEfficiency = ampPreEfficiency + ( ( ampPostEfficiency-ampPreEfficiency ) * (( mapKey.amps - intAmpsPre ) / ( intAmpsPost-intAmpsPre )))
Return New AlternatorMapValues(interpolatedEfficiency)
End If
If intAmpsPre = intAmpsPost then
rpmPreEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPre)).Efficiency
rpmPostEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPost)).Efficiency
interpolatedEfficiency = rpmPreEfficiency + ( ( rpmPostEfficiency-rpmPreEfficiency ) * (( mapKey.rpm - intRpmPre ) / ( intRpmPost-intRpmPre )))
Return New AlternatorMapValues(interpolatedEfficiency)
End If
rpmPre = map(New AlternatorMapKey(intAmpsPre, intRpmPre))
rpmPost = map(New AlternatorMapKey(intAmpsPre, intRpmPost))
ampsPre = map(New AlternatorMapKey(intAmpsPost, intRpmPre))
ampsPost = map(New AlternatorMapKey(intAmpsPost, intRpmPost))
'*************************************************************************
'The following biaxial linear interpolation formula was provided
'by Engineering. See example below.
'
' 1500 2000 4000
' 10 A-B <=Interpolated Horizontally
' (C-D)-(A-B) <=Interpolated Virtically
' 27 C-D <=Interpolated Horizontally
'
'************************************************************************
'
'*** A-B Efficiency ( Lower Using Lower Amps )
'get the delta values for rpm and the values
dRpm = intRpmPost - intRpmPre
dRpmEfficiency = rpmPost.Efficiency - rpmPre.Efficiency
'calculate the slopes
rpmEfficiencySlope = dRpmEfficiency / dRpm
'calculate the new values
'Dim AB_Efficiency As Single = If( drpm=0,rpmPre.Efficiency, ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + rpmPre.Efficiency)
Dim AB_Efficiency As Single = ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + rpmPre.Efficiency
'*** C-D Efficiency ( Using Higher Amps )
'get the delta values for rpm and the values
dRpm = intRpmPost - intRpmPre
dRpmEfficiency = ampsPost.Efficiency - ampsPre.Efficiency
'calculate the slopes
rpmEfficiencySlope = dRpmEfficiency / dRpm
'calculate the new values
'Dim CD_Efficiency As Single = If( dRpm=0, rpmPre.Efficiency, ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + ampsPre.Efficiency)
Dim CD_Efficiency As Single = ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + ampsPre.Efficiency
'(C-D) - (A-B) Efficiency
'Deltas
dAmps = intAmpsPost - intAmpsPre
dAmpEfficiency = CD_Efficiency - AB_Efficiency
'slopes
ampsEfficiencySlope = dAmpEfficiency / dAmps
'calculate final Values
' Dim ABCDEfficiency As Single = If( dAmps=0, CD_Efficiency, ((mapKey.amps - intAmpsPre) * ampsEfficiencySlope) + AB_Efficiency)
Dim ABCDEfficiency As Single = ((mapKey.amps - intAmpsPre) * ampsEfficiencySlope) + AB_Efficiency
Return New AlternatorMapValues(ABCDEfficiency)
End Function
Private Structure AlternatorMapKey
Implements IComparable
Public amps As Integer
Public rpm As Integer
Public Sub New(ByVal amps As Integer, ByVal rpm As Integer)
Me.amps = amps
Me.rpm = rpm
End Sub
Public Overrides Function ToString() As String
Return "Amps:" & amps & " / " & "Rpm:" & rpm
End Function
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
Dim compared As AlternatorMapKey = CType(obj, AlternatorMapKey)
Dim otherAlternatorMapKey As AlternatorMapKey = CType(obj, AlternatorMapKey)
'Same Place
If (Me.amps = otherAlternatorMapKey.amps AndAlso Me.rpm = otherAlternatorMapKey.rpm) Then
Return 0
End If
'smaller
If (Me.amps > otherAlternatorMapKey.amps) Or (Me.rpm > otherAlternatorMapKey.rpm) Then
Return 1
Else
Return -1
End If
End Function
End Structure
End Class
End Namespace
\ No newline at end of file
Namespace Electrics
Public Class CombinedAltEntry
Public Property Amps As Single
Public Property EngineSpeed As single
Public Property Efficiency As single
End Class
Public Structure CombinedAltKVP
Public Property Amps As Single
Public Property EngineSpeed As single
End structure
End Namespace
Imports System.Windows.Forms
Imports System.Drawing
Namespace Electrics
Public Class ImageCell
Inherits DataGridViewImageCell
'Public property tt As String = "ABC"
'Private del As Image = My.Resources.ResourceManager.GetObject("Info")
' Protected Overrides Sub Paint(graphics As Graphics, clipBounds As Rectangle, cellBounds As Rectangle, rowIndex As Integer, elementState As DataGridViewElementStates, value As Object, formattedValue As Object, errorText As String, cellStyle As DataGridViewCellStyle, advancedBorderStyle As DataGridViewAdvancedBorderStyle, paintParts As DataGridViewPaintParts)
' advancedBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single
' Me.ToolTipText=tt
' cellStyle.BackColor= Color.White
' MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts)
' graphics.DrawImage(del, cellBounds)
'End Sub
End Class
End Namespace
Imports System.Windows.Forms
Namespace Electrics
Public Class ImageColumn
Inherits DataGridViewImageColumn
Public Sub new()
' MyBase.New()
' Me.CellTemplate = New ImageCell()
End Sub
End Class
End Namespace

Namespace Electrics
Public class IncDecValuePair
Public Amps As Single
Public Efficiency As single
End class
End Namespace

Namespace Electrics
Public Class InterpAltUserInputs
Public shared Function Iterpolate( values As List(Of AltUserInput), x As single) As Single
Dim lowestX As single = values.Min( Function(m) m.Amps)
Dim highestX As Single = values.Max( Function(m) m.Amps)
Dim preKey, postKey ,preEff,postEff, xSlope, EffSlope As single
Dim deltaX , deltaEff As single
Dim slope As single
'Out of range, returns efficiency for lowest
If x< lowestX then Return values.First( Function(f) f.Amps= lowestX).Eff
'Out of range, efficiency for highest
If x> highestX then Return values.First( Function(f) f.Amps= highestX).Eff
'On Bounds check
If values.Where( Function(w) w.Amps=x).Count=1 then Return values.First( Function(w) w.Amps=x).Eff
'OK, we need to interpolate.
preKey = values.Last( Function(l) l.Amps < x).Amps
postKey = values.First( Function(l) l.Amps > x).Amps
preEff = values.First( Function(f) f.Amps=preKey).Eff
postEff = values.First( Function(f) f.Amps=postKey).Eff
deltaX = postKey-preKey
deltaEff = postEff-preEff
'slopes
effSlope = deltaEff/deltaX
Dim retVal As Single = ((x - preKey) * effSlope) + preEff
Return retVal
End Function
End Class
End Namespace
Namespace Hvac
Public MustInherit Class BusFloorBase
Public Property FloorType As String
Public property H as Double
Public Property V As Double
Public property C As Double
End Class
End Namespace

Namespace Hvac
Public Class BusFloorLow
Inherits BusFloorBase
Sub new ()
MyBase.FloorType= "low floor"
End Sub
Sub new ( H As Double, V As Double, C As Double )
Me.New()
MyBase.H=H
MyBase.V=V
MyBase.C=C
End Sub
End Class
End Namespace

Namespace Hvac
Public Class BusFloorRaised
inherits BusFloorBase
Sub new ()
MyBase.FloorType= "raised floor"
End Sub
Sub new ( H As Double, V As Double, C As Double )
Me.New()
MyBase.H=H
MyBase.V=V
MyBase.C=C
End Sub
End Class
End Namespace

Namespace Hvac
Public Class BusFloorSemiLow
Inherits BusFloorBase
Sub new ()
MyBase.FloorType= "semi low floor"
End Sub
Sub new ( H As Double, V As Double, C As Double )
Me.New()
MyBase.H=H
MyBase.V=V
MyBase.C=C
End Sub
End Class
End Namespace
Namespace Hvac
Public structure BusKey
public Model As String
public FloorType As String
public EngineType As String
End structure
End Namespace

Namespace Hvac
Public Class HVACInputs
Implements IHVACInputs
Public Property Region As Integer Implements IHVACInputs.Region
Public Property Season As Integer Implements IHVACInputs.Season
Public Sub New()
End Sub
Public Sub New(Region As Integer, Season As Integer)
Me.Region = Region
Me.Season = Season
End Sub
End Class
End Namespace
Imports System.IO
Imports AdvancedAuxiliaryInterfaces.Electrics
Imports System.Windows.Forms
Namespace Hvac
Public Class HVACMap
Implements IHVACMap
#Region "Header Comments"
'Some sort of multi-dimensional map implemented here
'No interpolation - too expensive/complex to implement?
'Set list of choices in each dimension of input
'options
'1. multi-dimension array
'2. dictionary with a Tuple Key?
'3. dictionary with struct as the key, struct would encapsulate the dimensions - this would map to the HVAC inputs
'Need to test different choices for speed/ease of use
'Initial Mock Implementation - 2 input parameters, 2 output values
'probably easiest to implement the inputs and outputs as structs and then create a dictionary<input,output> ?
'could define the list of inputs based on the supplied map
#End Region
'Constants for .vaux headers
Private Const REGIONheader As String = "Region"
Private Const SEASONheader As String = "Season"
Private Const MECHDheader As String = "MechD"
Private Const ELECDheader As String = "ElecD"
'Private Fields
Private _mapDimensions As Integer
Private _mapPath As String
Private _mechanicalDemandLookupKW As Single
Private _electricalDemandLookupKW As Single
Private _map As List(Of String())
'Public Property _mapHeaders As Dictionary(Of String, HVACMapParameter)
Private _mapHeaders As Dictionary(Of String, HVACMapParameter)
Public Property MapHeaders As Dictionary(Of String, HVACMapParameter) Implements IHVACMap.MapHeaders
Get
Return Me._mapHeaders
End Get
Private Set(ByVal Value As Dictionary(Of String, HVACMapParameter))
Me._mapHeaders = Value
End Set
End Property
'Constructor
''' <summary>
''' Constructor
''' </summary>
''' <param name="iMapPath"></param>
''' <remarks></remarks>
Public Sub New(iMapPath As String)
_mapPath = iMapPath
End Sub
'Initialisers and Map related Methods
Public Function Initialise() As Boolean Implements IHVACMap.Initialise
MapHeaders = New Dictionary(Of String, HVACMapParameter)()
_map = New List(Of String())
InitialiseMapHeaders()
Dim myData As String
Dim linesArray As String()
'Check map file can be found.
Try
myData = System.IO.File.ReadAllText(_mapPath, System.Text.Encoding.UTF8)
Catch ex As FileNotFoundException
Throw New ArgumentException("The map file was not found")
End Try
linesArray = (From s As String In myData.Split(vbLf) Select s.Trim).ToArray
'getValuesIntoMap
Dim lineNumber As Integer = 0
For Each line As String In linesArray
Dim values As String() = line.Split(","c)
'Test number of values
If values.Count <> _mapHeaders.Count Then
Throw New System.ArgumentException("Row contains inconsistant values")
End If
Dim intTest As Single
'Check lines all contain valid rows ( Assume Single )
For Each v As String In values
If lineNumber > 0 AndAlso Not Single.TryParse(v, intTest) Then
Throw New InvalidCastException("A non numeric value was found in the map file")
End If
Next
lineNumber += 1
_map.Add(values)
Next
_mapDimensions = _map(0).Length
'Validate Map
If validateMap() = False Then
Throw New Exception("Unable to complete Load of HVAC MAP")
End If
Return True
End Function
Private Function validateMap() As Boolean
'Lets make sure we have header and also data.
If _map.Count < 2 Then
MessageBox.Show("Map did not contain any data")
Return False
End If
'Make sure we have matching headers for our list of HVACMapParameterList
Dim i As Integer
For i = 0 To _mapDimensions - 1
If Not MapHeaders.ContainsKey(_map(0)(i)) Then
MessageBox.Show("Map header {0} was not found in the prefdefined and expected header list", _map(0)(i))
Return False
Else
'Set ordinal position of respective header.
MapHeaders(_map(0)(i)).OrdinalPosition = i
'Get Unique Values associated with Headers.
MapHeaders(_map(0)(i)).UniqueDataValues = GetUniqueValuesByOrdinal(i)
End If
Next
Return True
End Function
Private Sub InitialiseMapHeaders()
'Not all properties in the HVACMapParameter POCO are initialised here
'As some can only be populated dynamically such as OrdinalPosition.
'Region
Dim region As New HVACMapParameter With {.Key = REGIONheader,
.Description = "Region Code",
.Max = 0,
.Min = 0,
.Name = "Regional Code",
.Notes = "",
.SystemType = GetType(Integer),
.SearchControlType = GetType(System.Windows.Forms.ComboBox)}
MapHeaders.Add(REGIONheader, region)
'Season
Dim season As New HVACMapParameter With {.Key = SEASONheader,
.Description = "Season Code",
.Max = 0,
.Min = 0,
.Name = "Season Code",
.Notes = "",
.SystemType = GetType(Integer),
.SearchControlType = GetType(System.Windows.Forms.ComboBox)}
MapHeaders.Add(SEASONheader, season)
'*************************************************************************************************
' Author.
'
' Add more inputs here - Ensure that these match exactly with the headers in the .vaux file.
'
' This could be done dynamically with a loadable configuration file, but takes more time
'
'************************************************************************************************
'MechD
Dim mechD As New HVACMapParameter With {.Key = MECHDheader,
.Description = "MechD",
.Max = 0,
.Min = 0,
.Name = "MechD",
.Notes = "",
.SystemType = GetType(Integer),
.IsOutput = True}
MapHeaders.Add(MECHDheader, mechD)
'ElecD
Dim elecD As New HVACMapParameter With {.Key = ELECDheader,
.Description = "ElecD",
.Max = 0,
.Min = 0,
.Name = "ElecD",
.Notes = "",
.SystemType = GetType(Integer),
.IsOutput = True}
MapHeaders.Add(ELECDheader, elecD)
End Sub
'Public Map Enquiry Methods
Public Function GetMapHeaders() As Dictionary(Of String, HVACMapParameter) Implements IHVACMap.GetMapHeaders
Return MapHeaders
End Function
Public Function GetMapSubSet(search As String()) As List(Of String()) Implements IHVACMap.GetMapSubSet
'Sanity Check
If (search.Length <> _mapDimensions) Then
Throw New Exception("The search array does not match the number elements in the map")
End If
Dim reducer As New List(Of String())
Dim matched As Boolean
Dim i As Integer ' For each data row
For i = 1 To (_map.Count - 1)
matched = True
Dim o As Integer ' For each ordinal column
For o = 0 To search.Length - 1
'Dont try and match it if it is an output or nothing, what would be the point?
If search(o) = Nothing Or search(o) = "" Or GetMapHeaders.ToArray()(o).Value.IsOutput Then
Continue For ' Get next ordinal
Else
'Try and match
If search(o) <> _map(i)(o) Then
matched = False
End If
End If
Next o
If matched Then
reducer.Add(_map(i))
End If
Next i
Return reducer
End Function
Public Function GetUniqueValuesByOrdinal(o As Integer) As List(Of String) Implements IHVACMap.GetUniqueValuesByOrdinal
'Sanity Check
If (o < 0 Or o >= _mapDimensions) Then
Throw New Exception(Format("Get Unique Values by ordinal ordinal passed {0} is outside the bounds of the array.", o))
End If
Dim results As List(Of String) =
(From r In _map Select r(o) Distinct).ToList()
'Remove Headers
results.Remove(results(0))
Return results
End Function
Public Function GetMechanicalDemand(region As Integer, season As Integer) As Integer Implements IHVACMap.GetMechanicalDemand
Dim search As String() = {region.ToString(), season.ToString(), "", ""}
If (GetMapSubSet(search).Count <> 1) Then
Throw New ArgumentException("Not Exactly one result returned for these inputs.")
End If
'get mechanical demand
Dim resultStr As String = GetMapSubSet(search).First()(_mapHeaders(MECHDheader).OrdinalPosition)
Dim resultInt As Integer = Integer.Parse(resultStr)
Return resultInt
End Function
Public Function GetElectricalDemand(region As Integer, season As Integer) As Integer Implements IHVACMap.GetElectricalDemand
Dim search As String() = {region.ToString(), season.ToString(), "", ""}
If (GetMapSubSet(search).Count <> 1) Then
Throw New ArgumentException("Not Exactly one result returned for these inputs.")
End If
'get electrical demand
Dim resultStr As String = GetMapSubSet(search).First()(_mapHeaders(ELECDheader).OrdinalPosition)
Dim resultInt As Integer = Integer.Parse(resultStr)
Return resultInt
End Function
End Class
End Namespace
\ No newline at end of file
' Copyright 2015 European Union.
' Licensed under the EUPL (the 'Licence');
'
' * You may not use this work except in compliance with the Licence.
' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
' * Unless required by applicable law or agreed to in writing,
' software distributed under the Licence is distributed on an "AS IS" basis,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'
' See the LICENSE.txt for the specific language governing permissions and limitations.
'POCO Class to hold information required to
'1. Reference Value
'2. Create UI Controls on Form.
Namespace Hvac
Public Class HVACMapParameter
Public Key As String
Public Name As String
Public Description As String
Public Notes As String
Public Min As Double
Public Max As Double
Public SystemType As System.Type
Public SearchControlType As System.Type
Public ValueType As System.Type
Public OrdinalPosition As Integer
Public UniqueDataValues As List(Of String)
Public IsOutput As Boolean = False
End Class
End Namespace
\ No newline at end of file

Namespace Hvac
Public Interface IHVACInputs
Property Region As Integer
Property Season As Integer
End Interface
End Namespace
Imports System.IO
Imports AdvancedAuxiliaryInterfaces.Electrics
Imports System.Windows.Forms
Namespace Hvac
Public Interface IHVACMap
Property MapHeaders As Dictionary(Of String, HVACMapParameter)
Function Initialise() As Boolean
'Map Enquiry Methods
Function GetMapHeaders() As Dictionary(Of String, HVACMapParameter)
Function GetMapSubSet(search As String()) As List(Of String())
Function GetUniqueValuesByOrdinal(o As Integer) As List(Of String)
Function GetMechanicalDemand(ByVal region As Integer, ByVal season As Integer) As Integer
Function GetElectricalDemand(ByVal region As Integer, ByVal season As Integer) As Integer
End Interface
End Namespace
Namespace Hvac
Public Class ITechSectionLine
End Class
End Namespace
Public Interface ISignals
Property PreExistingAuxPower As single
Property EngineMotoringPower As single
property EngineDrivelinePower as single
property SmartElectrics As Boolean
Property ClutchEngaged As Boolean
Property EngineSpeed as integer
Property SmartPneumatics As Boolean
Property TotalCycleTimeSeconds As Integer
property EngineDrivelineTorque as single
Property Idle As Boolean
Property InNeutral As Boolean
End Interface
Public Interface IVectoInputs
Property VehicleWeightKG As Single
Property Cycle As String
Property PowerNetVoltage As Single
Property CycleDurationMinutes As single
Property FuelMap As string
End Interface
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