diff --git a/.gitignore b/.gitignore index e71c224455cbda7c9019387965ad4ebb09ef73e3..ef122add7c92d5596da889eb5bf05ff04e3657bd 100644 --- a/.gitignore +++ b/.gitignore @@ -203,3 +203,4 @@ Documentation/VehiclesReleaseComparisonDeclarationMode/*.vmod Documentation/VehiclesReleaseComparisonDeclarationMode/*.vsum DISTR/ +[0-9][0-9][0-9][0-9]_[0-9][0-9]_[0-9][0-9]-VECTO-*.zip diff --git a/VECTO.sln b/VECTO.sln index 93db14b9280d3ad102c43960c0e0b1e1ca96dd8d..d4b07ce4f7336032afac283e2eb2e9adf8e3ad0c 100644 --- a/VECTO.sln +++ b/VECTO.sln @@ -13,16 +13,11 @@ EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VectoAuxiliaries", "VECTOAux\VectoAuxiliaries\VectoAuxiliaries.vbproj", "{FDEEE460-0B8A-4EF6-8D9E-72F203A50F65}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoCore", "VectoCore\VectoCore\VectoCore.csproj", "{CD36938A-ADD9-4C65-96DA-B397CDEEA90A}" - ProjectSection(ProjectDependencies) = postProject - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD} = {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD} - EndProjectSection EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VectoAuxiliariesTests", "VECTOAux\VectoAuxiliariesTests\VectoAuxiliariesTests.vbproj", "{6F31F8B2-6AB3-4F85-8AC9-D09ADCA6432D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoCoreTest", "VectoCore\VectoCoreTest\VectoCoreTest.csproj", "{6A27F93E-4A58-48F6-B00B-3908C5D3D5A2}" EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AdvancedAuxiliaryInterfaces", "VectoCommon\AdvancedAuxiliaryInterfaces\AdvancedAuxiliaryInterfaces.vbproj", "{B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoConsole", "VectoConsole\VectoConsole.csproj", "{60AD4DF0-6648-4374-83CB-C7A162EFB391}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphDrawer", "Tools\GraphDrawer\GraphDrawer.csproj", "{6589CAEC-ECC9-4BCC-9699-DE3F22BBCBD4}" @@ -75,6 +70,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VECTO-GIT", "VECTO-GIT", "{ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VECTO_GIT_TEST", "..\STUDENTEN_PROJEKTE\Kober_VectoGIT\VECTO_GIT\VECTO_GIT_TEST\VECTO_GIT_TEST.csproj", "{52430C51-892A-4D8E-9189-B6C9D09791C0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusAuxiliaries", "VECTOAux\BusAuxiliaries\BusAuxiliaries.csproj", "{550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug PerformanceStats|Any CPU = Debug PerformanceStats|Any CPU @@ -241,32 +238,6 @@ Global {6A27F93E-4A58-48F6-B00B-3908C5D3D5A2}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU {6A27F93E-4A58-48F6-B00B-3908C5D3D5A2}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU {6A27F93E-4A58-48F6-B00B-3908C5D3D5A2}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug PerformanceStats|x86.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug PerformanceTrace|Any CPU.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug PerformanceTrace|x64.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug PerformanceTrace|x86.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug|x64.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Debug|x86.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.DebugTUG|Any CPU.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.DebugTUG|Any CPU.Build.0 = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.DebugTUG|x64.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.DebugTUG|x86.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Deploy|Any CPU.ActiveCfg = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Deploy|Any CPU.Build.0 = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Deploy|x64.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Deploy|x86.ActiveCfg = Debug|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Release|Any CPU.Build.0 = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Release|x64.ActiveCfg = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.Release|x86.ActiveCfg = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.ReleaseTUG|Any CPU.ActiveCfg = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU {60AD4DF0-6648-4374-83CB-C7A162EFB391}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU {60AD4DF0-6648-4374-83CB-C7A162EFB391}.Debug PerformanceStats|Any CPU.Build.0 = Debug|Any CPU {60AD4DF0-6648-4374-83CB-C7A162EFB391}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU @@ -835,6 +806,48 @@ Global {52430C51-892A-4D8E-9189-B6C9D09791C0}.ReleaseTUG|x64.Build.0 = Release|Any CPU {52430C51-892A-4D8E-9189-B6C9D09791C0}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU {52430C51-892A-4D8E-9189-B6C9D09791C0}.ReleaseTUG|x86.Build.0 = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceStats|Any CPU.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceStats|x64.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceStats|x86.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceStats|x86.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceTrace|Any CPU.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceTrace|Any CPU.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceTrace|x64.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceTrace|x64.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceTrace|x86.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug PerformanceTrace|x86.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug|x64.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug|x64.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug|x86.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Debug|x86.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.DebugTUG|Any CPU.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.DebugTUG|Any CPU.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.DebugTUG|x64.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.DebugTUG|x64.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.DebugTUG|x86.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.DebugTUG|x86.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Deploy|Any CPU.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Deploy|x64.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Deploy|x64.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Deploy|x86.ActiveCfg = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Deploy|x86.Build.0 = Debug|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Release|Any CPU.Build.0 = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Release|x64.ActiveCfg = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Release|x64.Build.0 = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Release|x86.ActiveCfg = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.Release|x86.Build.0 = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.ReleaseTUG|Any CPU.ActiveCfg = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.ReleaseTUG|x64.Build.0 = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}.ReleaseTUG|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -844,7 +857,6 @@ Global {CD36938A-ADD9-4C65-96DA-B397CDEEA90A} = {CC93EA68-F3FE-4BCB-9292-1101F94A4D09} {6F31F8B2-6AB3-4F85-8AC9-D09ADCA6432D} = {B7C0A40B-E468-44DE-A784-7A5B8DAC1042} {6A27F93E-4A58-48F6-B00B-3908C5D3D5A2} = {CC93EA68-F3FE-4BCB-9292-1101F94A4D09} - {B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD} = {73A5BF70-6168-456F-95E5-A1402BFA488C} {6589CAEC-ECC9-4BCC-9699-DE3F22BBCBD4} = {351FF7E8-B56B-445E-8E98-A61E07C990DA} {2320CD6F-FE7B-4341-A9BB-3ABCA7EF18F6} = {351FF7E8-B56B-445E-8E98-A61E07C990DA} {E8B0B447-1A54-4BEC-A160-AF0017000781} = {351FF7E8-B56B-445E-8E98-A61E07C990DA} @@ -860,5 +872,6 @@ Global {A684BC49-C9B3-4C0C-8D2E-A13077853EDA} = {5DDEEEC2-743F-4395-B058-687B5773E3D2} {C234077C-F81E-42FA-9367-1319753678A6} = {D29E62A2-CF08-469F-B29F-1B25DCB35386} {52430C51-892A-4D8E-9189-B6C9D09791C0} = {5DDEEEC2-743F-4395-B058-687B5773E3D2} + {550D99D4-25F7-48D9-B0F0-E5DD6CB3485D} = {B7C0A40B-E468-44DE-A784-7A5B8DAC1042} EndGlobalSection EndGlobal diff --git a/VECTO/AdvancedAuxiliariesModule.vb b/VECTO/AdvancedAuxiliariesModule.vb index 652a5dd03758941f01a85b738da341fb91a7e863..556546d550fd8c23cc0835d9a3da9940b6ef2e7f 100644 --- a/VECTO/AdvancedAuxiliariesModule.vb +++ b/VECTO/AdvancedAuxiliariesModule.vb @@ -1,8 +1,9 @@ Imports System.Collections.Generic -Imports VectoAuxiliaries Imports System.IO Imports System.Linq Imports System.Runtime.Remoting +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports VectoAuxiliaries Module AdvancedAuxiliariesModule Public WithEvents AdvancedAuxModel As IAdvancedAuxiliaries @@ -100,7 +101,7 @@ Module AdvancedAuxiliariesModule o = Activator.CreateInstance(chosenAssembly.Value.AssemblyName, "VectoAuxiliaries.AdvancedAuxiliaries") iAdvancedAux = DirectCast(o.Unwrap, IAdvancedAuxiliaries) - iAdvancedAux.Configure(filePath, vectoFilePath) + Configure(filePath, vectoFilePath) Catch ex As Exception @@ -111,6 +112,31 @@ Module AdvancedAuxiliariesModule Return result End Function + Function Configure(filePath As String, vectoFilePath As String) As Boolean + Try + + Dim frmAuxiliaryConfig As New frmAuxiliaryConfig(filePath, vectoFilePath) + + frmAuxiliaryConfig.Show() + + If frmAuxiliaryConfig.DialogResult <> DialogResult.OK Then + + Return True + + Else + + Return False + + End If + + + Catch ex As Exception + + Return False + + End Try + End Function + ''' <summary> ''' Gets location of Advanced Auxiliaries Directory which contains all the assemblies available. diff --git a/VECTO/VECTO.vbproj b/VECTO/VECTO.vbproj index 1d34ccb87bf4e198059d44dccc116d0d5463cb7f..f946f6135fb1819fe792125ee33762294db70518 100644 --- a/VECTO/VECTO.vbproj +++ b/VECTO/VECTO.vbproj @@ -519,9 +519,13 @@ <WCFMetadata Include="Service References\" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\VectoCommon\AdvancedAuxiliaryInterfaces\AdvancedAuxiliaryInterfaces.vbproj"> - <Project>{b4b9bd2f-fd8f-4bb8-82fa-e2154d2c7fbd}</Project> - <Name>AdvancedAuxiliaryInterfaces</Name> + <ProjectReference Include="..\VECTOAux\BusAuxiliaries\BusAuxiliaries.csproj"> + <Project>{550d99d4-25f7-48d9-b0f0-e5dd6cb3485d}</Project> + <Name>BusAuxiliaries</Name> + </ProjectReference> + <ProjectReference Include="..\VECTOAux\VectoAuxiliaries\VectoAuxiliaries.vbproj"> + <Project>{FDEEE460-0B8A-4EF6-8D9E-72F203A50F65}</Project> + <Name>VectoAuxiliaries</Name> </ProjectReference> <ProjectReference Include="..\VectoCommon\VectoCommon\VectoCommon.csproj"> <Project>{79a066ad-69a9-4223-90f6-6ed5d2d084f4}</Project> diff --git a/VECTOAux/BusAuxiliaries/AdvancedAuxiliaries.cs b/VECTOAux/BusAuxiliaries/AdvancedAuxiliaries.cs new file mode 100644 index 0000000000000000000000000000000000000000..617b274618abc52bc7721682e7e1cf72bf03d722 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/AdvancedAuxiliaries.cs @@ -0,0 +1,441 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl; +using TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC; +using TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; +using TUGraz.VectoCore.BusAuxiliaries.Util; + +namespace TUGraz.VectoCore.BusAuxiliaries { + /// <summary> + + /// ''' Main entry point for the advanced auxiliary module. + + /// ''' This class represents slide number 17 titled Calculations of Cycle FC accounting for Smart Auxiliaries. + + /// ''' </summary> + + /// ''' <remarks></remarks> + public class AdvancedAuxiliaries : IAdvancedAuxiliaries + { + protected internal AuxiliaryConfig auxConfig; + + // Supporting classes which may generate event messages + private ICompressorMap compressorMap; + + private SSMTOOL ssmTool; + private SSMTOOL ssmToolModule14; + + private IAlternatorMap alternatorMap; + public IPneumaticActuationsMAP actuationsMap; + private IFuelConsumptionMap fuelMap; + + // Classes which compose the model. + private IM0_NonSmart_AlternatorsSetEfficiency M0; + private IM0_5_SmartAlternatorSetEfficiency M05; + private IM1_AverageHVACLoadDemand M1; + private IM2_AverageElectricalLoadDemand M2; + private IM3_AveragePneumaticLoadDemand M3; + private IM4_AirCompressor M4; + private IM5_SmartAlternatorSetGeneration M5; + private IM6 M6; + private IM7 M7; + private IM8 M8; + private IM9 M9; + private IM10 M10; + private IM11 M11; + private IM12 M12; + private IM13 M13; + private IM14 M14; + + private string vectoDirectory; + + private HVACConstants hvacConstants; + + // Event Handler top level bubble. + // Public Sub VectoEventHandler(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + // Handles compressorMap.AuxiliaryEvent, alternatorMap.AuxiliaryEvent, ssmTool.Message, ssmToolModule14.Message + + // If Signals.AuxiliaryEventReportingLevel <= messageType Then + + // RaiseEvent AuxiliaryEvent(sender, message, messageType) + + // End If + // End Sub + + // Constructor + public AdvancedAuxiliaries() + { + VectoInputs = new VectoInputs(); + Signals = new Signals(); + } + + + + // Initialise Model + public void Initialise(string IAuxPath, string vectoFilePath) + { + string auxPath; + vectoDirectory = FilePathUtils.fPATH(vectoFilePath); + + auxPath = FilePathUtils.ResolveFilePath(vectoDirectory, IAuxPath); + + hvacConstants = new HVACConstants(VectoInputs.FuelDensity); + + Signals.CurrentCycleTimeInSeconds = 0; + auxConfig = new AuxiliaryConfig(auxPath); + + // Pass some signals from config to Signals. ( These are stored in the configuration but shared in the signal distribution around modules ) + Signals.SmartElectrics = auxConfig.ElectricalUserInputsConfig.SmartElectrical; + Signals.StoredEnergyEfficiency = auxConfig.ElectricalUserInputsConfig.StoredEnergyEfficiency; + Signals.SmartPneumatics = auxConfig.PneumaticUserInputsConfig.SmartAirCompression; + Signals.PneumaticOverrunUtilisation = auxConfig.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction; + + alternatorMap = new CombinedAlternator(FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.ElectricalUserInputsConfig.AlternatorMap), Signals); + + actuationsMap = new PneumaticActuationsMap(FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.PneumaticUserInputsConfig.ActuationsMap)); + + compressorMap = new CompressorMap(FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.PneumaticUserInputsConfig.CompressorMap)); + compressorMap.Initialise(); + + // fuelMap = New cMAP() + // fuelMap.FilePath = FilePathUtils.ResolveFilePath(vectoDirectory, VectoInputs.FuelMap) + // If Not fuelMap.ReadFile() Then + // MessageBox.Show("Unable to read fuel map, aborting.") + // Return + // End If + // fuelMap.Triangulate() + fuelMap = VectoInputs.FuelMap; + + auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.DoorDutyCycleFraction = GetDoorActuationTimeFraction(); + + // SSM HVAC + var ssmPath = FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.HvacUserInputsConfig.SSMFilePath); + var BusDatabase = FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.HvacUserInputsConfig.BusDatabasePath); + ssmTool = new SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled); + + // This duplicate SSM is being created for use in M14 as its properties will be dynamically changed at that point + // to honour EngineWaste Heat Usage in Fueling calculations. + ssmToolModule14 = new SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled); + + + if ((ssmTool.Load(ssmPath) == false || ssmToolModule14.Load(ssmPath) == false)) + throw new Exception(string.Format("Unable to load the ssmTOOL with file {0}", ssmPath)); + + + M0 = new M00Impl(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, alternatorMap, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI<Volt>(), Signals, ssmTool); + + + IM0_5_SmartAlternatorSetEfficiency M05tmp = new M0_5Impl(M0, auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, alternatorMap, auxConfig.ElectricalUserInputsConfig.ResultCardIdle, auxConfig.ElectricalUserInputsConfig.ResultCardTraction, auxConfig.ElectricalUserInputsConfig.ResultCardOverrun, Signals); + M05 = M05tmp; + + M1 = new M01Impl(M0, auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI<Volt>(), Signals, ssmTool); + + + M2 = new M02Impl(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, M0, auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI<Volt>(), Signals); + + + M3 = new M03Impl(auxConfig.PneumaticUserInputsConfig, auxConfig.PneumaticAuxillariesConfig, actuationsMap, compressorMap, VectoInputs.VehicleWeightKG, VectoInputs.Cycle, Signals); + + M4 = new M04Impl(compressorMap, auxConfig.PneumaticUserInputsConfig.CompressorGearRatio, auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, Signals); + M5 = new M05Impl(M05tmp, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI<Volt>(), auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency); + M6 = new M06Impl(M1, M2, M3, M4, M5, Signals); + M7 = new M07Impl(M5, M6, Signals); + M8 = new M08Impl(M1, M6, M7, Signals); + M9 = new M09Impl(M1, M4, M6, M8, fuelMap, auxConfig.PneumaticAuxillariesConfig, Signals); + M10 = new M10Impl(M3, M9, Signals); + M11 = new M11Impl(M1, M3, M6, M8, fuelMap, Signals); + M12 = new M12Impl(M10, M11, Signals); + M13 = new M13Impl(M10, M11, M12, Signals); + M14 = new M14Impl(M13, ssmToolModule14, hvacConstants, Signals); + } + + + public ISignals Signals { get; set; } + public IVectoInputs VectoInputs { get; set; } + + public event TUGraz.VectoCore.BusAuxiliaries.Interfaces.AuxiliaryEventEventHandler AuxiliaryEvent; + + public delegate void AuxiliaryEventEventHandler(ref object sender, string message, AdvancedAuxiliaryMessageType messageType); + + //public bool Configure(string filePath, string vectoFilePath) + //{ + // try { + // frmAuxiliaryConfig frmAuxiliaryConfig = new frmAuxiliaryConfig(filePath, vectoFilePath); + + // frmAuxiliaryConfig.Show(); + + // if (frmAuxiliaryConfig.DialogResult != DialogResult.OK) { + // return true; + // } + + // return false; + // } catch (Exception ex) { + // return false; + // } + //} + + public bool CycleStep(Second seconds, ref string message) + { + try { + M9.CycleStep(seconds); + M10.CycleStep(seconds); + M11.CycleStep(seconds); + + Signals.CurrentCycleTimeInSeconds += seconds.Value(); + } catch (Exception ex) { + MessageBox.Show("Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace); + return false; + } + + + return true; + } + + public bool Running + { + get { + throw new NotImplementedException(); + } + } + + public bool RunStart(string auxFilePath, string vectoFilePath) + { + try { + Initialise(auxFilePath, vectoFilePath); + } catch (Exception ex) { + return false; + } + + return true; + } + + public bool RunStop(ref string message) + { + throw new NotImplementedException(); + } + + public void ResetCalculations() + { + var modules = new List<IAbstractModule>() { M0, M05, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14 }; + foreach (var moduel in modules) + moduel.ResetCalculations(); + } + + public Kilogram TotalFuelGRAMS + { + get { + if (M13 != null) + return M14.TotalCycleFCGrams; + else + return 0.SI<Kilogram>(); + } + } + + public Liter TotalFuelLITRES + { + get { + if (M14 != null) + return M14.TotalCycleFCLitres; + else + return 0.SI<Liter>(); + } + } + + public string AuxiliaryName + { + get { + return "BusAuxiliaries"; + } + } + + public string AuxiliaryVersion + { + get { + return "Version 1.0 Beta"; + } + } + + + + // Helpers + private double GetDoorActuationTimeFraction() + { + var actuationsMap = new PneumaticActuationsMap(FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.PneumaticUserInputsConfig.ActuationsMap)); + var actuationsKey = new ActuationsKey("Park brake + 2 doors", VectoInputs.Cycle); + + var numActuations = actuationsMap.GetNumActuations(actuationsKey); + var secondsPerActuation = auxConfig.ElectricalUserInputsConfig.DoorActuationTimeSecond; + + var doorDutyCycleFraction = (numActuations * secondsPerActuation) / (double)Signals.TotalCycleTimeSeconds; + + return doorDutyCycleFraction; + } + + public bool ValidateAAUXFile(string filePath, ref string message) + { + var validResult = FilePathUtils.ValidateFilePath(filePath, ".aaux", ref message); + + return validResult; + } + + // Diagnostics outputs for testing purposes in Vecto. + // Eventually this can be removed or rendered non effective to reduce calculation load on the model. + public double AA_NonSmartAlternatorsEfficiency + { + get { + return M0.AlternatorsEfficiency; + } + } + + public Ampere AA_SmartIdleCurrent_Amps + { + get { + return M05.SmartIdleCurrent; + } + } + + public double AA_SmartIdleAlternatorsEfficiency + { + get { + return M05.AlternatorsEfficiencyIdleResultCard; + } + } + + public Ampere AA_SmartTractionCurrent_Amps + { + get { + return M05.SmartTractionCurrent; + } + } + + public double AA_SmartTractionAlternatorEfficiency + { + get { + return M05.AlternatorsEfficiencyTractionOnResultCard; + } + } + + public Ampere AA_SmartOverrunCurrent_Amps + { + get { + return M05.SmartOverrunCurrent; + } + } + + public double AA_SmartOverrunAlternatorEfficiency + { + get { + return M05.AlternatorsEfficiencyOverrunResultCard; + } + } + + public NormLiterPerSecond AA_CompressorFlowRate_LitrePerSec + { + get { + return M4.GetFlowRate(); + } + } + + public bool AA_OverrunFlag + { + get { + return M6.OverrunFlag; + } + } + + public int? AA_EngineIdleFlag + { + get { + return Signals.EngineSpeed <= Signals.EngineIdleSpeed && (!Signals.ClutchEngaged || Signals.InNeutral) ? 1 : 0; + } + } + + public bool AA_CompressorFlag + { + get { + return M8.CompressorFlag; + } + } + + public Kilogram AA_TotalCycleFC_Grams + { + get { + return M14.TotalCycleFCGrams; + } + } + + public Liter AA_TotalCycleFC_Litres + { + get { + return M14.TotalCycleFCLitres; + } + } + + public Watt AuxiliaryPowerAtCrankWatts + { + get { + return M8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries; + } + } + + public Watt AA_AveragePowerDemandCrankHVACMechanicals + { + get { + return M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts(); + } + } + + public Watt AA_AveragePowerDemandCrankHVACElectricals + { + get { + return M1.AveragePowerDemandAtCrankFromHVACElectricsWatts(); + } + } + + public Watt AA_AveragePowerDemandCrankElectrics + { + get { + return M2.GetAveragePowerAtCrankFromElectrics(); + } + } + + public Watt AA_AveragePowerDemandCrankPneumatics + { + get { + return M3.GetAveragePowerDemandAtCrankFromPneumatics(); + } + } + + public Kilogram AA_TotalCycleFuelConsumptionCompressorOff + { + get { + return M9.TotalCycleFuelConsumptionCompressorOffContinuously; + } + } + + public Kilogram AA_TotalCycleFuelConsumptionCompressorOn + { + get { + return M9.TotalCycleFuelConsumptionCompressorOnContinuously; + } + } + } +} diff --git a/VECTOAux/BusAuxiliaries/AuxiliaryConfig.cs b/VECTOAux/BusAuxiliaries/AuxiliaryConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..428ff7b874338d15be81eb69389ec72fb516ca56 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/AuxiliaryConfig.cs @@ -0,0 +1,445 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; +using Newtonsoft.Json; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC; +using TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; +using TUGraz.VectoCore.BusAuxiliaries.Legacy; + +namespace TUGraz.VectoCore.BusAuxiliaries { + [Serializable()] + public class AuxiliaryConfig : IAuxiliaryConfig + { + // Vecto + public IVectoInputs VectoInputs { get; set; } + + // Electrical + public IElectricsUserInputsConfig ElectricalUserInputsConfig { get; set; } + + // Pneumatics + public IPneumaticUserInputsConfig PneumaticUserInputsConfig { get; set; } + + public IPneumaticsAuxilliariesConfig PneumaticAuxillariesConfig { get; set; } + + // Hvac + public IHVACUserInputsConfig HvacUserInputsConfig { get; set; } + + // Vecto Signals + [JsonIgnore] + public ISignals Signals { get; set; } + + // Constructors + public AuxiliaryConfig() : this("EMPTY") { } + + public AuxiliaryConfig(string auxConfigFile) + { + // Special Condition + if (auxConfigFile == "EMPTY") { + ElectricalUserInputsConfig = new ElectricsUserInputsConfig() { PowerNetVoltage = 28.3 }; + ElectricalUserInputsConfig.ElectricalConsumers = new ElectricalConsumerList(28.3, 0.096, false); + ElectricalUserInputsConfig.ResultCardIdle = new ResultCard(new List<SmartResult>()); + ElectricalUserInputsConfig.ResultCardOverrun = new ResultCard(new List<SmartResult>()); + ElectricalUserInputsConfig.ResultCardTraction = new ResultCard(new List<SmartResult>()); + PneumaticAuxillariesConfig = new PneumaticsAuxilliariesConfig(false); + PneumaticUserInputsConfig = new PneumaticUserInputsConfig(false); + HvacUserInputsConfig = new HVACUserInputsConfig(string.Empty, string.Empty, false); + return; + } + + if (auxConfigFile == null || auxConfigFile.Trim().Length == 0 || !File.Exists(auxConfigFile)) + setDefaults(); + else { + setDefaults(); + + if (!Load(auxConfigFile)) + MessageBox.Show(string.Format("Unable to load file {0}", auxConfigFile)); + } + } + + // Set Default Values + private void setDefaults() + { + var tmp = new VectoInputs + () { + Cycle = "Urban", + VehicleWeightKG = 16500.SI<Kilogram>(), + PowerNetVoltage = 28.3.SI<Volt>() + }; + VectoInputs = tmp; + Signals = new Signals() { EngineSpeed = 2000.RPMtoRad(), TotalCycleTimeSeconds = 3114, ClutchEngaged = false }; + + // Pneumatics set deault values + PneumaticUserInputsConfig = new PneumaticUserInputsConfig(true); + PneumaticAuxillariesConfig = new PneumaticsAuxilliariesConfig(true); + + // Electrical set deault values + ElectricalUserInputsConfig = new ElectricsUserInputsConfig(true, tmp); + ElectricalUserInputsConfig.ElectricalConsumers = new ElectricalConsumerList(28.3, 0.096, true); + + // HVAC set deault values + HvacUserInputsConfig = new HVACUserInputsConfig(string.Empty, string.Empty, false); + } + + private double GetDoorActuationTimeFraction() + { + var actuationsMap = new PneumaticActuationsMap(PneumaticUserInputsConfig.ActuationsMap); + var actuationsKey = new ActuationsKey("Park brake + 2 doors", VectoInputs.Cycle); + + var numActuations = actuationsMap.GetNumActuations(actuationsKey); + var secondsPerActuation = ElectricalUserInputsConfig.DoorActuationTimeSecond; + + var doorDutyCycleFraction = (numActuations * secondsPerActuation) / (double)Signals.TotalCycleTimeSeconds; + + return doorDutyCycleFraction; + } + + + private bool CompareElectricalConfiguration(AuxiliaryConfig other) + { + // AlternatorGearEfficiency + if (ElectricalUserInputsConfig.AlternatorGearEfficiency != other.ElectricalUserInputsConfig.AlternatorGearEfficiency) + return false; + + // AlternatorMap + if (ElectricalUserInputsConfig.AlternatorMap != other.ElectricalUserInputsConfig.AlternatorMap) + return false; + + // DoorActuationTimeSecond + if (ElectricalUserInputsConfig.DoorActuationTimeSecond != other.ElectricalUserInputsConfig.DoorActuationTimeSecond) + return false; + + // Consumer list + if (ElectricalUserInputsConfig.ElectricalConsumers.Items.Count != + other.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count) + return false; + + int i; + for (i = 0; i <= ElectricalUserInputsConfig.ElectricalConsumers.Items.Count - 1; i++) { + IElectricalConsumer thisConsumer, otherConsumer; + thisConsumer = ElectricalUserInputsConfig.ElectricalConsumers.Items[i]; + otherConsumer = other.ElectricalUserInputsConfig.ElectricalConsumers.Items[i]; + + if (thisConsumer.AvgConsumptionAmps != otherConsumer.AvgConsumptionAmps || + thisConsumer.BaseVehicle != otherConsumer.BaseVehicle || thisConsumer.Category != otherConsumer.Category || + thisConsumer.ConsumerName != otherConsumer.ConsumerName || + thisConsumer.NominalConsumptionAmps != otherConsumer.NominalConsumptionAmps || + thisConsumer.NumberInActualVehicle != otherConsumer.NumberInActualVehicle || + thisConsumer.PhaseIdle_TractionOn != otherConsumer.PhaseIdle_TractionOn || + thisConsumer.TotalAvgConsumptionInWatts() != otherConsumer.TotalAvgConsumptionInWatts() || + thisConsumer.TotalAvgConumptionAmps() != otherConsumer.TotalAvgConumptionAmps()) + return false; + } + + // PowerNetVoltage + if (ElectricalUserInputsConfig.PowerNetVoltage != other.ElectricalUserInputsConfig.PowerNetVoltage) + return false; + + // ResultCardIdle + if (ElectricalUserInputsConfig.ResultCardIdle.Results.Count != + other.ElectricalUserInputsConfig.ResultCardIdle.Results.Count) + return false; + + for (i = 0; i <= ElectricalUserInputsConfig.ResultCardIdle.Results.Count - 1; i++) { + if (ElectricalUserInputsConfig.ResultCardIdle.Results[i].Amps != + other.ElectricalUserInputsConfig.ResultCardIdle.Results[i].Amps || + ElectricalUserInputsConfig.ResultCardIdle.Results[i].SmartAmps != + other.ElectricalUserInputsConfig.ResultCardIdle.Results[i].SmartAmps) + return false; + } + + // ResultCardOverrun + if (ElectricalUserInputsConfig.ResultCardOverrun.Results.Count != + other.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count) + return false; + + for (i = 0; i <= ElectricalUserInputsConfig.ResultCardOverrun.Results.Count - 1; i++) { + if (ElectricalUserInputsConfig.ResultCardOverrun.Results[i].Amps != + other.ElectricalUserInputsConfig.ResultCardOverrun.Results[i].Amps || + ElectricalUserInputsConfig.ResultCardOverrun.Results[i].SmartAmps != + other.ElectricalUserInputsConfig.ResultCardOverrun.Results[i].SmartAmps) + return false; + } + + // ResultCardTraction + if (ElectricalUserInputsConfig.ResultCardTraction.Results.Count != + other.ElectricalUserInputsConfig.ResultCardTraction.Results.Count) + return false; + + for (i = 0; i <= ElectricalUserInputsConfig.ResultCardTraction.Results.Count - 1; i++) { + if (ElectricalUserInputsConfig.ResultCardTraction.Results[i].Amps != + other.ElectricalUserInputsConfig.ResultCardTraction.Results[i].Amps || + ElectricalUserInputsConfig.ResultCardTraction.Results[i].SmartAmps != + other.ElectricalUserInputsConfig.ResultCardTraction.Results[i].SmartAmps) + return false; + } + + // SmartElectrical + if (ElectricalUserInputsConfig.SmartElectrical != other.ElectricalUserInputsConfig.SmartElectrical) + return false; + + return true; + } + + private bool ComparePneumaticAuxiliariesConfig(AuxiliaryConfig other) + { + if (PneumaticAuxillariesConfig.AdBlueNIperMinute != other.PneumaticAuxillariesConfig.AdBlueNIperMinute) + return false; + if (PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute != + other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute) + return false; + if (PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG != other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG) + return false; + if (PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG != + other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG) + return false; + if (PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM != + other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM) + return false; + if (PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour != + other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour) + return false; + if (PneumaticAuxillariesConfig.DeadVolumeLitres != other.PneumaticAuxillariesConfig.DeadVolumeLitres) + return false; + if (PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand != + other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand) + return false; + if (PneumaticAuxillariesConfig.PerDoorOpeningNI != other.PneumaticAuxillariesConfig.PerDoorOpeningNI) + return false; + if (PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG != + other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG) + return false; + if (PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand != + other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand) + return false; + if (PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction != + other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction) + return false; + + return true; + } + + private bool ComparePneumaticUserConfig(AuxiliaryConfig other) + { + if (PneumaticUserInputsConfig.ActuationsMap != other.PneumaticUserInputsConfig.ActuationsMap) + return false; + if (PneumaticUserInputsConfig.AdBlueDosing != other.PneumaticUserInputsConfig.AdBlueDosing) + return false; + if (PneumaticUserInputsConfig.AirSuspensionControl != other.PneumaticUserInputsConfig.AirSuspensionControl) + return false; + if (PneumaticUserInputsConfig.CompressorGearEfficiency != other.PneumaticUserInputsConfig.CompressorGearEfficiency) + return false; + if (PneumaticUserInputsConfig.CompressorGearRatio != other.PneumaticUserInputsConfig.CompressorGearRatio) + return false; + if (PneumaticUserInputsConfig.CompressorMap != other.PneumaticUserInputsConfig.CompressorMap) + return false; + if (PneumaticUserInputsConfig.Doors != other.PneumaticUserInputsConfig.Doors) + return false; + if (PneumaticUserInputsConfig.KneelingHeightMillimeters != other.PneumaticUserInputsConfig.KneelingHeightMillimeters) + return false; + if (PneumaticUserInputsConfig.RetarderBrake != other.PneumaticUserInputsConfig.RetarderBrake) + return false; + if (PneumaticUserInputsConfig.SmartAirCompression != other.PneumaticUserInputsConfig.SmartAirCompression) + return false; + if (PneumaticUserInputsConfig.SmartRegeneration != other.PneumaticUserInputsConfig.SmartRegeneration) + return false; + + return true; + } + + private bool CompareHVACConfig(AuxiliaryConfig other) + { + if (HvacUserInputsConfig.SSMFilePath != other.HvacUserInputsConfig.SSMFilePath) + return false; + if (HvacUserInputsConfig.BusDatabasePath != other.HvacUserInputsConfig.BusDatabasePath) + return false; + if (HvacUserInputsConfig.SSMDisabled != other.HvacUserInputsConfig.SSMDisabled) + return false; + + return true; + } + + public bool ConfigValuesAreTheSameAs(AuxiliaryConfig other) + { + if (!CompareElectricalConfiguration(other)) + return false; + if (!ComparePneumaticAuxiliariesConfig(other)) + return false; + if (!ComparePneumaticUserConfig(other)) + return false; + if (!CompareHVACConfig(other)) + return false; + + return true; + } + + + // Persistance Functions + public bool Save(string auxFile) + { + var returnValue = true; + var settings = new JsonSerializerSettings(); + settings.TypeNameHandling = TypeNameHandling.Objects; + + // JSON METHOD + try { + var output = JsonConvert.SerializeObject(this, Formatting.Indented, settings); + + File.WriteAllText(auxFile, output); + } catch (Exception ex) { + returnValue = false; + } + + return returnValue; + } + + public bool Load(string auxFile) + { + var returnValue = true; + var settings = new JsonSerializerSettings(); + AuxiliaryConfig tmpAux; + + settings.TypeNameHandling = TypeNameHandling.Objects; + + // JSON METHOD + try { + var output = File.ReadAllText(auxFile); + + tmpAux = JsonConvert.DeserializeObject<AuxiliaryConfig>(output, settings); + + // This is where we Assume values of loaded( Deserialized ) object. + AssumeValuesOfOther(tmpAux); + if (tmpAux.VectoInputs.FuelMapFile != null) { + var tmp = new cMAP(); + tmp.FilePath = Path.Combine(Path.GetDirectoryName(auxFile), tmpAux.VectoInputs.FuelMapFile); + if (!tmp.ReadFile()) { + MessageBox.Show("Unable to read fuel map, aborting."); + return false; + } + + tmp.Triangulate(); + VectoInputs.FuelMap = tmp; + } + } catch (Exception ex) { + returnValue = false; + } + + return returnValue; + } + + // Persistance Helpers + public void AssumeValuesOfOther(AuxiliaryConfig other) + { + CloneElectricaConfiguration(other); + ClonePneumaticsAuxiliariesConfig(other); + ClonePneumaticsUserInputsConfig(other); + CloneHVAC(other); + } + + private void CloneElectricaConfiguration(AuxiliaryConfig other) + { + // AlternatorGearEfficiency + ElectricalUserInputsConfig.AlternatorGearEfficiency = other.ElectricalUserInputsConfig.AlternatorGearEfficiency; + + // AlternatorMap + ElectricalUserInputsConfig.AlternatorMap = other.ElectricalUserInputsConfig.AlternatorMap; + + // DoorActuationTimeSecond + ElectricalUserInputsConfig.DoorActuationTimeSecond = other.ElectricalUserInputsConfig.DoorActuationTimeSecond; + + // Electrical Consumer list + ElectricalUserInputsConfig.ElectricalConsumers.Items.Clear(); + foreach (var otherConsumer in other.ElectricalUserInputsConfig.ElectricalConsumers.Items) { + var newConsumer = new ElectricalConsumer( + otherConsumer.BaseVehicle, otherConsumer.Category, otherConsumer.ConsumerName, otherConsumer.NominalConsumptionAmps, + otherConsumer.PhaseIdle_TractionOn, otherConsumer.PowerNetVoltage, otherConsumer.NumberInActualVehicle, + otherConsumer.Info); + + ElectricalUserInputsConfig.ElectricalConsumers.Items.Add(newConsumer); + } + + // PowerNetVoltage + ElectricalUserInputsConfig.PowerNetVoltage = other.ElectricalUserInputsConfig.PowerNetVoltage; + + // ResultCardIdle + ElectricalUserInputsConfig.ResultCardIdle.Results.Clear(); + foreach (var result in other.ElectricalUserInputsConfig.ResultCardIdle.Results) + ElectricalUserInputsConfig.ResultCardIdle.Results.Add(new SmartResult(result.Amps, result.SmartAmps)); + + // ResultCardOverrun + ElectricalUserInputsConfig.ResultCardOverrun.Results.Clear(); + foreach (var result in other.ElectricalUserInputsConfig.ResultCardOverrun.Results) + ElectricalUserInputsConfig.ResultCardOverrun.Results.Add(new SmartResult(result.Amps, result.SmartAmps)); + + // ResultCardTraction + ElectricalUserInputsConfig.ResultCardTraction.Results.Clear(); + foreach (var result in other.ElectricalUserInputsConfig.ResultCardTraction.Results) + ElectricalUserInputsConfig.ResultCardTraction.Results.Add(new SmartResult(result.Amps, result.SmartAmps)); + + // SmartElectrical + ElectricalUserInputsConfig.SmartElectrical = other.ElectricalUserInputsConfig.SmartElectrical; + } + + private void ClonePneumaticsAuxiliariesConfig(AuxiliaryConfig other) + { + PneumaticAuxillariesConfig.AdBlueNIperMinute = other.PneumaticAuxillariesConfig.AdBlueNIperMinute; + PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute = + other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute; + PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG = other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG; + PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG = other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG; + PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM = + other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM; + PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour = + other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour; + PneumaticAuxillariesConfig.DeadVolumeLitres = other.PneumaticAuxillariesConfig.DeadVolumeLitres; + PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand = + other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand; + PneumaticAuxillariesConfig.PerDoorOpeningNI = other.PneumaticAuxillariesConfig.PerDoorOpeningNI; + PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG = + other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG; + PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand = + other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand; + PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction = + other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction; + } + + private void ClonePneumaticsUserInputsConfig(AuxiliaryConfig other) + { + PneumaticUserInputsConfig.ActuationsMap = other.PneumaticUserInputsConfig.ActuationsMap; + PneumaticUserInputsConfig.AdBlueDosing = other.PneumaticUserInputsConfig.AdBlueDosing; + PneumaticUserInputsConfig.AirSuspensionControl = other.PneumaticUserInputsConfig.AirSuspensionControl; + PneumaticUserInputsConfig.CompressorGearEfficiency = other.PneumaticUserInputsConfig.CompressorGearEfficiency; + PneumaticUserInputsConfig.CompressorGearRatio = other.PneumaticUserInputsConfig.CompressorGearRatio; + PneumaticUserInputsConfig.CompressorMap = other.PneumaticUserInputsConfig.CompressorMap; + PneumaticUserInputsConfig.Doors = other.PneumaticUserInputsConfig.Doors; + PneumaticUserInputsConfig.KneelingHeightMillimeters = other.PneumaticUserInputsConfig.KneelingHeightMillimeters; + PneumaticUserInputsConfig.RetarderBrake = other.PneumaticUserInputsConfig.RetarderBrake; + PneumaticUserInputsConfig.SmartAirCompression = other.PneumaticUserInputsConfig.SmartAirCompression; + PneumaticUserInputsConfig.SmartRegeneration = other.PneumaticUserInputsConfig.SmartRegeneration; + } + + private void CloneHVAC(AuxiliaryConfig other) + { + HvacUserInputsConfig.SSMFilePath = other.HvacUserInputsConfig.SSMFilePath; + HvacUserInputsConfig.BusDatabasePath = other.HvacUserInputsConfig.BusDatabasePath; + HvacUserInputsConfig.SSMDisabled = other.HvacUserInputsConfig.SSMDisabled; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/BusAuxiliaries.csproj b/VECTOAux/BusAuxiliaries/BusAuxiliaries.csproj new file mode 100644 index 0000000000000000000000000000000000000000..b4cdb4b1be5499e0167d696d44db0347a0f8e9f9 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/BusAuxiliaries.csproj @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>TUGraz.VectoCore.BusAuxiliaries</RootNamespace> + <AssemblyName>BusAuxiliaries</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Microsoft.VisualBasic" /> + <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Omu.ValueInjecter, Version=3.1.1.0, Culture=neutral, PublicKeyToken=c7694541b0ac80e4, processorArchitecture=MSIL"> + <HintPath>..\..\packages\ValueInjecter.3.1.1.5\lib\net40\Omu.ValueInjecter.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AuxiliaryConfig.cs" /> + <Compile Include="AdvancedAuxiliaries.cs" /> + <Compile Include="IAuxiliaryConfig.cs" /> + <Compile Include="DownstreamModules\Impl\AbstractModule.cs" /> + <Compile Include="DownstreamModules\Impl\AlternatorMap.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\Alternator.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\ElectricsUserInputsConfig.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\ResultCard.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\ElectricalConsumer.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\ElectricalConsumerList.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\CombinedAlternatorSignals.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\CombinedAlternatorMapRow.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\CombinedAlternator.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\M00Impl.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\M02Impl.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\Bus.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\BusDatabase.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\BusEngineType.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\SSMTOOL.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\SSMTechList.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\SSMRun.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\SSMGenInputs.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\SSMCalculate.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\HVACUserInputsConfig.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\HVACSteadyStateModel.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\HVACConstants.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\EnvironmentalConditionsMap.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\EnvironmentalCondition.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\DeleteCell.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\DeleteColumn.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\IBusDatabase.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\IBus.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\TechListBenefitLine.cs" /> + <Compile Include="DownstreamModules\Impl\Pneumatics\PneumaticUserInputsConfig.cs" /> + <Compile Include="DownstreamModules\Impl\Pneumatics\PneumaticsAuxilliariesConfig.cs" /> + <Compile Include="DownstreamModules\Impl\Pneumatics\PneumaticActuationsMap.cs" /> + <Compile Include="DownstreamModules\Impl\Pneumatics\CompressorMap.cs" /> + <Compile Include="DownstreamModules\Impl\Pneumatics\M03Impl.cs" /> + <Compile Include="DownstreamModules\Impl\Pneumatics\M04Impl.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\M05Impl.cs" /> + <Compile Include="DownstreamModules\Impl\Electrics\M0_5Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M10Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M11Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M12Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M13Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M14Impl.cs" /> + <Compile Include="DownstreamModules\Impl\HVAC\M01Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M06Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M07Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M08Impl.cs" /> + <Compile Include="DownstreamModules\Impl\M09Impl.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\SmartResult.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\IResultCard.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\IElectricsUserInputsConfig.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\IElectricalConsumerList.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\IElectricalConsumer.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\ICombinedAlternatorSignals.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\ICombinedAlternatorMapRow.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\AlternatorMapValues.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\AltUserInput.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\ElectricConstants.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\IAlternator.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\IAlternatorMap.cs" /> + <Compile Include="Interfaces\DownstreamModules\Electrics\ICombinedAlternator.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\Class1.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\ISSMTOOL.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\ISSMTechList.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\ISSMRun.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\ISSMGenInputs.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\ISSMCalculate.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\IHVACUserInputsConfig.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\IHVACSteadyStateModel.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\IHVACConstants.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\IEnvironmentalConditionsMap.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\IEnvironmentalCondition.cs" /> + <Compile Include="Interfaces\DownstreamModules\HVAC\ITechListBenefitLine.cs" /> + <Compile Include="Interfaces\DownstreamModules\IAbstractModule.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM0_5_SmartAlternatorSetEfficiency.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM0_NonSmart_AlternatorsSetEfficiency.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM10.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM11.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM13.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM14.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM1_AverageHVACLoadDemand.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM2_AverageElectrialLoadDemand.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM3_AveragePneumaticLoadDemand.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM4_AirCompressor.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM5_SmartAlternatorSetGeneration.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM6.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM7.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM8.cs" /> + <Compile Include="Interfaces\DownstreamModules\IM9.cs" /> + <Compile Include="Interfaces\DownstreamModules\PneumaticSystem\ActuationsKey.cs" /> + <Compile Include="Interfaces\DownstreamModules\PneumaticSystem\IPneumaticUserInputsConfig.cs" /> + <Compile Include="Interfaces\DownstreamModules\PneumaticSystem\IPneumaticsAuxilliariesConfig.cs" /> + <Compile Include="Interfaces\DownstreamModules\PneumaticSystem\IPneumaticActuationsMAP.cs" /> + <Compile Include="Interfaces\DownstreamModules\PneumaticSystem\ICompressorMap.cs" /> + <Compile Include="Interfaces\Enumerations.cs" /> + <Compile Include="Interfaces\IAdvancedAuxiliaries.cs" /> + <Compile Include="Interfaces\IAuxiliaryEvent.cs" /> + <Compile Include="Interfaces\IFuelConsumptionMap.cs" /> + <Compile Include="Interfaces\IM12.cs" /> + <Compile Include="Interfaces\ISignals.cs" /> + <Compile Include="Interfaces\IVectoInputs.cs" /> + <Compile Include="Interfaces\Signals.cs" /> + <Compile Include="Interfaces\VectoInputs.cs" /> + <Compile Include="Legacy\cDelaunayMap.cs" /> + <Compile Include="Legacy\cFile_V3.cs" /> + <Compile Include="Legacy\Class1.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Util\FilePathUtils.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\VectoCommon\VectoCommon\VectoCommon.csproj"> + <Project>{79A066AD-69A9-4223-90F6-6ED5D2D084F4}</Project> + <Name>VectoCommon</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <None Include="Images\application-export-icon-small.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Delete.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + </ItemGroup> + <ItemGroup> + <None Include="Images\Delete1.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\Blank.bmp" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\desktop.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\favorites.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\file-history.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\Image1.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\Info.bmp" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\new_dir.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\Open-icon.png" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/AbstractModule.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/AbstractModule.cs new file mode 100644 index 0000000000000000000000000000000000000000..8eb867e312d5e09db1de2c6c386b65413ecbfc07 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/AbstractModule.cs @@ -0,0 +1,25 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public abstract class AbstractModule + { + protected bool calculationValid { get; private set; } + + public AbstractModule() + { + calculationValid = false; + } + + public virtual void ResetCalculations() + { + calculationValid = false; + } + + protected virtual void Calculate() + { + DoCalculate(); + calculationValid = true; + } + + protected virtual void DoCalculate() { } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/AlternatorMap.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/AlternatorMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..264d84c505acc620755218ca8f50a9c0ffe6cee9 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/AlternatorMap.cs @@ -0,0 +1,371 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class AlternatorMap : IAlternatorMap + { + private readonly string filePath; + + private List<MapPoint> _map = new List<MapPoint>(); + private List<double> _yRange; + private List<double> _xRange; + private double _minX, _minY, _maxX, _maxY; + + // Required Action Test or Interpolation Type + public bool OnBoundaryYInterpolatedX(double x, double y) + { + return _yRange.Contains(y) && !_xRange.Contains(x); + } + + public bool OnBoundaryXInterpolatedY(double x, double y) + { + return !_yRange.Contains(y) && _xRange.Contains(x); + } + + public bool ONBoundaryXY(double x, double y) + { + return (from sector in _map + where sector.Y == y && sector.x == x + select sector).Count() == 1; + } + + // Determine Value Methods + private double GetOnBoundaryXY(double x, double y) + { + return (from sector in _map + where sector.Y == y && sector.x == x + select sector).First().v; + } + + private double GetOnBoundaryYInterpolatedX(double x, double y) + { + double x0, x1, v0, v1, slope, dx; + + x0 = (from p in _xRange + orderby p + where p < x + select p).Last(); + x1 = (from p in _xRange + orderby p + where p > x + select p).First(); + dx = x1 - x0; + + v0 = GetOnBoundaryXY(x0, y); + v1 = GetOnBoundaryXY(x1, y); + + slope = (v1 - v0) / (x1 - x0); + + return v0 + ((x - x0) * slope); + } + + private double GetOnBoundaryXInterpolatedY(double x, double y) + { + double y0, y1, v0, v1, dy, v, slope; + + y0 = (from p in _yRange + orderby p + where p < y + select p).Last(); + y1 = (from p in _yRange + orderby p + where p > y + select p).First(); + dy = y1 - y0; + + v0 = GetOnBoundaryXY(x, y0); + v1 = GetOnBoundaryXY(x, y1); + + slope = (v1 - v0) / (y1 - y0); + + v = v0 + ((y - y0) * slope); + + return v; + } + + private double GetBiLinearInterpolatedValue(double x, double y) + { + double q11, q12, q21, q22, x1, x2, y1, y2, r1, r2, p; + + y1 = (from mapSector in _map + where mapSector.Y < y + select mapSector).Last().Y; + y2 = (from mapSector in _map + where mapSector.Y > y + select mapSector).First().Y; + + x1 = (from mapSector in _map + where mapSector.x < x + select mapSector).Last().x; + x2 = (from mapSector in _map + where mapSector.x > x + select mapSector).First().x; + + q11 = GetOnBoundaryXY(x1, y1); + q12 = GetOnBoundaryXY(x1, y2); + + q21 = GetOnBoundaryXY(x2, y1); + q22 = GetOnBoundaryXY(x2, y2); + + r1 = ((x2 - x) / (x2 - x1)) * q11 + ((x - x1) / (x2 - x1)) * q21; + + r2 = ((x2 - x) / (x2 - x1)) * q12 + ((x - x1) / (x2 - x1)) * q22; + + + p = ((y2 - y) / (y2 - y1)) * r1 + ((y - y1) / (y2 - y1)) * r2; + + + return p; + } + + // Utilities + private void fillMapWithDefaults() + { + _map.Add(new MapPoint(10, 1500, 0.615)); + _map.Add(new MapPoint(27, 1500, 0.7)); + _map.Add(new MapPoint(53, 1500, 0.1947)); + _map.Add(new MapPoint(63, 1500, 0.0)); + _map.Add(new MapPoint(68, 1500, 0.0)); + _map.Add(new MapPoint(125, 1500, 0.0)); + _map.Add(new MapPoint(136, 1500, 0.0)); + _map.Add(new MapPoint(10, 2000, 0.62)); + _map.Add(new MapPoint(27, 2000, 0.7)); + _map.Add(new MapPoint(53, 2000, 0.3)); + _map.Add(new MapPoint(63, 2000, 0.1462)); + _map.Add(new MapPoint(68, 2000, 0.692)); + _map.Add(new MapPoint(125, 2000, 0.0)); + _map.Add(new MapPoint(136, 2000, 0.0)); + _map.Add(new MapPoint(10, 4000, 0.64)); + _map.Add(new MapPoint(27, 4000, 0.6721)); + _map.Add(new MapPoint(53, 4000, 0.7211)); + _map.Add(new MapPoint(63, 4000, 0.74)); + _map.Add(new MapPoint(68, 4000, 0.7352)); + _map.Add(new MapPoint(125, 4000, 0.68)); + _map.Add(new MapPoint(136, 4000, 0.6694)); + _map.Add(new MapPoint(10, 6000, 0.53)); + _map.Add(new MapPoint(27, 6000, 0.5798)); + _map.Add(new MapPoint(53, 6000, 0.656)); + _map.Add(new MapPoint(63, 6000, 0.6853)); + _map.Add(new MapPoint(68, 6000, 0.7)); + _map.Add(new MapPoint(125, 6000, 0.6329)); + _map.Add(new MapPoint(136, 6000, 0.62)); + _map.Add(new MapPoint(10, 7000, 0.475)); + _map.Add(new MapPoint(27, 7000, 0.5337)); + _map.Add(new MapPoint(53, 7000, 0.6235)); + _map.Add(new MapPoint(63, 7000, 0.658)); + _map.Add(new MapPoint(68, 7000, 0.6824)); + _map.Add(new MapPoint(125, 7000, 0.6094)); + _map.Add(new MapPoint(136, 7000, 0.5953)); + } + + private void getMapRanges() + { + ;/* +Input: + + _yRange = (From coords As MapPoint In _map Order By coords.Y Select coords.Y Distinct).ToList() + */ + ;/* +Input: + _xRange = (From coords As MapPoint In _map Order By coords.x Select coords.x Distinct).ToList() + */ + _yRange = _map.Select(x => x.Y).Distinct().OrderBy(x => x).ToList(); + _xRange = _map.Select(x => x.x).Distinct().OrderBy(x => x).ToList(); + + _minX = _xRange.First(); + _maxX = _xRange.Last(); + _minY = _yRange.First(); + _maxY = _yRange.Last(); + } + + // Single entry point to determine Value on map + public double GetValue(double x, double y) + { + if (x < _minX || x > _maxX || y < _minY || y > _maxY) { + + // OnAuxiliaryEvent(String.Format("Alternator Map Limiting : RPM{0}, AMPS{1}",x,y),AdvancedAuxiliaryMessageType.Warning) + + + // Limiting + if (x < _minX) + x = _minX; + if (x > _maxX) + x = _maxX; + if (y < _minY) + y = _minY; + if (y > _maxY) + y = _maxY; + } + + + // Satisfies both data points - non interpolated value + if (ONBoundaryXY(x, y)) + return GetOnBoundaryXY(x, y); + + // Satisfies only x or y - single interpolation value + if (OnBoundaryXInterpolatedY(x, y)) + return GetOnBoundaryXInterpolatedY(x, y); + if (OnBoundaryYInterpolatedX(x, y)) + return GetOnBoundaryYInterpolatedX(x, y); + + // satisfies no data points - Bi-Linear interpolation + return GetBiLinearInterpolatedValue(x, y); + } + + public string ReturnDefaultMapValueTests() + { + var sb = new StringBuilder(); + + // All Sector Values + sb.AppendLine("All Values From Map"); + sb.AppendLine("-------------------"); + foreach (var xr in _xRange) { + foreach (var yr in _yRange) + sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", xr, yr, GetValue(xr, yr))); + } + + sb.AppendLine(""); + sb.AppendLine("Four Corners with interpolated other"); + sb.AppendLine("-------------------"); + var x = 1500.0; + var y = 18.5; + sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); + x = 7000; + y = 96.5; + sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); + x = 1750; + y = 10; + sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); + x = 6500; + y = 10; + sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); + + sb.AppendLine(""); + sb.AppendLine("Interpolated both"); + sb.AppendLine("-------------------"); + + double mx, my; + int x2, y2; + for (x2 = 0; x2 <= _xRange.Count - 2; x2++) { + for (y2 = 0; y2 <= _yRange.Count - 2; y2++) { + mx = _xRange[x2] + (_xRange[x2 + 1] - _xRange[x2]) / 2; + my = _yRange[y2] + (_yRange[y2 + 1] - _yRange[y2]) / 2; + + sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", mx, my, GetValue(mx, my))); + } + } + + sb.AppendLine(""); + sb.AppendLine("MIKE -> 40 & 1000"); + sb.AppendLine("-------------------"); + x = 1000; + y = 40; + sb.AppendLine(string.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))); + + + return sb.ToString(); + } + + // Constructors + public AlternatorMap(string filepath) + { + this.filePath = filepath; + + Initialise(); + + getMapRanges(); + } + + private class MapPoint + { + public double Y; + public double x; + public double v; + + public MapPoint(double y, double x, double v) + { + this.Y = y; + this.x = x; + this.v = v; + } + } + + // Get Alternator Efficiency + public AlternatorMapValues GetEfficiency(double rpm, Ampere amps) + { + return new AlternatorMapValues(GetValue(rpm, amps.Value())); + } + + // Initialises the map. + public bool Initialise() + { + if (File.Exists(filePath)) { + using (var sr = new StreamReader(filePath)) { + // get array og lines fron csv + var lines = sr.ReadToEnd().Split(new [] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); + + // Must have at least 2 entries in map to make it usable [dont forget the header row] + if (lines.Count() < 3) + throw new ArgumentException("Insufficient rows in csv to build a usable map"); + + _map = new List<MapPoint>(); + var firstline = true; + + foreach (var line in lines) { + if (!firstline) { + + // Advanced Alternator Source Check. + if (line.Contains("[MODELSOURCE")) + break; + + // split the line + var elements = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + // 3 entries per line required + if ((elements.Length != 3)) + throw new ArgumentException("Incorrect number of values in csv file"); + // add values to map + + // Create AlternatorKey + var newPoint = new MapPoint(float.Parse(elements[0], CultureInfo.InvariantCulture), float.Parse(elements[1], CultureInfo.InvariantCulture), float.Parse(elements[2], CultureInfo.InvariantCulture)); + _map.Add(newPoint); + } + firstline = false; + } + } + return true; + } + throw new ArgumentException("Supplied input file does not exist"); + } + + + // Public Events + public event AuxiliaryEventEventHandler AuxiliaryEvent; + + //public delegate void AuxiliaryEventEventHandler(ref object sender, string message, AdvancedAuxiliaryMessageType messageType); + + protected void OnAuxiliaryEvent(string message, AdvancedAuxiliaryMessageType messageType) + { + object alternatorMap = this; + AuxiliaryEvent?.Invoke(ref alternatorMap, message, messageType); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/Alternator.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/Alternator.cs new file mode 100644 index 0000000000000000000000000000000000000000..d231fad269033fabec79a6f22b78d62b0680ca70 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/Alternator.cs @@ -0,0 +1,320 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + // Model based on CombinedALTS_V02_Editable.xlsx + public class Alternator : IAlternator + { + private ICombinedAlternatorSignals signals; + + // D6 + public string AlternatorName { get; set; } + + // G6 + public double PulleyRatio { get; set; } + + // C10-D15 + public List<AltUserInput> InputTable2000 { get; set; } = new List<AltUserInput>(); + + // F10-G15 + public List<AltUserInput> InputTable4000 { get; set; } = new List<AltUserInput>(); + + // I10-J15 + public List<AltUserInput> InputTable6000 { get; set; } = new List<AltUserInput>(); + + // M10-N15 + public List<Table4Row> RangeTable { get; set; } = new List<Table4Row>(); + + // S9 + public double SpindleSpeed + { + get { return signals.CrankRPM * PulleyRatio; } + } + + // S10 + public double Efficiency + { + get { + // First build RangeTable, table 4 + InitialiseRangeTable(); + CalculateRangeTable(); + + // Calculate ( Interpolate ) Efficiency + var range = RangeTable.Select(s => new AltUserInput(s.RPM, s.Efficiency)).ToList(); + + return Alternator.Iterpolate(range, Convert.ToSingle(SpindleSpeed)); + } + } + + + // Constructors + public Alternator() { } + + public Alternator(ICombinedAlternatorSignals isignals, List<ICombinedAlternatorMapRow> inputs) + { + if (isignals == null) + throw new ArgumentException("Alternator - ISignals supplied is nothing"); + + signals = isignals; + + AlternatorName = inputs.First().AlternatorName; + PulleyRatio = inputs.First().PulleyRatio; + + var values2k = inputs.Where(x => x.RPM == 2000) + .Select(x => new KeyValuePair<double, double>(x.Amps, x.Efficiency)) + .ToDictionary(x => x.Key, x => x.Value); + var values4k = inputs.Where(x => x.RPM == 4000) + .Select(x => new KeyValuePair<double, double>(x.Amps, x.Efficiency)) + .ToDictionary(x => x.Key, x => x.Value); + var values6k = inputs.Where(x => x.RPM == 6000) + .Select(x => new KeyValuePair<double, double>(x.Amps, x.Efficiency)) + .ToDictionary(x => x.Key, x => x.Value); + + BuildInputTable(values2k, InputTable2000); + BuildInputTable(values4k, InputTable4000); + BuildInputTable(values6k, InputTable6000); + + CreateRangeTable(); + } + + public static double Iterpolate(List<AltUserInput> values, double x) + { + var lowestX = values.Min(m => m.Amps); + var highestX = values.Max(m => m.Amps); + + // Out of range, returns efficiency for lowest + if (x < lowestX) + return values.First(f => f.Amps == lowestX).Eff; + + // Out of range, efficiency for highest + if (x > highestX) + return values.First(f => f.Amps == highestX).Eff; + + // On Bounds check + if (values.Where(w => w.Amps == x).Count() == 1) + return values.First(w => w.Amps == x).Eff; + + // OK, we need to interpolate. + var preKey = values.Last(l => l.Amps < x).Amps; + var postKey = values.First(l => l.Amps > x).Amps; + var preEff = values.First(f => f.Amps == preKey).Eff; + var postEff = values.First(f => f.Amps == postKey).Eff; + + var deltaX = postKey - preKey; + var deltaEff = postEff - preEff; + + // slopes + var effSlope = deltaEff / deltaX; + + var retVal = ((x - preKey) * effSlope) + preEff; + + return retVal; + } + + private void CalculateRangeTable() + { + // M10=Row0-Rpm - N10=Row0-Eff + // M11=Row1-Rpm - N11=Row1-Eff + // M12=Row2-Rpm - N12=Row2-Eff - 2000 + // M13=Row3-Rpm - N13=Row3-Eff - 4000 + // M14=Row4-Rpm - N14=Row4-Eff - 6000 + // M15=Row5-Rpm - N15=Row5-Eff + // M16=Row6-Rpm - N16=Row6-Eff + + double N10, N11, N12, N13, N14, N15, N16; + double M10, M11, M12, M13, M14, M15, M16; + + // EFFICIENCY + + // 2000 + N12 = Alternator.Iterpolate(InputTable2000, signals.CurrentDemandAmps.Value()); + RangeTable[2].Efficiency = N12; + + // 4000 + N13 = Alternator.Iterpolate(InputTable4000, signals.CurrentDemandAmps.Value()); + RangeTable[3].Efficiency = N13; + + // 6000 + N14 = Alternator.Iterpolate(InputTable6000, signals.CurrentDemandAmps.Value()); + RangeTable[4].Efficiency = N14; + + // Row0 & Row1 Efficiency =IF(N13>N12,0,MAX(N12:N14)) - Example Alt 1 N13= + N11 = N13 > N12 ? 0 : Math.Max(Math.Max(N12, N13), N14); + RangeTable[1].Efficiency = N11; + N10 = N11; + RangeTable[0].Efficiency = N10; + + // Row 5 Efficiency + N15 = N13 > N14 ? 0 : Math.Max(Math.Max(N12, N13), N14); + RangeTable[5].Efficiency = N15; + + // Row 6 - Efficiency + N16 = N15; + RangeTable[6].Efficiency = N16; + + // RPM + + // 2000 Row 2 - RPM + M12 = 2000; + RangeTable[2].RPM = M12; + + // 4000 Row 3 - RPM + M13 = 4000; + RangeTable[3].RPM = M13; + + // 6000 Row 4 - RPM + M14 = 6000; + RangeTable[4].RPM = M14; + + // Row 1 - RPM + // NOTE: Update to reflect CombineALternatorSchematicV02 20150429 + // IF(M12=IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11)), M12-0.01, IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11))) + M11 = + Convert.ToSingle( + N12 - N13 == 0 + ? 0 + : ( + M12 == (N12 > N13 + ? M12 - (M12 - M13) / (N12 - N13) * (N12 - N11) + : M12 - (M12 - M13) / (N12 - N13) * (N12 - N11)) + ? M12 - 0.01 + : (N12 > N13 + ? M12 - (M12 - M13) / (N12 - N13) * (N12 - N11) + : M12 - (M12 - M13) / (N12 - N13) * (N12 - N11)))); + + RangeTable[1].RPM = M11; + + // Row 0 - RPM + M10 = M11 < 1500 ? M11 - 1 : 1500; + RangeTable[0].RPM = M10; + + // Row 5 - RPM + M15 = + Convert.ToSingle( + M14 == (N14 == 0 || N14 == N13 + ? M14 + 1 + : (N13 > N14 ? (M14 - M13) / (N13 - N14) * N14 + M14 : (M14 - M13) / (N13 - N14) * (N14 - N15) + M14) + ) + ? M14 + 0.01 + : (N14 == 0 || N14 == N13 + ? M14 + 1 + : (N13 > N14 ? (M14 - M13) / (N13 - N14) * N14 + M14 : (M14 - M13) / (N13 - N14) * (N14 - N15) + M14))); + + RangeTable[5].RPM = M15; + + // Row 6 - RPM + M16 = M15 > 10000 ? M15 + 1 : 10000; + RangeTable[6].RPM = M16; + } + + private void InitialiseRangeTable() + { + RangeTable[0].RPM = 0; + RangeTable[0].Efficiency = 0; + RangeTable[1].RPM = 0; + RangeTable[0].Efficiency = 0; + RangeTable[2].RPM = 2000; + RangeTable[0].Efficiency = 0; + RangeTable[3].RPM = 4000; + RangeTable[0].Efficiency = 0; + RangeTable[4].RPM = 6000; + RangeTable[0].Efficiency = 0; + RangeTable[5].RPM = 0; + RangeTable[0].Efficiency = 0; + RangeTable[6].RPM = 0; + RangeTable[0].Efficiency = 0; + } + + private void CreateRangeTable() + { + RangeTable.Clear(); + + RangeTable.Add(new Table4Row(0, 0)); + RangeTable.Add(new Table4Row(0, 0)); + RangeTable.Add(new Table4Row(0, 0)); + RangeTable.Add(new Table4Row(0, 0)); + RangeTable.Add(new Table4Row(0, 0)); + RangeTable.Add(new Table4Row(0, 0)); + RangeTable.Add(new Table4Row(0, 0)); + } + + public void BuildInputTable(Dictionary<double, double> inputs, List<AltUserInput> targetTable) + { + double C11, C12, C13, C14, C15, D11, D12, D13, D14, D15; + targetTable.Clear(); + + // Row0 + D14 = 0; + targetTable.Add(new AltUserInput(0, D14)); + + // Row1 + targetTable.Add(new AltUserInput(inputs.OrderBy(x => x.Key).First().Key, inputs.OrderBy(x => x.Key).First().Value)); + + // Row2 + targetTable.Add( + new AltUserInput(inputs.OrderBy(x => x.Key).Skip(1).First().Key, inputs.OrderBy(x => x.Key).Skip(1).First().Value)); + + // Row3 + targetTable.Add( + new AltUserInput(inputs.OrderBy(x => x.Key).Skip(2).First().Key, inputs.OrderBy(x => x.Key).Skip(2).First().Value)); + + C11 = targetTable[1].Amps; + C12 = targetTable[2].Amps; + C13 = targetTable[3].Amps; + + D11 = targetTable[1].Eff; + D12 = targetTable[2].Eff; + D13 = targetTable[3].Eff; + + D14 = D12 > D13 ? 0 : Math.Max(Math.Max(D11, D12), D13); + + // Row4 - Eff + targetTable.Add(new AltUserInput(0, D14)); + + // Row4 - Amps + // Should probably refactor this into some sort of helper/extension method + var numarray = new[] { D11, D12, D13 }; + var maxD11_D13 = numarray.Max(); + + // =IF(OR(D13=0,D13=D12),C13+1,IF(D12>D13,((((C13-C12)/(D12-D13))*D13)+C13),((((C13-C12)/(D12-D13))*(D13-D14))+C13))) + C14 = (D13 == 0 || D13 == D12 || D13 == maxD11_D13) + ? C13 + 1 + : D12 > D13 + ? ((((C13 - C12) / (D12 - D13)) * D13) + C13) + : ((((C13 - C12) / (D12 - D13)) * (D13 - D14)) + C13); + targetTable[4].Amps = C14; + + // Row5 + C15 = C14 > 200 ? C14 + 1 : 200; + D15 = D14; + targetTable.Add(new AltUserInput(C15, D15)); + + // Row0 + targetTable[0].Eff = D11; + } + + public bool IsEqualTo(IAlternator other) + { + if (AlternatorName != other.AlternatorName) { + return false; + } + if (PulleyRatio != other.PulleyRatio) { + return false; + } + + for (var i = 1; i <= 3; i++) { + if (InputTable2000[i].Eff != other.InputTable2000[i].Eff) + return false; + if (InputTable4000[i].Eff != other.InputTable4000[i].Eff) + return false; + if (InputTable6000[i].Eff != other.InputTable6000[i].Eff) + return false; + } + + return true; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternator.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternator.cs new file mode 100644 index 0000000000000000000000000000000000000000..668ec47a10f0d4338bb22c44676525f10d81e2d8 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternator.cs @@ -0,0 +1,394 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.Util; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class CombinedAlternator : IAlternatorMap, ICombinedAlternator + { + private List<ICombinedAlternatorMapRow> map = new List<ICombinedAlternatorMapRow>(); + public List<IAlternator> Alternators { get; set; } = new List<IAlternator>(); + private List<IAlternator> OriginalAlternators = new List<IAlternator>(); + private string FilePath; + private ICombinedAlternatorSignals altSignals; + private ISignals Signals; + private AlternatorMapValues AverageAlternatorsEfficiency; + + // Interface Implementation + public AlternatorMapValues GetEfficiency(double CrankRPM, Ampere Amps) + { + altSignals.CrankRPM = CrankRPM; + altSignals.CurrentDemandAmps = (Amps.Value() / (double)Alternators.Count).SI<Ampere>(); + + AlternatorMapValues alternatorMapValues; /* TODO Change to default(_) if this is not a reference type */; + + if (Signals == null || Signals.RunningCalc) + // If running calc cycle get efficiency from interpolation function + alternatorMapValues = new AlternatorMapValues(Convert.ToSingle(Alternators.Average(a => a.Efficiency) / (double)100)); + else + // If running Pre calc cycle get an average of inputs + alternatorMapValues = AverageAlternatorsEfficiency; + + if (alternatorMapValues.Efficiency <= 0) + alternatorMapValues = new AlternatorMapValues(0.01); + + return alternatorMapValues; + } + + public bool Initialise() + { + + // From the map we construct this CombinedAlternator object and original CombinedAlternator Object + + Alternators.Clear(); + OriginalAlternators.Clear(); + + + foreach (var alt in map.GroupBy(g => g.AlternatorName)) { + var altName = alt.First().AlternatorName; + var pulleyRatio = alt.First().PulleyRatio; + + + IAlternator alternator = new Alternator(altSignals, alt.ToList()); + + Alternators.Add(alternator); + } + + return true; + } + + // Constructors + public CombinedAlternator(string filePath, ISignals signals = null/* TODO Change to default(_) if this is not a reference type */) + { + var feedback = string.Empty; + this.Signals = signals; + + if (!FilePathUtils.ValidateFilePath(filePath, ".aalt", ref feedback)) + throw new ArgumentException(string.Format("Combined Alternator requires a valid .AALT filename. : {0}", feedback)); + else + this.FilePath = filePath; + + + this.altSignals = new CombinedAlternatorSignals(); + + + // IF file exists then read it otherwise create a default. + + if (File.Exists(filePath) && InitialiseMap(filePath)) + Initialise(); + else { + // Create Default Map + CreateDefaultMap(); + Initialise(); + } + + // Calculate alternators average which is used only in the pre-run + var efficiencySum = 0.0; + + foreach (var alt in Alternators) { + efficiencySum += alt.InputTable2000.ElementAt(1).Eff; + efficiencySum += alt.InputTable2000.ElementAt(2).Eff; + efficiencySum += alt.InputTable2000.ElementAt(3).Eff; + + efficiencySum += alt.InputTable4000.ElementAt(1).Eff; + efficiencySum += alt.InputTable4000.ElementAt(2).Eff; + efficiencySum += alt.InputTable4000.ElementAt(3).Eff; + + efficiencySum += alt.InputTable6000.ElementAt(1).Eff; + efficiencySum += alt.InputTable6000.ElementAt(2).Eff; + efficiencySum += alt.InputTable6000.ElementAt(3).Eff; + } + + var efficiencyAverage = efficiencySum / (Alternators.Count * 9); + AverageAlternatorsEfficiency = new AlternatorMapValues(efficiencyAverage / 100); + } + + event TUGraz.VectoCore.BusAuxiliaries.Interfaces.AuxiliaryEventEventHandler IAuxiliaryEvent.AuxiliaryEvent + { + add { + throw new NotImplementedException(); + } + + remove { + throw new NotImplementedException(); + } + } + + // Helpers + private void CreateDefaultMap() + { + map.Clear(); + + map.Add(new CombinedAlternatorMapRow("Alt1", 2000, 10, 62, 3.6)); + map.Add(new CombinedAlternatorMapRow("Alt1", 2000, 27, 70, 3.6)); + map.Add(new CombinedAlternatorMapRow("Alt1", 2000, 53, 30, 3.6)); + + map.Add(new CombinedAlternatorMapRow("Alt1", 4000, 10, 64, 3.6)); + map.Add(new CombinedAlternatorMapRow("Alt1", 4000, 63, 74, 3.6)); + map.Add(new CombinedAlternatorMapRow("Alt1", 4000, 125, 68, 3.6)); + + map.Add(new CombinedAlternatorMapRow("Alt1", 6000, 10, 53, 3.6)); + map.Add(new CombinedAlternatorMapRow("Alt1", 6000, 68, 70, 3.6)); + map.Add(new CombinedAlternatorMapRow("Alt1", 6000, 136, 62, 3.6)); + + map.Add(new CombinedAlternatorMapRow("Alt2", 2000, 10, 62, 3)); + map.Add(new CombinedAlternatorMapRow("Alt2", 2000, 27, 70, 3)); + map.Add(new CombinedAlternatorMapRow("Alt2", 2000, 53, 30, 3)); + + map.Add(new CombinedAlternatorMapRow("Alt2", 4000, 10, 64, 3)); + map.Add(new CombinedAlternatorMapRow("Alt2", 4000, 63, 74, 3)); + map.Add(new CombinedAlternatorMapRow("Alt2", 4000, 125, 68, 3)); + + map.Add(new CombinedAlternatorMapRow("Alt2", 6000, 10, 53, 3)); + map.Add(new CombinedAlternatorMapRow("Alt2", 6000, 68, 70, 3)); + map.Add(new CombinedAlternatorMapRow("Alt2", 6000, 136, 62, 3)); + } + + // Grid Management + private bool AddNewAlternator(List<ICombinedAlternatorMapRow> list, ref string feeback) + { + var altName = list.First().AlternatorName; + var pulleyRatio = list.First().PulleyRatio; + + // Check alt does not already exist in list + if (Alternators.Any(w => w.AlternatorName == altName)) { + feeback = "This alternator already exists in in the list, operation not completed."; + return false; + } + + IAlternator alternator = new Alternator(altSignals, list.ToList()); + + Alternators.Add(alternator); + + + return true; + } + + public bool AddAlternator(List<ICombinedAlternatorMapRow> rows, ref string feedback) + { + if (!AddNewAlternator(rows, ref feedback)) { + feedback = string.Format("Unable to add new alternator : {0}", feedback); + return false; + } + + return true; + } + + public bool DeleteAlternator(string alternatorName, ref string feedback, bool CountValidation) + { + + // Is this the last alternator, if so deny the user the right to remove it. + if (CountValidation && Alternators.Count < 2) { + feedback = "There must be at least one alternator remaining, operation aborted."; + return false; + } + + if (Alternators.All(w => w.AlternatorName != alternatorName)) { + feedback = "This alternator does not exist"; + return false; + } + + var altToRemove = Alternators.First(w => w.AlternatorName == alternatorName); + var numAlternators = Alternators.Count; + + Alternators.Remove(altToRemove); + + if (Alternators.Count == numAlternators - 1) { + return true; + } + + feedback = string.Format("The alternator {0} could not be removed : {1}", alternatorName, feedback); + return false; + } + + + public bool Save(string aaltPath) + { + var sb = new StringBuilder(); + + // write headers + sb.AppendLine("[AlternatorName],[RPM],[Amps],[Efficiency],[PulleyRatio]"); + + // write details + foreach (var alt in Alternators.OrderBy(o => o.AlternatorName)) { + // 2000 - IE Alt1,2000,10,50,3 + for (var row = 1; row <= 3; row++) { + var amps = alt.InputTable2000[row].Amps; + var eff = alt.InputTable2000[row].Eff; + sb.Append(alt.AlternatorName + ",2000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")); + sb.AppendLine(""); + } + + // 4000 - IE Alt1,2000,10,50,3 + for (var row = 1; row <= 3; row++) { + var amps = alt.InputTable4000[row].Amps; + var eff = alt.InputTable4000[row].Eff; + sb.Append(alt.AlternatorName + ",4000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")); + sb.AppendLine(""); + } + + // 6000 - IE Alt1,2000,10,50,3 + for (var row = 1; row <= 3; row++) { + var amps = alt.InputTable6000[row].Amps; + var eff = alt.InputTable6000[row].Eff; + sb.Append(alt.AlternatorName + ",6000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")); + sb.AppendLine(""); + } + } + + // Add Model Source + sb.AppendLine("[MODELSOURCE]"); + sb.Append(ToString()); + + // Write the stream cotnents to a new file named "AllTxtFiles.txt" + using (var outfile = new StreamWriter(aaltPath)) { + outfile.Write(sb.ToString()); + } + + return true; + } + + private bool Load() + { + if (!InitialiseMap(FilePath)) + return false; + + + return true; + } + + // Initialises the map, only valid when loadingUI for first time in edit mode or always in operational mode. + private bool InitialiseMap(string filePath) + { + var returnValue = false; + string[] elements; + + if (File.Exists(filePath)) { + using (var sr = new StreamReader(filePath)) { + // get array og lines fron csv + var lines = sr.ReadToEnd().Split(new[] { Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); + + // Must have at least 2 entries in map to make it usable [dont forget the header row] + if ((lines.Count() < 10)) + throw new ArgumentException("Insufficient rows in csv to build a usable map"); + + map = new List<ICombinedAlternatorMapRow>(); + + var firstline = true; + + foreach (var line in lines) { + if (!firstline) { + + // Advanced Alternator Source Check. + if (line.Contains("[MODELSOURCE")) + break; + + // split the line + elements = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + // 3 entries per line required + if ((elements.Length != 5)) + throw new ArgumentException("Incorrect number of values in csv file"); + // add values to map + + map.Add(new CombinedAlternatorMapRow(elements[0], float.Parse(elements[1], CultureInfo.InvariantCulture), float.Parse(elements[2], CultureInfo.InvariantCulture), float.Parse(elements[3], CultureInfo.InvariantCulture), float.Parse(elements[4], CultureInfo.InvariantCulture))); + } else + firstline = false; + } + } + return true; + } else + throw new ArgumentException("Supplied input file does not exist"); + + return returnValue; + } + + // Can be used to send messages to Vecto. + public event AuxiliaryEventEventHandler AuxiliaryEvent; + + public delegate void AuxiliaryEventEventHandler(ref object sender, string message, AdvancedAuxiliaryMessageType messageType); + + // This is used to generate a diagnostics output which enables the user to + // Determine if they beleive the resulting map is what is expected + // Basically it is a check against the model/Spreadsheet + public override string ToString() + { + var sb = new StringBuilder(); + string a1, a2, a3, e1, e2, e3; + + const string vbTab = "\t"; + foreach (Alternator alt in Alternators.OrderBy(o => o.AlternatorName)) { + sb.AppendLine(""); + sb.AppendFormat("** {0} ** , PulleyRatio {1}", alt.AlternatorName, alt.PulleyRatio); + sb.AppendLine(""); + sb.AppendLine("******************************************************************"); + sb.AppendLine(""); + + var i = 1; + sb.AppendLine("Table 1 (2000)" + vbTab + "Table 2 (4000)" + vbTab + "Table 3 (6000)"); + sb.AppendLine("Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab); + sb.AppendLine(""); + for (i = 1; i <= 3; i++) { + a1 = alt.InputTable2000[i].Amps.ToString("0"); + e1 = alt.InputTable2000[i].Eff.ToString("0.000"); + a2 = alt.InputTable4000[i].Amps.ToString("0"); + e2 = alt.InputTable4000[i].Eff.ToString("0.000"); + a3 = alt.InputTable6000[i].Amps.ToString("0"); + e3 = alt.InputTable6000[i].Eff.ToString("0.000"); + sb.AppendLine(a1 + vbTab + e1 + vbTab + a2 + vbTab + e2 + vbTab + a3 + vbTab + e3 + vbTab); + } + } + + // sb.AppendLine("") + // sb.AppendLine("********* COMBINED EFFICIENCY VALUES **************") + // sb.AppendLine("") + // sb.AppendLine(vbTab + "RPM VALUES") + // sb.AppendLine("AMPS" + vbTab + "500" + vbTab + "1500" + vbTab + "2500" + vbTab + "3500" + vbTab + "4500" + vbTab + "5500" + vbTab + "6500" + vbTab + "7500") + // For a As Single = 1 To Alternators.Count * 50 + + // sb.Append(a.ToString("0") + vbTab) + // For Each r As Single In {500, 1500, 2500, 3500, 4500, 5500, 6500, 7500} + + // Dim eff As Single = GetEfficiency(r, a).Efficiency + + // sb.Append(eff.ToString("0.000") + vbTab) + + // Next + // sb.AppendLine("") + + // Next + + + return sb.ToString(); + } + + + // Equality + public bool IsEqualTo(ICombinedAlternator other) + { + + // Count Check. + if (this.Alternators.Count != other.Alternators.Count) + return false; + + foreach (var alt in this.Alternators) { + + // Can we find the same alternatorName in other + if (other.Alternators.Where(f => f.AlternatorName == alt.AlternatorName).Count() != 1) + return false; + + // get the alternator to compare and compare it. + if (!alt.IsEqualTo(other.Alternators.First(f => f.AlternatorName == alt.AlternatorName))) + return false; + } + + return true; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternatorMapRow.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternatorMapRow.cs new file mode 100644 index 0000000000000000000000000000000000000000..4b76ce4afe9e2bb9e4995c99f985ae9d969d215c --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternatorMapRow.cs @@ -0,0 +1,41 @@ +using System; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + // This class is reflective of the stored entries for the combined alternator + // And is used by the Combined Alternator Form and any related classes. + + public class CombinedAlternatorMapRow : ICombinedAlternatorMapRow + { + public string AlternatorName { get; set; } + public double RPM { get; set; } + public double Amps { get; set; } + public double Efficiency { get; set; } + public double PulleyRatio { get; set; } + + // Constructors + public CombinedAlternatorMapRow() + { + } + + public CombinedAlternatorMapRow(string alternatorName, double rpm, double amps, double efficiency, double pulleyRatio) + { + + // Sanity Check + if (alternatorName.Trim().Length == 0) + throw new ArgumentException("Alternator name cannot be zero length"); + if (efficiency < 0 | efficiency > 100) + throw new ArgumentException("Alternator Efficiency must be between 0 and 100"); + if (pulleyRatio <= 0) + throw new ArgumentException("Alternator Pully ratio must be a positive number"); + + // Assignments + AlternatorName = alternatorName; + RPM = rpm; + Amps = amps; + Efficiency = efficiency; + PulleyRatio = pulleyRatio; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternatorSignals.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternatorSignals.cs new file mode 100644 index 0000000000000000000000000000000000000000..180ea9a3b8369938d060e8dbc9d00e6ab9e3972c --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/CombinedAlternatorSignals.cs @@ -0,0 +1,16 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + // Used by the CombinedAlternator class and any other related classes. + public class CombinedAlternatorSignals : ICombinedAlternatorSignals + { + public double CrankRPM { get; set; } + + public Ampere CurrentDemandAmps { get; set; } + + // Number of alternators in the Combined Alternator + public int NumberOfAlternators { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricalConsumer.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricalConsumer.cs new file mode 100644 index 0000000000000000000000000000000000000000..1beaaeb2776e59aa5c5f554bf78ec9972ceac184 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricalConsumer.cs @@ -0,0 +1,198 @@ +using System; +using System.ComponentModel; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +// Copyright 2017 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. + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + /// <summary> + /// ''' Described a consumer of Alternator electrical power + /// ''' </summary> + /// ''' <remarks></remarks> + public class ElectricalConsumer : IElectricalConsumer + { + + // Fields + private bool _BaseVehicle; + private string _Category; + private string _ConsumerName; + private double _NominalConsumptionAmps; + private int _NumberInActualVehicle; + private double _PhaseIdle_TractionOn; + private double _PowerNetVoltage; + private string _Info; + + // Calculated + public double AvgConsumptionAmps { get; set; } + + // Properties + public bool BaseVehicle + { + get { + return _BaseVehicle; + } + set { + _BaseVehicle = value; + NotifyPropertyChanged("BaseVehicle"); + } + } + + public string Category + { + get { + return _Category; + } + set { + _Category = value; + NotifyPropertyChanged("Category"); + } + } + + public string ConsumerName + { + get { + return _ConsumerName; + } + set { + _ConsumerName = value; + NotifyPropertyChanged("ConsumerName"); + } + } + + public double NominalConsumptionAmps + { + get { + return _NominalConsumptionAmps; + } + set { + _NominalConsumptionAmps = value; + NotifyPropertyChanged("NominalConsumptionAmps"); + } + } + + public int NumberInActualVehicle + { + get { + return _NumberInActualVehicle; + } + set { + _NumberInActualVehicle = value; + NotifyPropertyChanged("NumberInActualVehicle"); + } + } + + public double PhaseIdle_TractionOn + { + get { + return _PhaseIdle_TractionOn; + } + set { + _PhaseIdle_TractionOn = value; + NotifyPropertyChanged("PhaseIdle_TractionOn"); + } + } + + public double PowerNetVoltage + { + get { + return _PowerNetVoltage; + } + set { + _PowerNetVoltage = value; + NotifyPropertyChanged("PowerNetVoltage"); + } + } + + public string Info + { + get { + return _Info; + } + set { + _Info = value; + NotifyPropertyChanged("Info"); + } + } + + + // Public class outputs + public Ampere TotalAvgConumptionAmps(double PhaseIdle_TractionOnBasedOnCycle = default(Double)) + { + if (ConsumerName == "Doors per Door") + return NominalConsumptionAmps.SI<Ampere>() * (NumberInActualVehicle * PhaseIdle_TractionOnBasedOnCycle); + else + return NominalConsumptionAmps.SI<Ampere>() * (NumberInActualVehicle * PhaseIdle_TractionOn); + } + + public Watt TotalAvgConsumptionInWatts(double PhaseIdle_TractionOnBasedOnCycle = 0.0) + { + return TotalAvgConumptionAmps(PhaseIdle_TractionOnBasedOnCycle) * PowerNetVoltage.SI<Volt>(); + } + + // Constructor + public ElectricalConsumer(bool BaseVehicle, string Category, string ConsumerName, double NominalConsumptionAmps, double PhaseIdle_TractionOn, double PowerNetVoltage, int numberInVehicle, string info) + { + + // Illegal Value Check. + if (Category.Trim().Length == 0) + throw new ArgumentException("Category Name cannot be empty"); + if (ConsumerName.Trim().Length == 0) + throw new ArgumentException("ConsumerName Name cannot be empty"); + if (PhaseIdle_TractionOn < ElectricConstants.PhaseIdleTractionOnMin | PhaseIdle_TractionOn > ElectricConstants.PhaseIdleTractionMax) + throw new ArgumentException("PhaseIdle_TractionOn must have a value between 0 and 1"); + if (NominalConsumptionAmps < ElectricConstants.NonminalConsumerConsumptionAmpsMin | NominalConsumptionAmps > ElectricConstants.NominalConsumptionAmpsMax) + throw new ArgumentException("NominalConsumptionAmps must have a value between 0 and 100"); + if (PowerNetVoltage < ElectricConstants.PowenetVoltageMin | PowerNetVoltage > ElectricConstants.PowenetVoltageMax) + throw new ArgumentException("PowerNetVoltage must have a value between 6 and 48"); + if (numberInVehicle < 0) + throw new ArgumentException("Cannot have less than 0 consumers in the vehicle"); + + // Good, now assign. + this.BaseVehicle = BaseVehicle; + this.Category = Category; + this.ConsumerName = ConsumerName; + this.NominalConsumptionAmps = NominalConsumptionAmps; + this.PhaseIdle_TractionOn = PhaseIdle_TractionOn; + this.PowerNetVoltage = PowerNetVoltage; + this.NumberInActualVehicle = numberInVehicle; + this.Info = info; + } + + // Comparison Overrides + public override bool Equals(object obj) + { + if (obj == null || GetType() != obj.GetType()) + return false; + + var other = (IElectricalConsumer)obj; + + + return this.ConsumerName == other.ConsumerName; + } + + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + public override int GetHashCode() + { + return 0; + } + + + public event PropertyChangedEventHandler PropertyChanged; + + private void NotifyPropertyChanged(string p) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(p)); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricalConsumerList.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricalConsumerList.cs new file mode 100644 index 0000000000000000000000000000000000000000..f535ce87077fbbd8521cf1f1aa027211341a3d4f --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricalConsumerList.cs @@ -0,0 +1,168 @@ +// Copyright 2017 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. + + +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class ElectricalConsumerList : IElectricalConsumerList + { + private List<IElectricalConsumer> _items = new List<IElectricalConsumer>(); + private double _powernetVoltage; + private double _doorDutyCycleZeroToOne; + + + // Constructor + public ElectricalConsumerList(double powernetVoltage, double doorDutyCycle_ZeroToOne, bool createDefaultList = false) + { + _powernetVoltage = powernetVoltage; + + if (createDefaultList) + _items = GetDefaultConsumerList(); + + + _doorDutyCycleZeroToOne = doorDutyCycle_ZeroToOne; + } + + // Transfers the Info comments from a default set of consumables to a live set. + // This way makes the comments not dependent on saved data. + public void MergeInfoData() + { + if (_items.Count != GetDefaultConsumerList().Count) + return; + + var dflt = GetDefaultConsumerList(); + + for (var idx = 0; idx <= _items.Count - 1; idx++) + + _items[idx].Info = dflt[idx].Info; + } + + // Initialise default set of consumers + public List<IElectricalConsumer> GetDefaultConsumerList() + { + + // This populates the default settings as per engineering spreadsheet. + // Vehicle Basic Equipment' category can be added or remove by customers. + // At some time in the future, this may be removed and replace with file based consumer lists. + + var items = new List<IElectricalConsumer>(); + + IElectricalConsumer c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20; + + c1 = (IElectricalConsumer)new ElectricalConsumer(false, "Doors", "Doors per Door", 3.0, 0.096339, _powernetVoltage, 3, ""); + c2 = (IElectricalConsumer)new ElectricalConsumer(true, "Veh Electronics &Engine", "Controllers,Valves etc", 25.0, 1.0, _powernetVoltage, 1, ""); + c3 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "Radio City", 2.0, 0.8, _powernetVoltage, 1, ""); + c4 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "Radio Intercity", 5.0, 0.8, _powernetVoltage, 0, ""); + c5 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "Radio/Audio Tourism", 9.0, 0.8, _powernetVoltage, 0, ""); + c6 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "Fridge", 4.0, 0.5, _powernetVoltage, 0, ""); + c7 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "Kitchen Standard", 67.0, 0.05, _powernetVoltage, 0, ""); + c8 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "Interior lights City/ Intercity + Doorlights [Should be 1/m]", 1.0, 0.7, _powernetVoltage, 12, "1 Per metre length of bus"); + c9 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "LED Interior lights ceiling city/Intercity + door [Should be 1/m]", 0.6, 0.7, _powernetVoltage, 0, "1 Per metre length of bus"); + c10 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "Interior lights Tourism + reading [1/m]", 1.1, 0.7, _powernetVoltage, 0, "1 Per metre length of bus"); + c11 = (IElectricalConsumer)new ElectricalConsumer(false, "Vehicle basic equipment", "LED Interior lights ceiling Tourism + LED reading [Should be 1/m]", 0.66, 0.7, _powernetVoltage, 0, "1 Per metre length of bus"); + c12 = (IElectricalConsumer)new ElectricalConsumer(false, "Customer Specific Equipment", "External Displays Font/Side/Rear", 2.65017667844523, 1.0, _powernetVoltage, 4, ""); + c13 = (IElectricalConsumer)new ElectricalConsumer(false, "Customer Specific Equipment", "Internal display per unit ( front side rear)", 1.06007067137809, 1.0, _powernetVoltage, 1, ""); + c14 = (IElectricalConsumer)new ElectricalConsumer(false, "Customer Specific Equipment", "CityBus Ref EBSF Table4 Devices ITS No Displays", 9.3, 1.0, _powernetVoltage, 1, ""); + c15 = (IElectricalConsumer)new ElectricalConsumer(false, "Lights", "Exterior Lights BULB", 7.4, 1.0, _powernetVoltage, 1, ""); + c16 = (IElectricalConsumer)new ElectricalConsumer(false, "Lights", "Day running lights LED bonus", -0.723, 1.0, _powernetVoltage, 1, ""); + c17 = (IElectricalConsumer)new ElectricalConsumer(false, "Lights", "Antifog rear lights LED bonus", -0.17, 1.0, _powernetVoltage, 1, ""); + c18 = (IElectricalConsumer)new ElectricalConsumer(false, "Lights", "Position lights LED bonus", -1.2, 1.0, _powernetVoltage, 1, ""); + c19 = (IElectricalConsumer)new ElectricalConsumer(false, "Lights", "Direction lights LED bonus", -0.3, 1.0, _powernetVoltage, 1, ""); + c20 = (IElectricalConsumer)new ElectricalConsumer(false, "Lights", "Brake Lights LED bonus", -1.2, 1.0, _powernetVoltage, 1, ""); + + items.Add(c1); + items.Add(c2); + items.Add(c3); + items.Add(c4); + items.Add(c5); + items.Add(c6); + items.Add(c7); + items.Add(c8); + items.Add(c9); + items.Add(c10); + items.Add(c11); + items.Add(c12); + items.Add(c13); + items.Add(c14); + items.Add(c15); + items.Add(c16); + items.Add(c17); + items.Add(c18); + items.Add(c19); + items.Add(c20); + + return items; + } + + + // Interface implementation + public double DoorDutyCycleFraction + { + get { + return _doorDutyCycleZeroToOne; + } + set { + _doorDutyCycleZeroToOne = value; + } + } + + public List<IElectricalConsumer> Items + { + get { + return _items; + } + } + + public void AddConsumer(IElectricalConsumer consumer) + { + if (!_items.Contains(consumer)) + _items.Add(consumer); + else + throw new ArgumentException("Consumer Already Present in the list"); + } + + public void RemoveConsumer(IElectricalConsumer consumer) + { + if (_items.Contains(consumer)) + _items.Remove(consumer); + else + throw new ArgumentException("Consumer Not In List"); + } + + + public Ampere GetTotalAverageDemandAmps(bool excludeOnBase) + { + Ampere Amps; + + if (excludeOnBase) + + Amps = Items.Where(x => x.BaseVehicle == false) + .Sum(consumer => consumer.TotalAvgConumptionAmps(DoorDutyCycleFraction)); + + // Aggregate item In Items Where item.BaseVehicle = False Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) + + + else + + Amps = Items.Sum(x => x.TotalAvgConumptionAmps(DoorDutyCycleFraction)); + //Aggregate item In Items Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) + + + return Amps; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricsUserInputsConfig.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricsUserInputsConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..1d068acb5e0c8e23af029631f580cd9c55ed3f6f --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ElectricsUserInputsConfig.cs @@ -0,0 +1,54 @@ +// Copyright 2017 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. + +using System.Collections.Generic; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class ElectricsUserInputsConfig : IElectricsUserInputsConfig + { + public double PowerNetVoltage { get; set; } + public string AlternatorMap { get; set; } + public double AlternatorGearEfficiency { get; set; } + + public IElectricalConsumerList ElectricalConsumers { get; set; } + + public int DoorActuationTimeSecond { get; set; } + public double StoredEnergyEfficiency { get; set; } + + public IResultCard ResultCardIdle { get; set; } + public IResultCard ResultCardTraction { get; set; } + public IResultCard ResultCardOverrun { get; set; } + + public bool SmartElectrical { get; set; } + + public ElectricsUserInputsConfig(bool setToDefaults = false, VectoInputs vectoInputs = null/* TODO Change to default(_) if this is not a reference type */) + { + if (setToDefaults) + SetPropertiesToDefaults(vectoInputs); + } + + public void SetPropertiesToDefaults(VectoInputs vectoInputs) + { + DoorActuationTimeSecond = 4; + StoredEnergyEfficiency = 0.935; + AlternatorGearEfficiency = 0.92; + PowerNetVoltage = vectoInputs.PowerNetVoltage.Value(); + ResultCardIdle = new ResultCard(new List<SmartResult>()); + ResultCardOverrun = new ResultCard(new List<SmartResult>()); + ResultCardTraction = new ResultCard(new List<SmartResult>()); + SmartElectrical = false; + AlternatorMap = string.Empty; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M00Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M00Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..ac99ecf368ab19946e176a070a2ddf9ca751f732 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M00Impl.cs @@ -0,0 +1,78 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class M00Impl : AbstractModule, IM0_NonSmart_AlternatorsSetEfficiency + { + protected Ampere _getHVACElectricalPowerDemandAmps; + protected double _alternatorsEfficiency; + protected IElectricalConsumerList _electricalConsumersList; + protected IAlternatorMap _alternatorEfficiencyMap; + protected Volt _powernetVoltage; + protected ISignals _signals; + protected ISSMTOOL _steadyStateModelHVAC; + protected Watt _ElectricalPowerW; + protected Watt _MechanicalPowerW; + protected LiterPerSecond _FuelingLPerH; + + public M00Impl( + IElectricalConsumerList electricalConsumers, IAlternatorMap alternatorEfficiencyMap, Volt powernetVoltage, + ISignals signals, ISSMTOOL ssmHvac) + { + if (electricalConsumers == null) { + throw new ArgumentException("No ElectricalConsumersList Supplied"); + } + + if (alternatorEfficiencyMap == null) { + throw new ArgumentException("No Alternator Efficiency Map Supplied"); + } + + if (powernetVoltage < ElectricConstants.PowenetVoltageMin || powernetVoltage > ElectricConstants.PowenetVoltageMax) { + throw new ArgumentException("Powernet Voltage out of range"); + } + + if (signals == null) { + throw new ArgumentException("No Signals reference was supplied."); + } + + _electricalConsumersList = electricalConsumers; + + _alternatorEfficiencyMap = alternatorEfficiencyMap; + + _powernetVoltage = powernetVoltage; + + _signals = signals; + + _steadyStateModelHVAC = ssmHvac; + + _ElectricalPowerW = ssmHvac.ElectricalWAdjusted.SI<Watt>(); + + _MechanicalPowerW = ssmHvac.MechanicalWBaseAdjusted.SI<Watt>(); + + _FuelingLPerH = ssmHvac.FuelPerHBaseAdjusted.SI<LiterPerSecond>(); + } + + #region Implementation of IM0_NonSmart_AlternatorsSetEfficiency + + public Ampere GetHVACElectricalPowerDemandAmps + { + get { return _ElectricalPowerW / _powernetVoltage; } + } + + public double AlternatorsEfficiency + { + get { + var baseCurrentDemandAmps = _electricalConsumersList.GetTotalAverageDemandAmps(false); + var totalDemandAmps = baseCurrentDemandAmps + GetHVACElectricalPowerDemandAmps; + return _alternatorEfficiencyMap.GetEfficiency(_signals.EngineSpeed.AsRPM, totalDemandAmps).Efficiency; + } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M02Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M02Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..e334c8db6477a7d2cb9e6c66d7ec616d01510320 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M02Impl.cs @@ -0,0 +1,61 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class M02Impl : AbstractModule, IM2_AverageElectricalLoadDemand + { + private Volt _powerNetVoltage; + private IElectricalConsumerList _electricalConsumers; + private IM0_NonSmart_AlternatorsSetEfficiency _module0; + private double _alternatorPulleyEffiency; + + public M02Impl( + IElectricalConsumerList electricalConsumers, IM0_NonSmart_AlternatorsSetEfficiency m0, double altPulleyEfficiency, + Volt powerNetVoltage, ISignals signals) + { + if (electricalConsumers == null) { + throw new ArgumentException("Electrical Consumer List must be supplied"); + } + if (m0 == null) { + throw new ArgumentException("Must supply module 0"); + } + if (altPulleyEfficiency.IsEqual(0) || altPulleyEfficiency > 1) { + throw new ArgumentException("Alternator Gear efficiency out of range."); + } + if (powerNetVoltage < ElectricConstants.PowenetVoltageMin || powerNetVoltage > ElectricConstants.PowenetVoltageMax) { + throw new ArgumentException("Powernet Voltage out of known range."); + } + + _powerNetVoltage = powerNetVoltage; + _electricalConsumers = electricalConsumers; + _module0 = m0; + _alternatorPulleyEffiency = altPulleyEfficiency; + } + + #region Implementation of IM2_AverageElectricalLoadDemand + + public Watt GetAveragePowerDemandAtAlternator() + { + return _powerNetVoltage * _electricalConsumers.GetTotalAverageDemandAmps(false); + } + + public Watt GetAveragePowerAtCrankFromElectrics() + { + var ElectricalPowerDemandsWatts = GetAveragePowerDemandAtAlternator(); + var alternatorsEfficiency = _module0.AlternatorsEfficiency; + var ElectricalPowerDemandsWattsDividedByAlternatorEfficiency = + ElectricalPowerDemandsWatts * (1 / alternatorsEfficiency); + + var averagePowerDemandAtCrankFromElectricsWatts = + ElectricalPowerDemandsWattsDividedByAlternatorEfficiency * (1 / _alternatorPulleyEffiency); + + return averagePowerDemandAtCrankFromElectricsWatts; + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M05Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M05Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..23d608d6812597d694a8a062c7ef193f931c47f1 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M05Impl.cs @@ -0,0 +1,55 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class M05Impl : AbstractModule, IM5_SmartAlternatorSetGeneration + { + private IM0_5_SmartAlternatorSetEfficiency _m05; + private Volt _powerNetVoltage; + private double _alternatorGearEfficiency; + + public M05Impl(IM0_5_SmartAlternatorSetEfficiency m05, Volt powernetVoltage, double alternatorGearEfficiency) + { + //'sanity check + if (m05 == null) { + throw new ArgumentException("Please supply a valid module M05"); + } + + if (powernetVoltage < ElectricConstants.PowenetVoltageMin || powernetVoltage > ElectricConstants.PowenetVoltageMax) { + throw new ArgumentException("Powernet Voltage out of range"); + } + if (alternatorGearEfficiency < 0 || alternatorGearEfficiency > 1) { + throw new ArgumentException("AlternatorGearEfficiency Out of bounds, should be 0 to 1"); + } + + _m05 = m05; + _powerNetVoltage = powernetVoltage; + _alternatorGearEfficiency = alternatorGearEfficiency; + } + + #region Implementation of IM5_SmartAlternatorSetGeneration + + public Watt AlternatorsGenerationPowerAtCrankIdleWatts() + { + return _m05.SmartIdleCurrent * _powerNetVoltage * + (1 / (_m05.AlternatorsEfficiencyIdleResultCard * _alternatorGearEfficiency)); + } + + public Watt AlternatorsGenerationPowerAtCrankTractionOnWatts() + { + return _m05.SmartTractionCurrent * _powerNetVoltage * + (1 / (_m05.AlternatorsEfficiencyTractionOnResultCard * _alternatorGearEfficiency)); + } + + public Watt AlternatorsGenerationPowerAtCrankOverrunWatts() + { + return _m05.SmartOverrunCurrent * _powerNetVoltage * + (1 / (_m05.AlternatorsEfficiencyOverrunResultCard * _alternatorGearEfficiency)); + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M0_5Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M0_5Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..10318e37c5395ab55a7a2f6cb561cc3ddf197287 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/M0_5Impl.cs @@ -0,0 +1,105 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class M0_5Impl : AbstractModule, IM0_5_SmartAlternatorSetEfficiency + { + protected Ampere _smartIdleCurrent; + protected double _alternatorsEfficiencyIdleResultCard; + protected Ampere _smartTractionCurrent; + protected double _alternatorsEfficiencyTractionOnResultCard; + protected Ampere _smartOverrunCurrent; + protected double _alternatorsEfficiencyOverrunResultCard; + protected IM0_NonSmart_AlternatorsSetEfficiency _m0; + protected IElectricalConsumerList _electricalConsumables; + protected IAlternatorMap _alternatorMap; + protected IResultCard _resultCardIdle; + protected IResultCard _resultCardTraction; + protected IResultCard _resultCardOverrun; + protected ISignals _signals; + + public M0_5Impl(IM0_NonSmart_AlternatorsSetEfficiency m0, IElectricalConsumerList electricalConsumables, IAlternatorMap alternatorMap, IResultCard resultCardIdle, IResultCard resultCardTraction, IResultCard resultCardOverrun, ISignals signals) + { + //'Sanity Check on supplied arguments, throw an argument exception + if (m0 == null) { + throw new ArgumentException("Module 0 must be supplied");} + + if (electricalConsumables == null) { + throw new ArgumentException("ElectricalConsumablesList must be supplied even if empty"); + } + if (alternatorMap ==null) {throw new ArgumentException("Must supply a valid alternator map"); + } + if (resultCardIdle == null) { + throw new ArgumentException("Result Card 'IDLE' must be supplied even if it has no contents"); + } + + if (resultCardTraction == null) { + throw new ArgumentException("Result Card 'TRACTION' must be supplied even if it has no contents"); + } + + if (resultCardOverrun == null) { + throw new ArgumentException("Result Card 'OVERRUN' must be supplied even if it has no contents"); + } + if (signals == null) { + throw new ArgumentException("No Signals Reference object was provided ");} + + //'Assignments to private variables. + _m0 = m0; + _electricalConsumables = electricalConsumables; + _alternatorMap = alternatorMap; + _resultCardIdle = resultCardIdle; + _resultCardTraction = resultCardTraction; + _resultCardOverrun = resultCardOverrun; + _signals = signals; + } + + #region Implementation of IM0_5_SmartAlternatorSetEfficiency + + private Ampere HvacPlusNonBaseCurrents() + { + //'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb + return _m0.GetHVACElectricalPowerDemandAmps + _electricalConsumables.GetTotalAverageDemandAmps(true); //'/ElectricConstants.StoredEnergyEfficiency) + } + + public Ampere SmartIdleCurrent + { + get { + var hvac_Plus_None_Base = HvacPlusNonBaseCurrents(); + var smart_idle_current = _resultCardIdle.GetSmartCurrentResult(hvac_Plus_None_Base); + + return smart_idle_current; + } + } + + public double AlternatorsEfficiencyIdleResultCard + { + get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartIdleCurrent).Efficiency; } + } + + public Ampere SmartTractionCurrent + { + get { return _resultCardTraction.GetSmartCurrentResult(HvacPlusNonBaseCurrents()); } + } + + public double AlternatorsEfficiencyTractionOnResultCard + { + get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartTractionCurrent).Efficiency; } + } + + public Ampere SmartOverrunCurrent + { + get { return _resultCardOverrun.GetSmartCurrentResult(HvacPlusNonBaseCurrents()); } + } + + public double AlternatorsEfficiencyOverrunResultCard + { + get { return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartOverrunCurrent).Efficiency; } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ResultCard.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ResultCard.cs new file mode 100644 index 0000000000000000000000000000000000000000..99fe0342dc4db194db4f0068706ba5e5b9231bb3 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Electrics/ResultCard.cs @@ -0,0 +1,172 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +{ + public class ResultCard : IResultCard + { + private List<SmartResult> _results; + + // Constructor + public ResultCard(List<SmartResult> results) + { + if (results == null) + throw new ArgumentException("A list of smart results must be supplied."); + + _results = results; + } + + + // Public class outputs + public List<SmartResult> Results + { + get { return _results; } + } + + public Ampere GetSmartCurrentResult(Ampere Amps) + { + if (_results.Count < 2) + return 10.SI<Ampere>(); + + return GetOrInterpolate(Amps.Value()).SI<Ampere>(); + } + + + // Helpers + /// <summary> + /// ''' Gets or interpolates value (A) + /// ''' </summary> + /// ''' <param name="amps"></param> + /// ''' <returns></returns> + /// ''' <remarks></remarks> + private double GetOrInterpolate(double amps) + { + double pre; + double post; + double dAmps; + double dSmartAmps; + double smartAmpsSlope; + double smartAmps; + double maxKey; + double minKey; + + maxKey = _results.Max().Amps; + minKey = _results.Min().Amps; + + var compareKey = new SmartResult(amps, 0); + + // Is on boundary check + if (_results.Contains(compareKey)) + return _results.OrderBy(x => x.Amps).First(x => x.Amps == compareKey.Amps).SmartAmps; + + // Is over map - Extrapolate + if (amps > maxKey) { + // get the entries before and after the supplied key + pre = (from a in _results + orderby a.Amps + where a.Amps < maxKey + select a).Last().Amps; + post = maxKey; + + // get the delta values + dAmps = post - pre; + dSmartAmps = (from da in _results + orderby da.Amps + where da.Amps == post + select da).First().SmartAmps - (from da in _results + orderby da.Amps + where da.Amps == pre + select da).First().SmartAmps; + + // calculate the slopes + smartAmpsSlope = dSmartAmps / dAmps; + + // calculate the new values + smartAmps = ((amps - post) * smartAmpsSlope) + (from da in _results + orderby da.Amps + where da.Amps == post + select da).First().SmartAmps; + + return smartAmps; + } + + // Is under map - Extrapolate + if (amps < minKey) { + // get the entries before and after the supplied key + // Post is the first entry and pre is the penultimate to first entry + post = minKey; + pre = (from k in _results + orderby k.Amps + where k.Amps > minKey + select k).First().Amps; + + // get the delta values + dAmps = post - pre; + dSmartAmps = (from da in _results + orderby da.Amps + where da.Amps == post + select da).First().SmartAmps - (from da in _results + orderby da.Amps + where da.Amps == pre + select da).First().SmartAmps; + + // calculate the slopes + smartAmpsSlope = dSmartAmps / dAmps; + + // calculate the new values + smartAmps = ((amps - post) * smartAmpsSlope) + (from da in _results + orderby da.Amps + where da.Amps == post + select da).First().SmartAmps; + + return smartAmps; + } + + // Is Inside map - Interpolate + + // get the entries before and after the supplied rpm + pre = (from m in _results + orderby m.Amps + where m.Amps < amps + select m).Last().Amps; + post = (from m in _results + where m.Amps > amps + select m).First().Amps; + + // get the delta values for rpm and the map values + dAmps = post - pre; + dSmartAmps = (from da in _results + orderby da.Amps + where da.Amps == post + select da).First().SmartAmps - (from da in _results + orderby da.Amps + where da.Amps == pre + select da).First().SmartAmps; + + // calculate the slopes + smartAmpsSlope = dSmartAmps / dAmps; + + // calculate the new values + smartAmps = ((amps - post) * smartAmpsSlope) + (from da in _results + orderby da.Amps + where da.Amps == post + select da).First().SmartAmps; + + return smartAmps; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/Bus.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/Bus.cs new file mode 100644 index 0000000000000000000000000000000000000000..7dbb8d12aa337ffbccec5e994029ca43bf4adb30 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/Bus.cs @@ -0,0 +1,207 @@ +using System; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class Bus : IBus + { + + // Private Property Backing + private int _id; + private string _model; + private string _floorType; + private string _engineType; + private double _lengthInMetres; + private double _widthInMetres; + private double _heightInMetres; + private int _registeredPassengers; + private bool _isDoubleDecker; + + public int Id + { + get { + return _id; + } + } + + public string Model + { + get { + return _model; + } + set { + if (!ModelOK(value)) + throw new ArgumentException("Model argument is invalid"); + _model = value; + } + } + + public string FloorType + { + get { + return _floorType; + } + set { + if (!FloorTypeOK(value)) + throw new ArgumentException("Model argument is invalid"); + _floorType = value; + } + } + + public string EngineType + { + get { + return _engineType; + } + set { + if (!EngineOK(value)) + throw new ArgumentException("EngineType argument is invalid"); + _engineType = value; + } + } + + public double LengthInMetres + { + get { + return _lengthInMetres; + } + set { + if (!DimensionOK(value)) + throw new ArgumentException("Invalid Length"); + _lengthInMetres = value; + } + } + + public double WidthInMetres + { + get { + return _widthInMetres; + } + set { + if (!DimensionOK(value)) + throw new ArgumentException("Invalid Width"); + _widthInMetres = value; + } + } + + public double HeightInMetres + { + get { + return _heightInMetres; + } + set { + if (!DimensionOK(value)) + throw new ArgumentException("Invalid Height"); + _heightInMetres = value; + } + } + + public int RegisteredPassengers + { + get { + return _registeredPassengers; + } + set { + if (!PassengersOK(value)) + throw new ArgumentException("Invalid Number Of Passengers"); + _registeredPassengers = value; + } + } + + public bool IsDoubleDecker + { + get { + return _isDoubleDecker; + } + set { + _isDoubleDecker = value; + } + } + + // Constructors + public Bus(int _id, string _model, string _floorType, string _engineType, double _lengthInMetres, double _widthInMetres, double _heightInMetres, int _registeredPassengers, bool _doubleDecker) + { + + + // Validity checks. + if (!ModelOK(_model)) + throw new ArgumentException("Model argument is invalid"); + if (!FloorTypeOK(_floorType)) + throw new ArgumentException("Model argument is invalid"); + if (!EngineOK(_engineType)) + throw new ArgumentException("EngineType argument is invalid"); + if (!DimensionOK(_lengthInMetres)) + throw new ArgumentException("Invalid Length"); + if (!DimensionOK(_widthInMetres)) + throw new ArgumentException("Invalid Width"); + if (!DimensionOK(_heightInMetres)) + throw new ArgumentException("Invalid Height"); + if (!PassengersOK(_registeredPassengers)) + throw new ArgumentException("Invalid Number Of Passengers"); + + + // Set Private Members + this._id = _id; + this._model = _model; + this._floorType = _floorType; + this._engineType = _engineType; + this._lengthInMetres = _lengthInMetres; + this._widthInMetres = _widthInMetres; + this._heightInMetres = _heightInMetres; + this._registeredPassengers = _registeredPassengers; + this._isDoubleDecker = _doubleDecker; + } + + // Construction Validators Helpers + private bool ModelOK(string model) + { + model = model.ToLower(); + + if (model == null || model.Trim().Length == 0) + return false; + + return true; + } + + private bool FloorTypeOK(string floorType) + { + floorType = floorType.ToLower(); + + if (floorType == null || floorType.Trim().Length == 0) + return false; + + if (floorType != "raised floor" && floorType != "low floor" && floorType != "semi low floor") + return false; + + return true; + } + + private bool EngineOK(string engine) + { + engine = engine.ToLower(); + + if (engine == null || engine.Trim().Length == 0) + return false; + + if (engine != "diesel" && engine != "gas" && engine != "hybrid") + return false; + + return true; + } + + private bool DimensionOK(double dimension) + { + return dimension > 0.5; + } + + private bool PassengersOK(int registeredPassengers) + { + return registeredPassengers > 1; + } + + // To String function + public override string ToString() + { + return string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", _model, _floorType, _engineType, _lengthInMetres, _widthInMetres, _heightInMetres, _registeredPassengers, _isDoubleDecker); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/BusDatabase.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/BusDatabase.cs new file mode 100644 index 0000000000000000000000000000000000000000..95cce08ddaab0345725132b58066fa5fdc2b125f --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/BusDatabase.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class BusDatabase : IBusDatabase + { + private List<IBus> buses = new List<IBus>(); + private List<IBus> selectListBuses = new List<IBus>(); + + public bool AddBus(IBus bus) + { + var result = true; + + try { + buses.Add(bus); + } catch (Exception ex) { + result = false; + } + + return result; + } + + public List<IBus> GetBuses(string busModel, bool AsSelectList = false) + { + if (AsSelectList) { + selectListBuses = new List<IBus>(); + selectListBuses = buses.Where(v => v.Model == "" || v.Model.ToLower().Contains(busModel.ToLower())).ToList(); + selectListBuses.Insert(0, new Bus(0, "<Select>", "low floor", "gas", 1, 1, 1, 2, false)); + return selectListBuses; + } + + return buses.Where(v => v.Model == "" || v.Model.ToLower().Contains(busModel.ToLower())).ToList(); + } + + public bool Initialise(string filepath) + { + var returnStatus = true; + + if (File.Exists(filepath)) { + using (var sr = new StreamReader(filepath)) { + // get array og lines fron csv + var lines = sr.ReadToEnd().Split(new [] { Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); + + // Must have at least 2 entries in map to make it usable [dont forget the header row] + if (lines.Length < 2) { + return false; + } + + var firstline = true; + + var id = 1; + + foreach (var line in lines) { + if (!firstline) { + + // split the line + var elements = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + // 7 or 8 entries per line required + if ((elements.Length != 7 && elements.Length != 8)) + throw new ArgumentException("Incorrect number of values in csv file"); + + // Bus + try { + var bus = new Bus(id, elements[0], elements[1], elements[2], double.Parse(elements[3], CultureInfo.InvariantCulture), double.Parse(elements[4], CultureInfo.InvariantCulture), double.Parse(elements[5], CultureInfo.InvariantCulture), int.Parse(elements[6], CultureInfo.InvariantCulture), elements.Length == 8 ? bool.Parse(elements[7]) : false); + + buses.Add(bus); + } catch (Exception ex) { + + // Indicate problems + returnStatus = false; + } + + id = id + 1; + } else { + firstline = false; + } + } + } + } else { + returnStatus = false; + } + + var uniqueBuses = buses.Select(b => b.Model).Distinct().Count(); + if (buses.Count != uniqueBuses) { + returnStatus = false; + } + + return returnStatus; + } + + public bool UpdateBus(int id, IBus bus) + { + var result = true; + + try { + var existingBus = buses.Single(b => b.Id == id); + + existingBus.Model = bus.Model; + existingBus.RegisteredPassengers = bus.RegisteredPassengers; + existingBus.FloorType = bus.FloorType; + existingBus.LengthInMetres = bus.LengthInMetres; + existingBus.WidthInMetres = bus.WidthInMetres; + existingBus.HeightInMetres = bus.HeightInMetres; + existingBus.IsDoubleDecker = bus.IsDoubleDecker; + } catch (Exception ex) { + result = false; + } + + return result; + } + + public bool Save(string filepath) + { + var result = true; + var output = new StringBuilder(); + + try { + output.AppendLine("Bus Model,Type,engine Type,length in m,wide in m,height in m,registered passengers,double decker"); + + foreach (var bus in buses) + output.AppendLine(bus.ToString()); + + File.WriteAllText(filepath, output.ToString()); + } catch (Exception ex) { + result = false; + } + + return result; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/BusEngineType.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/BusEngineType.cs new file mode 100644 index 0000000000000000000000000000000000000000..5bee1d3394cc8ffc7d3e07cce31364681149fa59 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/BusEngineType.cs @@ -0,0 +1,9 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public enum BusEngineType + { + Diesal = 1, + Gas = 2, + Hybrid = 3 + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/DeleteCell.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/DeleteCell.cs new file mode 100644 index 0000000000000000000000000000000000000000..52c6871448f896edc9acf43a75751f188c4dcef2 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/DeleteCell.cs @@ -0,0 +1,64 @@ +using System.Drawing; +using System.Reflection; +using System.Windows.Forms; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC { + public class DeleteCell : DataGridViewButtonCell + { + public string ToolTip { get; set; } = "Delete tech benefit line"; + private Image del = null; //= My.Resources.ResourceManager.GetObject("Delete") as Image; + + + protected override void Paint( + Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, + object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, + DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) + { + if (del == null) { + var assembly = Assembly.GetExecutingAssembly(); + var file = assembly.GetManifestResourceStream("Delete"); + del = Image.FromStream(file); + } + advancedBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single; + + this.ToolTipText = ToolTip; + + cellStyle.BackColor = Color.White; + base.Paint( + graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, + advancedBorderStyle, paintParts); + graphics.DrawImage(del, cellBounds); + } + } + + public class DeleteAlternatorCell : DataGridViewButtonCell + { + public string ToolTip { get; set; } = "Delete alternator"; + + protected Image del = null; + //private Image del = My.Resources.ResourceManager.GetObject("Delete") as Image; + + protected override void Paint( + Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, + object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, + DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) + { + if (del == null) { + var assembly = Assembly.GetExecutingAssembly(); + var file = assembly.GetManifestResourceStream("Delete"); + del = Image.FromStream(file); + } + + + advancedBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single; + + this.ToolTipText = ToolTip; + + cellStyle.BackColor = Color.White; + base.Paint( + graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, + advancedBorderStyle, paintParts); + graphics.DrawImage(del, cellBounds); + } + } +} \ No newline at end of file diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/DeleteColumn.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/DeleteColumn.cs new file mode 100644 index 0000000000000000000000000000000000000000..2a48b0425ec15b682fd8d8e4a9a4d853d05b2ace --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/DeleteColumn.cs @@ -0,0 +1,19 @@ +using System.Windows.Forms; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC { + public class DeleteColumn : DataGridViewButtonColumn + { + public DeleteColumn() : base() + { + this.CellTemplate = new DeleteCell(); + } + } + + public class DeleteAlternatorColumn : DataGridViewButtonColumn + { + public DeleteAlternatorColumn() : base() + { + this.CellTemplate = new DeleteAlternatorCell(); + } + } +} \ No newline at end of file diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/EnvironmentalCondition.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/EnvironmentalCondition.cs new file mode 100644 index 0000000000000000000000000000000000000000..2b0d49eaeeac11008a7d027acbca387aa4b6efc7 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/EnvironmentalCondition.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class EnvironmentalCondition : IEnvironmentalCondition + { + private double _temperature; + private double _solar; + private double _weight; + + public EnvironmentalCondition(double temperature, double solar, double weight) + { + _temperature = temperature; + _solar = solar; + _weight = weight; + } + + public double GetTemperature() + { + return _temperature; + } + + public double GetSolar() + { + return _solar; + } + + public double GetWeighting() + { + return _weight; + } + + public double GetNormalisedWeighting(List<IEnvironmentalCondition> map) + { + return _weight / map.Sum(w => w.GetWeighting()); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/EnvironmentalConditionsMap.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/EnvironmentalConditionsMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..97dffa47d27a3eaeab535a466639cfe2a1240dec --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/EnvironmentalConditionsMap.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; +using TUGraz.VectoCore.BusAuxiliaries.Util; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class EnvironmentalConditionsMap : IEnvironmentalConditionsMap + { + private string filePath; + private string vectoDirectory; + + private List<IEnvironmentalCondition> _map = new List<IEnvironmentalCondition>(); + + public EnvironmentalConditionsMap(string filepath, string vectoDirectory) + { + this.filePath = filepath; + this.vectoDirectory = vectoDirectory; + + Initialise(); + } + + public bool Initialise() + { + if ((!string.IsNullOrWhiteSpace(filePath))) { + filePath = FilePathUtils.ResolveFilePath(vectoDirectory, filePath); + + if (File.Exists(filePath)) { + using (var sr = new StreamReader(filePath)) { + + // get array og lines fron csv + var lines = sr.ReadToEnd().Split(new [] { Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); + + // Must have at least 1 entries to make it usable [dont forget the header row] + if ((lines.Count() < 2)) + return false; + + var firstline = true; + + foreach (var line in lines) { + if (!firstline) { + + // split the line + var elements = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + + // 3 entries per line required + if ((elements.Length != 4)) + return false; + + // Add environment condition + var newCondition = new EnvironmentalCondition(double.Parse(elements[1], CultureInfo.InvariantCulture), double.Parse(elements[2], CultureInfo.InvariantCulture), double.Parse(elements[3], CultureInfo.InvariantCulture)); + + _map.Add(newCondition); + } else + firstline = false; + } + } + } else + return false; + } + + return true; + } + + public List<IEnvironmentalCondition> GetEnvironmentalConditions() + { + return _map; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACConstants.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACConstants.cs new file mode 100644 index 0000000000000000000000000000000000000000..7951d34b9df7b270520fb988d979077f7216892c --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACConstants.cs @@ -0,0 +1,60 @@ +// Copyright 2017 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. + +using Newtonsoft.Json; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class HVACConstants : IHVACConstants + { + [JsonProperty("FuelDensity")] + private readonly double _fuelDensity; + [JsonProperty("DieselGCVJperGram")] + private readonly double _dieselGcvJperGram = 44800; + + public HVACConstants() + { + _fuelDensity = 835; // .SI(Of KilogramPerCubicMeter)() + } + + public HVACConstants(KilogramPerCubicMeter fuelDensitySingle) + { + _fuelDensity = fuelDensitySingle.Value(); + } + + + [JsonIgnore] + public JoulePerKilogramm DieselGCVJperGram + { + get { + return _dieselGcvJperGram.SI(Unit.SI.Joule.Per.Gramm).Cast<JoulePerKilogramm>(); + } + } + + [JsonIgnore()] + public KilogramPerCubicMeter FuelDensity + { + get { + return _fuelDensity.SI<KilogramPerCubicMeter>(); + } + } + + [JsonIgnore()] + public double FuelDensityAsGramPerLiter + { + get { + return _fuelDensity * 1000; + } + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACSteadyStateModel.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACSteadyStateModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..656ffc9ecf5fd93c2f08d877b903331c9e02b633 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACSteadyStateModel.cs @@ -0,0 +1,103 @@ +// Copyright 2017 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. + +using System; +using System.IO; +using System.Linq; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class HVACSteadyStateModel : IHVACSteadyStateModel + { + public float HVACElectricalLoadPowerWatts { get; set; } + public float HVACFuellingLitresPerHour { get; set; } + public float HVACMechanicalLoadPowerWatts { get; set; } + + // Constructors + public HVACSteadyStateModel() + { + } + + public HVACSteadyStateModel(float elecPowerW, float mechPowerW, float fuellingLPH) + { + HVACElectricalLoadPowerWatts = elecPowerW; + HVACFuellingLitresPerHour = mechPowerW; + HVACMechanicalLoadPowerWatts = fuellingLPH; + } + + // Implementation + public bool SetValuesFromMap(string filePath, ref string message) + { + string myData; + string[] linesArray; + + var vbLf = '\n'; + + // Check map file can be found. + try { + myData = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); + } catch (FileNotFoundException ex) { + message = "HVAC Steady State Model : The map file was not found"; + return false; + } + + + linesArray = (from s in myData.Split(vbLf) + select s.Trim()).ToArray(); + + // Check count is at least 2 rows + if (linesArray.Count() < 2) { + message = "HVAC Steady State Model : Insufficient Lines in this File"; + return false; + } + + // validate headers + var headers = linesArray[0].Split(','); + if (headers.Length != 3 || headers[0].Trim() != "[Electrical Power (w)]" || headers[1].Trim() != "[Mechanical Power (w)]" || headers[2].Trim() != "[Fuelling (L/H)]") { + message = "HVAC Steady State Model : Column headers in *.AHSM file being read are incompatable."; + return false; + } + + // validate values + var values = linesArray[1].Split(','); + double unused; + if (headers.Length != 3 || !double.TryParse(values[0], out unused) || !double.TryParse(values[1], out unused) || !double.TryParse(values[2], out unused)) { + message = "Steady State Model : Unable to confirm numeric values in the *.AHSM file being read."; + return false; + } + + // OK we have the values so lets set the properties + float out1, out2, out3; + out1 = HVACElectricalLoadPowerWatts; + out2 = HVACMechanicalLoadPowerWatts; + out3 = HVACFuellingLitresPerHour; + try { + HVACElectricalLoadPowerWatts = float.Parse(values[0]); + HVACMechanicalLoadPowerWatts = float.Parse(values[1]); + HVACFuellingLitresPerHour = float.Parse(values[2]); + } catch (Exception ex) { + + // Restore in the event of failure to fully assign + HVACElectricalLoadPowerWatts = out1; + HVACMechanicalLoadPowerWatts = out2; + HVACFuellingLitresPerHour = out3; + + // Return result + message = "Steady State Model : Unable to parse the values in the *.AHSM file being read no values were harmed in reading of this file."; + return false; + } + + + return true; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACUserInputsConfig.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACUserInputsConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..ef2bc763dcb0f87edf4cefa64f619b28a8584f5b --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/HVACUserInputsConfig.cs @@ -0,0 +1,33 @@ +// Copyright 2017 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. + +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class HVACUserInputsConfig : IHVACUserInputsConfig + { + + // Constructor + public HVACUserInputsConfig(string ssmFilePath, string busDatabasePath, bool isDisabled) + { + this.SSMFilePath = ssmFilePath; + this.BusDatabasePath = busDatabasePath; + this.SSMDisabled = isDisabled; + } + + public string SSMFilePath { get; set; } + + public string BusDatabasePath { get; set; } + + public bool SSMDisabled { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/IBus.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/IBus.cs new file mode 100644 index 0000000000000000000000000000000000000000..452e9f583e0c33818c016dec0233960ddd407ad7 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/IBus.cs @@ -0,0 +1,16 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public interface IBus + { + int Id { get; } + + string Model { get; set; } + string FloorType { get; set; } + string EngineType { get; set; } + double LengthInMetres { get; set; } + double WidthInMetres { get; set; } + double HeightInMetres { get; set; } + int RegisteredPassengers { get; set; } + bool IsDoubleDecker { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/IBusDatabase.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/IBusDatabase.cs new file mode 100644 index 0000000000000000000000000000000000000000..32cf843ba26930eda134bca97184ab0de060347e --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/IBusDatabase.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public interface IBusDatabase + { + bool AddBus(IBus bus); + + List<IBus> GetBuses(string busModel, bool AsSelectList = false); + + bool Initialise(string busFileCSV); + + bool UpdateBus(int id, IBus bus); + + bool Save(string filepath); + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/M01Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/M01Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..b5cc278a9078682dedd7eebb497f1bce0d8c9992 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/M01Impl.cs @@ -0,0 +1,98 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public class M01Impl : AbstractModule, IM1_AverageHVACLoadDemand + { + protected IM0_NonSmart_AlternatorsSetEfficiency _m0; + protected Double _alternatorGearEfficiency; + protected Double _compressorGearEfficiency; + protected ISignals _signals; + protected Volt _powernetVoltage; + protected ISSMTOOL _steadyStateModel; + + protected Watt _ElectricalPowerW; + protected Watt _MechanicalPowerW; + protected LiterPerSecond _FuelingLPerH; + + public M01Impl(IM0_NonSmart_AlternatorsSetEfficiency m0, double altGearEfficiency, double compressorGearEfficiency, Volt powernetVoltage, ISignals signals, ISSMTOOL ssm) + { + //'Sanity Check - Illegal operations without all params. + if (m0 == null) { + throw new ArgumentException("Module0 as supplied is null"); + } + + if (altGearEfficiency < ElectricConstants.AlternatorPulleyEfficiencyMin || + altGearEfficiency > ElectricConstants.AlternatorPulleyEfficiencyMax) { + throw new ArgumentException( + string.Format + ( + "Gear efficiency must be between {0} and {1}", + ElectricConstants.AlternatorPulleyEfficiencyMin, ElectricConstants.AlternatorPulleyEfficiencyMax)); + } + if (signals == null) { + throw new Exception("Signals object as supplied is null"); + } + + if (powernetVoltage < ElectricConstants.PowenetVoltageMin || powernetVoltage > ElectricConstants.PowenetVoltageMax) { + throw new ArgumentException( + string.Format( + "PowenetVoltage supplied must be in the range {0} to {1}", ElectricConstants.PowenetVoltageMin, + ElectricConstants.PowenetVoltageMax)); + } + + if (ssm == null ) { + throw new ArgumentException("Steady State model was not supplied"); + } + + if (compressorGearEfficiency < 0 || altGearEfficiency > 1) { + throw new ArgumentException(String.Format("Compressor Gear efficiency must be between {0} and {1}", 0, 1)); + } + + //'Assign + _m0 = m0; + _alternatorGearEfficiency = altGearEfficiency; + _signals = signals; + + _compressorGearEfficiency = compressorGearEfficiency; + _powernetVoltage = powernetVoltage; + + + _steadyStateModel = ssm; + + _ElectricalPowerW = ssm.ElectricalWAdjusted.SI<Watt>(); + _MechanicalPowerW = ssm.MechanicalWBaseAdjusted.SI<Watt>(); + _FuelingLPerH = ssm.FuelPerHBaseAdjusted.SI(Unit.SI.Liter.Per.Hour).Cast<LiterPerSecond>(); // ' SI(Of LiterPerHour)() + + } + + #region Implementation of IM1_AverageHVACLoadDemand + + public Watt AveragePowerDemandAtCrankFromHVACMechanicalsWatts() + { + return _MechanicalPowerW * (1 / _compressorGearEfficiency); + } + + public Watt AveragePowerDemandAtAlternatorFromHVACElectricsWatts() + { + return _ElectricalPowerW; + } + + public Watt AveragePowerDemandAtCrankFromHVACElectricsWatts() + { + return _ElectricalPowerW * (1 / _m0.AlternatorsEfficiency / _alternatorGearEfficiency); + } + + public LiterPerSecond HVACFuelingLitresPerHour() + { + return _FuelingLPerH; + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMCalculate.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMCalculate.cs new file mode 100644 index 0000000000000000000000000000000000000000..5e96572d751ad407f05fe2dd5f474c2a6795e400 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMCalculate.cs @@ -0,0 +1,687 @@ +using System; +using System.Text; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + // Modeling SSHVAC V07 + public class SSMCalculate : ISSMCalculate + { + private ISSMTOOL ssmTOOL; + + private ISSMRun Run1; // { get; set; } + private ISSMRun Run2 { get; set; } + + // Constructor + public SSMCalculate(ISSMTOOL ssmTool) + { + ssmTOOL = ssmTool; + Run1 = new SSMRun(this.ssmTOOL, 1); + Run2 = new SSMRun(this.ssmTOOL, 2); + } + + + // BASE RESULTS + public double ElectricalWBase + { + get { + var ElectricalWBaseWeightedAverage = 0.0; + var gen = ssmTOOL.GenInputs; + var EC_EnviromentalTemperatureBefore = gen.EC_EnviromentalTemperature; + var EC_SolarBefore = gen.EC_Solar; + + // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + // Else if batch is enable calculate the ElectricalWBase for each input in the AENV file and then calculate the weighted average + if (!gen.EC_EnviromentalConditions_BatchEnabled) + ElectricalWBaseWeightedAverage = CalculateElectricalWBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1); + else { + foreach (var envCondition in gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions()) + ElectricalWBaseWeightedAverage += CalculateElectricalWBase(gen, envCondition.GetTemperature(), envCondition.GetSolar(), envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())); + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore; + gen.EC_Solar = EC_SolarBefore; + } + + return ElectricalWBaseWeightedAverage; + } + } + + public double MechanicalWBase + { + get { + var MechanicalWBaseWeightedAverage = 0.0; + var gen = ssmTOOL.GenInputs; + var EC_EnviromentalTemperatureBefore = gen.EC_EnviromentalTemperature; + var EC_SolarBefore = gen.EC_Solar; + + // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + // Else if batch is enable calculate the MechanicalWBase for each input in the AENV file and then calculate the weighted average + if (!gen.EC_EnviromentalConditions_BatchEnabled) + MechanicalWBaseWeightedAverage = CalculateMechanicalWBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1); + else { + foreach (var envCondition in gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions()) + MechanicalWBaseWeightedAverage += CalculateMechanicalWBase(gen, envCondition.GetTemperature(), envCondition.GetSolar(), envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())); + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore; + gen.EC_Solar = EC_SolarBefore; + } + + return MechanicalWBaseWeightedAverage; + } + } + + public double FuelPerHBase + { + get { + var FuelLPerHBaseWeightedAverage = 0.0; + var gen = ssmTOOL.GenInputs; + var EC_EnviromentalTemperatureBefore = gen.EC_EnviromentalTemperature; + var EC_SolarBefore = gen.EC_Solar; + + // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + // Else if batch is enable calculate the FuelLPerHBase for each input in the AENV file and then calculate the weighted average + if (!gen.EC_EnviromentalConditions_BatchEnabled) + FuelLPerHBaseWeightedAverage = CalculateFuelLPerHBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1); + else { + foreach (var envCondition in gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions()) + FuelLPerHBaseWeightedAverage += CalculateFuelLPerHBase(gen, envCondition.GetTemperature(), envCondition.GetSolar(), envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())); + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore; + gen.EC_Solar = EC_SolarBefore; + } + + return FuelLPerHBaseWeightedAverage; + } + } + + // ADJUSTED RESULTS + public double ElectricalWAdjusted + { + get { + var ElectricalWAdjustedAverage = 0.0; + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + var EC_EnviromentalTemperatureBefore = gen.EC_EnviromentalTemperature; + var EC_SolarBefore = gen.EC_Solar; + + // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + // Else if batch is enable calculate the ElectricalWAdjusted for each input in the AENV file and then calculate the weighted average + if (!gen.EC_EnviromentalConditions_BatchEnabled) + ElectricalWAdjustedAverage = CalculateElectricalWAdjusted(gen, tl, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1); + else { + foreach (var envCondition in gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions()) + ElectricalWAdjustedAverage += CalculateElectricalWAdjusted(gen, tl, envCondition.GetTemperature(), envCondition.GetSolar(), envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())); + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore; + gen.EC_Solar = EC_SolarBefore; + } + + return ElectricalWAdjustedAverage; + } + } + + public double MechanicalWBaseAdjusted + { + get { + var MechanicalWBaseAdjustedAverage = 0.0; + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + var EC_EnviromentalTemperatureBefore = gen.EC_EnviromentalTemperature; + var EC_SolarBefore = gen.EC_Solar; + + // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + // Else if batch is enable calculate the MechanicalWBaseAdjusted for each input in the AENV file and then calculate the weighted average + if (!gen.EC_EnviromentalConditions_BatchEnabled) + MechanicalWBaseAdjustedAverage = CalculateMechanicalWBaseAdjusted(gen, tl, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1); + else { + foreach (var envCondition in gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions()) + MechanicalWBaseAdjustedAverage += CalculateMechanicalWBaseAdjusted(gen, tl, envCondition.GetTemperature(), envCondition.GetSolar(), envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())); + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore; + gen.EC_Solar = EC_SolarBefore; + } + + return MechanicalWBaseAdjustedAverage; + } + } + + public double FuelPerHBaseAdjusted + { + get { + var FuelLPerHBaseAdjustedAverage = 0.0; + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + var EC_EnviromentalTemperatureBefore = gen.EC_EnviromentalTemperature; + var EC_SolarBefore = gen.EC_Solar; + + // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + // Else if batch is enable calculate the FuelLPerHBaseAdjusted for each input in the AENV file and then calculate the weighted average + if (!gen.EC_EnviromentalConditions_BatchEnabled) + FuelLPerHBaseAdjustedAverage = CalculateFuelLPerHBaseAdjusted(gen, tl, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1); + else { + foreach (var envCondition in gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions()) + FuelLPerHBaseAdjustedAverage += CalculateFuelLPerHBaseAdjusted(gen, tl, envCondition.GetTemperature(), envCondition.GetSolar(), envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())); + gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore; + gen.EC_Solar = EC_SolarBefore; + } + + return FuelLPerHBaseAdjustedAverage; + } + } + + + + + // Base Values + public double BaseHeatingW_Mechanical + { + get { + return default(Double); + } + } + + public double BaseHeatingW_ElectricalCoolingHeating + { + get { + return default(Double); + } + } + + public double BaseHeatingW_ElectricalVentilation + { + get { + // =IF(AND(M89<0,M90<0),IF(AND(C62="yes",C66="high"),C33,IF(AND(C62="yes",C66="low"),C34,0)),0) + + var gen = ssmTOOL.GenInputs; + + // Dim C33 = gen.BC_HighVentPowerW + // Dim C34 = gen.BC_LowVentPowerW + // Dim C62 = gen.VEN_VentilationONDuringHeating + // Dim C66 = gen.VEN_VentilationDuringHeating + // Dim M89 = Me.Run1.TotalW + // Dim M90 = Me.Run2.TotalW + + double res; + + res = Run1.TotalW < 0 && Run2.TotalW < 0 ? gen.VEN_VentilationOnDuringHeating && gen.VEN_VentilationDuringHeating.ToLower() == "high" ? gen.BC_HighVentPowerW : gen.VEN_VentilationOnDuringHeating && gen.VEN_VentilationDuringHeating.ToLower() == "low" ? gen.BC_LowVentPowerW : 0 : 0; + + + return res; + } + } + + public double BaseHeatingW_FuelFiredHeating + { + get { + // =IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:O90,3),0) + + // Dim M89 = Me.Run1.TotalW + // Dim M90 = Me.Run2.TotalW + // VLOOKUP(MAX(M89:M90),M89:O90 => VLOOKUP ( lookupValue, tableArray, colIndex, rangeLookup ) + + // If both Run TotalW values are >=0 then return FuelW from Run with largest TotalW value, else return 0 + if ((Run1.TotalW < 0 && Run2.TotalW < 0)) + return Run1.TotalW > Run2.TotalW ? Run1.FuelW : Run2.FuelW; + else + return 0; + } + } + + public double BaseCoolingW_Mechanical + { + get { + // =IF(C46<C28,0,IF(C53="electrical", 0, IF(AND(M89>0,M90>0),MIN(M89:M90),0))) + + var gen = ssmTOOL.GenInputs; + + // Dim C46 = gen.EC_EnviromentalTemperature + // Dim C28 = gen.BC_TemperatureCoolingTurnsOff + // Dim C53 = gen.AC_CompressorTypeDerived + // Dim M89 = Run1.TotalW + // Dim M90 = Run2.TotalW + + return gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff ? 0 : gen.AC_CompressorTypeDerived.ToLower() == "electrical" ? 0 : Run1.TotalW > 0 && Run2.TotalW > 0 ? Math.Min(Run1.TotalW, Run2.TotalW) : 0; + } + } + + public double BaseCoolingW_ElectricalCoolingHeating + { + get { + // =IF(C46<C28,0,IF(C53="electrical",IF(AND(M89>0,M90>0),MIN(M89:M90),0),0)) + + var gen = ssmTOOL.GenInputs; + + // Dim C46 = gen.EC_EnviromentalTemperature + // Dim C28 = gen.BC_TemperatureCoolingTurnsOff + // Dim C53 = gen.AC_CompressorTypeDerived + // Dim M89 = Run1.TotalW + // Dim M90 = Run2.TotalW + + return gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff ? 0 : gen.AC_CompressorTypeDerived.ToLower() == "electrical" ? Run1.TotalW > 0 && Run2.TotalW > 0 ? Math.Min(Run1.TotalW, Run2.TotalW) : 0 : 0; + } + } + + public double BaseCoolingW_ElectricalVentilation + { + get { + // =IF(AND(C46>=C28,M89>0,M90>0),IF(AND(C64="yes",C67="high"),C33,IF(AND(C64="yes",C67="low"),C34,0)),0) + + var gen = ssmTOOL.GenInputs; + + // Dim C46 = gen.EC_EnviromentalTemperature + // Dim C28 = gen.BC_TemperatureCoolingTurnsOff + // Dim M89 = Run1.TotalW + // Dim M90 = Run2.TotalW + // Dim C64 = gen.VEN_VentilationDuringAC + // Dim C67 = gen.VEN_VentilationDuringCooling + // Dim C33 = gen.BC_HighVentPowerW + // Dim C34 = gen.BC_LowVentPowerW + + return gen.EC_EnviromentalTemperature >= gen.BC_TemperatureCoolingTurnsOff && Run1.TotalW > 0 && Run2.TotalW > 0 ? gen.VEN_VentilationDuringAC && gen.VEN_VentilationDuringCooling.ToLower() == "high" ? gen.BC_HighVentPowerW : gen.VEN_VentilationDuringAC && gen.VEN_VentilationDuringCooling.ToLower() == "low" ? gen.BC_LowVentPowerW : 0 : 0; + } + } + + public double BaseCoolingW_FuelFiredHeating + { + get { + return 0; + } + } + + public double BaseVentilationW_Mechanical + { + get { + return default(Double); + } + } + + public double BaseVentilationW_ElectricalCoolingHeating + { + get { + return default(Double); + } + } + + public double BaseVentilationW_ElectricalVentilation + { + get { + // =IF(OR(AND(C46<C28,M89>0,M90>0),AND(M89>0,M90<0)),IF(AND(C63="yes",C65="high"),C33,IF(AND(C63="yes",C65="low"),C34,0)),0) + + var gen = ssmTOOL.GenInputs; + + // Dim C46 = gen.EC_EnviromentalTemperature + // Dim C28 = gen.BC_TemperatureCoolingTurnsOff + // Dim M89 = Run1.TotalW + // Dim M90 = Run2.TotalW + // Dim C63 = gen.VEN_VentilationWhenBothHeatingAndACInactive + // Dim C65 = gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive + // Dim C33 = gen.BC_HighVentPowerW + // Dim C34 = gen.BC_LowVentPowerW + + return (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff && Run1.TotalW > 0 && Run2.TotalW > 0) || (Run1.TotalW > 0 && Run2.TotalW < 0) ? gen.VEN_VentilationWhenBothHeatingAndACInactive && gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() == "high" ? gen.BC_HighVentPowerW : gen.VEN_VentilationWhenBothHeatingAndACInactive && gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() == "low" ? gen.BC_LowVentPowerW : 0 : 0; + } + } + + public double BaseVentilationW_FuelFiredHeating + { + get { + return 0; + } + } + + // Adjusted Values + public double TechListAdjustedHeatingW_Mechanical + { + get { + return default(Double); + } + } + + public double TechListAdjustedHeatingW_ElectricalCoolingHeating + { + get { + return default(Double); + } + } + + public double TechListAdjustedHeatingW_ElectricalVentilation + { + get { + // =IF('TECH LIST INPUT'!O92>0,MIN('TECH LIST INPUT'!O92,C43),MAX('TECH LIST INPUT'!O92,-C43)) + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + + // TECH LIST INPUT'!O92 + // Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + // Dim TLO92 As Double = tl.VHValueVariation + + + return tl.VHValueVariation > 0 ? Math.Min(tl.VHValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList) : Math.Max(tl.VHValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList); + } + } + + public double TechListAdjustedHeatingW_FuelFiredHeating + { + get { + // =IF('TECH LIST INPUT'!N92>0,MIN('TECH LIST INPUT'!N92,C43),MAX('TECH LIST INPUT'!N92,-C43)) + + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + + // TECH LIST INPUT'!N92 + // Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + // Dim TLN92 As Double = tl.HValueVariation + + + return tl.HValueVariation > 0 ? Math.Min(tl.HValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList) : Math.Max(tl.HValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList); + } + } + + public double TechListAdjustedCoolingW_Mechanical + { + get { + // =IF(IF(C53="mechanical",'TECH LIST INPUT'!R92,0)>0,MIN(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),C43),MAX(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),-C43)) + + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + double result; + // Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 + // Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + // Dim C53 As string = gen.AC_CompressorType + + //result = If(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0) > 0, + // Math.Min(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), + // gen.BC_MaxPossibleBenefitFromTechnologyList), + // Math.Max(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), + // -gen.BC_MaxPossibleBenefitFromTechnologyList)) + + result = (gen.AC_CompressorType.ToLower() == "mechanical" + ? tl.CValueVariation + : 0) > 0 + ? Math.Min( + gen.AC_CompressorType.ToLower() == "mechanical" ? tl.CValueVariation : 0, + gen.BC_MaxPossibleBenefitFromTechnologyList) + : Math.Max( + gen.AC_CompressorType.ToLower() == "mechanical" ? tl.CValueVariation : 0, + -gen.BC_MaxPossibleBenefitFromTechnologyList); + + return result; + } + } + + public double TechListAdjustedCoolingW_ElectricalCoolingHeating + { + get { + // =IF(IF(C53="mechanical",0,'TECH LIST INPUT'!R92)>0,MIN(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),C43),MAX(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),-C43)) + + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + double result; + + // Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 + // Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + // Dim C53 As string = gen.AC_CompressorType + + result = gen.AC_CompressorType.ToLower() == "mechanical" ? 0 : tl.CValueVariation > 0 ? Math.Min(gen.AC_CompressorType.ToLower() == "mechanical" ? 0 : tl.CValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList) : Math.Max(gen.AC_CompressorType.ToLower() == "mechanical" ? 0 : tl.CValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList); + + return result; + } + } + + public double TechListAdjustedCoolingW_ElectricalVentilation + { + get { + // =IF('TECH LIST INPUT'!Q92>0,MIN('TECH LIST INPUT'!Q92,C43),MAX('TECH LIST INPUT'!Q92,-C43)) + + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + + // Dim TLQ92 As Double = tl.VCValueVariation'TECH LIST INPUT'!Q92 + // Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + + return tl.VCValueVariation > 0 ? Math.Min(tl.VCValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList) : Math.Max(tl.VCValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList); + } + } + + public double TechListAdjustedCoolingW_FuelFiredHeating + { + get { + return 0; + } + } + + public double TechListAdjustedVentilationW_Mechanical + { + get { + return default(Double); + } + } + + public double TechListAdjustedVentilationW_ElectricalCoolingHeating + { + get { + return default(Double); + } + } + + public double TechListAdjustedVentilationW_ElectricalVentilation + { + get { + // =IF('TECH LIST INPUT'!P92>0,MIN('TECH LIST INPUT'!P92,C43),MAX('TECH LIST INPUT'!P92,-C43)) + + var gen = ssmTOOL.GenInputs; + var tl = ssmTOOL.TechList; + + // Dim TLP92 As Double = tl.VVValueVariation 'TECH LIST INPUT'!P92 + // Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList + + + return tl.VVValueVariation > 0 ? Math.Min(tl.VVValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList) : Math.Max(tl.VVValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList); + } + } + + public double TechListAdjustedVentilationW_FuelFiredHeating + { + get { + return 0; + } + } + + + // Provides Diagnostic Information for the user which can be displayed on the form. + // Based on the inputs generated, can be used to cross reference the Excel Model with the + // Outputs generated here. + public override string ToString() + { + var sb = new StringBuilder(); + var vbTab = "\t"; + + sb.AppendLine(""); + sb.AppendLine("TechList Detail"); + sb.AppendLine("***********************"); + + var nameLength = 40; + var catLength = 15; + var unitLength = 15; + var firstValuePos = nameLength + catLength + unitLength + 2; + string cat; + string name; + string units; + + sb.AppendLine(string.Format(new string(' ', firstValuePos) + "H{0}VH{0}VV{0}VC{0}C{0}", vbTab)); + + + foreach (var line in ssmTOOL.TechList.TechLines) { + { + var withBlock = line; + int extraNameSpaces, extraCatSpaces, extraUnitSpaces; + + extraNameSpaces = nameLength - withBlock.BenefitName.Length; + extraCatSpaces = catLength - withBlock.Category.Length; + extraUnitSpaces = unitLength - withBlock.Units.Length; + + cat = line.Category.Substring(0, Math.Min(line.Category.Length, catLength)) + new string(' ', extraCatSpaces < 0 ? 0 : extraCatSpaces).Replace(" ", "."); + name = line.BenefitName.Substring(0, Math.Min(line.BenefitName.Length, nameLength)) + new string(' ', extraNameSpaces < 0 ? 0 : extraNameSpaces).Replace(" ", "."); + units = line.Units.Substring(0, Math.Min(line.Units.Length, unitLength)) + new string(' ', extraUnitSpaces < 0 ? 0 : extraUnitSpaces).Replace(" ", "."); + + sb.AppendLine(string.Format(units + cat + name + " {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbTab, withBlock.H.ToString("0.000"), withBlock.VH.ToString("0.000"), withBlock.VV.ToString("0.000"), withBlock.VC.ToString("0.000"), withBlock.C.ToString("0.000"))); + } + } + + sb.AppendLine(""); + sb.AppendLine("TechList Totals"); + sb.AppendLine("***********************"); + + { + var withBlock = ssmTOOL.TechList; + sb.AppendLine(vbTab + vbTab + "H" + vbTab + "VH" + vbTab + "VV" + vbTab + "VC" + vbTab + "C"); + sb.AppendLine(string.Format("Base Var % {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbTab, withBlock.HValueVariation.ToString("0.000"), withBlock.VHValueVariation.ToString("0.000"), withBlock.VVValueVariation.ToString("0.000"), withBlock.VCValueVariation.ToString("0.000"), withBlock.CValueVariation.ToString("0.000"))); + sb.AppendLine(string.Format("Base Var KW {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbTab, withBlock.HValueVariationKW.ToString("0.000"), withBlock.VHValueVariationKW.ToString("0.000"), withBlock.VVValueVariationKW.ToString("0.000"), withBlock.VCValueVariationKW.ToString("0.000"), withBlock.CValueVariationKW.ToString("0.000"))); + } + + + // Runs + sb.AppendLine(Run1.ToString()); + sb.AppendLine(Run2.ToString()); + + // Staging Calcs + sb.AppendLine("Staging Base Values"); + sb.AppendLine("*******************"); + sb.AppendLine(vbTab + vbTab + vbTab + "Mechanical" + vbTab + "Elec Cool/Heat" + vbTab + "Elec Vent" + vbTab + "Fuel Fired Heating"); + + sb.AppendLine(string.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbTab, BaseHeatingW_Mechanical.ToString("0.00"), BaseHeatingW_ElectricalCoolingHeating.ToString("0.00"), BaseHeatingW_ElectricalVentilation.ToString("0.00"), BaseHeatingW_FuelFiredHeating.ToString("0.00"))); + sb.AppendLine(string.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbTab, BaseCoolingW_Mechanical.ToString("0.00"), BaseCoolingW_ElectricalCoolingHeating.ToString("0.00"), BaseCoolingW_ElectricalVentilation.ToString("0.00"), BaseCoolingW_FuelFiredHeating.ToString("0.00"))); + sb.AppendLine(string.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbTab, BaseVentilationW_Mechanical.ToString("0.00"), BaseVentilationW_ElectricalCoolingHeating.ToString("0.00"), BaseVentilationW_ElectricalVentilation.ToString("0.00"), BaseVentilationW_FuelFiredHeating.ToString("0.00"))); + + sb.AppendLine(""); + sb.AppendLine("Staging Adjusted Values"); + sb.AppendLine("***********************"); + + sb.AppendLine(string.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbTab, TechListAdjustedHeatingW_Mechanical.ToString("0.00"), TechListAdjustedHeatingW_ElectricalCoolingHeating.ToString("0.00"), TechListAdjustedHeatingW_ElectricalVentilation.ToString("0.00"), TechListAdjustedHeatingW_FuelFiredHeating.ToString("0.00"))); + sb.AppendLine(string.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbTab, TechListAdjustedCoolingW_Mechanical.ToString("0.00"), TechListAdjustedCoolingW_ElectricalCoolingHeating.ToString("0.00"), TechListAdjustedCoolingW_ElectricalVentilation.ToString("0.00"), TechListAdjustedCoolingW_FuelFiredHeating.ToString("0.00"))); + sb.AppendLine(string.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbTab, TechListAdjustedVentilationW_Mechanical.ToString("0.00"), TechListAdjustedVentilationW_ElectricalCoolingHeating.ToString("0.00"), TechListAdjustedVentilationW_ElectricalVentilation.ToString("0.00"), TechListAdjustedVentilationW_FuelFiredHeating.ToString("0.00"))); + + + return sb.ToString(); + } + + private double CalculateElectricalWBase(ISSMGenInputs genInputs, double EnviromentalTemperature, double Solar, double Weight) + { + + // MIN(SUM(H94),C54*1000)/C59+SUM(I93:I95) + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature; + genInputs.EC_Solar = Solar; + + // Dim H94 = BaseCoolingW_ElectricalCoolingHeating + // Dim C54 = genInputs.AC_CompressorCapacitykW + // Dim C59 = genInputs.AC_COP + // Dim I93 = BaseHeatingW_ElectricalVentilation + // Dim I94 = BaseCoolingW_ElectricalVentilation + // Dim I95 = BaseVentilationW_ElectricalVentilation + + var ElectricalWBaseCurrentResult = Math.Min(BaseCoolingW_ElectricalCoolingHeating, genInputs.AC_CompressorCapacitykW * 1000) / (double)genInputs.AC_COP + BaseHeatingW_ElectricalVentilation + BaseCoolingW_ElectricalVentilation + BaseVentilationW_ElectricalVentilation; + + return ElectricalWBaseCurrentResult * Weight; + } + + private double CalculateMechanicalWBase(ISSMGenInputs genInputs, double EnviromentalTemperature, double Solar, double Weight) + { + + // =MIN(F94,C54*1000)/C59 + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature; + genInputs.EC_Solar = Solar; + + // Dim F94 = BaseCoolingW_Mechanical + // Dim C54 = genInputs.AC_CompressorCapacitykW + // Dim C59 = genInputs.AC_COP + + var MechanicalWBaseCurrentResult = Math.Min(BaseCoolingW_Mechanical, genInputs.AC_CompressorCapacitykW * 1000) / (double)genInputs.AC_COP; + + return MechanicalWBaseCurrentResult * Weight; + } + + private double CalculateFuelLPerHBase(ISSMGenInputs genInputs, double EnviromentalTemperature, double Solar, double Weight) + { + + // =(MIN(ABS(J93/1000),C71)/C37)*(1/(C39*C38)) + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature; + genInputs.EC_Solar = Solar; + + // Dim J93 = BaseHeatingW_FuelFiredHeating + // Dim C71 = genInputs.AH_FuelFiredHeaterkW + // Dim C37 = genInputs.BC_AuxHeaterEfficiency + // Dim C39 = ssmTOOL.HVACConstants.FuelDensity + // Dim C38 = genInputs.BC_GCVDieselOrHeatingOil + + var FuelLPerHBaseCurrentResult = (Math.Min(Math.Abs(BaseHeatingW_FuelFiredHeating / 1000), genInputs.AH_FuelFiredHeaterkW) / (double)genInputs.BC_AuxHeaterEfficiency) * (1 / (double)(genInputs.BC_GCVDieselOrHeatingOil * ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)); + + return FuelLPerHBaseCurrentResult * Weight; + } + + private double CalculateElectricalWAdjusted(ISSMGenInputs genInputs, ISSMTechList tecList, double EnviromentalTemperature, double Solar, double Weight) + { + + // =(MIN((H94*(1-H100)),C54*1000)/C59)+(I93*(1-I99))+(I94*(1-I100))+(I95*(1-I101)) + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature; + genInputs.EC_Solar = Solar; + + var H94 = BaseCoolingW_ElectricalCoolingHeating; + var H100 = TechListAdjustedCoolingW_ElectricalCoolingHeating; + var C54 = genInputs.AC_CompressorCapacitykW; + var C59 = genInputs.AC_COP; + + var I93 = BaseHeatingW_ElectricalVentilation; + var I94 = BaseCoolingW_ElectricalVentilation; + var I95 = BaseVentilationW_ElectricalVentilation; + var I99 = TechListAdjustedHeatingW_ElectricalVentilation; + var I100 = TechListAdjustedCoolingW_ElectricalVentilation; + var I101 = TechListAdjustedVentilationW_ElectricalVentilation; + + var ElectricalWAdjusted = (Math.Min((H94 * (1 - H100)), C54 * 1000) / C59) + (I93 * (1 - I99)) + (I94 * (1 - I100)) + (I95 * (1 - I101)); + + return ElectricalWAdjusted * Weight; + } + + private double CalculateMechanicalWBaseAdjusted(ISSMGenInputs genInputs, ISSMTechList tecList, double EnviromentalTemperature, double Solar, double Weight) + { + + // =(MIN((F94*(1-F100)),C54*1000)/C59) + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature; + genInputs.EC_Solar = Solar; + + var F94 = BaseCoolingW_Mechanical; + var F100 = TechListAdjustedCoolingW_Mechanical; + var C54 = genInputs.AC_CompressorCapacitykW; + var C59 = genInputs.AC_COP; + + var MechanicalWBaseAdjusted = (Math.Min((F94 * (1 - F100)), C54 * 1000) / C59); + + return MechanicalWBaseAdjusted * Weight; + } + + private double CalculateFuelLPerHBaseAdjusted(ISSMGenInputs genInputs, ISSMTechList tecList, double EnviromentalTemperature, double Solar, double Weight) + { + + // =MIN(ABS(IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:P90,4),0)/1000),C71)/C37*(1/(C39*C38)) + + genInputs.EC_EnviromentalTemperature = EnviromentalTemperature; + genInputs.EC_Solar = Solar; + + // Dim M89 = Run1.TotalW + // Dim M90 = genInputs.BC_GCVDieselOrHeatingOil + // Dim C71 = genInputs.AH_FuelFiredHeaterkW + // Dim C37 = genInputs.BC_AuxHeaterEfficiency + // Dim C38 = genInputs.BC_GCVDieselOrHeatingOil + // Dim C39 = ssmTOOL.HVACConstants.FuelDensity + + double result = 0; + + if (Run1.TotalW < 0 && Run2.TotalW < 0) + result = Math.Abs(Run1.TotalW > Run2.TotalW ? Run1.TechListAmendedFuelW : Run2.TechListAmendedFuelW / (double)1000); + + var FuelLPerHBaseAdjusted = Math.Min(result, genInputs.AH_FuelFiredHeaterkW) / (double)genInputs.BC_AuxHeaterEfficiency * (1 / (double)(genInputs.BC_GCVDieselOrHeatingOil * ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)); + + return FuelLPerHBaseAdjusted * Weight; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMGenInputs.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMGenInputs.cs new file mode 100644 index 0000000000000000000000000000000000000000..90bb2fe732d34788dae9d309b6ce96de9547324e --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMGenInputs.cs @@ -0,0 +1,424 @@ +using System; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + // Used by SSMHVAC Class + public class SSMGenInputs : ISSMGenInputs + { + private string _EC_EnviromentalConditions_BatchFile; + private IEnvironmentalConditionsMap _EC_EnvironmentalConditionsMap; + private string _vectoDir; + + + public SSMGenInputs(bool initialiseDefaults = false, string vectoDir = "") + { + _vectoDir = vectoDir; + BP_BusModel = ""; + BP_BusFloorType = ""; + EC_EnviromentalConditions_BatchFile = ""; + AC_CompressorType = ""; + VEN_VentilationDuringCooling = ""; + VEN_VentilationDuringHeating = ""; + VEN_VentilationFlowSettingWhenHeatingAndACInactive = ""; + if (initialiseDefaults) + SetDefaults(); + } + + + + // C4/D4 + public string BP_BusModel { get; set; } + + // C5/D5 + public double BP_NumberOfPassengers { get; set; } + + // C6/D6 + public string BP_BusFloorType { get; set; } + + // D7/C7 - ( M/2 ) + public double BP_BusFloorSurfaceArea + { + get { + + // =IF(AND(C6="low floor",C13<=2.55,C13>=2.5),(2.55*(C12-1.2)),((C12-1.2)*C13)) + if (BP_BusFloorType == "low floor" && BP_BusWidth <= 2.55 && BP_BusWidth >= 2.5) + return Math.Round((2.55 * (BP_BusLength - 1.2)), 6); + else + return Math.Round(((BP_BusLength - 1.2) * BP_BusWidth), 6); + } + } + + // D8/C8 - ( M/2 ) + public double BP_BusSurfaceAreaM2 + { + get { + // 2 * (C12*C13 + C12*C14 + C13*C14) + return 2 * ((BP_BusLength * BP_BusWidth) + (BP_BusLength * BP_BusHeight) + (BP_BusWidth * BP_BusHeight)); + } + } + + // D9/C9 - ( M/2 ) + public double BP_BusWindowSurface + { + get { + // =(C40*C12)+C41 + return (BC_WindowAreaPerUnitBusLength * BP_BusLength) + BC_FrontRearWindowArea; + } + } + + // C10/D10 + public bool BP_DoubleDecker { get; set; } + + // D11/C11 - ( M/3 ) + public double BP_BusVolume + { + get { + // =(C12*C13*C14) + return (BP_BusLength * BP_BusWidth * BP_BusHeight); + } + } + + // D12/C12 - ( M ) + public double BP_BusLength { get; set; } + + // D13/C13 - ( M ) + public double BP_BusWidth { get; set; } + + // D14/C14 - ( M ) + public double BP_BusHeight { get; set; } + + + + // C17 + public double BC_GFactor { get; set; } + + // C18 + public double BC_SolarClouding + { + get { + // =IF(C46<17,0.65,0.8) + return EC_EnviromentalTemperature < 17 ? 0.65 : 0.8; + } + } + + // C19 - ( W ) + public double BC_HeatPerPassengerIntoCabinW + { + get { + // =IF(C46<17,50,80) + return EC_EnviromentalTemperature < 17 ? 50 : 80; + } + } + + // C20 - ( oC ) + public double BC_PassengerBoundaryTemperature { get; set; } + + // C21 - ( Passenger/Metre Squared ) + public double BC_PassengerDensityLowFloor + { + get { + // =IF($C$10="No",3,3.7) + return BP_DoubleDecker ? 3.7 : 3; + } + } + + // C22 - ( Passenger/Metre Squared ) + public double BC_PassengerDensitySemiLowFloor + { + get { + // =IF($C$10="No",2.2,3) + return BP_DoubleDecker ? 3 : 2.2; + } + } + + // C23 - ( Passenger/Metre Squared ) + public double BC_PassengerDensityRaisedFloor + { + get { + // =IF($C$10="No",1.4,2) + return BP_DoubleDecker ? 2 : 1.4; + } + } + + // C24 + public double BC_CalculatedPassengerNumber + { + get { + // =ROUND(IF($D$5<IF(D6="low floor",C21,IF(D6="semi low floor",C22,C23))*D7,$D$5,IF(D6="low floor",C21,IF(D6="semi low floor",C22,C23))*D7),0) + var tmp = BP_BusFloorType == "low floor" ? BC_PassengerDensityLowFloor : BP_BusFloorType == "semi low floor" ? BC_PassengerDensitySemiLowFloor : BC_PassengerDensityRaisedFloor * BP_BusFloorSurfaceArea; + return Math.Round(BP_NumberOfPassengers < tmp ? BP_NumberOfPassengers : tmp, 0); + } + } + + // C25 - ( W/K/M3 ) + public double BC_UValues + { + get { + // =IF(D6="low floor",4,IF(D6="semi low floor",3.5,3)) + return BP_BusFloorType == "low floor" ? 4 : BP_BusFloorType == "semi low floor" ? 3.5 : 3; + } + } + + // C26 - ( oC ) + public double BC_HeatingBoundaryTemperature { get; set; } + + // C27 - ( oC ) + public double BC_CoolingBoundaryTemperature { get; set; } + + // C28 - ( oC ) + public double BC_TemperatureCoolingTurnsOff + { + get { + return 17; + } + } + + // C29 - ( L/H ) + public double BC_HighVentilation { get; set; } + + // C30 - ( L/H ) + public double BC_lowVentilation { get; set; } + + // C31 - ( M3/H ) + public double BC_High + { + get { + // =D11*C29 + return BP_BusVolume * BC_HighVentilation; + } + } + + // C32 - ( M3/H ) + public double BC_Low + { + get { + // =C30*D11 + return BP_BusVolume * BC_lowVentilation; + } + } + + // C33 - ( W ) + public double BC_HighVentPowerW + { + get { + // =C31*C35 + return BC_High * BC_SpecificVentilationPower; + } + } + + // C34 - ( W ) + public double BC_LowVentPowerW + { + get { + // =C32*C35 + return BC_Low * BC_SpecificVentilationPower; + } + } + + // C35 - ( Wh/M3 ) + public double BC_SpecificVentilationPower { get; set; } + + // C37 + public double BC_AuxHeaterEfficiency { get; set; } + + // C38 - ( KW/HKG ) + public double BC_GCVDieselOrHeatingOil { get; set; } + + // C40 - ( M2/M ) + public double BC_WindowAreaPerUnitBusLength + { + get { + // =IF($C$10="No",1.5,2.5) + return BP_DoubleDecker ? 2.5 : 1.5; + } + } + + // C41 - ( M/2 ) + public double BC_FrontRearWindowArea + { + get { + // =IF($C$10="No",5,8) + return BP_DoubleDecker ? 8 : 5; + } + } + + // C42 - ( K ) + public double BC_MaxTemperatureDeltaForLowFloorBusses { get; set; } + + // C43 - ( Fraction ) + public double BC_MaxPossibleBenefitFromTechnologyList { get; set; } + + + + // C46 - ( oC ) + public double EC_EnviromentalTemperature { get; set; } + + // C47 - ( W/M3 ) + public double EC_Solar { get; set; } + + // ( EC_EnviromentalTemperature and EC_Solar) (Batch Mode) + public IEnvironmentalConditionsMap EC_EnvironmentalConditionsMap + { + get { + return _EC_EnvironmentalConditionsMap; + } + } + + public string EC_EnviromentalConditions_BatchFile + { + get { + return _EC_EnviromentalConditions_BatchFile; + } + set { + _EC_EnvironmentalConditionsMap = new EnvironmentalConditionsMap(value, _vectoDir); + _EC_EnviromentalConditions_BatchFile = value; + } + } + + public bool EC_EnviromentalConditions_BatchEnabled { get; set; } + + + + // C53 - "Continous/2-stage/3-stage/4-stage + public string AC_CompressorType { get; set; } + + // mechanical/electrical + public string AC_CompressorTypeDerived + { + get { + return AC_CompressorType == "Continuous" ? "Electrical" : "Mechanical"; + } + } + + // C54 - ( KW ) + public double AC_CompressorCapacitykW { get; set; } + + // C59 + public double AC_COP + { + get { + var cop = 3.5D; + + if ((AC_CompressorType != null)) { + cop = AC_CompressorType.ToLower() == "3-stage" ? cop * 1.02 : cop; + cop = AC_CompressorType.ToLower() == "4-stage" ? cop * 1.02 : cop; + cop = AC_CompressorType.ToLower() == "continuous" ? BP_BusFloorType.ToLower() == "low floor" ? cop * 1.04 : cop * 1.06 : cop; + } + + return Math.Round(cop, 2); + } + } + + + + // C62 - Boolean Yes/No + public bool VEN_VentilationOnDuringHeating { get; set; } + + // C63 - Boolean Yes/No + public bool VEN_VentilationWhenBothHeatingAndACInactive { get; set; } + + // C64 - Boolean Yes/No + public bool VEN_VentilationDuringAC { get; set; } + + // C65 - String high/low + public string VEN_VentilationFlowSettingWhenHeatingAndACInactive { get; set; } + + // C66 - String high/low + public string VEN_VentilationDuringHeating { get; set; } + + // C67 - String high/low + public string VEN_VentilationDuringCooling { get; set; } + + + + // C70 - ( KW ) + public double AH_EngineWasteHeatkW { get; set; } + + // C71 - ( KW ) + public double AH_FuelFiredHeaterkW { get; set; } + + public double AH_FuelEnergyToHeatToCoolant { get; set; } + + public double AH_CoolantHeatTransferredToAirCabinHeater { get; set; } + + + + private void SetDefaults() + { + + // BUS Parameterisation + // ******************** + BP_BusModel = "DummyBus"; + BP_NumberOfPassengers = 47.0D; + BP_BusFloorType = "raised floor"; + BP_DoubleDecker = false; + BP_BusLength = 10.655D; + BP_BusWidth = 2.55D; + BP_BusHeight = 2.275D; + // BP_BusFloorSurfaceArea : Calculated + // BP_BusSurfaceAreaM2 : Calculated + // BP_BusWindowSurface : Calculated + // BP_BusVolume : Calculated + + // BOUNDRY CONDITIONS + // ****************** + + BC_GFactor = 0.95D; + // BC_SolarClouding As Double :Calculated + // BC_HeatPerPassengerIntoCabinW :Calculated + BC_PassengerBoundaryTemperature = 12.0D; + // BC_PassengerDensityLowFloor :Calculated + // BC_PassengerDensitySemiLowFloor :Calculated + // BC_PassengerDensityRaisedFloor :Calculated + // BC_CalculatedPassengerNumber :Calculated + // BC_UValues :Calculated + BC_HeatingBoundaryTemperature = 18.0D; + BC_CoolingBoundaryTemperature = 23.0D; + // BC_CoolingBoundaryTemperature : ReadOnly Static + BC_HighVentilation = 20.0D; + BC_lowVentilation = 7.0D; + // BC_High :Calculated + // BC_Low :Calculated + // BC_HighVentPowerW :Calculated + // BC_LowVentPowerW :Calculated + BC_SpecificVentilationPower = 0.56D; + // BC_COP :Calculated + BC_AuxHeaterEfficiency = 0.84D; + BC_GCVDieselOrHeatingOil = 11.8D; + // BC_WindowAreaPerUnitBusLength :Calculated + // BC_FrontRearWindowArea :Calculated + BC_MaxTemperatureDeltaForLowFloorBusses = 3.0D; + BC_MaxPossibleBenefitFromTechnologyList = 0.5D; + + // Environmental Conditions + // ************************ + EC_EnviromentalTemperature = 25.0D; + EC_Solar = 400.0D; + EC_EnviromentalConditions_BatchEnabled = true; + EC_EnviromentalConditions_BatchFile = "DefaultClimatic.aenv"; + + // AC SYSTEM + // ********* + AC_CompressorType = "2-stage"; + AC_CompressorCapacitykW = 18.0D; + + + // VENTILATION + // *********** + VEN_VentilationOnDuringHeating = true; + VEN_VentilationWhenBothHeatingAndACInactive = true; + VEN_VentilationDuringAC = true; + VEN_VentilationFlowSettingWhenHeatingAndACInactive = "high"; + VEN_VentilationDuringHeating = "high"; + VEN_VentilationDuringCooling = "high"; + + + // AUX HEATER + // ********** + AH_FuelFiredHeaterkW = 30.0D; + AH_FuelEnergyToHeatToCoolant = 0.2; + AH_CoolantHeatTransferredToAirCabinHeater = 0.75; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMRun.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMRun.cs new file mode 100644 index 0000000000000000000000000000000000000000..76fca6a6273248ee2c98a1d754eb1007c6fd9b8f --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMRun.cs @@ -0,0 +1,196 @@ +using System; +using System.Text; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + + // Used By SSMHVAC Class + public class SSMRun : ISSMRun + { + private ISSMTOOL ssmTOOL; + private int runNumber; + + + public SSMRun(ISSMTOOL ssm, int runNbr) + { + if (runNbr != 1 && runNbr != 2) + throw new ArgumentException("Run number must be either 1 or 2"); + + runNumber = runNbr; + ssmTOOL = ssm; + } + + + public double HVACOperation + { + get { + // =IF(C43>C25,3,IF(C43<C24,1,2)) + // C43 = EC_Enviromental Temperature + // C25 = BC_CoolingBoundary Temperature + // C24 = BC_HeatingBoundaryTemperature + + var gen = ssmTOOL.GenInputs; + + return gen.EC_EnviromentalTemperature > gen.BC_CoolingBoundaryTemperature ? 3 : gen.EC_EnviromentalTemperature < gen.BC_HeatingBoundaryTemperature ? 1 : 2; + } + } + public double TCalc + { + get { + + // C24 = BC_HeatingBoundaryTemperature + // C25 = BC_CoolingBoundary Temperature + // C6 = BP_BusFloorType + // C43 = EC_Enviromental Temperature + // C39 = BC_FontAndRearWindowArea + + var gen = ssmTOOL.GenInputs; + double returnVal; + + if (runNumber == 1) + returnVal = gen.BC_HeatingBoundaryTemperature; + else + returnVal = gen.BP_BusFloorType == "low floor" ? (gen.EC_EnviromentalTemperature - gen.BC_CoolingBoundaryTemperature) < gen.BC_FrontRearWindowArea ? gen.BC_CoolingBoundaryTemperature : gen.EC_EnviromentalTemperature - 3 : gen.BC_CoolingBoundaryTemperature; + + + return returnVal; + } + } + public double TemperatureDelta + { + get { + // =C43-F79/F80 + // C43 = EC_Enviromental Temperature + // F79/80 = Me.TCalc + + var gen = ssmTOOL.GenInputs; + return gen.EC_EnviromentalTemperature - TCalc; + } + } + public double QWall + { + get { + // =I79*D8*C23 or '=I80*D8*C23 + // Translated to + // =I79*C8*C23 or '=I80*C8*C23 + + // C23 = BC_UValues + // C8 = BP_BusSurfaceAreaM2 + // I78/I80 = Me.TemperatureDelta + + var gen = ssmTOOL.GenInputs; + + return TemperatureDelta * gen.BP_BusSurfaceAreaM2 * gen.BC_UValues; + } + } + public double WattsPerPass + { + get { + + // =IF(D5="",C22,IF(E5="",IF(C22<D5,C22,D5),E5))*C17 + // Translated to + // =IF(IF(C22<C5,C22,C5))*C17 + // Simplified to + // Max( C22,C5 ) + + // C5 = BP_NumberOfPassengers + // C22 = BC_Calculated Passenger Number + // C17 = BC_Heat Per Passenger into cabin + + + var gen = ssmTOOL.GenInputs; + + return Math.Min(gen.BP_NumberOfPassengers, gen.BC_CalculatedPassengerNumber) * gen.BC_HeatPerPassengerIntoCabinW; + } + } + public double Solar + { + get { + // =C44*D9*C15*C16*0.25 + // Translated to + // =C44*C9*C15*C16*0.25 + + // C44 = EC_Solar + // C9 = BP_BusWindowSurfaceArea + // C15 = BC_GFactor + // C16 = BC_SolarClouding + + var gen = ssmTOOL.GenInputs; + + + return gen.EC_Solar * gen.BP_BusWindowSurface * gen.BC_GFactor * gen.BC_SolarClouding * 0.25; + } + } + public double TotalW + { + get { + + // =SUM(J79:L79) or =SUM(J80:L80) + // Tanslated to + // =Sum ( Me.Qwall ,Me.WattsPerPass,Me.Solar ) + + return QWall + WattsPerPass + Solar; + } + } + public double TotalKW + { + get { + // =M79 or =M80 / (1000) + + return TotalW / 1000; + } + } + public double FuelW + { + get { + // =IF(AND(N79<0,N79<(C60*-1)),N79-(C60*-1),0)*1000 + + var gen = ssmTOOL.GenInputs; + + // Dim N79 as Double = TotalKW + // Dim C60 As Double = gen.AH_EngineWasteHeatkW + + return (TotalKW < 0 && TotalKW < (gen.AH_EngineWasteHeatkW * -1)) ? TotalKW - (gen.AH_EngineWasteHeatkW * -1) : 0 + * 1000; + } + } + public double TechListAmendedFuelW + { + get { + // =IF(IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000<0,IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000,0) + + var gen = ssmTOOL.GenInputs; + var TLFFH = ssmTOOL.Calculate.TechListAdjustedHeatingW_FuelFiredHeating; + // Dim C60 As Double = gen.AH_EngineWasteHeatkW + // Dim N79 As Double = Me.TotalKW + + return ((TotalKW * (1 - TLFFH)) < 0 && (TotalKW * (1 - TLFFH)) < (gen.AH_EngineWasteHeatkW * -1)) ? (TotalKW * (1 - TLFFH)) - (gen.AH_EngineWasteHeatkW * -1) : 0 * 1000 < 0 ? ((TotalKW * (1 - TLFFH)) < 0 && (TotalKW * (1 - TLFFH)) < (gen.AH_EngineWasteHeatkW * -1)) ? (TotalKW * (1 - TLFFH)) - (gen.AH_EngineWasteHeatkW * -1) : 0 * 1000 : 0; + } + } + + // Provides Diagnostic Information + // To be utilised by the User. + public override string ToString() + { + var sb = new StringBuilder(); + + var vbTab = "\t"; + sb.AppendLine(string.Format("Run : {0}", runNumber)); + sb.AppendLine(string.Format("************************************")); + sb.AppendLine(string.Format("HVAC OP " + vbTab + ": {0}", HVACOperation)); + sb.AppendLine(string.Format("TCALC " + vbTab + ": {0}", TCalc)); + sb.AppendLine(string.Format("Tempurature D " + vbTab + ": {0}", TemperatureDelta)); + sb.AppendLine(string.Format("QWall " + vbTab + ": {0}", QWall)); + sb.AppendLine(string.Format("WattsPerPass " + vbTab + ": {0}", WattsPerPass)); + sb.AppendLine(string.Format("Solar " + vbTab + ": {0}", Solar)); + sb.AppendLine(string.Format("TotalW " + vbTab + ": {0}", TotalW)); + sb.AppendLine(string.Format("TotalKW " + vbTab + ": {0}", TotalKW)); + sb.AppendLine(string.Format("Fuel W " + vbTab + ": {0}", FuelW)); + sb.AppendLine(string.Format("Fuel Tech Adj " + vbTab + ": {0}", TechListAmendedFuelW)); + + + return sb.ToString(); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTOOL.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTOOL.cs new file mode 100644 index 0000000000000000000000000000000000000000..94c9ce57fd4f32b3ddc40c824a16d78bdf795f84 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTOOL.cs @@ -0,0 +1,270 @@ +using System; +using System.IO; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +using Omu.ValueInjecter; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; +using TUGraz.VectoCore.BusAuxiliaries.Util; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + // Used by frmHVACTool + // Replaces Spreadsheet model which does the same calculation + // Version of which appears on the form title. + public class SSMTOOL : ISSMTOOL + { + private string filePath; + public ISSMGenInputs GenInputs { get; set; } + public ISSMTechList TechList { get; set; } + public ISSMCalculate Calculate { get; set; } + public bool SSMDisabled { get; set; } + public IHVACConstants HVACConstants { get; set; } + + // Repeat Warning Flags + private bool CompressorCapacityInsufficientWarned; + private bool FuelFiredHeaterInsufficientWarned; + + // Base Values + public double ElectricalWBase + { + get { + return SSMDisabled ? 0 : Calculate.ElectricalWBase; // .SI(Of Watt)() + } + } + + public double MechanicalWBase + { + get { + return SSMDisabled ? 0 : Calculate.MechanicalWBase; // .SI(Of Watt)() + } + } + + public double FuelPerHBase + { + get { + return SSMDisabled ? 0 : Calculate.FuelPerHBase; // .SI(Of LiterPerHour)() + } + } + + // Adjusted Values + public double ElectricalWAdjusted + { + get { + return SSMDisabled ? 0 : Calculate.ElectricalWAdjusted; // .SI(Of Watt)() + } + } + + public double MechanicalWBaseAdjusted + { + get { + var mechAdjusted = SSMDisabled ? 0 : Calculate.MechanicalWBaseAdjusted; + + if (CompressorCapacityInsufficientWarned == false && (mechAdjusted) / (1000 * GenInputs.AC_COP) > GenInputs.AC_CompressorCapacitykW) { + OnMessage(this, "HVAC SSM :AC-Compressor Capacity unable to service cooling, run continues as if capacity was sufficient.", AdvancedAuxiliaryMessageType.Warning); + CompressorCapacityInsufficientWarned = true; + } + + + return mechAdjusted; // .SI(Of Watt)() + } + } + + public double FuelPerHBaseAdjusted + { + get { + return SSMDisabled ? 0 : Calculate.FuelPerHBaseAdjusted; // .SI(Of LiterPerHour)() + } + } + + // Constructors + public SSMTOOL(string filePath, HVACConstants hvacConstants, bool isDisabled = false, bool useTestValues = false) + { + this.filePath = filePath; + this.SSMDisabled = isDisabled; + this.HVACConstants = hvacConstants; + + GenInputs = new SSMGenInputs(useTestValues, FilePathUtils.fPATH(filePath)); + TechList = new SSMTechList(filePath, GenInputs, useTestValues); + + Calculate = new SSMCalculate(this); + } + + // Clone values from another object of same type + public void Clone(ISSMTOOL from) + { + var feedback = string.Empty; + + GenInputs.InjectFrom(((SSMTOOL)from).GenInputs); + + TechList.Clear(); + + foreach (var line in from.TechList.TechLines) { + var newLine = new TechListBenefitLine(this.GenInputs); + // newLine.InjectFrom() + newLine.InjectFrom(line); + TechList.Add(newLine, ref feedback); + } + } + + // Persistance Functions + public bool Save(string filePath) + { + var returnValue = true; + var settings = new JsonSerializerSettings(); + settings.TypeNameHandling = TypeNameHandling.Objects; + + // JSON METHOD + try { + var output = JsonConvert.SerializeObject(this, Formatting.Indented, settings); + + File.WriteAllText(filePath, output); + } catch (Exception ex) { + + // Nothing to do except return false. + returnValue = false; + } + + return returnValue; + } + + public bool Load(string filePath) + { + var returnValue = true; + var settings = new JsonSerializerSettings(); + SSMTOOL tmpAux; // = New SSMTOOL(filePath, HVACConstants) + + settings.TypeNameHandling = TypeNameHandling.Objects; + + // JSON METHOD + try { + var output = File.ReadAllText(filePath); + + + tmpAux = JsonConvert.DeserializeObject<SSMTOOL>(output, settings); + + tmpAux.TechList.SetSSMGeneralInputs(tmpAux.GenInputs); + + foreach (TechListBenefitLine tll in tmpAux.TechList.TechLines) + + tll.inputSheet = tmpAux.GenInputs; + + + // This is where we Assume values of loaded( Deserialized ) object. + Clone(tmpAux); + } catch (Exception ex) { + + // Nothing to do except return false. + + returnValue = false; + } + + return returnValue; + } + + // Comparison + public bool IsEqualTo(ISSMTOOL source) + { + + // In this methods we only want to compare the non Static , non readonly public properties of + // The class's General, User Inputs and Tech Benefit members. + + return compareGenUserInputs(source) && compareTechListBenefitLines(source); + } + + private bool compareGenUserInputs(ISSMTOOL source) + { + var src = (SSMTOOL)source; + + var returnValue = true; + + var properties = this.GenInputs.GetType().GetProperties(); + + foreach (var prop in properties) { + + // If Not prop.GetAccessors.IsReadOnly Then + if (prop.CanWrite) { + if (!prop.GetValue(this.GenInputs, null/* TODO Change to default(_) if this is not a reference type */).Equals(prop.GetValue(src.GenInputs, null/* TODO Change to default(_) if this is not a reference type */))) + returnValue = false; + } + } + + return returnValue; + } + + private bool compareTechListBenefitLines(ISSMTOOL source) + { + var src = (SSMTOOL)source; + + // Equal numbers of lines check + if (this.TechList.TechLines.Count != src.TechList.TechLines.Count) + return false; + + foreach (var tl in this.TechList.TechLines.OrderBy(o => o.Category).ThenBy(n => n.BenefitName)) { + + // First Check line exists in other + if (src.TechList.TechLines.Where(w => w.BenefitName == tl.BenefitName && w.Category == tl.Category).Count() != 1) + return false; + else { + + // check are equal + + var testLine = src.TechList.TechLines.First(w => w.BenefitName == tl.BenefitName && w.Category == tl.Category); + + if (!testLine.IsEqualTo(tl)) + return false; + } + } + + // All Looks OK + return true; + } + + // Overrides + public override string ToString() + { + var sb = new StringBuilder(); + + sb.AppendLine(Calculate.ToString()); + + + return sb.ToString(); + } + + // Dynamicly Get Fuel having re-adjusted Engine Heat Waste, this was originally supposed to be Solid State. Late adjustment request 24/3/2015 + public double FuelPerHBaseAsjusted(double AverageUseableEngineWasteHeatKW) + { + if (SSMDisabled) + return 0; + + // Set Engine Waste Heat + GenInputs.AH_EngineWasteHeatkW = AverageUseableEngineWasteHeatKW; + var fba = FuelPerHBaseAdjusted; + + // Dim FuelFiredWarning As Boolean = fba * GenInputs.BC_AuxHeaterEfficiency * HVACConstants.FuelDensity * GenInputs.BC_GCVDieselOrHeatingOil * 1000 > (AverageUseableEngineWasteHeatKW + GenInputs.AH_FuelFiredHeaterkW) + + // If Not FuelFiredHeaterInsufficientWarned AndAlso FuelFiredWarning Then + + // FuelFiredHeaterInsufficientWarned = True + + // OnMessage(Me, " HVAC SSM : Fuel fired heater insufficient for heating requirements, run continues assuming it was sufficient.", AdvancedAuxiliaryMessageType.Warning) + + // End If + + return fba; + } + + // Events + public event MessageEventHandler Message; + + // Raise Message Event. + private void OnMessage(object sender, string message, AdvancedAuxiliaryMessageType messageType) + { + if (message != null) { + object ssmtool = this; + Message?.Invoke(ref ssmtool, message: message, messageType: messageType); + } + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTechList.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTechList.cs new file mode 100644 index 0000000000000000000000000000000000000000..e4fe9e701d74b78059e04bc88941f4ab923a64d2 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTechList.cs @@ -0,0 +1,487 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + // Used By SSMTOOL Class. + public class SSMTechList : ISSMTechList + { + + // Private Fields + private string filePath; + private ISSMGenInputs _ssmInputs; + private bool _dirty; + + public List<ITechListBenefitLine> TechLines { get; set; } + + // Constructors + public SSMTechList(string filepath, ISSMGenInputs genInputs, bool initialiseDefaults = false) + { + TechLines = new List<ITechListBenefitLine>(); + + filePath = filepath; + + _ssmInputs = genInputs; + + if (initialiseDefaults) + SetDefaults(); + } + + + public void SetSSMGeneralInputs(ISSMGenInputs genInputs) + { + _ssmInputs = genInputs; + } + + // Initialisation Methods + public bool Initialise(string filepath) + { + filePath = filepath; + + return Initialise(); + } + + public bool Initialise() + { + var returnStatus = true; + + if (File.Exists(filePath)) { + using (var sr = new StreamReader(filePath)) { + // get array og lines fron csv + var lines = sr.ReadToEnd().Split(new [] { Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); + + // Must have at least 2 entries in map to make it usable [dont forget the header row] + if (lines.Length < 1) { + return false; + } + + var firstline = true; + + foreach (var line in lines) { + if (!firstline) { + + // split the line + var elements = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + // 3 entries per line required + if (elements.Length != 17) + throw new ArgumentException("Incorrect number of values in csv file"); + // add values to map + + // 00. Category, + // 01. BenefitName, + // 02. Units, + // 03. LowH, + // 04. LowV, + // 05. LowC, + // 06. SemiLowH, + // 07. SemiLowV, + // 08. SemiLowC, + // 09. RaisedH, + // 10. RaisedV, + // 11. RaisedC, + // 12. OnVehicle, + // 13. LineType, + // 14. AvtiveVH, + // 15. ActiveVV, + // 16. ActiveVC + + + // Bus + try { + var tbline = new TechListBenefitLine(_ssmInputs, elements[2], elements[0], elements[1], double.Parse(elements[3], CultureInfo.InvariantCulture), double.Parse(elements[4], CultureInfo.InvariantCulture), double.Parse(elements[5], CultureInfo.InvariantCulture), double.Parse(elements[6], CultureInfo.InvariantCulture), double.Parse(elements[7], CultureInfo.InvariantCulture), double.Parse(elements[8], CultureInfo.InvariantCulture), double.Parse(elements[9], CultureInfo.InvariantCulture), double.Parse(elements[10], CultureInfo.InvariantCulture), double.Parse(elements[11], CultureInfo.InvariantCulture), bool.Parse(elements[12]), elements[13].ParseEnum<TechLineType>(), bool.Parse(elements[14]), bool.Parse(elements[15]), bool.Parse(elements[16])); + + TechLines.Add(tbline); + } catch (Exception ex) { + + // Indicate problems + returnStatus = false; + } + } else { + firstline = false; + } + } + } + } else { + returnStatus = false; + } + + return returnStatus; + } + + // Public Properties - Outputs Of Class + public double CValueVariation + { + get { + double a; + + a = TechLines.Where(x => x.Units.ToLower() == "fraction").Sum(s => s.C); + + return a; + } + } + + public double CValueVariationKW + { + get { + double a; + + a = TechLines.Where(x => x.Units.ToLower() == "kw").Sum(s => s.C); + + return a; + } + } + + public double HValueVariation + { + get { + + // Dim a,b As double + return TechLines.Where(x => x.Units == "fraction").Sum(s => s.H); + } + } + + public double HValueVariationKW + { + get { + return TechLines.Where(x => x.Units.ToLower() == "kw").Sum(s => s.H); + } + } + + public double VCValueVariation + { + get { + return TechLines.Where(x => x.Units.ToLower() == "fraction").Sum(s => s.VC); // - VCValueVariationKW + } + } + + public double VCValueVariationKW + { + get { + return TechLines.Where(x => x.Units.ToLower() == "kw").Sum(s => s.VC); + } + } + + public double VHValueVariation + { + get { + // Dim a,b As double + + return TechLines.Where(x => x.Units.ToLower() == "fraction").Sum(s => s.VH); + } + } + + public double VHValueVariationKW + { + get { + return TechLines.Where(x => x.Units.ToLower() == "kw").Sum(s => s.VH); + } + } + + public double VVValueVariation + { + get { + return TechLines.Where(x => x.Units.ToLower() == "fraction").Sum(s => s.VV); + } + } + + public double VVValueVariationKW + { + get { + return TechLines.Where(x => x.Units.ToLower() == "kw").Sum(s => s.VV); // - VVValueVariationKW + } + } + + // Member Management + public bool Add(ITechListBenefitLine item, ref string feedback) + { + var initialCount = TechLines.Count; + + if (TechLines.Any(w => w.Category == item.Category && w.BenefitName == item.BenefitName)) { + // Failure + feedback = "Item already exists."; + return false; + } + + + try { + TechLines.Add(item); + + if (TechLines.Count == initialCount + 1) { + + // Success + feedback = "OK"; + _dirty = true; + return true; + } else { + + // Failure + feedback = "The system was unable to add the new tech benefit list item."; + return false; + } + } catch (Exception ex) { + feedback = "The system threw an exception and was unable to add the new tech benefit list item."; + return false; + } + } + + public void Clear() + { + if (TechLines.Count > 0) + _dirty = true; + + TechLines.Clear(); + } + + public bool Delete(ITechListBenefitLine item, ref string feedback) + { + var currentCount = TechLines.Count; + + if ((TechLines.Count(c => c.Category == item.Category && c.BenefitName == item.BenefitName) == 1)) { + try { + TechLines.RemoveAt(TechLines.FindIndex(c => c.Category == item.Category && c.BenefitName == item.BenefitName)); + + if (TechLines.Count == currentCount - 1) { + // This succeeded + _dirty = true; + return true; + } else { + // No Exception, but this failed for some reason. + feedback = "The system was unable to remove the item from the list."; + return false; + } + } catch (Exception ex) { + feedback = "An exception occured, the removal failed."; + return false; + } + } else { + feedback = "the item was not found in the list."; + return false; + } + } + + public bool Modify(ITechListBenefitLine originalItem, ITechListBenefitLine newItem, ref string feedback) + { + var fi = TechLines.Find(f => f.Category == originalItem.Category && f.BenefitName == originalItem.BenefitName); + + if (fi != null) { + try { + var originalUnits = fi.Units; + fi.CloneFrom(newItem); + + // The lines below are to assist in testing. The KW units are being excluded, but for benchmarking against the spreadsheet model + // Two KW entries are left in. There is no provision for adding KW units in so we check if the original entry was KW and + // force it back to KW if it was already so. There shoud be no need to remove this as newly created lists will not match this + // Phenomenon. + if ((originalUnits.ToLower() == "kw")) { + fi.Units = originalUnits; + newItem.Units = originalUnits; + } + + if (newItem == fi) { + // This succeeded + _dirty = true; + return true; + } else { + // No Exception, but this failed for some reason. + feedback = "The system was unable to remove the item from the list."; + return false; + } + } catch (Exception ex) { + feedback = "An exception occured, the update failed."; + return false; + } + } else { + feedback = "the item was not found so cannot be modified."; + return false; + } + } + + + private void SetDefaults() + { + ITechListBenefitLine techLine1 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine1; + withBlock.Category = "Cooling"; + withBlock.BenefitName = "Separate air distribution ducts"; + withBlock.LowFloorH = 0; + withBlock.LowFloorC = 0.04; + withBlock.LowFloorV = 0.04; + withBlock.SemiLowFloorH = 0; + withBlock.SemiLowFloorC = 0.04; + withBlock.SemiLowFloorV = 0.04; + withBlock.RaisedFloorH = 0; + withBlock.RaisedFloorC = 0.04; + withBlock.RaisedFloorV = 0.04; + withBlock.ActiveVH = false; + withBlock.ActiveVV = false; + withBlock.ActiveVC = true; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + } + + ITechListBenefitLine techLine2 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine2; + withBlock.Category = "Heating"; + withBlock.BenefitName = "Adjustable auxiliary heater"; + withBlock.LowFloorH = 0.02; + withBlock.LowFloorC = 0; + withBlock.LowFloorV = 0.02; + withBlock.SemiLowFloorH = 0.02; + withBlock.SemiLowFloorC = 0; + withBlock.SemiLowFloorV = 0.02; + withBlock.RaisedFloorH = 0.02; + withBlock.RaisedFloorC = 0; + withBlock.RaisedFloorV = 0.02; + withBlock.ActiveVH = true; + withBlock.ActiveVV = false; + withBlock.ActiveVC = false; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + } + + ITechListBenefitLine techLine3 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine3; + withBlock.Category = "Heating"; + withBlock.BenefitName = "Adjustable coolant thermostat"; + withBlock.LowFloorH = 0.02; + withBlock.LowFloorC = 0; + withBlock.LowFloorV = 0.02; + withBlock.SemiLowFloorH = 0.02; + withBlock.SemiLowFloorC = 0; + withBlock.SemiLowFloorV = 0.02; + withBlock.RaisedFloorH = 0.02; + withBlock.RaisedFloorC = 0; + withBlock.RaisedFloorV = 0.02; + withBlock.ActiveVH = true; + withBlock.ActiveVV = false; + withBlock.ActiveVC = false; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + } + + ITechListBenefitLine techLine4 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine4; + withBlock.Category = "Heating"; + withBlock.BenefitName = "Engine waste gas heat exchanger"; + withBlock.LowFloorH = 0.04; + withBlock.LowFloorC = 0; + withBlock.LowFloorV = 0.04; + withBlock.SemiLowFloorH = 0; + withBlock.SemiLowFloorC = 0; + withBlock.SemiLowFloorV = 0; + withBlock.RaisedFloorH = 0; + withBlock.RaisedFloorC = 0; + withBlock.RaisedFloorV = 0; + withBlock.ActiveVH = true; + withBlock.ActiveVV = false; + withBlock.ActiveVC = false; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + } + + ITechListBenefitLine techLine5 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine5; + withBlock.Category = "Heating"; + withBlock.BenefitName = "Heat pump systems"; + withBlock.LowFloorH = 0.06; + withBlock.LowFloorC = 0; + withBlock.LowFloorV = 0.06; + withBlock.SemiLowFloorH = 0.04; + withBlock.SemiLowFloorC = 0; + withBlock.SemiLowFloorV = 0.04; + withBlock.RaisedFloorH = 0.04; + withBlock.RaisedFloorC = 0; + withBlock.RaisedFloorV = 0.04; + withBlock.ActiveVH = true; + withBlock.ActiveVV = false; + withBlock.ActiveVC = false; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + } + + ITechListBenefitLine techLine6 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine6; + withBlock.Category = "Insulation"; + withBlock.BenefitName = "Double-glazing"; + withBlock.LowFloorH = 0.04; + withBlock.LowFloorC = 0.04; + withBlock.LowFloorV = 0.04; + withBlock.SemiLowFloorH = 0.04; + withBlock.SemiLowFloorC = 0.04; + withBlock.SemiLowFloorV = 0.04; + withBlock.RaisedFloorH = 0.04; + withBlock.RaisedFloorC = 0.04; + withBlock.RaisedFloorV = 0.04; + withBlock.ActiveVH = true; + withBlock.ActiveVV = true; + withBlock.ActiveVC = true; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + } + + ITechListBenefitLine techLine7 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine7; + withBlock.Category = "Insulation"; + withBlock.BenefitName = "Tinted windows"; + withBlock.LowFloorH = 0; + withBlock.LowFloorC = 0; + withBlock.LowFloorV = 0; + withBlock.SemiLowFloorH = 0; + withBlock.SemiLowFloorC = 0; + withBlock.SemiLowFloorV = 0; + withBlock.RaisedFloorH = 0; + withBlock.RaisedFloorC = 0; + withBlock.RaisedFloorV = 0; + withBlock.ActiveVH = false; + withBlock.ActiveVV = false; + withBlock.ActiveVC = false; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + } + + ITechListBenefitLine techLine8 = new TechListBenefitLine(_ssmInputs); + { + var withBlock = techLine8; + withBlock.Category = "Ventilation"; + withBlock.BenefitName = "Fan control strategy (serial/parallel)"; + withBlock.LowFloorH = 0.02; + withBlock.LowFloorC = 0.02; + withBlock.LowFloorV = 0.02; + withBlock.SemiLowFloorH = 0.02; + withBlock.SemiLowFloorC = 0.02; + withBlock.SemiLowFloorV = 0.02; + withBlock.RaisedFloorH = 0.02; + withBlock.RaisedFloorC = 0.02; + withBlock.RaisedFloorV = 0.02; + withBlock.ActiveVH = true; + withBlock.ActiveVV = true; + withBlock.ActiveVC = true; + withBlock.OnVehicle = false; + withBlock.Units = "fraction"; + withBlock.LineType = TechLineType.HVCActiveSelection; + } + + var feedback = string.Empty; + Add(techLine1, ref feedback); + Add(techLine2, ref feedback); + Add(techLine3, ref feedback); + Add(techLine4, ref feedback); + Add(techLine5, ref feedback); + Add(techLine6, ref feedback); + Add(techLine7, ref feedback); + Add(techLine8, ref feedback); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/TechListBenefitLine.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/TechListBenefitLine.cs new file mode 100644 index 0000000000000000000000000000000000000000..96ec989bc242e01f083d3f5a393a1bb5b89f3dd5 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/HVAC/TechListBenefitLine.cs @@ -0,0 +1,300 @@ +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +{ + public enum PowerType + { + Mechanical, + Electrical + } + + // Used by SSMTOOL Class, refer to original spreadsheet model + // Or PDF Model Document which articulates the same spreadsheet functionality + // But within the context of the Vecto interpretation of the same. + + public class TechListBenefitLine : ITechListBenefitLine + { + private float _h, _vh, _vv, _vc, _c; + public ISSMGenInputs inputSheet; + + public string Units { get; set; } + public string Category { get; set; } + public string BenefitName { get; set; } + public double LowFloorH { get; set; } = new double(); + public double LowFloorV { get; set; } = new double(); + public double LowFloorC { get; set; } = new double(); + + public double SemiLowFloorH { get; set; } = new double(); + public double SemiLowFloorV { get; set; } = new double(); + public double SemiLowFloorC { get; set; } = new double(); + + public double RaisedFloorH { get; set; } = new double(); + public double RaisedFloorV { get; set; } = new double(); + public double RaisedFloorC { get; set; } = new double(); + + public bool OnVehicle { get; set; } + public bool ActiveVH { get; set; } + public bool ActiveVV { get; set; } + public bool ActiveVC { get; set; } + public TechLineType LineType { get; set; } + + public double H + { + get { + double returnValue = 0; + + // =IF($M49=0,0,IF(AND($M49=1,'INPUT & RESULTS SHEET'!$D$6="low floor"),'TECH LIST INPUT'!D49, IF(AND($M49=1,'INPUT & RESULTS SHEET'!$D$6="semi low floor"),'TECH LIST INPUT'!G49,'TECH LIST INPUT'!J49))) + if (!OnVehicle) + return returnValue; + + switch (inputSheet.BP_BusFloorType) { + case "low floor": { + returnValue = LowFloorH; + break; + } + + case "semi low floor": { + returnValue = SemiLowFloorH; + break; + } + + case "raised floor": { + returnValue = RaisedFloorH; + break; + } + } + + return returnValue; + } + } + + public double VH + { + get { + double floorValue = 0; + + if (!OnVehicle) + return floorValue; + + // Get floor value + switch (inputSheet.BP_BusFloorType) { + case "low floor": { + floorValue = LowFloorV; + break; + } + + case "semi low floor": { + floorValue = SemiLowFloorV; + break; + } + + case "raised floor": { + floorValue = RaisedFloorV; + break; + } + } + + // Active + if (ActiveVH) + return floorValue; + else + return 0; + } + } + + public double VV + { + get { + double floorValue = 0; + + if (!OnVehicle) + return floorValue; + + // Get floor value + switch (inputSheet.BP_BusFloorType) { + case "low floor": { + floorValue = LowFloorV; + break; + } + + case "semi low floor": { + floorValue = SemiLowFloorV; + break; + } + + case "raised floor": { + floorValue = RaisedFloorV; + break; + } + } + + // Active + if (ActiveVV) + return floorValue; + else + return 0; + } + } + + public double VC + { + get { + double floorValue = 0; + + if (!OnVehicle) + return floorValue; + + // Get floor value + switch (inputSheet.BP_BusFloorType) { + case "low floor": { + floorValue = LowFloorV; + break; + } + + case "semi low floor": { + floorValue = SemiLowFloorV; + break; + } + + case "raised floor": { + floorValue = RaisedFloorV; + break; + } + } + + // Active + if (ActiveVC) + return floorValue; + else + return 0; + } + } + + public double C + { + get { + double returnValue = 0; + + if (!OnVehicle) + return returnValue; + + switch (inputSheet.BP_BusFloorType) { + case "low floor": { + returnValue = LowFloorC; + break; + } + + case "semi low floor": { + returnValue = SemiLowFloorC; + break; + } + + case "raised floor": { + returnValue = RaisedFloorC; + break; + } + } + + return returnValue; + } + } + + public TechListBenefitLine() { } + + public TechListBenefitLine(ISSMGenInputs geninputs) + { + this.inputSheet = geninputs; + } + + public TechListBenefitLine( + ISSMGenInputs geninputs, string units, string category, string benefitName, double lowFloorH, double lowFloorV, + double lowFloorC, double semiLowFloorH, double semiLowFloorV, double semiLowFloorC, double raisedFloorH, + double raisedFloorV, double raisedFloorC, bool onVehicle, TechLineType lineType, bool activeVH, bool activeVV, + bool activeVC + ) + { + inputSheet = geninputs; + Units = units; + Category = category; + BenefitName = benefitName; + LowFloorH = lowFloorH; + LowFloorV = lowFloorV; + LowFloorC = lowFloorC; + SemiLowFloorH = semiLowFloorH; + SemiLowFloorV = semiLowFloorV; + SemiLowFloorC = semiLowFloorC; + RaisedFloorH = raisedFloorH; + RaisedFloorV = raisedFloorV; + RaisedFloorC = raisedFloorC; + OnVehicle = onVehicle; + LineType = lineType; + ActiveVH = activeVH; + ActiveVV = activeVV; + ActiveVC = activeVC; + } + + // Operator Overloads + public static bool operator ==(TechListBenefitLine op1, TechListBenefitLine op2) + { + if ((op1.Category == op2.Category && op1.BenefitName == op2.BenefitName && op1.ActiveVC == op2.ActiveVC && + op1.ActiveVH == op2.ActiveVH && op1.ActiveVV == op2.ActiveVV && op1.LineType == op2.LineType && + op1.LowFloorC == op2.LowFloorC && op1.LowFloorV == op2.LowFloorV && op1.LowFloorH == op2.LowFloorH && + op1.SemiLowFloorC == op2.SemiLowFloorC && op1.SemiLowFloorH == op2.SemiLowFloorH && + op1.SemiLowFloorV == op2.SemiLowFloorV && op1.RaisedFloorC == op2.RaisedFloorC && + op1.RaisedFloorH == op2.RaisedFloorH && op1.RaisedFloorV == op2.RaisedFloorV && op1.OnVehicle == op2.OnVehicle && + op1.Units == op2.Units)) { + return true; + } else { + return false; + } + } + + public static bool operator !=(TechListBenefitLine op1, TechListBenefitLine op2) + { + if ((op1.Category != op2.Category || op1.BenefitName != op2.BenefitName || op1.ActiveVC != op2.ActiveVC || + op1.ActiveVH != op2.ActiveVH || op1.ActiveVV != op2.ActiveVV || op1.LineType != op2.LineType || + op1.LowFloorC != op2.LowFloorC || op1.LowFloorV != op2.LowFloorV || op1.LowFloorH != op2.LowFloorH || + op1.SemiLowFloorC != op2.SemiLowFloorC || op1.SemiLowFloorH != op2.SemiLowFloorH || + op1.SemiLowFloorV != op2.SemiLowFloorV || op1.RaisedFloorC != op2.RaisedFloorC || + op1.RaisedFloorH != op2.RaisedFloorH || op1.RaisedFloorV != op2.RaisedFloorV || op1.OnVehicle != op2.OnVehicle || + op1.Units != op2.Units)) + return true; + else + return false; + } + + public void CloneFrom(ITechListBenefitLine source) + { + this.Units = source.Units; + this.Category = source.Category; + this.BenefitName = source.BenefitName; + this.LowFloorH = source.LowFloorH; + this.LowFloorV = source.LowFloorV; + this.LowFloorC = source.LowFloorC; + + this.SemiLowFloorH = source.SemiLowFloorH; + this.SemiLowFloorV = source.SemiLowFloorV; + this.SemiLowFloorC = source.SemiLowFloorC; + + this.RaisedFloorH = source.RaisedFloorH; + this.RaisedFloorV = source.RaisedFloorV; + this.RaisedFloorC = source.RaisedFloorC; + + this.OnVehicle = source.OnVehicle; + this.ActiveVH = source.ActiveVH; + this.ActiveVV = source.ActiveVV; + this.ActiveVC = source.ActiveVC; + this.LineType = source.LineType; + } + + public bool IsEqualTo(ITechListBenefitLine source) + { + var mySource = (TechListBenefitLine)source; + if (object.ReferenceEquals(mySource, null)) { + return false; + } + + return this == mySource; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M06Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M06Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..34971ea4993ea7422f9470c2ca0c5ca72a086a90 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M06Impl.cs @@ -0,0 +1,171 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M06Impl : AbstractModule, IM6 + { + protected bool _overrunFlag; + protected bool _smartElecAndPneumaticsCompressorFlag; + protected Watt _smartElecAndPneumaticAltPowerGenAtCrank; + protected Watt _smartElecAndPneumaticAirCompPowerGenAtCrank; + protected Watt _smartElecOnlyAltPowerGenAtCrank; + protected Watt _averagePowerDemandAtCrankFromPneumatics; + protected Watt _smartPneumaticOnlyAirCompPowerGenAtCrank; + protected Watt _avgPowerDemandAtCrankFromElectricsIncHVAC; + protected bool _smartPneumaticsOnlyCompressorFlag; + + protected IM1_AverageHVACLoadDemand _m1; + protected IM2_AverageElectricalLoadDemand _m2; + protected IM3_AveragePneumaticLoadDemand _m3; + protected IM4_AirCompressor _m4; + protected IM5_SmartAlternatorSetGeneration _m5; + protected ISignals _signals; + + public M06Impl( + IM1_AverageHVACLoadDemand m1, IM2_AverageElectricalLoadDemand m2, IM3_AveragePneumaticLoadDemand m3, + IM4_AirCompressor m4, IM5_SmartAlternatorSetGeneration m5, ISignals signals) + { + _m1 = m1; + _m2 = m2; + _m3 = m3; + _m4 = m4; + _m5 = m5; + _signals = signals; + } + + protected override void DoCalculate() + { + var sum1 = _m1.AveragePowerDemandAtCrankFromHVACElectricsWatts() + _m2.GetAveragePowerAtCrankFromElectrics(); + var sw1 = _signals.SmartElectrics ? _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts() : sum1; + var sum2 = _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts() + sw1 + + _m3.GetAveragePowerDemandAtCrankFromPneumatics(); + var sum3 = _signals.EngineMotoringPower + _signals.InternalEnginePower + sum2; + var vc0 = sum3 <= 0; + + var sum4 = sum3 - sw1 - _m3.GetAveragePowerDemandAtCrankFromPneumatics() + _m4.GetPowerCompressorOff(); + var sum5 = vc0 ? sum4 : 0.SI<Watt>(); + var sum10 = _m5.AlternatorsGenerationPowerAtCrankOverrunWatts() * -1.0; + var max1 = sum5 > sum10 ? sum5 : sum10; + var sum11 = sum5 - max1; + var sum12 = _m4.GetPowerDifference() + sum11; + var vc2 = sum12 < 0 || sum12.IsEqual(0); + + var vc1 = sum12 > 0; + var sum14 = vc1 ? _m4.GetPowerCompressorOff() : 0.SI<Watt>(); + var sum15 = vc2 ? _m4.GetPowerCompressorOn() * _signals.PneumaticOverrunUtilisation : 0.SI<Watt>(); + var sum16 = sum14 + sum15; + + var sum6 = sum4 - _m4.GetPowerCompressorOff() + _m3.GetAveragePowerDemandAtCrankFromPneumatics(); + var sum7 = vc0 ? sum6 : 0.SI<Watt>(); + var max2 = sum7 > sum10 ? sum7 : sum10; + + var sum8 = sum4 + sw1; + var sum9 = vc0 ? sum8 : 0.SI<Watt>(); + var sum13 = sum9 + _m4.GetPowerDifference(); + var vc3 = sum13 > 0; + var vc4 = sum13 < 0 || sum13.IsEqual(0); + var sum17 = vc3 ? _m4.GetPowerCompressorOff() : 0.SI<Watt>(); + var sum18 = vc4 ? _m4.GetPowerCompressorOn() * _signals.PneumaticOverrunUtilisation : 0.SI<Watt>(); + var sum19 = sum17 + sum18; + + _overrunFlag = vc0; + _smartElecAndPneumaticsCompressorFlag = vc2; + _smartElecAndPneumaticAltPowerGenAtCrank = max1 * -1; + _smartElecAndPneumaticAirCompPowerGenAtCrank = sum16; + _smartElecOnlyAltPowerGenAtCrank = max2 * -1; + _averagePowerDemandAtCrankFromPneumatics = _m3.GetAveragePowerDemandAtCrankFromPneumatics(); + _smartPneumaticOnlyAirCompPowerGenAtCrank = sum19; + _avgPowerDemandAtCrankFromElectricsIncHVAC = sum1; + _smartPneumaticsOnlyCompressorFlag = vc4; + } + + #region Implementation of IM6 + + public bool OverrunFlag + { + get { + if (!calculationValid) { + Calculate(); + } + return _overrunFlag; + } + } + + public bool SmartElecAndPneumaticsCompressorFlag + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElecAndPneumaticsCompressorFlag; } + } + + public Watt SmartElecAndPneumaticAltPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElecAndPneumaticAltPowerGenAtCrank; } + } + + public Watt SmartElecAndPneumaticAirCompPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElecAndPneumaticAirCompPowerGenAtCrank; } + } + + public Watt SmartElecOnlyAltPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElecOnlyAltPowerGenAtCrank; } + } + + public Watt AveragePowerDemandAtCrankFromPneumatics + { + get { + if (!calculationValid) { + Calculate(); + } + return _averagePowerDemandAtCrankFromPneumatics; } + } + + public Watt SmartPneumaticOnlyAirCompPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartPneumaticOnlyAirCompPowerGenAtCrank; } + } + + public Watt AvgPowerDemandAtCrankFromElectricsIncHVAC + { + get { + if (!calculationValid) { + Calculate(); + } + return _avgPowerDemandAtCrankFromElectricsIncHVAC; } + } + + public bool SmartPneumaticsOnlyCompressorFlag + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartPneumaticsOnlyCompressorFlag; } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M07Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M07Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..c0ef9161e5d4f1be89ac3c253d5b9b4596bc5b37 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M07Impl.cs @@ -0,0 +1,94 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M07Impl : AbstractModule, IM7 + { + protected Watt _smartElectricalAndPneumaticAuxAltPowerGenAtCrank; + protected Watt _smartElectricalAndPneumaticAuxAirCompPowerGenAtCrank; + protected Watt _smartElectricalOnlyAuxAltPowerGenAtCrank; + protected Watt _smartPneumaticOnlyAuxAirCompPowerGenAtCrank; + + protected IM5_SmartAlternatorSetGeneration _m5; + protected IM6 _m6; + protected ISignals _signals; + + public M07Impl(IM5_SmartAlternatorSetGeneration m5, IM6 m6, ISignals signals) + { + _m5 = m5; + _m6 = m6; + _signals = signals; + } + + protected override void DoCalculate() + { + var idle = _signals.EngineSpeed <= _signals.EngineIdleSpeed && + (!_signals.ClutchEngaged || _signals.InNeutral); + + var sw1 = idle + ? _m5.AlternatorsGenerationPowerAtCrankIdleWatts() + : _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts(); + + var c1 = _m6.OverrunFlag && _signals.ClutchEngaged && _signals.InNeutral == false; + var sw2 = c1 ? _m6.SmartElecAndPneumaticAltPowerGenAtCrank : sw1; + + var sw3 = c1 ? _m6.SmartElecAndPneumaticAirCompPowerGenAtCrank : _m6.AveragePowerDemandAtCrankFromPneumatics; + + var sw4 = c1 ? _m6.SmartElecOnlyAltPowerGenAtCrank : sw1; + + var sw5 = c1 ? _m6.SmartPneumaticOnlyAirCompPowerGenAtCrank : _m6.AveragePowerDemandAtCrankFromPneumatics; + + _smartElectricalAndPneumaticAuxAltPowerGenAtCrank = sw2; + _smartElectricalAndPneumaticAuxAirCompPowerGenAtCrank = sw3; + _smartElectricalOnlyAuxAltPowerGenAtCrank = sw4; + _smartPneumaticOnlyAuxAirCompPowerGenAtCrank = sw5; + } + + #region Implementation of IM7 + + public Watt SmartElectricalAndPneumaticAuxAltPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElectricalAndPneumaticAuxAltPowerGenAtCrank; + } + } + + public Watt SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElectricalAndPneumaticAuxAirCompPowerGenAtCrank; + } + } + + public Watt SmartElectricalOnlyAuxAltPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElectricalOnlyAuxAltPowerGenAtCrank; + } + } + + public Watt SmartPneumaticOnlyAuxAirCompPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartPneumaticOnlyAuxAirCompPowerGenAtCrank; + } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M08Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M08Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..91450b4caade4304891a50eb1687dd6a7582c34c --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M08Impl.cs @@ -0,0 +1,83 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M08Impl : AbstractModule, IM8 + { + protected Watt _auxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries; + protected Watt _smartElectricalAlternatorPowerGenAtCrank; + protected bool _compressorFlag; + + protected IM1_AverageHVACLoadDemand _m1; + protected IM6 _m6; + protected IM7 _m7; + protected ISignals _signals; + + public M08Impl(IM1_AverageHVACLoadDemand m1, IM6 m6, IM7 m7, ISignals signals) + { + _m1 = m1; + _m6 = m6; + _m7 = m7; + _signals = signals; + } + + + protected override void DoCalculate() + { + var sum1 = _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank + + _m7.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank; + var sum2 = _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank + _m6.AveragePowerDemandAtCrankFromPneumatics; + var sum3 = _m7.SmartPneumaticOnlyAuxAirCompPowerGenAtCrank + _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC; + var sum4 = _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC + _m6.AveragePowerDemandAtCrankFromPneumatics; + var sw1 = _signals.SmartPneumatics ? sum1 : sum2; + var sw2 = _signals.SmartPneumatics ? sum3 : sum4; + var sw5 = _signals.SmartElectrics ? sw1 : sw2; + var sw6 = !_signals.EngineStopped; + var sum5 = _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts() + sw5; + var sum6 = sw6 ? sum5 : 0.SI<Watt>(); + + var sw3 = _signals.SmartPneumatics ? _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank : + _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank; + + var sw4 = _signals.SmartElectrics ? _m6.SmartElecAndPneumaticsCompressorFlag : _m6.SmartPneumaticsOnlyCompressorFlag; + + _auxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries = sum6; + _smartElectricalAlternatorPowerGenAtCrank = sw3; + _compressorFlag = sw4; + } + + #region Implementation of IM8 + + public Watt AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries + { + get { + if (!calculationValid) { + Calculate(); + } + return _auxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries; } + } + + public Watt SmartElectricalAlternatorPowerGenAtCrank + { + get { + if (!calculationValid) { + Calculate(); + } + return _smartElectricalAlternatorPowerGenAtCrank; } + } + + public bool CompressorFlag + { + get { + if (!calculationValid) { + Calculate(); + } + return _compressorFlag; } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M09Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M09Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..3e169e84c023292e5caf76b6f9d72e6d91489c20 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M09Impl.cs @@ -0,0 +1,136 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M09Impl : AbstractModule, IM9 + { + + #region "Aggregates" + + //'AG1 + protected NormLiter _LitresOfAirCompressorOnContinuallyAggregate; + + //'AG2 + protected NormLiter _LitresOfAirCompressorOnOnlyInOverrunAggregate; + + //'AG3 + protected Kilogram _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate; + + //'AG4 + protected Kilogram _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate; + + #endregion + + protected IM1_AverageHVACLoadDemand M1; + protected IM4_AirCompressor M4; + protected IM6 M6; + protected IM8 M8; + protected IFuelConsumptionMap FMAP; + protected IPneumaticsAuxilliariesConfig PSAC; + protected ISignals Signals; + + public M09Impl(IM1_AverageHVACLoadDemand m1, IM4_AirCompressor m4, IM6 m6, IM8 m8, IFuelConsumptionMap fmap, IPneumaticsAuxilliariesConfig psac, ISignals signals) + { + M1 = m1; + M4 = m4; + M6 = m6; + M8 = m8; + FMAP = fmap; + PSAC = psac; + Signals = signals; + ClearAggregates(); + } + + + #region Implementation of IAuxiliaryEvent + + public event AuxiliaryEventEventHandler AuxiliaryEvent; + + #endregion + + #region Implementation of IM9 + + public void ClearAggregates() + { + _LitresOfAirCompressorOnContinuallyAggregate = 0.SI<NormLiter>(); + _LitresOfAirCompressorOnOnlyInOverrunAggregate = 0.SI<NormLiter>(); + _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate = 0.SI<Kilogram>(); + _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate = 0.SI<Kilogram>(); + } + + protected PerSecond S0(PerSecond rpm) + { + if (rpm < 1) { + rpm = 1.RPMtoRad(); + } + + return rpm; + } + + public void CycleStep(Second stepTimeInSeconds) + { + if (Signals.EngineStopped) { + return; + } + + var s9 = M6.OverrunFlag && M8.CompressorFlag ? M4.GetFlowRate() : 0.SI<NormLiterPerSecond>(); + var s13 = Signals.ClutchEngaged && !(Signals.InNeutral) ? s9 : 0.SI<NormLiterPerSecond>(); + var s10 = s13 * PSAC.OverrunUtilisationForCompressionFraction; + + if (S0(Signals.EngineSpeed).IsEqual(0)) { + throw new DivideByZeroException("Engine speed is zero and cannot be used as a divisor."); + } + + var s1 = M6.AvgPowerDemandAtCrankFromElectricsIncHVAC + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts(); + var s2 = M4.GetPowerCompressorOn() / S0(Signals.EngineSpeed); + var s3 = M4.GetPowerCompressorOff() / S0(Signals.EngineSpeed); + var s4 = s1 / S0(Signals.EngineSpeed); + var s14 = Signals.EngineDrivelineTorque + + Signals.PreExistingAuxPower / S0(Signals.EngineSpeed); + var s5 = s2 + s14; + var s6 = s14 + s3; + var s7 = s4 + s5; + var s8 = s4 + s6; + + var int1 = FMAP.GetFuelConsumption(s7, Signals.EngineSpeed); + int1 = int1 > 0 && !double.IsNaN(int1.Value()) ? int1 : 0.SI<KilogramPerSecond>(); + var s11 = int1; + + var int2 = FMAP.GetFuelConsumption(s8, Signals.EngineSpeed); + int2 = int2 > 0 && !double.IsNaN(int2.Value()) ? int2 : 0.SI<KilogramPerSecond>(); + var s12 = int2; + + _LitresOfAirCompressorOnContinuallyAggregate += M4.GetFlowRate() * stepTimeInSeconds; + _LitresOfAirCompressorOnOnlyInOverrunAggregate += s10 * stepTimeInSeconds; + _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate += s11 * stepTimeInSeconds; + _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate += s12 * stepTimeInSeconds; + } + + public NormLiter LitresOfAirCompressorOnContinually + { + get { return _LitresOfAirCompressorOnContinuallyAggregate; } + } + + public NormLiter LitresOfAirCompressorOnOnlyInOverrun + { + get { return _LitresOfAirCompressorOnOnlyInOverrunAggregate; } + } + + public Kilogram TotalCycleFuelConsumptionCompressorOnContinuously + { + get { return _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate; } + } + + public Kilogram TotalCycleFuelConsumptionCompressorOffContinuously + { + get { return _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate; } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M10Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M10Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..34568bcd74bfe2360cbd5fda6775f90afe9bf7b2 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M10Impl.cs @@ -0,0 +1,105 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M10Impl : AbstractModule, IM10 + { + protected Kilogram _averageLoadsFuelConsumptionInterpolatedForPneumatics; + protected Kilogram _fuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand; + + protected IM3_AveragePneumaticLoadDemand M3; + + protected IM9 M9; + //'Not Currently used but there for ease of refactoring in future. + protected ISignals Signals; + + //'Aggregators + protected NormLiter _AverageAirConsumedLitre; + + + public M10Impl(IM3_AveragePneumaticLoadDemand m3, IM9 m9, ISignals signals) + { + M3 = m3; + M9 = m9; + Signals = signals; + _AverageAirConsumedLitre = 0.SI<NormLiter>(); + } + + protected enum InterpolationType + { + NonSmartPneumtaics, + SmartPneumtaics + } + + protected override void DoCalculate() + { + var intrp1 = Interpolate(InterpolationType.NonSmartPneumtaics); + var intrp2 = Interpolate(InterpolationType.SmartPneumtaics); + + _averageLoadsFuelConsumptionInterpolatedForPneumatics = intrp1; + _fuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand = intrp2; + } + + protected virtual Kilogram Interpolate(InterpolationType interpType) + { + var returnValue = 0.SI<Kilogram>(); + //' Dim x1,y1,x2,y2,x3,y3, xTA As Single + + var x1 = M9.LitresOfAirCompressorOnContinually; + var y1 = M9.TotalCycleFuelConsumptionCompressorOnContinuously; + var x2 = 0.SI<NormLiter>(); + var y2 = M9.TotalCycleFuelConsumptionCompressorOffContinuously; + var x3 = M9.LitresOfAirCompressorOnOnlyInOverrun; + var y3 = M9.TotalCycleFuelConsumptionCompressorOffContinuously; + + var xTA = _AverageAirConsumedLitre; //'m3.AverageAirConsumedPerSecondLitre + + switch (interpType) { + // 'Non-Smart Pneumatics ( OUT 1 ) + case InterpolationType.NonSmartPneumtaics: + //'returnValue = (y2 + (((y1 - y2) * xTA) / x1)) + returnValue = VectoMath.Interpolate(x1, x2, y1, y2, xTA); + break; + // 'Smart Pneumatics ( OUT 2 ) + case InterpolationType.SmartPneumtaics: + //'returnValue = (y3 + (((y1 - y3) / (x1 - x3)) * (xTA - x3))) + returnValue = VectoMath.Interpolate(x1, x3, y1, y3, xTA); + break; + default: throw new ArgumentOutOfRangeException(nameof(interpType), interpType, null); + } + + return returnValue; + } + + #region Implementation of IM10 + + public Kilogram AverageLoadsFuelConsumptionInterpolatedForPneumatics + { + get { + if (!calculationValid) { + Calculate(); + } + return _averageLoadsFuelConsumptionInterpolatedForPneumatics; } + } + + public Kilogram FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand + { + get { + if (!calculationValid) { + Calculate(); + } + return _fuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand; } + } + + public void CycleStep(Second stepTimeInSeconds) + { + _AverageAirConsumedLitre += double.IsNaN(M3.AverageAirConsumedPerSecondLitre().Value()) ? 0.SI<NormLiter>() : M3.AverageAirConsumedPerSecondLitre() * stepTimeInSeconds; + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M11Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M11Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..f33dbe68897263172842eccee98d79720138d505 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M11Impl.cs @@ -0,0 +1,151 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M11Impl : AbstractModule, IM11 + { + protected Joule _smartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly; + protected Joule _smartElectricalTotalCycleEletricalEnergyGenerated; + protected Joule _totalCycleElectricalDemand; + protected Kilogram _totalCycleFuelConsumptionSmartElectricalLoad; + protected Kilogram _totalCycleFuelConsumptionZeroElectricalLoad; + protected Joule _stopStartSensitiveTotalCycleElectricalDemand; + protected Kilogram _totalCycleFuelConsuptionAverageLoads; + +#region "Private Aggregates" + protected Joule AG1; + protected Joule AG2; + protected Joule AG3; + protected Kilogram AG4; + protected Kilogram AG5; + protected Joule AG6; + protected Kilogram AG7; +#endregion + + protected IM1_AverageHVACLoadDemand M1; + protected IM3_AveragePneumaticLoadDemand M3; + protected IM6 M6; + protected IM8 M8; + protected IFuelConsumptionMap FMAP; + protected ISignals Signals; + + public M11Impl(IM1_AverageHVACLoadDemand m1, IM3_AveragePneumaticLoadDemand m3, IM6 m6, IM8 m8, IFuelConsumptionMap fmap, ISignals signals) + { + M1 = m1; + M3 = m3; + M6 = m6; + M8 = m8; + FMAP = fmap; + Signals = signals; + ClearAggregates(); + } + + #region Implementation of IM11 + + public Joule SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly + { + get { return AG1; } + } + + public Joule SmartElectricalTotalCycleEletricalEnergyGenerated + { + get { return AG2; } + } + + public Joule TotalCycleElectricalDemand + { + get { return AG3; } + } + + public Kilogram TotalCycleFuelConsumptionSmartElectricalLoad + { + get { return AG4; } + } + + public Kilogram TotalCycleFuelConsumptionZeroElectricalLoad + { + get { return AG5; } + } + + public Joule StopStartSensitiveTotalCycleElectricalDemand + { + get { return AG6; } + } + + public Kilogram TotalCycleFuelConsuptionAverageLoads + { + get { return AG7; } + } + + public void ClearAggregates() + { + AG1 = 0.SI<Joule>(); + AG2 = 0.SI<Joule>(); + AG3 = 0.SI<Joule>(); + AG4 = 0.SI<Kilogram>(); + AG5 = 0.SI<Kilogram>(); + AG6 = 0.SI<Joule>(); + AG7 = 0.SI<Kilogram>(); + } + + protected PerSecond Sum0(PerSecond rpm) + { + if (rpm < 1) { + rpm = 1.RPMtoRad(); + } + + return rpm; // ' / RPM_to_RadiansPerSecond + } + + public void CycleStep(Second stepTimeInSeconds) + { + //'S/S Insensitive + AG3 += M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds; + + + if (Signals.EngineStopped) { + return; + } + + // 'S/S Sensitive + + var sum1 = M6.OverrunFlag ? M8.SmartElectricalAlternatorPowerGenAtCrank : 0.SI<Watt>(); + AG1 += (sum1 * stepTimeInSeconds); + AG2 += (M8.SmartElectricalAlternatorPowerGenAtCrank * stepTimeInSeconds); + + AG6 += (M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds); + + var sum2 = M3.GetAveragePowerDemandAtCrankFromPneumatics() + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts(); + var sum3 = M8.SmartElectricalAlternatorPowerGenAtCrank / Sum0(Signals.EngineSpeed); + var sum4 = sum2 / Sum0(Signals.EngineSpeed); + var sum9 = Signals.EngineDrivelineTorque + + (Signals.PreExistingAuxPower / Sum0(Signals.EngineSpeed)); + var sum5 = sum4 + sum9; + var sum6 = sum3 + sum5; + var intrp1 = FMAP.GetFuelConsumption(sum6, Signals.EngineSpeed); + intrp1 = !double.IsNaN(intrp1.Value()) && intrp1 > 0 ? intrp1 : 0.SI<KilogramPerSecond>(); + var sum7 = intrp1; + + var intrp2 = FMAP.GetFuelConsumption(sum5, Signals.EngineSpeed); + intrp2 = !double.IsNaN(intrp2.Value()) && intrp2 > 0 ? intrp2 : 0.SI<KilogramPerSecond>(); + var sum8 = intrp2; + + var sum10 = M6.AvgPowerDemandAtCrankFromElectricsIncHVAC / Sum0(Signals.EngineSpeed); + var sum11 = sum5 + sum10; + var intrp3 = FMAP.GetFuelConsumption(sum11, Signals.EngineSpeed); + intrp3 = !double.IsNaN(intrp3.Value()) && intrp3 > 0 ? intrp3 : 0.SI<KilogramPerSecond>(); + var sum12 = intrp3; + + //'MQ: No longer needed - already per Second 'These need to be divided by 3600 as the Fuel + // Map output is in Grams / Second. + AG4 += sum7 * stepTimeInSeconds; // '/ 3600 + AG5 += sum8 * stepTimeInSeconds; // ' / 3600 + AG7 += sum12 * stepTimeInSeconds; // '/ 3600 + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M12Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M12Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..560cad0a8d658a1073042cafb48d563d85cf8ca4 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M12Impl.cs @@ -0,0 +1,111 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M12Impl : AbstractModule, IM12 + { + protected IM11 M11; + protected IM10 M10; + protected ISignals Signals; + + protected Kilogram _fuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand; + protected Kilogram _baseFuelConsumptionWithTrueAuxiliaryLoads; + protected double _stopStartCorrection; + + public M12Impl(IM10 m10, IM11 m11, ISignals signals) + { + M10 = m10; + M11 = m11; + Signals = signals; + } + + private class Point + { + public Joule X; + public Kilogram Y; + } + + protected override void DoCalculate() + { + var p1 = new Point { X = 0.SI<Joule>(), Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad }; + var p2 = new Point { + X = M11.SmartElectricalTotalCycleEletricalEnergyGenerated * Signals.StoredEnergyEfficiency, + Y = M11.TotalCycleFuelConsumptionSmartElectricalLoad + }; + + var ip5X = M11.TotalCycleElectricalDemand; + var tanTetaP2 = ((p2.Y - p1.Y).Value() / (p2.X - p1.X).Value()); + var ip5yP2 = (p1.Y.Value() + (tanTetaP2 * ip5X.Value())).SI<Kilogram>(); + + var interp1 = double.IsNaN(ip5yP2.Value()) ? 0.SI<Kilogram>() : ip5yP2; + + interp1 = !double.IsNaN(interp1.Value()) && M11.StopStartSensitiveTotalCycleElectricalDemand > 0 + ? interp1 + : M11.TotalCycleFuelConsumptionZeroElectricalLoad; + + _fuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand = interp1; + + var p3 = new Point { + X = M11.StopStartSensitiveTotalCycleElectricalDemand, + Y = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics + }; + + var tanTetaP3 = (p3.Y - p1.Y).Value() / (p3.X - p1.X).Value(); + + var ip5yP3 = p1.Y + (tanTetaP3 * ip5X.Value()).SI<Kilogram>(); + + var interp2 = double.IsNaN(ip5yP3.Value()) ? 0.SI<Kilogram>() : ip5yP3; + + interp2 = !double.IsNaN(interp2.Value()) && M11.StopStartSensitiveTotalCycleElectricalDemand > 0 + ? interp2 + : M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics; + + _baseFuelConsumptionWithTrueAuxiliaryLoads = interp2; + + var stopStartCorrectionV = _baseFuelConsumptionWithTrueAuxiliaryLoads / + (M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics > 0 + ? M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics + : 1.SI<Kilogram>()); + + _stopStartCorrection = stopStartCorrectionV > 0 ? stopStartCorrectionV.Value() : 1; + } + + + #region Implementation of IM12 + + public Kilogram FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand + { + get { + if (!calculationValid) { + Calculate(); + } + return _fuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand; + } + } + + public Kilogram BaseFuelConsumptionWithTrueAuxiliaryLoads + { + get { + if (!calculationValid) { + Calculate(); + } + return _baseFuelConsumptionWithTrueAuxiliaryLoads; + } + } + + public double StopStartCorrection + { + get { + if (!calculationValid) { + Calculate(); + } + return _stopStartCorrection; + } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M13Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M13Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..36275ddaef53be1d82c11ca9f171d774d3d56f3f --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M13Impl.cs @@ -0,0 +1,59 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + + + public class M13Impl : AbstractModule, IM13 + { + protected IM10 M10; + protected IM11 M11; + protected IM12 M12; + protected ISignals Signals; + + private Kilogram _whtcTotalCycleFuelConsumptionGrams; + + public M13Impl(IM10 m10, IM11 m11, IM12 m12, ISignals signals) + { + M10 = m10; + M11 = m11; + M12 = m12; + Signals = signals; + } + + protected override void DoCalculate() + { + var sum1 = M11.TotalCycleFuelConsuptionAverageLoads * M12.StopStartCorrection; + var sum2 = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics * M12.StopStartCorrection; + var sum3 = M10.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand * M12.StopStartCorrection; + var sum4 = -M12.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand + sum1; + var sum5 = sum2 - sum3; + var sum6 = M12.BaseFuelConsumptionWithTrueAuxiliaryLoads - sum4; + var sum7 = M12.BaseFuelConsumptionWithTrueAuxiliaryLoads - sum5; + var sum8 = -sum4 + sum7; + var sw1 = Signals.SmartPneumatics? sum8: sum6; + var sw2 = Signals.SmartPneumatics ? sum3 : M12.BaseFuelConsumptionWithTrueAuxiliaryLoads; + var sw3 = Signals.SmartElectrics? sw1: sw2; + var sw4 = Signals.DeclarationMode ? Signals.WHTC : 1; + var sum9 = sw4 * sw3; + + _whtcTotalCycleFuelConsumptionGrams = sum9; + } + + #region Implementation of IM13 + + public Kilogram WHTCTotalCycleFuelConsumptionGrams + { + get { + if (!calculationValid) { + Calculate(); + } + return _whtcTotalCycleFuelConsumptionGrams; } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M14Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M14Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..0ed0e7d7104adc4e6ddeaa701355dd6333fa4caf --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/M14Impl.cs @@ -0,0 +1,68 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; + + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +{ + public class M14Impl : AbstractModule, IM14 + { + protected IM13 M13; + protected ISignals Signals; + protected IHVACConstants Constants; + protected ISSMTOOL SSM; + + protected Kilogram _totalCycleFcGrams; + protected Liter _totalCycleFcLitres; + + public M14Impl(IM13 m13, ISSMTOOL ssm, IHVACConstants hvacConstants, ISignals signals) + { + M13 = m13; + SSM = ssm; + Constants = hvacConstants; + Signals = signals; + } + + + protected override void DoCalculate() + { + var s1 = M13.WHTCTotalCycleFuelConsumptionGrams * Constants.DieselGCVJperGram; + var s2 = SSM.GenInputs.AH_FuelEnergyToHeatToCoolant * s1; + var s3 = s2 * SSM.GenInputs.AH_CoolantHeatTransferredToAirCabinHeater; + var s4 = s3 / Signals.CurrentCycleTimeInSeconds.SI<Second>(); + var s5 = Signals.CurrentCycleTimeInSeconds.SI<Second>(); // ' / 3600 + var s6 = (s5 * SSM.FuelPerHBaseAsjusted(s4.Value() / 1000).SI(Unit.SI.Liter.Per.Hour)).Cast<Liter>() * Constants.FuelDensity; + var s7 = M13.WHTCTotalCycleFuelConsumptionGrams + s6; + var s8 = (s7 / (Constants.FuelDensity)).Cast<Liter>(); + _totalCycleFcGrams = s7; + _totalCycleFcLitres = s8; + + } + + + #region Implementation of IM14 + + public Kilogram TotalCycleFCGrams + { + get { + if (!calculationValid) { + Calculate(); + } + return _totalCycleFcGrams; + } + } + + public Liter TotalCycleFCLitres + { + get { + if (!calculationValid) { + Calculate(); + } + return _totalCycleFcLitres; + } + } + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/CompressorMap.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/CompressorMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2502c4c62aea1877b1e2198a36cf36615cb937d8 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/CompressorMap.cs @@ -0,0 +1,270 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +{ + /// <summary> + /// ''' Compressor Flow Rate and Power Map + /// ''' </summary> + /// ''' <remarks></remarks> + public class CompressorMap : ICompressorMap, IAuxiliaryEvent + { + private readonly string filePath; + private double _averagePowerDemandPerCompressorUnitFlowRateLitresperSec; + private bool _MapBoundariesExceeded; + + /// <summary> + /// ''' Dictionary of values keyed by the rpm valaues in the csv file + /// ''' Values are held as a tuple as follows + /// ''' Item1 = flow rate + /// ''' Item2 - power [compressor on] + /// ''' Item3 - power [compressor off] + /// ''' </summary> + /// ''' <remarks></remarks> + private Dictionary<int, CompressorMapValues> map; + + // Returns the AveragePowerDemand per unit flow rate in seconds. + public double GetAveragePowerDemandPerCompressorUnitFlowRate() + { + return _averagePowerDemandPerCompressorUnitFlowRateLitresperSec; + } + + + /// <summary> + /// ''' Creates a new instance of the CompressorMap class + /// ''' </summary> + /// ''' <param name="path">full path to csv data file</param> + /// ''' <remarks></remarks> + public CompressorMap(string path) + { + filePath = path; + } + + /// <summary> + /// ''' Initilaises the map from the supplied csv data + /// ''' </summary> + /// ''' <remarks></remarks> + public bool Initialise() + { + if (File.Exists(filePath)) { + using (var sr = new StreamReader(filePath)) { + // get array of lines from csv + var lines = sr.ReadToEnd().Split(new[] { Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); + + // Must have at least 2 entries in map to make it usable [dont forget the header row] + if (lines.Length < 3) + throw new ArgumentException("Insufficient rows in csv to build a usable map"); + + map = new Dictionary<int, CompressorMapValues>(); + var firstline = true; + + foreach (var line in lines) { + if (!firstline) { + // split the line + var elements = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + // 4 entries per line required + if ((elements.Length != 4)) + throw new ArgumentException("Incorrect number of values in csv file"); + // add values to map + try { + map.Add(int.Parse(elements[0]), new CompressorMapValues(double.Parse(elements[1], CultureInfo.InvariantCulture).SI<NormLiterPerSecond>(), double.Parse(elements[2], CultureInfo.InvariantCulture).SI<Watt>(), double.Parse(elements[3], CultureInfo.InvariantCulture).SI<Watt>())); + } catch (FormatException fe) { + throw new InvalidCastException(string.Format("Compresor Map: line '{0}", line), fe); + } + } else + firstline = false; + } + } + + // ********************************************************************* + // Calculate the Average Power Demand Per Compressor Unit FlowRate / per second. + double powerDividedByFlowRateSum = 0; + foreach (var speed in map) + powerDividedByFlowRateSum += (speed.Value.PowerCompressorOn - speed.Value.PowerCompressorOff).Value() / (double)speed.Value.FlowRate.Value(); + + // Map in Litres Per Minute, so * 60 to get per second, calculated only once at initialisation. + _averagePowerDemandPerCompressorUnitFlowRateLitresperSec = (powerDividedByFlowRateSum / map.Count) * 60; + } else + throw new ArgumentException("supplied input file does not exist"); + + // If we get here then all should be well and we can return a True value of success. + return true; + } + + /// <summary> + /// ''' Returns compressor flow rate at the given rotation speed + /// ''' </summary> + /// ''' <param name="rpm">compressor rotation speed</param> + /// ''' <returns></returns> + /// ''' <remarks>Single</remarks> + public NormLiterPerSecond GetFlowRate(double rpm) + { + var val = InterpolatedTuple(rpm); + return val.FlowRate; + } + + /// <summary> + /// ''' Returns mechanical power at rpm when compressor is on + /// ''' </summary> + /// ''' <param name="rpm">compressor rotation speed</param> + /// ''' <returns></returns> + /// ''' <remarks>Single</remarks> + public Watt GetPowerCompressorOn(double rpm) + { + var val = InterpolatedTuple(rpm); + return val.PowerCompressorOn; + } + + /// <summary> + /// ''' Returns mechanical power at rpm when compressor is off + /// ''' </summary> + /// ''' <param name="rpm">compressor rotation speed</param> + /// ''' <returns></returns> + /// ''' <remarks>Single</remarks> + public Watt GetPowerCompressorOff(double rpm) + { + var val = InterpolatedTuple(rpm); + return val.PowerCompressorOff; + } + + /// <summary> + /// ''' Returns an instance of CompressorMapValues containing the values at a key, or interpolated values + /// ''' </summary> + /// ''' <returns>CompressorMapValues</returns> + /// ''' <remarks>Throws exception if rpm are outside map</remarks> + private CompressorMapValues InterpolatedTuple(double rpm) + { + // check the rpm is within the map + var min = map.Keys.Min(); + var max = map.Keys.Max(); + + if (rpm < min || rpm > max) { + if (!_MapBoundariesExceeded) { + OnMessage(this, string.Format("Compresser : limited RPM of '{2}' to extent of map - map range is {0} to {1}", min, max, rpm), AdvancedAuxiliaryMessageType.Warning); + _MapBoundariesExceeded = true; + } + + // Limiting as agreed. + if (rpm > max) + rpm = max; + if (rpm < min) + rpm = min; + } + + // If supplied rpm is a key, we can just return the appropriate tuple + var intRpm = System.Convert.ToInt32(rpm); + if (rpm.IsEqual(intRpm) && map.ContainsKey(intRpm)) + return map[intRpm]; + + // Not a key value, interpolate + // get the entries before and after the supplied rpm + var pre = (from m in map + where m.Key < rpm + select m).Last(); + var post = (from m in map + where m.Key > rpm + select m).First(); + + // get the delta values for rpm and the map values + double dRpm = post.Key - pre.Key; + var dFlowRate = post.Value.FlowRate - pre.Value.FlowRate; + var dPowerOn = post.Value.PowerCompressorOn - pre.Value.PowerCompressorOn; + var dPowerOff = post.Value.PowerCompressorOff - pre.Value.PowerCompressorOff; + + // calculate the slopes + var flowSlope = dFlowRate.Value() / dRpm; + var powerOnSlope = dPowerOn.Value() / dRpm; + var powerOffSlope = dPowerOff.Value() / dRpm; + + // calculate the new values + var flowRate = (((rpm - pre.Key) * flowSlope).SI<NormLiterPerSecond>() + pre.Value.FlowRate); + var powerCompressorOn = (((rpm - pre.Key) * powerOnSlope).SI<Watt>() + pre.Value.PowerCompressorOn); + var powerCompressorOff = (((rpm - pre.Key) * powerOffSlope).SI<Watt>() + pre.Value.PowerCompressorOff); + + // Build and return a new CompressorMapValues instance + return new CompressorMapValues(flowRate, powerCompressorOn, powerCompressorOff); + } + + /// <summary> + /// ''' Encapsulates compressor map values + /// ''' Flow Rate + /// ''' Power - Compressor On + /// ''' Power - Compressor Off + /// ''' </summary> + /// ''' <remarks></remarks> + /// ''' + + private struct CompressorMapValues + { + /// <summary> + /// ''' Compressor flowrate + /// ''' </summary> + /// ''' <remarks></remarks> + public readonly NormLiterPerSecond FlowRate; + + /// <summary> + /// ''' Power, compressor on + /// ''' </summary> + /// ''' <remarks></remarks> + public readonly Watt PowerCompressorOn; + + /// <summary> + /// ''' Power compressor off + /// ''' </summary> + /// ''' <remarks></remarks> + public readonly Watt PowerCompressorOff; + + /// <summary> + /// ''' Creates a new instance of CompressorMapValues + /// ''' </summary> + /// ''' <param name="flowRate">flow rate</param> + /// ''' <param name="powerCompressorOn">power - compressor on</param> + /// ''' <param name="powerCompressorOff">power - compressor off</param> + /// ''' <remarks></remarks> + public CompressorMapValues(NormLiterPerSecond flowRate, Watt powerCompressorOn, Watt powerCompressorOff) + { + this.FlowRate = flowRate; + this.PowerCompressorOn = powerCompressorOn; + this.PowerCompressorOff = powerCompressorOff; + } + } + + + public event MessageEventHandler Message; + + //public delegate void MessageEventHandler(ref object sender, string message, AdvancedAuxiliaryMessageType messageType); + + private void OnMessage(object sender, string message, AdvancedAuxiliaryMessageType messageType) + { + if (message != null) { + object compressorMap = this; + Message?.Invoke(ref compressorMap, message, messageType); + } + + } + + #region Implementation of IAuxiliaryEvent + + public event AuxiliaryEventEventHandler AuxiliaryEvent; + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/M03Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/M03Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..37bac7d7f186e6a130997b1cceb6c06b471e3ba2 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/M03Impl.cs @@ -0,0 +1,141 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +{ + public class M03Impl : AbstractModule, IM3_AveragePneumaticLoadDemand + { + protected IPneumaticUserInputsConfig _pneumaticUserInputsConfig; + protected IPneumaticsAuxilliariesConfig _pneumaticAuxillariesConfig; + protected IPneumaticActuationsMAP _pneumaticsActuationsMap; + protected ICompressorMap _pneumaticsCompressorFlowRateMap; + protected Kilogram _vehicleMassKG; + protected string _cycleName; + protected ISignals _signals; + protected SI _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond; + protected NormLiter _totalAirDemand; + + + public M03Impl(IPneumaticUserInputsConfig pneumaticsUserInputConfig, IPneumaticsAuxilliariesConfig pneumaticsAuxillariesConfig, IPneumaticActuationsMAP pneumaticsActuationsMap, ICompressorMap pneumaticsCompressorFlowRateMap, Kilogram vehicleMassKG, string cycleName, ISignals signals) + { + _pneumaticUserInputsConfig = pneumaticsUserInputConfig; + _pneumaticAuxillariesConfig = pneumaticsAuxillariesConfig; + _pneumaticsActuationsMap = pneumaticsActuationsMap; + _pneumaticsCompressorFlowRateMap = pneumaticsCompressorFlowRateMap; + _vehicleMassKG = vehicleMassKG; + _cycleName = cycleName; + _signals = signals; + + + //'Total up the blow demands from compressor map + _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond = + (_pneumaticsCompressorFlowRateMap.GetAveragePowerDemandPerCompressorUnitFlowRate() / 60).SI(); + + //'Calculate the Total Required Air Delivery Rate L / S + _totalAirDemand = TotalAirDemandCalculation(); + } + + + private NormLiter TotalAirDemandCalculation() + { + //'These calculation are done directly from formulae provided from a supplied spreadsheet. + + //'* * Breaks * * + double numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(new ActuationsKey("Brakes", _cycleName)); + //'=IF(K10 = "yes", IF(COUNTBLANK(F33), G33, F33), IF(COUNTBLANK(F34), G34, F34)) * K16 + var airConsumptionPerActuation = _pneumaticUserInputsConfig.RetarderBrake + ? _pneumaticAuxillariesConfig.BrakingWithRetarderNIperKG + : _pneumaticAuxillariesConfig.BrakingNoRetarderNIperKG; + var Breaks = (numActuationsPerCycle * airConsumptionPerActuation * _vehicleMassKG.Value()).SI<NormLiter>(); + + //'* * ParkBrakesBreakplus2Doors * *Park break +2 doors + numActuationsPerCycle = + _pneumaticsActuationsMap.GetNumActuations(new ActuationsKey("Park brake + 2 doors", _cycleName)); + //'=SUM(IF(K14 = "electric", 0, IF(COUNTBLANK(F36), G36, F36)), PRODUCT(K16 * IF(COUNTBLANK(F37), G37, F37))) + airConsumptionPerActuation = _pneumaticUserInputsConfig.Doors == "Electric" + ? 0 + : _pneumaticAuxillariesConfig.PerDoorOpeningNI; + airConsumptionPerActuation += _pneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG * _vehicleMassKG.Value(); + var parkBrakesplus2Doors = (numActuationsPerCycle * airConsumptionPerActuation).SI<NormLiter>(); + + //'* * Kneeling * * + numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(new ActuationsKey("Kneeling", _cycleName)); + //'=IF(COUNTBLANK(F35), G35, F35) * K11 * K16 + airConsumptionPerActuation = _pneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM * _vehicleMassKG.Value() * + _pneumaticUserInputsConfig.KneelingHeightMillimeters; + var kneeling = (numActuationsPerCycle * airConsumptionPerActuation).SI<NormLiter>(); + + //'* * AdBlue * * + // '=IF(K13 = "electric", 0, G39 * F54) - Supplied Spreadsheet + var adBlue = (_pneumaticUserInputsConfig.AdBlueDosing == "Electric" ? 0 : + _pneumaticAuxillariesConfig.AdBlueNIperMinute * (_signals.TotalCycleTimeSeconds / 60.0)).SI<NormLiter>(); + + //'* * Regeneration * * + // '=SUM(R6: R9) * IF(K9 = "yes", IF(COUNTBLANK(F41), G41, F41), IF(COUNTBLANK(F40), G40, F40)) - Supplied SpreadSheet + var regeneration = Breaks + parkBrakesplus2Doors + kneeling + adBlue; + var regenFraction = _pneumaticUserInputsConfig.SmartRegeneration + ? _pneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand + : _pneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand; + regeneration = regeneration * regenFraction; + + //'* * DeadVolBlowOuts * * + // '=IF(COUNTBLANK(F43), G43, F43) / (F54 / 60) - Supplied SpreadSheet + numActuationsPerCycle = _pneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour / + (60.0 / (_signals.TotalCycleTimeSeconds / 60.0)); + airConsumptionPerActuation = _pneumaticAuxillariesConfig.DeadVolumeLitres; + var DeadVolBlowOuts = (numActuationsPerCycle * airConsumptionPerActuation).SI<NormLiter>(); + + //'* * AirSuspension * * + // '=IF(K12 = "electrically", 0, G38 * F54) - Suplied Spreadsheet + var AirSuspension = (_pneumaticUserInputsConfig.AirSuspensionControl == "Electrically" ? 0 : + _pneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute * (_signals.TotalCycleTimeSeconds / 60.0)).SI<NormLiter>(); + + //'* * Total Air Demand** + var TotalAirDemand = Breaks + parkBrakesplus2Doors + kneeling + adBlue + regeneration + DeadVolBlowOuts + + AirSuspension; + + + return TotalAirDemand; + } + + + #region Implementation of IM3_AveragePneumaticLoadDemand + + public Watt GetAveragePowerDemandAtCrankFromPneumatics() + { + var Sum1 = _totalAirDemand / _signals.TotalCycleTimeSeconds.SI<Second>(); + var Sum6 = _pneumaticsCompressorFlowRateMap.GetFlowRate( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) / + 60; + var pon = _pneumaticsCompressorFlowRateMap.GetPowerCompressorOn( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio); + var poff = _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio); + var diff = pon - poff; + var Sum7 = diff; + + var Sum2 = (Sum7.Value() / Sum6.Value() * Sum1.Value()).SI<Watt>(); // ' Watt / Nl/s * Nl/s = Watt + var Sum3 = Sum2 + + _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio); + var Sum4 = Sum3 * (1 / _pneumaticUserInputsConfig.CompressorGearEfficiency); + return Sum4; + } + + public NormLiterPerSecond AverageAirConsumedPerSecondLitre() + { + var Sum1 = _totalAirDemand / _signals.TotalCycleTimeSeconds.SI<Second>(); + return Sum1; + } + + public NormLiter TotalAirDemand + { + get { return _totalAirDemand; } + } + + + #endregion + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/M04Impl.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/M04Impl.cs new file mode 100644 index 0000000000000000000000000000000000000000..c7289b03f3acf25d58723c54d0b4d19d6ab7574d --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/M04Impl.cs @@ -0,0 +1,101 @@ +using System; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +{ + public class M04Impl : AbstractModule, IM4_AirCompressor + { + private const double MinRatio = 1; + private const double MaxRatio = 10; + private const double MinEff = 0; + private const double MaxEff = 1; + + private double _pulleyGearRatio; + private double _pulleyGearEfficiency; + private ICompressorMap _map; + private ISignals _signals; + + public M04Impl(ICompressorMap map, double pulleyGearRatio, double pulleyGearEfficiency, ISignals signals) + { + _map = map; + _pulleyGearRatio = pulleyGearRatio; + _pulleyGearEfficiency = pulleyGearEfficiency; + _signals = signals; + } + + #region Implementation of IM4_AirCompressor + + public double PulleyGearRatio + { + get { return _pulleyGearRatio; } + set { + if (value < MinRatio || value > MaxRatio) { + throw new ArgumentOutOfRangeException( + "pulleyGearRatio", value, + string.Format("Invalid value, should be in the range {0} to {1}", MinRatio, MaxRatio)); + } + + _pulleyGearRatio = value; + } + } + + public double PulleyGearEfficiency + { + get { return _pulleyGearEfficiency; } + set { + if (value < MinEff || value > MaxEff) { + throw new ArgumentOutOfRangeException( + "pulleyGearEfficiency", value, + String.Format("Invalid value, should be in the range {0} to {1}", MinEff, MaxEff) + ); + } + + _pulleyGearEfficiency = value; + } + } + + public bool Initialise() + { + return _map.Initialise(); + } + + public NormLiterPerSecond GetFlowRate() + { + var compressorRpm = _signals.EngineSpeed.AsRPM * PulleyGearRatio; + return _map.GetFlowRate(compressorRpm) / 60; + } + + public Watt GetPowerCompressorOff() + { + return GetCompressorPower(false); + } + + public Watt GetPowerCompressorOn() + { + return GetCompressorPower(true); + } + + public Watt GetPowerDifference() + { + var powerOn = GetPowerCompressorOn(); + var powerOff = GetPowerCompressorOff(); + return powerOn - powerOff; + } + + public SI GetAveragePowerDemandPerCompressorUnitFlowRate() + { + return _map.GetAveragePowerDemandPerCompressorUnitFlowRate().SI(); + } + + #endregion + + private Watt GetCompressorPower(bool compressorOn) + { + var compressorRpm = _signals.EngineSpeed.AsRPM * PulleyGearRatio; + return compressorOn ? _map.GetPowerCompressorOn(compressorRpm) : _map.GetPowerCompressorOff(compressorRpm); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticActuationsMap.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticActuationsMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..a847261b7834fdda0760ae66350bec0e107f2fdf --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticActuationsMap.cs @@ -0,0 +1,91 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +{ + public class PneumaticActuationsMap : IPneumaticActuationsMAP + { + private Dictionary<ActuationsKey, int> map; + private string filePath; + + + public int GetNumActuations(ActuationsKey key) + { + if (map == null || !map.ContainsKey(key)) + throw new ArgumentException(string.Format("Pneumatic Actuations map does not contain the key '{0}'.", key.CycleName + ":" + key.ConsumerName)); + + return map[key]; + } + + + public PneumaticActuationsMap(string filePath) + { + this.filePath = filePath; + + if (filePath.Trim().Length == 0) + throw new ArgumentException("A filename for the Pneumatic Actuations Map has not been supplied"); + + Initialise(); + } + + public bool Initialise() + { + ActuationsKey newKey; + int numActuations; + + if (File.Exists(filePath)) { + using (var sr = new StreamReader(filePath)) { + // get array of lines from csv + var lines = sr.ReadToEnd().Split(new [] { Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); + + // Must have at least 2 entries in map to make it usable [dont forget the header row] + if (lines.Length < 3) + throw new ArgumentException("Pneumatic Actuations Map does not have sufficient rows in file to build a usable map"); + + map = new Dictionary<ActuationsKey, int>(); + var firstline = true; + + foreach (var line in lines) { + if (!firstline) { + // split the line + var elements = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + // 3 entries per line required + if ((elements.Length != 3)) + throw new ArgumentException("Pneumatic Actuations Map has Incorrect number of values in file"); + + // add values to map + + + if (!int.TryParse(elements[2], out numActuations)) + throw new ArgumentException("Pneumatic Actuations Map Contains Non Integer values in actuations column"); + + // Should throw exception if ConsumerName or CycleName are empty. + newKey = new ActuationsKey(elements[0].ToString(), elements[1].ToString()); + + map.Add(newKey, int.Parse(elements[2], CultureInfo.InvariantCulture)); + } else + firstline = false; + } + } + } else + throw new ArgumentException(string.Format(" Pneumatic Acutations map '{0}' supplied does not exist", filePath)); + + // If we get here then all should be well and we can return a True value of success. + return true; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticUserInputsConfig.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticUserInputsConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..753411043f614cb80bc8801de78e6139bdd286d5 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticUserInputsConfig.cs @@ -0,0 +1,60 @@ +// Copyright 2017 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. + +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +{ + public class PneumaticUserInputsConfig : IPneumaticUserInputsConfig + { + public string CompressorMap { get; set; } + public double CompressorGearRatio { get; set; } + public double CompressorGearEfficiency { get; set; } + + // pnmeumatic or electric + public string AdBlueDosing { get; set; } + + // mechanical or electrical + public string AirSuspensionControl { get; set; } + + // pneumatic or electric + public string Doors { get; set; } + public double KneelingHeightMillimeters { get; set; } + + // PneumaticActuationsMap + public string ActuationsMap { get; set; } + + public bool RetarderBrake { get; set; } + public bool SmartAirCompression { get; set; } + public bool SmartRegeneration { get; set; } + + public PneumaticUserInputsConfig(bool setToDefaults = false) + { + if (setToDefaults) + SetPropertiesToDefaults(); + } + + public void SetPropertiesToDefaults() + { + CompressorMap = string.Empty; + CompressorGearRatio = 1.0; + CompressorGearEfficiency = 0.97; + AdBlueDosing = "Pneumatic"; + AirSuspensionControl = "Mechanically"; + Doors = "Pneumatic"; + KneelingHeightMillimeters = 70; + ActuationsMap = null; + RetarderBrake = true; + SmartAirCompression = false; + SmartRegeneration = false; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticsAuxilliariesConfig.cs b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticsAuxilliariesConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..c377393eb3323df15717ff835ac6321f6717c023 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/DownstreamModules/Impl/Pneumatics/PneumaticsAuxilliariesConfig.cs @@ -0,0 +1,65 @@ +// Copyright 2017 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. + +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + +namespace TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +{ + public class PneumaticsAuxilliariesConfig : IPneumaticsAuxilliariesConfig + { + public double AdBlueNIperMinute { get; set; } + + public double AirControlledSuspensionNIperMinute { get; set; } + + public double BrakingNoRetarderNIperKG { get; set; } + + public double BrakingWithRetarderNIperKG { get; set; } + + public double BreakingPerKneelingNIperKGinMM { get; set; } + + public double DeadVolBlowOutsPerLitresperHour { get; set; } + + public double DeadVolumeLitres { get; set; } + + public double NonSmartRegenFractionTotalAirDemand { get; set; } + + public double OverrunUtilisationForCompressionFraction { get; set; } + + public double PerDoorOpeningNI { get; set; } + + public double PerStopBrakeActuationNIperKG { get; set; } + + public double SmartRegenFractionTotalAirDemand { get; set; } + + + public PneumaticsAuxilliariesConfig(bool setToDefaults = false) + { + if (setToDefaults) + SetDefaults(); + } + + public void SetDefaults() + { + AdBlueNIperMinute = 21.25; + AirControlledSuspensionNIperMinute = 15; + BrakingNoRetarderNIperKG = 0.00081; + BrakingWithRetarderNIperKG = 0.0006; + BreakingPerKneelingNIperKGinMM = 0.000066; + DeadVolBlowOutsPerLitresperHour = 24; + DeadVolumeLitres = 30; + NonSmartRegenFractionTotalAirDemand = 0.26; + OverrunUtilisationForCompressionFraction = 0.97; + PerDoorOpeningNI = 12.7; + PerStopBrakeActuationNIperKG = 0.00064; + SmartRegenFractionTotalAirDemand = 0.12; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/IAuxiliaryConfig.cs b/VECTOAux/BusAuxiliaries/IAuxiliaryConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..bdf0eca6f660c810ba377397b84527d1c68615a1 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/IAuxiliaryConfig.cs @@ -0,0 +1,41 @@ +// Copyright 2017 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. + +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; + +namespace TUGraz.VectoCore.BusAuxiliaries { + public interface IAuxiliaryConfig + { + // Vecto + IVectoInputs VectoInputs { get; set; } + + // Electrical + IElectricsUserInputsConfig ElectricalUserInputsConfig { get; set; } + + + // Pneumatics + IPneumaticUserInputsConfig PneumaticUserInputsConfig { get; set; } + IPneumaticsAuxilliariesConfig PneumaticAuxillariesConfig { get; set; } + + // Hvac + IHVACUserInputsConfig HvacUserInputsConfig { get; set; } + + bool ConfigValuesAreTheSameAs(AuxiliaryConfig other); + + + // Persistance Functions + bool Save(string filePath); + bool Load(string filePath); + } +} diff --git a/VECTOAux/BusAuxiliaries/Images/Delete-32.png b/VECTOAux/BusAuxiliaries/Images/Delete-32.png new file mode 100644 index 0000000000000000000000000000000000000000..31eab12612c7a2895ef3e9fad8110f6dcb6b3448 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Images/Delete-32.png differ diff --git a/VECTOAux/BusAuxiliaries/Images/Delete.png b/VECTOAux/BusAuxiliaries/Images/Delete.png new file mode 100644 index 0000000000000000000000000000000000000000..31eab12612c7a2895ef3e9fad8110f6dcb6b3448 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Images/Delete.png differ diff --git a/VECTOAux/BusAuxiliaries/Images/Delete1.png b/VECTOAux/BusAuxiliaries/Images/Delete1.png new file mode 100644 index 0000000000000000000000000000000000000000..31eab12612c7a2895ef3e9fad8110f6dcb6b3448 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Images/Delete1.png differ diff --git a/VECTOAux/BusAuxiliaries/Images/application-export-icon-small.png b/VECTOAux/BusAuxiliaries/Images/application-export-icon-small.png new file mode 100644 index 0000000000000000000000000000000000000000..308a361b10574649a2b733de3d933a243c4f4f4d Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Images/application-export-icon-small.png differ diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/AltUserInput.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/AltUserInput.cs new file mode 100644 index 0000000000000000000000000000000000000000..9ae644a92227c89364d31c57aeb919b40288ffc4 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/AltUserInput.cs @@ -0,0 +1,26 @@ +using System; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + // Used by the Combined Alternator Form/Classes to accept user input for the combined alternators efficiency + // At different Current Demands + public class AltUserInput + { + public double Amps; + public double Eff; + + // Constructor + public AltUserInput(double amps, double eff) + { + this.Amps = amps; + this.Eff = eff; + } + + // Equality + public bool IsEqual(AltUserInput other, int rounding = 7) + { + return Math.Round(this.Amps, rounding) == Math.Round(other.Amps, rounding) && + Math.Round(this.Eff, rounding) == Math.Round(other.Eff, rounding); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/AlternatorMapValues.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/AlternatorMapValues.cs new file mode 100644 index 0000000000000000000000000000000000000000..80d81c06fd2ea81dd421929bb1dbb084015252ed --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/AlternatorMapValues.cs @@ -0,0 +1,13 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + // Originally was going to hold more than one value type. + public struct AlternatorMapValues + { + public readonly double Efficiency; + + public AlternatorMapValues(double efficiency) + { + this.Efficiency = efficiency; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ElectricConstants.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ElectricConstants.cs new file mode 100644 index 0000000000000000000000000000000000000000..ac6d1e76acd9c4eed0814b47f58d0ff2715790ac --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ElectricConstants.cs @@ -0,0 +1,22 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public class ElectricConstants + { + // Anticipated Min and Max Allowable values for Powernet, normally 26.3 volts but could be 48 in the future. + public const double PowenetVoltageMin = 6; + public const double PowenetVoltageMax = 50; + + // Duty Cycle IE Percentage of use + public const double PhaseIdleTractionOnMin = 0; + public const double PhaseIdleTractionMax = 1; + + // Max Min Expected Consumption for a Single Consumer, negative values allowed as bonuses. + public const int NonminalConsumerConsumptionAmpsMin = -10; + public const int NominalConsumptionAmpsMax = 100; + + + // Alternator + public const double AlternatorPulleyEfficiencyMin = 0.1; + public const double AlternatorPulleyEfficiencyMax = 1; + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IAlternator.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IAlternator.cs new file mode 100644 index 0000000000000000000000000000000000000000..8ffccdbe399ea698296837c0efe45e76c5f7c797 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IAlternator.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public class Table4Row + { + public double RPM; + public double Efficiency; + + public Table4Row(double rpm, double eff) + { + this.RPM = rpm; + this.Efficiency = eff; + } + } + + // Used By Combined Alternator. + // Model based on CombinedALTS_V02_Editable.xlsx + public interface IAlternator + { + // D6 + string AlternatorName { get; set; } + + // G6 + double PulleyRatio { get; set; } + + // S9 + double SpindleSpeed { get; } + + // S10 + double Efficiency { get; } + + // C10-D15 + List<AltUserInput> InputTable2000 { get; set; } + + // F10-G15 + List<AltUserInput> InputTable4000 { get; set; } + + // I10-J15 + List<AltUserInput> InputTable6000 { get; set; } + + // M10-N15 + List<Table4Row> RangeTable { get; set; } + + // Test Equality + bool IsEqualTo(IAlternator other); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IAlternatorMap.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IAlternatorMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..a7a7fa87c6ad46292eead967b4fd88df932a6adc --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IAlternatorMap.cs @@ -0,0 +1,34 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public interface IAlternatorMap : IAuxiliaryEvent + { + + /// <summary> + /// Initialise the map from supplied csv data + /// </summary> + /// <returns>Boolean - true if map is created successfully</returns> + /// <remarks></remarks> + bool Initialise(); + + /// <summary> + /// Returns the alternator efficiency at given rpm + /// </summary> + /// <param name="rpm">alternator rotation speed</param> + /// <returns>Single</returns> + /// <remarks></remarks> + AlternatorMapValues GetEfficiency(double rpm, Ampere amps); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternator.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternator.cs new file mode 100644 index 0000000000000000000000000000000000000000..48329d6d08fb66d82bcef5cec18169f5deb182d5 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternator.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public interface ICombinedAlternator + { + // Alternators List + List<IAlternator> Alternators { get; set; } + + // Test Equality + bool IsEqualTo(ICombinedAlternator other); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternatorMapRow.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternatorMapRow.cs new file mode 100644 index 0000000000000000000000000000000000000000..f375cbbd5ed86f4e4cb7e6b9440dfd6d9a41cd83 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternatorMapRow.cs @@ -0,0 +1,12 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + // Reflects stored data in pesisted CombinedAlternator Map .AALT + public interface ICombinedAlternatorMapRow + { + string AlternatorName { get; set; } + double RPM { get; set; } + double Amps { get; set; } + double Efficiency { get; set; } + double PulleyRatio { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternatorSignals.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternatorSignals.cs new file mode 100644 index 0000000000000000000000000000000000000000..725f5316bbfa823e82a43acdd73331548c726480 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ICombinedAlternatorSignals.cs @@ -0,0 +1,12 @@ +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + // Used by CombinedAlternator + public interface ICombinedAlternatorSignals + { + int NumberOfAlternators { get; set; } + double CrankRPM { get; set; } + Ampere CurrentDemandAmps { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricalConsumer.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricalConsumer.cs new file mode 100644 index 0000000000000000000000000000000000000000..e6e91498d25448a71d28d4336c359e8bc777078c --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricalConsumer.cs @@ -0,0 +1,32 @@ +// Copyright 2017 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. + +using System; +using System.ComponentModel; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public interface IElectricalConsumer : INotifyPropertyChanged + { + string Category { get; set; } + string ConsumerName { get; set; } + bool BaseVehicle { get; set; } + double NominalConsumptionAmps { get; set; } + double PhaseIdle_TractionOn { get; set; } + int NumberInActualVehicle { get; set; } + double PowerNetVoltage { get; set; } + double AvgConsumptionAmps { get; set; } + string Info { get; set; } + Ampere TotalAvgConumptionAmps(double PhaseIdle_TractionOnBasedOnCycle = default(Double)); + Watt TotalAvgConsumptionInWatts(double PhaseIdle_TractionOnBasedOnCycle = 0.0); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricalConsumerList.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricalConsumerList.cs new file mode 100644 index 0000000000000000000000000000000000000000..94139b75fed686f9269d1642225194b591022a08 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricalConsumerList.cs @@ -0,0 +1,61 @@ +// Copyright 2017 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. + +using System.Collections.Generic; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public interface IElectricalConsumerList + { + /// <summary> + /// List of Electrical Consumers + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + List<IElectricalConsumer> Items { get; } + + /// <summary> + /// Add New Electrical Consumer + /// </summary> + /// <param name="consumer"></param> + /// <remarks></remarks> + void AddConsumer(IElectricalConsumer consumer); + + /// <summary> + /// Remove Electrical Consumer + /// </summary> + /// <param name="consumer"></param> + /// <remarks></remarks> + void RemoveConsumer(IElectricalConsumer consumer); + + /// <summary> + /// Get Total Average Demand In Amps + /// </summary> + /// <param name="excludeOnBase">Exclude those on base vehicle</param> + /// <returns></returns> + /// <remarks></remarks> + Ampere GetTotalAverageDemandAmps(bool excludeOnBase); + + /// <summary> + /// Door Actuation Time Fraction ( Total Time Spent Operational during cycle ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double DoorDutyCycleFraction { get; set; } + + // Merge Info data from ElectricalConsumer in a Default set into live set + // This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. + void MergeInfoData(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricsUserInputsConfig.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricsUserInputsConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..29e63b70a1b09c8537c21c7c81ef863ca9d117bb --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IElectricsUserInputsConfig.cs @@ -0,0 +1,97 @@ +// Copyright 2017 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. + + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public interface IElectricsUserInputsConfig + { + /// <summary> + /// Power Net Voltage - The supply voltage used on the vehilce. + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double PowerNetVoltage { get; set; } + + /// <summary> + /// The Path for the Alternator map + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + string AlternatorMap { get; set; } + + /// <summary> + /// Alternator Gear Efficiency + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double AlternatorGearEfficiency { get; set; } + + /// <summary> + /// List of Electrical Consumers + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + IElectricalConsumerList ElectricalConsumers { get; set; } + + /// <summary> + /// Door Actuation Time In Seconds ( Time Taken to Open/Close the door ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + int DoorActuationTimeSecond { get; set; } + + /// <summary> + /// Result Card Taken During Idle. + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + IResultCard ResultCardIdle { get; set; } + + /// <summary> + /// Result Card Taken During Traction + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + IResultCard ResultCardTraction { get; set; } + + /// <summary> + /// Result Card Taken During Overrun + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + IResultCard ResultCardOverrun { get; set; } + + /// <summary> + /// Smart Electrical System + /// </summary> + /// <value></value> + /// <returns>True For Smart Electrical Systems/ False For non Smart.</returns> + /// <remarks></remarks> + bool SmartElectrical { get; set; } + + /// <summary> + /// Stored Energy Efficiency + /// </summary> + /// <value></value> + /// <returns>Stored Energy Efficiency</returns> + /// <remarks></remarks> + double StoredEnergyEfficiency { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IResultCard.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IResultCard.cs new file mode 100644 index 0000000000000000000000000000000000000000..0773c9664bfa4c70f966d6ef69c164bf96c1d812 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/IResultCard.cs @@ -0,0 +1,35 @@ +// Copyright 2017 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. + +using System.Collections.Generic; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public interface IResultCard + { + /// <summary> + /// Returns a List of (SmartResult ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + List<SmartResult> Results { get; } + + /// <summary> + /// Returns the Smart Current (A) + /// </summary> + /// <param name="amps"></param> + /// <returns></returns> + /// <remarks>Defaults to 10 Amps if no readings present</remarks> + Ampere GetSmartCurrentResult(Ampere amps); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/SmartResult.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/SmartResult.cs new file mode 100644 index 0000000000000000000000000000000000000000..b8ca2b37c791a09239dbdbde24d6bf2a92102437 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/SmartResult.cs @@ -0,0 +1,56 @@ +// Copyright 2017 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. + +using System; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +{ + public class SmartResult : IComparable<SmartResult> + { + public double Amps { get; set; } + public double SmartAmps { get; set; } + + // Constructors + public SmartResult() + { + } + + public SmartResult(double amps, double smartAmps) + { + Amps = amps; + SmartAmps = smartAmps; + } + + // Comparison + public int CompareTo(SmartResult other) + { + if (other.Amps > Amps) + return -1; + if (other.Amps == Amps) + return 0; + + return 1; + } + + // Comparison Overrides + public override bool Equals(object obj) + { + var other = (SmartResult)obj; + + return Amps == other.Amps; + } + + public override int GetHashCode() + { + return 0; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/Class1.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/Class1.cs new file mode 100644 index 0000000000000000000000000000000000000000..2ad245a6136efa19cd9644c0c47249dab91e896f --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/Class1.cs @@ -0,0 +1,8 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public enum TechLineType + { + Normal, + HVCActiveSelection + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IEnvironmentalCondition.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IEnvironmentalCondition.cs new file mode 100644 index 0000000000000000000000000000000000000000..408b4434efa33ac9d94623f5c588bc2c587a4b37 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IEnvironmentalCondition.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface IEnvironmentalCondition + { + double GetTemperature(); + double GetSolar(); + double GetWeighting(); + double GetNormalisedWeighting(List<IEnvironmentalCondition> map); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IEnvironmentalConditionsMap.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IEnvironmentalConditionsMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..6b45aa1633f58380b9ff46e0ae1b77a2d3d4d858 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IEnvironmentalConditionsMap.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface IEnvironmentalConditionsMap + { + bool Initialise(); + + List<IEnvironmentalCondition> GetEnvironmentalConditions(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACConstants.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACConstants.cs new file mode 100644 index 0000000000000000000000000000000000000000..e8ba4fa7ae5b64b2c63a48dc692c375c6e6ef5ee --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACConstants.cs @@ -0,0 +1,25 @@ +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface IHVACConstants + { + /// <summary> + /// Diesel: 44800 [J/g] + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + JoulePerKilogramm DieselGCVJperGram { get; } + + /// <summary> + /// 835 [g/l] + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + KilogramPerCubicMeter FuelDensity { get; } + + double FuelDensityAsGramPerLiter { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACSteadyStateModel.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACSteadyStateModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..e90485e89c4c1843843992126e732302c4ed5735 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACSteadyStateModel.cs @@ -0,0 +1,38 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface IHVACSteadyStateModel + { + /// <summary> + /// Initialised Values From Map + /// </summary> + /// <param name="filePath"></param> + /// <param name="message"></param> + /// <returns>True if successfull, and False if not.</returns> + /// <remarks></remarks> + bool SetValuesFromMap(string filePath, ref string message); + + /// <summary> + /// HVAC Mechanical Load Power (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + float HVACMechanicalLoadPowerWatts { get; set; } + + /// <summary> + /// HVAC Electrical Load Power (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + float HVACElectricalLoadPowerWatts { get; set; } + + /// <summary> + /// HVAC Fuelling (L/H) + /// </summary> + /// <value></value> + /// <returns>Liters per hour</returns> + /// <remarks></remarks> + float HVACFuellingLitresPerHour { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACUserInputsConfig.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACUserInputsConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..751c3b2f57b1829262fd13690d9bebf9b657966a --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/IHVACUserInputsConfig.cs @@ -0,0 +1,18 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface IHVACUserInputsConfig + { + // Property SteadyStateModel As IHVACSteadyStateModel + /// <summary> + /// PathName of the Steady State Model File + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + string SSMFilePath { get; set; } + + string BusDatabasePath { get; set; } + + bool SSMDisabled { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMCalculate.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMCalculate.cs new file mode 100644 index 0000000000000000000000000000000000000000..2517041bef47e493919f239011fe79babbae0058 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMCalculate.cs @@ -0,0 +1,57 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface ISSMCalculate + { + //ISSMRun Run1 { get; set; } + //ISSMRun Run2 { get; set; } + + + double ElectricalWBase { get; } + double MechanicalWBase { get; } + double FuelPerHBase { get; } + + double ElectricalWAdjusted { get; } + double MechanicalWBaseAdjusted { get; } + double FuelPerHBaseAdjusted { get; } + + + // BaseValues + // - Heating + double BaseHeatingW_Mechanical { get; } + double BaseHeatingW_ElectricalCoolingHeating { get; } + double BaseHeatingW_ElectricalVentilation { get; } + double BaseHeatingW_FuelFiredHeating { get; } + + // Cooling + double BaseCoolingW_Mechanical { get; } + double BaseCoolingW_ElectricalCoolingHeating { get; } + double BaseCoolingW_ElectricalVentilation { get; } + double BaseCoolingW_FuelFiredHeating { get; } + + // Cooling + double BaseVentilationW_Mechanical { get; } + double BaseVentilationW_ElectricalCoolingHeating { get; } + double BaseVentilationW_ElectricalVentilation { get; } + double BaseVentilationW_FuelFiredHeating { get; } + + + // TechListBenefits + // - Heating + double TechListAdjustedHeatingW_Mechanical { get; } + double TechListAdjustedHeatingW_ElectricalCoolingHeating { get; } + double TechListAdjustedHeatingW_ElectricalVentilation { get; } + double TechListAdjustedHeatingW_FuelFiredHeating { get; } + + // Cooling TechListAdjusted + double TechListAdjustedCoolingW_Mechanical { get; } + double TechListAdjustedCoolingW_ElectricalCoolingHeating { get; } + double TechListAdjustedCoolingW_ElectricalVentilation { get; } + double TechListAdjustedCoolingW_FuelFiredHeating { get; } + + // Cooling TechListAdjusted + double TechListAdjustedVentilationW_Mechanical { get; } + double TechListAdjustedVentilationW_ElectricalCoolingHeating { get; } + double TechListAdjustedVentilationW_ElectricalVentilation { get; } + double TechListAdjustedVentilationW_FuelFiredHeating { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMGenInputs.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMGenInputs.cs new file mode 100644 index 0000000000000000000000000000000000000000..1200f239260029a6f59ee10edb704ea319bed8d9 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMGenInputs.cs @@ -0,0 +1,74 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface ISSMGenInputs + { + + // Bus Parameterisation + string BP_BusModel { get; set; } + double BP_NumberOfPassengers { get; set; } + string BP_BusFloorType { get; set; } + bool BP_DoubleDecker { get; set; } + double BP_BusLength { get; set; } + double BP_BusWidth { get; set; } + double BP_BusHeight { get; set; } + + double BP_BusFloorSurfaceArea { get; } + double BP_BusWindowSurface { get; } + double BP_BusSurfaceAreaM2 { get; } + double BP_BusVolume { get; } + + // Boundary Conditions: + double BC_GFactor { get; set; } + double BC_SolarClouding { get; } + double BC_HeatPerPassengerIntoCabinW { get; } + double BC_PassengerBoundaryTemperature { get; set; } + double BC_PassengerDensityLowFloor { get; } + double BC_PassengerDensitySemiLowFloor { get; } + double BC_PassengerDensityRaisedFloor { get; } + double BC_CalculatedPassengerNumber { get; } + double BC_UValues { get; } + double BC_HeatingBoundaryTemperature { get; set; } + double BC_CoolingBoundaryTemperature { get; set; } + double BC_TemperatureCoolingTurnsOff { get; } + double BC_HighVentilation { get; set; } + double BC_lowVentilation { get; set; } + double BC_High { get; } + double BC_Low { get; } + double BC_HighVentPowerW { get; } + double BC_LowVentPowerW { get; } + double BC_SpecificVentilationPower { get; set; } + double BC_AuxHeaterEfficiency { get; set; } + double BC_GCVDieselOrHeatingOil { get; set; } + double BC_WindowAreaPerUnitBusLength { get; } + double BC_FrontRearWindowArea { get; } + double BC_MaxTemperatureDeltaForLowFloorBusses { get; set; } + double BC_MaxPossibleBenefitFromTechnologyList { get; set; } + + // EnviromentalConditions + double EC_EnviromentalTemperature { get; set; } + double EC_Solar { get; set; } + IEnvironmentalConditionsMap EC_EnvironmentalConditionsMap { get; } + string EC_EnviromentalConditions_BatchFile { get; set; } + bool EC_EnviromentalConditions_BatchEnabled { get; set; } + + // AC-system + string AC_CompressorType { get; set; } + string AC_CompressorTypeDerived { get; } + double AC_CompressorCapacitykW { get; set; } + double AC_COP { get; } + + // Ventilation + bool VEN_VentilationOnDuringHeating { get; set; } + bool VEN_VentilationWhenBothHeatingAndACInactive { get; set; } + bool VEN_VentilationDuringAC { get; set; } + string VEN_VentilationFlowSettingWhenHeatingAndACInactive { get; set; } + string VEN_VentilationDuringHeating { get; set; } + string VEN_VentilationDuringCooling { get; set; } + + // Aux. Heater + double AH_EngineWasteHeatkW { get; set; } + double AH_FuelFiredHeaterkW { get; set; } + double AH_FuelEnergyToHeatToCoolant { get; set; } + double AH_CoolantHeatTransferredToAirCabinHeater { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMRun.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMRun.cs new file mode 100644 index 0000000000000000000000000000000000000000..08fbfa00e8aaffe15da789e2ee43cbdee2b460c3 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMRun.cs @@ -0,0 +1,16 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface ISSMRun + { + double HVACOperation { get; } + double TCalc { get; } + double TemperatureDelta { get; } + double QWall { get; } + double WattsPerPass { get; } + double Solar { get; } + double TotalW { get; } + double TotalKW { get; } + double FuelW { get; } + double TechListAmendedFuelW { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTOOL.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTOOL.cs new file mode 100644 index 0000000000000000000000000000000000000000..c0e58df2b66eb081c5f861e03adf47c02120840e --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTOOL.cs @@ -0,0 +1,39 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC { + public interface ISSMTOOL + { + ISSMGenInputs GenInputs { get; set; } + ISSMTechList TechList { get; set; } + ISSMCalculate Calculate { get; set; } + bool SSMDisabled { get; set; } + IHVACConstants HVACConstants { get; set; } + + double ElectricalWBase { get; } // Watt + double MechanicalWBase { get; } // Watt + double FuelPerHBase { get; } // LiterPerHour + + double ElectricalWAdjusted { get; } // Watt + double MechanicalWBaseAdjusted { get; } // Watt + double FuelPerHBaseAdjusted { get; } // LiterPerHour + + void Clone(ISSMTOOL from); + + bool Load(string filePath); + + bool Save(string filePath); + + bool IsEqualTo(ISSMTOOL source); + + /// <summary> + /// This alters the waste heat and returns an adjusted fueling value + /// </summary> + /// <param name="AverageUseableEngineWasteHeatKW"></param> + /// <returns></returns> + /// <remarks></remarks> + double FuelPerHBaseAsjusted(double AverageUseableEngineWasteHeatKW); + + event MessageEventHandler Message; + + } + + public delegate void MessageEventHandler(ref object sender, string message, AdvancedAuxiliaryMessageType messageType); +} \ No newline at end of file diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTechList.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTechList.cs new file mode 100644 index 0000000000000000000000000000000000000000..253e8cfc510bd8b0ea2bf91bac82039cfaf4cb5a --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTechList.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +{ + public interface ISSMTechList + { + List<ITechListBenefitLine> TechLines { get; set; } + + void Clear(); + bool Add(ITechListBenefitLine item, ref string feedback); + bool Delete(ITechListBenefitLine item, ref string feedback); + bool Modify(ITechListBenefitLine originalItem, ITechListBenefitLine modifiedItem, ref string feedback); + + void SetSSMGeneralInputs(ISSMGenInputs genInputs); + + double HValueVariation { get; } + double VHValueVariation { get; } + double VVValueVariation { get; } + double VCValueVariation { get; } + double CValueVariation { get; } + + double HValueVariationKW { get; } + double VHValueVariationKW { get; } + double VVValueVariationKW { get; } + double VCValueVariationKW { get; } + double CValueVariationKW { get; } + + + bool Initialise(); + bool Initialise(string filePath); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ITechListBenefitLine.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ITechListBenefitLine.cs new file mode 100644 index 0000000000000000000000000000000000000000..e776bea6511af6713b61635c244a779f87ff0a23 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ITechListBenefitLine.cs @@ -0,0 +1,36 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC { + public interface ITechListBenefitLine + { + string Units { get; set; } + string Category { get; set; } + string BenefitName { get; set; } + + double LowFloorH { get; set; } + double LowFloorV { get; set; } + double LowFloorC { get; set; } + + double SemiLowFloorH { get; set; } + double SemiLowFloorV { get; set; } + double SemiLowFloorC { get; set; } + + double RaisedFloorH { get; set; } + double RaisedFloorV { get; set; } + double RaisedFloorC { get; set; } + + bool OnVehicle { get; set; } + bool ActiveVH { get; set; } + bool ActiveVV { get; set; } + bool ActiveVC { get; set; } + TechLineType LineType { get; set; } + + double H { get; } + double VH { get; } + double VV { get; } + double VC { get; } + double C { get; } + + void CloneFrom(ITechListBenefitLine source); + + bool IsEqualTo(ITechListBenefitLine source); + } +} \ No newline at end of file diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IAbstractModule.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IAbstractModule.cs new file mode 100644 index 0000000000000000000000000000000000000000..850bc73eda0396a018c7a091aa42e0a47894570b --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IAbstractModule.cs @@ -0,0 +1,6 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules { + public interface IAbstractModule + { + void ResetCalculations(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM0_5_SmartAlternatorSetEfficiency.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM0_5_SmartAlternatorSetEfficiency.cs new file mode 100644 index 0000000000000000000000000000000000000000..2a7fa8c63ee0d37d9196e819425261bc30eed47d --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM0_5_SmartAlternatorSetEfficiency.cs @@ -0,0 +1,67 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM0_5_SmartAlternatorSetEfficiency : IAbstractModule + { + + /// <summary> + /// Smart Idle Current (A) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Ampere SmartIdleCurrent { get; } + + /// <summary> + /// Alternators Efficiency In Idle ( Fraction ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double AlternatorsEfficiencyIdleResultCard { get; } + + /// <summary> + /// Smart Traction Current (A) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Ampere SmartTractionCurrent { get; } + + /// <summary> + /// Alternators Efficiency In Traction ( Fraction ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double AlternatorsEfficiencyTractionOnResultCard { get; } + + /// <summary> + /// Smart Overrrun Current (A) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Ampere SmartOverrunCurrent { get; } + + /// <summary> + /// Alternators Efficiency In Overrun ( Fraction ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double AlternatorsEfficiencyOverrunResultCard { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM0_NonSmart_AlternatorsSetEfficiency.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM0_NonSmart_AlternatorsSetEfficiency.cs new file mode 100644 index 0000000000000000000000000000000000000000..8dd5cd1f4d2dfe8ef4510009bf21d4fb1c2508ef --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM0_NonSmart_AlternatorsSetEfficiency.cs @@ -0,0 +1,35 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM0_NonSmart_AlternatorsSetEfficiency : IAbstractModule + { + + /// <summary> + /// Gets HVAC Electrical Power Demand (A) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Ampere GetHVACElectricalPowerDemandAmps { get; } + + /// <summary> + /// Gets Alternator Efficiency (0-1) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double AlternatorsEfficiency { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM10.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM10.cs new file mode 100644 index 0000000000000000000000000000000000000000..36c6a950d65fb07998aa2b7fbfa63d00724fb95c --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM10.cs @@ -0,0 +1,27 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM10 : IAbstractModule + { + + // AverageLoadsFuelConsumptionInterpolatedForPneumatics + Kilogram AverageLoadsFuelConsumptionInterpolatedForPneumatics { get; } + + // Interpolated FC between points 2-3-1 Representing smart Pneumatics = Fuel consumption with smart Pneumatics and average electrical power demand + Kilogram FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand { get; } + + void CycleStep(Second stepTimeInSeconds); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM11.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM11.cs new file mode 100644 index 0000000000000000000000000000000000000000..787fffd74a163a8e7389b34c53468feca44a1832 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM11.cs @@ -0,0 +1,88 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM11 : IAbstractModule + { + + /// <summary> + /// Smart Electrical Total Cycle Electrical Energy Generated During Overrun Only(J) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Joule SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly { get; } + + /// <summary> + /// Smart Electrical Total Cycle Eletrical EnergyGenerated (J) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Joule SmartElectricalTotalCycleEletricalEnergyGenerated { get; } + + /// <summary> + /// Total Cycle Electrical Demand (J) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Joule TotalCycleElectricalDemand { get; } + + /// <summary> + /// Total Cycle Fuel Consumption: Smart Electrical Load (g) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram TotalCycleFuelConsumptionSmartElectricalLoad { get; } + + /// <summary> + /// Total Cycle Fuel Consumption: Zero Electrical Load (g) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram TotalCycleFuelConsumptionZeroElectricalLoad { get; } + + /// <summary> + /// Stop Start Sensitive: Total Cycle Electrical Demand (J) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Joule StopStartSensitiveTotalCycleElectricalDemand { get; } + + /// <summary> + /// Total Cycle Fuel Consuption : Average Loads (g) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram TotalCycleFuelConsuptionAverageLoads { get; } + + /// <summary> + /// Clears aggregated values ( Sets them to zero ). + /// </summary> + /// <remarks></remarks> + void ClearAggregates(); + + /// <summary> + /// Increments all aggregated outputs + /// </summary> + /// <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> + /// <remarks></remarks> + void CycleStep(Second stepTimeInSeconds); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM13.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM13.cs new file mode 100644 index 0000000000000000000000000000000000000000..12525682217d9404510f71431926d425593194e6 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM13.cs @@ -0,0 +1,28 @@ +// Copyright 2017 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. + + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM13 : IAbstractModule + { + + /// <summary> + /// Total Cycle Fuel Consumption Grams + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>WHTC and Start Stop Adjusted</remarks> + Kilogram WHTCTotalCycleFuelConsumptionGrams { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM14.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM14.cs new file mode 100644 index 0000000000000000000000000000000000000000..bd06c88fef1968903db6c0eb3808e854d3f7b7a3 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM14.cs @@ -0,0 +1,11 @@ +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM14 : IAbstractModule + { + Kilogram TotalCycleFCGrams { get; } + + Liter TotalCycleFCLitres { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM1_AverageHVACLoadDemand.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM1_AverageHVACLoadDemand.cs new file mode 100644 index 0000000000000000000000000000000000000000..d04ec8a01c0a618da29bdd323c8e3e520a3c0604 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM1_AverageHVACLoadDemand.cs @@ -0,0 +1,47 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM1_AverageHVACLoadDemand : IAbstractModule + { + + /// <summary> + /// Average Power Demand At Crank From HVAC Mechanicals (W) + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt AveragePowerDemandAtCrankFromHVACMechanicalsWatts(); + + /// <summary> + /// Average Power Demand At Alternator From HVAC Electrics (W) + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt AveragePowerDemandAtAlternatorFromHVACElectricsWatts(); + + /// <summary> + /// Average Power Demand At Crank From HVAC Electrics (W) + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt AveragePowerDemandAtCrankFromHVACElectricsWatts(); + + /// <summary> + /// HVAC Fueling (L/H) + /// </summary> + /// <returns>Litres Per Hour</returns> + /// <remarks></remarks> + LiterPerSecond HVACFuelingLitresPerHour(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM2_AverageElectrialLoadDemand.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM2_AverageElectrialLoadDemand.cs new file mode 100644 index 0000000000000000000000000000000000000000..0a427d74bd3e5be8f1b571e9cef8480f24b53c63 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM2_AverageElectrialLoadDemand.cs @@ -0,0 +1,21 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM2_AverageElectricalLoadDemand : IAbstractModule + { + Watt GetAveragePowerDemandAtAlternator(); + Watt GetAveragePowerAtCrankFromElectrics(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM3_AveragePneumaticLoadDemand.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM3_AveragePneumaticLoadDemand.cs new file mode 100644 index 0000000000000000000000000000000000000000..f45b6cf6ad994e2d5bf95956cbd518d93829b00e --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM3_AveragePneumaticLoadDemand.cs @@ -0,0 +1,24 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM3_AveragePneumaticLoadDemand : IAbstractModule + { + Watt GetAveragePowerDemandAtCrankFromPneumatics(); + + NormLiterPerSecond AverageAirConsumedPerSecondLitre(); + + NormLiter TotalAirDemand { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM4_AirCompressor.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM4_AirCompressor.cs new file mode 100644 index 0000000000000000000000000000000000000000..1248b8a518edf70b66bfde0c67e8e8e6ba5ac964 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM4_AirCompressor.cs @@ -0,0 +1,77 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM4_AirCompressor : IAbstractModule + { + + /// <summary> + /// Ratio of Gear or Pulley used to drive the compressor + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double PulleyGearRatio { get; set; } + + /// <summary> + /// Efficiency of the Pulley or Gear used to drive the compressor + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double PulleyGearEfficiency { get; set; } + + /// <summary> + /// Initialises the AirCompressor Class + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + bool Initialise(); + + /// <summary> + /// Returns the flow rate [litres/second] of compressor for the given engine rpm + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + NormLiterPerSecond GetFlowRate(); + + /// <summary> + /// Returns the power consumed for the given engine rpm when compressor is off + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt GetPowerCompressorOff(); + + /// <summary> + /// Returns the power consumed for the given engine rpm when compressor is on + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt GetPowerCompressorOn(); + + /// <summary> + /// Returns the difference in power between compressonr on and compressor off operation at the given engine rpm + /// </summary> + /// <returns>Single / Watts</returns> + /// <remarks></remarks> + Watt GetPowerDifference(); + + /// <summary> + /// Returns Average PoweDemand PeCompressor UnitFlowRate + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + SI GetAveragePowerDemandPerCompressorUnitFlowRate(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM5_SmartAlternatorSetGeneration.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM5_SmartAlternatorSetGeneration.cs new file mode 100644 index 0000000000000000000000000000000000000000..50d8998b1bc554655b1570f2a016f765e751159e --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM5_SmartAlternatorSetGeneration.cs @@ -0,0 +1,40 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM5_SmartAlternatorSetGeneration : IAbstractModule + { + + /// <summary> + /// Alternators Generation Power At Crank Idle (W) + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt AlternatorsGenerationPowerAtCrankIdleWatts(); + + /// <summary> + /// Alternators Generation Power At Crank Traction On (W) + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt AlternatorsGenerationPowerAtCrankTractionOnWatts(); + + /// <summary> + /// Alternators Generation Power At Crank Overrun (W) + /// </summary> + /// <returns></returns> + /// <remarks></remarks> + Watt AlternatorsGenerationPowerAtCrankOverrunWatts(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM6.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM6.cs new file mode 100644 index 0000000000000000000000000000000000000000..bfbdcd7dfb1c25d77bc9ada8c4c0728750a0b96c --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM6.cs @@ -0,0 +1,91 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM6 : IAbstractModule + { + + /// <summary> + /// OverrunFlag + /// </summary> + /// <value></value> + /// <returns>0 = Not in overrun, 1 = In Overrun</returns> + /// <remarks></remarks> + bool OverrunFlag { get; } + + /// <summary> + /// Smart Elec And Pneumatics Compressor Flag + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + bool SmartElecAndPneumaticsCompressorFlag { get; } + + /// <summary> + /// Smart Elec And Pneumatic: Alternator Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartElecAndPneumaticAltPowerGenAtCrank { get; } + + /// <summary> + /// Smart Elec And Pneumatic: Air Compressor Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartElecAndPneumaticAirCompPowerGenAtCrank { get; } + + /// <summary> + /// Smart Electrics Only : Alternator Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartElecOnlyAltPowerGenAtCrank { get; } + + /// <summary> + /// Average Power Demand At Crank From Pneumatics (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt AveragePowerDemandAtCrankFromPneumatics { get; } + + /// <summary> + /// Smart Pneumatic Only Air Comp Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartPneumaticOnlyAirCompPowerGenAtCrank { get; } + + /// <summary> + /// Avgerage Power Demand At Crank From Electrics Including HVAC electrics (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt AvgPowerDemandAtCrankFromElectricsIncHVAC { get; } + + /// <summary> + /// Smart Pneumatics Only CompressorFlag + /// </summary> + /// <value></value> + /// <returns>Less than Zero = No, Greater then Zero = Yes </returns> + /// <remarks></remarks> + bool SmartPneumaticsOnlyCompressorFlag { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM7.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM7.cs new file mode 100644 index 0000000000000000000000000000000000000000..95656f38950c00b71fac9d7ada7078ff56022867 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM7.cs @@ -0,0 +1,51 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM7 : IAbstractModule + { + + /// <summary> + /// Smart Electrical And Pneumatic Aux: Alternator Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartElectricalAndPneumaticAuxAltPowerGenAtCrank { get; } + + /// <summary> + /// Smart Electrical And Pneumatic Aux : Air Compressor Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank { get; } + + /// <summary> + /// Smart Electrical Only Aux : Alternator Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartElectricalOnlyAuxAltPowerGenAtCrank { get; } + + /// <summary> + /// Smart Pneumatic Only Aux : Air Comppressor Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartPneumaticOnlyAuxAirCompPowerGenAtCrank { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM8.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM8.cs new file mode 100644 index 0000000000000000000000000000000000000000..ae97c00319da2138d4221ddd04676f18f89ac47b --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM8.cs @@ -0,0 +1,45 @@ +// Copyright 2017 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. + + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM8 : IAbstractModule + { + + // OUT1 + /// <summary> + /// Aux Power At Crank From Electrical HVAC And Pneumatics Ancilaries (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries { get; } + // OUT2 + /// <summary> + /// Smart Electrical Alternator Power Gen At Crank (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt SmartElectricalAlternatorPowerGenAtCrank { get; } + // OUT3 + /// <summary> + /// Compressor Flag + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + bool CompressorFlag { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM9.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM9.cs new file mode 100644 index 0000000000000000000000000000000000000000..d840df6d9e17afb7935253dcc46ab30fb31e24f0 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/IM9.cs @@ -0,0 +1,64 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +{ + public interface IM9 : IAuxiliaryEvent, IAbstractModule + { + + /// <summary> + /// Clears aggregated values ( Sets them to zero ) + /// </summary> + /// <remarks></remarks> + void ClearAggregates(); + + /// <summary> + /// Increments all aggregated outputs + /// </summary> + /// <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> + /// <remarks></remarks> + void CycleStep(Second stepTimeInSeconds); + + /// <summary> + /// Litres Of Air: Compressor On Continually (L) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Start/Stop Sensitive</remarks> + NormLiter LitresOfAirCompressorOnContinually { get; } + + /// <summary> + /// Litres Of Air Compressor On Only In Overrun (L) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + NormLiter LitresOfAirCompressorOnOnlyInOverrun { get; } + + /// <summary> + /// Total Cycle Fuel Consumption Compressor *On* Continuously (G) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram TotalCycleFuelConsumptionCompressorOnContinuously { get; } + + /// <summary> + /// Total Cycle Fuel Consumption Compressor *OFF* Continuously (G) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram TotalCycleFuelConsumptionCompressorOffContinuously { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/ActuationsKey.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/ActuationsKey.cs new file mode 100644 index 0000000000000000000000000000000000000000..6abe4703655023ca4465375c15750d9eee39b5a2 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/ActuationsKey.cs @@ -0,0 +1,59 @@ +// Copyright 2017 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. + +using System; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem +{ + public class ActuationsKey + { + private string _consumerName; + private string _cycleName; + + // Properties + public string ConsumerName + { + get { + return _consumerName; + } + } + + public string CycleName + { + get { + return _cycleName; + } + } + + // Constructor + public ActuationsKey(string consumerName, string cycleName) + { + if (consumerName.Trim().Length == 0 | cycleName.Trim().Length == 0) + throw new ArgumentException("ConsumerName and CycleName must be provided"); + _consumerName = consumerName; + _cycleName = cycleName; + } + + + // Overrides to enable this class to be used as a dictionary key in the ActuationsMap. + public override bool Equals(object obj) + { + var other = (ActuationsKey)obj; + + return other.ConsumerName == this.ConsumerName && other.CycleName == this.CycleName; + } + + public override int GetHashCode() + { + return 0; + } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/ICompressorMap.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/ICompressorMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4cee1360c23563deedc935b5a4f3c1a5b557b562 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/ICompressorMap.cs @@ -0,0 +1,52 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem +{ + public interface ICompressorMap : IAuxiliaryEvent + { + + /// <summary> + /// Initilaises the map from the supplied csv data + /// </summary> + /// <remarks></remarks> + bool Initialise(); + + /// <summary> + /// Returns compressor flow rate at the given rotation speed + /// </summary> + /// <param name="rpm">compressor rotation speed</param> + /// <returns></returns> + /// <remarks>Single</remarks> + NormLiterPerSecond GetFlowRate(double rpm); + + /// <summary> + /// Returns mechanical power at rpm when compressor is on + /// </summary> + /// <param name="rpm">compressor rotation speed</param> + /// <returns></returns> + /// <remarks>Single</remarks> + Watt GetPowerCompressorOn(double rpm); + + /// <summary> + /// Returns mechanical power at rpm when compressor is off + /// </summary> + /// <param name="rpm">compressor rotation speed</param> + /// <returns></returns> + /// <remarks>Single</remarks> + Watt GetPowerCompressorOff(double rpm); + + // Returns Average Power Demand Per Compressor Unit FlowRate + double GetAveragePowerDemandPerCompressorUnitFlowRate(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticActuationsMAP.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticActuationsMAP.cs new file mode 100644 index 0000000000000000000000000000000000000000..37cd7dea7380efce6e87aba699f00edc696467f2 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticActuationsMAP.cs @@ -0,0 +1,21 @@ +// Copyright 2017 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. + + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem +{ + public interface IPneumaticActuationsMAP + { + int GetNumActuations(ActuationsKey key); + + bool Initialise(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticUserInputsConfig.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticUserInputsConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..b32a18968b9051d3c9e911e9cebcc949e0f529b4 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticUserInputsConfig.cs @@ -0,0 +1,17 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem +{ + public interface IPneumaticUserInputsConfig + { + string CompressorMap { get; set; } + double CompressorGearEfficiency { get; set; } + double CompressorGearRatio { get; set; } + string ActuationsMap { get; set; } + bool SmartAirCompression { get; set; } + bool SmartRegeneration { get; set; } + bool RetarderBrake { get; set; } + double KneelingHeightMillimeters { get; set; } + string AirSuspensionControl { get; set; } // mechanical or electrical + string AdBlueDosing { get; set; } // pnmeumatic or electric + string Doors { get; set; } // pneumatic or electric + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticsAuxilliariesConfig.cs b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticsAuxilliariesConfig.cs new file mode 100644 index 0000000000000000000000000000000000000000..833b9a255debaa6efeeedb4938b8a58fdecf14af --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/DownstreamModules/PneumaticSystem/IPneumaticsAuxilliariesConfig.cs @@ -0,0 +1,17 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem { + public interface IPneumaticsAuxilliariesConfig + { + double OverrunUtilisationForCompressionFraction { get; set; } + double BrakingWithRetarderNIperKG { get; set; } + double BrakingNoRetarderNIperKG { get; set; } + double BreakingPerKneelingNIperKGinMM { get; set; } + double PerDoorOpeningNI { get; set; } + double PerStopBrakeActuationNIperKG { get; set; } + double AirControlledSuspensionNIperMinute { get; set; } + double AdBlueNIperMinute { get; set; } + double NonSmartRegenFractionTotalAirDemand { get; set; } + double SmartRegenFractionTotalAirDemand { get; set; } + double DeadVolumeLitres { get; set; } + double DeadVolBlowOutsPerLitresperHour { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/Enumerations.cs b/VECTOAux/BusAuxiliaries/Interfaces/Enumerations.cs new file mode 100644 index 0000000000000000000000000000000000000000..ea4fa8b4fc2a64c0bc207fa93bf85f8051d96e92 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/Enumerations.cs @@ -0,0 +1,8 @@ +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + public enum AdvancedAuxiliaryMessageType + { + Information = 1, + Warning = 2, + Critical = 3 + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/IAdvancedAuxiliaries.cs b/VECTOAux/BusAuxiliaries/Interfaces/IAdvancedAuxiliaries.cs new file mode 100644 index 0000000000000000000000000000000000000000..ce122663cfab814141b6b25ece7da199520337dc --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/IAdvancedAuxiliaries.cs @@ -0,0 +1,139 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + + //public delegate void AuxiliaryEventEventHandler(ref object sender, string message, AdvancedAuxiliaryMessageType messageType); + + public interface IAdvancedAuxiliaries + { + // Inherits IAuxiliaryEvent + + event AuxiliaryEventEventHandler AuxiliaryEvent; + + // Information + bool Running { get; } + + string AuxiliaryName { get; } + string AuxiliaryVersion { get; } + + // Additional Permenent Monitoring Signals - Required by engineering + double AA_NonSmartAlternatorsEfficiency { get; } + Ampere AA_SmartIdleCurrent_Amps { get; } + double AA_SmartIdleAlternatorsEfficiency { get; } + Ampere AA_SmartTractionCurrent_Amps { get; } + double AA_SmartTractionAlternatorEfficiency { get; } + Ampere AA_SmartOverrunCurrent_Amps { get; } + double AA_SmartOverrunAlternatorEfficiency { get; } + NormLiterPerSecond AA_CompressorFlowRate_LitrePerSec { get; } + bool AA_OverrunFlag { get; } + int? AA_EngineIdleFlag { get; } + bool AA_CompressorFlag { get; } + Kilogram AA_TotalCycleFC_Grams { get; } + Liter AA_TotalCycleFC_Litres { get; } + Watt AA_AveragePowerDemandCrankHVACMechanicals { get; } + Watt AA_AveragePowerDemandCrankHVACElectricals { get; } + Watt AA_AveragePowerDemandCrankElectrics { get; } + Watt AA_AveragePowerDemandCrankPneumatics { get; } + Kilogram AA_TotalCycleFuelConsumptionCompressorOff { get; } + Kilogram AA_TotalCycleFuelConsumptionCompressorOn { get; } + + /// <summary> + /// Total Cycle Fuel In Grams + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram TotalFuelGRAMS { get; } + + /// <summary> + /// Total Cycle Fuel in Litres + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Liter TotalFuelLITRES { get; } + + /// <summary> + /// Total Power Demans At Crank From Auxuliaries (W) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt AuxiliaryPowerAtCrankWatts { get; } + + + /// <summary> + /// Vecto Inputs + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + IVectoInputs VectoInputs { get; set; } + + /// <summary> + /// Signals From Vecto + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + ISignals Signals { get; set; } + + /// <summary> + /// Configure Auxuliaries ( Launches Config Form ) + /// </summary> + /// <param name="filePath"></param> + /// <param name="vectoFilePath"></param> + /// <returns></returns> + /// <remarks></remarks> + //bool Configure(string filePath, string vectoFilePath); + + /// <summary> + /// Validate AAUX file path supplied. + /// </summary> + /// <param name="filePath"></param> + /// <param name="message"></param> + /// <returns></returns> + /// <remarks></remarks> + bool ValidateAAUXFile(string filePath, ref string message); + + // Command + /// <summary> + /// Cycle Step - Used to calculate fuelling + /// </summary> + /// <param name="seconds"></param> + /// <param name="message"></param> + /// <returns></returns> + /// <remarks></remarks> + bool CycleStep(Second seconds, ref string message); + + /// <summary> + /// Initialises AAUX Environment ( Begin Processs ) + /// </summary> + /// <param name="auxFilePath"></param> + /// <param name="vectoFilePath"></param> + /// <returns></returns> + /// <remarks></remarks> + bool RunStart(string auxFilePath, string vectoFilePath); + + /// <summary> + /// Any Termination Which Needs to be done ( Model depenent ) + /// </summary> + /// <param name="message"></param> + /// <returns></returns> + /// <remarks></remarks> + bool RunStop(ref string message); + + void ResetCalculations(); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/IAuxiliaryEvent.cs b/VECTOAux/BusAuxiliaries/Interfaces/IAuxiliaryEvent.cs new file mode 100644 index 0000000000000000000000000000000000000000..7d47c4fab46142599c234d65323b039ec21616d4 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/IAuxiliaryEvent.cs @@ -0,0 +1,21 @@ +// Copyright 2017 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. + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + public interface IAuxiliaryEvent + { + event AuxiliaryEventEventHandler AuxiliaryEvent; + + } + + + public delegate void AuxiliaryEventEventHandler(ref object sender, string message, AdvancedAuxiliaryMessageType messageType); +} \ No newline at end of file diff --git a/VECTOAux/BusAuxiliaries/Interfaces/IFuelConsumptionMap.cs b/VECTOAux/BusAuxiliaries/Interfaces/IFuelConsumptionMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..88271f2374ea16f94f63dcbc3d01b5eb94c201fd --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/IFuelConsumptionMap.cs @@ -0,0 +1,15 @@ +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + public interface IFuelConsumptionMap + { + /// <summary> + /// + /// </summary> + /// <param name="torque"></param> + /// <param name="angularVelocity"></param> + /// <returns></returns> + /// <remarks></remarks> + KilogramPerSecond GetFuelConsumption(NewtonMeter torque, PerSecond angularVelocity); + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/IM12.cs b/VECTOAux/BusAuxiliaries/Interfaces/IM12.cs new file mode 100644 index 0000000000000000000000000000000000000000..1e4390d565496f85557af8e3d8a082863c62d16d --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/IM12.cs @@ -0,0 +1,44 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces +{ + public interface IM12 : IAbstractModule + { + + /// <summary> + /// Fuel consumption with smart Electrics and Average Pneumatic Power Demand + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand { get; } + + /// <summary> + /// Base Fuel Consumption With Average Auxiliary Loads + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram BaseFuelConsumptionWithTrueAuxiliaryLoads { get; } + + /// <summary> + /// Stop Start Correction + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double StopStartCorrection { get; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/ISignals.cs b/VECTOAux/BusAuxiliaries/Interfaces/ISignals.cs new file mode 100644 index 0000000000000000000000000000000000000000..92a2a4a0bd196676dd4e852e803d38673330bd4d --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/ISignals.cs @@ -0,0 +1,185 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + public interface ISignals + { + /// <summary> + /// Pre Existing Aux Power (KW) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input</remarks> + Watt PreExistingAuxPower { get; set; } + + /// <summary> + /// Engine Motoring Power (KW) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input</remarks> + Watt EngineMotoringPower { get; set; } + + /// <summary> + /// Engine Driveline Power (KW) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt EngineDrivelinePower { get; set; } + + /// <summary> + /// Smart Electrics + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Should be true if fitted to the vehicle - AAUX Input</remarks> + bool SmartElectrics { get; set; } + + /// <summary> + /// Clucth Engaged + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input</remarks> + bool ClutchEngaged { get; set; } + + /// <summary> + /// Engine Speed 1/NU + /// </summary> + /// <value></value> + /// <returns></returns> + /// ''' + PerSecond EngineSpeed { get; set; } + + /// <summary> + /// Smart Pneumatics + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>should be true if fitted to the vehicle- AAux Config Input</remarks> + bool SmartPneumatics { get; set; } + + /// <summary> + /// Total Cycle Time In Seconds + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input</remarks> + int TotalCycleTimeSeconds { get; set; } + + /// <summary> + /// Current Cycle Time In Seconds + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>( Will Increment during Cycle )</remarks> + double CurrentCycleTimeInSeconds { get; set; } + + /// <summary> + /// Engine Driveline Torque + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input</remarks> + NewtonMeter EngineDrivelineTorque { get; set; } + + /// <summary> + /// Engine Idle + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input</remarks> + bool Idle { get; set; } + + /// <summary> + /// In Neutral + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input</remarks> + bool InNeutral { get; set; } + + /// <summary> + /// Auxiliary Event Reporting Level + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Can be used by Vecto to choose the level of reporting</remarks> + AdvancedAuxiliaryMessageType AuxiliaryEventReportingLevel { get; set; } + + /// <summary> + /// Engine Stopped + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>'Vecto Input - Used to Cut Fueling in AAux model</remarks> + bool EngineStopped { get; set; } + + /// <summary> + /// WHTC ( Correction factor to be applied ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>'Vecto Input</remarks> + double WHTC { get; set; } + + /// <summary> + /// Declaration Mode + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>Vecto Input - Used to decide if to apply WHTC/Possiblye other things in future</remarks> + bool DeclarationMode { get; set; } + + /// <summary> + /// Engine Idle Speed ( Associated with the vehicle bein tested ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + PerSecond EngineIdleSpeed { get; set; } + + /// <summary> + /// Pneumatic Overrun Utilisation + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double PneumaticOverrunUtilisation { get; set; } + + /// <summary> + /// Stored Energy Efficiency + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + double StoredEnergyEfficiency { get; set; } + + /// <summary> + /// Running Calc + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + bool RunningCalc { get; set; } + + /// <summary> + /// Running Calc + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Watt InternalEnginePower { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/IVectoInputs.cs b/VECTOAux/BusAuxiliaries/Interfaces/IVectoInputs.cs new file mode 100644 index 0000000000000000000000000000000000000000..cad879530f29075d3fdf6e0dfd92a1dc50e15834 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/IVectoInputs.cs @@ -0,0 +1,59 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + public interface IVectoInputs + { + /// <summary> + /// Vehicle Mass (KG) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Kilogram VehicleWeightKG { get; set; } + + /// <summary> + /// Cycle ( Urban, Interurban etc ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + string Cycle { get; set; } + + /// <summary> + /// PowerNet Voltage (V) Volts available on the bus by Batteries + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + Volt PowerNetVoltage { get; set; } + + /// <summary> + /// Fuel Map Used in Vecto. + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + IFuelConsumptionMap FuelMap { get; set; } + + string FuelMapFile { get; set; } + + /// <summary> + /// Fuel density used in Vecto. + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + KilogramPerCubicMeter FuelDensity { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/Signals.cs b/VECTOAux/BusAuxiliaries/Interfaces/Signals.cs new file mode 100644 index 0000000000000000000000000000000000000000..f10eecce83048e168b2c310f3b4e31bb36189219 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/Signals.cs @@ -0,0 +1,66 @@ +// Copyright 2017 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. + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + public class Signals : ISignals + { + + // Backing variables + private double _WHTCCorretion = 1; + private bool _smartElectrics; + + public bool ClutchEngaged { get; set; } + public Watt EngineDrivelinePower { get; set; } + public NewtonMeter EngineDrivelineTorque { get; set; } + public Watt EngineMotoringPower { get; set; } + public PerSecond EngineSpeed { get; set; } + + public bool SmartElectrics + { + get { + return _smartElectrics; + } + set { + _smartElectrics = value; + } + } + + public bool SmartPneumatics { get; set; } + public int TotalCycleTimeSeconds { get; set; } + public double CurrentCycleTimeInSeconds { get; set; } + public Watt PreExistingAuxPower { get; set; } + public bool Idle { get; set; } + public bool InNeutral { get; set; } + + public AdvancedAuxiliaryMessageType AuxiliaryEventReportingLevel { get; set; } + + public bool EngineStopped { get; set; } + public bool DeclarationMode { get; set; } + + public double WHTC + { + set { + _WHTCCorretion = value; + } + get { + return _WHTCCorretion; + } + } + + public PerSecond EngineIdleSpeed { get; set; } + public double PneumaticOverrunUtilisation { get; set; } + public double StoredEnergyEfficiency { get; set; } + public bool RunningCalc { get; set; } + public Watt InternalEnginePower { get; set; } + } +} diff --git a/VECTOAux/BusAuxiliaries/Interfaces/VectoInputs.cs b/VECTOAux/BusAuxiliaries/Interfaces/VectoInputs.cs new file mode 100644 index 0000000000000000000000000000000000000000..4f6339a4fa191d3de626ca3a7a14b3d840036ec0 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Interfaces/VectoInputs.cs @@ -0,0 +1,99 @@ +// Copyright 2017 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. + +using Newtonsoft.Json; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.BusAuxiliaries.Interfaces { + public class VectoInputs : IVectoInputs + { + + /// <summary> + /// Name of the Cycle ( Urban, Interurban etc ) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + public string Cycle { get; set; } + + /// <summary> + /// Vehicle Mass (KG) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + [JsonIgnore] + public Kilogram VehicleWeightKG + { + get { + return _vehicleWeight.SI<Kilogram>(); + } + set { + _vehicleWeight = value.Value(); + } + } + + [JsonProperty("VehicleWeightKG")] + private double _vehicleWeight; + + /// <summary> + /// Powernet Voltage (V) + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks>This is the power voltage available in the bus - usually 26.3 Volts</remarks> + [JsonIgnore] + public Volt PowerNetVoltage + { + get { + return _powerNetVoltage.SI<Volt>(); + } + set { + _powerNetVoltage = value.Value(); + } + } + + [JsonProperty("PowerNetVoltage")] + private double _powerNetVoltage; + + /// <summary> + /// Fuel Map Same One as used in Vecto. + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + [JsonIgnore] + public IFuelConsumptionMap FuelMap { get; set; } + + [JsonProperty("FuelMap")] + public string FuelMapFile { get; set; } + + /// <summary> + /// Fuel Density as used in Vecto. + /// </summary> + /// <value></value> + /// <returns></returns> + /// <remarks></remarks> + [JsonIgnore] + public KilogramPerCubicMeter FuelDensity + { + get { + return _fuelDensity.SI<KilogramPerCubicMeter>(); + } + set { + _fuelDensity = value.Value(); + } + } + + [JsonProperty("FuelDensity")] + private double _fuelDensity; + } +} diff --git a/VECTOAux/BusAuxiliaries/Legacy/Class1.cs b/VECTOAux/BusAuxiliaries/Legacy/Class1.cs new file mode 100644 index 0000000000000000000000000000000000000000..e51920eb4d9e71062440da4c7bf4128b2600e606 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Legacy/Class1.cs @@ -0,0 +1,192 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; +using System.Globalization; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; + +namespace TUGraz.VectoCore.BusAuxiliaries.Legacy { + public class cMAP : IFuelConsumptionMap + { + private List<float> LnU; + private List<float> LTq; + private List<float> lFC; + + private string sFilePath; + private int iMapDim; + + private cDelaunayMap FuelMap; + + private void ResetMe() + { + lFC = null; + LTq = null; + LnU = null; + iMapDim = -1; + FuelMap = new cDelaunayMap(); + } + + public bool ReadFile(bool ShowMsg = true) + { + cFile_V3 file; + string[] line; + float nU; + string MsgSrc; + + + MsgSrc = "Main/ReadInp/MAP"; + + // Reset + ResetMe(); + + // Stop if there's no file + if (sFilePath == "" || !System.IO.File.Exists(sFilePath)) + return false; + + // Open file + file = new cFile_V3(); + if (!file.OpenRead(sFilePath)) { + file = null/* TODO Change to default(_) if this is not a reference type */; + return false; + } + + // Skip Header + file.ReadLine(); + + // Initi Lists (before version check so ReadOldFormat works) + lFC = new System.Collections.Generic.List<float>(); + LTq = new System.Collections.Generic.List<float>(); + LnU = new System.Collections.Generic.List<float>(); + + try { + while (!file.EndOfFile) { + + // Line read + line = file.ReadLine(); + + // Line counter up (was reset in ResetMe) + iMapDim += 1; + + // Revolutions + nU = float.Parse(line[0], CultureInfo.InvariantCulture); + + LnU.Add(nU); + + // Power + LTq.Add(float.Parse(line[1], CultureInfo.InvariantCulture)); + + // FC + // Check sign + if (System.Convert.ToSingle(line[2]) < 0) { + file.Close(); + + return false; + } + + lFC.Add(System.Convert.ToSingle(line[2])); + } + } catch (Exception ex) { + goto lbEr; + } + + // Close file + file.Close(); + + file = null/* TODO Change to default(_) if this is not a reference type */; + + return true; + + + // ERROR-label for clean Abort + lbEr: + ; + file.Close(); + file = null/* TODO Change to default(_) if this is not a reference type */; + + return false; + } + + public bool Triangulate() + { + int i; + + string MsgSrc; + + MsgSrc = "MAP/Norm"; + + // FC Delauney + for (i = 0; i <= iMapDim; i++) + FuelMap.AddPoints(LnU[i], LTq[i], lFC[i]); + + return FuelMap.Triangulate(); + } + + + public float fFCdelaunay_Intp(float nU, float Tq) + { + float val; + + val = System.Convert.ToSingle(FuelMap.Intpol(nU, Tq)); + + if (FuelMap.ExtrapolError) + return -10000; + else + return val; + } + + + public string FilePath + { + get { + return sFilePath; + } + set { + sFilePath = value; + } + } + + public int MapDim + { + get { + return iMapDim; + } + } + + public List<float> Tq + { + get { + return LTq; + } + } + + public List<float> FC + { + get { + return lFC; + } + } + + public List<float> nU + { + get { + return LnU; + } + } + + + public KilogramPerSecond GetFuelConsumption(NewtonMeter torque, PerSecond angularVelocity) + { + return (fFCdelaunay_Intp(System.Convert.ToSingle(angularVelocity.AsRPM), System.Convert.ToSingle(torque.Value())) / 3600.0 / 1000.0).SI<KilogramPerSecond>(); + } + } +} diff --git a/VECTOAux/BusAuxiliaries/Legacy/cDelaunayMap.cs b/VECTOAux/BusAuxiliaries/Legacy/cDelaunayMap.cs new file mode 100644 index 0000000000000000000000000000000000000000..7efd9ea13bd32cff1d20b62e223ba957f7fdd2ac --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Legacy/cDelaunayMap.cs @@ -0,0 +1,476 @@ +// Copyright 2017 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. + +using System; +using System.Collections.Generic; + +namespace TUGraz.VectoCore.BusAuxiliaries.Legacy { + public class cDelaunayMap + { + public int ptDim; + + public List<dPoint> ptList; + private List<dTriangle> lDT; + private List<double[]> planes; + + public bool DualMode; + private List<dPoint> ptListXZ; + private List<double[]> planesXZ; + private List<dTriangle> lDTXZ; + + public bool ExtrapolError; + + + public cDelaunayMap() + { + ptList = new List<dPoint>(); + ptListXZ = new List<dPoint>(); + DualMode = false; + } + + public void AddPoints(double X, double Y, double Z) + { + ptList.Add(new dPoint(X, Y, Z)); + if (DualMode) + ptListXZ.Add(new dPoint(X, Z, Y)); + } + + public bool Triangulate() + { + //dTriangle tr; + dTriangulation DT; + + ptDim = ptList.Count - 1; + + // XY-triangulation + try { + DT = new dTriangulation(); + lDT = DT.Triangulate(ptList); + } catch (Exception ex) { + return false; + } + + planes = new List<double[]>(); + + foreach (var tr in lDT) + planes.Add(GetPlane(tr)); + + + // #If DEBUG Then + // Dim i As Int16 + // Debug.Print("#,x1,y1,z1,x2,y2,z2") + // i = -1 + // For Each tr In lDT + // i += 1 + // Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) + // Debug.Print(i & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) + // Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z) + // Next + // #End If + + + // XZ-triangulation + if (DualMode) { + if (ptDim != ptListXZ.Count - 1) + return false; + + try { + DT = new dTriangulation(); + lDTXZ = DT.Triangulate(ptListXZ); + } catch (Exception ex) { + return false; + } + + planesXZ = new List<double[]>(); + + foreach (var tr in lDTXZ) + planesXZ.Add(GetPlane(tr)); + } + + return true; + } + + // XY => Z Interpolation + public double Intpol(double x, double y) + { + int j; + double[] l0; + //dTriangle tr; + + ExtrapolError = false; + + // Try exact solution for IsInside() + j = -1; + foreach (var tr in lDT) { + j += 1; + if (IsInside(tr, x, y, true)) { + l0 = planes[j]; + return (l0[3] - x * l0[0] - y * l0[1]) / l0[2]; + } + } + + // Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) + j = -1; + foreach (var tr in lDT) { + j += 1; + if (IsInside(tr, x, y, false)) { + l0 = planes[j]; + return (l0[3] - x * l0[0] - y * l0[1]) / l0[2]; + } + } + + + // ERROR: Extrapolation + ExtrapolError = true; + + return default(Double); + } + + // XZ => Y Interpolation + public double IntpolXZ(double x, double z) + { + int j; + double[] l0; + //dTriangle tr; + + ExtrapolError = false; + + if (DualMode) { + j = -1; + + // Try exact solution for IsInside() + foreach (var tr in lDTXZ) { + j += 1; + if (IsInside( tr, x, z, true)) { + l0 = planesXZ[j]; + return (l0[3] - x * l0[0] - z * l0[1]) / l0[2]; + } + } + + // Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) + j = -1; + foreach (var tr in lDTXZ) { + j += 1; + if (IsInside( tr, x, z, false)) { + l0 = planesXZ[j]; + return (l0[3] - x * l0[0] - z * l0[1]) / l0[2]; + } + } + + // ERROR: Extrapolation + ExtrapolError = true; + return default(Double); + } else { + + // ERROR: Extrapolation + ExtrapolError = true; + return default(Double); + } + } + + private double[] GetPlane(dTriangle tr) + { + dPoint AB; + dPoint AC; + dPoint cross; + var l = new double[4]; + dPoint pt1; + dPoint pt2; + dPoint pt3; + + pt1 = tr.P1; + pt2 = tr.P2; + pt3 = tr.P3; + + AB = new dPoint(pt2.X - pt1.X, pt2.Y - pt1.Y, pt2.Z - pt1.Z); + AC = new dPoint(pt3.X - pt1.X, pt3.Y - pt1.Y, pt3.Z - pt1.Z); + + cross = new dPoint(AB.Y * AC.Z - AB.Z * AC.Y, AB.Z * AC.X - AB.X * AC.Z, AB.X * AC.Y - AB.Y * AC.X); + + l[0] = cross.X; + l[1] = cross.Y; + l[2] = cross.Z; + + l[3] = pt1.X * cross.X + pt1.Y * cross.Y + pt1.Z * cross.Z; + + return l; + } + + private bool IsInside(dTriangle tr, double xges, double yges, bool Exact) + { + var v0 = new double[2]; + var v1 = new double[2]; + var v2 = new double[2]; + double dot00; + double dot01; + double dot02; + double dot11; + double dot12; + double invDenom; + double u; + double v; + dPoint pt1; + dPoint pt2; + dPoint pt3; + + pt1 = tr.P1; + pt2 = tr.P2; + pt3 = tr.P3; + + // Quelle: http://www.blackpawn.com/texts/pointinpoly/default.html (Barycentric Technique) + + // Compute vectors + v0[0] = pt3.X - pt1.X; + v0[1] = pt3.Y - pt1.Y; + + v1[0] = pt2.X - pt1.X; + v1[1] = pt2.Y - pt1.Y; + + v2[0] = xges - pt1.X; + v2[1] = yges - pt1.Y; + + // Compute dot products + dot00 = v0[0] * v0[0] + v0[1] * v0[1]; + dot01 = v0[0] * v1[0] + v0[1] * v1[1]; + dot02 = v0[0] * v2[0] + v0[1] * v2[1]; + dot11 = v1[0] * v1[0] + v1[1] * v1[1]; + dot12 = v1[0] * v2[0] + v1[1] * v2[1]; + + // Compute barycentric coordinates + invDenom = 1 / (dot00 * dot11 - dot01 * dot01); + u = (dot11 * dot02 - dot01 * dot12) * invDenom; + v = (dot00 * dot12 - dot01 * dot02) * invDenom; + + // Debug.Print(u & ", " & v & ", " & u + v) + + // Check if point is in triangle + if (Exact) + return (u >= 0) & (v >= 0) & (u + v <= 1); + else + return (u >= -0.001) & (v >= -0.001) & (u + v <= 1.001); + } + + public struct dPoint + { + public double X; + public double Y; + public double Z; + + public dPoint(double xd, double yd, double zd) + { + X = xd; + Y = yd; + Z = zd; + } + + public static bool operator ==(dPoint left, dPoint right) + { + + // If DirectCast(left, Object) = DirectCast(right, Object) Then + // Return True + // End If + + // If (DirectCast(left, Object) Is Nothing) OrElse (DirectCast(right, Object) Is Nothing) Then + // Return False + // End If + + // Just compare x and y here... + if (left.X != right.X) + return false; + + if (left.Y != right.Y) + return false; + + return true; + } + + public static bool operator !=(dPoint left, dPoint right) + { + return !(left == right); + } + } + + public class dTriangle + { + public dPoint P1; + public dPoint P2; + public dPoint P3; + + public dTriangle( dPoint pp1, dPoint pp2, dPoint pp3) + { + P1 = pp1; + P2 = pp2; + P3 = pp3; + } + + public double ContainsInCircumcircle(dPoint pt) + { + var ax = this.P1.X - pt.X; + var ay = this.P1.Y - pt.Y; + var bx = this.P2.X - pt.X; + var by = this.P2.Y - pt.Y; + var cx = this.P3.X - pt.X; + var cy = this.P3.Y - pt.Y; + var det_ab = ax * by - bx * ay; + var det_bc = bx * cy - cx * by; + var det_ca = cx * ay - ax * cy; + var a_squared = ax * ax + ay * ay; + var b_squared = bx * bx + by * by; + var c_squared = cx * cx + cy * cy; + + return a_squared * det_bc + b_squared * det_ca + c_squared * det_ab; + } + + public bool SharesVertexWith(dTriangle triangle) + { + if (this.P1.X == triangle.P1.X && this.P1.Y == triangle.P1.Y) + return true; + if (this.P1.X == triangle.P2.X && this.P1.Y == triangle.P2.Y) + return true; + if (this.P1.X == triangle.P3.X && this.P1.Y == triangle.P3.Y) + return true; + + if (this.P2.X == triangle.P1.X && this.P2.Y == triangle.P1.Y) + return true; + if (this.P2.X == triangle.P2.X && this.P2.Y == triangle.P2.Y) + return true; + if (this.P2.X == triangle.P3.X && this.P2.Y == triangle.P3.Y) + return true; + + if (this.P3.X == triangle.P1.X && this.P3.Y == triangle.P1.Y) + return true; + if (this.P3.X == triangle.P2.X && this.P3.Y == triangle.P2.Y) + return true; + if (this.P3.X == triangle.P3.X && this.P3.Y == triangle.P3.Y) + return true; + + return false; + } + } + + public class dEdge + { + public dPoint StartPoint; + public dPoint EndPoint; + + public dEdge(dPoint p1, dPoint p2) + { + StartPoint = p1; + EndPoint = p2; + } + + public static bool operator ==(dEdge left, dEdge right) + { + // If DirectCast(left, Object) = DirectCast(right, Object) Then + // Return True + // End If + + // If (DirectCast(left, Object) Is Nothing) Or (DirectCast(right, Object) Is Nothing) Then + // Return False + // End If + + return ((left.StartPoint == right.StartPoint && left.EndPoint == right.EndPoint) || (left.StartPoint == right.EndPoint && left.EndPoint == right.StartPoint)); + } + + public static bool operator !=(dEdge left, dEdge right) + { + return !(left == right); + } + } + + public class dTriangulation + { + public List<dTriangle> Triangulate(List<dPoint> triangulationPoints) + { + if (triangulationPoints.Count < 3) + throw new ArgumentException("Can not triangulate less than three vertices!"); + + // The triangle list + var triangles = new List<dTriangle>(); + + + // The "supertriangle" which encompasses all triangulation points. + // This triangle initializes the algorithm and will be removed later. + var superTriangle = this.SuperTriangle(triangulationPoints); + triangles.Add(superTriangle); + + // Include each point one at a time into the existing triangulation + for (var i = 0; i <= triangulationPoints.Count - 1; i++) { + // Initialize the edge buffer. + var EdgeBuffer = new List<dEdge>(); + + // If the actual vertex lies inside the circumcircle, then the three edges of the + // triangle are added to the edge buffer and the triangle is removed from list. + for (var j = triangles.Count - 1; j >= 0; j += -1) { + var t = triangles[j]; + if (t.ContainsInCircumcircle(triangulationPoints[i]) > 0) { + EdgeBuffer.Add(new dEdge(t.P1, t.P2)); + EdgeBuffer.Add(new dEdge(t.P2, t.P3)); + EdgeBuffer.Add(new dEdge(t.P3, t.P1)); + triangles.RemoveAt(j); + } + } + + // Remove duplicate edges. This leaves the convex hull of the edges. + // The edges in this convex hull are oriented counterclockwise! + for (var j = EdgeBuffer.Count - 2; j >= 0; j += -1) { + for (var k = EdgeBuffer.Count - 1; k >= j + 1; k += -1) { + if (EdgeBuffer[j] == EdgeBuffer[k]) { + EdgeBuffer.RemoveAt(k); + EdgeBuffer.RemoveAt(j); + k -= 1; + continue; + } + } + } + + // Generate new counterclockwise oriented triangles filling the "hole" in + // the existing triangulation. These triangles all share the actual vertex. + for (var j = 0; j <= EdgeBuffer.Count - 1; j++) + triangles.Add(new dTriangle(EdgeBuffer[j].StartPoint, EdgeBuffer[j].EndPoint, triangulationPoints[i])); + } + + // We don't want the supertriangle in the triangulation, so + // remove all triangles sharing a vertex with the supertriangle. + for (var i = triangles.Count - 1; i >= 0; i += -1) { + if (triangles[i].SharesVertexWith(superTriangle)) + triangles.RemoveAt(i); + } + + // Return the triangles + return triangles; + } + + + private dTriangle SuperTriangle(List<dPoint> triangulationPoints) + { + var M = triangulationPoints[0].X; + + // get the extremal x and y coordinates + for (var i = 1; i <= triangulationPoints.Count - 1; i++) { + var xAbs = Math.Abs(triangulationPoints[i].X); + var yAbs = Math.Abs(triangulationPoints[i].Y); + if (xAbs > M) + M = xAbs; + if (yAbs > M) + M = yAbs; + } + + // make a triangle + var sp1 = new dPoint(10 * M, 0, 0); + var sp2 = new dPoint(0, 10 * M, 0); + var sp3 = new dPoint(-10 * M, -10 * M, 0); + + return new dTriangle( sp1, sp2, sp3); + } + } + } +} diff --git a/VECTOAux/BusAuxiliaries/Legacy/cFile_V3.cs b/VECTOAux/BusAuxiliaries/Legacy/cFile_V3.cs new file mode 100644 index 0000000000000000000000000000000000000000..15e41ec7f240fcb11204be453ecc644e9ffe0a06 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Legacy/cFile_V3.cs @@ -0,0 +1,175 @@ +// Copyright 2017 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. + +using System; +using System.IO; +using Microsoft.VisualBasic.FileIO; +using TUGraz.VectoCore.BusAuxiliaries.Util; + +namespace TUGraz.VectoCore.BusAuxiliaries.Legacy { + public class cFile_V3 + { + private TextFieldParser TxtFldParser; + private StreamWriter StrWrter; + private FileMode Mode; + private string Path; + private string Sepp; + private bool SkipCom; + private bool StopE; + private bool FileOpen; + private string[] PreLine; + private bool FileEnd; + + // File format + private System.Text.Encoding FileFormat = System.Text.Encoding.UTF8; + + public cFile_V3() + { + Reset(); + } + + private void Reset() + { + FileOpen = false; + Mode = FileMode.Undefined; + PreLine = null; + FileEnd = false; + } + + public bool OpenRead(string FileName, string Separator = ",", bool SkipComment = true, bool StopAtE = false) + { + Reset(); + StopE = StopAtE; + Path = FileName; + Sepp = Separator; + SkipCom = SkipComment; + if (!(Mode == FileMode.Undefined)) + return false; + if (!File.Exists(Path)) + return false; + Mode = FileMode.Read; + try { + TxtFldParser = new TextFieldParser(Path, System.Text.Encoding.Default); + FileOpen = true; + } catch (Exception ex) { + return false; + } + TxtFldParser.TextFieldType = FieldType.Delimited; + TxtFldParser.Delimiters = new string[] { Sepp }; + + // If TxtFldParser.EndOfData Then Return False + + ReadLine(); + return true; + } + + public string[] ReadLine() + { + var line = PreLine; + + lb10: + ; + if (TxtFldParser.EndOfData) { + FileEnd = true; + } else { + PreLine = TxtFldParser.ReadFields(); + var line0 = PreLine[0].Trim().ToUpper(); + + if (SkipCom) { + if (FilePathUtils.Left(line0, 1) == "#") + goto lb10; + } + + if (StopE) + FileEnd = (line0 == "E"); + } + + return line; + } + + public void Close() + { + switch (Mode) { + case FileMode.Read: { + if (FileOpen) + TxtFldParser.Close(); + TxtFldParser = null; + break; + } + + case FileMode.Write: { + if (FileOpen) + StrWrter.Close(); + StrWrter = null; + break; + } + } + Reset(); + } + + public bool EndOfFile + { + get { + return FileEnd; + } + } + + public bool OpenWrite(string FileName, string Separator = ",", bool AutoFlush = false, bool Append = false) + { + Reset(); + Path = FileName; + Sepp = Separator; + if (Mode != FileMode.Undefined) + return false; + Mode = FileMode.Write; + try { + if (!Append) { + File.Delete(Path); + } + StrWrter = new StreamWriter(File.OpenWrite(Path), FileFormat); + FileOpen = true; + } catch (Exception ex) { + return false; + } + StrWrter.AutoFlush = AutoFlush; + return true; + } + + public void WriteLine(params object[] x) + { + //string St; + var StB = new System.Text.StringBuilder(); + bool Skip; + Skip = true; + foreach (var St in x) { + if (Skip) { + StB.Append(St); + Skip = false; + } else + StB.Append(Sepp + St); + } + StrWrter.WriteLine(StB.ToString()); + StB = null; + } + + public void WriteLine(string x) + { + StrWrter.WriteLine(x); + } + + private enum FileMode + { + Undefined, + Read, + Write + } + } +} diff --git a/VECTOAux/BusAuxiliaries/Properties/AssemblyInfo.cs b/VECTOAux/BusAuxiliaries/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..902014cc5b555aee27ad5a3b12f5757f56b023fe --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BusAuxiliaries")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("BusAuxiliaries")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("550d99d4-25f7-48d9-b0f0-e5dd6cb3485d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VECTOAux/BusAuxiliaries/Resources/Blank.bmp b/VECTOAux/BusAuxiliaries/Resources/Blank.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3356cb1a16ef78415ac26ff4ddfe2ec06e7f5e1a Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/Blank.bmp differ diff --git a/VECTOAux/BusAuxiliaries/Resources/Image1.png b/VECTOAux/BusAuxiliaries/Resources/Image1.png new file mode 100644 index 0000000000000000000000000000000000000000..3e9d6ed41b4901ee2e3811ef6e85df0978acf1d2 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/Image1.png differ diff --git a/VECTOAux/BusAuxiliaries/Resources/Info.bmp b/VECTOAux/BusAuxiliaries/Resources/Info.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c87470c216723cf67cf853cec686934aee6c9c66 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/Info.bmp differ diff --git a/VECTOAux/BusAuxiliaries/Resources/Open-icon.png b/VECTOAux/BusAuxiliaries/Resources/Open-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5b25c5b924bd2a400e3b1a24887bad98d10b5ad2 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/Open-icon.png differ diff --git a/VECTOAux/BusAuxiliaries/Resources/desktop.png b/VECTOAux/BusAuxiliaries/Resources/desktop.png new file mode 100644 index 0000000000000000000000000000000000000000..59c84dc6b7c229730f174dd03f2987f674fc6e20 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/desktop.png differ diff --git a/VECTOAux/BusAuxiliaries/Resources/favorites.png b/VECTOAux/BusAuxiliaries/Resources/favorites.png new file mode 100644 index 0000000000000000000000000000000000000000..12d6fc99713d7cfe23191a759747818531d77731 Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/favorites.png differ diff --git a/VECTOAux/BusAuxiliaries/Resources/file-history.png b/VECTOAux/BusAuxiliaries/Resources/file-history.png new file mode 100644 index 0000000000000000000000000000000000000000..8dbe20e0272030574f39f5c471d48a20744f7c7d Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/file-history.png differ diff --git a/VECTOAux/BusAuxiliaries/Resources/new_dir.png b/VECTOAux/BusAuxiliaries/Resources/new_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..1035fe49b199854810d1e6d33e91dfe338d3366f Binary files /dev/null and b/VECTOAux/BusAuxiliaries/Resources/new_dir.png differ diff --git a/VECTOAux/BusAuxiliaries/Util/FilePathUtils.cs b/VECTOAux/BusAuxiliaries/Util/FilePathUtils.cs new file mode 100644 index 0000000000000000000000000000000000000000..34385bbcfe52a533710b84c94530f06bd154e556 --- /dev/null +++ b/VECTOAux/BusAuxiliaries/Util/FilePathUtils.cs @@ -0,0 +1,158 @@ +using System; +using System.IO; +using System.Linq; + +namespace TUGraz.VectoCore.BusAuxiliaries.Util { + public class FilePathUtils + { + + public static string fPATH(string path) + { + if (string.IsNullOrWhiteSpace(path) || path.Length < 3 || path.Substring(1, 2) != @":\") { + return ""; + } + + return Path.GetDirectoryName(path); + } + + public static string Left(string str, int length) + { + return str.Substring(0, Math.Min(length, str.Length)); + } + + public static string Right(string value, int length) + { + if (string.IsNullOrEmpty(value)) return string.Empty; + + return value.Length <= length ? value : value.Substring(value.Length - length); + } + + public static bool ValidateFilePath(string filePath, string expectedExtension, ref string message) + { + var illegalFileNameCharacters = new[] { '<', '>', ':', '"', '/', '\\', '|', '?', '*', '~' }; + var detectedExtention = fileExtentionOnly(filePath); + var pathOnly = filePathOnly(filePath); + var fileNameOnlyWithExtension = fileNameOnly(filePath, true); + var fileNameOnlyNoExtension = fileNameOnly(filePath, false); + + // Is this filePath empty + if (filePath.Trim().Length == 0 || Right(filePath, 1) == @"\") { + message = "A filename cannot be empty"; + return false; + } + + + // Extension Expected, but not match + if (expectedExtension.Trim().Length > 0) { + if (string.Compare(expectedExtension, detectedExtention, true) != 0) { + message = string.Format("The file extension type does not match the expected type of {0}", expectedExtension); + return false; + } + } + + // Extension Not Expected, but was supplied + if (expectedExtension.Trim().Length > 0) { + if (detectedExtention.Length == 0) { + message = string.Format("No Extension was supplied, but an extension of {0}, this is not required", detectedExtention); + return false; + } + } + + + // Illegal characters + if (!fileNameLegal(fileNameOnlyWithExtension)) { + message = string.Format("The filenames have one or more illegal characters"); + return false; + } + + + message = "OK"; + return true; + } + + + public static bool fileNameLegal(string fileName) + { + var illegalFileNameCharacters = new[] { '<', '>', ':', '"', '/', '\\', '|', '?', '*', '~' }; + + + // Illegal characters + foreach (var ch in illegalFileNameCharacters) { + if (fileName.Contains(ch)) + return false; + } + return true; + } + + + public static string ResolveFilePath(string vectoPath, string filename) + { + + // No Vecto Path supplied + if (string.IsNullOrEmpty(vectoPath)) + return filename; + + // This is not relative + if (filename.Contains(@":\")) + + // Filepath is already absolute + return filename; + else + return Path.Combine(vectoPath, filename);// vectoPath & filename + } + + + /// <summary> + /// ''' File name without the path "C:\temp\TEST.txt" >> "TEST.txt" oder "TEST" + /// ''' </summary> + /// ''' <param name="filePath"></param> + /// ''' <param name="WithExtention"></param> + /// ''' <returns>Return file portion of the path, with or without the extension</returns> + /// ''' <remarks></remarks> + public static string fileNameOnly(string filePath, bool WithExtention) + { + int x; + x = filePath.LastIndexOf(@"\") + 1; + filePath = Right(filePath, filePath.Length - x); + if (!WithExtention) { + x = filePath.LastIndexOf("."); + if (x > 0) + filePath = Left(filePath, x); + } + return filePath; + } + + + /// <summary> + /// ''' Extension alone "C:\temp\TEST.txt" >> ".txt" + /// ''' </summary> + /// ''' <param name="filePath"></param> + /// ''' <returns>Extension alone Including the dot IE .EXT</returns> + /// ''' <remarks></remarks> + public static string fileExtentionOnly(string filePath) + { + int x; + x = filePath.LastIndexOf("."); + if (x == -1) + return ""; + else + return Right(filePath, filePath.Length - x); + } + + /// <summary> + /// ''' File Path alone "C:\temp\TEST.txt" >> "C:\temp\" + /// ''' "TEST.txt" >> "" + /// ''' </summary> + /// ''' <param name="filePath"></param> + /// ''' <returns>Filepath without the extension</returns> + /// ''' <remarks></remarks> + public static string filePathOnly(string filePath) + { + int x; + if (filePath == null || filePath.Length < 3 || filePath.Substring(1, 2) != @":\") + return ""; + x = filePath.LastIndexOf(@"\"); + return Left(filePath, x + 1); + } + } +} diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/packages.config b/VECTOAux/BusAuxiliaries/packages.config similarity index 59% rename from VectoCommon/AdvancedAuxiliaryInterfaces/packages.config rename to VECTOAux/BusAuxiliaries/packages.config index 6b50e260edc83ddef1ec196b286e143c4e2867d9..5abf7ccb21f8613504587c35d5b41acc009f5c35 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/packages.config +++ b/VECTOAux/BusAuxiliaries/packages.config @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net40" requireReinstallation="True" /> + <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> + <package id="ValueInjecter" version="3.1.1.5" targetFramework="net45" /> </packages> \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb index 9cd035d9f5bfa51cc7c6cf9f02303112f43f2aff..6a8179abeacce62a53449da114ed87a079c57884 100644 --- a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb +++ b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb @@ -10,15 +10,23 @@ ' See the LICENSE.txt for the specific language governing permissions and limitations. Imports System.Runtime.CompilerServices -Imports VectoAuxiliaries Imports VectoAuxiliaries.Electrics Imports VectoAuxiliaries.Pneumatics Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules Imports System.Windows.Forms +Imports DownstreamModules +Imports DownstreamModules.Electrics +Imports Electrics +Imports Hvac +Imports Pneumatics Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces -<Assembly: InternalsVisibleTo("VectoCore")> +<Assembly: InternalsVisibleTo("VectoCore")> ''' <summary> ''' Main entry point for the advanced auxiliary module. @@ -26,452 +34,471 @@ Imports TUGraz.VectoCommon.Utils ''' </summary> ''' <remarks></remarks> Public Class AdvancedAuxiliaries - Implements IAdvancedAuxiliaries + Implements IAdvancedAuxiliaries - Protected Friend auxConfig As AuxiliaryConfig + Protected Friend auxConfig As AuxiliaryConfig - 'Supporting classes which may generate event messages - Private WithEvents compressorMap As ICompressorMap + 'Supporting classes which may generate event messages + Private WithEvents compressorMap As ICompressorMap - Private WithEvents ssmTool As SSMTOOL - Private WithEvents ssmToolModule14 As SSMTOOL + Private WithEvents ssmTool As SSMTOOL + Private WithEvents ssmToolModule14 As SSMTOOL - Private WithEvents alternatorMap As IAlternatorMap - Protected Friend WithEvents actuationsMap As IPneumaticActuationsMAP - Private fuelMap As IFuelConsumptionMap + Private WithEvents alternatorMap As IAlternatorMap + Protected Friend WithEvents actuationsMap As IPneumaticActuationsMAP + Private fuelMap As IFuelConsumptionMap - 'Classes which compose the model. - Private WithEvents M0 As IM0_NonSmart_AlternatorsSetEfficiency - Private WithEvents M05 As IM0_5_SmartAlternatorSetEfficiency - Private WithEvents M1 As IM1_AverageHVACLoadDemand - Private WithEvents M2 As IM2_AverageElectricalLoadDemand - Private WithEvents M3 As IM3_AveragePneumaticLoadDemand - Private WithEvents M4 As IM4_AirCompressor - Private WithEvents M5 As IM5_SmartAlternatorSetGeneration - Private WithEvents M6 As IM6 - Private WithEvents M7 As IM7 - Private WithEvents M8 As IM8 - Private WithEvents M9 As IM9 - Private WithEvents M10 As IM10 - Private WithEvents M11 As IM11 - Private WithEvents M12 As IM12 - Private WithEvents M13 As IM13 - Private WithEvents M14 As IM14 + 'Classes which compose the model. + Private WithEvents M0 As IM0_NonSmart_AlternatorsSetEfficiency + Private WithEvents M05 As IM0_5_SmartAlternatorSetEfficiency + Private WithEvents M1 As IM1_AverageHVACLoadDemand + Private WithEvents M2 As IM2_AverageElectricalLoadDemand + Private WithEvents M3 As IM3_AveragePneumaticLoadDemand + Private WithEvents M4 As IM4_AirCompressor + Private WithEvents M5 As IM5_SmartAlternatorSetGeneration + Private WithEvents M6 As IM6 + Private WithEvents M7 As IM7 + Private WithEvents M8 As IM8 + Private WithEvents M9 As IM9 + Private WithEvents M10 As IM10 + Private WithEvents M11 As IM11 + Private WithEvents M12 As IM12 + Private WithEvents M13 As IM13 + Private WithEvents M14 As IM14 - Private vectoDirectory As String + Private vectoDirectory As String - Private hvacConstants As HVACConstants + Private hvacConstants As HVACConstants - 'Event Handler top level bubble. - Public Sub VectoEventHandler(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Handles compressorMap.AuxiliaryEvent, alternatorMap.AuxiliaryEvent, ssmTool.Message, ssmToolModule14.Message + 'Event Handler top level bubble. + 'Public Sub VectoEventHandler(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + ' Handles compressorMap.AuxiliaryEvent, alternatorMap.AuxiliaryEvent, ssmTool.Message, ssmToolModule14.Message - If Signals.AuxiliaryEventReportingLevel <= messageType Then + ' If Signals.AuxiliaryEventReportingLevel <= messageType Then - RaiseEvent AuxiliaryEvent(sender, message, messageType) + ' RaiseEvent AuxiliaryEvent(sender, message, messageType) - End If - End Sub + ' End If + 'End Sub - 'Constructor - Public Sub New() + 'Constructor + Public Sub New() - VectoInputs = New VectoInputs() - Signals = New Signals() - End Sub + VectoInputs = New VectoInputs() + Signals = New Signals() + End Sub - 'Initialise Model - Public Sub Initialise(IAuxPath As String, vectoFilePath As String) + 'Initialise Model + Public Sub Initialise(IAuxPath As String, vectoFilePath As String) - Dim auxPath As String - vectoDirectory = fPATH(vectoFilePath) + Dim auxPath As String + vectoDirectory = fPATH(vectoFilePath) - auxPath = FilePathUtils.ResolveFilePath(vectoDirectory, IAuxPath) + auxPath = FilePathUtils.ResolveFilePath(vectoDirectory, IAuxPath) - hvacConstants = New HVACConstants(VectoInputs.FuelDensity) + hvacConstants = New HVACConstants(VectoInputs.FuelDensity) + + Signals.CurrentCycleTimeInSeconds = 0 + auxConfig = New AuxiliaryConfig(auxPath) + + 'Pass some signals from config to Signals. ( These are stored in the configuration but shared in the signal distribution around modules ) + Signals.SmartElectrics = auxConfig.ElectricalUserInputsConfig.SmartElectrical + Signals.StoredEnergyEfficiency = auxConfig.ElectricalUserInputsConfig.StoredEnergyEfficiency + Signals.SmartPneumatics = auxConfig.PneumaticUserInputsConfig.SmartAirCompression + Signals.PneumaticOverrunUtilisation = + auxConfig.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction + + alternatorMap = New CombinedAlternator( + FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.ElectricalUserInputsConfig.AlternatorMap), Signals) + + actuationsMap = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.PneumaticUserInputsConfig. + ActuationsMap)) + + compressorMap = New CompressorMap(FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.PneumaticUserInputsConfig. + CompressorMap)) + compressorMap.Initialise() + + 'fuelMap = New cMAP() + 'fuelMap.FilePath = FilePathUtils.ResolveFilePath(vectoDirectory, VectoInputs.FuelMap) + 'If Not fuelMap.ReadFile() Then + ' MessageBox.Show("Unable to read fuel map, aborting.") + ' Return + 'End If + 'fuelMap.Triangulate() + fuelMap = VectoInputs.FuelMap + + auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.DoorDutyCycleFraction = GetDoorActuationTimeFraction() + + 'SSM HVAC + Dim ssmPath As String = FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.HvacUserInputsConfig.SSMFilePath) + Dim BusDatabase As String = FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.HvacUserInputsConfig.BusDatabasePath) + ssmTool = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) + + 'This duplicate SSM is being created for use in M14 as its properties will be dynamically changed at that point + 'to honour EngineWaste Heat Usage in Fueling calculations. + ssmToolModule14 = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) + + + If (ssmTool.Load(ssmPath) = False OrElse ssmToolModule14.Load(ssmPath) = False) Then + + Throw New Exception(String.Format("Unable to load the ssmTOOL with file {0}", ssmPath)) + + End If + + + M0 = New M00Impl(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, + alternatorMap, + auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI (Of Volt), + Signals, + ssmTool) + + + Dim M05tmp As IM0_5_SmartAlternatorSetEfficiency = New M0_5Impl(M0, + auxConfig.ElectricalUserInputsConfig. + ElectricalConsumers, + alternatorMap, + auxConfig.ElectricalUserInputsConfig. + ResultCardIdle, + auxConfig.ElectricalUserInputsConfig. + ResultCardTraction, + auxConfig.ElectricalUserInputsConfig. + ResultCardOverrun, Signals) + M05 = M05tmp - Signals.CurrentCycleTimeInSeconds = 0 - auxConfig = New AuxiliaryConfig(auxPath) + M1 = New M01Impl(M0, + auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, + auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, + auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI (Of Volt), + Signals, + ssmTool) - 'Pass some signals from config to Signals. ( These are stored in the configuration but shared in the signal distribution around modules ) - Signals.SmartElectrics = auxConfig.ElectricalUserInputsConfig.SmartElectrical - Signals.StoredEnergyEfficiency = auxConfig.ElectricalUserInputsConfig.StoredEnergyEfficiency - Signals.SmartPneumatics = auxConfig.PneumaticUserInputsConfig.SmartAirCompression - Signals.PneumaticOverrunUtilisation = auxConfig.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction - alternatorMap = New CombinedAlternator( - FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.ElectricalUserInputsConfig.AlternatorMap), Signals) - - actuationsMap = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.PneumaticUserInputsConfig.ActuationsMap)) - - compressorMap = New CompressorMap(FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.PneumaticUserInputsConfig.CompressorMap)) - compressorMap.Initialise() - - 'fuelMap = New cMAP() - 'fuelMap.FilePath = FilePathUtils.ResolveFilePath(vectoDirectory, VectoInputs.FuelMap) - 'If Not fuelMap.ReadFile() Then - ' MessageBox.Show("Unable to read fuel map, aborting.") - ' Return - 'End If - 'fuelMap.Triangulate() - fuelMap = VectoInputs.FuelMap - - auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.DoorDutyCycleFraction = GetDoorActuationTimeFraction() - - 'SSM HVAC - Dim ssmPath As String = FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.HvacUserInputsConfig.SSMFilePath) - Dim BusDatabase As String = FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.HvacUserInputsConfig.BusDatabasePath) - ssmTool = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) - - 'This duplicate SSM is being created for use in M14 as its properties will be dynamically changed at that point - 'to honour EngineWaste Heat Usage in Fueling calculations. - ssmToolModule14 = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) - - - If (ssmTool.Load(ssmPath) = False OrElse ssmToolModule14.Load(ssmPath) = False) Then - - Throw New Exception(String.Format("Unable to load the ssmTOOL with file {0}", ssmPath)) - - End If - - - M0 = New M0_NonSmart_AlternatorsSetEfficiency(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, - alternatorMap, - auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), - Signals, - ssmTool) - - - Dim M05tmp As M0_5_SmartAlternatorSetEfficiency = New M0_5_SmartAlternatorSetEfficiency(M0, - auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, - alternatorMap, - auxConfig.ElectricalUserInputsConfig.ResultCardIdle, - auxConfig.ElectricalUserInputsConfig.ResultCardTraction, - auxConfig.ElectricalUserInputsConfig.ResultCardOverrun, Signals) - M05 = M05tmp - - M1 = New M1_AverageHVACLoadDemand(M0, - auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, - auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, - auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), - Signals, - ssmTool) - - - M2 = New M2_AverageElectricalLoadDemand(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, - M0, - auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, - auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), Signals) - - - M3 = New M3_AveragePneumaticLoadDemand(auxConfig.PneumaticUserInputsConfig, - auxConfig.PneumaticAuxillariesConfig, - actuationsMap, - compressorMap, - VectoInputs.VehicleWeightKG, - VectoInputs.Cycle, - Signals) - - M4 = New M4_AirCompressor(compressorMap, auxConfig.PneumaticUserInputsConfig.CompressorGearRatio, - auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, Signals) - M5 = New M5__SmartAlternatorSetGeneration(M05tmp, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), - auxConfig.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, auxConfig.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(M10, M11, M12, Signals) - M14 = New M14(M13, ssmToolModule14, hvacConstants, Signals) - End Sub + M2 = New M02Impl(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, + M0, + auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, + auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI (Of Volt), Signals) + + + M3 = New M03Impl(auxConfig.PneumaticUserInputsConfig, + auxConfig.PneumaticAuxillariesConfig, + actuationsMap, + compressorMap, + VectoInputs.VehicleWeightKG, + VectoInputs.Cycle, + Signals) + + M4 = New M04Impl(compressorMap, auxConfig.PneumaticUserInputsConfig.CompressorGearRatio, + auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, Signals) + M5 = New M05Impl(M05tmp, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI (Of Volt), + auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency) + M6 = New M06Impl(M1, M2, M3, M4, M5, Signals) + M7 = New M07Impl(M5, M6, Signals) + M8 = New M08Impl(M1, M6, M7, Signals) + M9 = New M09Impl(M1, M4, M6, M8, fuelMap, auxConfig.PneumaticAuxillariesConfig, Signals) + M10 = New M10Impl(M3, M9, Signals) + M11 = New M11Impl(M1, M3, M6, M8, fuelMap, Signals) + M12 = New M12Impl(M10, M11, Signals) + M13 = New M13Impl(M10, M11, M12, Signals) + M14 = New M14Impl(M13, ssmToolModule14, hvacConstants, Signals) + End Sub #Region "Interface implementation" - Public Property Signals As ISignals Implements IAdvancedAuxiliaries.Signals - Public Property VectoInputs As IVectoInputs Implements IAdvancedAuxiliaries.VectoInputs + Public Property Signals As ISignals Implements IAdvancedAuxiliaries.Signals + Public Property VectoInputs As IVectoInputs Implements IAdvancedAuxiliaries.VectoInputs + + Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + Implements IAdvancedAuxiliaries.AuxiliaryEvent - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAdvancedAuxiliaries.AuxiliaryEvent + Public Function Configure(filePath As String, vectoFilePath As String) As Boolean _ + Implements IAdvancedAuxiliaries.Configure - Public Function Configure(filePath As String, vectoFilePath As String) As Boolean _ - Implements VectoAuxiliaries.IAdvancedAuxiliaries.Configure + Try - Try + Dim frmAuxiliaryConfig As New frmAuxiliaryConfig(filePath, vectoFilePath) - Dim frmAuxiliaryConfig As New frmAuxiliaryConfig(filePath, vectoFilePath) + frmAuxiliaryConfig.Show() - frmAuxiliaryConfig.Show() + If frmAuxiliaryConfig.DialogResult <> DialogResult.OK Then - If frmAuxiliaryConfig.DialogResult <> DialogResult.OK Then + Return True - Return True + Else - Else + Return False - Return False + End If - End If + Catch ex As Exception - Catch ex As Exception + Return False - Return False + Return False - Return False + End Try - End Try + Return True + End Function - Return True - End Function + Public Function CycleStep(seconds As Second, ByRef message As String) As Boolean _ + Implements IAdvancedAuxiliaries.CycleStep - Public Function CycleStep(seconds As Second, ByRef message As String) As Boolean _ - Implements VectoAuxiliaries.IAdvancedAuxiliaries.CycleStep + Try + M9.CycleStep(seconds) + M10.CycleStep(seconds) + M11.CycleStep(seconds) - Try - M9.CycleStep(seconds) - M10.CycleStep(seconds) - M11.CycleStep(seconds) + Signals.CurrentCycleTimeInSeconds += seconds.Value() + Catch ex As Exception + MessageBox.Show("Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace) + Return False + End Try - Signals.CurrentCycleTimeInSeconds += seconds.Value() - Catch ex As Exception - MessageBox.Show("Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace) - Return False - End Try + Return True + End Function - Return True - End Function + Public ReadOnly Property Running As Boolean Implements IAdvancedAuxiliaries.Running + Get + Throw New NotImplementedException + End Get + End Property - Public ReadOnly Property Running As Boolean Implements VectoAuxiliaries.IAdvancedAuxiliaries.Running - Get - Throw New NotImplementedException - End Get - End Property + Public Function RunStart(ByVal auxFilePath As String, ByVal vectoFilePath As String) As Boolean _ + Implements IAdvancedAuxiliaries.RunStart - Public Function RunStart(ByVal auxFilePath As String, ByVal vectoFilePath As String) As Boolean _ - Implements VectoAuxiliaries.IAdvancedAuxiliaries.RunStart + Try - Try + Initialise(auxFilePath, vectoFilePath) - Initialise(auxFilePath, vectoFilePath) + Catch ex As Exception - Catch ex As Exception + Return False - Return False + End Try - End Try + Return True + End Function - Return True - End Function + Public Function RunStop(ByRef message As String) As Boolean Implements IAdvancedAuxiliaries.RunStop + Throw New NotImplementedException + End Function - Public Function RunStop(ByRef message As String) As Boolean Implements VectoAuxiliaries.IAdvancedAuxiliaries.RunStop - Throw New NotImplementedException - End Function + Public Sub IAdvancedAuxiliaries_ResetCalculations() Implements IAdvancedAuxiliaries.ResetCalculations + Dim modules As List(Of IAbstractModule) = New List(Of IAbstractModule)() From { + M0, M05, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14} + For Each moduel As IAbstractModule In modules + moduel.ResetCalculations() + Next + End Sub - Public ReadOnly Property TotalFuelGRAMS As Kilogram Implements VectoAuxiliaries.IAdvancedAuxiliaries.TotalFuelGRAMS - Get - If Not M13 Is Nothing Then - Return M14.TotalCycleFCGrams - Else - Return 0.SI(Of Kilogram)() - End If - End Get - End Property + Public ReadOnly Property TotalFuelGRAMS As Kilogram Implements IAdvancedAuxiliaries.TotalFuelGRAMS + Get + If Not M13 Is Nothing Then + Return M14.TotalCycleFCGrams + Else + Return 0.SI (Of Kilogram)() + End If + End Get + End Property - Public ReadOnly Property TotalFuelLITRES As Liter Implements VectoAuxiliaries.IAdvancedAuxiliaries.TotalFuelLITRES - Get - If Not M14 Is Nothing Then - Return M14.TotalCycleFCLitres - Else - Return 0.SI(Of Liter)() - End If - End Get - End Property + Public ReadOnly Property TotalFuelLITRES As Liter Implements IAdvancedAuxiliaries.TotalFuelLITRES + Get + If Not M14 Is Nothing Then + Return M14.TotalCycleFCLitres + Else + Return 0.SI (Of Liter)() + End If + End Get + End Property - Public ReadOnly Property AuxiliaryName As String Implements VectoAuxiliaries.IAdvancedAuxiliaries.AuxiliaryName - Get - Return "BusAuxiliaries" - End Get - End Property + Public ReadOnly Property AuxiliaryName As String Implements IAdvancedAuxiliaries.AuxiliaryName + Get + Return "BusAuxiliaries" + End Get + End Property - Public ReadOnly Property AuxiliaryVersion As String Implements VectoAuxiliaries.IAdvancedAuxiliaries.AuxiliaryVersion - Get - Return "Version 1.0 Beta" - End Get - End Property + Public ReadOnly Property AuxiliaryVersion As String Implements IAdvancedAuxiliaries.AuxiliaryVersion + Get + Return "Version 1.0 Beta" + End Get + End Property #End Region - 'Helpers - Private Function GetDoorActuationTimeFraction() As Single - - Dim actuationsMap As PneumaticActuationsMAP = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.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 = auxConfig.ElectricalUserInputsConfig.DoorActuationTimeSecond - - Dim doorDutyCycleFraction As Single = (numActuations * secondsPerActuation) / Signals.TotalCycleTimeSeconds - - Return doorDutyCycleFraction - End Function - - Public Function ValidateAAUXFile(filePath As String, ByRef message As String) As Boolean _ - Implements IAdvancedAuxiliaries.ValidateAAUXFile - - - Dim validResult As Boolean = FilePathUtils.ValidateFilePath(filePath, ".aaux", message) - - If Not validResult Then Return False - - - Return True - End Function - - 'Diagnostics outputs for testing purposes in Vecto. - 'Eventually this can be removed or rendered non effective to reduce calculation load on the model. - Public ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_NonSmartAlternatorsEfficiency - Get - Return M0.AlternatorsEfficiency - End Get - End Property - - Public ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere Implements IAdvancedAuxiliaries.AA_SmartIdleCurrent_Amps - Get - Return M05.SmartIdleCurrent - End Get - End Property - - Public ReadOnly Property AA_SmartIdleAlternatorsEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_SmartIdleAlternatorsEfficiency - Get - Return M05.AlternatorsEfficiencyIdleResultCard - End Get - End Property - - Public ReadOnly Property AA_SmartTractionCurrent_Amps As Ampere _ - Implements IAdvancedAuxiliaries.AA_SmartTractionCurrent_Amps - Get - Return M05.SmartTractionCurrent - End Get - End Property - - Public ReadOnly Property AA_SmartTractionAlternatorEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_SmartTractionAlternatorEfficiency - Get - Return M05.AlternatorsEfficiencyTractionOnResultCard - End Get - End Property - - Public ReadOnly Property AA_SmartOverrunCurrent_Amps As Ampere _ - Implements IAdvancedAuxiliaries.AA_SmartOverrunCurrent_Amps - Get - Return M05.SmartOverrunCurrent - End Get - End Property - - Public ReadOnly Property AA_SmartOverrunAlternatorEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_SmartOverrunAlternatorEfficiency - Get - Return M05.AlternatorsEfficiencyOverrunResultCard - End Get - End Property - - Public ReadOnly Property AA_CompressorFlowRate_LitrePerSec As NormLiterPerSecond _ - Implements IAdvancedAuxiliaries.AA_CompressorFlowRate_LitrePerSec - Get - Return M4.GetFlowRate - End Get - End Property - - Public ReadOnly Property AA_OverrunFlag As Boolean Implements IAdvancedAuxiliaries.AA_OverrunFlag - Get - Return M6.OverrunFlag - End Get - End Property - - Public ReadOnly Property AA_EngineIdleFlag As Integer? Implements IAdvancedAuxiliaries.AA_EngineIdleFlag - Get - - Return _ - If _ - (Signals.EngineSpeed <= _Signals.EngineIdleSpeed AndAlso (Not Signals.ClutchEngaged OrElse Signals.InNeutral), 1, 0) - End Get - End Property - - Public ReadOnly Property AA_CompressorFlag As Boolean Implements IAdvancedAuxiliaries.AA_CompressorFlag - Get - Return M8.CompressorFlag - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFC_Grams As Kilogram Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Grams - Get - Return M14.TotalCycleFCGrams - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFC_Litres As Liter Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Litres - Get - Return M14.TotalCycleFCLitres - End Get - End Property - - Public ReadOnly Property AuxiliaryPowerAtCrankWatts As Watt _ - Implements IAdvancedAuxiliaries.AuxiliaryPowerAtCrankWatts - Get - Return M8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankHVACMechanicals As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACMechanicals - Get - Return M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts() - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankHVACElectricals As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACElectricals - Get - Return M1.AveragePowerDemandAtCrankFromHVACElectricsWatts() - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankElectrics As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankElectrics - Get - Return M2.GetAveragePowerAtCrankFromElectrics() - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankPneumatics As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankPneumatics - Get - Return M3.GetAveragePowerDemandAtCrankFromPneumatics() - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOff As Kilogram _ - Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOff - Get - Return M9.TotalCycleFuelConsumptionCompressorOffContinuously - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOn As Kilogram _ - Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOn - Get - Return M9.TotalCycleFuelConsumptionCompressorOnContinuously - End Get - End Property + 'Helpers + Private Function GetDoorActuationTimeFraction() As Single + + Dim actuationsMap As PneumaticActuationsMAP = + New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.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 = auxConfig.ElectricalUserInputsConfig.DoorActuationTimeSecond + + Dim doorDutyCycleFraction As Single = (numActuations*secondsPerActuation)/Signals.TotalCycleTimeSeconds + + Return doorDutyCycleFraction + End Function + + Public Function ValidateAAUXFile(filePath As String, ByRef message As String) As Boolean _ + Implements IAdvancedAuxiliaries.ValidateAAUXFile + + + Dim validResult As Boolean = FilePathUtils.ValidateFilePath(filePath, ".aaux", message) + + If Not validResult Then Return False + + + Return True + End Function + + 'Diagnostics outputs for testing purposes in Vecto. + 'Eventually this can be removed or rendered non effective to reduce calculation load on the model. + Public ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_NonSmartAlternatorsEfficiency + Get + Return M0.AlternatorsEfficiency + End Get + End Property + + Public ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere Implements IAdvancedAuxiliaries.AA_SmartIdleCurrent_Amps + Get + Return M05.SmartIdleCurrent + End Get + End Property + + Public ReadOnly Property AA_SmartIdleAlternatorsEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_SmartIdleAlternatorsEfficiency + Get + Return M05.AlternatorsEfficiencyIdleResultCard + End Get + End Property + + Public ReadOnly Property AA_SmartTractionCurrent_Amps As Ampere _ + Implements IAdvancedAuxiliaries.AA_SmartTractionCurrent_Amps + Get + Return M05.SmartTractionCurrent + End Get + End Property + + Public ReadOnly Property AA_SmartTractionAlternatorEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_SmartTractionAlternatorEfficiency + Get + Return M05.AlternatorsEfficiencyTractionOnResultCard + End Get + End Property + + Public ReadOnly Property AA_SmartOverrunCurrent_Amps As Ampere _ + Implements IAdvancedAuxiliaries.AA_SmartOverrunCurrent_Amps + Get + Return M05.SmartOverrunCurrent + End Get + End Property + + Public ReadOnly Property AA_SmartOverrunAlternatorEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_SmartOverrunAlternatorEfficiency + Get + Return M05.AlternatorsEfficiencyOverrunResultCard + End Get + End Property + + Public ReadOnly Property AA_CompressorFlowRate_LitrePerSec As NormLiterPerSecond _ + Implements IAdvancedAuxiliaries.AA_CompressorFlowRate_LitrePerSec + Get + Return M4.GetFlowRate + End Get + End Property + + Public ReadOnly Property AA_OverrunFlag As Boolean Implements IAdvancedAuxiliaries.AA_OverrunFlag + Get + Return M6.OverrunFlag + End Get + End Property + + Public ReadOnly Property AA_EngineIdleFlag As Integer? Implements IAdvancedAuxiliaries.AA_EngineIdleFlag + Get + + Return _ + If _ + ( + Signals.EngineSpeed <= _Signals.EngineIdleSpeed AndAlso + (Not Signals.ClutchEngaged OrElse Signals.InNeutral), 1, 0) + End Get + End Property + + Public ReadOnly Property AA_CompressorFlag As Boolean Implements IAdvancedAuxiliaries.AA_CompressorFlag + Get + Return M8.CompressorFlag + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFC_Grams As Kilogram Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Grams + Get + Return M14.TotalCycleFCGrams + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFC_Litres As Liter Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Litres + Get + Return M14.TotalCycleFCLitres + End Get + End Property + + Public ReadOnly Property AuxiliaryPowerAtCrankWatts As Watt _ + Implements IAdvancedAuxiliaries.AuxiliaryPowerAtCrankWatts + Get + Return M8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankHVACMechanicals As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACMechanicals + Get + Return M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts() + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankHVACElectricals As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACElectricals + Get + Return M1.AveragePowerDemandAtCrankFromHVACElectricsWatts() + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankElectrics As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankElectrics + Get + Return M2.GetAveragePowerAtCrankFromElectrics() + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankPneumatics As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankPneumatics + Get + Return M3.GetAveragePowerDemandAtCrankFromPneumatics() + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOff As Kilogram _ + Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOff + Get + Return M9.TotalCycleFuelConsumptionCompressorOffContinuously + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOn As Kilogram _ + Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOn + Get + Return M9.TotalCycleFuelConsumptionCompressorOnContinuously + End Get + End Property End Class diff --git a/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb b/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb index 0478e8fff63a4f9a3e46691d73ef821d4084501b..b79a10ba6e2c645f9b5800d939224c35c05b1cf8 100644 --- a/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb +++ b/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb @@ -13,438 +13,444 @@ Imports VectoAuxiliaries.Electrics Imports VectoAuxiliaries.Pneumatics Imports VectoAuxiliaries.Hvac Imports System.IO -Imports VectoAuxiliaries.DownstreamModules Imports System.Windows.Forms Imports Newtonsoft.Json Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem +Imports TUGraz.VectoCore.BusAuxiliaries.Legacy <Serializable()> Public Class AuxiliaryConfig - Implements IAuxiliaryConfig + Implements IAuxiliaryConfig - 'Vecto - Public Property VectoInputs As IVectoInputs Implements IAuxiliaryConfig.VectoInputs + 'Vecto + Public Property VectoInputs As IVectoInputs Implements IAuxiliaryConfig.VectoInputs - 'Electrical - Public Property ElectricalUserInputsConfig As IElectricsUserInputsConfig _ - Implements IAuxiliaryConfig.ElectricalUserInputsConfig + 'Electrical + Public Property ElectricalUserInputsConfig As IElectricsUserInputsConfig _ + Implements IAuxiliaryConfig.ElectricalUserInputsConfig - 'Pneumatics - Public Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig _ - Implements IAuxiliaryConfig.PneumaticUserInputsConfig + 'Pneumatics + Public Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig _ + Implements IAuxiliaryConfig.PneumaticUserInputsConfig - Public Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig _ - Implements IAuxiliaryConfig.PneumaticAuxillariesConfig + Public Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig _ + Implements IAuxiliaryConfig.PneumaticAuxillariesConfig - 'Hvac - Public Property HvacUserInputsConfig As IHVACUserInputsConfig Implements IAuxiliaryConfig.HvacUserInputsConfig + 'Hvac + Public Property HvacUserInputsConfig As IHVACUserInputsConfig Implements IAuxiliaryConfig.HvacUserInputsConfig - 'Vecto Signals - <JsonIgnore> - Public Property Signals As ISignals + 'Vecto Signals + <JsonIgnore> + Public Property Signals As ISignals - 'Constructors - Sub New() + 'Constructors + Sub New() - Call Me.New("EMPTY") - End Sub + Call Me.New("EMPTY") + End Sub - Public Sub New(auxConfigFile As String) + Public Sub New(auxConfigFile As String) - 'Special Condition - If auxConfigFile = "EMPTY" Then - ElectricalUserInputsConfig = New ElectricsUserInputsConfig() With {.PowerNetVoltage = 28.3} - ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.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(String.Empty, String.Empty, False) - Exit Sub + 'Special Condition + If auxConfigFile = "EMPTY" Then + ElectricalUserInputsConfig = New ElectricsUserInputsConfig() With {.PowerNetVoltage = 28.3} + ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.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(String.Empty, String.Empty, False) + Exit Sub - End If + End If - If auxConfigFile Is Nothing OrElse auxConfigFile.Trim().Length = 0 OrElse Not File.Exists(auxConfigFile) Then + If auxConfigFile Is Nothing OrElse auxConfigFile.Trim().Length = 0 OrElse Not File.Exists(auxConfigFile) Then - setDefaults() + setDefaults() - Else + Else - setDefaults() + setDefaults() - If Not Load(auxConfigFile) Then - MessageBox.Show(String.Format("Unable to load file {0}", auxConfigFile)) - End If + If Not Load(auxConfigFile) Then + MessageBox.Show(String.Format("Unable to load file {0}", auxConfigFile)) + End If - End If - End Sub + End If + End Sub - 'Set Default Values - Private Sub setDefaults() + 'Set Default Values + Private Sub setDefaults() - Dim tmp As VectoInputs = New VectoInputs _ - With {.Cycle = "Urban", .VehicleWeightKG = 16500.SI(Of Kilogram)(), .PowerNetVoltage = 28.3.SI(Of Volt)()} - VectoInputs = tmp - Signals = New Signals With {.EngineSpeed = 2000.RPMtoRad(), .TotalCycleTimeSeconds = 3114, .ClutchEngaged = False} + Dim tmp As VectoInputs = New VectoInputs _ + With {.Cycle = "Urban", .VehicleWeightKG = 16500.SI(Of Kilogram)(), .PowerNetVoltage = 28.3.SI(Of Volt)()} + VectoInputs = tmp + Signals = New Signals With {.EngineSpeed = 2000.RPMtoRad(), .TotalCycleTimeSeconds = 3114, .ClutchEngaged = False} - 'Pneumatics set deault values - PneumaticUserInputsConfig = New PneumaticUserInputsConfig(True) - PneumaticAuxillariesConfig = New PneumaticsAuxilliariesConfig(True) + 'Pneumatics set deault values + PneumaticUserInputsConfig = New PneumaticUserInputsConfig(True) + PneumaticAuxillariesConfig = New PneumaticsAuxilliariesConfig(True) - 'Electrical set deault values - ElectricalUserInputsConfig = New ElectricsUserInputsConfig(True, tmp) - ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.3, 0.096, True) + 'Electrical set deault values + ElectricalUserInputsConfig = New ElectricsUserInputsConfig(True, tmp) + ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.3, 0.096, True) - 'HVAC set deault values - HvacUserInputsConfig = New HVACUserInputsConfig(String.Empty, String.Empty, False) - End Sub + 'HVAC set deault values + HvacUserInputsConfig = New HVACUserInputsConfig(String.Empty, String.Empty, False) + End Sub - Private Function GetDoorActuationTimeFraction() As Single + 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 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 numActuations As Single = actuationsMap.GetNumActuations(actuationsKey) + Dim secondsPerActuation As Single = ElectricalUserInputsConfig.DoorActuationTimeSecond - Dim doorDutyCycleFraction As Single = (numActuations * secondsPerActuation) / Signals.TotalCycleTimeSeconds + Dim doorDutyCycleFraction As Single = (numActuations * secondsPerActuation) / Signals.TotalCycleTimeSeconds - Return doorDutyCycleFraction - End Function + Return doorDutyCycleFraction + End Function #Region "Comparison" - Private Function CompareElectricalConfiguration(other As AuxiliaryConfig) 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 AuxiliaryConfig) 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 AuxiliaryConfig) 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 AuxiliaryConfig) As Boolean _ - Implements IAuxiliaryConfig.ConfigValuesAreTheSameAs - - If Me.HvacUserInputsConfig.SSMFilePath <> other.HvacUserInputsConfig.SSMFilePath Then Return False - If Me.HvacUserInputsConfig.BusDatabasePath <> other.HvacUserInputsConfig.BusDatabasePath Then Return False - If Me.HvacUserInputsConfig.SSMDisabled <> other.HvacUserInputsConfig.SSMDisabled Then Return False - - Return True - End Function - - Public Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) 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 + Private Function CompareElectricalConfiguration(other As AuxiliaryConfig) 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 AuxiliaryConfig) 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 AuxiliaryConfig) 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 AuxiliaryConfig) As Boolean _ + Implements IAuxiliaryConfig.ConfigValuesAreTheSameAs + + If Me.HvacUserInputsConfig.SSMFilePath <> other.HvacUserInputsConfig.SSMFilePath Then Return False + If Me.HvacUserInputsConfig.BusDatabasePath <> other.HvacUserInputsConfig.BusDatabasePath Then Return False + If Me.HvacUserInputsConfig.SSMDisabled <> other.HvacUserInputsConfig.SSMDisabled Then Return False + + Return True + End Function + + Public Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) 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" - 'Persistance Functions - Public Function Save(auxFile As String) As Boolean Implements IAuxiliaryConfig.Save + 'Persistance Functions + Public Function Save(auxFile As String) As Boolean Implements IAuxiliaryConfig.Save - Dim returnValue As Boolean = True - Dim settings As JsonSerializerSettings = New JsonSerializerSettings() - settings.TypeNameHandling = TypeNameHandling.Objects + Dim returnValue As Boolean = True + Dim settings As JsonSerializerSettings = New JsonSerializerSettings() + settings.TypeNameHandling = TypeNameHandling.Objects - 'JSON METHOD - Try + 'JSON METHOD + Try - Dim output As String = JsonConvert.SerializeObject(Me, Formatting.Indented, settings) + Dim output As String = JsonConvert.SerializeObject(Me, Formatting.Indented, settings) - File.WriteAllText(auxFile, output) + File.WriteAllText(auxFile, output) - Catch ex As Exception + Catch ex As Exception - returnValue = False + returnValue = False - End Try + End Try - Return returnValue - End Function - - Public Function Load(auxFile As String) As Boolean Implements IAuxiliaryConfig.Load - - Dim returnValue As Boolean = True - Dim settings As JsonSerializerSettings = New JsonSerializerSettings() - Dim tmpAux As AuxiliaryConfig - - settings.TypeNameHandling = TypeNameHandling.Objects - - 'JSON METHOD - Try - - Dim output As String = File.ReadAllText(auxFile) - - - tmpAux = JsonConvert.DeserializeObject(Of AuxiliaryConfig)(output, settings) - - 'This is where we Assume values of loaded( Deserialized ) object. - AssumeValuesOfOther(tmpAux) - If Not tmpAux.VectoInputs.FuelMapFile Is Nothing Then - Dim tmp As cMAP = New cMAP - tmp.FilePath = Path.Combine(Path.GetDirectoryName(auxFile), tmpAux.VectoInputs.FuelMapFile) - If Not tmp.ReadFile() Then - MessageBox.Show("Unable to read fuel map, aborting.") - Return False - End If - tmp.Triangulate() - VectoInputs.FuelMap = tmp - End If - Catch ex As Exception - - returnValue = False - End Try - - Return returnValue - End Function - - 'Persistance Helpers - Public Sub AssumeValuesOfOther(other As AuxiliaryConfig) - - CloneElectricaConfiguration(other) - ClonePneumaticsAuxiliariesConfig(other) - ClonePneumaticsUserInputsConfig(other) - CloneHVAC(other) - End Sub - - Private Sub CloneElectricaConfiguration(other As AuxiliaryConfig) - - '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, - otherConsumer.Info) - - 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 - Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Clear() - For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardOverrun.Results - Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) - Next - 'ResultCardTraction - Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Clear() - 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 AuxiliaryConfig) - - 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 AuxiliaryConfig) - - 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 AuxiliaryConfig) - - Me.HvacUserInputsConfig.SSMFilePath = other.HvacUserInputsConfig.SSMFilePath - Me.HvacUserInputsConfig.BusDatabasePath = other.HvacUserInputsConfig.BusDatabasePath - Me.HvacUserInputsConfig.SSMDisabled = other.HvacUserInputsConfig.SSMDisabled - End Sub + Return returnValue + End Function + + Public Function Load(auxFile As String) As Boolean Implements IAuxiliaryConfig.Load + + Dim returnValue As Boolean = True + Dim settings As JsonSerializerSettings = New JsonSerializerSettings() + Dim tmpAux As AuxiliaryConfig + + settings.TypeNameHandling = TypeNameHandling.Objects + + 'JSON METHOD + Try + + Dim output As String = File.ReadAllText(auxFile) + + + tmpAux = JsonConvert.DeserializeObject(Of AuxiliaryConfig)(output, settings) + + 'This is where we Assume values of loaded( Deserialized ) object. + AssumeValuesOfOther(tmpAux) + If Not tmpAux.VectoInputs.FuelMapFile Is Nothing Then + Dim tmp As cMAP = New cMAP + tmp.FilePath = Path.Combine(Path.GetDirectoryName(auxFile), tmpAux.VectoInputs.FuelMapFile) + If Not tmp.ReadFile() Then + MessageBox.Show("Unable to read fuel map, aborting.") + Return False + End If + tmp.Triangulate() + VectoInputs.FuelMap = tmp + End If + Catch ex As Exception + + returnValue = False + End Try + + Return returnValue + End Function + + 'Persistance Helpers + Public Sub AssumeValuesOfOther(other As AuxiliaryConfig) + + CloneElectricaConfiguration(other) + ClonePneumaticsAuxiliariesConfig(other) + ClonePneumaticsUserInputsConfig(other) + CloneHVAC(other) + End Sub + + Private Sub CloneElectricaConfiguration(other As AuxiliaryConfig) + + '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, + otherConsumer.Info) + + 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 + Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Clear() + For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardOverrun.Results + Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) + Next + 'ResultCardTraction + Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Clear() + 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 AuxiliaryConfig) + + 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 AuxiliaryConfig) + + 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 AuxiliaryConfig) + + Me.HvacUserInputsConfig.SSMFilePath = other.HvacUserInputsConfig.SSMFilePath + Me.HvacUserInputsConfig.BusDatabasePath = other.HvacUserInputsConfig.BusDatabasePath + Me.HvacUserInputsConfig.SSMDisabled = other.HvacUserInputsConfig.SSMDisabled + End Sub #End Region End Class diff --git a/VECTOAux/VectoAuxiliaries/AuxillaryEnvironment.vb b/VECTOAux/VectoAuxiliaries/AuxillaryEnvironment.vb deleted file mode 100644 index 493c2a2f872392ec5a32ccb5f7335eefb1ebc4c0..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/AuxillaryEnvironment.vb +++ /dev/null @@ -1,550 +0,0 @@ -' 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 - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb deleted file mode 100644 index 0576a556b7bb9353146b2a9f73db731880c07795..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb +++ /dev/null @@ -1,40 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules - -Namespace DownstreamModules - Public Interface IM10 - 'AverageLoadsFuelConsumptionInterpolatedForPneumatics - ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Kilogram - - 'Interpolated FC between points 2-3-1 Representing smart Pneumatics = Fuel consumption with smart Pneumatics and average electrical power demand - ReadOnly Property FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand As Kilogram - - Sub CycleStep(stepTimeInSeconds As Second) - - 'Added for diagnostic inspection purposes only, does not materially affect the class function. - ReadOnly Property P1X As NormLiter - ReadOnly Property P1Y As Kilogram - ReadOnly Property P2X As NormLiter - ReadOnly Property P2Y As Kilogram - ReadOnly Property P3X As NormLiter - ReadOnly Property P3Y As Kilogram - ReadOnly Property XTAIN As NormLiter - ReadOnly Property INTRP1 As Kilogram - ReadOnly Property INTRP2 As Kilogram - End Interface -End Namespace - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM11.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM11.vb deleted file mode 100644 index a974b9b273be57f4ef531b98f13fad9975f14f51..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM11.vb +++ /dev/null @@ -1,90 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM11 - ''' <summary> - ''' Smart Electrical Total Cycle Electrical Energy Generated During Overrun Only(J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly As Joule - - ''' <summary> - ''' Smart Electrical Total Cycle Eletrical EnergyGenerated (J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalTotalCycleEletricalEnergyGenerated As Joule - - ''' <summary> - ''' Total Cycle Electrical Demand (J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleElectricalDemand As Joule - - ''' <summary> - ''' Total Cycle Fuel Consumption: Smart Electrical Load (g) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionSmartElectricalLoad As Kilogram - - ''' <summary> - ''' Total Cycle Fuel Consumption: Zero Electrical Load (g) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionZeroElectricalLoad As Kilogram - - ''' <summary> - ''' Stop Start Sensitive: Total Cycle Electrical Demand (J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property StopStartSensitiveTotalCycleElectricalDemand As Joule - - ''' <summary> - ''' Total Cycle Fuel Consuption : Average Loads (g) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsuptionAverageLoads As Kilogram - - ''' <summary> - ''' Clears aggregated values ( Sets them to zero ). - ''' </summary> - ''' <remarks></remarks> - Sub ClearAggregates() - - ''' <summary> - ''' Increments all aggregated outputs - ''' </summary> - ''' <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> - ''' <remarks></remarks> - Sub CycleStep(stepTimeInSeconds As Second) - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM12.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM12.vb deleted file mode 100644 index e1c5ad6bca92b94e931377c709f315376b03e9eb..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM12.vb +++ /dev/null @@ -1,53 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace DownstreamModules - Public Interface IM12 - ''' <summary> - ''' Fuel consumption with smart Electrics and Average Pneumatic Power Demand - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand As Kilogram - - ''' <summary> - ''' Base Fuel Consumption With Average Auxiliary Loads - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property BaseFuelConsumptionWithTrueAuxiliaryLoads As Kilogram - - ''' <summary> - ''' Stop Start Correction - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property StopStartCorrection As Double - - - 'Diagnostic Signals Only For Testing - No Material interference with operation of class. - ReadOnly Property P1X As Joule - ReadOnly Property P1Y As Kilogram - ReadOnly Property P2X As Joule - ReadOnly Property P2Y As Kilogram - ReadOnly Property P3X As Joule - ReadOnly Property P3Y As Kilogram - ReadOnly Property XTAIN As Joule - ReadOnly Property INTRP1 As Kilogram - ReadOnly Property INTRP2 As Kilogram - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb deleted file mode 100644 index 57d3253dfcb80dbae67a665878fdbda2e28d5eed..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb +++ /dev/null @@ -1,30 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM13 - ''' <summary> - ''' Total Cycle Fuel Consumption Grams - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>WHTC and Start Stop Adjusted</remarks> - ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Kilogram - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM14.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM14.vb deleted file mode 100644 index cd9537fc048ef1a08bd19f28bf3176f61cacedf2..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM14.vb +++ /dev/null @@ -1,13 +0,0 @@ - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM14 - ReadOnly Property TotalCycleFCGrams As Kilogram - - ReadOnly Property TotalCycleFCLitres As Liter - End Interface -End Namespace diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM6.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM6.vb deleted file mode 100644 index 64c1aaa87915d2ce198fc5a3090629d3f6a5017f..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM6.vb +++ /dev/null @@ -1,89 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace DownstreamModules - Public Interface IM6 - ''' <summary> - ''' OverrunFlag - ''' </summary> - ''' <value></value> - ''' <returns>0 = Not in overrun, 1 = In Overrun</returns> - ''' <remarks></remarks> - ReadOnly Property OverrunFlag As Boolean - - ''' <summary> - ''' Smart Elec And Pneumatics Compressor Flag - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecAndPneumaticsCompressorFlag As Boolean - - ''' <summary> - ''' Smart Elec And Pneumatic: Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecAndPneumaticAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Elec And Pneumatic: Air Compressor Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecAndPneumaticAirCompPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Electrics Only : Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecOnlyAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Average Power Demand At Crank From Pneumatics (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AveragePowerDemandAtCrankFromPneumatics As Watt - - ''' <summary> - ''' Smart Pneumatic Only Air Comp Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartPneumaticOnlyAirCompPowerGenAtCrank As Watt - - ''' <summary> - ''' Avgerage Power Demand At Crank From Electrics Including HVAC electrics (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AvgPowerDemandAtCrankFromElectricsIncHVAC As Watt - - ''' <summary> - ''' Smart Pneumatics Only CompressorFlag - ''' </summary> - ''' <value></value> - ''' <returns>Less than Zero = No, Greater then Zero = Yes </returns> - ''' <remarks></remarks> - ReadOnly Property SmartPneumaticsOnlyCompressorFlag As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM7.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM7.vb deleted file mode 100644 index 688c1c4bec9ee6efbf1f53456a4ec56ebf5ba82a..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM7.vb +++ /dev/null @@ -1,53 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM7 - ''' <summary> - ''' Smart Electrical And Pneumatic Aux: Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalAndPneumaticAuxAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Electrical And Pneumatic Aux : Air Compressor Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Electrical Only Aux : Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalOnlyAuxAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Pneumatic Only Aux : Air Comppressor Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartPneumaticOnlyAuxAirCompPowerGenAtCrank As Watt - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM8.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM8.vb deleted file mode 100644 index 30da43ede9672d02bacf5a56d09f9fd24cd6ab74..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM8.vb +++ /dev/null @@ -1,47 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM8 -'OUT1 - ''' <summary> - ''' Aux Power At Crank From Electrical HVAC And Pneumatics Ancilaries (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries As Watt -'OUT2 - ''' <summary> - ''' Smart Electrical Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalAlternatorPowerGenAtCrank As Watt -'OUT3 - ''' <summary> - ''' Compressor Flag - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property CompressorFlag As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb deleted file mode 100644 index 9743dc4c1fd471991245905c4b52fd60f33e6ae4..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb +++ /dev/null @@ -1,68 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM9 - Inherits IAuxiliaryEvent - - ''' <summary> - ''' Clears aggregated values ( Sets them to zero ) - ''' </summary> - ''' <remarks></remarks> - Sub ClearAggregates() - - ''' <summary> - ''' Increments all aggregated outputs - ''' </summary> - ''' <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> - ''' <remarks></remarks> - Sub CycleStep(stepTimeInSeconds As Second) - - ''' <summary> - ''' Litres Of Air: Compressor On Continually (L) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Start/Stop Sensitive</remarks> - ReadOnly Property LitresOfAirCompressorOnContinually As NormLiter - - ''' <summary> - ''' Litres Of Air Compressor On Only In Overrun (L) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As NormLiter - - ''' <summary> - ''' Total Cycle Fuel Consumption Compressor *On* Continuously (G) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Kilogram - - ''' <summary> - ''' Total Cycle Fuel Consumption Compressor *OFF* Continuously (G) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Kilogram - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb deleted file mode 100644 index ab015bf56a68c660f17ab9a24d0bb94f8f1014a1..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb +++ /dev/null @@ -1,189 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Pneumatics - -Namespace DownstreamModules - Public Class M10 - Implements IM10 - - 'Aggregators - Private _AverageAirConsumedLitre As NormLiter - - 'Diagnostics - Private x1 As NormLiter - Private y1 As Kilogram - Private x2 As NormLiter - Private y2 As Kilogram - Private x3 As NormLiter - Private y3 As Kilogram - Private xTA As NormLiter - Private interp1 As Kilogram - Private interp2 As Kilogram - - Public ReadOnly Property P1X As NormLiter Implements IM10.P1X - Get - Return x1 - End Get - End Property - - Public ReadOnly Property P1Y As Kilogram Implements IM10.P1Y - Get - Return y1 - End Get - End Property - - Public ReadOnly Property P2X As NormLiter Implements IM10.P2X - Get - Return x2 - End Get - End Property - - Public ReadOnly Property P2Y As Kilogram Implements IM10.P2Y - Get - Return y2 - End Get - End Property - - Public ReadOnly Property P3X As NormLiter Implements IM10.P3X - Get - Return x3 - End Get - End Property - - Public ReadOnly Property P3Y As Kilogram Implements IM10.P3Y - Get - Return y3 - End Get - End Property - - Public ReadOnly Property XTAIN As NormLiter Implements IM10.XTAIN - Get - Return xTA - End Get - End Property - - Public ReadOnly Property INTRP1 As Kilogram Implements IM10.INTRP1 - Get - Return interp1 - End Get - End Property - - Public ReadOnly Property INTRP2 As Kilogram Implements IM10.INTRP2 - Get - Return interp2 - End Get - End Property - - - 'Private - -#Region "Private Fields = > Constructor Requirements" - - Private m3 As IM3_AveragePneumaticLoadDemand - Private m9 As IM9 - 'Not Currently used but there for ease of refactoring in future. - Private signals As ISignals - -#End Region - - Private Enum InterpolationType - NonSmartPneumtaics - SmartPneumtaics - End Enum - - Private Function Interpolate(interpType As InterpolationType) As Kilogram - - Dim returnValue As Kilogram = 0.SI(Of Kilogram)() - ' Dim x1,y1,x2,y2,x3,y3, xTA As Single - - x1 = m9.LitresOfAirCompressorOnContinually - y1 = m9.TotalCycleFuelConsumptionCompressorOnContinuously - x2 = 0.SI(Of NormLiter)() - y2 = m9.TotalCycleFuelConsumptionCompressorOffContinuously - x3 = m9.LitresOfAirCompressorOnOnlyInOverrun - y3 = m9.TotalCycleFuelConsumptionCompressorOffContinuously - - - xTA = _AverageAirConsumedLitre 'm3.AverageAirConsumedPerSecondLitre - - - Select Case interpType - - 'Non-Smart Pneumatics ( OUT 1 ) - Case InterpolationType.NonSmartPneumtaics - 'returnValue = (y2 + (((y1 - y2) * xTA) / x1)) - returnValue = VectoMath.Interpolate(x1, x2, y1, y2, xTA) - interp1 = returnValue - - 'Smart Pneumatics ( OUT 2 ) - Case InterpolationType.SmartPneumtaics - 'returnValue = (y3 + (((y1 - y3) / (x1 - x3)) * (xTA - x3))) - returnValue = VectoMath.Interpolate(x1, x3, y1, y3, xTA) - interp2 = returnValue - End Select - - - Return returnValue - End Function - - 'Public - -#Region "Public Properties" - - Public ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Kilogram _ - Implements IM10.AverageLoadsFuelConsumptionInterpolatedForPneumatics - Get - - 'SCHM 3_02 - Dim intrp1 As Kilogram = Interpolate(InterpolationType.NonSmartPneumtaics) - 'intrp1 = If(Not Single.IsNaN(intrp1), intrp1, 0) - Return intrp1 - End Get - End Property - - Public ReadOnly Property FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand As Kilogram _ - Implements IM10.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand - Get - - 'SCHM 3_02 - Dim intrp2 As Kilogram = Interpolate(InterpolationType.SmartPneumtaics) - 'intrp2 = If(Not Single.IsNaN(intrp2), intrp2, 0) - Return intrp2 - End Get - End Property - -#End Region - -#Region "Contructors" - - Public Sub New(m3 As IM3_AveragePneumaticLoadDemand, m9 As IM9, signals As ISignals) - - Me.m3 = m3 - Me.m9 = m9 - Me.signals = signals - _AverageAirConsumedLitre = 0.SI(Of NormLiter)() - End Sub - -#End Region - - Public Sub CycleStep(stepTimeInSeconds As Second) Implements IM10.CycleStep - - _AverageAirConsumedLitre += - If _ - (Double.IsNaN(m3.AverageAirConsumedPerSecondLitre.Value()), 0.SI(Of NormLiter), - m3.AverageAirConsumedPerSecondLitre * stepTimeInSeconds) - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M11.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M11.vb deleted file mode 100644 index 8bd593943fc8297b1a1512bfe885e764d4b61661..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M11.vb +++ /dev/null @@ -1,250 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M11 - Implements IM11 - - Private Const RPM_to_RadiansPerSecond As Single = 9.55 - -#Region "Private Aggregates" - 'Private Aggregations - Private AG1 As Joule - Private AG2 As Joule - Private AG3 As Joule - Private AG4 As Kilogram - Private AG5 As Kilogram - Private AG6 As Joule - Private AG7 As Kilogram - -#End Region - -#Region "Private Fields Assigned by Constructor." - - Private M1 As IM1_AverageHVACLoadDemand - Private M3 As IM3_AveragePneumaticLoadDemand - Private M6 As IM6 - Private M8 As IM8 - Private fmap As IFuelConsumptionMap - Private signals As ISignals - -#End Region - - - 'Staging Calculations - Private Function Sum0(ByVal rpm As PerSecond) As PerSecond - - If rpm < 1 Then rpm = 1.RPMtoRad() - - Return rpm ' / RPM_to_RadiansPerSecond - End Function - - Private ReadOnly Property Sum1 As Watt - Get - Return If(M6.OverrunFlag, M8.SmartElectricalAlternatorPowerGenAtCrank, SIBase(Of Watt).Create(0.0)) - 'Return M6.OverrunFlag*M8.SmartElectricalAlternatorPowerGenAtCrank - End Get - End Property - - Private ReadOnly Property Sum2 As Watt - Get - Return M3.GetAveragePowerDemandAtCrankFromPneumatics + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts - End Get - End Property - - Private ReadOnly Property Sum3 As NewtonMeter - Get - Return M8.SmartElectricalAlternatorPowerGenAtCrank / Sum0(signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property Sum4 As NewtonMeter - Get - Return Sum2 / Sum0(signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property Sum5 As NewtonMeter - Get - Return Sum4 + Sum9 - End Get - End Property - - Private ReadOnly Property Sum6 As NewtonMeter - Get - Return Sum3 + Sum5 - End Get - End Property - - Private ReadOnly Property Sum7 As KilogramPerSecond - Get - - 'SCM 3_02 - Dim intrp1 As KilogramPerSecond = fmap.GetFuelConsumption(Sum6, signals.EngineSpeed) - intrp1 = If(Not Double.IsNaN(intrp1.Value()) AndAlso intrp1 > 0, intrp1, 0.SI(Of KilogramPerSecond)) - Return intrp1 - End Get - End Property - - Private ReadOnly Property Sum8 As KilogramPerSecond - Get - - 'SCHM 3_2 - Dim intrp2 As KilogramPerSecond = fmap.GetFuelConsumption(Sum5, signals.EngineSpeed) - intrp2 = If(Not Double.IsNaN(intrp2.Value()) AndAlso intrp2 > 0, intrp2, 0.SI(Of KilogramPerSecond)) - Return intrp2 - End Get - End Property - - Private ReadOnly Property Sum9 As NewtonMeter - Get - - Return _ - signals.EngineDrivelineTorque + - (signals.PreExistingAuxPower / Sum0(signals.EngineSpeed)) - End Get - End Property - - Private ReadOnly Property Sum10 As NewtonMeter - Get - - Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC / Sum0(signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property Sum11 As NewtonMeter - Get - - Return Sum5 + Sum10 - End Get - End Property - - Private ReadOnly Property Sum12 As KilogramPerSecond - Get - - 'SCHM 3_2 - Dim intrp3 As KilogramPerSecond = fmap.GetFuelConsumption(Sum11, signals.EngineSpeed) - intrp3 = If(Not Double.IsNaN(intrp3.Value()) AndAlso intrp3 > 0, intrp3, 0.SI(Of KilogramPerSecond)) - Return intrp3 - End Get - End Property - - 'OUT1 - Public ReadOnly Property SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly As Joule _ - Implements IM11.SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly - Get - Return AG1 - End Get - End Property - 'OUT2 - Public ReadOnly Property SmartElectricalTotalCycleEletricalEnergyGenerated As Joule _ - Implements IM11.SmartElectricalTotalCycleEletricalEnergyGenerated - Get - Return AG2 - End Get - End Property - 'OUT3 - Public ReadOnly Property TotalCycleElectricalDemand As Joule Implements IM11.TotalCycleElectricalDemand - Get - Return AG3 - End Get - End Property - 'OUT4 - Public ReadOnly Property TotalCycleFuelConsumptionSmartElectricalLoad As Kilogram _ - Implements IM11.TotalCycleFuelConsumptionSmartElectricalLoad - Get - Return AG4 - End Get - End Property - 'OUT5 - Public ReadOnly Property TotalCycleFuelConsumptionZeroElectricalLoad As Kilogram _ - Implements IM11.TotalCycleFuelConsumptionZeroElectricalLoad - Get - Return AG5 - End Get - End Property - 'OUT6 - Public ReadOnly Property StopStartSensitiveTotalCycleElectricalDemand As Joule _ - Implements IM11.StopStartSensitiveTotalCycleElectricalDemand - Get - Return AG6 - End Get - End Property - 'OUT7 - Public ReadOnly Property TotalCycleFuelConsuptionAverageLoads As Kilogram _ - Implements IM11.TotalCycleFuelConsuptionAverageLoads - Get - Return AG7 - End Get - End Property - - Private ReadOnly Property SW1 As Boolean - Get - Return Not signals.EngineStopped - End Get - End Property - - 'Clear at the beginning of cycle - Sub ClearAggregates() Implements IM11.ClearAggregates - - AG1 = 0.SI(Of Joule)() - AG2 = 0.SI(Of Joule)() - AG3 = 0.SI(Of Joule)() - AG4 = 0.SI(Of Kilogram)() - AG5 = 0.SI(Of Kilogram)() - AG6 = 0.SI(Of Joule)() - AG7 = 0.SI(Of Kilogram)() - End Sub - - 'Add to Aggregates dependent on cycle step time. - Sub CycleStep(stepTimeInSeconds As Second) Implements IM11.CycleStep - - 'S/S Insensitive - AG3 += (M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds) - - - If signals.EngineStopped Then Return - - 'S/S Sensitive - If (SW1) Then - AG1 += (Sum1 * stepTimeInSeconds) - AG2 += (M8.SmartElectricalAlternatorPowerGenAtCrank * stepTimeInSeconds) - - AG6 += (M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds) - - 'MQ: No longer needed - already per Second 'These need to be divided by 3600 as the Fuel Map output is in Grams/Second. - AG4 += (Sum7 * stepTimeInSeconds) '/ 3600 - AG5 += (Sum8 * stepTimeInSeconds) ' / 3600 - AG7 += (Sum12 * stepTimeInSeconds) '/ 3600 - End If - End Sub - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, m3 As IM3_AveragePneumaticLoadDemand, m6 As IM6, m8 As IM8, - fmap As IFuelConsumptionMap, signals As ISignals) - - Me.M1 = m1 - Me.M3 = m3 - Me.M6 = m6 - Me.M8 = m8 - Me.fmap = fmap - Me.signals = signals - ClearAggregates() - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M12.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M12.vb deleted file mode 100644 index 03d948b6e718e44329efb1101d50df772bc46156..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M12.vb +++ /dev/null @@ -1,199 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M12 - Implements IM12 - - Private Class Point - Public X As Joule - Public Y As Kilogram - End Class - - Private M11 As IM11 - Private M10 As IM10 - Private Signals As ISignals - Private _P1X As Joule - Private _P1Y As Kilogram - Private _P2X As Joule - Private _P2Y As Kilogram - Private _P3X As Joule - Private _P3Y As Kilogram - Private _XT As Joule - Private _INTERP1 As Kilogram - Private _INTERP2 As Kilogram - - Private Sub setPoints() - - _P1X = 0.SI(Of Joule)() - _P1Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad - _P2X = M11.SmartElectricalTotalCycleEletricalEnergyGenerated - _P2Y = M11.TotalCycleFuelConsumptionSmartElectricalLoad - _P3X = M11.StopStartSensitiveTotalCycleElectricalDemand - _P3Y = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics - _XT = M11.TotalCycleElectricalDemand - End Sub - - 'Interpolation - Private Function Sum1() As Kilogram - - Dim P1 As Point = New Point With {.X = 0.SI(Of Joule)(), .Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad} - Dim P2 As Point = New Point _ - With {.X = M11.SmartElectricalTotalCycleEletricalEnergyGenerated * Signals.StoredEnergyEfficiency, - .Y = M11.TotalCycleFuelConsumptionSmartElectricalLoad} - - Dim IP5x As Joule = M11.TotalCycleElectricalDemand - - - Dim TanTeta As double = ((P2.Y - P1.Y).Value() / (P2.X - P1.X).Value()) - - Dim IP5y As Kilogram = (P1.Y.Value() + (TanTeta * IP5x.Value())).SI(of Kilogram) - - _INTERP1 = IP5y - - setPoints() - - Return If(Double.IsNaN(IP5y.Value()), 0.SI(Of Kilogram), IP5y) - End Function - - Private Function Sum2() As Kilogram - - Dim P1 As Point = New Point With {.X = 0.SI(Of Joule)(), .Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad} - Dim P3 As Point = New Point _ - With {.X = M11.StopStartSensitiveTotalCycleElectricalDemand, - .Y = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics} - - Dim IP5x As Joule = M11.TotalCycleElectricalDemand - Dim IP5y As Kilogram - - Dim TanTeta As Double = (P3.Y - P1.Y).Value() / (P3.X - P1.X).Value() - - IP5y = P1.Y + (TanTeta * IP5x.Value()).SI(Of Kilogram)() - - _INTERP2 = IP5y - - Return If(Double.IsNaN(IP5y.Value()), 0.SI(Of Kilogram), IP5y) - End Function - - 'Constructor - Public Sub New(m10 As IM10, m11 As IM11, signals As ISignals) - - Me.M10 = m10 - Me.M11 = m11 - Me.Signals = signals - End Sub - - 'Main Class Outputs - Public ReadOnly Property FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand As Kilogram _ - Implements IM12.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand - Get - - 'SCHM 3_2 - Dim interp1 As Kilogram = Sum1() - - interp1 = - If _ - (Not Double.IsNaN(interp1.Value()) AndAlso M11.StopStartSensitiveTotalCycleElectricalDemand > 0, interp1, - M11.TotalCycleFuelConsumptionZeroElectricalLoad) - Return interp1 - End Get - End Property - - Public ReadOnly Property BaseFuelConsumptionWithTrueAuxiliaryLoads As Kilogram _ - Implements IM12.BaseFuelConsumptionWithTrueAuxiliaryLoads - Get - - 'SCM 3_02 - Dim interp2 As Kilogram = Sum2() - - interp2 = - If _ - (Not Double.IsNaN(interp2.Value()) AndAlso M11.StopStartSensitiveTotalCycleElectricalDemand > 0, interp2, - M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics) - Return interp2 - End Get - End Property - - Public ReadOnly Property StopStartCorrection As Double Implements IM12.StopStartCorrection - Get - - Dim _stopStartCorrection As Scalar = BaseFuelConsumptionWithTrueAuxiliaryLoads() / - If _ - (M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics > 0, - M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics, 1.SI(Of Kilogram)) - - Return If(_stopStartCorrection > 0, _stopStartCorrection.Value(), 1) - End Get - End Property - - 'Diagnostics Signal Exposure only. Does not materially affect class operation. - Public ReadOnly Property INTRP1 As Kilogram Implements IM12.INTRP1 - Get - Return _INTERP1 - End Get - End Property - - Public ReadOnly Property INTRP2 As Kilogram Implements IM12.INTRP2 - Get - Return _INTERP2 - End Get - End Property - - Public ReadOnly Property P1X As Joule Implements IM12.P1X - Get - Return _P1X - End Get - End Property - - Public ReadOnly Property P1Y As Kilogram Implements IM12.P1Y - Get - Return _P1Y - End Get - End Property - - Public ReadOnly Property P2X As Joule Implements IM12.P2X - Get - Return _P2X - End Get - End Property - - Public ReadOnly Property P2Y As Kilogram Implements IM12.P2Y - Get - Return _P2Y - End Get - End Property - - Public ReadOnly Property P3X As Joule Implements IM12.P3X - Get - Return _P3X - End Get - End Property - - Public ReadOnly Property P3Y As Kilogram Implements IM12.P3Y - Get - Return _P3Y - End Get - End Property - - Public ReadOnly Property XTAIN As Joule Implements IM12.XTAIN - Get - Return _XT - End Get - End Property - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb deleted file mode 100644 index 109eb23d446fed74f6f75f2449f81920bfde902d..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb +++ /dev/null @@ -1,126 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M13 - Implements IM13 - - Private m10 As IM10 - Private m11 As IM11 - Private m12 As IM12 - Private signals As ISignals - - 'Internal Staging Calculations - - Private ReadOnly Property Sum1 As Kilogram - Get - Return m11.TotalCycleFuelConsuptionAverageLoads * m12.StopStartCorrection - End Get - End Property - - Private ReadOnly Property Sum2 As Kilogram - Get - Return m10.AverageLoadsFuelConsumptionInterpolatedForPneumatics * m12.StopStartCorrection - End Get - End Property - - Private ReadOnly Property Sum3 As Kilogram - Get - Return m10.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand * m12.StopStartCorrection - End Get - End Property - - Private ReadOnly Property Sum4 As Kilogram - Get - Return -m12.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand() + Sum1 - End Get - End Property - - Private ReadOnly Property Sum5 As Kilogram - Get - Return Sum2 - Sum3 - End Get - End Property - - Private ReadOnly Property Sum6 As Kilogram - Get - Return m12.BaseFuelConsumptionWithTrueAuxiliaryLoads() - Sum4 - End Get - End Property - - Private ReadOnly Property Sum7 As Kilogram - Get - Return m12.BaseFuelConsumptionWithTrueAuxiliaryLoads() - Sum5 - End Get - End Property - - Private ReadOnly Property Sum8 As Kilogram - Get - Return -Sum4 + Sum7 - End Get - End Property - - Private ReadOnly Property Sum9 As Kilogram - Get - Return SW4 * SW3 - End Get - End Property - - 'Internal Staging Switches - Private ReadOnly Property SW1 As Kilogram - Get - Return If(signals.SmartPneumatics, Sum8, Sum6) - End Get - End Property - - Private ReadOnly Property SW2 As Kilogram - Get - Return If(signals.SmartPneumatics, Sum3, m12.BaseFuelConsumptionWithTrueAuxiliaryLoads()) - End Get - End Property - - Private ReadOnly Property SW3 As Kilogram - Get - Return If(signals.SmartElectrics, SW1, SW2) - End Get - End Property - - Private ReadOnly Property SW4 As Double - Get - Return If(signals.DeclarationMode, signals.WHTC, 1) - End Get - End Property - - 'Constructor - Public Sub New(m10 As IM10, m11 As IM11, m12 As IM12, signals As ISignals) - - Me.m10 = m10 - Me.m11 = m11 - Me.m12 = m12 - Me.signals = signals - End Sub - - 'Public class outputs - Public ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Kilogram _ - Implements IM13.WHTCTotalCycleFuelConsumptionGrams - Get - Return Sum9 - End Get - End Property - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M14.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M14.vb deleted file mode 100644 index f1d7b4cfe3b77f0d088e568ef62813f5e6c8e35c..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M14.vb +++ /dev/null @@ -1,94 +0,0 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M14 - Implements IM14 - - Private m13 As IM13 - Private signals As ISignals - Private constants As IHVACConstants - Private ssm As ISSMTOOL - - - Public Sub New(m13 As IM13, hvacSSM As ISSMTOOL, constants As IHVACConstants, signals As ISignals) - - If m13 Is Nothing Then Throw New ArgumentException("M14, No M13 Supplied in arguments") - If hvacSSM Is Nothing Then Throw New ArgumentException("M14, No SSMTOOL constants Supplied in arguments") - If constants Is Nothing Then Throw New ArgumentException("M14, No signals Supplied in arguments") - If signals Is Nothing Then Throw New ArgumentException("M14, No signals constants Supplied in arguments") - - - Me.m13 = m13 - Me.signals = signals - Me.constants = constants - Me.ssm = hvacSSM - End Sub - - 'Staging Calculations - Private ReadOnly Property S1 As Joule - Get - Return m13.WHTCTotalCycleFuelConsumptionGrams * constants.DieselGCVJperGram - End Get - End Property - - Private ReadOnly Property S2 As Joule - Get - Return ssm.GenInputs.AH_FuelEnergyToHeatToCoolant * S1 - End Get - End Property - - Private ReadOnly Property S3 As Joule - Get - Return S2 * ssm.GenInputs.AH_CoolantHeatTransferredToAirCabinHeater - End Get - End Property - - Private ReadOnly Property S4 As Watt 'kW - Get - Return (S3 / signals.CurrentCycleTimeInSeconds.SI(Of Second)()) - End Get - End Property - - Private ReadOnly Property S5 As Second ' hour - Get - Return signals.CurrentCycleTimeInSeconds.SI(Of Second)() ' / 3600 - End Get - End Property - - Private ReadOnly Property S6 As Kilogram - Get - 'Return (S5.Value() * ssm.FuelPerHBaseAsjusted(S4.Value() / 1000) / 3600 * (constants.FuelDensity)).SI(Of Kilogram)() - Return _ - (S5 * ssm.FuelPerHBaseAsjusted(S4.Value() / 1000).SI(Unit.SI.Liter.Per.Hour)).Cast(Of Liter)() * constants.FuelDensity - End Get - End Property - - Private ReadOnly Property S7 As Kilogram - Get - Return m13.WHTCTotalCycleFuelConsumptionGrams + S6 - End Get - End Property - - Private ReadOnly Property S8 As Liter - Get - Return (S7 / (constants.FuelDensity)).Cast(Of Liter) - End Get - End Property - - Public ReadOnly Property TotalCycleFCGrams As Kilogram Implements IM14.TotalCycleFCGrams - Get - Return S7 - End Get - End Property - - Public ReadOnly Property TotalCycleFCLitres As Liter Implements IM14.TotalCycleFCLitres - Get - Return S8 - End Get - End Property - End Class -End Namespace - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb deleted file mode 100644 index 4f4f332602a4c5b1a6fe531e9cf13762608d5007..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb +++ /dev/null @@ -1,291 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M6 - Implements IM6 - -#Region "Private Field - Constructor requirements" - - Private _m1 As IM1_AverageHVACLoadDemand - Private _m2 As IM2_AverageElectricalLoadDemand - Private _m3 As IM3_AveragePneumaticLoadDemand - Private _m4 As IM4_AirCompressor - Private _m5 As IM5_SmartAlternatorSetGeneration - Private _signals As ISignals - -#End Region - - 'OUT1 - Public ReadOnly Property OverrunFlag As Boolean Implements IM6.OverrunFlag - - Get - Return VC0 - End Get - End Property - 'OUT2 - Public ReadOnly Property SmartElecAndPneumaticsCompressorFlag As Boolean _ - Implements IM6.SmartElecAndPneumaticsCompressorFlag - Get - Return VC2 - End Get - End Property - 'OUT3 - Public ReadOnly Property SmartElecAndPneumaticAltPowerGenAtCrank As Watt _ - Implements IM6.SmartElecAndPneumaticAltPowerGenAtCrank - Get - 'Multiply * 1 @ Engineering Request - Return Max1 * -1 - End Get - End Property - 'OUT4 - Public ReadOnly Property SmartElecAndPneumaticAirCompPowerGenAtCrank As Watt _ - Implements IM6.SmartElecAndPneumaticAirCompPowerGenAtCrank - Get - Return Sum16 - End Get - End Property - 'OUT5 - Public ReadOnly Property SmartElecOnlyAltPowerGenAtCrank As Watt Implements IM6.SmartElecOnlyAltPowerGenAtCrank - Get - 'Multiply * -1 @ Engineering request. - Return Max2 * -1 - End Get - End Property - 'OUT6 - Public ReadOnly Property AveragePowerDemandAtCrankFromPneumatics As Watt _ - Implements IM6.AveragePowerDemandAtCrankFromPneumatics - Get - Return _m3.GetAveragePowerDemandAtCrankFromPneumatics - End Get - End Property - 'OUT7 - Public ReadOnly Property SmartPneumaticOnlyAirCompPowerGenAtCrank As Watt _ - Implements IM6.SmartPneumaticOnlyAirCompPowerGenAtCrank - Get - Return Sum19 - End Get - End Property - 'OUT8 - Public ReadOnly Property AvgPowerDemandAtCrankFromElectricsIncHVAC As Watt _ - Implements IM6.AvgPowerDemandAtCrankFromElectricsIncHVAC - Get - - Return Sum1 - End Get - End Property - 'OUT9 - Public ReadOnly Property SmartPneumaticsOnlyCompressorFlag As Boolean Implements IM6.SmartPneumaticsOnlyCompressorFlag - Get - Return VC4 - End Get - End Property - - 'Internal Staging Calculations - 'switches - Private ReadOnly Property SW1 As Watt - Get - - Return If(_signals.SmartElectrics, _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts, Sum1) - End Get - End Property - - 'Max of Sum5 vs Sum10 - Public ReadOnly Property Max1 As Watt - Get - Return If(Sum5 > Sum10, Sum5, Sum10) - End Get - End Property - 'Max of Sum10 vs Sum7 - Public ReadOnly Property Max2 As Watt - Get - Return If(Sum7 > Sum10, Sum7, Sum10) - End Get - End Property - - 'Value Choices - Public ReadOnly Property VC0 As Boolean - Get - Return Sum3 <= 0 - End Get - End Property - - Public ReadOnly Property VC1 As Boolean - Get - Return Sum12 > 0 - End Get - End Property - - Public ReadOnly Property VC2 As Boolean - Get - Return Sum12 < 0 OrElse Sum12.IsEqual(0) - End Get - End Property - - Public ReadOnly Property VC3 As Boolean - Get - Return Sum13 > 0 - End Get - End Property - - Public ReadOnly Property VC4 As Boolean - Get - Return Sum13 < 0 OrElse Sum13.IsEqual(0) - End Get - End Property - - 'Sums - Public ReadOnly Property Sum1 As Watt - Get - Return _m1.AveragePowerDemandAtCrankFromHVACElectricsWatts() + _m2.GetAveragePowerAtCrankFromElectrics() - End Get - End Property - - Public ReadOnly Property Sum2 As Watt - Get - - Dim returnValue As Watt = _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + SW1 + - _m3.GetAveragePowerDemandAtCrankFromPneumatics - - Return returnValue - End Get - End Property - - Public ReadOnly Property Sum3 As Watt - Get - Return (_signals.EngineMotoringPower) + - (_signals.InternalEnginePower) + - Sum2 - End Get - End Property - - Public ReadOnly Property Sum4 As Watt - Get - - Return Sum3 - SW1 - _m3.GetAveragePowerDemandAtCrankFromPneumatics + _m4.GetPowerCompressorOff - End Get - End Property - - Public ReadOnly Property Sum5 As Watt - Get - Return If(OverrunFlag, Sum4, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum6 As Watt - Get - Return Sum4 - _m4.GetPowerCompressorOff + _m3.GetAveragePowerDemandAtCrankFromPneumatics - End Get - End Property - - Public ReadOnly Property Sum7 As Watt - Get - Return If(VC0, Sum6, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum8 As Watt - Get - Return Sum4 + SW1 - End Get - End Property - - Public ReadOnly Property Sum9 As Watt - Get - Return If(VC0, Sum8, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum10 As Watt - Get - Return _m5.AlternatorsGenerationPowerAtCrankOverrunWatts * -1.0 - End Get - End Property - - Public ReadOnly Property Sum11 As Watt - Get - Return Sum5 - Max1 - End Get - End Property - - Public ReadOnly Property Sum12 As Watt - Get - Return _m4.GetPowerDifference + Sum11 - End Get - End Property - - Public ReadOnly Property Sum13 As Watt - Get - Return Sum9 + _m4.GetPowerDifference - End Get - End Property - - Public ReadOnly Property Sum14 As Watt - Get - Return If(VC1, _m4.GetPowerCompressorOff, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum15 As Watt - Get - Return If(VC2, (_m4.GetPowerCompressorOn * _signals.PneumaticOverrunUtilisation), 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum16 As Watt - Get - Return Sum14 + Sum15 - End Get - End Property - - Public ReadOnly Property Sum17 As Watt - Get - Return If(VC3, _m4.GetPowerCompressorOff, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum18 As Watt - Get - Return If(VC4, (_m4.GetPowerCompressorOn * _signals.PneumaticOverrunUtilisation), 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum19 As Watt - Get - Return Sum17 + Sum18 - End Get - End Property - - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, - m2 As IM2_AverageElectricalLoadDemand, - m3 As IM3_AveragePneumaticLoadDemand, - m4 As IM4_AirCompressor, - m5 As IM5_SmartAlternatorSetGeneration, - signals As ISignals) - - _m1 = m1 - _m2 = m2 - _m3 = m3 - _m4 = m4 - _m5 = m5 - _signals = signals - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M7.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M7.vb deleted file mode 100644 index 714bcce9c895a4e2f0812057e67e7f3d93937d4f..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M7.vb +++ /dev/null @@ -1,109 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M7 - Implements IM7 - - Private _m5 As IM5_SmartAlternatorSetGeneration - Private _m6 As IM6 - Private _signals As ISignals - - 'Boolean Conditions - Private ReadOnly Property C1 As Boolean - Get - Return _m6.OverrunFlag AndAlso _signals.ClutchEngaged AndAlso _signals.InNeutral = False - End Get - End Property - - 'Internal Switched Outputs - Private ReadOnly Property SW1 As Watt - Get - - Dim idle As Boolean = _signals.EngineSpeed <= _signals.EngineIdleSpeed AndAlso - (Not _signals.ClutchEngaged OrElse _signals.InNeutral) - - Return _ - If(idle, _m5.AlternatorsGenerationPowerAtCrankIdleWatts, _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts) - End Get - End Property - - Private ReadOnly Property SW2 As Watt - Get - Return If(C1, _m6.SmartElecAndPneumaticAltPowerGenAtCrank, SW1) - End Get - End Property - - Private ReadOnly Property SW3 As Watt - Get - Return If(C1, _m6.SmartElecAndPneumaticAirCompPowerGenAtCrank, _m6.AveragePowerDemandAtCrankFromPneumatics) - End Get - End Property - - Private ReadOnly Property SW4 As Watt - Get - Return If(C1, _m6.SmartElecOnlyAltPowerGenAtCrank, SW1) - End Get - End Property - - Private ReadOnly Property SW5 As Watt - Get - Return If(C1, _m6.SmartPneumaticOnlyAirCompPowerGenAtCrank, _m6.AveragePowerDemandAtCrankFromPneumatics) - End Get - End Property - - 'Public readonly properties ( Outputs ) - Public ReadOnly Property SmartElectricalAndPneumaticAuxAltPowerGenAtCrank As Watt _ - Implements IM7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank - Get - Return SW2 - End Get - End Property - - Public ReadOnly Property SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank As Watt _ - Implements IM7.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank - Get - Return SW3 - End Get - End Property - - Public ReadOnly Property SmartElectricalOnlyAuxAltPowerGenAtCrank As Watt _ - Implements IM7.SmartElectricalOnlyAuxAltPowerGenAtCrank - Get - Return SW4 - End Get - End Property - - Public ReadOnly Property SmartPneumaticOnlyAuxAirCompPowerGenAtCrank As Watt _ - Implements IM7.SmartPneumaticOnlyAuxAirCompPowerGenAtCrank - Get - Return SW5 - End Get - End Property - - 'Constructor - Public Sub New(m5 As IM5_SmartAlternatorSetGeneration, - m6 As IM6, - signals As ISignals) - - _m5 = m5 - _m6 = m6 - _signals = signals - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M8.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M8.vb deleted file mode 100644 index 3ac82eb359692df3bdf47524b034c2afd98ea7e2..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M8.vb +++ /dev/null @@ -1,144 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M8 - Implements IM8 - -#Region "Private Fields" - - Private _m1 As IM1_AverageHVACLoadDemand - Private _m6 As IM6 - Private _m7 As IM7 - Private _signals As ISignals - -#End Region - -#Region "Internal Sums and Switches" - - 'Internal Staged Sums and Switches - Private ReadOnly Property Sum1 As Watt - Get - Return _ - _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank() + _m7.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank() - End Get - End Property - - Private ReadOnly Property Sum2 As Watt - Get - Return _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank() + _m6.AveragePowerDemandAtCrankFromPneumatics - End Get - End Property - - Private ReadOnly Property Sum3 As Watt - Get - Return _m7.SmartPneumaticOnlyAuxAirCompPowerGenAtCrank + _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC - End Get - End Property - - Private ReadOnly Property Sum4 As Watt - Get - Return _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC + _m6.AveragePowerDemandAtCrankFromPneumatics - End Get - End Property - - Private ReadOnly Property Sum5 As Watt - Get - Return _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + SW5 - End Get - End Property - - Private ReadOnly Property Sum6 As Watt - Get - Return If(SW6, Sum5, SIBase(Of Watt).Create(0)) - End Get - End Property - - Private ReadOnly Property SW1 As Watt - Get - Return If(_signals.SmartPneumatics, Sum1, Sum2) - End Get - End Property - - Private ReadOnly Property SW2 As Watt - Get - Return If(_signals.SmartPneumatics, Sum3, Sum4) - End Get - End Property - - Private ReadOnly Property SW3 As Watt - Get - Return _ - If _ - (_signals.SmartPneumatics, _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank(), - _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank()) - End Get - End Property - - Private ReadOnly Property SW4 As Boolean - Get - Return If(_signals.SmartElectrics, _m6.SmartElecAndPneumaticsCompressorFlag, _m6.SmartPneumaticsOnlyCompressorFlag) - End Get - End Property - - Private ReadOnly Property SW5 As Watt - Get - Return If(_signals.SmartElectrics, SW1, SW2) - End Get - End Property - - Private ReadOnly Property SW6 As Boolean - Get - Return Not _signals.EngineStopped - End Get - End Property - -#End Region - - 'OUT1 - Public ReadOnly Property AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries As Watt _ - Implements IM8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries - Get - Return Sum6 - End Get - End Property - 'OUT2 - Public ReadOnly Property SmartElectricalAlternatorPowerGenAtCrank As Watt _ - Implements IM8.SmartElectricalAlternatorPowerGenAtCrank - Get - Return SW3 - End Get - End Property - 'OUT3 - Public ReadOnly Property CompressorFlag As Boolean Implements IM8.CompressorFlag - Get - Return SW4 - End Get - End Property - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, m6 As IM6, m7 As IM7, signals As ISignals) - - _m1 = m1 - _m6 = m6 - _m7 = m7 - _signals = signals - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb deleted file mode 100644 index 39908f12dd77c1d7af4b2aa3e48c87361a75cb08..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb +++ /dev/null @@ -1,236 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M9 - Implements IM9 - Private Const RPM_TO_RADS_PER_SECOND As Single = 60 / (2 * Math.PI) '9.55F - -#Region "Aggregates" - - 'AG1 - Private _LitresOfAirCompressorOnContinuallyAggregate As NormLiter - 'AG2 - Private _LitresOfAirCompressorOnOnlyInOverrunAggregate As NormLiter - 'AG3 - Private _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate As Kilogram - 'AG4 - Private _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate As Kilogram - -#End Region - -#Region "Constructor Requirements" - - Private M1 As IM1_AverageHVACLoadDemand - Private M4 As IM4_AirCompressor - Private M6 As IM6 - Private M8 As IM8 - Private FMAP As IFuelConsumptionMap - Private PSAC As IPneumaticsAuxilliariesConfig - Private Signals As ISignals - -#End Region - - -#Region "Class Outputs" - 'OUT 1 - Public ReadOnly Property LitresOfAirCompressorOnContinually As NormLiter _ - Implements IM9.LitresOfAirCompressorOnContinually - Get - Return _LitresOfAirCompressorOnContinuallyAggregate - End Get - End Property - 'OUT 2 - Public ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As NormLiter _ - Implements IM9.LitresOfAirCompressorOnOnlyInOverrun - Get - Return _LitresOfAirCompressorOnOnlyInOverrunAggregate - End Get - End Property - 'OUT 3 - Public ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Kilogram _ - Implements IM9.TotalCycleFuelConsumptionCompressorOffContinuously - Get - Return _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate - End Get - End Property - 'OUT 4 - Public ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Kilogram _ - Implements IM9.TotalCycleFuelConsumptionCompressorOnContinuously - Get - Return _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate - End Get - End Property - -#End Region - - 'Staging Calculations - Private Function S0(ByVal rpm As PerSecond) As PerSecond - - If rpm < 1 Then rpm = 1.RPMtoRad() - - Return rpm ' / RPM_TO_RADS_PER_SECOND - End Function - - Private ReadOnly Property S1 As Watt - Get - Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts - End Get - End Property - - Private ReadOnly Property S2 As NewtonMeter - Get - If S0(Signals.EngineSpeed).IsEqual(0) Then _ - Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") - Return M4.GetPowerCompressorOn / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property S3 As NewtonMeter - Get - If S0(Signals.EngineSpeed).IsEqual(0) Then _ - Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") - Return M4.GetPowerCompressorOff / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property S4 As NewtonMeter - Get - If S0(Signals.EngineSpeed).IsEqual(0) Then _ - Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") - Return S1 / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property S5 As NewtonMeter - Get - Return S2 + S14 - End Get - End Property - - Private ReadOnly Property S6 As NewtonMeter - Get - Return S14 + S3 - End Get - End Property - - Private ReadOnly Property S7 As NewtonMeter - Get - Return S4 + S5 - End Get - End Property - - Private ReadOnly Property S8 As NewtonMeter - Get - Return S4 + S6 - End Get - End Property - - Private ReadOnly Property S9 As NormLiterPerSecond - Get - Return If(M6.OverrunFlag AndAlso M8.CompressorFlag, M4.GetFlowRate, SIBase(Of NormLiterPerSecond).Create(0)) - End Get - End Property - - Private ReadOnly Property S10 As NormLiterPerSecond - Get - Return S13 * PSAC.OverrunUtilisationForCompressionFraction - End Get - End Property - - Private ReadOnly Property S11 As KilogramPerSecond - Get - 'SCHM 3_02 - Dim int1 As KilogramPerSecond = FMAP.GetFuelConsumption(S7, Signals.EngineSpeed) - int1 = If(int1 > 0 AndAlso Not Double.IsNaN(int1.Value()), int1, 0.SI(Of KilogramPerSecond)) - - Return int1 - End Get - End Property - - Private ReadOnly Property S12 As KilogramPerSecond - Get - - 'SCHM 3_02 - Dim int2 As KilogramPerSecond = FMAP.GetFuelConsumption(S8, Signals.EngineSpeed) - int2 = If(int2 > 0 AndAlso Not Double.IsNaN(int2.Value()), int2, 0.SI(Of KilogramPerSecond)) - - Return int2 - End Get - End Property - - Private ReadOnly Property S13 As NormLiterPerSecond - Get - Return If(Signals.ClutchEngaged AndAlso Not (Signals.InNeutral), S9, SIBase(Of NormLiterPerSecond).Create(0)) - End Get - End Property - - Private ReadOnly Property S14 As NewtonMeter - Get - Return _ - Signals.EngineDrivelineTorque + - Signals.PreExistingAuxPower / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property SW1 As Boolean - Get - Return Not Signals.EngineStopped - End Get - End Property - - 'Utility Methods - Public Sub ClearAggregates() Implements IM9.ClearAggregates - - _LitresOfAirCompressorOnContinuallyAggregate = SIBase(Of NormLiter).Create(0) - _LitresOfAirCompressorOnOnlyInOverrunAggregate = SIBase(Of NormLiter).Create(0) - _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate = SIBase(Of Kilogram).Create(0) - _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate = SIBase(Of Kilogram).Create(0) - End Sub - - Public Sub CycleStep(stepTimeInSeconds As Second) Implements IM9.CycleStep - - If Signals.EngineStopped Then Return - - If (SW1) Then - _LitresOfAirCompressorOnContinuallyAggregate += M4.GetFlowRate * stepTimeInSeconds - _LitresOfAirCompressorOnOnlyInOverrunAggregate += S10 * stepTimeInSeconds - _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate += S11 * stepTimeInSeconds - _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate += S12 * stepTimeInSeconds - End If - End Sub - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, m4 As IM4_AirCompressor, m6 As IM6, m8 As IM8, - fmap As IFuelConsumptionMap, psac As IPneumaticsAuxilliariesConfig, signals As ISignals) - Me.M1 = m1 - Me.M4 = m4 - Me.M6 = m6 - Me.M8 = m8 - Me.FMAP = fmap - Me.PSAC = psac - Me.Signals = signals - - ClearAggregates() - End Sub - - 'Auxiliary Event - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cDelaunayMap.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cDelaunayMap.vb deleted file mode 100644 index 0dee1481c911afe5286ab6178db1a6830cf08059..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/cDelaunayMap.vb +++ /dev/null @@ -1,475 +0,0 @@ -' Copyright 2017 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 System.Collections.Generic - -Public Class cDelaunayMap - Public ptDim As Integer - - Public ptList As List(Of dPoint) - Private lDT As List(Of dTriangle) - Private planes As List(Of Double()) - - Public DualMode As Boolean - Private ptListXZ As List(Of dPoint) - Private planesXZ As List(Of Double()) - Private lDTXZ As List(Of dTriangle) - - Public ExtrapolError As Boolean - - - Public Sub New() - ptList = New List(Of dPoint) - ptListXZ = New List(Of dPoint) - DualMode = False - End Sub - - Public Sub AddPoints(ByVal X As Double, ByVal Y As Double, ByVal Z As Double) - ptList.Add(New dPoint(X, Y, Z)) - If DualMode Then ptListXZ.Add(New dPoint(X, Z, Y)) - End Sub - - Public Function Triangulate() As Boolean - Dim tr As dTriangle - Dim DT As dTriangulation - - ptDim = ptList.Count - 1 - - 'XY-triangulation - Try - DT = New dTriangulation - lDT = DT.Triangulate(ptList) - Catch ex As Exception - Return False - End Try - - planes = New List(Of Double()) - - For Each tr In lDT - planes.Add(GetPlane(tr)) - Next - - - '#If DEBUG Then - ' Dim i As Int16 - ' Debug.Print("#,x1,y1,z1,x2,y2,z2") - ' i = -1 - ' For Each tr In lDT - ' i += 1 - ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) - ' Debug.Print(i & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) - ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z) - ' Next - '#End If - - - 'XZ-triangulation - If DualMode Then - - If ptDim <> ptListXZ.Count - 1 Then Return False - - Try - DT = New dTriangulation - lDTXZ = DT.Triangulate(ptListXZ) - Catch ex As Exception - Return False - End Try - - planesXZ = New List(Of Double()) - - For Each tr In lDTXZ - planesXZ.Add(GetPlane(tr)) - Next - - End If - - Return True - End Function - - 'XY => Z Interpolation - Public Function Intpol(ByVal x As Double, ByVal y As Double) As Double - Dim j As Integer - Dim l0 As Double() - Dim tr As dTriangle - - ExtrapolError = False - - 'Try exact solution for IsInside() - j = - 1 - For Each tr In lDT - j += 1 - If IsInside(tr, x, y, True) Then - l0 = planes(j) - Return (l0(3) - x*l0(0) - y*l0(1))/l0(2) - End If - Next - - 'Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) - j = - 1 - For Each tr In lDT - j += 1 - If IsInside(tr, x, y, False) Then - l0 = planes(j) - Return (l0(3) - x*l0(0) - y*l0(1))/l0(2) - End If - Next - - - 'ERROR: Extrapolation - ExtrapolError = True - - Return Nothing - End Function - - 'XZ => Y Interpolation - Public Function IntpolXZ(ByVal x As Double, ByVal z As Double) As Double - Dim j As Integer - Dim l0 As Double() - Dim tr As dTriangle - - ExtrapolError = False - - If DualMode Then - - j = - 1 - - 'Try exact solution for IsInside() - For Each tr In lDTXZ - j += 1 - If IsInside(tr, x, z, True) Then - l0 = planesXZ(j) - Return (l0(3) - x*l0(0) - z*l0(1))/l0(2) - End If - Next - - 'Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) - j = - 1 - For Each tr In lDTXZ - j += 1 - If IsInside(tr, x, z, False) Then - l0 = planesXZ(j) - Return (l0(3) - x*l0(0) - z*l0(1))/l0(2) - End If - Next - - 'ERROR: Extrapolation - ExtrapolError = True - Return Nothing - - Else - - 'ERROR: Extrapolation - ExtrapolError = True - Return Nothing - - End If - End Function - - Private Function GetPlane(ByRef tr As dTriangle) As Double() - Dim AB As dPoint - Dim AC As dPoint - Dim cross As dPoint - Dim l(3) As Double - Dim pt1 As dPoint - Dim pt2 As dPoint - Dim pt3 As dPoint - - pt1 = tr.P1 - pt2 = tr.P2 - pt3 = tr.P3 - - AB = New dPoint(pt2.X - pt1.X, pt2.Y - pt1.Y, pt2.Z - pt1.Z) - AC = New dPoint(pt3.X - pt1.X, pt3.Y - pt1.Y, pt3.Z - pt1.Z) - - cross = New dPoint(AB.Y*AC.Z - AB.Z*AC.Y, AB.Z*AC.X - AB.X*AC.Z, AB.X*AC.Y - AB.Y*AC.X) - - l(0) = cross.X - l(1) = cross.Y - l(2) = cross.Z - - l(3) = pt1.X*cross.X + pt1.Y*cross.Y + pt1.Z*cross.Z - - Return l - End Function - - Private Function IsInside(ByRef tr As dTriangle, ByVal xges As Double, ByVal yges As Double, ByVal Exact As Boolean) _ - As Boolean - Dim v0(1) As Double - Dim v1(1) As Double - Dim v2(1) As Double - Dim dot00 As Double - Dim dot01 As Double - Dim dot02 As Double - Dim dot11 As Double - Dim dot12 As Double - Dim invDenom As Double - Dim u As Double - Dim v As Double - Dim pt1 As dPoint - Dim pt2 As dPoint - Dim pt3 As dPoint - - pt1 = tr.P1 - pt2 = tr.P2 - pt3 = tr.P3 - - 'Quelle: http://www.blackpawn.com/texts/pointinpoly/default.html (Barycentric Technique) - - ' Compute vectors - v0(0) = pt3.X - pt1.X - v0(1) = pt3.Y - pt1.Y - - v1(0) = pt2.X - pt1.X - v1(1) = pt2.Y - pt1.Y - - v2(0) = xges - pt1.X - v2(1) = yges - pt1.Y - - ' Compute dot products - dot00 = v0(0)*v0(0) + v0(1)*v0(1) - dot01 = v0(0)*v1(0) + v0(1)*v1(1) - dot02 = v0(0)*v2(0) + v0(1)*v2(1) - dot11 = v1(0)*v1(0) + v1(1)*v1(1) - dot12 = v1(0)*v2(0) + v1(1)*v2(1) - - ' Compute barycentric coordinates - invDenom = 1/(dot00*dot11 - dot01*dot01) - u = (dot11*dot02 - dot01*dot12)*invDenom - v = (dot00*dot12 - dot01*dot02)*invDenom - - 'Debug.Print(u & ", " & v & ", " & u + v) - - ' Check if point is in triangle - If Exact Then - Return (u >= 0) And (v >= 0) And (u + v <= 1) - Else - Return (u >= - 0.001) And (v >= - 0.001) And (u + v <= 1.001) - End If - End Function - - Public Class dPoint - Public X As Double - Public Y As Double - Public Z As Double - - Public Sub New(ByVal xd As Double, ByVal yd As Double, ByVal zd As Double) - X = xd - Y = yd - Z = zd - End Sub - - Public Shared Operator =(left As dPoint, right As dPoint) As Boolean - - 'If DirectCast(left, Object) = DirectCast(right, Object) Then - ' Return True - 'End If - - 'If (DirectCast(left, Object) Is Nothing) OrElse (DirectCast(right, Object) Is Nothing) Then - ' Return False - 'End If - - ' Just compare x and y here... - If left.X <> right.X Then - Return False - End If - - If left.Y <> right.Y Then - Return False - End If - - Return True - End Operator - - Public Shared Operator <>(left As dPoint, right As dPoint) As Boolean - Return Not (left = right) - End Operator - End Class - - Public Class dTriangle - Public P1 As dPoint - Public P2 As dPoint - Public P3 As dPoint - - Public Sub New(ByRef pp1 As dPoint, ByRef pp2 As dPoint, ByRef pp3 As dPoint) - P1 = pp1 - P2 = pp2 - P3 = pp3 - End Sub - - Public Function ContainsInCircumcircle(pt As dPoint) As Double - Dim ax As Double = Me.P1.X - pt.X - Dim ay As Double = Me.P1.Y - pt.Y - Dim bx As Double = Me.P2.X - pt.X - Dim by As Double = Me.P2.Y - pt.Y - Dim cx As Double = Me.P3.X - pt.X - Dim cy As Double = Me.P3.Y - pt.Y - Dim det_ab As Double = ax*by - bx*ay - Dim det_bc As Double = bx*cy - cx*by - Dim det_ca As Double = cx*ay - ax*cy - Dim a_squared As Double = ax*ax + ay*ay - Dim b_squared As Double = bx*bx + by*by - Dim c_squared As Double = cx*cx + cy*cy - - Return a_squared*det_bc + b_squared*det_ca + c_squared*det_ab - End Function - - Public Function SharesVertexWith(triangle As dTriangle) As Boolean - If Me.P1.X = triangle.P1.X AndAlso Me.P1.Y = triangle.P1.Y Then - Return True - End If - If Me.P1.X = triangle.P2.X AndAlso Me.P1.Y = triangle.P2.Y Then - Return True - End If - If Me.P1.X = triangle.P3.X AndAlso Me.P1.Y = triangle.P3.Y Then - Return True - End If - - If Me.P2.X = triangle.P1.X AndAlso Me.P2.Y = triangle.P1.Y Then - Return True - End If - If Me.P2.X = triangle.P2.X AndAlso Me.P2.Y = triangle.P2.Y Then - Return True - End If - If Me.P2.X = triangle.P3.X AndAlso Me.P2.Y = triangle.P3.Y Then - Return True - End If - - If Me.P3.X = triangle.P1.X AndAlso Me.P3.Y = triangle.P1.Y Then - Return True - End If - If Me.P3.X = triangle.P2.X AndAlso Me.P3.Y = triangle.P2.Y Then - Return True - End If - If Me.P3.X = triangle.P3.X AndAlso Me.P3.Y = triangle.P3.Y Then - Return True - End If - - Return False - End Function - End Class - - Public Class dEdge - Public StartPoint As dPoint - Public EndPoint As dPoint - - Public Sub New(ByRef p1 As dPoint, ByRef p2 As dPoint) - StartPoint = p1 - EndPoint = p2 - End Sub - - Public Shared Operator =(left As dEdge, right As dEdge) As Boolean - 'If DirectCast(left, Object) = DirectCast(right, Object) Then - ' Return True - 'End If - - 'If (DirectCast(left, Object) Is Nothing) Or (DirectCast(right, Object) Is Nothing) Then - ' Return False - 'End If - - Return _ - ((left.StartPoint = right.StartPoint AndAlso left.EndPoint = right.EndPoint) OrElse - (left.StartPoint = right.EndPoint AndAlso left.EndPoint = right.StartPoint)) - End Operator - - Public Shared Operator <>(left As dEdge, right As dEdge) As Boolean - Return Not (left = right) - End Operator - End Class - - Public Class dTriangulation - Public Function Triangulate(triangulationPoints As List(Of dPoint)) As List(Of dTriangle) - If triangulationPoints.Count < 3 Then - Throw New ArgumentException("Can not triangulate less than three vertices!") - End If - - ' The triangle list - Dim triangles As New List(Of dTriangle)() - - - ' The "supertriangle" which encompasses all triangulation points. - ' This triangle initializes the algorithm and will be removed later. - Dim superTriangle As dTriangle = Me.SuperTriangle(triangulationPoints) - triangles.Add(superTriangle) - - ' Include each point one at a time into the existing triangulation - For i As Integer = 0 To triangulationPoints.Count - 1 - ' Initialize the edge buffer. - Dim EdgeBuffer As New List(Of dEdge)() - - ' If the actual vertex lies inside the circumcircle, then the three edges of the - ' triangle are added to the edge buffer and the triangle is removed from list. - For j As Integer = triangles.Count - 1 To 0 Step - 1 - Dim t As dTriangle = triangles(j) - If t.ContainsInCircumcircle(triangulationPoints(i)) > 0 Then - EdgeBuffer.Add(New dEdge(t.P1, t.P2)) - EdgeBuffer.Add(New dEdge(t.P2, t.P3)) - EdgeBuffer.Add(New dEdge(t.P3, t.P1)) - triangles.RemoveAt(j) - End If - Next - - ' Remove duplicate edges. This leaves the convex hull of the edges. - ' The edges in this convex hull are oriented counterclockwise! - For j As Integer = EdgeBuffer.Count - 2 To 0 Step - 1 - For k As Integer = EdgeBuffer.Count - 1 To j + 1 Step - 1 - If EdgeBuffer(j) = EdgeBuffer(k) Then - EdgeBuffer.RemoveAt(k) - EdgeBuffer.RemoveAt(j) - k -= 1 - Continue For - End If - Next - Next - - ' Generate new counterclockwise oriented triangles filling the "hole" in - ' the existing triangulation. These triangles all share the actual vertex. - For j As Integer = 0 To EdgeBuffer.Count - 1 - triangles.Add(New dTriangle(EdgeBuffer(j).StartPoint, EdgeBuffer(j).EndPoint, triangulationPoints(i))) - Next - Next - - ' We don't want the supertriangle in the triangulation, so - ' remove all triangles sharing a vertex with the supertriangle. - For i As Integer = triangles.Count - 1 To 0 Step - 1 - If triangles(i).SharesVertexWith(superTriangle) Then - triangles.RemoveAt(i) - End If - Next - - ' Return the triangles - Return triangles - End Function - - - Private Function SuperTriangle(triangulationPoints As List(Of dPoint)) As dTriangle - Dim M As Double = triangulationPoints(0).X - - ' get the extremal x and y coordinates - For i As Integer = 1 To triangulationPoints.Count - 1 - Dim xAbs As Double = Math.Abs(triangulationPoints(i).X) - Dim yAbs As Double = Math.Abs(triangulationPoints(i).Y) - If xAbs > M Then - M = xAbs - End If - If yAbs > M Then - M = yAbs - End If - Next - - ' make a triangle - Dim sp1 As New dPoint(10*M, 0, 0) - Dim sp2 As New dPoint(0, 10*M, 0) - Dim sp3 As New dPoint(- 10*M, - 10*M, 0) - - Return New dTriangle(sp1, sp2, sp3) - End Function - End Class -End Class - diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cFile V3.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cFile V3.vb deleted file mode 100644 index 9c75cac2ce191764ed4369c14864a4e594a687f5..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/cFile V3.vb +++ /dev/null @@ -1,150 +0,0 @@ -' Copyright 2017 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. -Public Class cFile_V3 - Private TxtFldParser As Microsoft.VisualBasic.FileIO.TextFieldParser - Private StrWrter As System.IO.StreamWriter - Private Mode As FileMode - Private Path As String - Private Sepp As String - Private SkipCom As Boolean - Private StopE As Boolean - Private FileOpen As Boolean - Private PreLine As String() - Private FileEnd As Boolean - - 'File format - private FileFormat As System.Text.Encoding = System.Text.Encoding.UTF8 - - Public Sub New() - Me.Reset() - End Sub - - Private Sub Reset() - FileOpen = False - Mode = FileMode.Undefined - PreLine = Nothing - FileEnd = False - End Sub - - Public Function OpenRead(ByVal FileName As String, Optional ByVal Separator As String = ",", - Optional ByVal SkipComment As Boolean = True, Optional ByVal StopAtE As Boolean = False) As Boolean - Me.Reset() - StopE = StopAtE - Path = FileName - Sepp = Separator - SkipCom = SkipComment - If Not (Mode = FileMode.Undefined) Then Return False - If Not IO.File.Exists(Path) Then Return False - Mode = FileMode.Read - Try - TxtFldParser = New Microsoft.VisualBasic.FileIO.TextFieldParser(Path, System.Text.Encoding.Default) - FileOpen = True - Catch ex As Exception - Return False - End Try - TxtFldParser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited - TxtFldParser.Delimiters = New String() {Sepp} - - 'If TxtFldParser.EndOfData Then Return False - - Me.ReadLine() - Return True - End Function - - Public Function ReadLine() As String() - Dim line As String() - Dim line0 As String - - line = PreLine - - lb10: - If TxtFldParser.EndOfData Then - - FileEnd = True - - Else - - PreLine = TxtFldParser.ReadFields - line0 = UCase(Trim(PreLine(0))) - - If SkipCom Then - If Left(line0, 1) = "#" Then GoTo lb10 - End If - - If StopE Then FileEnd = (line0 = "E") - - End If - - Return line - End Function - - Public Sub Close() - Select Case Mode - Case FileMode.Read - If FileOpen Then TxtFldParser.Close() - TxtFldParser = Nothing - Case FileMode.Write - If FileOpen Then StrWrter.Close() - StrWrter = Nothing - End Select - Me.Reset() - End Sub - - Public ReadOnly Property EndOfFile() As Boolean - Get - Return FileEnd - End Get - End Property - - Public Function OpenWrite(ByVal FileName As String, Optional ByVal Separator As String = ",", - Optional ByVal AutoFlush As Boolean = False, Optional ByVal Append As Boolean = False) As Boolean - Me.Reset() - Path = FileName - Sepp = Separator - If Not (Mode = FileMode.Undefined) Then Return False - Mode = FileMode.Write - Try - StrWrter = My.Computer.FileSystem.OpenTextFileWriter(Path, Append, FileFormat) - FileOpen = True - Catch ex As Exception - Return False - End Try - StrWrter.AutoFlush = AutoFlush - Return True - End Function - - Public Sub WriteLine(ByVal ParamArray x() As Object) - Dim St As String - Dim StB As New System.Text.StringBuilder - Dim Skip As Boolean - Skip = True - For Each St In x - If Skip Then - StB.Append(St) - Skip = False - Else - StB.Append(Sepp & St) - End If - Next - StrWrter.WriteLine(StB.ToString) - StB = Nothing - End Sub - - Public Sub WriteLine(ByVal x As String) - StrWrter.WriteLine(x) - End Sub - - Private Enum FileMode - Undefined - Read - Write - End Enum -End Class diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb deleted file mode 100644 index 7b8c13d27d42bff352cbea31fec97461f7564548..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb +++ /dev/null @@ -1,192 +0,0 @@ -' Copyright 2017 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 System.Collections.Generic -Imports System.Globalization -Imports TUGraz.VectoCommon.Utils - -Public Class cMAP - Implements IFuelConsumptionMap - - Private LnU As List(Of Single) - Private LTq As List(Of Single) - Private lFC As List(Of Single) - - Private sFilePath As String - Private iMapDim As Integer - - Private FuelMap As cDelaunayMap - - Private Sub ResetMe() - lFC = Nothing - LTq = Nothing - LnU = Nothing - iMapDim = - 1 - FuelMap = New cDelaunayMap - End Sub - - Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean - Dim file As cFile_V3 - Dim line As String() - Dim nU As Single - Dim MsgSrc As String - - - MsgSrc = "Main/ReadInp/MAP" - - 'Reset - ResetMe() - - 'Stop if there's no file - If sFilePath = "" OrElse Not IO.File.Exists(sFilePath) Then - Return False - End If - - 'Open file - file = New cFile_V3 - If Not file.OpenRead(sFilePath) Then - file = Nothing - Return False - End If - - 'Skip Header - file.ReadLine() - - 'Initi Lists (before version check so ReadOldFormat works) - lFC = New System.Collections.Generic.List(Of Single) - LTq = New System.Collections.Generic.List(Of Single) - LnU = New System.Collections.Generic.List(Of Single) - - Try - Do While Not file.EndOfFile - - 'Line read - line = file.ReadLine - - 'Line counter up (was reset in ResetMe) - iMapDim += 1 - - 'Revolutions - nU = Single.Parse(line(0), CultureInfo.InvariantCulture) - - LnU.Add(nU) - - 'Power - LTq.Add(Single.Parse(line(1), CultureInfo.InvariantCulture)) - - 'FC - 'Check sign - If CSng(line(2)) < 0 Then - file.Close() - - Return False - End If - - lFC.Add(CSng(line(2))) - - - Loop - Catch ex As Exception - - - GoTo lbEr - - End Try - - 'Close file - file.Close() - - file = Nothing - - Return True - - - 'ERROR-label for clean Abort - lbEr: - file.Close() - file = Nothing - - Return False - End Function - - Public Function Triangulate() As Boolean - Dim i As Integer - - Dim MsgSrc As String - - MsgSrc = "MAP/Norm" - - 'FC Delauney - For i = 0 To iMapDim - FuelMap.AddPoints(LnU(i), LTq(i), lFC(i)) - Next - - Return FuelMap.Triangulate() - End Function - - - Public Function fFCdelaunay_Intp(ByVal nU As Single, ByVal Tq As Single) As Single - Dim val As Single - - val = CType(FuelMap.Intpol(nU, Tq), Single) - - If FuelMap.ExtrapolError Then - - Return - 10000 - Else - Return val - End If - End Function - -#Region "Properties" - - Public Property FilePath() As String - Get - Return sFilePath - End Get - Set(ByVal value As String) - sFilePath = value - End Set - End Property - - Public ReadOnly Property MapDim As Integer - Get - Return iMapDim - End Get - End Property - - Public ReadOnly Property Tq As List(Of Single) - Get - Return LTq - End Get - End Property - - Public ReadOnly Property FC As List(Of Single) - Get - Return lFC - End Get - End Property - - Public ReadOnly Property nU As List(Of Single) - Get - Return LnU - End Get - End Property - -#End Region - - Public Function GetFuelConsumption(torque As NewtonMeter, angularVelocity As PerSecond) As KilogramPerSecond _ - Implements IFuelConsumptionMap.GetFuelConsumption - Return _ - (fFCdelaunay_Intp(CType(angularVelocity.AsRPM, Single), CType(torque.Value(), Single)) / 3600.0 / 1000.0).SI(Of KilogramPerSecond)() - End Function -End Class - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AltUserInput.vb b/VECTOAux/VectoAuxiliaries/Electrics/AltUserInput.vb deleted file mode 100644 index 18c79741954b5c2d2b1b0bda7ee30bf73d94df8a..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/AltUserInput.vb +++ /dev/null @@ -1,27 +0,0 @@ -Option Strict On - - -Namespace Electrics -'Used by the Combined Alternator Form/Classes to accept user input for the combined alternators efficiency -'At different Current Demands - Public class AltUserInput - Public Amps As Double - Public Eff As Double - - 'Constructor - Sub New(amps As Double, eff As Double) - - Me.Amps = amps - Me.Eff = eff - End Sub - - 'Equality - Public Function IsEqual(other As AltUserInput, Optional rounding As Integer = 7) As Boolean - - Return Math.round(Me.Amps, rounding) = Math.Round(other.Amps, rounding) AndAlso - Math.Round(Me.Eff, rounding) = Math.Round(other.eff, rounding) - End Function - End class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/Alternator.vb b/VECTOAux/VectoAuxiliaries/Electrics/Alternator.vb deleted file mode 100644 index 179102eca47e75efb4950d735ef31202da8e56c5..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/Alternator.vb +++ /dev/null @@ -1,326 +0,0 @@ -Option Strict On - -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class Table4Row - Public RPM As Double - Public Efficiency As Double - - Public Sub New(rpm As Double, eff As Double) - - Me.RPM = rpm - Me.Efficiency = eff - End Sub - End Class - - 'Model based on CombinedALTS_V02_Editable.xlsx - Public Class Alternator - Implements IAlternator - - Private signals As ICombinedAlternatorSignals - - 'D6 - Public Property AlternatorName As String Implements IAlternator.AlternatorName - 'G6 - Public Property PulleyRatio As Single Implements IAlternator.PulleyRatio - 'C10-D15 - Public Property InputTable2000 As New List(Of AltUserInput) Implements IAlternator.InputTable2000 - 'F10-G15 - Public Property InputTable4000 As New List(Of AltUserInput) Implements IAlternator.InputTable4000 - 'I10-J15 - Public Property InputTable6000 As New List(Of AltUserInput) Implements IAlternator.InputTable6000 - 'M10-N15 - Public Property RangeTable As New List(Of Table4Row) Implements IAlternator.RangeTable - 'S9 - Public ReadOnly Property SpindleSpeed As Double Implements IAlternator.SpindleSpeed - Get - Return signals.CrankRPM * PulleyRatio - End Get - End Property - 'S10 - Public ReadOnly Property Efficiency As Double Implements IAlternator.Efficiency - - Get - 'First build RangeTable, table 4 - InitialiseRangeTable() - CalculateRangeTable() - - 'Calculate ( Interpolate ) Efficiency - Dim range As List(Of AltUserInput) = RangeTable.Select(Function(s) New AltUserInput(s.RPM, s.Efficiency)).ToList() - - Return Alternator.Iterpolate(range, Convert.ToSingle(SpindleSpeed)) - End Get - End Property - - - 'Constructors - Sub New() - End Sub - - Sub New(isignals As ICombinedAlternatorSignals, inputs As List(Of ICombinedAlternatorMapRow)) - - - If isignals Is Nothing Then Throw New ArgumentException("Alternator - ISignals supplied is nothing") - signals = isignals - - Me.AlternatorName = inputs.First().AlternatorName - Me.PulleyRatio = inputs.First().PulleyRatio - - Dim values2k As Dictionary(Of Double, Double) = - inputs.Where(Function(x) x.RPM = 2000).Select(Function(x) New KeyValuePair(Of Double, Double)(x.Amps, x.Efficiency)) _ - .ToDictionary(Function(x) x.Key, Function(x) x.Value) - Dim values4k As Dictionary(Of Double, Double) = - inputs.Where(Function(x) x.RPM = 4000).Select(Function(x) New KeyValuePair(Of Double, Double)(x.Amps, x.Efficiency)) _ - .ToDictionary(Function(x) x.Key, Function(x) x.Value) - Dim values6k As Dictionary(Of Double, Double) = - inputs.Where(Function(x) x.RPM = 6000).Select(Function(x) New KeyValuePair(Of Double, Double)(x.Amps, x.Efficiency)) _ - .ToDictionary(Function(x) x.Key, Function(x) x.Value) - - - BuildInputTable(values2k, InputTable2000) - BuildInputTable(values4k, InputTable4000) - BuildInputTable(values6k, InputTable6000) - - - CreateRangeTable() - End Sub - - Public Shared Function Iterpolate(values As List(Of AltUserInput), x As Double) As Double - - Dim lowestX As Double = values.Min(Function(m) m.Amps) - Dim highestX As Double = values.Max(Function(m) m.Amps) - Dim preKey, postKey, preEff, postEff, EffSlope As Double - Dim deltaX, deltaEff As Double - - '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 Double = ((x - preKey) * EffSlope) + preEff - - Return retVal - End Function - - Private Sub CalculateRangeTable() - - 'M10=Row0-Rpm - N10=Row0-Eff - 'M11=Row1-Rpm - N11=Row1-Eff - 'M12=Row2-Rpm - N12=Row2-Eff - 2000 - 'M13=Row3-Rpm - N13=Row3-Eff - 4000 - 'M14=Row4-Rpm - N14=Row4-Eff - 6000 - 'M15=Row5-Rpm - N15=Row5-Eff - 'M16=Row6-Rpm - N16=Row6-Eff - - Dim N10, N11, N12, N13, N14, N15, N16 As Double - Dim M10, M11, M12, M13, M14, M15, M16 As Double - - 'EFFICIENCY - - '2000 - N12 = Alternator.Iterpolate(InputTable2000, signals.CurrentDemandAmps.Value()) - RangeTable(2).Efficiency = N12 - '4000 - N13 = Alternator.Iterpolate(InputTable4000, signals.CurrentDemandAmps.Value()) - RangeTable(3).Efficiency = N13 - '6000 - N14 = Alternator.Iterpolate(InputTable6000, signals.CurrentDemandAmps.Value()) - RangeTable(4).Efficiency = N14 - - 'Row0 & Row1 Efficiency =IF(N13>N12,0,MAX(N12:N14)) - Example Alt 1 N13= - N11 = If(N13 > N12, 0, Math.Max(Math.Max(N12, N13), N14)) - RangeTable(1).Efficiency = N11 - N10 = N11 - RangeTable(0).Efficiency = N10 - - - 'Row 5 Efficiency - N15 = If(N13 > N14, 0, Math.Max(Math.Max(N12, N13), N14)) - RangeTable(5).Efficiency = N15 - 'Row 6 - Efficiency - N16 = N15 - RangeTable(6).Efficiency = N16 - - 'RPM - - '2000 Row 2 - RPM - M12 = 2000 - RangeTable(2).RPM = M12 - - '4000 Row 3 - RPM - M13 = 4000 - RangeTable(3).RPM = M13 - - '6000 Row 4 - RPM - M14 = 6000 - RangeTable(4).RPM = M14 - - 'Row 1 - RPM - 'NOTE: Update to reflect CombineALternatorSchematicV02 20150429 - 'IF(M12=IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11)), M12-0.01, IF(N12>N13,M12-((M12-M13)/(N12-N13))*(N12-N11),M12-((M12-M13)/(N12-N13))*(N12-N11))) - M11 = - Convert.ToSingle( - If _ - (N12 - N13 = 0, 0, - If _ - (M12 = If(N12 > N13, M12 - ((M12 - M13) / (N12 - N13)) * (N12 - N11), M12 - ((M12 - M13) / (N12 - N13)) * (N12 - N11)), - M12 - 0.01, - If(N12 > N13, M12 - ((M12 - M13) / (N12 - N13)) * (N12 - N11), M12 - ((M12 - M13) / (N12 - N13)) * (N12 - N11))))) - RangeTable(1).RPM = M11 - - 'Row 0 - RPM - M10 = If(M11 < 1500, M11 - 1, 1500) - RangeTable(0).RPM = M10 - - 'Row 5 - RPM - M15 = - Convert.ToSingle( - If _ - ( - M14 = - If _ - ((N14 = 0 OrElse N14 = N13), M14 + 1, - If(N13 > N14, ((((M14 - M13) / (N13 - N14)) * N14) + M14), ((((M14 - M13) / (N13 - N14)) * (N14 - N15)) + M14))), - M14 + 0.01, - If _ - ((N14 = 0 OrElse N14 = N13), M14 + 1, - If(N13 > N14, ((((M14 - M13) / (N13 - N14)) * N14) + M14), ((((M14 - M13) / (N13 - N14)) * (N14 - N15)) + M14))))) - RangeTable(5).RPM = M15 - - - 'Row 6 - RPM - M16 = If(M15 > 10000, M15 + 1, 10000) - RangeTable(6).RPM = M16 - End Sub - - Private Sub InitialiseRangeTable() - - RangeTable(0).RPM = 0 - RangeTable(0).Efficiency = 0 - RangeTable(1).RPM = 0 - RangeTable(0).Efficiency = 0 - RangeTable(2).RPM = 2000 - RangeTable(0).Efficiency = 0 - RangeTable(3).RPM = 4000 - RangeTable(0).Efficiency = 0 - RangeTable(4).RPM = 6000 - RangeTable(0).Efficiency = 0 - RangeTable(5).RPM = 0 - RangeTable(0).Efficiency = 0 - RangeTable(6).RPM = 0 - RangeTable(0).Efficiency = 0 - End Sub - - Private Sub CreateRangeTable() - - - RangeTable.Clear() - - RangeTable.Add(New Table4Row(0, 0)) - RangeTable.Add(New Table4Row(0, 0)) - RangeTable.Add(New Table4Row(0, 0)) - RangeTable.Add(New Table4Row(0, 0)) - RangeTable.Add(New Table4Row(0, 0)) - RangeTable.Add(New Table4Row(0, 0)) - RangeTable.Add(New Table4Row(0, 0)) - End Sub - - Public Sub BuildInputTable(inputs As Dictionary(Of Double, Double), targetTable As List(Of AltUserInput)) - - - Dim C11, C12, C13, C14, C15, D11, D12, D13, D14, D15 As Double - targetTable.Clear() - - 'Row0 - targetTable.Add(New AltUserInput(0, D14)) - - 'Row1 - targetTable.Add(New AltUserInput(inputs.OrderBy(Function(x) x.Key).First.Key, - inputs.OrderBy(Function(x) x.Key).First.Value)) - - 'Row2 - targetTable.Add(New AltUserInput(inputs.OrderBy(Function(x) x.Key).Skip(1).First.Key, - inputs.OrderBy(Function(x) x.Key).Skip(1).First.Value)) - - 'Row3 - targetTable.Add(New AltUserInput(inputs.OrderBy(Function(x) x.Key).Skip(2).First.Key, - inputs.OrderBy(Function(x) x.Key).Skip(2).First.Value)) - - C11 = targetTable(1).Amps - C12 = targetTable(2).Amps - C13 = targetTable(3).Amps - - D11 = targetTable(1).Eff - D12 = targetTable(2).Eff - D13 = targetTable(3).Eff - - D14 = If(D12 > D13, 0, Math.Max(Math.Max(D11, D12), D13)) - - - 'Row4 - Eff - targetTable.Add(New AltUserInput(0, D14)) - - - 'Row4 - Amps - ' Should probably refactor this into some sort of helper/extension method - Dim numarray As Double() = {D11, D12, D13} - Dim maxD11_D13 As Double = numarray.Max() - - '=IF(OR(D13=0,D13=D12),C13+1,IF(D12>D13,((((C13-C12)/(D12-D13))*D13)+C13),((((C13-C12)/(D12-D13))*(D13-D14))+C13))) - C14 = - If _ - ((D13 = 0 OrElse D13 = D12 OrElse D13 = maxD11_D13), C13 + 1, - If(D12 > D13, ((((C13 - C12) / (D12 - D13)) * D13) + C13), ((((C13 - C12) / (D12 - D13)) * (D13 - D14)) + C13))) - targetTable(4).Amps = C14 - - 'Row5 - C15 = If(C14 > 200, C14 + 1, 200) - D15 = D14 - targetTable.Add(New AltUserInput(C15, D15)) - - 'Row0 - targetTable(0).Eff = D11 - End Sub - - Public Function IsEqualTo(other As IAlternator) As Boolean Implements IAlternator.IsEqualTo - - If Me.AlternatorName <> other.AlternatorName Then Return False - If Me.PulleyRatio <> other.PulleyRatio Then Return False - - Dim i As Integer = 1 - - For i = 1 To 3 - - If Me.InputTable2000(i).Eff <> other.InputTable2000(i).Eff Then Return False - If Me.InputTable4000(i).Eff <> other.InputTable4000(i).Eff Then Return False - If Me.InputTable6000(i).Eff <> other.InputTable6000(i).Eff Then Return False - - - Next - - Return True - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb deleted file mode 100644 index 1456fb32911e0a529b10bd58af7571d790f362b3..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb +++ /dev/null @@ -1,339 +0,0 @@ -' Copyright 2017 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 System.Globalization -Imports System.IO -Imports System.Text -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class AlternatorMap - Implements IAlternatorMap - - Private ReadOnly filePath As String - - Private _map As New List(Of MapPoint) - Private _yRange As List(Of Double) - Private _xRange As List(Of Double) - Private _minX, _minY, _maxX, _maxY As Double - - 'Required Action Test or Interpolation Type - Public Function OnBoundaryYInterpolatedX(x As Double, y As Double) As Boolean - Return _yRange.Contains(y) AndAlso Not _xRange.Contains(x) - End Function - - Public Function OnBoundaryXInterpolatedY(x As Double, y As Double) As Boolean - Return Not _yRange.Contains(y) AndAlso _xRange.Contains(x) - End Function - - Public Function ONBoundaryXY(x As Double, y As Double) As Boolean - Return (From sector In _map Where sector.Y = y AndAlso sector.x = x).Count = 1 - End Function - - 'Determine Value Methods - Private Function GetOnBoundaryXY(x As Double, y As Double) As Double - Return (From sector In _map Where sector.Y = y AndAlso sector.x = x).First().v - End Function - - Private Function GetOnBoundaryYInterpolatedX(x As Double, y As Double) As Double - - Dim x0, x1, v0, v1, slope, dx As Double - - x0 = (From p In _xRange Order By p Where p < x).Last() - x1 = (From p In _xRange Order By p Where p > x).First() - dx = x1 - x0 - - v0 = GetOnBoundaryXY(x0, y) - v1 = GetOnBoundaryXY(x1, y) - - slope = (v1 - v0) / (x1 - x0) - - Return v0 + ((x - x0) * slope) - End Function - - Private Function GetOnBoundaryXInterpolatedY(x As Double, y As Double) As Double - - Dim y0, y1, v0, v1, dy, v, slope As Double - - y0 = (From p In _yRange Order By p Where p < y).Last() - y1 = (From p In _yRange Order By p Where p > y).First() - dy = y1 - y0 - - v0 = GetOnBoundaryXY(x, y0) - v1 = GetOnBoundaryXY(x, y1) - - slope = (v1 - v0) / (y1 - y0) - - v = v0 + ((y - y0) * slope) - - Return v - End Function - - Private Function GetBiLinearInterpolatedValue(x As Double, y As Double) As Double - - Dim q11, q12, q21, q22, x1, x2, y1, y2, r1, r2, p As Double - - y1 = (From mapSector As MapPoint In _map Where mapSector.Y < y).Last().Y - y2 = (From mapSector As MapPoint In _map Where mapSector.Y > y).First().Y - - x1 = (From mapSector As MapPoint In _map Where mapSector.x < x).Last().x - x2 = (From mapSector As MapPoint In _map Where mapSector.x > x).First().x - - q11 = GetOnBoundaryXY(x1, y1) - q12 = GetOnBoundaryXY(x1, y2) - - q21 = GetOnBoundaryXY(x2, y1) - q22 = GetOnBoundaryXY(x2, y2) - - r1 = ((x2 - x) / (x2 - x1)) * q11 + ((x - x1) / (x2 - x1)) * q21 - - r2 = ((x2 - x) / (x2 - x1)) * q12 + ((x - x1) / (x2 - x1)) * q22 - - - p = ((y2 - y) / (y2 - y1)) * r1 + ((y - y1) / (y2 - y1)) * r2 - - - Return p - End Function - - 'Utilities - Private Sub fillMapWithDefaults() - - - _map.Add(New MapPoint(10, 1500, 0.615)) - _map.Add(New MapPoint(27, 1500, 0.7)) - _map.Add(New MapPoint(53, 1500, 0.1947)) - _map.Add(New MapPoint(63, 1500, 0.0)) - _map.Add(New MapPoint(68, 1500, 0.0)) - _map.Add(New MapPoint(125, 1500, 0.0)) - _map.Add(New MapPoint(136, 1500, 0.0)) - _map.Add(New MapPoint(10, 2000, 0.62)) - _map.Add(New MapPoint(27, 2000, 0.7)) - _map.Add(New MapPoint(53, 2000, 0.3)) - _map.Add(New MapPoint(63, 2000, 0.1462)) - _map.Add(New MapPoint(68, 2000, 0.692)) - _map.Add(New MapPoint(125, 2000, 0.0)) - _map.Add(New MapPoint(136, 2000, 0.0)) - _map.Add(New MapPoint(10, 4000, 0.64)) - _map.Add(New MapPoint(27, 4000, 0.6721)) - _map.Add(New MapPoint(53, 4000, 0.7211)) - _map.Add(New MapPoint(63, 4000, 0.74)) - _map.Add(New MapPoint(68, 4000, 0.7352)) - _map.Add(New MapPoint(125, 4000, 0.68)) - _map.Add(New MapPoint(136, 4000, 0.6694)) - _map.Add(New MapPoint(10, 6000, 0.53)) - _map.Add(New MapPoint(27, 6000, 0.5798)) - _map.Add(New MapPoint(53, 6000, 0.656)) - _map.Add(New MapPoint(63, 6000, 0.6853)) - _map.Add(New MapPoint(68, 6000, 0.7)) - _map.Add(New MapPoint(125, 6000, 0.6329)) - _map.Add(New MapPoint(136, 6000, 0.62)) - _map.Add(New MapPoint(10, 7000, 0.475)) - _map.Add(New MapPoint(27, 7000, 0.5337)) - _map.Add(New MapPoint(53, 7000, 0.6235)) - _map.Add(New MapPoint(63, 7000, 0.658)) - _map.Add(New MapPoint(68, 7000, 0.6824)) - _map.Add(New MapPoint(125, 7000, 0.6094)) - _map.Add(New MapPoint(136, 7000, 0.5953)) - End Sub - - Private Sub getMapRanges() - - _yRange = (From coords As MapPoint In _map Order By coords.Y Select coords.Y Distinct).ToList() - _xRange = (From coords As MapPoint In _map Order By coords.x Select coords.x Distinct).ToList() - - _minX = _xRange.First - _maxX = _xRange.Last - _minY = _yRange.First - _maxY = _yRange.Last - End Sub - - 'Single entry point to determine Value on map - Public Function GetValue(x As Double, y As Double) As Double - - - If x < _minX OrElse x > _maxX OrElse y < _minY OrElse y > _maxY Then - - 'OnAuxiliaryEvent(String.Format("Alternator Map Limiting : RPM{0}, AMPS{1}",x,y),AdvancedAuxiliaryMessageType.Warning) - - - 'Limiting - If x < _minX Then x = _minX - If x > _maxX Then x = _maxX - If y < _minY Then y = _minY - If y > _maxY Then y = _maxY - - End If - - - 'Satisfies both data points - non interpolated value - If ONBoundaryXY(x, y) Then Return GetOnBoundaryXY(x, y) - - 'Satisfies only x or y - single interpolation value - If OnBoundaryXInterpolatedY(x, y) Then Return GetOnBoundaryXInterpolatedY(x, y) - If OnBoundaryYInterpolatedX(x, y) Then Return GetOnBoundaryYInterpolatedX(x, y) - - 'satisfies no data points - Bi-Linear interpolation - Return GetBiLinearInterpolatedValue(x, y) - End Function - - Public Function ReturnDefaultMapValueTests() As String - - Dim sb As StringBuilder = New StringBuilder() - Dim x, y As Single - - 'All Sector Values - sb.AppendLine("All Values From Map") - sb.AppendLine("-------------------") - For Each x In _xRange - - For Each y In _yRange - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - Next - - Next - - sb.AppendLine("") - sb.AppendLine("Four Corners with interpolated other") - sb.AppendLine("-------------------") - x = 1500 - y = 18.5 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - x = 7000 - y = 96.5 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - x = 1750 - y = 10 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - x = 6500 - y = 10 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - - sb.AppendLine("") - sb.AppendLine("Interpolated both") - sb.AppendLine("-------------------") - - Dim mx, my As Double - Dim x2, y2 As Integer - For x2 = 0 To _xRange.Count - 2 - - For y2 = 0 To _yRange.Count - 2 - - mx = _xRange(x2) + (_xRange(x2 + 1) - _xRange(x2)) / 2 - my = _yRange(y2) + (_yRange(y2 + 1) - _yRange(y2)) / 2 - - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", mx, my, GetValue(mx, my))) - - - Next - - Next - - sb.AppendLine("") - sb.AppendLine("MIKE -> 40 & 1000") - sb.AppendLine("-------------------") - x = 1000 - y = 40 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - - - Return sb.ToString() - End Function - - 'Constructors - Public Sub New(filepath As String) - - Me.filePath = filepath - - Initialise() - - getMapRanges() - End Sub - - Private Class MapPoint - Public Y As Double - Public x As Double - Public v As Double - - Public Sub New(y As Double, x As Double, v As Double) - - Me.Y = y - Me.x = x - Me.v = v - End Sub - End Class - - 'Get Alternator Efficiency - Public Function GetEfficiency(rpm As Double, amps As Ampere) As AlternatorMapValues _ - Implements IAlternatorMap.GetEfficiency - - Return New AlternatorMapValues(GetValue(rpm, amps.Value())) - End Function - - 'Initialises the map. - 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 List(Of MapPoint) - Dim firstline As Boolean = True - - For Each line As String In lines - If Not firstline Then - - 'Advanced Alternator Source Check. - If line.Contains("[MODELSOURCE") Then Exit For - - 'split the line - Dim elements() As String = line.Split(New Char() {","c}, 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 newPoint As MapPoint = New MapPoint(Single.Parse(elements(0), CultureInfo.InvariantCulture), - Single.Parse(elements(1), CultureInfo.InvariantCulture), - Single.Parse(elements(2), CultureInfo.InvariantCulture)) - _map.Add(newPoint) - - 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 - - - 'Public Events - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent - - Protected Sub OnAuxiliaryEvent(message As String, messageType As AdvancedAuxiliaryMessageType) - - RaiseEvent AuxiliaryEvent(Me, message, messageType) - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapOLDREMOVELATER.vb b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapOLDREMOVELATER.vb deleted file mode 100644 index 4be843238d70322997946a3c71afca320afedc6b..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapOLDREMOVELATER.vb +++ /dev/null @@ -1,313 +0,0 @@ -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 diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapValues.vb b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapValues.vb deleted file mode 100644 index 54c3f19b07bbe2cb1b3cbb41c3268c47abb69098..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapValues.vb +++ /dev/null @@ -1,23 +0,0 @@ -' Copyright 2017 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. - - -Namespace Electrics - 'Originally was going to hold more than one value type. - Public Structure AlternatorMapValues - Public ReadOnly Efficiency As Double - - Public Sub New(ByVal efficiency As Double) - Me.Efficiency = efficiency - End Sub - End Structure -End Namespace - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAltEntry.vb b/VECTOAux/VectoAuxiliaries/Electrics/CombinedAltEntry.vb deleted file mode 100644 index 1bd421ee95282534838911bb59966be593e2b7ae..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAltEntry.vb +++ /dev/null @@ -1,32 +0,0 @@ -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 - - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternator.vb b/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternator.vb deleted file mode 100644 index bfa3f81396bb12c0696b1f7eef0ba7462674be55..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternator.vb +++ /dev/null @@ -1,436 +0,0 @@ -Option Strict On - -Imports System -Imports System.Collections.Generic -Imports System.Linq -Imports System.Text -Imports System.IO -Imports System.Globalization -Imports TUGraz.VectoCommon.Utils - - -Namespace Electrics - Public Class CombinedAlternator - Implements IAlternatorMap, ICombinedAlternator - - Private map As New List(Of ICombinedAlternatorMapRow) - Public Property Alternators As New List(Of IAlternator) Implements ICombinedAlternator.Alternators - Private OriginalAlternators As New List(Of IAlternator) - Private FilePath As String - Private altSignals As ICombinedAlternatorSignals - Private Signals As ISignals - Private AverageAlternatorsEfficiency As AlternatorMapValues - - 'Interface Implementation - Public Function GetEfficiency(ByVal CrankRPM As Double, ByVal Amps As Ampere) As AlternatorMapValues _ - Implements IAlternatorMap.GetEfficiency - - altSignals.CrankRPM = CrankRPM - altSignals.CurrentDemandAmps = (Amps.Value() / Alternators.Count).SI(Of Ampere)() - - Dim alternatorMapValues As AlternatorMapValues = Nothing - - If Signals Is Nothing OrElse Signals.RunningCalc Then - 'If running calc cycle get efficiency from interpolation function - alternatorMapValues = New AlternatorMapValues(Convert.ToSingle(Alternators.Average(Function(a) a.Efficiency) / 100)) - Else - 'If running Pre calc cycle get an average of inputs - alternatorMapValues = AverageAlternatorsEfficiency - End If - - If alternatorMapValues.Efficiency <= 0 Then - alternatorMapValues = New AlternatorMapValues(0.01) - End If - - Return alternatorMapValues - End Function - - Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise - - 'From the map we construct this CombinedAlternator object and original CombinedAlternator Object - - Alternators.Clear() - OriginalAlternators.Clear() - - - For Each alt As IEnumerable(Of ICombinedAlternatorMapRow) In map.GroupBy(Function(g) g.AlternatorName) - - Dim altName As String = alt.First().AlternatorName - Dim pulleyRatio As Single = alt.First().PulleyRatio - - - Dim alternator As IAlternator = New Alternator(altSignals, alt.ToList()) - - Alternators.Add(alternator) - - - Next - - Return True - End Function - - 'Constructors - Public Sub New(filePath As String, Optional signals As ISignals = Nothing) - - Dim feedback As String = String.Empty - Me.Signals = signals - - If Not FilePathUtils.ValidateFilePath(filePath, ".aalt", feedback) Then - Throw New ArgumentException(String.Format("Combined Alternator requires a valid .AALT filename. : {0}", feedback)) - Else - Me.FilePath = filePath - End If - - - Me.altSignals = New CombinedAlternatorSignals() - - - 'IF file exists then read it otherwise create a default. - - If File.Exists(filePath) AndAlso InitialiseMap(filePath) Then - Initialise() - Else - 'Create Default Map - CreateDefaultMap() - Initialise() - End If - - ' Calculate alternators average which is used only in the pre-run - Dim efficiencySum As Double - Dim efficiencyAverage As Double - - For Each alt As IAlternator In Alternators - efficiencySum += alt.InputTable2000.ElementAt(1).Eff - efficiencySum += alt.InputTable2000.ElementAt(2).Eff - efficiencySum += alt.InputTable2000.ElementAt(3).Eff - - efficiencySum += alt.InputTable4000.ElementAt(1).Eff - efficiencySum += alt.InputTable4000.ElementAt(2).Eff - efficiencySum += alt.InputTable4000.ElementAt(3).Eff - - efficiencySum += alt.InputTable6000.ElementAt(1).Eff - efficiencySum += alt.InputTable6000.ElementAt(2).Eff - efficiencySum += alt.InputTable6000.ElementAt(3).Eff - Next - - efficiencyAverage = efficiencySum / (Alternators.Count * 9) - AverageAlternatorsEfficiency = New AlternatorMapValues(efficiencyAverage / 100) - End Sub - - 'Helpers - Private Sub CreateDefaultMap() - - map.Clear() - - map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 10, 62, 3.6)) - map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 27, 70, 3.6)) - map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 53, 30, 3.6)) - - map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 10, 64, 3.6)) - map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 63, 74, 3.6)) - map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 125, 68, 3.6)) - - map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 10, 53, 3.6)) - map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 68, 70, 3.6)) - map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 136, 62, 3.6)) - - map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 10, 62, 3)) - map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 27, 70, 3)) - map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 53, 30, 3)) - - map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 10, 64, 3)) - map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 63, 74, 3)) - map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 125, 68, 3)) - - map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 10, 53, 3)) - map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 68, 70, 3)) - map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 136, 62, 3)) - End Sub - - 'Grid Management - Private Function AddNewAlternator(list As List(Of ICombinedAlternatorMapRow), ByRef feeback As String) As Boolean - - Dim returnValue As Boolean = True - - Dim altName As String = list.First().AlternatorName - Dim pulleyRatio As Single = list.First().PulleyRatio - - 'Check alt does not already exist in list - If Alternators.Where(Function(w) w.AlternatorName = altName).Count > 0 Then - feeback = "This alternator already exists in in the list, operation not completed." - Return False - End If - - Dim alternator As IAlternator = New Alternator(altSignals, list.ToList()) - - Alternators.Add(alternator) - - - Return returnValue - End Function - - Public Function AddAlternator(rows As List(Of ICombinedAlternatorMapRow), ByRef feedback As String) As Boolean - - If Not AddNewAlternator(rows, feedback) Then - feedback = String.Format("Unable to add new alternator : {0}", feedback) - Return False - End If - - Return True - End Function - - Public Function DeleteAlternator(alternatorName As String, ByRef feedback As String, CountValidation As Boolean) _ - As Boolean - - 'Is this the last alternator, if so deny the user the right to remove it. - If CountValidation AndAlso Alternators.Count < 2 Then - feedback = "There must be at least one alternator remaining, operation aborted." - Return False - End If - - If Alternators.Where(Function(w) w.AlternatorName = alternatorName).Count = 0 Then - feedback = "This alternator does not exist" - Return False - End If - - Dim altToRemove As IAlternator = Alternators.First(Function(w) w.AlternatorName = alternatorName) - Dim numAlternators As Integer = Alternators.Count - - Alternators.Remove(altToRemove) - - If Alternators.Count = numAlternators - 1 Then - Return True - Else - feedback = String.Format("The alternator {0} could not be removed : {1}", alternatorName, feedback) - Return False - End If - End Function - 'Public Function UpdateAlternator( gridIndex As Integer, rows As List(Of ICombinedAlternatorMapRow), ByRef feedback As String) As Boolean - - ' Dim altName As String = rows.First.AlternatorName - ' Dim altToUpd As IAlternator = Alternators.First(Function(w) w.AlternatorName = altName) - - ' If Not DeleteAlternator(altName, feedback) Then - ' feedback = feedback - ' Return False - - ' End If - - ' 'Re.create alternator. - - ' Dim replacementAlt As New Alternator(altSignals, rows) - ' Alternators.Add(replacementAlt) - - ' Return True - - - 'End Function - - 'Persistance Functions - Public Function Save(aaltPath As String) As Boolean - - - Dim returnValue As Boolean = True - Dim sb As New StringBuilder() - Dim row As Integer = 0 - Dim amps As Double - Dim eff As Double - - 'write headers - sb.AppendLine("[AlternatorName],[RPM],[Amps],[Efficiency],[PulleyRatio]") - - 'write details - For Each alt As IAlternator In Alternators.OrderBy(Function(o) o.AlternatorName) - - - '2000 - IE Alt1,2000,10,50,3 - For row = 1 To 3 - amps = alt.InputTable2000(row).Amps - eff = alt.InputTable2000(row).Eff - sb.Append( - alt.AlternatorName + ",2000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + - alt.PulleyRatio.ToString("0.000")) - sb.AppendLine("") - Next - - '4000 - IE Alt1,2000,10,50,3 - For row = 1 To 3 - amps = alt.InputTable4000(row).Amps - eff = alt.InputTable4000(row).Eff - sb.Append( - alt.AlternatorName + ",4000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + - alt.PulleyRatio.ToString("0.000")) - sb.AppendLine("") - Next - - '6000 - IE Alt1,2000,10,50,3 - For row = 1 To 3 - amps = alt.InputTable6000(row).Amps - eff = alt.InputTable6000(row).Eff - sb.Append( - alt.AlternatorName + ",6000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + - alt.PulleyRatio.ToString("0.000")) - sb.AppendLine("") - Next - - - Next - - 'Add Model Source - sb.AppendLine("[MODELSOURCE]") - sb.Append(Me.ToString()) - - ' Write the stream cotnents to a new file named "AllTxtFiles.txt" - Using outfile As New StreamWriter(aaltPath) - outfile.Write(sb.ToString()) - End Using - - Return returnValue - End Function - - Private Function Load() As Boolean - - If Not InitialiseMap(FilePath) Then Return False - - - Return True - End Function - - 'Initialises the map, only valid when loadingUI for first time in edit mode or always in operational mode. - Private Function InitialiseMap(filePath As String) As Boolean - - Dim returnValue As Boolean = False - Dim elements As String() - - 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() < 10) Then - Throw New ArgumentException("Insufficient rows in csv to build a usable map") - End If - - map = New List(Of ICombinedAlternatorMapRow) - - Dim firstline As Boolean = True - - For Each line As String In lines - If Not firstline Then - - 'Advanced Alternator Source Check. - If line.Contains("[MODELSOURCE") Then Exit For - - 'split the line - elements = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) - '3 entries per line required - If (elements.Length <> 5) Then - Throw New ArgumentException("Incorrect number of values in csv file") - End If - 'add values to map - - map.Add(New CombinedAlternatorMapRow(elements(0), Single.Parse(elements(1), CultureInfo.InvariantCulture), - Single.Parse(elements(2), CultureInfo.InvariantCulture), - Single.Parse(elements(3), CultureInfo.InvariantCulture), - Single.Parse(elements(4), CultureInfo.InvariantCulture))) - - Else - firstline = False - End If - Next line - End Using - Return True - Else - Throw New ArgumentException("Supplied input file does not exist") - End If - - Return returnValue - End Function - - 'Can be used to send messages to Vecto. - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent - - 'This is used to generate a diagnostics output which enables the user to - 'Determine if they beleive the resulting map is what is expected - 'Basically it is a check against the model/Spreadsheet - Public Overrides Function ToString() As String - - Dim sb As New StringBuilder() - Dim a1, a2, a3, e1, e2, e3 As String - - - For Each alt As Alternator In Alternators.OrderBy(Function(o) o.AlternatorName) - sb.AppendLine("") - sb.AppendFormat("** {0} ** , PulleyRatio {1}", alt.AlternatorName, alt.PulleyRatio) - sb.AppendLine("") - sb.AppendLine("******************************************************************") - sb.AppendLine("") - - Dim i As Integer = 1 - sb.AppendLine("Table 1 (2000)" + vbTab + "Table 2 (4000)" + vbTab + "Table 3 (6000)") - sb.AppendLine("Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab) - sb.AppendLine("") - For i = 1 To 3 - - a1 = alt.InputTable2000(i).Amps.ToString("0") - e1 = alt.InputTable2000(i).Eff.ToString("0.000") - a2 = alt.InputTable4000(i).Amps.ToString("0") - e2 = alt.InputTable4000(i).Eff.ToString("0.000") - a3 = alt.InputTable6000(i).Amps.ToString("0") - e3 = alt.InputTable6000(i).Eff.ToString("0.000") - sb.AppendLine(a1 + vbTab + e1 + vbTab + a2 + vbTab + e2 + vbTab + a3 + vbTab + e3 + vbTab) - - Next - - - Next - - 'sb.AppendLine("") - 'sb.AppendLine("********* COMBINED EFFICIENCY VALUES **************") - 'sb.AppendLine("") - 'sb.AppendLine(vbTab + "RPM VALUES") - 'sb.AppendLine("AMPS" + vbTab + "500" + vbTab + "1500" + vbTab + "2500" + vbTab + "3500" + vbTab + "4500" + vbTab + "5500" + vbTab + "6500" + vbTab + "7500") - 'For a As Single = 1 To Alternators.Count * 50 - - ' sb.Append(a.ToString("0") + vbTab) - ' For Each r As Single In {500, 1500, 2500, 3500, 4500, 5500, 6500, 7500} - - ' Dim eff As Single = GetEfficiency(r, a).Efficiency - - ' sb.Append(eff.ToString("0.000") + vbTab) - - ' Next - ' sb.AppendLine("") - - 'Next - - - Return sb.ToString() - End Function - - - 'Equality - Public Function IsEqualTo(other As ICombinedAlternator) As Boolean Implements ICombinedAlternator.IsEqualTo - - 'Count Check. - If Me.Alternators.Count <> other.Alternators.Count Then Return False - - For Each alt As IAlternator In Me.Alternators - - 'Can we find the same alternatorName in other - If other.Alternators.Where(Function(f) f.AlternatorName = alt.AlternatorName).Count() <> 1 Then Return False - - 'get the alternator to compare and compare it. - If Not alt.IsEqualTo(other.Alternators.First(Function(f) f.AlternatorName = alt.AlternatorName)) Then Return False - - Next - - Return True - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternatorMapRow.vb b/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternatorMapRow.vb deleted file mode 100644 index d9a141dbbd2b959de8f0744863fc880c92c78d71..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternatorMapRow.vb +++ /dev/null @@ -1,36 +0,0 @@ -Namespace Electrics - 'This class is reflective of the stored entries for the combined alternator - 'And is used by the Combined Alternator Form and any related classes. - - Public Class CombinedAlternatorMapRow - Implements ICombinedAlternatorMapRow - - Public Property AlternatorName As String Implements ICombinedAlternatorMapRow.AlternatorName - Public Property RPM As Single Implements ICombinedAlternatorMapRow.RPM - Public Property Amps As Single Implements ICombinedAlternatorMapRow.Amps - Public Property Efficiency As Single Implements ICombinedAlternatorMapRow.Efficiency - Public Property PulleyRatio As Single Implements ICombinedAlternatorMapRow.PulleyRatio - - 'Constructors - Sub New() - End Sub - - Sub New(AlternatorName As String, RPM As Single, Amps As Single, Efficiency As Single, PulleyRatio As Single) - - 'Sanity Check - If AlternatorName.Trim.Length = 0 Then Throw New ArgumentException("Alternator name cannot be zero length") - If Efficiency < 0 Or Efficiency > 100 Then _ - Throw New ArgumentException("Alternator Efficiency must be between 0 and 100") - If PulleyRatio <= 0 Then Throw New ArgumentException("Alternator Pully ratio must be a positive number") - - 'Assignments - Me.AlternatorName = AlternatorName - Me.RPM = RPM - Me.Amps = Amps - Me.Efficiency = Efficiency - Me.PulleyRatio = PulleyRatio - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternatorSignals.vb b/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternatorSignals.vb deleted file mode 100644 index 873d569f5c5fc599ba7aa95ed848a21ad111101d..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternatorSignals.vb +++ /dev/null @@ -1,18 +0,0 @@ - -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - 'Used by the CombinedAlternator class and any other related classes. - Public Class CombinedAlternatorSignals - Implements ICombinedAlternatorSignals - - Public Property CrankRPM As Double Implements ICombinedAlternatorSignals.CrankRPM - - Public Property CurrentDemandAmps As Ampere Implements ICombinedAlternatorSignals.CurrentDemandAmps - - 'Number of alternators in the Combined Alternator - Public Property NumberOfAlternators As Integer Implements ICombinedAlternatorSignals.NumberOfAlternators - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricConstants.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricConstants.vb deleted file mode 100644 index a04737a39216d3215492120ee2698857c7c0fec8..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricConstants.vb +++ /dev/null @@ -1,33 +0,0 @@ -' Copyright 2017 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. - -Namespace Electrics - Public Class ElectricConstants - 'Anticipated Min and Max Allowable values for Powernet, normally 26.3 volts but could be 48 in the future. - Public Const PowenetVoltageMin As Double = 6 - Public Const PowenetVoltageMax As Double = 50 - - 'Duty Cycle IE Percentage of use - Public Const PhaseIdleTractionOnMin As Double = 0 - Public Const PhaseIdleTractionMax As Double = 1 - - 'Max Min Expected Consumption for a Single Consumer, negative values allowed as bonuses. - Public Const NonminalConsumerConsumptionAmpsMin As Integer = - 10 - Public Const NominalConsumptionAmpsMax As Integer = 100 - - - 'Alternator - public const AlternatorPulleyEfficiencyMin as single = 0.1 - public const AlternatorPulleyEfficiencyMax as single = 1 - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumer.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumer.vb deleted file mode 100644 index 8fff90df7738db016cb6a10cab5c26689923a479..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumer.vb +++ /dev/null @@ -1,190 +0,0 @@ -Imports System.ComponentModel -Imports TUGraz.VectoCommon.Utils - -' Copyright 2017 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. - -Namespace Electrics - ''' <summary> - ''' Described a consumer of Alternator electrical power - ''' </summary> - ''' <remarks></remarks> - Public Class ElectricalConsumer - Implements IElectricalConsumer - - 'Fields - Private _BaseVehicle As Boolean - Private _Category As String - Private _ConsumerName As String - Private _NominalConsumptionAmps As Double - Private _NumberInActualVehicle As Integer - Private _PhaseIdle_TractionOn As Double - Private _PowerNetVoltage As Double - Private _Info As String - - 'Calculated - Private Property AvgConsumptionAmps As Double Implements IElectricalConsumer.AvgConsumptionAmps - - 'Properties - Public Property BaseVehicle As Boolean Implements IElectricalConsumer.BaseVehicle - Get - Return _BaseVehicle - End Get - Set(value As Boolean) - _BaseVehicle = value - NotifyPropertyChanged("BaseVehicle") - End Set - End Property - - Public Property Category As String Implements IElectricalConsumer.Category - Get - Return _Category - End Get - Set(value As String) - _Category = value - NotifyPropertyChanged("Category") - End Set - End Property - - Public Property ConsumerName As String Implements IElectricalConsumer.ConsumerName - Get - Return _ConsumerName - End Get - Set(value As String) - _ConsumerName = value - NotifyPropertyChanged("ConsumerName") - End Set - End Property - - Public Property NominalConsumptionAmps As Double Implements IElectricalConsumer.NominalConsumptionAmps - Get - Return _NominalConsumptionAmps - End Get - Set(value As Double) - _NominalConsumptionAmps = value - NotifyPropertyChanged("NominalConsumptionAmps") - End Set - End Property - - Public Property NumberInActualVehicle As Integer Implements IElectricalConsumer.NumberInActualVehicle - Get - Return _NumberInActualVehicle - End Get - Set(value As Integer) - _NumberInActualVehicle = value - NotifyPropertyChanged("NumberInActualVehicle") - End Set - End Property - - Public Property PhaseIdle_TractionOn As Double Implements IElectricalConsumer.PhaseIdle_TractionOn - Get - Return _PhaseIdle_TractionOn - End Get - Set(value As Double) - _PhaseIdle_TractionOn = value - NotifyPropertyChanged("PhaseIdle_TractionOn") - End Set - End Property - - Public Property PowerNetVoltage As Double Implements IElectricalConsumer.PowerNetVoltage - Get - Return _PowerNetVoltage - End Get - Set(value As Double) - _PowerNetVoltage = value - NotifyPropertyChanged("PowerNetVoltage") - End Set - End Property - - Public Property Info As String Implements IElectricalConsumer.Info - Get - Return _Info - End Get - Set(value As String) - _Info = value - NotifyPropertyChanged("Info") - End Set - End Property - - - 'Public class outputs - Public Function TotalAvgConumptionAmps(Optional PhaseIdle_TractionOnBasedOnCycle As Double = Nothing) As Ampere _ - Implements IElectricalConsumer.TotalAvgConumptionAmps - - If ConsumerName = "Doors per Door" Then - Return NominalConsumptionAmps.SI(Of Ampere)() * (NumberInActualVehicle * PhaseIdle_TractionOnBasedOnCycle) - Else - Return NominalConsumptionAmps.SI(Of Ampere)() * (NumberInActualVehicle * PhaseIdle_TractionOn) - End If - End Function - - Public Function TotalAvgConsumptionInWatts(Optional PhaseIdle_TractionOnBasedOnCycle As Double = 0.0) As Watt _ - Implements IElectricalConsumer.TotalAvgConsumptionInWatts - Return TotalAvgConumptionAmps(PhaseIdle_TractionOnBasedOnCycle) * PowerNetVoltage.SI(Of Volt)() - End Function - - 'Constructor - Public Sub New(BaseVehicle As Boolean, Category As String, ConsumerName As String, NominalConsumptionAmps As Double, - PhaseIdle_TractionOn As Double, PowerNetVoltage As Double, numberInVehicle As Integer, info As String) - - 'Illegal Value Check. - If Category.Trim.Length = 0 Then Throw New ArgumentException("Category Name cannot be empty") - If ConsumerName.Trim.Length = 0 Then Throw New ArgumentException("ConsumerName Name cannot be empty") - If _ - PhaseIdle_TractionOn < ElectricConstants.PhaseIdleTractionOnMin Or - PhaseIdle_TractionOn > ElectricConstants.PhaseIdleTractionMax Then _ - Throw New ArgumentException("PhaseIdle_TractionOn must have a value between 0 and 1") - If _ - NominalConsumptionAmps < ElectricConstants.NonminalConsumerConsumptionAmpsMin Or - NominalConsumptionAmps > ElectricConstants.NominalConsumptionAmpsMax Then _ - Throw New ArgumentException("NominalConsumptionAmps must have a value between 0 and 100") - If PowerNetVoltage < ElectricConstants.PowenetVoltageMin Or PowerNetVoltage > ElectricConstants.PowenetVoltageMax _ - Then Throw New ArgumentException("PowerNetVoltage must have a value between 6 and 48") - If numberInVehicle < 0 Then Throw New ArgumentException("Cannot have less than 0 consumers in the vehicle") - - 'Good, now assign. - Me.BaseVehicle = BaseVehicle - Me.Category = Category - Me.ConsumerName = ConsumerName - Me.NominalConsumptionAmps = NominalConsumptionAmps - Me.PhaseIdle_TractionOn = PhaseIdle_TractionOn - Me.PowerNetVoltage = PowerNetVoltage - Me.NumberInActualVehicle = numberInVehicle - Me.Info = info - End Sub - - 'Comparison Overrides - Public Overrides Function Equals(obj As Object) As Boolean - - If obj Is Nothing OrElse Not Me.GetType() Is obj.GetType() Then - Return False - End If - - Dim other As IElectricalConsumer = CType(obj, IElectricalConsumer) - - - Return Me.ConsumerName = other.ConsumerName - End Function - - <System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage> - Public Overrides Function GetHashCode() As Integer - Return 0 - End Function - - - Public Event PropertyChanged As PropertyChangedEventHandler _ - Implements INotifyPropertyChanged.PropertyChanged - - Private Sub NotifyPropertyChanged(p As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(p)) - End Sub - End Class -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumerList.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumerList.vb deleted file mode 100644 index 132c93c0e920ab17deceace6d5abb584e14cbfec..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumerList.vb +++ /dev/null @@ -1,230 +0,0 @@ -' Copyright 2017 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 System.Collections.Generic -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class ElectricalConsumerList - Implements IElectricalConsumerList - - Private _items As New List(Of IElectricalConsumer) - Private _powernetVoltage As Double - Private _doorDutyCycleZeroToOne As Double - - - 'Constructor - Public Sub New(powernetVoltage As Double, doorDutyCycle_ZeroToOne As Double, - Optional createDefaultList As Boolean = False) - - _powernetVoltage = powernetVoltage - - If createDefaultList Then - - _items = GetDefaultConsumerList() - - End If - - - _doorDutyCycleZeroToOne = doorDutyCycle_ZeroToOne - End Sub - - 'Transfers the Info comments from a default set of consumables to a live set. - 'This way makes the comments not dependent on saved data. - Public Sub MergeInfoData() Implements IElectricalConsumerList.MergeInfoData - - If _items.Count <> GetDefaultConsumerList().Count Then Return - - Dim dflt As List(Of IElectricalConsumer) = GetDefaultConsumerList() - - For idx As Integer = 0 To _items.Count - 1 - - _items(idx).Info = dflt(idx).Info - - Next - End Sub - - 'Initialise default set of consumers - Public Function GetDefaultConsumerList() As List(Of IElectricalConsumer) - - 'This populates the default settings as per engineering spreadsheet. - 'Vehicle Basic Equipment' category can be added or remove by customers. - 'At some time in the future, this may be removed and replace with file based consumer lists. - - Dim items As New List(Of IElectricalConsumer) - - Dim c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20 As IElectricalConsumer - - c1 = CType(New ElectricalConsumer(False, "Doors", "Doors per Door", 3.0, 0.096339, - _powernetVoltage, 3, ""), - IElectricalConsumer) - c2 = CType(New ElectricalConsumer(True, "Veh Electronics &Engine", "Controllers,Valves etc", - 25.0, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c3 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio City", 2.0, 0.8, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c4 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio Intercity", 5.0, - 0.8, _powernetVoltage, - 0, ""), - IElectricalConsumer) - c5 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio/Audio Tourism", - 9.0, 0.8, - _powernetVoltage, 0, ""), - IElectricalConsumer) - c6 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Fridge", 4.0, 0.5, - _powernetVoltage, 0, ""), - IElectricalConsumer) - c7 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Kitchen Standard", - 67.0, 0.05, _powernetVoltage, - 0, ""), - IElectricalConsumer) - c8 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", - "Interior lights City/ Intercity + Doorlights [Should be 1/m]", 1.0, 0.7, - _powernetVoltage, 12, - "1 Per metre length of bus"), - IElectricalConsumer) - c9 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", - "LED Interior lights ceiling city/Intercity + door [Should be 1/m]", 0.6, 0.7, - _powernetVoltage, 0, - "1 Per metre length of bus"), - IElectricalConsumer) - c10 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Interior lights Tourism + reading [1/m]", - 1.1, - 0.7, _powernetVoltage, 0, "1 Per metre length of bus"), - IElectricalConsumer) - c11 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", - "LED Interior lights ceiling Tourism + LED reading [Should be 1/m]", 0.66, 0.7, - _powernetVoltage, 0, - "1 Per metre length of bus"), - IElectricalConsumer) - c12 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", "External Displays Font/Side/Rear", - 2.65017667844523, 1.0, _powernetVoltage, 4, ""), - IElectricalConsumer) - c13 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", - "Internal display per unit ( front side rear)", 1.06007067137809, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c14 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", - "CityBus Ref EBSF Table4 Devices ITS No Displays", 9.3, 1.0, _powernetVoltage, 1, - ""), - IElectricalConsumer) - c15 = CType(New ElectricalConsumer(False, "Lights", "Exterior Lights BULB", 7.4, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c16 = CType(New ElectricalConsumer(False, "Lights", "Day running lights LED bonus", - -0.723, 1.0, _powernetVoltage, - 1, ""), - IElectricalConsumer) - c17 = CType(New ElectricalConsumer(False, "Lights", "Antifog rear lights LED bonus", - -0.17, 1.0, _powernetVoltage, - 1, ""), - IElectricalConsumer) - c18 = CType(New ElectricalConsumer(False, "Lights", "Position lights LED bonus", -1.2, - 1.0, _powernetVoltage, 1, - ""), - IElectricalConsumer) - c19 = CType(New ElectricalConsumer(False, "Lights", "Direction lights LED bonus", -0.3, - 1.0, _powernetVoltage, 1, - ""), - IElectricalConsumer) - c20 = CType(New ElectricalConsumer(False, "Lights", "Brake Lights LED bonus", -1.2, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - - items.Add(c1) - items.Add(c2) - items.Add(c3) - items.Add(c4) - items.Add(c5) - items.Add(c6) - items.Add(c7) - items.Add(c8) - items.Add(c9) - items.Add(c10) - items.Add(c11) - items.Add(c12) - items.Add(c13) - items.Add(c14) - items.Add(c15) - items.Add(c16) - items.Add(c17) - items.Add(c18) - items.Add(c19) - items.Add(c20) - - Return items - End Function - - - 'Interface implementation - Public Property DoorDutyCycleFraction As Double Implements IElectricalConsumerList.DoorDutyCycleFraction - - Get - Return _doorDutyCycleZeroToOne - End Get - Set(value As Double) - _doorDutyCycleZeroToOne = value - End Set - End Property - - Public ReadOnly Property Items As List(Of IElectricalConsumer) Implements IElectricalConsumerList.Items - Get - Return _items - End Get - End Property - - Public Sub AddConsumer(consumer As IElectricalConsumer) Implements Electrics.IElectricalConsumerList.AddConsumer - - If Not _items.Contains(consumer) Then - _items.Add(consumer) - Else - - Throw New ArgumentException("Consumer Already Present in the list") - - End If - End Sub - - Public Sub RemoveConsumer(consumer As IElectricalConsumer) Implements Electrics.IElectricalConsumerList.RemoveConsumer - - If _items.Contains(consumer) Then - - _items.Remove(consumer) - - Else - - Throw New ArgumentException("Consumer Not In List") - - End If - End Sub - - - Public Function GetTotalAverageDemandAmps(excludeOnBase As Boolean) As Ampere _ - Implements Electrics.IElectricalConsumerList.GetTotalAverageDemandAmps - - Dim Amps As Ampere - - If excludeOnBase Then - Amps = - Aggregate item In Items Where item.BaseVehicle = False Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) - Else - Amps = Aggregate item In Items Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) - End If - - - Return Amps - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricsUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricsUserInputsConfig.vb deleted file mode 100644 index db1bc9a072a64671f1323e65e5478c7c67826367..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricsUserInputsConfig.vb +++ /dev/null @@ -1,55 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics - -Namespace Electrics - Public Class ElectricsUserInputsConfig - Implements IElectricsUserInputsConfig - - Public Property PowerNetVoltage As Double Implements IElectricsUserInputsConfig.PowerNetVoltage - Public Property AlternatorMap As String Implements IElectricsUserInputsConfig.AlternatorMap - Public Property AlternatorGearEfficiency As Double Implements IElectricsUserInputsConfig.AlternatorGearEfficiency - - Public Property ElectricalConsumers As IElectricalConsumerList _ - Implements IElectricsUserInputsConfig.ElectricalConsumers - - Public Property DoorActuationTimeSecond As Integer Implements IElectricsUserInputsConfig.DoorActuationTimeSecond - Public Property StoredEnergyEfficiency As Single Implements IElectricsUserInputsConfig.StoredEnergyEfficiency - - Public Property ResultCardIdle As IResultCard Implements IElectricsUserInputsConfig.ResultCardIdle - Public Property ResultCardTraction As IResultCard Implements IElectricsUserInputsConfig.ResultCardTraction - Public Property ResultCardOverrun As IResultCard Implements IElectricsUserInputsConfig.ResultCardOverrun - - Public Property SmartElectrical As Boolean Implements IElectricsUserInputsConfig.SmartElectrical - - Public Sub New(Optional setToDefaults As Boolean = False, Optional vectoInputs As VectoInputs = Nothing) - - If setToDefaults Then SetPropertiesToDefaults(vectoInputs) - End Sub - - Public Sub SetPropertiesToDefaults(vectoInputs As VectoInputs) - - DoorActuationTimeSecond = 4 - StoredEnergyEfficiency = 0.935 - AlternatorGearEfficiency = 0.92 - PowerNetVoltage = vectoInputs.PowerNetVoltage.Value() - ResultCardIdle = New ResultCard(New List(Of SmartResult)) - ResultCardOverrun = New ResultCard(New List(Of SmartResult)) - ResultCardTraction = New ResultCard(New List(Of SmartResult)) - SmartElectrical = False - AlternatorMap = String.Empty - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IAlternator.vb b/VECTOAux/VectoAuxiliaries/Electrics/IAlternator.vb deleted file mode 100644 index de5aea114a40a38171925376be6a97065c85b10e..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IAlternator.vb +++ /dev/null @@ -1,35 +0,0 @@ - -Namespace Electrics - 'Used By Combined Alternator. - 'Model based on CombinedALTS_V02_Editable.xlsx - Public Interface IAlternator - 'D6 - Property AlternatorName As String - - 'G6 - Property PulleyRatio As Single - - 'S9 - ReadOnly Property SpindleSpeed As Double - - 'S10 - ReadOnly Property Efficiency As Double - - 'C10-D15 - Property InputTable2000 As List(Of AltUserInput) - - 'F10-G15 - Property InputTable4000 As List(Of AltUserInput) - - 'I10-J15 - Property InputTable6000 As List(Of AltUserInput) - - 'M10-N15 - Property RangeTable As List(Of Table4Row) - - 'Test Equality - Function IsEqualTo(other As IAlternator) As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb b/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb deleted file mode 100644 index d5622c8f7e34cb60a6d7a9924d14e22284ec9c38..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb +++ /dev/null @@ -1,32 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IAlternatorMap - Inherits IAuxiliaryEvent - - ''' <summary> - ''' Initialise the map from supplied csv data - ''' </summary> - ''' <returns>Boolean - true if map is created successfully</returns> - ''' <remarks></remarks> - Function Initialise() As Boolean - - ''' <summary> - ''' Returns the alternator efficiency at given rpm - ''' </summary> - ''' <param name="rpm">alternator rotation speed</param> - ''' <returns>Single</returns> - ''' <remarks></remarks> - Function GetEfficiency(ByVal rpm As Double, ByVal amps As Ampere) As AlternatorMapValues - End Interface -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternator.vb b/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternator.vb deleted file mode 100644 index bfba89d9c8f68c8dd795a2596e95f909e506d4bf..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternator.vb +++ /dev/null @@ -1,12 +0,0 @@ - -Namespace Electrics - Public Interface ICombinedAlternator - 'Alternators List - Property Alternators As List(Of IAlternator) - - 'Test Equality - Function IsEqualTo(other As ICombinedAlternator) As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternatorMapRow.vb b/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternatorMapRow.vb deleted file mode 100644 index ec881fdcce7517b94d3ce98123242cb4bf2983bc..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternatorMapRow.vb +++ /dev/null @@ -1,12 +0,0 @@ - -Namespace Electrics -'Reflects stored data in pesisted CombinedAlternator Map .AALT - Public Interface ICombinedAlternatorMapRow - Property AlternatorName As String - Property RPM As Single - Property Amps As Single - Property Efficiency As Single - Property PulleyRatio As Single - End Interface -End Namespace - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternatorSignals.vb b/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternatorSignals.vb deleted file mode 100644 index b13f49e89c71fe4d9df6619d4ca1b34992f61c0a..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ICombinedAlternatorSignals.vb +++ /dev/null @@ -1,13 +0,0 @@ - -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - 'Used by CombinedAlternator - Public Interface ICombinedAlternatorSignals - Property NumberOfAlternators As Integer - Property CrankRPM As Double - Property CurrentDemandAmps As Ampere - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumer.vb b/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumer.vb deleted file mode 100644 index 7158bc909ca62d9015e9c6aef8e0601b38247fb0..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumer.vb +++ /dev/null @@ -1,31 +0,0 @@ -' Copyright 2017 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 System.ComponentModel -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IElectricalConsumer - Inherits INotifyPropertyChanged - - Property Category As String - Property ConsumerName As String - Property BaseVehicle As Boolean - Property NominalConsumptionAmps As Double - Property PhaseIdle_TractionOn As Double - Property NumberInActualVehicle As Integer - Property PowerNetVoltage As Double - Property AvgConsumptionAmps As Double - Property Info As String - Function TotalAvgConumptionAmps(Optional PhaseIdle_TractionOnBasedOnCycle As Double = Nothing) As Ampere - Function TotalAvgConsumptionInWatts(Optional PhaseIdle_TractionOnBasedOnCycle As Double = 0.0) As Watt - End Interface -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumerList.vb b/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumerList.vb deleted file mode 100644 index f29100d7c7fae3ac5923f40a9cf029a338806443..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumerList.vb +++ /dev/null @@ -1,59 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IElectricalConsumerList - ''' <summary> - ''' List of Electrical Consumers - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property Items As List(Of IElectricalConsumer) - - ''' <summary> - ''' Add New Electrical Consumer - ''' </summary> - ''' <param name="consumer"></param> - ''' <remarks></remarks> - Sub AddConsumer(consumer As IElectricalConsumer) - - ''' <summary> - ''' Remove Electrical Consumer - ''' </summary> - ''' <param name="consumer"></param> - ''' <remarks></remarks> - Sub RemoveConsumer(consumer As IElectricalConsumer) - - ''' <summary> - ''' Get Total Average Demand In Amps - ''' </summary> - ''' <param name="excludeOnBase">Exclude those on base vehicle</param> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetTotalAverageDemandAmps(excludeOnBase As Boolean) As Ampere - - ''' <summary> - ''' Door Actuation Time Fraction ( Total Time Spent Operational during cycle ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property DoorDutyCycleFraction As Double - - 'Merge Info data from ElectricalConsumer in a Default set into live set - 'This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. - Sub MergeInfoData() - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IElectricsUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Electrics/IElectricsUserInputsConfig.vb deleted file mode 100644 index 86e44534b4c975d82bc06ceebcccb88fedd2e6de..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IElectricsUserInputsConfig.vb +++ /dev/null @@ -1,98 +0,0 @@ -' Copyright 2017 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 - -Namespace Electrics - Public Interface IElectricsUserInputsConfig - ''' <summary> - ''' Power Net Voltage - The supply voltage used on the vehilce. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PowerNetVoltage As Double - - ''' <summary> - ''' The Path for the Alternator map - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property AlternatorMap As String - - ''' <summary> - ''' Alternator Gear Efficiency - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property AlternatorGearEfficiency As Double - - ''' <summary> - ''' List of Electrical Consumers - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ElectricalConsumers As IElectricalConsumerList - - ''' <summary> - ''' Door Actuation Time In Seconds ( Time Taken to Open/Close the door ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property DoorActuationTimeSecond As Integer - - ''' <summary> - ''' Result Card Taken During Idle. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ResultCardIdle As IResultCard - - ''' <summary> - ''' Result Card Taken During Traction - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ResultCardTraction As IResultCard - - ''' <summary> - ''' Result Card Taken During Overrun - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ResultCardOverrun As IResultCard - - ''' <summary> - ''' Smart Electrical System - ''' </summary> - ''' <value></value> - ''' <returns>True For Smart Electrical Systems/ False For non Smart.</returns> - ''' <remarks></remarks> - Property SmartElectrical As Boolean - - ''' <summary> - ''' Stored Energy Efficiency - ''' </summary> - ''' <value></value> - ''' <returns>Stored Energy Efficiency</returns> - ''' <remarks></remarks> - Property StoredEnergyEfficiency As Single - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM0_5_SmartAlternatorSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM0_5_SmartAlternatorSetEfficiency.vb deleted file mode 100644 index e7caf4eb4a54c485adeb977adb8f2612a6927feb..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM0_5_SmartAlternatorSetEfficiency.vb +++ /dev/null @@ -1,65 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM0_5_SmartAlternatorSetEfficiency - ''' <summary> - ''' Smart Idle Current (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartIdleCurrent() As Ampere - - ''' <summary> - ''' Alternators Efficiency In Idle ( Fraction ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiencyIdleResultCard() As Double - - ''' <summary> - ''' Smart Traction Current (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartTractionCurrent As Ampere - - ''' <summary> - ''' Alternators Efficiency In Traction ( Fraction ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiencyTractionOnResultCard() As Double - - ''' <summary> - ''' Smart Overrrun Current (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartOverrunCurrent As Ampere - - ''' <summary> - ''' Alternators Efficiency In Overrun ( Fraction ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiencyOverrunResultCard() As Double - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM0_NonSmart_AlternatorsSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM0_NonSmart_AlternatorsSetEfficiency.vb deleted file mode 100644 index 49c492ca1751714fe137b5c5096a4115ae407f88..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM0_NonSmart_AlternatorsSetEfficiency.vb +++ /dev/null @@ -1,33 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM0_NonSmart_AlternatorsSetEfficiency - ''' <summary> - ''' Gets HVAC Electrical Power Demand (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property GetHVACElectricalPowerDemandAmps() As Ampere - - ''' <summary> - ''' Gets Alternator Efficiency (0-1) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiency() As Double - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM2_AverageElectricalLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM2_AverageElectricalLoadDemand.vb deleted file mode 100644 index 5412a35c5954ebf5e3a81e49fc52213a7da09a5b..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM2_AverageElectricalLoadDemand.vb +++ /dev/null @@ -1,20 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM2_AverageElectricalLoadDemand - Function GetAveragePowerDemandAtAlternator() As Watt - Function GetAveragePowerAtCrankFromElectrics() As Watt - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM5_SmartAlternatorSetGeneration.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM5_SmartAlternatorSetGeneration.vb deleted file mode 100644 index 42ee115e433764678f4b0fe0d425ac104de51936..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM5_SmartAlternatorSetGeneration.vb +++ /dev/null @@ -1,38 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM5_SmartAlternatorSetGeneration - ''' <summary> - ''' Alternators Generation Power At Crank Idle (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AlternatorsGenerationPowerAtCrankIdleWatts() As Watt - - ''' <summary> - ''' Alternators Generation Power At Crank Traction On (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AlternatorsGenerationPowerAtCrankTractionOnWatts() As Watt - - ''' <summary> - ''' Alternators Generation Power At Crank Overrun (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AlternatorsGenerationPowerAtCrankOverrunWatts() As Watt - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IResultCard.vb b/VECTOAux/VectoAuxiliaries/Electrics/IResultCard.vb deleted file mode 100644 index 0b6481b72bacdfb3cdca31418ffcfc0c847ea39a..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IResultCard.vb +++ /dev/null @@ -1,33 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IResultCard - ''' <summary> - ''' Returns a List of (SmartResult ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property Results As List(Of SmartResult) - - ''' <summary> - ''' Returns the Smart Current (A) - ''' </summary> - ''' <param name="Amps"></param> - ''' <returns></returns> - ''' <remarks>Defaults to 10 Amps if no readings present</remarks> - Function GetSmartCurrentResult(ByVal Amps As Ampere) As Ampere - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ImageCell.vb b/VECTOAux/VectoAuxiliaries/Electrics/ImageCell.vb deleted file mode 100644 index 44504999059b85863ae075bb142c8649d818335d..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ImageCell.vb +++ /dev/null @@ -1,33 +0,0 @@ -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 - - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ImageColumn.vb b/VECTOAux/VectoAuxiliaries/Electrics/ImageColumn.vb deleted file mode 100644 index ca70465d70d31bbbcb1f24990a1d120ef59e7d98..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ImageColumn.vb +++ /dev/null @@ -1,28 +0,0 @@ -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 - - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IncDecValuePair.vb b/VECTOAux/VectoAuxiliaries/Electrics/IncDecValuePair.vb deleted file mode 100644 index 3e1fc01aa3b1b0f907730ef6cd318c1f0b0d5b3f..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/IncDecValuePair.vb +++ /dev/null @@ -1,15 +0,0 @@ - -Namespace Electrics - - -Public class IncDecValuePair - - Public Amps As Single - Public Efficiency As single - -End class - - -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/InterpAltUserInputs.vb b/VECTOAux/VectoAuxiliaries/Electrics/InterpAltUserInputs.vb deleted file mode 100644 index 2d830531ce812a564f98eb0c5f94b739cca71f52..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/InterpAltUserInputs.vb +++ /dev/null @@ -1,50 +0,0 @@ - - -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 - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M0_5_SmartAlternatorSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/M0_5_SmartAlternatorSetEfficiency.vb deleted file mode 100644 index c964dbc28dc5f23e07cc1768ad68a2b58764ab85..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/M0_5_SmartAlternatorSetEfficiency.vb +++ /dev/null @@ -1,121 +0,0 @@ -' Copyright 2017 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 System.Diagnostics.CodeAnalysis -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class M0_5_SmartAlternatorSetEfficiency - Implements IM0_5_SmartAlternatorSetEfficiency - - 'Fields - Private _m0 As IM0_NonSmart_AlternatorsSetEfficiency - Private _electricalConsumables As IElectricalConsumerList - Private _alternatorMap As IAlternatorMap - Private _resultCardIdle As IResultCard - Private _resultCardTraction As IResultCard - Private _resultCardOverrun As IResultCard - Private _signals As ISignals - - 'Constructor - Public Sub New(m0 As IM0_NonSmart_AlternatorsSetEfficiency, - electricalConsumables As IElectricalConsumerList, - alternatorMap As IAlternatorMap, - resultCardIdle As IResultCard, - resultCardTraction As IResultCard, - resultCardOverrun As IResultCard, - signals As ISignals) - - 'Sanity Check on supplied arguments, throw an argument exception - If m0 Is Nothing Then Throw New ArgumentException("Module 0 must be supplied") - If electricalConsumables Is Nothing Then _ - Throw New ArgumentException("ElectricalConsumablesList must be supplied even if empty") - If alternatorMap Is Nothing Then Throw New ArgumentException("Must supply a valid alternator map") - If resultCardIdle Is Nothing Then _ - Throw New ArgumentException("Result Card 'IDLE' must be supplied even if it has no contents") - If resultCardTraction Is Nothing Then _ - Throw New ArgumentException("Result Card 'TRACTION' must be supplied even if it has no contents") - If resultCardOverrun Is Nothing Then _ - Throw New ArgumentException("Result Card 'OVERRUN' must be supplied even if it has no contents") - If signals Is Nothing Then Throw New ArgumentException("No Signals Reference object was provided ") - - 'Assignments to private variables. - _m0 = m0 - _electricalConsumables = electricalConsumables - _alternatorMap = alternatorMap - _resultCardIdle = resultCardIdle - _resultCardTraction = resultCardTraction - _resultCardOverrun = resultCardOverrun - _signals = signals - End Sub - - - 'Public Class Outputs (Properties) - Public ReadOnly Property SmartIdleCurrent() As Ampere Implements IM0_5_SmartAlternatorSetEfficiency.SmartIdleCurrent - Get - Dim hvac_Plus_None_Base As Ampere = HvacPlusNonBaseCurrents() - Dim smart_idle_current As Ampere = _resultCardIdle.GetSmartCurrentResult(hvac_Plus_None_Base) - - Return smart_idle_current - End Get - End Property - - Public ReadOnly Property AlternatorsEfficiencyIdleResultCard() As Double _ - Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyIdleResultCard - Get - Return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartIdleCurrent()).Efficiency - End Get - End Property - - Public ReadOnly Property SmartTractionCurrent As Ampere _ - Implements IM0_5_SmartAlternatorSetEfficiency.SmartTractionCurrent - Get - Return _resultCardTraction.GetSmartCurrentResult(HvacPlusNonBaseCurrents()) - End Get - End Property - - Public ReadOnly Property AlternatorsEfficiencyTractionOnResultCard() As Double _ - Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyTractionOnResultCard - Get - Return _alternatorMap.GetEfficiency(CType(_signals.EngineSpeed.AsRPM, Single), SmartTractionCurrent()).Efficiency - End Get - End Property - - Public ReadOnly Property SmartOverrunCurrent As Ampere _ - Implements IM0_5_SmartAlternatorSetEfficiency.SmartOverrunCurrent - Get - Return _resultCardOverrun.GetSmartCurrentResult(HvacPlusNonBaseCurrents()) - End Get - End Property - - Public ReadOnly Property AlternatorsEfficiencyOverrunResultCard() As Double _ - Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyOverrunResultCard - Get - Return _alternatorMap.GetEfficiency(CType(_signals.EngineSpeed.AsRPM, Single), SmartOverrunCurrent()).Efficiency - End Get - End Property - - 'Helpers - ''' <summary> - ''' Returns Non Base Currents (A) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - <ExcludeFromCodeCoverage> - Private Function HvacPlusNonBaseCurrents() As Ampere - 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb - Return _m0.GetHVACElectricalPowerDemandAmps() + _electricalConsumables.GetTotalAverageDemandAmps(True) _ - '/ElectricConstants.StoredEnergyEfficiency) - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb deleted file mode 100644 index a57e0abf23f7dab739e9d4cc96f587b15b47ecbf..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb +++ /dev/null @@ -1,73 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Hvac - -Namespace Electrics - Public Class M0_NonSmart_AlternatorsSetEfficiency - Implements IM0_NonSmart_AlternatorsSetEfficiency - - Private _electricalConsumersList As IElectricalConsumerList - Private _alternatorEfficiencyMap As IAlternatorMap - Private _powernetVoltage As Volt - Private _signals As ISignals - Private _steadyStateModelHVAC As ISSMTOOL - - - Private _ElectricalPowerW As Watt - Private _MechanicalPowerW As Watt - Private _FuelingLPerH As LiterPerSecond - - 'Constructor - Public Sub New(electricalConsumers As IElectricalConsumerList, alternatorEfficiencyMap As IAlternatorMap, - powernetVoltage As Volt, signals As ISignals, ssmHvac As ISSMTOOL) - - If electricalConsumers Is Nothing Then Throw New ArgumentException("No ElectricalConsumersList Supplied") - If alternatorEfficiencyMap Is Nothing Then Throw New ArgumentException("No Alternator Efficiency Map Supplied") - If (powernetVoltage < ElectricConstants.PowenetVoltageMin Or powernetVoltage > ElectricConstants.PowenetVoltageMax) _ - Then Throw New ArgumentException("Powernet Voltage out of range") - If signals Is Nothing Then Throw New ArgumentException("No Signals reference was supplied.") - - Me._electricalConsumersList = electricalConsumers - Me._alternatorEfficiencyMap = alternatorEfficiencyMap - Me._powernetVoltage = powernetVoltage - Me._signals = signals - Me._steadyStateModelHVAC = ssmHvac - - _ElectricalPowerW = ssmHvac.ElectricalWAdjusted.SI(Of Watt)() - _MechanicalPowerW = ssmHvac.MechanicalWBaseAdjusted.SI(Of Watt)() - _FuelingLPerH = ssmHvac.FuelPerHBaseAdjusted.SI(Of LiterPerSecond)() - End Sub - - 'Public class outputs (Properties) - Public ReadOnly Property AlternatorsEfficiency As Double _ - Implements IM0_NonSmart_AlternatorsSetEfficiency.AlternatorsEfficiency - - Get - 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb - Dim baseCurrentDemandAmps As Ampere = _electricalConsumersList.GetTotalAverageDemandAmps(False) _ - ' ElectricConstants.StoredEnergyEfficiency - Dim totalDemandAmps As Ampere = baseCurrentDemandAmps + GetHVACElectricalPowerDemandAmps - Return _alternatorEfficiencyMap.GetEfficiency(_signals.EngineSpeed.AsRPM, totalDemandAmps).Efficiency - End Get - End Property - - Public ReadOnly Property GetHVACElectricalPowerDemandAmps As Ampere _ - Implements IM0_NonSmart_AlternatorsSetEfficiency.GetHVACElectricalPowerDemandAmps - Get - Return _ElectricalPowerW / _powernetVoltage - End Get - End Property - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M2_AverageElectricalLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Electrics/M2_AverageElectricalLoadDemand.vb deleted file mode 100644 index 956eda52d38efe9180f3ff3053e18f88d7ee4f43..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/M2_AverageElectricalLoadDemand.vb +++ /dev/null @@ -1,69 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class M2_AverageElectricalLoadDemand - Implements IM2_AverageElectricalLoadDemand - - Public _powerNetVoltage As Volt = 26.3.SI(Of Volt)() - Private _electricalConsumers As IElectricalConsumerList - Private _module0 As IM0_NonSmart_AlternatorsSetEfficiency - Private _alternatorPulleyEffiency As Double - Private _signals As Signals - - - 'Constructor - Public Sub New(ByVal electricalConsumers As IElectricalConsumerList, m0 As IM0_NonSmart_AlternatorsSetEfficiency, - altPulleyEfficiency As Double, powerNetVoltage As Volt, signals As ISignals) - - If electricalConsumers Is Nothing Then Throw New ArgumentException("Electrical Consumer List must be supplied") - If m0 Is Nothing Then Throw New ArgumentException("Must supply module 0") - If altPulleyEfficiency = 0 OrElse altPulleyEfficiency > 1 Then _ - Throw New ArgumentException("Alternator Gear efficiency out of range.") - If powerNetVoltage < ElectricConstants.PowenetVoltageMin OrElse powerNetVoltage > ElectricConstants.PowenetVoltageMax _ - Then - Throw New ArgumentException("Powernet Voltage out of known range.") - End If - - - _powerNetVoltage = powerNetVoltage - _electricalConsumers = electricalConsumers - _module0 = m0 - _alternatorPulleyEffiency = altPulleyEfficiency - End Sub - - 'Public class outputs (Properties) - Public Function GetAveragePowerDemandAtAlternator() As Watt _ - Implements IM2_AverageElectricalLoadDemand.GetAveragePowerDemandAtAlternator - - 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb - 'Return ( _electricalConsumers.GetTotalAverageDemandAmps(False)/ElectricConstants.StoredEnergyEfficiency) * _powerNetVoltage - Return _powerNetVoltage * _electricalConsumers.GetTotalAverageDemandAmps(False) - End Function - - Public Function GetAveragePowerAtCrankFromElectrics() As Watt _ - Implements IM2_AverageElectricalLoadDemand.GetAveragePowerAtCrankFromElectrics - - Dim ElectricalPowerDemandsWatts As Watt = GetAveragePowerDemandAtAlternator() - Dim alternatorsEfficiency As Double = _module0.AlternatorsEfficiency - Dim ElectricalPowerDemandsWattsDividedByAlternatorEfficiency As Watt = ElectricalPowerDemandsWatts * (1 / - alternatorsEfficiency) - - Dim averagePowerDemandAtCrankFromElectricsWatts As Watt - - averagePowerDemandAtCrankFromElectricsWatts = ElectricalPowerDemandsWattsDividedByAlternatorEfficiency * (1 / - _alternatorPulleyEffiency) - - Return averagePowerDemandAtCrankFromElectricsWatts - End Function - End Class -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M5__SmartAlternatorSetGeneration.vb b/VECTOAux/VectoAuxiliaries/Electrics/M5__SmartAlternatorSetGeneration.vb deleted file mode 100644 index c2535205c05c7e7859be31113d3ae6d20fee150c..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/M5__SmartAlternatorSetGeneration.vb +++ /dev/null @@ -1,65 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class M5__SmartAlternatorSetGeneration - Implements IM5_SmartAlternatorSetGeneration - - Private _powerNetVoltage As Volt - Private _m05 As M0_5_SmartAlternatorSetEfficiency - Private _alternatorGearEfficiency As Double - - 'Constructor - Public Sub New(m05 As M0_5_SmartAlternatorSetEfficiency, ByVal powernetVoltage As Volt, - alternatorGearEfficiency As Double) - - 'sanity check - If m05 Is Nothing Then Throw New ArgumentException("Please supply a valid module M05") - If powernetVoltage < ElectricConstants.PowenetVoltageMin OrElse powernetVoltage > ElectricConstants.PowenetVoltageMax _ - Then Throw New ArgumentException("Powernet Voltage out of range") - If alternatorGearEfficiency < 0 Or alternatorGearEfficiency > 1 Then _ - Throw New ArgumentException("AlternatorGearEfficiency Out of bounds, should be 0 to 1") - - 'assign private variables. - _m05 = m05 - _powerNetVoltage = powernetVoltage - _alternatorGearEfficiency = alternatorGearEfficiency - End Sub - - 'Public class outputs (Functions) - Public Function AlternatorsGenerationPowerAtCrankIdleWatts() As Watt _ - Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankIdleWatts - - Return _ - (_m05.SmartIdleCurrent() * _powerNetVoltage) * - (1 / (_m05.AlternatorsEfficiencyIdleResultCard() * _alternatorGearEfficiency)) - End Function - - Public Function AlternatorsGenerationPowerAtCrankOverrunWatts() As Watt _ - Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankOverrunWatts - - Return _ - (_m05.SmartOverrunCurrent() * _powerNetVoltage) * (1 / - (_m05.AlternatorsEfficiencyOverrunResultCard() * _alternatorGearEfficiency)) - End Function - - Public Function AlternatorsGenerationPowerAtCrankTractionOnWatts() As Watt _ - Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankTractionOnWatts - - Return _ - (_m05.SmartTractionCurrent() * _powerNetVoltage) * (1 / - (_m05.AlternatorsEfficiencyTractionOnResultCard() * _alternatorGearEfficiency)) - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ResultCard.vb b/VECTOAux/VectoAuxiliaries/Electrics/ResultCard.vb deleted file mode 100644 index c6a0d60ed92d2cc9abf7ad7111360c38b5533b82..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/ResultCard.vb +++ /dev/null @@ -1,143 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics - -Namespace Electrics - Public Class ResultCard - Implements IResultCard - - Private _results As List(Of SmartResult) - - 'Constructor - Public Sub New(results As List(Of SmartResult)) - - If results Is Nothing Then Throw New ArgumentException("A list of smart results must be supplied.") - - _results = results - End Sub - - - 'Public class outputs - Public ReadOnly Property Results As List(Of SmartResult) Implements IResultCard.Results - Get - Return _results - End Get - End Property - - Public Function GetSmartCurrentResult(ByVal Amps As Ampere) As Ampere Implements IResultCard.GetSmartCurrentResult - - - If _results.Count < 2 Then Return 10.SI(Of Ampere)() - - Return GetOrInterpolate(Amps.Value()).SI(Of Ampere)() - End Function - - - 'Helpers - ''' <summary> - ''' Gets or interpolates value (A) - ''' </summary> - ''' <param name="amps"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Private Function GetOrInterpolate(amps As Double) As Double - - Dim pre As Double - Dim post As Double - Dim dAmps As Double - Dim dSmartAmps As Double - Dim smartAmpsSlope As Double - Dim smartAmps As Double - Dim maxKey As Double - Dim minKey As Double - - maxKey = _results.Max.Amps - minKey = _results.Min.Amps - - Dim compareKey As SmartResult = New SmartResult(amps, 0) - - 'Is on boundary check - If _results.Contains(compareKey) Then _ - Return _results.OrderBy(Function(x) x.Amps).First(Function(x) x.Amps = compareKey.Amps).SmartAmps - - 'Is over map - Extrapolate - If amps > maxKey Then - - 'get the entries before and after the supplied key - pre = (From a In _results Order By a.Amps Where a.Amps < maxKey Select a).Last().Amps - post = maxKey - - 'get the delta values - dAmps = post - pre - dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps - - 'calculate the slopes - smartAmpsSlope = dSmartAmps / dAmps - - 'calculate the new values - smartAmps = ((amps - post) * smartAmpsSlope) + - (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - Return smartAmps - - End If - - 'Is under map - Extrapolate - If amps < minKey Then - - 'get the entries before and after the supplied key - 'Post is the first entry and pre is the penultimate to first entry - post = minKey - pre = (From k In _results Order By k.Amps Where k.Amps > minKey Select k).First().Amps - - 'get the delta values - dAmps = post - pre - dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps - - 'calculate the slopes - smartAmpsSlope = dSmartAmps / dAmps - - 'calculate the new values - smartAmps = ((amps - post) * smartAmpsSlope) + - (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - Return smartAmps - End If - - 'Is Inside map - Interpolate - - 'get the entries before and after the supplied rpm - pre = (From m In _results Order By m.Amps Where m.Amps < amps Select m).Last().Amps - post = (From m In _results Where m.Amps > amps Select m).First().Amps - - 'get the delta values for rpm and the map values - dAmps = post - pre - dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps - - 'calculate the slopes - smartAmpsSlope = dSmartAmps / dAmps - - 'calculate the new values - smartAmps = ((amps - post) * smartAmpsSlope) + - (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - - Return smartAmps - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Electrics/SmartResult.vb b/VECTOAux/VectoAuxiliaries/Electrics/SmartResult.vb deleted file mode 100644 index ff17f3651cccb6a03a254f1f8a115c59b568cdd7..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Electrics/SmartResult.vb +++ /dev/null @@ -1,53 +0,0 @@ -' Copyright 2017 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. - -Namespace Electrics - Public Class SmartResult - Implements IComparable(Of SmartResult) - - Public Property Amps As Double - Public Property SmartAmps As Double - - 'Constructors - Public Sub new() - 'An empty constructor is requried. Do not remove. - End Sub - - Public Sub New(amps As Double, smartAmps As Double) - - Me.Amps = amps - Me.SmartAmps = smartAmps - End Sub - - 'Comparison - Public Function CompareTo(other As SmartResult) As Integer Implements IComparable(Of SmartResult).CompareTo - - If other.Amps > Me.Amps then return - 1 - If other.Amps = Me.Amps then Return 0 - - Return 1 - End Function - - 'Comparison Overrides - Public Overrides Function Equals(obj As Object) As Boolean - - Dim other as SmartResult = Ctype(Obj, SmartResult) - - Return Me.Amps = other.Amps - End Function - - Public Overrides Function GetHashCode() As Integer - Return 0 - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/Bus.vb b/VECTOAux/VectoAuxiliaries/Hvac/Bus.vb deleted file mode 100644 index 53fd82da052c5fbe4bba9d69ddfdbbc2d4d33419..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/Bus.vb +++ /dev/null @@ -1,188 +0,0 @@ -Namespace Hvac - Public Class Bus - Implements IBus - - 'Private Property Backing - Private _id As Integer - Private _model As String - Private _floorType As String - Private _engineType As String - Private _lengthInMetres As Double - Private _widthInMetres As Double - Private _heightInMetres As Double - Private _registeredPassengers As Integer - Private _isDoubleDecker As Boolean - - Public ReadOnly Property Id As Integer Implements IBus.Id - Get - Return _id - End Get - End Property - - Public Property Model As String Implements IBus.Model - Get - Return _model - End Get - Set(value As String) - If Not ModelOK(value) Then Throw New ArgumentException("Model argument is invalid") - _model = value - End Set - End Property - - Public Property FloorType As String Implements IBus.FloorType - Get - Return _floorType - End Get - Set(value As String) - If Not FloorTypeOK(value) Then Throw New ArgumentException("Model argument is invalid") - _floorType = value - End Set - End Property - - Public Property EngineType As String Implements IBus.EngineType - Get - Return _engineType - End Get - Set(value As String) - If Not EngineOK(value) Then Throw New ArgumentException("EngineType argument is invalid") - _engineType = value - End Set - End Property - - Public Property LengthInMetres As Double Implements IBus.LengthInMetres - Get - Return _lengthInMetres - End Get - Set(value As Double) - If Not DimensionOK(value) Then Throw New ArgumentException("Invalid Length") - _lengthInMetres = value - End Set - End Property - - Public Property WidthInMetres As Double Implements IBus.WidthInMetres - Get - Return _widthInMetres - End Get - Set(value As Double) - If Not DimensionOK(value) Then Throw New ArgumentException("Invalid Width") - _widthInMetres = value - End Set - End Property - - Public Property HeightInMetres As Double Implements IBus.HeightInMetres - Get - Return _heightInMetres - End Get - Set(value As Double) - If Not DimensionOK(value) Then Throw New ArgumentException("Invalid Height") - _heightInMetres = value - End Set - End Property - - Public Property RegisteredPassengers As Integer Implements IBus.RegisteredPassengers - Get - Return _registeredPassengers - End Get - Set(value As Integer) - If Not PassengersOK(value) Then Throw New ArgumentException("Invalid Number Of Passengers") - _registeredPassengers = value - End Set - End Property - - Public Property IsDoubleDecker As Boolean Implements IBus.IsDoubleDecker - Get - Return _isDoubleDecker - End Get - Set(ByVal value As Boolean) - _isDoubleDecker = value - End Set - End Property - - 'Constructors - Public Sub New(_id As Integer, - _model As String, - _floorType As String, - _engineType As String, - _lengthInMetres As Double, - _widthInMetres As Double, - _heightInMetres As Double, - _registeredPassengers As Integer, - _doubleDecker As Boolean) - - - 'Validity checks. - If Not ModelOK(_model) Then Throw New ArgumentException("Model argument is invalid") - If Not FloorTypeOK(_floorType) Then Throw New ArgumentException("Model argument is invalid") - If Not EngineOK(_engineType) Then Throw New ArgumentException("EngineType argument is invalid") - If Not DimensionOK(_lengthInMetres) Then Throw New ArgumentException("Invalid Length") - If Not DimensionOK(_widthInMetres) Then Throw New ArgumentException("Invalid Width") - If Not DimensionOK(_heightInMetres) Then Throw New ArgumentException("Invalid Height") - If Not PassengersOK(_registeredPassengers) Then Throw New ArgumentException("Invalid Number Of Passengers") - - - 'Set Private Members - Me._id = _id - Me._model = _model - Me._floorType = _floorType - Me._engineType = _engineType - Me._lengthInMetres = _lengthInMetres - Me._widthInMetres = _widthInMetres - Me._heightInMetres = _heightInMetres - Me._registeredPassengers = _registeredPassengers - Me._isDoubleDecker = _doubleDecker - End Sub - - 'Construction Validators Helpers - Private Function ModelOK(ByVal model As String) As Boolean - - model = model.ToLower - - If model Is Nothing OrElse model.Trim.Length = 0 Then Return False - - Return True - End Function - - Private Function FloorTypeOK(ByVal floorType As String) As Boolean - - floorType = floorType.ToLower - - If floorType Is Nothing OrElse floorType.Trim.Length = 0 Then Return False - - If floorType <> "raised floor" AndAlso floorType <> "low floor" AndAlso floorType <> "semi low floor" Then _ - Return False - - Return True - End Function - - Private Function EngineOK(ByVal engine As String) As Boolean - - engine = engine.ToLower - - If engine Is Nothing OrElse engine.Trim.Length = 0 Then Return False - - If engine <> "diesel" AndAlso engine <> "gas" AndAlso engine <> "hybrid" Then Return False - - Return True - End Function - - Private Function DimensionOK(ByVal dimension As Double) As Boolean - - Return dimension > 0.5 - End Function - - Private Function PassengersOK(ByVal registeredPassengers As Integer) As Boolean - - Return registeredPassengers > 1 - End Function - - 'To String function - Public Overrides Function ToString() As String - - Return _ - String.Format("{0},{1},{2},{3},{4},{5},{6},{7}", _model, _floorType, _engineType, _lengthInMetres, _widthInMetres, - _heightInMetres, _registeredPassengers, _isDoubleDecker) - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/BusDatabase.vb b/VECTOAux/VectoAuxiliaries/Hvac/BusDatabase.vb deleted file mode 100644 index 783b0ca0652bd25b10ff48fde17e06c6e06da2b3..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/BusDatabase.vb +++ /dev/null @@ -1,156 +0,0 @@ -Imports System.Globalization -Imports System.IO -Imports System.Text - -Namespace Hvac - Public Class BusDatabase - Implements IBusDatabase - - Private buses As New List(Of IBus) - Private selectListBuses As New List(Of IBus) - - Public Function AddBus(bus As IBus) As Boolean Implements IBusDatabase.AddBus - - Dim result As Boolean = True - - Try - buses.Add(bus) - Catch ex As Exception - result = False - End Try - - Return result - End Function - - Public Function GetBuses(busModel As String, Optional AsSelectList As Boolean = False) As List(Of IBus) _ - Implements IBusDatabase.GetBuses - - If AsSelectList Then - selectListBuses = New List(Of IBus) - selectListBuses = buses.Where(Function(v) v.Model = "" OrElse v.Model.ToLower.Contains(busModel.ToLower)).ToList() - selectListBuses.Insert(0, New Bus(0, "<Select>", "low floor", "gas", 1, 1, 1, 2, False)) - Return selectListBuses - - Else - - Return buses.Where(Function(v) v.Model = "" OrElse v.Model.ToLower.Contains(busModel.ToLower)).ToList() - - End If - End Function - - Public Function Initialise(filepath As String) As Boolean Implements IBusDatabase.Initialise - - Dim returnStatus As Boolean = True - - 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() < 2) Then - Return False - End If - - Dim firstline As Boolean = True - - Dim id As Integer = 1 - - For Each line As String In lines - If Not firstline Then - - 'split the line - Dim elements() As String = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) - '7 or 8 entries per line required - If (elements.Length <> 7 AndAlso elements.Length <> 8) Then - Throw New ArgumentException("Incorrect number of values in csv file") - End If - - 'Bus - Try - Dim bus As New Bus(id, - elements(0), - elements(1), - elements(2), - Double.Parse(elements(3), CultureInfo.InvariantCulture), - Double.Parse(elements(4), CultureInfo.InvariantCulture), - Double.Parse(elements(5), CultureInfo.InvariantCulture), - Integer.Parse(elements(6), CultureInfo.InvariantCulture), - If(elements.Length = 8, Boolean.Parse(elements(7)), False)) - - buses.Add(bus) - - Catch ex As Exception - - 'Indicate problems - returnStatus = False - - End Try - - id = id + 1 - Else - firstline = False - End If - Next line - End Using - - Else - returnStatus = False - End If - - Dim uniqueBuses As Integer = (From b In buses Select New With {Key b.Model, b} Distinct).Count() - - If buses.Count <> uniqueBuses Then - returnStatus = False - End If - - Return returnStatus - End Function - - Public Function UpdateBus(id As Integer, bus As IBus) As Boolean Implements IBusDatabase.UpdateBus - - Dim result As Boolean = True - - Try - - Dim existingBus As IBus = buses.Single(Function(b) b.Id = id) - - existingBus.Model = bus.Model - existingBus.RegisteredPassengers = bus.RegisteredPassengers - existingBus.FloorType = bus.FloorType - existingBus.LengthInMetres = bus.LengthInMetres - existingBus.WidthInMetres = bus.WidthInMetres - existingBus.HeightInMetres = bus.HeightInMetres - existingBus.IsDoubleDecker = bus.IsDoubleDecker - - Catch ex As Exception - result = False - End Try - - Return result - End Function - - Public Function Save(filepath As String) As Boolean Implements IBusDatabase.Save - - Dim result As Boolean = True - Dim output As New StringBuilder - - Try - output.AppendLine("Bus Model,Type,engine Type,length in m,wide in m,height in m,registered passengers,double decker") - - For Each bus As IBus In buses - output.AppendLine(bus.ToString()) - Next - - File.WriteAllText(filepath, output.ToString()) - Catch ex As Exception - result = False - End Try - - Return result - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/BusEngineType.vb b/VECTOAux/VectoAuxiliaries/Hvac/BusEngineType.vb deleted file mode 100644 index 7c6d5f5c65d9c8f6a15bc284cc180c291d6b4dad..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/BusEngineType.vb +++ /dev/null @@ -1,10 +0,0 @@ -Namespace Hvac - Public Enum BusEngineType - - Diesal = 1 - Gas = 2 - Hybrid = 3 - End Enum -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorBase.vb b/VECTOAux/VectoAuxiliaries/Hvac/BusFloorBase.vb deleted file mode 100644 index 929a33ba6f5dc098a1d8fedbd946479a70bc9485..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorBase.vb +++ /dev/null @@ -1,19 +0,0 @@ -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 - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorLow.vb b/VECTOAux/VectoAuxiliaries/Hvac/BusFloorLow.vb deleted file mode 100644 index 4a8863e9f7a95afabff1fbc9d104a7291c63dbbb..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorLow.vb +++ /dev/null @@ -1,30 +0,0 @@ - -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 - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorRaisedFloor.vb b/VECTOAux/VectoAuxiliaries/Hvac/BusFloorRaisedFloor.vb deleted file mode 100644 index a9ee65b4bc6604c06e5ab21f7ed40eda82a162f9..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorRaisedFloor.vb +++ /dev/null @@ -1,31 +0,0 @@ - -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 - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorSemiLow.vb b/VECTOAux/VectoAuxiliaries/Hvac/BusFloorSemiLow.vb deleted file mode 100644 index 546bf56a510521d41adbca707b10a82d4eea999c..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/BusFloorSemiLow.vb +++ /dev/null @@ -1,31 +0,0 @@ - -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 - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/BusKey.vb b/VECTOAux/VectoAuxiliaries/Hvac/BusKey.vb deleted file mode 100644 index ca77a8d0d2bd06acf980ea9b9a49934cf48f2b16..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/BusKey.vb +++ /dev/null @@ -1,19 +0,0 @@ -Namespace Hvac - - -Public structure BusKey - - public Model As String - public FloorType As String - public EngineType As String - - -End structure - - - - -End Namespace - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/DeleteCell.vb b/VECTOAux/VectoAuxiliaries/Hvac/DeleteCell.vb deleted file mode 100644 index ae83180688b957f0839fb2be8e3cae9fd82b4015..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/DeleteCell.vb +++ /dev/null @@ -1,49 +0,0 @@ -Imports System.Windows.Forms -Imports System.Drawing - - -Public Class DeleteCell - Inherits DataGridViewButtonCell - - Public Property ToolTip As String = "Delete tech benefit line" - Private del As Image = TryCast(My.Resources.ResourceManager.GetObject("Delete"), Image) - - - 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 = ToolTip - - 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 - -Public Class DeleteAlternatorCell - Inherits DataGridViewButtonCell - - Public Property ToolTip As String = "Delete alternator" - Private del As Image = TryCast(My.Resources.ResourceManager.GetObject("Delete"), Image) - - - 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 = ToolTip - - 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 \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/DeleteColumn.vb b/VECTOAux/VectoAuxiliaries/Hvac/DeleteColumn.vb deleted file mode 100644 index d222b9838dd7dbf657a0dfd37e088e2f33694bc6..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/DeleteColumn.vb +++ /dev/null @@ -1,22 +0,0 @@ -Imports System.Windows.Forms - - -Public Class DeleteColumn - Inherits DataGridViewButtonColumn - - Public Sub new() - - MyBase.New() - Me.CellTemplate = New DeleteCell() - End Sub -End Class - -Public Class DeleteAlternatorColumn - Inherits DataGridViewButtonColumn - - Public Sub new() - - MyBase.New() - Me.CellTemplate = New DeleteAlternatorCell() - End Sub -End Class \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/EnvironmentalCondition.vb b/VECTOAux/VectoAuxiliaries/Hvac/EnvironmentalCondition.vb deleted file mode 100644 index 0d9eabda44fa45345b8f7a6e1d4ec354a9a2ff26..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/EnvironmentalCondition.vb +++ /dev/null @@ -1,33 +0,0 @@ -Namespace Hvac - Public Class EnvironmentalCondition - Implements IEnvironmentalCondition - - Private _temperature As Double - Private _solar As Double - Private _weight As Double - - Public Sub New(temperature As Double, solar As Double, weight As Double) - - _temperature = temperature - _solar = solar - _weight = weight - End Sub - - Public Function GetTemperature() As Double Implements IEnvironmentalCondition.GetTemperature - Return _temperature - End Function - - Public Function GetSolar() As Double Implements IEnvironmentalCondition.GetSolar - Return _solar - End Function - - Public Function GetWeight() As Double Implements IEnvironmentalCondition.GetWeighting - Return _weight - End Function - - Public Function GetNormalisedWeight(map As List(Of IEnvironmentalCondition)) As Double _ - Implements IEnvironmentalCondition.GetNormalisedWeighting - Return _weight/map.Sum(Function(w) w.GetWeighting()) - End Function - End Class -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/EnvironmentalConditionsMap.vb b/VECTOAux/VectoAuxiliaries/Hvac/EnvironmentalConditionsMap.vb deleted file mode 100644 index fe22582b6152d64839bab7a4369d08b514afede5..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/EnvironmentalConditionsMap.vb +++ /dev/null @@ -1,80 +0,0 @@ -Imports System.Globalization -Imports System.IO - -Namespace Hvac - Public Class EnvironmentalConditionsMap - Implements IEnvironmentalConditionsMap - - Private filePath As String - Private vectoDirectory As String - - Private _map As New List(Of IEnvironmentalCondition) - - Public Sub New(filepath As String, vectoDirectory As String) - - Me.filePath = filepath - Me.vectoDirectory = vectoDirectory - - Initialise() - End Sub - - Public Function Initialise() As Boolean Implements IEnvironmentalConditionsMap.Initialise - - If (Not String.IsNullOrWhiteSpace(filePath)) Then - - filePath = FilePathUtils.ResolveFilePath(vectoDirectory, filePath) - - 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 1 entries to make it usable [dont forget the header row] - If (lines.Count() < 2) Then - Return False - End If - - 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() {","c}, StringSplitOptions.RemoveEmptyEntries) - - '3 entries per line required - If (elements.Length <> 4) Then - Return False - End If - - 'Add environment condition - Dim newCondition As EnvironmentalCondition = New EnvironmentalCondition( - Double.Parse(elements(1), CultureInfo.InvariantCulture), - Double.Parse(elements(2), CultureInfo.InvariantCulture), - Double.Parse(elements(3), CultureInfo.InvariantCulture)) - - _map.Add(newCondition) - - Else - firstline = False - End If - Next line - End Using - - Else - Return False - End If - End If - - Return True - End Function - - Public Function GetEnvironmentalConditions() As List(Of IEnvironmentalCondition) _ - Implements IEnvironmentalConditionsMap.GetEnvironmentalConditions - - Return _map - End Function - End Class -End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb deleted file mode 100644 index 3812cd643670e61b483d1816b7598ec881a1dcd4..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb +++ /dev/null @@ -1,53 +0,0 @@ -' Copyright 2017 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 Newtonsoft.Json -Imports TUGraz.VectoCommon.Utils - -Namespace Hvac - Public Class HVACConstants - Implements IHVACConstants - - <JsonProperty("FuelDensity")> ReadOnly _fuelDensity As Double - <JsonProperty("DieselGCVJperGram")> ReadOnly _dieselGcvJperGram As Double = 44800 - - Public Sub New() - _fuelDensity = 835 '.SI(Of KilogramPerCubicMeter)() - End Sub - - Public Sub New(fuelDensitySingle As KilogramPerCubicMeter) - _fuelDensity = fuelDensitySingle.Value() - End Sub - - - <JsonIgnore> - Public ReadOnly Property DieselGCVJperGram As JoulePerKilogramm Implements IHVACConstants.DieselGCVJperGram - Get - Return _dieselGcvJperGram.SI(Unit.SI.Joule.Per.Gramm).Cast(Of JoulePerKilogramm)() - End Get - End Property - - <JsonIgnore()> - Public ReadOnly Property FuelDensity As KilogramPerCubicMeter Implements IHVACConstants.FuelDensity - Get - Return _fuelDensity.SI(Of KilogramPerCubicMeter)() - End Get - End Property - - <JsonIgnore()> - Public ReadOnly Property FuelDensityAsGramPerLiter As Double Implements IHVACConstants.FuelDensityAsGramPerLiter - Get - Return _fuelDensity * 1000 - End Get - End Property - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACInputs.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACInputs.vb deleted file mode 100644 index d401aa629a1c139360e0b99f3988c9be7212bc0b..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACInputs.vb +++ /dev/null @@ -1,30 +0,0 @@ - -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 - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vb deleted file mode 100644 index 19f5a7c33d7930ef8a6b54b60a9ce8df852d9636..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vb +++ /dev/null @@ -1,309 +0,0 @@ -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 diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACMapParameter.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACMapParameter.vb deleted file mode 100644 index 6b6b199380cf6345bba2f37db10bef7aab6b7f1f..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACMapParameter.vb +++ /dev/null @@ -1,38 +0,0 @@ -' 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 diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb deleted file mode 100644 index fe840ffd87027d89646c98b9178957cc78bd5eb0..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb +++ /dev/null @@ -1,112 +0,0 @@ -' Copyright 2017 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 System.IO - -Namespace Hvac - Public Class HVACSteadyStateModel - Implements IHVACSteadyStateModel - - Public Property HVACElectricalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACElectricalLoadPowerWatts - Public Property HVACFuellingLitresPerHour As Single Implements IHVACSteadyStateModel.HVACFuellingLitresPerHour - Public Property HVACMechanicalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACMechanicalLoadPowerWatts - - 'Constructors - Public Sub New() - End Sub - - Public Sub New(elecPowerW As Single, mechPowerW As Single, fuellingLPH As Single) - - HVACElectricalLoadPowerWatts = elecPowerW - HVACFuellingLitresPerHour = mechPowerW - HVACMechanicalLoadPowerWatts = fuellingLPH - End Sub - - 'Implementation - Public Function SetValuesFromMap(ByVal filePath As String, byref message As String) As Boolean _ - Implements IHVACSteadyStateModel.SetValuesFromMap - - - Dim myData As String - Dim linesArray As String() - - - 'Check map file can be found. - Try - myData = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8) - Catch ex As FileNotFoundException - - message = "HVAC Steady State Model : The map file was not found" - Return false - End Try - - - linesArray = (From s As String In myData.Split(CType(vbLf, Char)) Select s.Trim).ToArray - - 'Check count is at least 2 rows - If linesArray.Count < 2 then - message = "HVAC Steady State Model : Insufficient Lines in this File" - Return False - End If - - 'validate headers - Dim headers As String() = linesArray(0).Split(","c) - If headers.Count <> 3 OrElse - headers(0).Trim <> "[Electrical Power (w)]" OrElse - headers(1).Trim <> "[Mechanical Power (w)]" OrElse - headers(2).Trim <> "[Fuelling (L/H)]" Then - message = "HVAC Steady State Model : Column headers in *.AHSM file being read are incompatable." - Return False - - End If - - 'validate values - Dim values As String() = linesArray(1).Split(","c) - If headers.Count <> 3 OrElse - NOT IsNumeric(values(0)) OrElse - NOT IsNumeric(values(1)) OrElse - Not IsNumeric(values(2)) - message = "Steady State Model : Unable to confirm numeric values in the *.AHSM file being read." - Return False - End If - - 'OK we have the values so lets set the properties - Dim out1, out2, out3 As single - out1 = HVACElectricalLoadPowerWatts - out2 = HVACMechanicalLoadPowerWatts - out3 = HVACFuellingLitresPerHour - try - - HVACElectricalLoadPowerWatts = Single.Parse(values(0)) - HVACMechanicalLoadPowerWatts = Single.Parse(values(1)) - HVACFuellingLitresPerHour = Single.Parse(values(2)) - - Catch ex As Exception - - 'Restore in the event of failure to fully assign - HVACElectricalLoadPowerWatts = out1 - HVACMechanicalLoadPowerWatts = out2 - HVACFuellingLitresPerHour = out3 - - 'Return result - message = - "Steady State Model : Unable to parse the values in the *.AHSM file being read no values were harmed in reading of this file." - Return False - - End Try - - - Return True - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACUserInputsConfig.vb deleted file mode 100644 index 3a806dcd8ab247c8cd1f0001b35a0d4b34d8123f..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACUserInputsConfig.vb +++ /dev/null @@ -1,36 +0,0 @@ -' Copyright 2017 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.Hvac -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics - -Namespace Hvac - Public Class HVACUserInputsConfig - Implements IHVACUserInputsConfig - - 'Constructor - Public Sub New(ssmFilePath As String, busDatabasePath As String, isDisabled As Boolean) - - Me.SSMFilePath = ssmFilePath - Me.BusDatabasePath = busDatabasePath - Me.SSMDisabled = isDisabled - End Sub - - Public Property SSMFilePath As String Implements IHVACUserInputsConfig.SSMFilePath - - Public Property BusDatabasePath As String Implements IHVACUserInputsConfig.BusDatabasePath - - Public Property SSMDisabled As Boolean Implements IHVACUserInputsConfig.SSMDisabled - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IBus.vb b/VECTOAux/VectoAuxiliaries/Hvac/IBus.vb deleted file mode 100644 index d1f5b72190bbac39e51307a27f9487604657a888..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IBus.vb +++ /dev/null @@ -1,17 +0,0 @@ - -Namespace Hvac - Public Interface IBus - ReadOnly Property Id As Integer - - Property Model As String - Property FloorType As String - Property EngineType As String - Property LengthInMetres As Double - Property WidthInMetres As Double - Property HeightInMetres As Double - Property RegisteredPassengers As Integer - Property IsDoubleDecker As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IBusDatabase.vb b/VECTOAux/VectoAuxiliaries/Hvac/IBusDatabase.vb deleted file mode 100644 index afa479db3d88c75740c5340beed55f29cbfdf580..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IBusDatabase.vb +++ /dev/null @@ -1,13 +0,0 @@ -Namespace Hvac - Public Interface IBusDatabase - Function AddBus(bus As IBus) As Boolean - - Function GetBuses(busModel As String, Optional AsSelectList As Boolean = False) As List(Of IBus) - - Function Initialise(busFileCSV As String) As Boolean - - Function UpdateBus(id As Integer, bus As IBus) As Boolean - - Function Save(filepath As String) As Boolean - End Interface -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IEnvironmentalCondition.vb b/VECTOAux/VectoAuxiliaries/Hvac/IEnvironmentalCondition.vb deleted file mode 100644 index 2fd07cffcc30d7ece7e5e8785f850c6b7643909d..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IEnvironmentalCondition.vb +++ /dev/null @@ -1,8 +0,0 @@ -Namespace Hvac - Public Interface IEnvironmentalCondition - Function GetTemperature() As Double - Function GetSolar() As Double - Function GetWeighting() As Double - Function GetNormalisedWeighting(map As List(Of IEnvironmentalCondition)) As Double - End Interface -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IEnvironmentalConditionsMap.vb b/VECTOAux/VectoAuxiliaries/Hvac/IEnvironmentalConditionsMap.vb deleted file mode 100644 index 9100921176c265fee2d65503e642f71d12768827..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IEnvironmentalConditionsMap.vb +++ /dev/null @@ -1,7 +0,0 @@ -Namespace Hvac - Public Interface IEnvironmentalConditionsMap - Function Initialise() As Boolean - - Function GetEnvironmentalConditions() As List(Of IEnvironmentalCondition) - End Interface -End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACConstants.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACConstants.vb deleted file mode 100644 index 7748f5a9c39d26793239dfbc9f5f63986b427cbf..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACConstants.vb +++ /dev/null @@ -1,25 +0,0 @@ -Imports TUGraz.VectoCommon.Utils - -Namespace Hvac - Public Interface IHVACConstants - ''' <summary> - ''' Diesel: 44800 [J/g] - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property DieselGCVJperGram As JoulePerKilogramm - - ''' <summary> - ''' 835 [g/l] - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property FuelDensity As KilogramPerCubicMeter - - ReadOnly Property FuelDensityAsGramPerLiter As Double - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACInputs.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACInputs.vb deleted file mode 100644 index 27ac62a71e9ad8a24744a9c7465f2ea628bc0ba3..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACInputs.vb +++ /dev/null @@ -1,15 +0,0 @@ - -Namespace Hvac - -Public Interface IHVACInputs - - Property Region As Integer - - Property Season As Integer - -End Interface - - - -End Namespace - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACMap.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACMap.vb deleted file mode 100644 index 716dafe3c74fdd36954192f7da399fd3ee864ce0..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACMap.vb +++ /dev/null @@ -1,27 +0,0 @@ -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 - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb deleted file mode 100644 index 15069622b36f34f49df22eaf537857545f5169fc..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb +++ /dev/null @@ -1,49 +0,0 @@ -' Copyright 2017 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. - -Namespace Hvac - Public Interface IHVACSteadyStateModel - ''' <summary> - ''' Initialised Values From Map - ''' </summary> - ''' <param name="filePath"></param> - ''' <param name="message"></param> - ''' <returns>True if successfull, and False if not.</returns> - ''' <remarks></remarks> - Function SetValuesFromMap(byval filePath As String, ByRef message As string) As Boolean - - ''' <summary> - ''' HVAC Mechanical Load Power (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property HVACMechanicalLoadPowerWatts As Single - - ''' <summary> - ''' HVAC Electrical Load Power (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property HVACElectricalLoadPowerWatts As Single - - ''' <summary> - ''' HVAC Fuelling (L/H) - ''' </summary> - ''' <value></value> - ''' <returns>Liters per hour</returns> - ''' <remarks></remarks> - Property HVACFuellingLitresPerHour As single - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACUserInputsConfig.vb deleted file mode 100644 index 9c5063622e2996c98257591fe12977ff93d8eb23..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACUserInputsConfig.vb +++ /dev/null @@ -1,33 +0,0 @@ -' Copyright 2017 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.Pneumatics -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Hvac - -Namespace Hvac - Public Interface IHVACUserInputsConfig - ' Property SteadyStateModel As IHVACSteadyStateModel - ''' <summary> - ''' PathName of the Steady State Model File - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property SSMFilePath As String - - Property BusDatabasePath As String - - Property SSMDisabled As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IM1_AverageHVACLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Hvac/IM1_AverageHVACLoadDemand.vb deleted file mode 100644 index 61255d11c46b2ba5eee30256ed118fa1df30b0fc..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/IM1_AverageHVACLoadDemand.vb +++ /dev/null @@ -1,45 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Hvac - Public Interface IM1_AverageHVACLoadDemand - ''' <summary> - ''' Average Power Demand At Crank From HVAC Mechanicals (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AveragePowerDemandAtCrankFromHVACMechanicalsWatts() As Watt - - ''' <summary> - ''' Average Power Demand At Alternator From HVAC Electrics (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AveragePowerDemandAtAlternatorFromHVACElectricsWatts() As Watt - - ''' <summary> - ''' Average Power Demand At Crank From HVAC Electrics (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AveragePowerDemandAtCrankFromHVACElectricsWatts() As Watt - - ''' <summary> - ''' HVAC Fueling (L/H) - ''' </summary> - ''' <returns>Litres Per Hour</returns> - ''' <remarks></remarks> - Function HVACFuelingLitresPerHour() As LiterPerSecond - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ISSMCalculate.vb b/VECTOAux/VectoAuxiliaries/Hvac/ISSMCalculate.vb deleted file mode 100644 index 97deff4a13e7b956f7d74d823a934d5606296924..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/ISSMCalculate.vb +++ /dev/null @@ -1,65 +0,0 @@ -Namespace Hvac - - Public Interface ISSMCalculate - - Property Run1 As ISSMRun - Property Run2 As ISSMRun - - - ReadOnly Property ElectricalWBase As Double - ReadOnly Property MechanicalWBase As Double - ReadOnly Property FuelPerHBase As Double - - ReadOnly Property ElectricalWAdjusted As Double - ReadOnly Property MechanicalWBaseAdjusted As Double - ReadOnly Property FuelPerHBaseAdjusted As Double - - - 'BaseValues - '- Heating - ReadOnly Property BaseHeatingW_Mechanical As Double - ReadOnly Property BaseHeatingW_ElectricalCoolingHeating As Double - ReadOnly Property BaseHeatingW_ElectricalVentilation As Double - ReadOnly Property BaseHeatingW_FuelFiredHeating As Double - - 'Cooling - ReadOnly Property BaseCoolingW_Mechanical As Double - ReadOnly Property BaseCoolingW_ElectricalCoolingHeating As Double - ReadOnly Property BaseCoolingW_ElectricalVentilation As Double - ReadOnly Property BaseCoolingW_FuelFiredHeating As Double - - 'Cooling - ReadOnly Property BaseVentilationW_Mechanical As Double - ReadOnly Property BaseVentilationW_ElectricalCoolingHeating As Double - ReadOnly Property BaseVentilationW_ElectricalVentilation As Double - ReadOnly Property BaseVentilationW_FuelFiredHeating As Double - - - 'TechListBenefits - '- Heating - ReadOnly Property TechListAdjustedHeatingW_Mechanical As Double - ReadOnly Property TechListAdjustedHeatingW_ElectricalCoolingHeating As Double - ReadOnly Property TechListAdjustedHeatingW_ElectricalVentilation As Double - ReadOnly Property TechListAdjustedHeatingW_FuelFiredHeating As Double - - 'Cooling TechListAdjusted - ReadOnly Property TechListAdjustedCoolingW_Mechanical As Double - ReadOnly Property TechListAdjustedCoolingW_ElectricalCoolingHeating As Double - ReadOnly Property TechListAdjustedCoolingW_ElectricalVentilation As Double - ReadOnly Property TechListAdjustedCoolingW_FuelFiredHeating As Double - - 'Cooling TechListAdjusted - ReadOnly Property TechListAdjustedVentilationW_Mechanical As Double - ReadOnly Property TechListAdjustedVentilationW_ElectricalCoolingHeating As Double - ReadOnly Property TechListAdjustedVentilationW_ElectricalVentilation As Double - ReadOnly Property TechListAdjustedVentilationW_FuelFiredHeating As Double - - - End Interface - - - -End Namespace - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ISSMGenInputs.vb b/VECTOAux/VectoAuxiliaries/Hvac/ISSMGenInputs.vb deleted file mode 100644 index ccb3f0501447079e691dd62f5485bfda4424773d..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/ISSMGenInputs.vb +++ /dev/null @@ -1,77 +0,0 @@ - -Namespace Hvac - - Public Interface ISSMGenInputs - - 'Bus Parameterisation - Property BP_BusModel As String - Property BP_NumberOfPassengers As Double - Property BP_BusFloorType As String - Property BP_DoubleDecker As Boolean - Property BP_BusLength As Double - Property BP_BusWidth As Double - Property BP_BusHeight As Double - - ReadOnly Property BP_BusFloorSurfaceArea As Double - ReadOnly Property BP_BusWindowSurface As Double - ReadOnly Property BP_BusSurfaceAreaM2 As Double - ReadOnly Property BP_BusVolume As Double - - 'Boundary Conditions: - Property BC_GFactor As Double - ReadOnly Property BC_SolarClouding As Double - ReadOnly Property BC_HeatPerPassengerIntoCabinW As Double - Property BC_PassengerBoundaryTemperature As Double - ReadOnly Property BC_PassengerDensityLowFloor As Double - ReadOnly Property BC_PassengerDensitySemiLowFloor As Double - ReadOnly Property BC_PassengerDensityRaisedFloor As Double - ReadOnly Property BC_CalculatedPassengerNumber As Double - ReadOnly Property BC_UValues As Double - Property BC_HeatingBoundaryTemperature As Double - Property BC_CoolingBoundaryTemperature As Double - ReadOnly Property BC_TemperatureCoolingTurnsOff As Double - Property BC_HighVentilation As Double - Property BC_lowVentilation As Double - ReadOnly Property BC_High As Double - ReadOnly Property BC_Low As Double - ReadOnly Property BC_HighVentPowerW As Double - ReadOnly Property BC_LowVentPowerW As Double - Property BC_SpecificVentilationPower As Double - Property BC_AuxHeaterEfficiency As Double - Property BC_GCVDieselOrHeatingOil As Double - ReadOnly Property BC_WindowAreaPerUnitBusLength As Double - ReadOnly Property BC_FrontRearWindowArea As Double - Property BC_MaxTemperatureDeltaForLowFloorBusses As Double - Property BC_MaxPossibleBenefitFromTechnologyList As Double - - 'EnviromentalConditions - Property EC_EnviromentalTemperature As Double - Property EC_Solar As Double - ReadOnly Property EC_EnvironmentalConditionsMap As IEnvironmentalConditionsMap - Property EC_EnviromentalConditions_BatchFile As String - Property EC_EnviromentalConditions_BatchEnabled As Boolean - - 'AC-system - Property AC_CompressorType As String - ReadOnly Property AC_CompressorTypeDerived As String - Property AC_CompressorCapacitykW As Double - ReadOnly Property AC_COP As Double - - 'Ventilation - Property VEN_VentilationOnDuringHeating As Boolean - Property VEN_VentilationWhenBothHeatingAndACInactive As Boolean - Property VEN_VentilationDuringAC As Boolean - Property VEN_VentilationFlowSettingWhenHeatingAndACInactive As String - Property VEN_VentilationDuringHeating As String - Property VEN_VentilationDuringCooling As String - - 'Aux. Heater - Property AH_EngineWasteHeatkW As Double - Property AH_FuelFiredHeaterkW As Double - Property AH_FuelEnergyToHeatToCoolant As Double - Property AH_CoolantHeatTransferredToAirCabinHeater As Double - End Interface - -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ISSMRun.vb b/VECTOAux/VectoAuxiliaries/Hvac/ISSMRun.vb deleted file mode 100644 index 35ebc4d1ad7f4aa868e3ad6fc0f32661b4a2ccd9..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/ISSMRun.vb +++ /dev/null @@ -1,25 +0,0 @@ - -Namespace Hvac - - - Public Interface ISSMRun - - ReadOnly Property HVACOperation As Double - ReadOnly Property TCalc As Double - ReadOnly Property TemperatureDelta As Double - ReadOnly Property QWall As Double - ReadOnly Property WattsPerPass As Double - ReadOnly Property Solar As Double - ReadOnly Property TotalW As Double - ReadOnly Property TotalKW As Double - ReadOnly Property FuelW As Double - ReadOnly Property TechListAmendedFuelW As Double - - End Interface - - - - -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ISSMTOOL.vb b/VECTOAux/VectoAuxiliaries/Hvac/ISSMTOOL.vb deleted file mode 100644 index 8083b01d6bc13fac7f4b000229a89ffda35e9bd9..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/ISSMTOOL.vb +++ /dev/null @@ -1,36 +0,0 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Hvac - -Public Interface ISSMTOOL - Property GenInputs As ISSMGenInputs - Property TechList As ISSMTechList - Property Calculate As ISSMCalculate - Property SSMDisabled As Boolean - Property HVACConstants As IHVACConstants - - ReadOnly Property ElectricalWBase As Double 'Watt - ReadOnly Property MechanicalWBase As Double ' Watt - ReadOnly Property FuelPerHBase As Double ' LiterPerHour - - ReadOnly Property ElectricalWAdjusted As Double ' Watt - ReadOnly Property MechanicalWBaseAdjusted As Double ' Watt - ReadOnly Property FuelPerHBaseAdjusted As Double ' LiterPerHour - - Sub Clone(from As ISSMTOOL) - - Function Load(filePath As String) As Boolean - - Function Save(filePath As String) As Boolean - - Function IsEqualTo(source As ISSMTOOL) As Boolean - - ''' <summary> - ''' This alters the waste heat and returns an adjusted fueling value - ''' </summary> - ''' <param name="AverageUseableEngineWasteHeatKW"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function FuelPerHBaseAsjusted(AverageUseableEngineWasteHeatKW As Double) As Double - - Event Message(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) -End Interface diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ISSMTechList.vb b/VECTOAux/VectoAuxiliaries/Hvac/ISSMTechList.vb deleted file mode 100644 index 781f3aa8aa988ebb422c4cb23cbdf12fe0b1fab9..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/ISSMTechList.vb +++ /dev/null @@ -1,40 +0,0 @@ - -Namespace Hvac - - Public Interface ISSMTechList - - Property TechLines As List(Of ITechListBenefitLine) - - Sub Clear() - Function Add(item As ITechListBenefitLine, ByRef feedback As String) As Boolean - Function Delete(item As ITechListBenefitLine, ByRef feedback As String) As Boolean - Function Modify(originalItem As ITechListBenefitLine, modifiedItem As ITechListBenefitLine, ByRef feedback As String) As Boolean - - Sub SetSSMGeneralInputs(genInputs As ISSMGenInputs) - - ReadOnly Property HValueVariation As Double - ReadOnly Property VHValueVariation As Double - ReadOnly Property VVValueVariation As Double - ReadOnly Property VCValueVariation As Double - ReadOnly Property CValueVariation As Double - - ReadOnly Property HValueVariationKW As Double - ReadOnly Property VHValueVariationKW As Double - ReadOnly Property VVValueVariationKW As Double - ReadOnly Property VCValueVariationKW As Double - ReadOnly Property CValueVariationKW As Double - - - Function Initialise() As Boolean - Function Initialise(filePath As String) As Boolean - - - - - End Interface - - - -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ITechListBenefitLine.vb b/VECTOAux/VectoAuxiliaries/Hvac/ITechListBenefitLine.vb deleted file mode 100644 index 216a9c55409455a14178da0d0c47922c8d845c5a..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/ITechListBenefitLine.vb +++ /dev/null @@ -1,37 +0,0 @@ -Namespace Hvac - Public Interface ITechListBenefitLine - Property Units As string - Property Category As String - Property BenefitName As String - - Property LowFloorH As double - Property LowFloorV As double - Property LowFloorC As double - - Property SemiLowFloorH As double - Property SemiLowFloorV As double - Property SemiLowFloorC As double - - Property RaisedFloorH As double - Property RaisedFloorV As double - Property RaisedFloorC As double - - Property OnVehicle As Boolean - Property ActiveVH As Boolean - Property ActiveVV As Boolean - Property ActiveVC As Boolean - Property LineType As TechLineType - - ReadOnly Property H As Double - ReadOnly Property VH As Double - ReadOnly Property VV As Double - ReadOnly Property VC As Double - ReadOnly Property C As Double - - Sub CloneFrom(source As ITechListBenefitLine) - - Function IsEqualTo(source As ITechListBenefitLine) As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/ITechSectionLine.vb b/VECTOAux/VectoAuxiliaries/Hvac/ITechSectionLine.vb deleted file mode 100644 index 5881e6d7d1e70936f384299ac55f2f52efe4c6d4..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/ITechSectionLine.vb +++ /dev/null @@ -1,15 +0,0 @@ -Namespace Hvac - -Public Class ITechSectionLine - - - - - -End Class - - -End Namespace - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb deleted file mode 100644 index 92e1b2606fb0795310616fb081433c9d93df4e57..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb +++ /dev/null @@ -1,98 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics - -Namespace Hvac - Public Class M1_AverageHVACLoadDemand - Implements IM1_AverageHVACLoadDemand - - Private _m0 As IM0_NonSmart_AlternatorsSetEfficiency - Private _alternatorGearEfficiency As Double - Private _compressorGearEfficiency As Double - Private _signals As ISignals - Private _powernetVoltage As Volt - Private _steadyStateModel As ISSMTOOL - - Private _ElectricalPowerW As Watt - Private _MechanicalPowerW As Watt - Private _FuelingLPerH As LiterPerSecond - - - 'Constructor - Public Sub New(m0 As IM0_NonSmart_AlternatorsSetEfficiency, altGearEfficiency As Double, - compressorGearEfficiency As Double, powernetVoltage As Volt, signals As ISignals, ssm As ISSMTOOL) - - 'Sanity Check - Illegal operations without all params. - If m0 Is Nothing Then Throw New ArgumentException("Module0 as supplied is null") - - If _ - altGearEfficiency < ElectricConstants.AlternatorPulleyEfficiencyMin OrElse - altGearEfficiency > ElectricConstants.AlternatorPulleyEfficiencyMax Then _ - Throw _ - New ArgumentException(String.Format("Gear efficiency must be between {0} and {1}", - ElectricConstants.AlternatorPulleyEfficiencyMin, ElectricConstants.AlternatorPulleyEfficiencyMax)) - - If signals Is Nothing Then Throw New Exception("Signals object as supplied is null") - If powernetVoltage < ElectricConstants.PowenetVoltageMin OrElse powernetVoltage > ElectricConstants.PowenetVoltageMax _ - Then _ - Throw _ - New ArgumentException(String.Format("PowenetVoltage supplied must be in the range {0} to {1}", - ElectricConstants.PowenetVoltageMin, ElectricConstants.PowenetVoltageMax)) - If ssm Is Nothing Then Throw New ArgumentException("Steady State model was not supplied") - If compressorGearEfficiency < 0 OrElse altGearEfficiency > 1 Then _ - Throw New ArgumentException(String.Format("Compressor Gear efficiency must be between {0} and {1}", 0, 1)) - - - 'Assign - _m0 = m0 - _alternatorGearEfficiency = altGearEfficiency - _signals = signals - - _compressorGearEfficiency = compressorGearEfficiency - _powernetVoltage = powernetVoltage - - - _steadyStateModel = ssm - - _ElectricalPowerW = ssm.ElectricalWAdjusted.SI(Of Watt)() - _MechanicalPowerW = ssm.MechanicalWBaseAdjusted.SI(Of Watt)() - _FuelingLPerH = ssm.FuelPerHBaseAdjusted.SI(Unit.SI.Liter.Per.Hour).Cast(Of LiterPerSecond)() ' SI(Of LiterPerHour)() - End Sub - - 'Public Methods - Implementation - Public Function AveragePowerDemandAtCrankFromHVACMechanicalsWatts() As Watt _ - Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtCrankFromHVACMechanicalsWatts - - Return _MechanicalPowerW * (1 / _compressorGearEfficiency) - End Function - - Public Function AveragePowerDemandAtAlternatorFromHVACElectricsWatts() As Watt _ - Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtAlternatorFromHVACElectricsWatts - - Return _ElectricalPowerW - End Function - - Public Function AveragePowerDemandAtCrankFromHVACElectricsWatts() As Watt _ - Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtCrankFromHVACElectricsWatts - - Return _ElectricalPowerW * (1 / _m0.AlternatorsEfficiency() / _alternatorGearEfficiency) - End Function - - Public Function HVACFuelingLitresPerHour() As LiterPerSecond _ - Implements IM1_AverageHVACLoadDemand.HVACFuelingLitresPerHour - - Return _FuelingLPerH - End Function - End Class -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb deleted file mode 100644 index 12b5ac6feaba175e3b03d1099b9cad394e8b699b..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMCalculate.vb +++ /dev/null @@ -1,795 +0,0 @@ -Imports System.Text -Imports Microsoft.VisualBasic -Imports VectoAuxiliaries.Hvac - -Namespace Hvac - 'Modeling SSHVAC V07 - Public Class SSMCalculate - Implements ISSMCalculate - - Private ssmTOOL As ISSMTOOL - Private Property Run1 As ISSMRun Implements ISSMCalculate.Run1 - Private Property Run2 As ISSMRun Implements ISSMCalculate.Run2 - - 'Constructor - Sub New(ssmTool As ISSMTOOL) - - Me.ssmTOOL = ssmTool - Run1 = New SSMRun(Me.ssmTOOL, 1) - Run2 = New SSMRun(Me.ssmTOOL, 2) - End Sub - -#Region "Main Outputs" - - 'BASE RESULTS - Public ReadOnly Property ElectricalWBase As Double Implements ISSMCalculate.ElectricalWBase - Get - - Dim ElectricalWBaseWeightedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the ElectricalWBase for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - ElectricalWBaseWeightedAverage = CalculateElectricalWBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - ElectricalWBaseWeightedAverage += CalculateElectricalWBase(gen, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return ElectricalWBaseWeightedAverage - End Get - End Property - - Public ReadOnly Property MechanicalWBase As Double Implements ISSMCalculate.MechanicalWBase - Get - - Dim MechanicalWBaseWeightedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the MechanicalWBase for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - MechanicalWBaseWeightedAverage = CalculateMechanicalWBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - MechanicalWBaseWeightedAverage += CalculateMechanicalWBase(gen, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return MechanicalWBaseWeightedAverage - End Get - End Property - - Public ReadOnly Property FuelPerHBase As Double Implements ISSMCalculate.FuelPerHBase - Get - - Dim FuelLPerHBaseWeightedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the FuelLPerHBase for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - FuelLPerHBaseWeightedAverage = CalculateFuelLPerHBase(gen, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - FuelLPerHBaseWeightedAverage += CalculateFuelLPerHBase(gen, envCondition.GetTemperature(), envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return FuelLPerHBaseWeightedAverage - End Get - End Property - - 'ADJUSTED RESULTS - Public ReadOnly Property ElectricalWAdjusted As Double Implements ISSMCalculate.ElectricalWAdjusted - Get - Dim ElectricalWAdjustedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the ElectricalWAdjusted for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - ElectricalWAdjustedAverage = CalculateElectricalWAdjusted(gen, tl, gen.EC_EnviromentalTemperature, gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - ElectricalWAdjustedAverage += CalculateElectricalWAdjusted(gen, tl, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return ElectricalWAdjustedAverage - End Get - End Property - - Public ReadOnly Property MechanicalWBaseAdjusted As Double Implements ISSMCalculate.MechanicalWBaseAdjusted - Get - - Dim MechanicalWBaseAdjustedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the MechanicalWBaseAdjusted for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - MechanicalWBaseAdjustedAverage = CalculateMechanicalWBaseAdjusted(gen, tl, gen.EC_EnviromentalTemperature, - gen.EC_Solar, 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - MechanicalWBaseAdjustedAverage += CalculateMechanicalWBaseAdjusted(gen, tl, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting( - gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return MechanicalWBaseAdjustedAverage - End Get - End Property - - Public ReadOnly Property FuelPerHBaseAdjusted As Double Implements ISSMCalculate.FuelPerHBaseAdjusted - Get - Dim FuelLPerHBaseAdjustedAverage As Double - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim EC_EnviromentalTemperatureBefore As Double = gen.EC_EnviromentalTemperature - Dim EC_SolarBefore As Double = gen.EC_Solar - - 'If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - 'Else if batch is enable calculate the FuelLPerHBaseAdjusted for each input in the AENV file and then calculate the weighted average - If Not gen.EC_EnviromentalConditions_BatchEnabled Then - FuelLPerHBaseAdjustedAverage = CalculateFuelLPerHBaseAdjusted(gen, tl, gen.EC_EnviromentalTemperature, gen.EC_Solar, - 1) - Else - For Each envCondition As IEnvironmentalCondition In gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions() - FuelLPerHBaseAdjustedAverage += CalculateFuelLPerHBaseAdjusted(gen, tl, envCondition.GetTemperature(), - envCondition.GetSolar(), - envCondition.GetNormalisedWeighting(gen.EC_EnvironmentalConditionsMap.GetEnvironmentalConditions())) - Next - gen.EC_EnviromentalTemperature = EC_EnviromentalTemperatureBefore - gen.EC_Solar = EC_SolarBefore - End If - - Return FuelLPerHBaseAdjustedAverage - End Get - End Property - - -#End Region - -#Region "Staging Calculations" - - 'Base Values - Public ReadOnly Property BaseHeatingW_Mechanical As Double Implements ISSMCalculate.BaseHeatingW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseHeatingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.BaseHeatingW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseHeatingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.BaseHeatingW_ElectricalVentilation - Get - '=IF(AND(M89<0,M90<0),IF(AND(C62="yes",C66="high"),C33,IF(AND(C62="yes",C66="low"),C34,0)),0) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C33 = gen.BC_HighVentPowerW - 'Dim C34 = gen.BC_LowVentPowerW - 'Dim C62 = gen.VEN_VentilationONDuringHeating - 'Dim C66 = gen.VEN_VentilationDuringHeating - 'Dim M89 = Me.Run1.TotalW - 'Dim M90 = Me.Run2.TotalW - - Dim res As Double - - res = If(Run1.TotalW < 0 AndAlso Run2.TotalW < 0, - If(gen.VEN_VentilationOnDuringHeating AndAlso gen.VEN_VentilationDuringHeating.ToLower() = "high", - gen.BC_HighVentPowerW, - If _ - (gen.VEN_VentilationOnDuringHeating AndAlso gen.VEN_VentilationDuringHeating.ToLower() = "low", - gen.BC_LowVentPowerW, 0)), 0) - - - Return res - End Get - End Property - - Public ReadOnly Property BaseHeatingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.BaseHeatingW_FuelFiredHeating - - Get - '=IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:O90,3),0) - - 'Dim M89 = Me.Run1.TotalW - 'Dim M90 = Me.Run2.TotalW - 'VLOOKUP(MAX(M89:M90),M89:O90 => VLOOKUP ( lookupValue, tableArray, colIndex, rangeLookup ) - - 'If both Run TotalW values are >=0 then return FuelW from Run with largest TotalW value, else return 0 - If (Run1.TotalW < 0 AndAlso Run2.TotalW < 0) Then - - Return If(Run1.TotalW > Run2.TotalW, Run1.FuelW, Run2.FuelW) - - Else - - Return 0 - - End If - End Get - End Property - - Public ReadOnly Property BaseCoolingW_Mechanical As Double Implements ISSMCalculate.BaseCoolingW_Mechanical - Get - '=IF(C46<C28,0,IF(C53="electrical", 0, IF(AND(M89>0,M90>0),MIN(M89:M90),0))) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim C53 = gen.AC_CompressorTypeDerived - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - - Return _ - If _ - (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff, 0, - If _ - (gen.AC_CompressorTypeDerived.ToLower() = "electrical", 0, - If(Run1.TotalW > 0 AndAlso Run2.TotalW > 0, Math.Min(Run1.TotalW, Run2.TotalW), 0))) - End Get - End Property - - Public ReadOnly Property BaseCoolingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.BaseCoolingW_ElectricalCoolingHeating - Get - '=IF(C46<C28,0,IF(C53="electrical",IF(AND(M89>0,M90>0),MIN(M89:M90),0),0)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim C53 = gen.AC_CompressorTypeDerived - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - - Return _ - If _ - (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff, 0, - If _ - (gen.AC_CompressorTypeDerived.ToLower() = "electrical", - If(Run1.TotalW > 0 AndAlso Run2.TotalW > 0, Math.Min(Run1.TotalW, Run2.TotalW), 0), 0)) - End Get - End Property - - Public ReadOnly Property BaseCoolingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.BaseCoolingW_ElectricalVentilation - Get - '=IF(AND(C46>=C28,M89>0,M90>0),IF(AND(C64="yes",C67="high"),C33,IF(AND(C64="yes",C67="low"),C34,0)),0) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - 'Dim C64 = gen.VEN_VentilationDuringAC - 'Dim C67 = gen.VEN_VentilationDuringCooling - 'Dim C33 = gen.BC_HighVentPowerW - 'Dim C34 = gen.BC_LowVentPowerW - - Return _ - If _ - ( - gen.EC_EnviromentalTemperature >= gen.BC_TemperatureCoolingTurnsOff AndAlso Run1.TotalW > 0 AndAlso - Run2.TotalW > 0, - If _ - (gen.VEN_VentilationDuringAC AndAlso gen.VEN_VentilationDuringCooling.ToLower() = "high", gen.BC_HighVentPowerW, - If _ - (gen.VEN_VentilationDuringAC AndAlso gen.VEN_VentilationDuringCooling.ToLower() = "low", gen.BC_LowVentPowerW, 0)) _ - , 0) - End Get - End Property - - Public ReadOnly Property BaseCoolingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.BaseCoolingW_FuelFiredHeating - Get - Return 0 - End Get - End Property - - Public ReadOnly Property BaseVentilationW_Mechanical As Double Implements ISSMCalculate.BaseVentilationW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseVentilationW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.BaseVentilationW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property BaseVentilationW_ElectricalVentilation As Double _ - Implements ISSMCalculate.BaseVentilationW_ElectricalVentilation - Get - '=IF(OR(AND(C46<C28,M89>0,M90>0),AND(M89>0,M90<0)),IF(AND(C63="yes",C65="high"),C33,IF(AND(C63="yes",C65="low"),C34,0)),0) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim C46 = gen.EC_EnviromentalTemperature - 'Dim C28 = gen.BC_TemperatureCoolingTurnsOff - 'Dim M89 = Run1.TotalW - 'Dim M90 = Run2.TotalW - 'Dim C63 = gen.VEN_VentilationWhenBothHeatingAndACInactive - 'Dim C65 = gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive - 'Dim C33 = gen.BC_HighVentPowerW - 'Dim C34 = gen.BC_LowVentPowerW - - Return _ - If _ - ( - (gen.EC_EnviromentalTemperature < gen.BC_TemperatureCoolingTurnsOff AndAlso Run1.TotalW > 0 AndAlso - Run2.TotalW > 0) OrElse (Run1.TotalW > 0 AndAlso Run2.TotalW < 0), - If _ - ( - gen.VEN_VentilationWhenBothHeatingAndACInactive AndAlso - gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() = "high", gen.BC_HighVentPowerW, - If _ - ( - gen.VEN_VentilationWhenBothHeatingAndACInactive AndAlso - gen.VEN_VentilationFlowSettingWhenHeatingAndACInactive.ToLower() = "low", gen.BC_LowVentPowerW, 0)), 0) - End Get - End Property - - Public ReadOnly Property BaseVentilationW_FuelFiredHeating As Double _ - Implements ISSMCalculate.BaseVentilationW_FuelFiredHeating - Get - Return 0 - End Get - End Property - - 'Adjusted Values - Public ReadOnly Property TechListAdjustedHeatingW_Mechanical As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedHeatingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedHeatingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_ElectricalVentilation - Get - '=IF('TECH LIST INPUT'!O92>0,MIN('TECH LIST INPUT'!O92,C43),MAX('TECH LIST INPUT'!O92,-C43)) - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'TECH LIST INPUT'!O92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim TLO92 As Double = tl.VHValueVariation - - - Return _ - If _ - (tl.VHValueVariation > 0, Math.Min(tl.VHValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.VHValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedHeatingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.TechListAdjustedHeatingW_FuelFiredHeating - Get - '=IF('TECH LIST INPUT'!N92>0,MIN('TECH LIST INPUT'!N92,C43),MAX('TECH LIST INPUT'!N92,-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'TECH LIST INPUT'!N92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim TLN92 As Double = tl.HValueVariation - - - Return _ - If _ - (tl.HValueVariation > 0, Math.Min(tl.HValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.HValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_Mechanical As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_Mechanical - Get - '=IF(IF(C53="mechanical",'TECH LIST INPUT'!R92,0)>0,MIN(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),C43),MAX(IF(C53="mechanical",'TECH LIST INPUT'!R92,0),-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim result As Double - 'Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim C53 As string = gen.AC_CompressorType - - result = If(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0) > 0, - Math.Min(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), - gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(If(gen.AC_CompressorType.ToLower() = "mechanical", tl.CValueVariation, 0), - -gen.BC_MaxPossibleBenefitFromTechnologyList)) - - Return result - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_ElectricalCoolingHeating - Get - '=IF(IF(C53="mechanical",0,'TECH LIST INPUT'!R92)>0,MIN(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),C43),MAX(IF(C53="mechanical",0,'TECH LIST INPUT'!R92),-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - Dim result As Double - - 'Dim TLR92 As Double = tl.CValueVariation 'TECH LIST INPUT'!R92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - 'Dim C53 As string = gen.AC_CompressorType - - result = If(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation) > 0, - Math.Min(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation), - gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(If(gen.AC_CompressorType.ToLower() = "mechanical", 0, tl.CValueVariation), - -gen.BC_MaxPossibleBenefitFromTechnologyList)) - - Return result - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_ElectricalVentilation As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_ElectricalVentilation - Get - '=IF('TECH LIST INPUT'!Q92>0,MIN('TECH LIST INPUT'!Q92,C43),MAX('TECH LIST INPUT'!Q92,-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'Dim TLQ92 As Double = tl.VCValueVariation'TECH LIST INPUT'!Q92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - - Return If(tl.VCValueVariation > 0, - Math.Min(tl.VCValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.VCValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedCoolingW_FuelFiredHeating As Double _ - Implements ISSMCalculate.TechListAdjustedCoolingW_FuelFiredHeating - Get - Return 0 - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_Mechanical As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_Mechanical - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_ElectricalCoolingHeating As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_ElectricalCoolingHeating - Get - Return Nothing - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_ElectricalVentilation As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_ElectricalVentilation - Get - '=IF('TECH LIST INPUT'!P92>0,MIN('TECH LIST INPUT'!P92,C43),MAX('TECH LIST INPUT'!P92,-C43)) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim tl As ISSMTechList = ssmTOOL.TechList - - 'Dim TLP92 As Double = tl.VVValueVariation 'TECH LIST INPUT'!P92 - 'Dim C43 As Double = gen.BC_MaxPossibleBenefitFromTechnologyList - - - Return _ - If _ - (tl.VVValueVariation > 0, Math.Min(tl.VVValueVariation, gen.BC_MaxPossibleBenefitFromTechnologyList), - Math.Max(tl.VVValueVariation, -gen.BC_MaxPossibleBenefitFromTechnologyList)) - End Get - End Property - - Public ReadOnly Property TechListAdjustedVentilationW_FuelFiredHeating As Double _ - Implements ISSMCalculate.TechListAdjustedVentilationW_FuelFiredHeating - Get - Return 0 - End Get - End Property - -#End Region - - 'Provides Diagnostic Information for the user which can be displayed on the form. - 'Based on the inputs generated, can be used to cross reference the Excel Model with the - 'Outputs generated here. - Public Overrides Function ToString() As String - - Dim sb As New StringBuilder() - - sb.AppendLine("") - sb.AppendLine("TechList Detail") - sb.AppendLine("***********************") - - Dim nameLength As Integer = 40 - Dim catLength As Integer = 15 - Dim unitLength As Integer = 15 - Dim firstValuePos As Integer = nameLength + catLength + unitLength + 2 - Dim cat As String - Dim name As String - Dim units As String - - sb.AppendLine(String.Format(Space(firstValuePos) + "H{0}VH{0}VV{0}VC{0}C{0}", vbtab)) - - - For Each line As ITechListBenefitLine In ssmTOOL.TechList.TechLines - - With line - - Dim extraNameSpaces, extraCatSpaces, extraUnitSpaces As Integer - - extraNameSpaces = nameLength - .BenefitName.Length - extraCatSpaces = catLength - .Category.Length - extraUnitSpaces = unitLength - .Units.Length - - cat = line.Category.Substring(0, Math.Min(line.Category.Length, catLength)) + - Space(If(extraCatSpaces < 0, 0, extraCatSpaces)).Replace(" ", ".") - name = line.BenefitName.Substring(0, Math.Min(line.BenefitName.Length, nameLength)) + - Space(If(extraNameSpaces < 0, 0, extraNameSpaces)).Replace(" ", ".") - units = line.Units.Substring(0, Math.Min(line.Units.Length, unitLength)) + - Space(If(extraUnitSpaces < 0, 0, extraUnitSpaces)).Replace(" ", ".") - - sb.AppendLine(String.Format(units + cat + name + " {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbTab, .H().ToString("0.000"), - .VH().ToString("0.000"), .VV().ToString("0.000"), .VC().ToString("0.000"), .C().ToString("0.000"))) - - End With - - Next - - sb.AppendLine("") - sb.AppendLine("TechList Totals") - sb.AppendLine("***********************") - - With ssmTOOL.TechList - - sb.AppendLine(vbTab + vbTab + "H" + vbTab + "VH" + vbTab + "VV" + vbTab + "VC" + vbTab + "C") - sb.AppendLine(String.Format("Base Var % {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbtab, .HValueVariation.ToString("0.000"), - .VHValueVariation.ToString("0.000"), .VVValueVariation.ToString("0.000"), .VCValueVariation.ToString("0.000"), - .CValueVariation.ToString("0.000"))) - sb.AppendLine(String.Format("Base Var KW {0}{1}{0}{2}{0}{3}{0}{4}{0}{5}", vbtab, - .HValueVariationKW.ToString("0.000"), .VHValueVariationKW.ToString("0.000"), - .VVValueVariationKW.ToString("0.000"), .VCValueVariationKW.ToString("0.000"), - .CValueVariationKW.ToString("0.000"))) - - End With - - - 'Runs - sb.AppendLine(Run1.ToString()) - sb.AppendLine(Run2.ToString()) - - 'Staging Calcs - sb.AppendLine("Staging Base Values") - sb.AppendLine("*******************") - sb.AppendLine( - vbTab + vbTab + vbTab + "Mechanical" + vbTab + "Elec Cool/Heat" + vbTab + "Elec Vent" + vbTab + "Fuel Fired Heating") - - sb.AppendLine(String.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - BaseHeatingW_Mechanical.ToString("0.00"), BaseHeatingW_ElectricalCoolingHeating.ToString("0.00"), - BaseHeatingW_ElectricalVentilation.ToString("0.00"), BaseHeatingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - BaseCoolingW_Mechanical.ToString("0.00"), BaseCoolingW_ElectricalCoolingHeating.ToString("0.00"), - BaseCoolingW_ElectricalVentilation.ToString("0.00"), BaseCoolingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - BaseVentilationW_Mechanical.ToString("0.00"), BaseVentilationW_ElectricalCoolingHeating.ToString("0.00"), - BaseVentilationW_ElectricalVentilation.ToString("0.00"), BaseVentilationW_FuelFiredHeating.ToString("0.00"))) - - sb.AppendLine("") - sb.AppendLine("Staging Adjusted Values") - sb.AppendLine("***********************") - - sb.AppendLine(String.Format("Heating {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - TechListAdjustedHeatingW_Mechanical.ToString("0.00"), - TechListAdjustedHeatingW_ElectricalCoolingHeating.ToString("0.00"), - TechListAdjustedHeatingW_ElectricalVentilation.ToString("0.00"), - TechListAdjustedHeatingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Cooling {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - TechListAdjustedCoolingW_Mechanical.ToString("0.00"), - TechListAdjustedCoolingW_ElectricalCoolingHeating.ToString("0.00"), - TechListAdjustedCoolingW_ElectricalVentilation.ToString("0.00"), - TechListAdjustedCoolingW_FuelFiredHeating.ToString("0.00"))) - sb.AppendLine(String.Format("Ventilate {0}{1}{0}{2}{0}{3}{0}{4}", vbTab + vbtab, - TechListAdjustedVentilationW_Mechanical.ToString("0.00"), - TechListAdjustedVentilationW_ElectricalCoolingHeating.ToString("0.00"), - TechListAdjustedVentilationW_ElectricalVentilation.ToString("0.00"), - TechListAdjustedVentilationW_FuelFiredHeating.ToString("0.00"))) - - - Return sb.ToString() - End Function - - Private Function CalculateElectricalWBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, - Solar As Double, Weight As Double) As Double - - 'MIN(SUM(H94),C54*1000)/C59+SUM(I93:I95) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim H94 = BaseCoolingW_ElectricalCoolingHeating - 'Dim C54 = genInputs.AC_CompressorCapacitykW - 'Dim C59 = genInputs.AC_COP - 'Dim I93 = BaseHeatingW_ElectricalVentilation - 'Dim I94 = BaseCoolingW_ElectricalVentilation - 'Dim I95 = BaseVentilationW_ElectricalVentilation - - Dim ElectricalWBaseCurrentResult As Double = - Math.Min(BaseCoolingW_ElectricalCoolingHeating, genInputs.AC_CompressorCapacitykW * 1000) / genInputs.AC_COP + - BaseHeatingW_ElectricalVentilation + BaseCoolingW_ElectricalVentilation + BaseVentilationW_ElectricalVentilation - - Return ElectricalWBaseCurrentResult * Weight - End Function - - Private Function CalculateMechanicalWBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, - Solar As Double, Weight As Double) As Double - - '=MIN(F94,C54*1000)/C59 - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim F94 = BaseCoolingW_Mechanical - 'Dim C54 = genInputs.AC_CompressorCapacitykW - 'Dim C59 = genInputs.AC_COP - - Dim MechanicalWBaseCurrentResult As Double = - Math.Min(BaseCoolingW_Mechanical, genInputs.AC_CompressorCapacitykW * 1000) / genInputs.AC_COP - - Return MechanicalWBaseCurrentResult * Weight - End Function - - Private Function CalculateFuelLPerHBase(genInputs As ISSMGenInputs, EnviromentalTemperature As Double, Solar As Double, - Weight As Double) As Double - - '=(MIN(ABS(J93/1000),C71)/C37)*(1/(C39*C38)) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim J93 = BaseHeatingW_FuelFiredHeating - 'Dim C71 = genInputs.AH_FuelFiredHeaterkW - 'Dim C37 = genInputs.BC_AuxHeaterEfficiency - 'Dim C39 = ssmTOOL.HVACConstants.FuelDensity - 'Dim C38 = genInputs.BC_GCVDieselOrHeatingOil - - Dim FuelLPerHBaseCurrentResult As Double = - (Math.Min(Math.Abs(BaseHeatingW_FuelFiredHeating / 1000), genInputs.AH_FuelFiredHeaterkW) / - genInputs.BC_AuxHeaterEfficiency) * - (1 / (genInputs.BC_GCVDieselOrHeatingOil * ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)) - - Return FuelLPerHBaseCurrentResult * Weight - End Function - - Private Function CalculateElectricalWAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, - EnviromentalTemperature As Double, Solar As Double, Weight As Double) As Double - - '=(MIN((H94*(1-H100)),C54*1000)/C59)+(I93*(1-I99))+(I94*(1-I100))+(I95*(1-I101)) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - Dim H94 As Double = BaseCoolingW_ElectricalCoolingHeating - Dim H100 As Double = TechListAdjustedCoolingW_ElectricalCoolingHeating - Dim C54 As Double = genInputs.AC_CompressorCapacitykW - Dim C59 As Double = genInputs.AC_COP - - Dim I93 As Double = BaseHeatingW_ElectricalVentilation - Dim I94 As Double = BaseCoolingW_ElectricalVentilation - Dim I95 As Double = BaseVentilationW_ElectricalVentilation - Dim I99 As Double = TechListAdjustedHeatingW_ElectricalVentilation - Dim I100 As Double = TechListAdjustedCoolingW_ElectricalVentilation - Dim I101 As Double = TechListAdjustedVentilationW_ElectricalVentilation - - Dim ElectricalWAdjusted As Double = (Math.Min((H94 * (1 - H100)), C54 * 1000) / C59) + (I93 * (1 - I99)) + (I94 * (1 - I100)) + - (I95 * (1 - I101)) - - Return ElectricalWAdjusted * Weight - End Function - - Private Function CalculateMechanicalWBaseAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, - EnviromentalTemperature As Double, Solar As Double, Weight As Double) As Double - - '=(MIN((F94*(1-F100)),C54*1000)/C59) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - Dim F94 As Double = BaseCoolingW_Mechanical - Dim F100 As Double = TechListAdjustedCoolingW_Mechanical - Dim C54 As Double = genInputs.AC_CompressorCapacitykW - Dim C59 As Double = genInputs.AC_COP - - Dim MechanicalWBaseAdjusted As Double = (Math.Min((F94 * (1 - F100)), C54 * 1000) / C59) - - Return MechanicalWBaseAdjusted * Weight - End Function - - Private Function CalculateFuelLPerHBaseAdjusted(genInputs As ISSMGenInputs, tecList As ISSMTechList, - EnviromentalTemperature As Double, Solar As Double, Weight As Double) As Double - - '=MIN(ABS(IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:P90,4),0)/1000),C71)/C37*(1/(C39*C38)) - - genInputs.EC_EnviromentalTemperature = EnviromentalTemperature - genInputs.EC_Solar = Solar - - 'Dim M89 = Run1.TotalW - 'Dim M90 = genInputs.BC_GCVDieselOrHeatingOil - 'Dim C71 = genInputs.AH_FuelFiredHeaterkW - 'Dim C37 = genInputs.BC_AuxHeaterEfficiency - 'Dim C38 = genInputs.BC_GCVDieselOrHeatingOil - 'Dim C39 = ssmTOOL.HVACConstants.FuelDensity - - Dim result As Double = 0 - - If Run1.TotalW < 0 AndAlso Run2.TotalW < 0 Then - result = Math.Abs(If(Run1.TotalW > Run2.TotalW, Run1.TechListAmendedFuelW, Run2.TechListAmendedFuelW) / 1000) - End If - - Dim FuelLPerHBaseAdjusted As Double = Math.Min(result, genInputs.AH_FuelFiredHeaterkW) / - genInputs.BC_AuxHeaterEfficiency * - (1 / (genInputs.BC_GCVDieselOrHeatingOil * ssmTOOL.HVACConstants.FuelDensityAsGramPerLiter)) - - Return FuelLPerHBaseAdjusted * Weight - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMGenInputs.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMGenInputs.vb deleted file mode 100644 index 46f55fe022d97e145d71797805d51862dbb9c3ae..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMGenInputs.vb +++ /dev/null @@ -1,437 +0,0 @@ -Imports System.IO - -Namespace Hvac - 'Used by SSMHVAC Class - Public Class SSMGenInputs - Implements ISSMGenInputs - - Private _EC_EnviromentalConditions_BatchFile As String - Private _EC_EnvironmentalConditionsMap As IEnvironmentalConditionsMap - Private _vectoDir As String - -#Region "Constructors" - - Sub New(Optional initialiseDefaults As Boolean = False, Optional vectoDir As String = "") - - _vectoDir = vectoDir - BP_BusModel = "" - BP_BusFloorType = "" - EC_EnviromentalConditions_BatchFile = "" - AC_CompressorType = "" - VEN_VentilationDuringCooling = "" - VEN_VentilationDuringHeating = "" - VEN_VentilationFlowSettingWhenHeatingAndACInactive = "" - If initialiseDefaults Then SetDefaults() - End Sub - -#End Region - -#Region "Bus Parameterisation" - - 'C4/D4 - Public Property BP_BusModel As String Implements ISSMGenInputs.BP_BusModel - - 'C5/D5 - Public Property BP_NumberOfPassengers As Double Implements ISSMGenInputs.BP_NumberOfPassengers - - 'C6/D6 - Public Property BP_BusFloorType As String Implements ISSMGenInputs.BP_BusFloorType - - 'D7/C7 - ( M/2 ) - Public ReadOnly Property BP_BusFloorSurfaceArea As Double Implements ISSMGenInputs.BP_BusFloorSurfaceArea - Get - - '=IF(AND(C6="low floor",C13<=2.55,C13>=2.5),(2.55*(C12-1.2)),((C12-1.2)*C13)) - If BP_BusFloorType = "low floor" AndAlso BP_BusWidth <= 2.55 AndAlso BP_BusWidth >= 2.5 Then - Return Math.Round((2.55 * (BP_BusLength - 1.2)), 6) - Else - Return Math.Round(((BP_BusLength - 1.2) * BP_BusWidth), 6) - End If - End Get - End Property - - 'D8/C8 - ( M/2 ) - Public ReadOnly Property BP_BusSurfaceAreaM2 As Double Implements ISSMGenInputs.BP_BusSurfaceAreaM2 - Get - '2 * (C12*C13 + C12*C14 + C13*C14) - Return 2 * ((BP_BusLength * BP_BusWidth) + (BP_BusLength * BP_BusHeight) + (BP_BusWidth * BP_BusHeight)) - End Get - End Property - - 'D9/C9 - ( M/2 ) - Public ReadOnly Property BP_BusWindowSurface As Double Implements ISSMGenInputs.BP_BusWindowSurface - Get - '=(C40*C12)+C41 - Return (BC_WindowAreaPerUnitBusLength * BP_BusLength) + BC_FrontRearWindowArea - End Get - End Property - - 'C10/D10 - Public Property BP_DoubleDecker As Boolean Implements ISSMGenInputs.BP_DoubleDecker - - 'D11/C11 - ( M/3 ) - Public ReadOnly Property BP_BusVolume As Double Implements ISSMGenInputs.BP_BusVolume - Get - '=(C12*C13*C14) - Return (BP_BusLength * BP_BusWidth * BP_BusHeight) - End Get - End Property - - 'D12/C12 - ( M ) - Public Property BP_BusLength As Double Implements ISSMGenInputs.BP_BusLength - - 'D13/C13 - ( M ) - Public Property BP_BusWidth As Double Implements ISSMGenInputs.BP_BusWidth - - 'D14/C14 - ( M ) - Public Property BP_BusHeight As Double Implements ISSMGenInputs.BP_BusHeight - -#End Region - -#Region "Boundary Conditions" - - 'C17 - Public Property BC_GFactor As Double Implements ISSMGenInputs.BC_GFactor - - 'C18 - Public ReadOnly Property BC_SolarClouding As Double Implements ISSMGenInputs.BC_SolarClouding - Get - '=IF(C46<17,0.65,0.8) - Return If(EC_EnviromentalTemperature < 17, 0.65, 0.8) - End Get - End Property - - 'C19 - ( W ) - Public ReadOnly Property BC_HeatPerPassengerIntoCabinW As Double _ - Implements ISSMGenInputs.BC_HeatPerPassengerIntoCabinW - Get - '=IF(C46<17,50,80) - Return If(EC_EnviromentalTemperature < 17, 50, 80) - End Get - End Property - - 'C20 - ( oC ) - Public Property BC_PassengerBoundaryTemperature As Double Implements ISSMGenInputs.BC_PassengerBoundaryTemperature - - 'C21 - ( Passenger/Metre Squared ) - Public ReadOnly Property BC_PassengerDensityLowFloor As Double Implements ISSMGenInputs.BC_PassengerDensityLowFloor - Get - '=IF($C$10="No",3,3.7) - Return If(BP_DoubleDecker, 3.7, 3) - End Get - End Property - - 'C22 - ( Passenger/Metre Squared ) - Public ReadOnly Property BC_PassengerDensitySemiLowFloor As Double _ - Implements ISSMGenInputs.BC_PassengerDensitySemiLowFloor - Get - '=IF($C$10="No",2.2,3) - Return If(BP_DoubleDecker, 3, 2.2) - End Get - End Property - - 'C23 - ( Passenger/Metre Squared ) - Public ReadOnly Property BC_PassengerDensityRaisedFloor As Double _ - Implements ISSMGenInputs.BC_PassengerDensityRaisedFloor - Get - '=IF($C$10="No",1.4,2) - Return If(BP_DoubleDecker, 2, 1.4) - End Get - End Property - - 'C24 - Public ReadOnly Property BC_CalculatedPassengerNumber As Double Implements ISSMGenInputs.BC_CalculatedPassengerNumber - Get - '=ROUND(IF($D$5<IF(D6="low floor",C21,IF(D6="semi low floor",C22,C23))*D7,$D$5,IF(D6="low floor",C21,IF(D6="semi low floor",C22,C23))*D7),0) - Dim tmp As Double = - If _ - (BP_BusFloorType = "low floor", BC_PassengerDensityLowFloor, - If(BP_BusFloorType = "semi low floor", BC_PassengerDensitySemiLowFloor, BC_PassengerDensityRaisedFloor)) * - BP_BusFloorSurfaceArea - Return Math.Round(If(BP_NumberOfPassengers < tmp, BP_NumberOfPassengers, tmp), 0) - End Get - End Property - - 'C25 - ( W/K/M3 ) - Public ReadOnly Property BC_UValues As Double Implements ISSMGenInputs.BC_UValues - Get - '=IF(D6="low floor",4,IF(D6="semi low floor",3.5,3)) - Return If(BP_BusFloorType = "low floor", 4, If(BP_BusFloorType = "semi low floor", 3.5, 3)) - End Get - End Property - - 'C26 - ( oC ) - Public Property BC_HeatingBoundaryTemperature As Double Implements ISSMGenInputs.BC_HeatingBoundaryTemperature - - 'C27 - ( oC ) - Public Property BC_CoolingBoundaryTemperature As Double Implements ISSMGenInputs.BC_CoolingBoundaryTemperature - - 'C28 - ( oC ) - Public ReadOnly Property BC_TemperatureCoolingTurnsOff As Double _ - Implements ISSMGenInputs.BC_TemperatureCoolingTurnsOff - Get - Return 17 - End Get - End Property - - 'C29 - ( L/H ) - Public Property BC_HighVentilation As Double Implements ISSMGenInputs.BC_HighVentilation - - 'C30 - ( L/H ) - Public Property BC_lowVentilation As Double Implements ISSMGenInputs.BC_lowVentilation - - 'C31 - ( M3/H ) - Public ReadOnly Property BC_High As Double Implements ISSMGenInputs.BC_High - Get - '=D11*C29 - Return BP_BusVolume * BC_HighVentilation - End Get - End Property - - 'C32 - ( M3/H ) - Public ReadOnly Property BC_Low As Double Implements ISSMGenInputs.BC_Low - Get - '=C30*D11 - Return BP_BusVolume * BC_lowVentilation - End Get - End Property - - 'C33 - ( W ) - Public ReadOnly Property BC_HighVentPowerW As Double Implements ISSMGenInputs.BC_HighVentPowerW - Get - '=C31*C35 - Return BC_High * BC_SpecificVentilationPower - End Get - End Property - - 'C34 - ( W ) - Public ReadOnly Property BC_LowVentPowerW As Double Implements ISSMGenInputs.BC_LowVentPowerW - Get - '=C32*C35 - Return BC_Low * BC_SpecificVentilationPower - End Get - End Property - - 'C35 - ( Wh/M3 ) - Public Property BC_SpecificVentilationPower As Double Implements ISSMGenInputs.BC_SpecificVentilationPower - - 'C37 - Public Property BC_AuxHeaterEfficiency As Double Implements ISSMGenInputs.BC_AuxHeaterEfficiency - - 'C38 - ( KW/HKG ) - Public Property BC_GCVDieselOrHeatingOil As Double Implements ISSMGenInputs.BC_GCVDieselOrHeatingOil - - 'C40 - ( M2/M ) - Public ReadOnly Property BC_WindowAreaPerUnitBusLength As Double _ - Implements ISSMGenInputs.BC_WindowAreaPerUnitBusLength - Get - '=IF($C$10="No",1.5,2.5) - Return If(BP_DoubleDecker, 2.5, 1.5) - End Get - End Property - - 'C41 - ( M/2 ) - Public ReadOnly Property BC_FrontRearWindowArea As Double Implements ISSMGenInputs.BC_FrontRearWindowArea - Get - '=IF($C$10="No",5,8) - Return If(BP_DoubleDecker, 8, 5) - End Get - End Property - - 'C42 - ( K ) - Public Property BC_MaxTemperatureDeltaForLowFloorBusses As Double _ - Implements ISSMGenInputs.BC_MaxTemperatureDeltaForLowFloorBusses - - 'C43 - ( Fraction ) - Public Property BC_MaxPossibleBenefitFromTechnologyList As Double _ - Implements ISSMGenInputs.BC_MaxPossibleBenefitFromTechnologyList - -#End Region - -#Region "Environmental Conditions" - - 'C46 - ( oC ) - Public Property EC_EnviromentalTemperature As Double Implements ISSMGenInputs.EC_EnviromentalTemperature - - 'C47 - ( W/M3 ) - Public Property EC_Solar As Double Implements ISSMGenInputs.EC_Solar - - '( EC_EnviromentalTemperature and EC_Solar) (Batch Mode) - Public ReadOnly Property EC_EnvironmentalConditionsMap As IEnvironmentalConditionsMap _ - Implements ISSMGenInputs.EC_EnvironmentalConditionsMap - Get - Return _EC_EnvironmentalConditionsMap - End Get - End Property - - Public Property EC_EnviromentalConditions_BatchFile As String _ - Implements ISSMGenInputs.EC_EnviromentalConditions_BatchFile - Get - Return _EC_EnviromentalConditions_BatchFile - End Get - Set(value As String) - _EC_EnvironmentalConditionsMap = New EnvironmentalConditionsMap(value, _vectoDir) - _EC_EnviromentalConditions_BatchFile = value - End Set - End Property - - Public Property EC_EnviromentalConditions_BatchEnabled As Boolean _ - Implements ISSMGenInputs.EC_EnviromentalConditions_BatchEnabled - -#End Region - -#Region "AC System" - - 'C53 - "Continous/2-stage/3-stage/4-stage - Public Property AC_CompressorType As String Implements ISSMGenInputs.AC_CompressorType - - 'mechanical/electrical - Public ReadOnly Property AC_CompressorTypeDerived As String Implements ISSMGenInputs.AC_CompressorTypeDerived - Get - Return If(AC_CompressorType = "Continuous", "Electrical", "Mechanical") - End Get - End Property - - 'C54 - ( KW ) - Public Property AC_CompressorCapacitykW As Double Implements ISSMGenInputs.AC_CompressorCapacitykW - - 'C59 - Public ReadOnly Property AC_COP As Double Implements ISSMGenInputs.AC_COP - Get - Dim cop As Double = 3.5R - - If (Not AC_CompressorType Is Nothing) Then - cop = If(AC_CompressorType.ToLower = "3-stage", cop * 1.02, cop) - cop = If(AC_CompressorType.ToLower = "4-stage", cop * 1.02, cop) - cop = - If(AC_CompressorType.ToLower = "continuous", If(BP_BusFloorType.ToLower = "low floor", cop * 1.04, cop * 1.06), cop) - End If - - Return Math.Round(cop, 2) - End Get - End Property - -#End Region - -#Region "Ventilation" - - 'C62 - Boolean Yes/No - Public Property VEN_VentilationOnDuringHeating As Boolean Implements ISSMGenInputs.VEN_VentilationOnDuringHeating - - 'C63 - Boolean Yes/No - Property VEN_VentilationWhenBothHeatingAndACInactive As Boolean _ - Implements ISSMGenInputs.VEN_VentilationWhenBothHeatingAndACInactive - - 'C64 - Boolean Yes/No - Public Property VEN_VentilationDuringAC As Boolean Implements ISSMGenInputs.VEN_VentilationDuringAC - - 'C65 - String high/low - Public Property VEN_VentilationFlowSettingWhenHeatingAndACInactive As String _ - Implements ISSMGenInputs.VEN_VentilationFlowSettingWhenHeatingAndACInactive - - 'C66 - String high/low - Property VEN_VentilationDuringHeating As String Implements ISSMGenInputs.VEN_VentilationDuringHeating - - 'C67 - String high/low - Property VEN_VentilationDuringCooling As String Implements ISSMGenInputs.VEN_VentilationDuringCooling - -#End Region - -#Region "AUX Heater" - - 'C70 - ( KW ) - Public Property AH_EngineWasteHeatkW As Double Implements ISSMGenInputs.AH_EngineWasteHeatkW - - 'C71 - ( KW ) - Public Property AH_FuelFiredHeaterkW As Double Implements ISSMGenInputs.AH_FuelFiredHeaterkW - - Public Property AH_FuelEnergyToHeatToCoolant As Double Implements ISSMGenInputs.AH_FuelEnergyToHeatToCoolant - - Public Property AH_CoolantHeatTransferredToAirCabinHeater As Double _ - Implements ISSMGenInputs.AH_CoolantHeatTransferredToAirCabinHeater - -#End Region - -#Region "Default Values" - - Private Sub SetDefaults() - - 'BUS Parameterisation - '******************** - BP_BusModel = "DummyBus" - BP_NumberOfPassengers = 47.0R - BP_BusFloorType = "raised floor" - BP_DoubleDecker = False - BP_BusLength = 10.655R - BP_BusWidth = 2.55R - BP_BusHeight = 2.275R - 'BP_BusFloorSurfaceArea : Calculated - 'BP_BusSurfaceAreaM2 : Calculated - 'BP_BusWindowSurface : Calculated - 'BP_BusVolume : Calculated - - 'BOUNDRY CONDITIONS - '****************** - - BC_GFactor = 0.95R - 'BC_SolarClouding As Double :Calculated - 'BC_HeatPerPassengerIntoCabinW :Calculated - BC_PassengerBoundaryTemperature = 12.0R - 'BC_PassengerDensityLowFloor :Calculated - 'BC_PassengerDensitySemiLowFloor :Calculated - 'BC_PassengerDensityRaisedFloor :Calculated - 'BC_CalculatedPassengerNumber :Calculated - 'BC_UValues :Calculated - BC_HeatingBoundaryTemperature = 18.0R - BC_CoolingBoundaryTemperature = 23.0R - 'BC_CoolingBoundaryTemperature : ReadOnly Static - BC_HighVentilation = 20.0R - BC_lowVentilation = 7.0R - 'BC_High :Calculated - 'BC_Low :Calculated - 'BC_HighVentPowerW :Calculated - 'BC_LowVentPowerW :Calculated - BC_SpecificVentilationPower = 0.56R - 'BC_COP :Calculated - BC_AuxHeaterEfficiency = 0.84R - BC_GCVDieselOrHeatingOil = 11.8R - 'BC_WindowAreaPerUnitBusLength :Calculated - 'BC_FrontRearWindowArea :Calculated - BC_MaxTemperatureDeltaForLowFloorBusses = 3.0R - BC_MaxPossibleBenefitFromTechnologyList = 0.5R - - 'Environmental Conditions - '************************ - EC_EnviromentalTemperature = 25.0R - EC_Solar = 400.0R - EC_EnviromentalConditions_BatchEnabled = True - EC_EnviromentalConditions_BatchFile = "DefaultClimatic.aenv" - - 'AC SYSTEM - '********* - AC_CompressorType = "2-stage" - AC_CompressorCapacitykW = 18.0R - - - 'VENTILATION - '*********** - VEN_VentilationOnDuringHeating = True - VEN_VentilationWhenBothHeatingAndACInactive = True - VEN_VentilationDuringAC = True - VEN_VentilationFlowSettingWhenHeatingAndACInactive = "high" - VEN_VentilationDuringHeating = "high" - VEN_VentilationDuringCooling = "high" - - - 'AUX HEATER - '********** - AH_FuelFiredHeaterkW = 30.0R - AH_FuelEnergyToHeatToCoolant = 0.2 - AH_CoolantHeatTransferredToAirCabinHeater = 0.75 - End Sub - -#End Region - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMRun.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMRun.vb deleted file mode 100644 index 2eb4045fd15954a4843a531388173cd5acc3cc64..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMRun.vb +++ /dev/null @@ -1,218 +0,0 @@ -Imports System.Text -Imports Microsoft.VisualBasic - -Namespace Hvac - -'Used By SSMHVAC Class -Public Class SSMRun - Implements ISSMRun - - - Private ssmTOOL As ISSMTOOL - private runNumber As Integer - - - Sub New(ssm As ISSMTOOL, runNumber As Integer) - - If runNumber <> 1 AndAlso runNumber <> 2 Then Throw New ArgumentException("Run number must be either 1 or 2") - - Me.runNumber = runNumber - ssmTOOL = ssm - - End Sub - - - Public ReadOnly Property HVACOperation As Double Implements ISSMRun.HVACOperation - Get - '=IF(C43>C25,3,IF(C43<C24,1,2)) - 'C43 = EC_Enviromental Temperature - 'C25 = BC_CoolingBoundary Temperature - 'C24 = BC_HeatingBoundaryTemperature - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - Return If(gen.EC_EnviromentalTemperature > gen.BC_CoolingBoundaryTemperature, 3, If(gen.EC_EnviromentalTemperature < gen.BC_HeatingBoundaryTemperature, 1, 2)) - - End Get - - End Property - Public ReadOnly Property TCalc As Double Implements ISSMRun.TCalc - Get - - 'C24 = BC_HeatingBoundaryTemperature - 'C25 = BC_CoolingBoundary Temperature - 'C6 = BP_BusFloorType - 'C43 = EC_Enviromental Temperature - 'C39 = BC_FontAndRearWindowArea - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim returnVal As Double - - If runNumber = 1 Then '=C24 - - returnVal = gen.BC_HeatingBoundaryTemperature - - Else '=IF(C6="low floor",IF((C43-C25)<C39,C25,C43-3),C25) - - returnVal = If(gen.BP_BusFloorType = "low floor", If((gen.EC_EnviromentalTemperature - gen.BC_CoolingBoundaryTemperature) < gen.BC_FrontRearWindowArea, gen.BC_CoolingBoundaryTemperature, gen.EC_EnviromentalTemperature - 3), gen.BC_CoolingBoundaryTemperature) - - End If - - - Return returnVal - - End Get - End Property - Public ReadOnly Property TemperatureDelta As Double Implements ISSMRun.TemperatureDelta - Get - '=C43-F79/F80 - 'C43 = EC_Enviromental Temperature - 'F79/80 = Me.TCalc - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Return gen.EC_EnviromentalTemperature - TCalc - - End Get - End Property - Public ReadOnly Property QWall As Double Implements ISSMRun.QWall - Get - '=I79*D8*C23 or '=I80*D8*C23 - 'Translated to - '=I79*C8*C23 or '=I80*C8*C23 - - 'C23 = BC_UValues - 'C8 = BP_BusSurfaceAreaM2 - 'I78/I80 = Me.TemperatureDelta - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - Return TemperatureDelta * gen.BP_BusSurfaceAreaM2 * gen.BC_UValues - - End Get - End Property - Public ReadOnly Property WattsPerPass As Double Implements ISSMRun.WattsPerPass - Get - - '=IF(D5="",C22,IF(E5="",IF(C22<D5,C22,D5),E5))*C17 - 'Translated to - '=IF(IF(C22<C5,C22,C5))*C17 - 'Simplified to - 'Max( C22,C5 ) - - 'C5 = BP_NumberOfPassengers - 'C22 = BC_Calculated Passenger Number - 'C17 = BC_Heat Per Passenger into cabin - - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - Return Math.Min(gen.BP_NumberOfPassengers, gen.BC_CalculatedPassengerNumber) * gen.BC_HeatPerPassengerIntoCabinW - - - End Get - End Property - Public ReadOnly Property Solar As Double Implements ISSMRun.Solar - Get - '=C44*D9*C15*C16*0.25 - 'Translated to - '=C44*C9*C15*C16*0.25 - - 'C44 = EC_Solar - 'C9 = BP_BusWindowSurfaceArea - 'C15 = BC_GFactor - 'C16 = BC_SolarClouding - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - - Return gen.EC_Solar * gen.BP_BusWindowSurface * gen.BC_GFactor * gen.BC_SolarClouding * 0.25 - - - End Get - End Property - Public ReadOnly Property TotalW As Double Implements ISSMRun.TotalW - Get - - '=SUM(J79:L79) or =SUM(J80:L80) - 'Tanslated to - '=Sum ( Me.Qwall ,Me.WattsPerPass,Me.Solar ) - - Return Me.QWall + Me.WattsPerPass + Me.Solar - - End Get - End Property - Public ReadOnly Property TotalKW As Double Implements ISSMRun.TotalKW - Get - '=M79 or =M80 / (1000) - - Return Me.TotalW / 1000 - - End Get - End Property - Public ReadOnly Property FuelW As Double Implements ISSMRun.FuelW - Get - '=IF(AND(N79<0,N79<(C60*-1)),N79-(C60*-1),0)*1000 - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - - 'Dim N79 as Double = TotalKW - 'Dim C60 As Double = gen.AH_EngineWasteHeatkW - - Return IF((TotalKW<0 AndAlso TotalKW<(gen.AH_EngineWasteHeatkW *-1)), _ - TotalKW-(gen.AH_EngineWasteHeatkW*-1), _ - 0) _ - *1000 - - End Get - End Property - Public ReadOnly Property TechListAmendedFuelW As Double Implements ISSMRun.TechListAmendedFuelW - Get - '=IF(IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000<0,IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000,0) - - Dim gen As ISSMGenInputs = ssmTOOL.GenInputs - Dim TLFFH As Double = ssmTOOL.Calculate.TechListAdjustedHeatingW_FuelFiredHeating - 'Dim C60 As Double = gen.AH_EngineWasteHeatkW - 'Dim N79 As Double = Me.TotalKW - - Return IF( IF(((TotalKW*(1-TLFFH))<0 AndAlso (TotalKW*(1-TLFFH))<(gen.AH_EngineWasteHeatkW*-1)), _ - (TotalKW*(1-TLFFH))-(gen.AH_EngineWasteHeatkW*-1),0)*1000<0, _ - IF(((TotalKW*(1-TLFFH))<0 AndAlso (TotalKW*(1-TLFFH))<(gen.AH_EngineWasteHeatkW*-1)),(TotalKW*(1-TLFFH))-(gen.AH_EngineWasteHeatkW*-1),0)*1000,0) - - End Get - - End Property - - 'Provides Diagnostic Information - 'To be utilised by the User. - Public Overrides Function ToString() As String - - Dim sb As New StringBuilder() - - sb.AppendLine(String.Format("Run : {0}", runNumber)) - sb.AppendLine(String.Format("************************************")) - sb.AppendLine(String.Format("HVAC OP " + vbTab + ": {0}", HVACOperation)) - sb.AppendLine(String.Format("TCALC " + vbTab + ": {0}", TCalc)) - sb.AppendLine(String.Format("Tempurature D " + vbTab + ": {0}", TemperatureDelta)) - sb.AppendLine(String.Format("QWall " + vbTab + ": {0}", QWall)) - sb.AppendLine(String.Format("WattsPerPass " + vbTab + ": {0}", WattsPerPass)) - sb.AppendLine(String.Format("Solar " + vbTab + ": {0}", Solar)) - sb.AppendLine(String.Format("TotalW " + vbTab + ": {0}", TotalW)) - sb.AppendLine(String.Format("TotalKW " + vbTab + ": {0}", TotalKW)) - sb.AppendLine(String.Format("Fuel W " + vbTab + ": {0}", FuelW)) - sb.AppendLine(String.Format("Fuel Tech Adj " + vbTab + ": {0}", TechListAmendedFuelW)) - - - Return sb.ToString() - - - End Function - -End Class - - - -End Namespace - - - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMTOOL.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMTOOL.vb deleted file mode 100644 index e483f29f7bd665a1d4878683ad4cabdddcb26dc1..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMTOOL.vb +++ /dev/null @@ -1,296 +0,0 @@ -Imports Omu.ValueInjecter -Imports VectoAuxiliaries.Hvac -Imports Newtonsoft.Json -Imports System.IO -Imports System.Reflection -Imports System.Text -Imports TUGraz.VectoCommon.Utils - -Namespace Hvac - 'Used by frmHVACTool - 'Replaces Spreadsheet model which does the same calculation - 'Version of which appears on the form title. - Public Class SSMTOOL - Implements ISSMTOOL - - Private filePath As String - Public Property GenInputs As ISSMGenInputs Implements ISSMTOOL.GenInputs - Public Property TechList As ISSMTechList Implements ISSMTOOL.TechList - Public Property Calculate As ISSMCalculate Implements ISSMTOOL.Calculate - Public Property SSMDisabled As Boolean Implements ISSMTOOL.SSMDisabled - Public Property HVACConstants As IHVACConstants Implements ISSMTOOL.HVACConstants - - 'Repeat Warning Flags - Private CompressorCapacityInsufficientWarned As Boolean - Private FuelFiredHeaterInsufficientWarned As Boolean - - 'Base Values - Public ReadOnly Property ElectricalWBase As Double Implements ISSMTOOL.ElectricalWBase - Get - Return If(SSMDisabled, 0, Calculate.ElectricalWBase()) '.SI(Of Watt)() - End Get - End Property - - Public ReadOnly Property MechanicalWBase As Double Implements ISSMTOOL.MechanicalWBase - Get - Return If(SSMDisabled, 0, Calculate.MechanicalWBase) '.SI(Of Watt)() - End Get - End Property - - Public ReadOnly Property FuelPerHBase As Double Implements ISSMTOOL.FuelPerHBase - Get - Return If(SSMDisabled, 0, Calculate.FuelPerHBase()) '.SI(Of LiterPerHour)() - End Get - End Property - - 'Adjusted Values - Public ReadOnly Property ElectricalWAdjusted As Double Implements ISSMTOOL.ElectricalWAdjusted - Get - Return If(SSMDisabled, 0, Calculate.ElectricalWAdjusted()) '.SI(Of Watt)() - End Get - End Property - - Public ReadOnly Property MechanicalWBaseAdjusted As Double Implements ISSMTOOL.MechanicalWBaseAdjusted - Get - Dim mechAdjusted As Double = If(SSMDisabled, 0, Calculate.MechanicalWBaseAdjusted()) - - If _ - CompressorCapacityInsufficientWarned = False AndAlso - (mechAdjusted) / (1000 * GenInputs.AC_COP) > GenInputs.AC_CompressorCapacitykW Then - - OnMessage(Me, - "HVAC SSM :AC-Compressor Capacity unable to service cooling, run continues as if capacity was sufficient.", - AdvancedAuxiliaryMessageType.Warning) - CompressorCapacityInsufficientWarned = True - - End If - - - Return mechAdjusted ' .SI(Of Watt)() - End Get - End Property - - Public ReadOnly Property FuelPerHBaseAdjusted As Double Implements ISSMTOOL.FuelPerHBaseAdjusted - Get - Return If(SSMDisabled, 0, Calculate.FuelPerHBaseAdjusted()) ' .SI(Of LiterPerHour)() - End Get - End Property - - 'Constructors - Sub New(filePath As String, hvacConstants As HVACConstants, Optional isDisabled As Boolean = False, - Optional useTestValues As Boolean = False) - - Me.filePath = filePath - Me.SSMDisabled = isDisabled - Me.HVACConstants = hvacConstants - - GenInputs = New SSMGenInputs(useTestValues, fPATH(filePath)) - TechList = New SSMTechList(filePath, GenInputs, useTestValues) - - Calculate = New SSMCalculate(Me) - End Sub - - 'Clone values from another object of same type - Public Sub Clone(from As ISSMTOOL) Implements ISSMTOOL.Clone - - Dim feedback As String = String.Empty - - GenInputs.InjectFrom(DirectCast(from, SSMTOOL).GenInputs) - - TechList.Clear() - - For Each line As TechListBenefitLine In DirectCast(from, SSMTOOL).TechList.TechLines - - Dim newLine As New TechListBenefitLine(Me.GenInputs) - 'newLine.InjectFrom() - newLine.InjectFrom(line) - TechList.Add(newLine, feedback) - - Next - End Sub - - 'Persistance Functions - Public Function Save(filePath As String) As Boolean Implements ISSMTOOL.Save - - - 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 - - 'Nothing to do except return false. - returnValue = False - - End Try - - Return returnValue - End Function - - Public Function Load(filePath As String) As Boolean Implements ISSMTOOL.Load - - Dim returnValue As Boolean = True - Dim settings As JsonSerializerSettings = New JsonSerializerSettings() - Dim tmpAux As SSMTOOL ' = New SSMTOOL(filePath, HVACConstants) - - settings.TypeNameHandling = TypeNameHandling.Objects - - 'JSON METHOD - Try - - Dim output As String = File.ReadAllText(filePath) - - - tmpAux = JsonConvert.DeserializeObject(Of SSMTOOL)(output, settings) - - tmpAux.TechList.SetSSMGeneralInputs(tmpAux.GenInputs) - - For Each tll As TechListBenefitLine In tmpAux.TechList.TechLines - - tll.inputSheet = tmpAux.GenInputs - - Next - - - 'This is where we Assume values of loaded( Deserialized ) object. - Clone(tmpAux) - - Catch ex As Exception - - 'Nothing to do except return false. - - returnValue = False - End Try - - Return returnValue - End Function - - 'Comparison - Public Function IsEqualTo(source As ISSMTOOL) As Boolean Implements ISSMTOOL.IsEqualTo - - 'In this methods we only want to compare the non Static , non readonly public properties of - 'The class's General, User Inputs and Tech Benefit members. - - Return compareGenUserInputs(source) AndAlso compareTechListBenefitLines(source) - End Function - - Private Function compareGenUserInputs(source As ISSMTOOL) As Boolean - - Dim src As SSMTOOL = DirectCast(source, SSMTOOL) - - Dim returnValue As Boolean = True - - Dim properties As PropertyInfo() = Me.GenInputs.GetType.GetProperties - - For Each prop As PropertyInfo In properties - - 'If Not prop.GetAccessors.IsReadOnly Then - If prop.CanWrite Then - If Not prop.GetValue(Me.GenInputs, Nothing).Equals(prop.GetValue(src.GenInputs, Nothing)) Then - returnValue = False - End If - - End If - - Next - - Return returnValue - End Function - - Private Function compareTechListBenefitLines(source As ISSMTOOL) As Boolean - - - Dim src As SSMTOOL = DirectCast(source, SSMTOOL) - - 'Equal numbers of lines check - If Me.TechList.TechLines.Count <> src.TechList.TechLines.Count Then Return False - - For Each tl As ITechListBenefitLine In _ - Me.TechList.TechLines.OrderBy(Function(o) o.Category).ThenBy(Function(n) n.BenefitName) - - 'First Check line exists in other - If _ - src.TechList.TechLines.Where(Function(w) w.BenefitName = tl.BenefitName AndAlso w.Category = tl.Category).Count <> - 1 Then - - Return False - Else - - 'check are equal - - Dim testLine As ITechListBenefitLine = - src.TechList.TechLines.First(Function(w) w.BenefitName = tl.BenefitName AndAlso w.Category = tl.Category) - - If Not testLine.IsEqualTo(tl) Then - Return False - End If - - End If - - - Next - - 'All Looks OK - Return True - End Function - - 'Overrides - Public Overrides Function ToString() As String - - - Dim sb As New StringBuilder - - sb.AppendLine(Calculate.ToString()) - - - Return sb.ToString() - End Function - - 'Dynamicly Get Fuel having re-adjusted Engine Heat Waste, this was originally supposed to be Solid State. Late adjustment request 24/3/2015 - Public Function FuelPerHBaseAsjusted(AverageUseableEngineWasteHeatKW As Double) As Double _ - Implements ISSMTOOL.FuelPerHBaseAsjusted - - If SSMDisabled Then - Return 0 - End If - - 'Set Engine Waste Heat - GenInputs.AH_EngineWasteHeatkW = AverageUseableEngineWasteHeatKW - Dim fba As Double = FuelPerHBaseAdjusted - - 'Dim FuelFiredWarning As Boolean = fba * GenInputs.BC_AuxHeaterEfficiency * HVACConstants.FuelDensity * GenInputs.BC_GCVDieselOrHeatingOil * 1000 > (AverageUseableEngineWasteHeatKW + GenInputs.AH_FuelFiredHeaterkW) - - 'If Not FuelFiredHeaterInsufficientWarned AndAlso FuelFiredWarning Then - - ' FuelFiredHeaterInsufficientWarned = True - - ' OnMessage(Me, " HVAC SSM : Fuel fired heater insufficient for heating requirements, run continues assuming it was sufficient.", AdvancedAuxiliaryMessageType.Warning) - - 'End If - - Return fba - End Function - - 'Events - Public Event Message(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements ISSMTOOL.Message - - 'Raise Message Event. - Private Sub OnMessage(sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) - - - If Not message Is Nothing Then - - RaiseEvent Message(Me, message, messageType) - - End If - End Sub - End Class -End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMTechList.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMTechList.vb deleted file mode 100644 index 45dd0d5736d7d3e3ff208dd0266f215d9f0b60ae..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMTechList.vb +++ /dev/null @@ -1,530 +0,0 @@ -Imports System.Globalization -Imports System.IO -Imports TUGraz.VectoCommon.Utils - -Namespace Hvac - 'Used By SSMTOOL Class. - Public Class SSMTechList - Implements ISSMTechList - - 'Private Fields - Private filePath As String - Private _ssmInputs As ISSMGenInputs - Private _dirty As Boolean - - Public Property TechLines As List(Of ITechListBenefitLine) Implements ISSMTechList.TechLines - - 'Constructors - Public Sub New(filepath As String, genInputs As ISSMGenInputs, Optional initialiseDefaults As Boolean = False) - - Me.TechLines = New List(Of ITechListBenefitLine) - - Me.filePath = filepath - - Me._ssmInputs = genInputs - - If initialiseDefaults Then SetDefaults() - End Sub - - - Public Sub SetSSMGeneralInputs(genInputs As ISSMGenInputs) Implements ISSMTechList.SetSSMGeneralInputs - - _ssmInputs = genInputs - End Sub - - 'Initialisation Methods - Public Function Initialise(filePath As String) As Boolean Implements ISSMTechList.Initialise - - Me.filePath = filePath - - Return Initialise() - End Function - - Public Function Initialise() As Boolean Implements ISSMTechList.Initialise - - - Dim returnStatus As Boolean = True - - 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() < 1) Then - Return False - End If - - 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() {","c}, StringSplitOptions.RemoveEmptyEntries) - '3 entries per line required - If (elements.Length <> 17) Then - Throw New ArgumentException("Incorrect number of values in csv file") - End If - 'add values to map - - ' 00. Category, - ' 01. BenefitName, - ' 02. Units, - ' 03. LowH, - ' 04. LowV, - ' 05. LowC, - ' 06. SemiLowH, - ' 07. SemiLowV, - ' 08. SemiLowC, - ' 09. RaisedH, - ' 10. RaisedV, - ' 11. RaisedC, - ' 12. OnVehicle, - ' 13. LineType, - ' 14. AvtiveVH, - ' 15. ActiveVV, - ' 16. ActiveVC - - - 'Bus - Try - - - Dim tbline As New TechListBenefitLine(_ssmInputs, - elements(2), - elements(0), - elements(1), - Double.Parse(elements(3), CultureInfo.InvariantCulture), - Double.Parse(elements(4), CultureInfo.InvariantCulture), - Double.Parse(elements(5), CultureInfo.InvariantCulture), - Double.Parse(elements(6), CultureInfo.InvariantCulture), - Double.Parse(elements(7), CultureInfo.InvariantCulture), - Double.Parse(elements(8), CultureInfo.InvariantCulture), - Double.Parse(elements(9), CultureInfo.InvariantCulture), - Double.Parse(elements(10), CultureInfo.InvariantCulture), - Double.Parse(elements(11), CultureInfo.InvariantCulture), - Boolean.Parse(elements(12)), - elements(13).ParseEnum(Of TechLineType)(), - Boolean.Parse(elements(14)), - Boolean.Parse(elements(15)), - Boolean.Parse(elements(16))) - - TechLines.Add(tbline) - - Catch ex As Exception - - 'Indicate problems - returnStatus = False - - End Try - - - Else - firstline = False - End If - Next line - End Using - - Else - returnStatus = False - End If - - Return returnStatus - End Function - - 'Public Properties - Outputs Of Class - Public ReadOnly Property CValueVariation As Double Implements ISSMTechList.CValueVariation - Get - Dim a As Double - - a = TechLines.Where(Function(x) x.Units.ToLower = "fraction").Sum(Function(s) s.C()) - - Return a - End Get - End Property - - Public ReadOnly Property CValueVariationKW As Double Implements ISSMTechList.CValueVariationKW - Get - - Dim a As Double - - a = TechLines.Where(Function(x) x.Units.ToLower = "kw").Sum(Function(s) s.C()) - - Return a - End Get - End Property - - Public ReadOnly Property HValueVariation As Double Implements ISSMTechList.HValueVariation - Get - - 'Dim a,b As double - Return TechLines.Where(Function(x) x.Units = "fraction").Sum(Function(s) s.H()) - ' a = - ' b = HValueVariationKW - ' Return a-b - End Get - End Property - - Public ReadOnly Property HValueVariationKW As Double Implements ISSMTechList.HValueVariationKW - Get - Return TechLines.Where(Function(x) x.Units.ToLower = "kw").Sum(Function(s) s.H()) - End Get - End Property - - Public ReadOnly Property VCValueVariation As Double Implements ISSMTechList.VCValueVariation - Get - Return TechLines.Where(Function(x) x.Units.ToLower = "fraction").Sum(Function(s) s.VC()) '- VCValueVariationKW - End Get - End Property - - Public ReadOnly Property VCValueVariationKW As Double Implements ISSMTechList.VCValueVariationKW - Get - Return TechLines.Where(Function(x) x.Units.ToLower = "kw").Sum(Function(s) s.VC()) - End Get - End Property - - Public ReadOnly Property VHValueVariation As Double Implements ISSMTechList.VHValueVariation - Get - 'Dim a,b As double - - Return TechLines.Where(Function(x) x.Units.ToLower = "fraction").Sum(Function(s) s.VH()) - 'a=TechLines.Where( Function(x) x.Units="fraction").Sum( Function(s) s.VH) - 'b=VHValueVariationKW - ' Return a-b - End Get - End Property - - Public ReadOnly Property VHValueVariationKW As Double Implements ISSMTechList.VHValueVariationKW - Get - Return TechLines.Where(Function(x) x.Units.ToLower = "kw").Sum(Function(s) s.VH()) - End Get - End Property - - Public ReadOnly Property VVValueVariation As Double Implements ISSMTechList.VVValueVariation - Get - Return TechLines.Where(Function(x) x.Units.ToLower = "fraction").Sum(Function(s) s.VV()) - End Get - End Property - - Public ReadOnly Property VVValueVariationKW As Double Implements ISSMTechList.VVValueVariationKW - Get - Return TechLines.Where(Function(x) x.Units.ToLower = "kw").Sum(Function(s) s.VV()) ' - VVValueVariationKW - End Get - End Property - - 'Member Management - Public Function Add(item As ITechListBenefitLine, ByRef feedback As String) As Boolean Implements ISSMTechList.Add - - Dim initialCount As Integer = TechLines.Count - - If TechLines.Where(Function(w) w.Category = item.Category AndAlso w.BenefitName = item.BenefitName).Count() > 0 Then - 'Failure - feedback = "Item already exists." - Return False - End If - - - Try - - TechLines.Add(item) - - If TechLines.Count = initialCount + 1 Then - - 'Success - feedback = "OK" - _dirty = True - Return True - - Else - - 'Failure - feedback = "The system was unable to add the new tech benefit list item." - Return False - - End If - - Catch ex As Exception - - feedback = "The system threw an exception and was unable to add the new tech benefit list item." - Return False - - End Try - End Function - - Public Sub Clear() Implements ISSMTechList.Clear - - If TechLines.Count > 0 Then _dirty = True - - TechLines.Clear() - End Sub - - Public Function Delete(item As ITechListBenefitLine, ByRef feedback As String) As Boolean _ - Implements ISSMTechList.Delete - - Dim currentCount As Integer = TechLines.Count - - If (TechLines.Where(Function(c) c.Category = item.Category AndAlso c.BenefitName = item.BenefitName).Count = 1) Then - - Try - TechLines.RemoveAt( - TechLines.FindIndex(Function(c) c.Category = item.Category AndAlso c.BenefitName = item.BenefitName)) - - If TechLines.Count = currentCount - 1 Then - 'This succeeded - _dirty = True - Return True - Else - 'No Exception, but this failed for some reason. - feedback = "The system was unable to remove the item from the list." - Return False - - End If - - Catch ex As Exception - - feedback = "An exception occured, the removal failed." - Return False - - End Try - - - Else - - feedback = "the item was not found in the list." - Return False - - End If - End Function - - Public Function Modify(originalItem As ITechListBenefitLine, newItem As ITechListBenefitLine, ByRef feedback As String) _ - As Boolean Implements ISSMTechList.Modify - - Dim fi As ITechListBenefitLine = - TechLines.Find(Function(f) (f.Category = originalItem.Category) AndAlso f.BenefitName = originalItem.BenefitName) - Dim originalUnits As String = fi.Units - - If (Not fi Is Nothing) Then - - Try - - fi.CloneFrom(newItem) - - 'The lines below are to assist in testing. The KW units are being excluded, but for benchmarking against the spreadsheet model - 'Two KW entries are left in. There is no provision for adding KW units in so we check if the original entry was KW and - 'force it back to KW if it was already so. There shoud be no need to remove this as newly created lists will not match this - 'Phenomenon. - If (originalUnits.ToLower = "kw") Then - fi.Units = originalUnits - newItem.Units = originalUnits - End If - - If newItem Is fi Then - 'This succeeded - _dirty = True - Return True - Else - 'No Exception, but this failed for some reason. - feedback = "The system was unable to remove the item from the list." - Return False - - End If - - Catch ex As Exception - - feedback = "An exception occured, the update failed." - Return False - - End Try - - - Else - - feedback = "the item was not found so cannot be modified." - Return False - - End If - End Function - -#Region "Default Values" - - Private Sub SetDefaults() - - Dim techLine1 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine1 - .Category = "Cooling" - .BenefitName = "Separate air distribution ducts" - .LowFloorH = 0 - .LowFloorC = 0.04 - .LowFloorV = 0.04 - .SemiLowFloorH = 0 - .SemiLowFloorC = 0.04 - .SemiLowFloorV = 0.04 - .RaisedFloorH = 0 - .RaisedFloorC = 0.04 - .RaisedFloorV = 0.04 - .ActiveVH = False - .ActiveVV = False - .ActiveVC = True - .OnVehicle = False - .Units = "fraction" - End With - - Dim techLine2 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine2 - .Category = "Heating" - .BenefitName = "Adjustable auxiliary heater" - .LowFloorH = 0.02 - .LowFloorC = 0 - .LowFloorV = 0.02 - .SemiLowFloorH = 0.02 - .SemiLowFloorC = 0 - .SemiLowFloorV = 0.02 - .RaisedFloorH = 0.02 - .RaisedFloorC = 0 - .RaisedFloorV = 0.02 - .ActiveVH = True - .ActiveVV = False - .ActiveVC = False - .OnVehicle = False - .Units = "fraction" - End With - - Dim techLine3 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine3 - .Category = "Heating" - .BenefitName = "Adjustable coolant thermostat" - .LowFloorH = 0.02 - .LowFloorC = 0 - .LowFloorV = 0.02 - .SemiLowFloorH = 0.02 - .SemiLowFloorC = 0 - .SemiLowFloorV = 0.02 - .RaisedFloorH = 0.02 - .RaisedFloorC = 0 - .RaisedFloorV = 0.02 - .ActiveVH = True - .ActiveVV = False - .ActiveVC = False - .OnVehicle = False - .Units = "fraction" - End With - - Dim techLine4 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine4 - .Category = "Heating" - .BenefitName = "Engine waste gas heat exchanger" - .LowFloorH = 0.04 - .LowFloorC = 0 - .LowFloorV = 0.04 - .SemiLowFloorH = 0 - .SemiLowFloorC = 0 - .SemiLowFloorV = 0 - .RaisedFloorH = 0 - .RaisedFloorC = 0 - .RaisedFloorV = 0 - .ActiveVH = True - .ActiveVV = False - .ActiveVC = False - .OnVehicle = False - .Units = "fraction" - End With - - Dim techLine5 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine5 - .Category = "Heating" - .BenefitName = "Heat pump systems" - .LowFloorH = 0.06 - .LowFloorC = 0 - .LowFloorV = 0.06 - .SemiLowFloorH = 0.04 - .SemiLowFloorC = 0 - .SemiLowFloorV = 0.04 - .RaisedFloorH = 0.04 - .RaisedFloorC = 0 - .RaisedFloorV = 0.04 - .ActiveVH = True - .ActiveVV = False - .ActiveVC = False - .OnVehicle = False - .Units = "fraction" - End With - - Dim techLine6 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine6 - .Category = "Insulation" - .BenefitName = "Double-glazing" - .LowFloorH = 0.04 - .LowFloorC = 0.04 - .LowFloorV = 0.04 - .SemiLowFloorH = 0.04 - .SemiLowFloorC = 0.04 - .SemiLowFloorV = 0.04 - .RaisedFloorH = 0.04 - .RaisedFloorC = 0.04 - .RaisedFloorV = 0.04 - .ActiveVH = True - .ActiveVV = True - .ActiveVC = True - .OnVehicle = False - .Units = "fraction" - End With - - Dim techLine7 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine7 - .Category = "Insulation" - .BenefitName = "Tinted windows" - .LowFloorH = 0 - .LowFloorC = 0 - .LowFloorV = 0 - .SemiLowFloorH = 0 - .SemiLowFloorC = 0 - .SemiLowFloorV = 0 - .RaisedFloorH = 0 - .RaisedFloorC = 0 - .RaisedFloorV = 0 - .ActiveVH = False - .ActiveVV = False - .ActiveVC = False - .OnVehicle = False - .Units = "fraction" - End With - - Dim techLine8 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) - With techLine8 - .Category = "Ventilation" - .BenefitName = "Fan control strategy (serial/parallel)" - .LowFloorH = 0.02 - .LowFloorC = 0.02 - .LowFloorV = 0.02 - .SemiLowFloorH = 0.02 - .SemiLowFloorC = 0.02 - .SemiLowFloorV = 0.02 - .RaisedFloorH = 0.02 - .RaisedFloorC = 0.02 - .RaisedFloorV = 0.02 - .ActiveVH = True - .ActiveVV = True - .ActiveVC = True - .OnVehicle = False - .Units = "fraction" - .LineType = TechLineType.HVCActiveSelection - End With - - Dim feedback As String = String.Empty - Add(techLine1, feedback) - Add(techLine2, feedback) - Add(techLine3, feedback) - Add(techLine4, feedback) - Add(techLine5, feedback) - Add(techLine6, feedback) - Add(techLine7, feedback) - Add(techLine8, feedback) - End Sub - -#End Region - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Hvac/TechListBenefitLine.vb b/VECTOAux/VectoAuxiliaries/Hvac/TechListBenefitLine.vb deleted file mode 100644 index e4748490caf0edbd26ad65fd42330978c95c5b36..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Hvac/TechListBenefitLine.vb +++ /dev/null @@ -1,310 +0,0 @@ - -Namespace Hvac - Public Enum TechLineType - - Normal - HVCActiveSelection - End Enum - - Public Enum PowerType - - Mechanical - Electrical - End Enum - - 'Used by SSMTOOL Class, refer to original spreadsheet model - 'Or PDF Model Document which articulates the same spreadsheet functionality - 'But within the context of the Vecto interpretation of the same. - Public Class TechListBenefitLine - Implements ITechListBenefitLine - - Private _h, _vh, _vv, _vc, _c As Single - Public inputSheet As ISSMGenInputs - - Public Property Units As String Implements ITechListBenefitLine.Units - Public Property Category As String Implements ITechListBenefitLine.Category - Public Property BenefitName As String Implements ITechListBenefitLine.BenefitName - Public Property LowFloorH As New Double Implements ITechListBenefitLine.LowFloorH - Public Property LowFloorV As New Double Implements ITechListBenefitLine.LowFloorV - Public Property LowFloorC As New Double Implements ITechListBenefitLine.LowFloorC - - Public Property SemiLowFloorH As New Double Implements ITechListBenefitLine.SemiLowFloorH - Public Property SemiLowFloorV As New Double Implements ITechListBenefitLine.SemiLowFloorV - Public Property SemiLowFloorC As New Double Implements ITechListBenefitLine.SemiLowFloorC - - Public Property RaisedFloorH As New Double Implements ITechListBenefitLine.RaisedFloorH - Public Property RaisedFloorV As New Double Implements ITechListBenefitLine.RaisedFloorV - Public Property RaisedFloorC As New Double Implements ITechListBenefitLine.RaisedFloorC - - Public Property OnVehicle As Boolean Implements ITechListBenefitLine.OnVehicle - Public Property ActiveVH As Boolean Implements ITechListBenefitLine.ActiveVH - Public Property ActiveVV As Boolean Implements ITechListBenefitLine.ActiveVV - Public Property ActiveVC As Boolean Implements ITechListBenefitLine.ActiveVC - Public Property LineType As TechLineType Implements ITechListBenefitLine.LineType - - Public ReadOnly Property H As Double Implements ITechListBenefitLine.H - Get - - Dim returnValue As Double = 0 - - '=IF($M49=0,0,IF(AND($M49=1,'INPUT & RESULTS SHEET'!$D$6="low floor"),'TECH LIST INPUT'!D49, IF(AND($M49=1,'INPUT & RESULTS SHEET'!$D$6="semi low floor"),'TECH LIST INPUT'!G49,'TECH LIST INPUT'!J49))) - If Not OnVehicle Then Return returnValue - - Select Case inputSheet.BP_BusFloorType - Case "low floor" - returnValue = LowFloorH - Case "semi low floor" - returnValue = SemiLowFloorH - Case "raised floor" - returnValue = RaisedFloorH - End Select - - Return returnValue - End Get - End Property - - Public ReadOnly Property VH As Double Implements ITechListBenefitLine.VH - Get - - Dim floorValue As Double = 0 - - If Not OnVehicle Then Return floorValue - - 'Get floor value - Select Case inputSheet.BP_BusFloorType - Case "low floor" - floorValue = LowFloorV - Case "semi low floor" - floorValue = SemiLowFloorV - Case "raised floor" - floorValue = RaisedFloorV - End Select - - - 'Active - If ActiveVH Then ' TechLineType.HVCActiveSelection AndAlso - Return floorValue - Else - Return 0 - End If - End Get - End Property - - Public ReadOnly Property VV As Double Implements ITechListBenefitLine.VV - Get - - Dim floorValue As Double = 0 - - If Not OnVehicle Then Return floorValue - - 'Get floor value - Select Case inputSheet.BP_BusFloorType - Case "low floor" - floorValue = LowFloorV - Case "semi low floor" - floorValue = SemiLowFloorV - Case "raised floor" - floorValue = RaisedFloorV - End Select - - - 'Active - If ActiveVV Then ' TechLineType.HVCActiveSelection AndAlso - Return floorValue - Else - Return 0 - End If - End Get - End Property - - Public ReadOnly Property VC As Double Implements ITechListBenefitLine.VC - Get - - Dim floorValue As Double = 0 - - If Not OnVehicle Then Return floorValue - - 'Get floor value - Select Case inputSheet.BP_BusFloorType - Case "low floor" - floorValue = LowFloorV - Case "semi low floor" - floorValue = SemiLowFloorV - Case "raised floor" - floorValue = RaisedFloorV - End Select - - - 'Active - If ActiveVC Then ' TechLineType.HVCActiveSelection AndAlso - Return floorValue - Else - Return 0 - End If - End Get - End Property - - Public ReadOnly Property C As Double Implements ITechListBenefitLine.C - Get - - Dim returnValue As Double = 0 - - - If Not OnVehicle Then Return returnValue - - Select Case inputSheet.BP_BusFloorType - Case "low floor" - returnValue = LowFloorC - Case "semi low floor" - returnValue = SemiLowFloorC - Case "raised floor" - returnValue = RaisedFloorC - End Select - - Return returnValue - End Get - End Property - - Sub New() - End Sub - - Sub New(geninputs As ISSMGenInputs) - - Me.inputSheet = geninputs - End Sub - - Sub New(geninputs As ISSMGenInputs, - units As String, - category As String, - benefitName As String, - lowFloorH As Double, - lowFloorV As Double, - lowFloorC As Double, - semiLowFloorH As Double, - semiLowFloorV As Double, - semiLowFloorC As Double, - raisedFloorH As Double, - raisedFloorV As Double, - raisedFloorC As Double, - onVehicle As Boolean, - lineType As TechLineType, - activeVH As Boolean, - activeVV As Boolean, - activeVC As Boolean - ) - - Me.inputSheet = geninputs - Me.Units = Units - Me.category = category - Me.benefitName = benefitName - Me.lowFloorH = lowFloorH - Me.lowFloorV = lowFloorV - Me.lowFloorC = lowFloorC - Me.semiLowFloorH = semiLowFloorH - Me.semiLowFloorV = semiLowFloorV - Me.semiLowFloorC = semiLowFloorC - Me.raisedFloorH = raisedFloorH - Me.raisedFloorV = raisedFloorV - Me.raisedFloorC = raisedFloorC - Me.OnVehicle = onVehicle - Me.lineType = lineType - Me.ActiveVH = activeVH - Me.ActiveVV = activeVV - Me.ActiveVC = activeVC - End Sub - - 'Operator Overloads - Public Shared Operator =(ByVal op1 As TechListBenefitLine, ByVal op2 As TechListBenefitLine) As Boolean - - If (op1.Category = op2.Category AndAlso - op1.BenefitName = op2.BenefitName AndAlso - op1.ActiveVC = op2.ActiveVC AndAlso - op1.ActiveVH = op2.ActiveVH AndAlso - op1.ActiveVV = op2.ActiveVV AndAlso - op1.LineType = op2.LineType AndAlso - op1.LowFloorC = op2.LowFloorC AndAlso - op1.LowFloorV = op2.LowFloorV AndAlso - op1.LowFloorH = op2.LowFloorH AndAlso - op1.SemiLowFloorC = op2.SemiLowFloorC AndAlso - op1.SemiLowFloorH = op2.SemiLowFloorH AndAlso - op1.SemiLowFloorV = op2.SemiLowFloorV AndAlso - op1.RaisedFloorC = op2.RaisedFloorC AndAlso - op1.RaisedFloorH = op2.RaisedFloorH AndAlso - op1.RaisedFloorV = op2.RaisedFloorV AndAlso - op1.OnVehicle = op2.OnVehicle AndAlso - op1.Units = op2.Units) Then - - Return True - - Else - - Return False - - End If - End Operator - - Public Shared Operator <>(ByVal op1 As TechListBenefitLine, ByVal op2 As TechListBenefitLine) As Boolean - - If (op1.Category <> op2.Category OrElse - op1.BenefitName <> op2.BenefitName OrElse - op1.ActiveVC <> op2.ActiveVC OrElse - op1.ActiveVH <> op2.ActiveVH OrElse - op1.ActiveVV <> op2.ActiveVV OrElse - op1.LineType <> op2.LineType OrElse - op1.LowFloorC <> op2.LowFloorC OrElse - op1.LowFloorV <> op2.LowFloorV OrElse - op1.LowFloorH <> op2.LowFloorH OrElse - op1.SemiLowFloorC <> op2.SemiLowFloorC OrElse - op1.SemiLowFloorH <> op2.SemiLowFloorH OrElse - op1.SemiLowFloorV <> op2.SemiLowFloorV OrElse - op1.RaisedFloorC <> op2.RaisedFloorC OrElse - op1.RaisedFloorH <> op2.RaisedFloorH OrElse - op1.RaisedFloorV <> op2.RaisedFloorV OrElse - op1.OnVehicle <> op2.OnVehicle OrElse - op1.Units <> op2.Units) Then - - Return True - - Else - - Return False - - End If - End Operator - - Public Sub CloneFrom(source As ITechListBenefitLine) Implements ITechListBenefitLine.CloneFrom - - - Me.Units = source.Units - Me.Category = source.Category - Me.BenefitName = source.BenefitName - Me.LowFloorH = source.LowFloorH - Me.LowFloorV = source.LowFloorV - Me.LowFloorC = source.LowFloorC - - Me.SemiLowFloorH = source.SemiLowFloorH - Me.SemiLowFloorV = source.SemiLowFloorV - Me.SemiLowFloorC = source.SemiLowFloorC - - Me.RaisedFloorH = source.RaisedFloorH - Me.RaisedFloorV = source.RaisedFloorV - Me.RaisedFloorC = source.RaisedFloorC - - Me.OnVehicle = source.OnVehicle - Me.ActiveVH = source.ActiveVH - Me.ActiveVV = source.ActiveVV - Me.ActiveVC = source.ActiveVC - Me.LineType = source.LineType - End Sub - - Public Function IsEqualTo(source As ITechListBenefitLine) As Boolean Implements ITechListBenefitLine.IsEqualTo - Dim mySource As TechListBenefitLine = CType(source, TechListBenefitLine) - If mySource Is Nothing Then - Return False - End If - Return Me = mySource - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb b/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb index 0ea2a7543e687bbfd29b74c81fbef129ced18a65..4b0efbda20df4d8b31dece3587e3e26d6e90e8d5 100644 --- a/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb +++ b/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb @@ -9,35 +9,31 @@ ' ' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules -Imports System.IO - -Imports System.Windows.Forms -Imports Newtonsoft.Json +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem Public Interface IAuxiliaryConfig - 'Vecto - Property VectoInputs As IVectoInputs + 'Vecto + Property VectoInputs As IVectoInputs - 'Electrical - property ElectricalUserInputsConfig As IElectricsUserInputsConfig + 'Electrical + property ElectricalUserInputsConfig As IElectricsUserInputsConfig - 'Pneumatics - Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig - Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig + 'Pneumatics + Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig + Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig - 'Hvac - Property HvacUserInputsConfig As IHVACUserInputsConfig + 'Hvac + Property HvacUserInputsConfig As IHVACUserInputsConfig - Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) As Boolean + Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) As Boolean - 'Persistance Functions - Function Save(filePath As String) As Boolean - Function Load(filePath As String) As Boolean + 'Persistance Functions + Function Save(filePath As String) As Boolean + Function Load(filePath As String) As Boolean End Interface diff --git a/VECTOAux/VectoAuxiliaries/ISignals.vb b/VECTOAux/VectoAuxiliaries/ISignals.vb deleted file mode 100644 index de354bedbfedad0becfb9026be1bf0c22d9c5766..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/ISignals.vb +++ /dev/null @@ -1,15 +0,0 @@ -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 diff --git a/VECTOAux/VectoAuxiliaries/IVectoInputs.vb b/VECTOAux/VectoAuxiliaries/IVectoInputs.vb deleted file mode 100644 index 6d6634dfd7a66c58d9186e83f15a9c284e43bbca..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/IVectoInputs.vb +++ /dev/null @@ -1,10 +0,0 @@ -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 diff --git a/VECTOAux/VectoAuxiliaries/My Project/AssemblyInfo.vb b/VECTOAux/VectoAuxiliaries/My Project/AssemblyInfo.vb index 30dd372dbba136e55b0b4c5befa5a85ba14809c0..e1d034d5f3110c279b792a7df6785f107addefef 100644 --- a/VECTOAux/VectoAuxiliaries/My Project/AssemblyInfo.vb +++ b/VECTOAux/VectoAuxiliaries/My Project/AssemblyInfo.vb @@ -1,5 +1,4 @@ -Imports System -Imports System.Reflection +Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following diff --git a/VECTOAux/VectoAuxiliaries/My Project/Resources.Designer.vb b/VECTOAux/VectoAuxiliaries/My Project/Resources.Designer.vb index 9945d2f64dacdf7d7526e39673737e1fa038a074..02dcd6f1f64447f29b19d6d819efe3189eec7fe5 100644 --- a/VECTOAux/VectoAuxiliaries/My Project/Resources.Designer.vb +++ b/VECTOAux/VectoAuxiliaries/My Project/Resources.Designer.vb @@ -11,7 +11,6 @@ Option Strict On Option Explicit On -Imports System Namespace My.Resources diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/ActuationsKey.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/ActuationsKey.vb deleted file mode 100644 index c943df8f2288055a489f081f49d82c3cd90f9b15..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/ActuationsKey.vb +++ /dev/null @@ -1,53 +0,0 @@ -' Copyright 2017 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. - -Namespace Pneumatics - Public Class ActuationsKey - Private _consumerName As String - Private _cycleName As String - -'Properties - Public ReadOnly Property ConsumerName As String - Get - Return _consumerName - End Get - End Property - - Public ReadOnly Property CycleName As String - Get - Return _cycleName - End Get - End Property - -'Constructor - Public Sub New(consumerName As String, cycleName As String) - - If consumerName.Trim.Length = 0 Or cycleName.Trim.Length = 0 Then _ - Throw New ArgumentException("ConsumerName and CycleName must be provided") - _consumerName = consumerName - _cycleName = cycleName - End Sub - - - 'Overrides to enable this class to be used as a dictionary key in the ActuationsMap. - Public Overrides Function Equals(obj As Object) As Boolean - - Dim other As ActuationsKey = CType(obj, ActuationsKey) - - Return other.ConsumerName = Me.ConsumerName AndAlso other.CycleName = Me.CycleName - End Function - - Public Overrides Function GetHashCode() As Integer - Return 0 - End Function - End Class -End Namespace - diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/CompressorMap.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/CompressorMap.vb deleted file mode 100644 index 66a9abdebbdd9fe02a177933cb4d0da534cf4290..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/CompressorMap.vb +++ /dev/null @@ -1,260 +0,0 @@ -' Copyright 2017 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 System.Globalization -Imports System.IO -Imports TUGraz.VectoCommon.Utils - -Namespace Pneumatics - ''' <summary> - ''' Compressor Flow Rate and Power Map - ''' </summary> - ''' <remarks></remarks> - Public Class CompressorMap - Implements ICompressorMap, - IAuxiliaryEvent - - Private ReadOnly filePath As String - Private _averagePowerDemandPerCompressorUnitFlowRateLitresperSec As Double - Private _MapBoundariesExceeded As Boolean - - ''' <summary> - ''' Dictionary of values keyed by the rpm valaues in the csv file - ''' Values are held as a tuple as follows - ''' Item1 = flow rate - ''' Item2 - power [compressor on] - ''' Item3 - power [compressor off] - ''' </summary> - ''' <remarks></remarks> - Private map As Dictionary(Of Integer, CompressorMapValues) - - 'Returns the AveragePowerDemand per unit flow rate in seconds. - Public Function GetAveragePowerDemandPerCompressorUnitFlowRate() As Double _ - Implements ICompressorMap.GetAveragePowerDemandPerCompressorUnitFlowRate - - Return _averagePowerDemandPerCompressorUnitFlowRateLitresperSec - End Function - - - ''' <summary> - ''' Creates a new instance of the CompressorMap class - ''' </summary> - ''' <param name="path">full path to csv data file</param> - ''' <remarks></remarks> - Public Sub New(ByVal path As String) - filePath = path - End Sub - - ''' <summary> - ''' Initilaises the map from the supplied csv data - ''' </summary> - ''' <remarks></remarks> - Public Function Initialise() As Boolean Implements ICompressorMap.Initialise - - If File.Exists(filePath) Then - Using sr As StreamReader = New StreamReader(filePath) - 'get array of lines from 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.Length < 3 Then Throw New ArgumentException("Insufficient rows in csv to build a usable map") - - map = New Dictionary(Of Integer, CompressorMapValues)() - 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() {","c}, StringSplitOptions.RemoveEmptyEntries) - '4 entries per line required - If (elements.Length <> 4) Then Throw New ArgumentException("Incorrect number of values in csv file") - 'add values to map - Try - map.Add(Integer.Parse(elements(0)), - New CompressorMapValues(Double.Parse(elements(1), CultureInfo.InvariantCulture).SI(Of NormLiterPerSecond), - Double.Parse(elements(2), CultureInfo.InvariantCulture).SI(Of Watt), - Double.Parse(elements(3), CultureInfo.InvariantCulture).SI(Of Watt))) - Catch fe As FormatException - Throw New InvalidCastException(String.Format("Compresor Map: line '{0}", line), fe) - End Try - Else - firstline = False - End If - Next - End Using - - '********************************************************************* - 'Calculate the Average Power Demand Per Compressor Unit FlowRate / per second. - Dim powerDividedByFlowRateSum As Double = 0 - For Each speed As KeyValuePair(Of Integer, CompressorMapValues) In map - powerDividedByFlowRateSum += (speed.Value.PowerCompressorOn - speed.Value.PowerCompressorOff).Value() / - speed.Value.FlowRate.Value() - Next - - 'Map in Litres Per Minute, so * 60 to get per second, calculated only once at initialisation. - _averagePowerDemandPerCompressorUnitFlowRateLitresperSec = (powerDividedByFlowRateSum / map.Count) * 60 - '********************************************************************** - - Else - Throw New ArgumentException("supplied input file does not exist") - End If - - 'If we get here then all should be well and we can return a True value of success. - Return True - End Function - - ''' <summary> - ''' Returns compressor flow rate at the given rotation speed - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Public Function GetFlowRate(ByVal rpm As Double) As NormLiterPerSecond Implements ICompressorMap.GetFlowRate - Dim val As CompressorMapValues = InterpolatedTuple(rpm) - Return val.FlowRate - End Function - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is on - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Public Function GetPowerCompressorOn(ByVal rpm As Double) As Watt Implements ICompressorMap.GetPowerCompressorOn - Dim val As CompressorMapValues = InterpolatedTuple(rpm) - Return val.PowerCompressorOn - End Function - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is off - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Public Function GetPowerCompressorOff(ByVal rpm As Double) As Watt Implements ICompressorMap.GetPowerCompressorOff - Dim val As CompressorMapValues = InterpolatedTuple(rpm) - Return val.PowerCompressorOff - End Function - - ''' <summary> - ''' Returns an instance of CompressorMapValues containing the values at a key, or interpolated values - ''' </summary> - ''' <returns>CompressorMapValues</returns> - ''' <remarks>Throws exception if rpm are outside map</remarks> - Private Function InterpolatedTuple(ByVal rpm As Double) As CompressorMapValues - 'check the rpm is within the map - Dim min As Integer = map.Keys.Min() - Dim max As Integer = map.Keys.Max() - - If rpm < min OrElse rpm > max Then - If Not _MapBoundariesExceeded Then - OnMessage(Me, - String.Format("Compresser : limited RPM of '{2}' to extent of map - map range is {0} to {1}", min, max, rpm), - AdvancedAuxiliaryMessageType.Warning) - _MapBoundariesExceeded = True - End If - - 'Limiting as agreed. - If rpm > max Then rpm = max - If rpm < min Then rpm = min - - End If - - 'If supplied rpm is a key, we can just return the appropriate tuple - Dim intRpm As Integer = CType(rpm, Integer) - If rpm.IsEqual(intRpm) AndAlso map.ContainsKey(intRpm) Then - Return map(intRpm) - End If - - 'Not a key value, interpolate - 'get the entries before and after the supplied rpm - Dim pre As KeyValuePair(Of Integer, CompressorMapValues) = (From m In map Where m.Key < rpm Select m).Last() - Dim post As KeyValuePair(Of Integer, CompressorMapValues) = (From m In map Where m.Key > rpm Select m).First() - - 'get the delta values for rpm and the map values - Dim dRpm As Double = post.Key - pre.Key - Dim dFlowRate As NormLiterPerSecond = post.Value.FlowRate - pre.Value.FlowRate - Dim dPowerOn As Watt = post.Value.PowerCompressorOn - pre.Value.PowerCompressorOn - Dim dPowerOff As Watt = post.Value.PowerCompressorOff - pre.Value.PowerCompressorOff - - 'calculate the slopes - Dim flowSlope As Double = dFlowRate.Value() / dRpm - Dim powerOnSlope As Double = dPowerOn.Value() / dRpm - Dim powerOffSlope As Double = dPowerOff.Value() / dRpm - - 'calculate the new values - Dim flowRate As NormLiterPerSecond = (((rpm - pre.Key) * flowSlope).SI(Of NormLiterPerSecond)() + pre.Value.FlowRate) - Dim powerCompressorOn As Watt = (((rpm - pre.Key) * powerOnSlope).SI(Of Watt)() + pre.Value.PowerCompressorOn) - Dim powerCompressorOff As Watt = (((rpm - pre.Key) * powerOffSlope).SI(Of Watt)() + pre.Value.PowerCompressorOff) - - 'Build and return a new CompressorMapValues instance - Return New CompressorMapValues(flowRate, powerCompressorOn, powerCompressorOff) - End Function - - ''' <summary> - ''' Encapsulates compressor map values - ''' Flow Rate - ''' Power - Compressor On - ''' Power - Compressor Off - ''' </summary> - ''' <remarks></remarks> - ''' - - Private Structure CompressorMapValues - ''' <summary> - ''' Compressor flowrate - ''' </summary> - ''' <remarks></remarks> - Public ReadOnly FlowRate As NormLiterPerSecond - - ''' <summary> - ''' Power, compressor on - ''' </summary> - ''' <remarks></remarks> - Public ReadOnly PowerCompressorOn As Watt - - ''' <summary> - ''' Power compressor off - ''' </summary> - ''' <remarks></remarks> - Public ReadOnly PowerCompressorOff As Watt - - ''' <summary> - ''' Creates a new instance of CompressorMapValues - ''' </summary> - ''' <param name="flowRate">flow rate</param> - ''' <param name="powerCompressorOn">power - compressor on</param> - ''' <param name="powerCompressorOff">power - compressor off</param> - ''' <remarks></remarks> - Public Sub New(ByVal flowRate As NormLiterPerSecond, ByVal powerCompressorOn As Watt, - ByVal powerCompressorOff As Watt) - Me.FlowRate = flowRate - Me.PowerCompressorOn = powerCompressorOn - Me.PowerCompressorOff = powerCompressorOff - End Sub - End Structure - - - Public Event Message(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent - - Private Sub OnMessage(sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) - - - If Not message Is Nothing Then - - RaiseEvent Message(Me, message, messageType) - - End If - End Sub - End Class -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/ICompressorMap.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/ICompressorMap.vb deleted file mode 100644 index ebb7b4de8330b1c71535d11b5f18d9e2a51c06b1..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/ICompressorMap.vb +++ /dev/null @@ -1,50 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Interface ICompressorMap - Inherits IAuxiliaryEvent - - ''' <summary> - ''' Initilaises the map from the supplied csv data - ''' </summary> - ''' <remarks></remarks> - Function Initialise() As Boolean - - ''' <summary> - ''' Returns compressor flow rate at the given rotation speed - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Function GetFlowRate(ByVal rpm As Double) As NormLiterPerSecond - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is on - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Function GetPowerCompressorOn(ByVal rpm As Double) As Watt - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is off - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Function GetPowerCompressorOff(ByVal rpm As Double) As Watt - - 'Returns Average Power Demand Per Compressor Unit FlowRate - Function GetAveragePowerDemandPerCompressorUnitFlowRate() As Double - End Interface -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IM3_AveragePneumaticLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IM3_AveragePneumaticLoadDemand.vb deleted file mode 100644 index 860b26b99e45b6ebae91c4c0d16bebf753aa6179..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IM3_AveragePneumaticLoadDemand.vb +++ /dev/null @@ -1,21 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Interface IM3_AveragePneumaticLoadDemand - Function GetAveragePowerDemandAtCrankFromPneumatics() As Watt - - Function AverageAirConsumedPerSecondLitre() As NormLiterPerSecond - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IM4_AirCompressor.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IM4_AirCompressor.vb deleted file mode 100644 index 757fc9ec00e6d5475b4a14c237eb534d3da52502..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IM4_AirCompressor.vb +++ /dev/null @@ -1,73 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Interface IM4_AirCompressor - ''' <summary> - ''' Ratio of Gear or Pulley used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PulleyGearRatio() As Double - - ''' <summary> - ''' Efficiency of the Pulley or Gear used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PulleyGearEfficiency() As Double - - ''' <summary> - ''' Initialises the AirCompressor Class - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function Initialise() As Boolean - - ''' <summary> - ''' Returns the flow rate [litres/second] of compressor for the given engine rpm - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetFlowRate() As NormLiterPerSecond - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is off - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetPowerCompressorOff() As Watt - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is on - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetPowerCompressorOn() As Watt - - ''' <summary> - ''' Returns the difference in power between compressonr on and compressor off operation at the given engine rpm - ''' </summary> - ''' <returns>Single / Watts</returns> - ''' <remarks></remarks> - Function GetPowerDifference() As Watt - - ''' <summary> - ''' Returns Average PoweDemand PeCompressor UnitFlowRate - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetAveragePowerDemandPerCompressorUnitFlowRate() As SI - End Interface -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticActuationsMAP.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticActuationsMAP.vb deleted file mode 100644 index cf0dcfea4c862fefac3792d16a262486366d5773..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticActuationsMAP.vb +++ /dev/null @@ -1,21 +0,0 @@ -' Copyright 2017 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. - - -Namespace Pneumatics - Public Interface IPneumaticActuationsMAP - Function GetNumActuations(key As ActuationsKey) As Integer - - Function Initialise() As Boolean - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticUserInputsConfig.vb deleted file mode 100644 index 1cd6931fc90c9a15ecd56b834f18cdc8eeb8cf20..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticUserInputsConfig.vb +++ /dev/null @@ -1,29 +0,0 @@ -' Copyright 2017 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. - - -Namespace Pneumatics - Public Interface IPneumaticUserInputsConfig - Property CompressorMap As String - Property CompressorGearEfficiency As Double - Property CompressorGearRatio As Double - Property ActuationsMap As String - Property SmartAirCompression As Boolean - Property SmartRegeneration As Boolean - Property RetarderBrake As Boolean - Property KneelingHeightMillimeters As Double - Property AirSuspensionControl As String 'mechanical or electrical - Property AdBlueDosing As String 'pnmeumatic or electric - Property Doors As String 'pneumatic or electric - End Interface -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticsAuxilliariesConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticsAuxilliariesConfig.vb deleted file mode 100644 index 421f7c2c81d0cf67059e5b1ea44c05f8e19665cd..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticsAuxilliariesConfig.vb +++ /dev/null @@ -1,25 +0,0 @@ -' Copyright 2017 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. - -Public Interface IPneumaticsAuxilliariesConfig - Property OverrunUtilisationForCompressionFraction As Double - Property BrakingWithRetarderNIperKG As Double - Property BrakingNoRetarderNIperKG As Double - Property BreakingPerKneelingNIperKGinMM As Double - Property PerDoorOpeningNI As Double - Property PerStopBrakeActuationNIperKG As Double - Property AirControlledSuspensionNIperMinute As Double - Property AdBlueNIperMinute As Double - Property NonSmartRegenFractionTotalAirDemand As Double - Property SmartRegenFractionTotalAirDemand As Double - Property DeadVolumeLitres As Double - Property DeadVolBlowOutsPerLitresperHour As Double -End Interface diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb deleted file mode 100644 index 7e5a23a3db4880e08019b78618cda70338501aa1..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb +++ /dev/null @@ -1,220 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Pneumatics - -Namespace Pneumatics - Public Class M3_AveragePneumaticLoadDemand - Implements IM3_AveragePneumaticLoadDemand - - Private _pneumaticUserInputsConfig As IPneumaticUserInputsConfig - Private _pneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig - Private _pneumaticsActuationsMap As IPneumaticActuationsMAP - Private _pneumaticsCompressorFlowRateMap As ICompressorMap - Private _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond As SI - Private _vehicleMassKG As Kilogram - Private _cycleName As String - Private _cycleDurationMinutes As Double - Private _totalAirDemand As NormLiter - Private _signals As ISignals - - - Private ReadOnly Property Sum1 As NormLiterPerSecond - Get - Return _totalAirDemand / _signals.TotalCycleTimeSeconds.SI(Of Second)() - End Get - End Property - - Private ReadOnly Property Sum2 As Watt - Get - Return (Sum7.Value() / Sum6.Value() * Sum1.Value()).SI(Of Watt)() ' Watt / Nl/s * Nl/s = Watt - End Get - End Property - - Private ReadOnly Property Sum3 As Watt - Get - Return _ - Sum2 + - _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) - End Get - End Property - - Private ReadOnly Property Sum4 As Watt - Get - Return Sum3 * (1 / _pneumaticUserInputsConfig.CompressorGearEfficiency) - End Get - End Property - - 'Private ReadOnly Property Sum5 As Single - ' Get - ' 'NOT USED. - ' End Get - 'End Property - - Private ReadOnly Property Sum6 As NormLiterPerSecond - Get - Return _ - _pneumaticsCompressorFlowRateMap.GetFlowRate( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) / - 60 - End Get - End Property - - Private ReadOnly Property Sum7 As Watt - Get - - Dim pon As Watt = - _pneumaticsCompressorFlowRateMap.GetPowerCompressorOn( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) - Dim poff As Watt = - _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) - Dim diff As Watt = pon - poff - Return diff - End Get - End Property - - - Public ReadOnly Property TotalAirDemand As NormLiter - Get - Return _totalAirDemand - End Get - End Property - - - 'Constructors - Public Sub New( - ByRef pneumaticsUserInputConfig As IPneumaticUserInputsConfig, - ByRef pneumaticsAuxillariesConfig As IPneumaticsAuxilliariesConfig, - ByRef pneumaticsActuationsMap As IPneumaticActuationsMAP, - ByRef pneumaticsCompressorFlowRateMap As ICompressorMap, - vehicleMassKG As Kilogram, - cycleName As String, - signals As ISignals - ) - - - _pneumaticUserInputsConfig = pneumaticsUserInputConfig - _pneumaticAuxillariesConfig = pneumaticsAuxillariesConfig - _pneumaticsActuationsMap = pneumaticsActuationsMap - _pneumaticsCompressorFlowRateMap = pneumaticsCompressorFlowRateMap - _vehicleMassKG = vehicleMassKG - _cycleName = cycleName - _signals = signals - - - 'Total up the blow demands from compressor map - _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond = - (_pneumaticsCompressorFlowRateMap.GetAveragePowerDemandPerCompressorUnitFlowRate() / 60).SI() - - 'Calculate the Total Required Air Delivery Rate L / S - _totalAirDemand = TotalAirDemandCalculation() - End Sub - - - Private Function TotalAirDemandCalculation() As NormLiter - - 'These calculation are done directly from formulae provided from a supplied spreadsheet. - - Dim numActuationsPerCycle As Double - Dim airConsumptionPerActuationNI As Double - Dim TotalAirDemand As NormLiter - - 'Consumers - Dim Breaks As NormLiter - Dim ParkBrakesplus2Doors As NormLiter - Dim Kneeling As NormLiter - Dim AdBlue As NormLiter - Dim Regeneration As NormLiter - Dim DeadVolBlowOuts As NormLiter - Dim AirSuspension As NormLiter - - - '** Breaks ** - numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Brakes", _cycleName)) - '=IF(K10 = "yes", IF(COUNTBLANK(F33),G33,F33), IF(COUNTBLANK(F34),G34,F34))*K16 - airConsumptionPerActuationNI = - If _ - (_pneumaticUserInputsConfig.RetarderBrake, _pneumaticAuxillariesConfig.BrakingWithRetarderNIperKG, - _pneumaticAuxillariesConfig.BrakingNoRetarderNIperKG) - Breaks = (numActuationsPerCycle * airConsumptionPerActuationNI * _vehicleMassKG.Value()).SI(Of NormLiter)() - - '** ParkBrakesBreakplus2Doors ** Park break + 2 doors - numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Park brake + 2 doors", - _cycleName)) - '=SUM(IF(K14="electric",0,IF(COUNTBLANK(F36),G36,F36)),PRODUCT(K16*IF(COUNTBLANK(F37),G37,F37))) - airConsumptionPerActuationNI = - If(_pneumaticUserInputsConfig.Doors = "Electric", 0, _pneumaticAuxillariesConfig.PerDoorOpeningNI) - airConsumptionPerActuationNI += (_pneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG * _vehicleMassKG.Value()) - ParkBrakesplus2Doors = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() - - '** Kneeling ** - numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Kneeling", _cycleName)) - '=IF(COUNTBLANK(F35),G35,F35)*K11*K16 - airConsumptionPerActuationNI = _pneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM * _vehicleMassKG.Value() * - _pneumaticUserInputsConfig.KneelingHeightMillimeters - Kneeling = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() - - '** AdBlue ** - '=IF(K13="electric",0,G39*F54)- Supplied Spreadsheet - AdBlue = - If _ - (_pneumaticUserInputsConfig.AdBlueDosing = "Electric", 0, - _pneumaticAuxillariesConfig.AdBlueNIperMinute * (_signals.TotalCycleTimeSeconds / 60)).SI(Of NormLiter)() - - '** Regeneration ** - '=SUM(R6:R9)*IF(K9="yes",IF(COUNTBLANK(F41),G41,F41),IF(COUNTBLANK(F40),G40,F40)) - Supplied SpreadSheet - Regeneration = (Breaks + ParkBrakesplus2Doors + Kneeling + AdBlue) - Dim regenFraction As Double = - If(_pneumaticUserInputsConfig.SmartRegeneration, _pneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand, - _pneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand) - Regeneration = Regeneration * regenFraction - - '** DeadVolBlowOuts ** - '=IF(COUNTBLANK(F43),G43,F43)/(F54/60) - Supplied SpreadSheet - numActuationsPerCycle = _pneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour / - (60 / (_signals.TotalCycleTimeSeconds / 60)) - airConsumptionPerActuationNI = _pneumaticAuxillariesConfig.DeadVolumeLitres - DeadVolBlowOuts = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() - - '** AirSuspension ** - '=IF(K12="electrically",0,G38*F54) - Suplied Spreadsheet - AirSuspension = - If _ - (_pneumaticUserInputsConfig.AirSuspensionControl = "Electrically", 0, - _pneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute * _cycleDurationMinutes).SI(Of NormLiter)() - - '** Total Air Demand ** - TotalAirDemand = Breaks + ParkBrakesplus2Doors + Kneeling + AdBlue + Regeneration + DeadVolBlowOuts + AirSuspension - - - Return TotalAirDemand - End Function - - - 'Get Average Power Demand @ Crank From Pneumatics - Public Function GetAveragePowerDemandAtCrankFromPneumatics() As Watt _ - Implements IM3_AveragePneumaticLoadDemand.GetAveragePowerDemandAtCrankFromPneumatics - - Return Sum4 - End Function - - 'Get Total Required Air Delivery Rate - Public Function AverageAirConsumedPerSecondLitre() As NormLiterPerSecond _ - Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumedPerSecondLitre - - Return Sum1 - End Function - End Class -End Namespace - diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/M4_AirCompressor.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/M4_AirCompressor.vb deleted file mode 100644 index 547aaf8b9ba1cb5247870fd9ac90463d8c352dbf..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/M4_AirCompressor.vb +++ /dev/null @@ -1,175 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Class M4_AirCompressor - Implements IM4_AirCompressor - - Private Const MinRatio As Double = 1 - Private Const MaxRatio As Double = 10 - Private Const MinEff As Double = 0 - Private Const MaxEff As Double = 1 - - Private _pulleyGearRatio As Double - Private _pulleyGearEfficiency As Double - Private _map As ICompressorMap - Private _signals As ISignals - - - ''' <summary> - ''' Ratio of Gear or Pulley used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property PulleyGearRatio() As Double Implements IM4_AirCompressor.PulleyGearRatio - Get - Return _pulleyGearRatio - End Get - Set(value As Double) - If (value < MinRatio OrElse value > MaxRatio) Then - Throw _ - New ArgumentOutOfRangeException("pulleyGearRatio", value, - String.Format("Invalid value, should be in the range {0} to {1}", MinRatio, MaxRatio)) - Else - _pulleyGearRatio = value - End If - End Set - End Property - - ''' <summary> - ''' Efficiency of the Pulley or Gear used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property PulleyGearEfficiency() As Double Implements IM4_AirCompressor.PulleyGearEfficiency - Get - Return _pulleyGearEfficiency - End Get - Set(value As Double) - If (value < MinEff OrElse value > MaxEff) Then - Throw _ - New ArgumentOutOfRangeException("pulleyGearEfficiency", value, - String.Format("Invalid value, should be in the range {0} to {1}", MinEff, MaxEff) - ) - Else - _pulleyGearEfficiency = value - End If - End Set - End Property - - - '''<summary> - ''' Creates a new instance of the AirCompressor Class - ''' </summary> - ''' <param name="map">map of compressor values against compressor rpm</param> - ''' <param name="pulleyGearRatio">Ratio of Pulley/Gear</param> - ''' <param name="pulleyGearEfficiency">Efficiency of Pulley/Gear</param> - ''' <remarks></remarks> - Public Sub New(ByVal map As ICompressorMap, ByRef pulleyGearRatio As Double, ByRef pulleyGearEfficiency As Double, - signals As ISignals) - - _map = map - _pulleyGearRatio = pulleyGearRatio - _pulleyGearEfficiency = pulleyGearEfficiency - _signals = signals - End Sub - - ''' <summary> - ''' Initialises the AirCompressor Class - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function Initialise() As Boolean Implements IM4_AirCompressor.Initialise - Return _map.Initialise() - End Function - - 'Queryable Compressor Methods - ' - 'Compressor ( Speed ) Flow Rate - 'Power @ Crank From Pnumatics compressor off ( A ) - 'Power @ Crank From Pnumatics compressor On ( B ) - 'Power Delta ( A ) vs ( B ) - - - 'Return Average Power Demand Per Compressor Unit Flow Rate - - - ''' <summary> - ''' Returns the flow rate [litres/second] of compressor for the given engine rpm - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetFlowRate() As NormLiterPerSecond Implements IM4_AirCompressor.GetFlowRate - Dim compressorRpm As Double = _signals.EngineSpeed.AsRPM * PulleyGearRatio - - ''Flow Rate in the map is Litres/min so divide by 60 to get Units per second. - Return _map.GetFlowRate(compressorRpm) / 60 - End Function - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is off - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetPowerCompressorOff() As Watt Implements IM4_AirCompressor.GetPowerCompressorOff - Return GetCompressorPower(False) - End Function - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is on - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetPowerCompressorOn() As Watt Implements IM4_AirCompressor.GetPowerCompressorOn - Return GetCompressorPower(True) - End Function - - ''' <summary> - ''' Returns the difference in power between compressonr on and compressor off operation at the given engine rpm - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetPowerDifference() As Watt Implements IM4_AirCompressor.GetPowerDifference - Dim powerOn As Watt = GetPowerCompressorOn() - Dim powerOff As Watt = GetPowerCompressorOff() - Return powerOn - powerOff - End Function - - ''' <summary> - ''' Looks up the compressor power from the map at given engine speed - ''' </summary> - ''' <param name="compressorOn">Is compressor on</param> - ''' <returns></returns> - ''' <remarks></remarks> - Private Function GetCompressorPower(ByVal compressorOn As Boolean) As Watt - Dim compressorRpm As Double = _signals.EngineSpeed.AsRPM * PulleyGearRatio - If compressorOn Then - Return _map.GetPowerCompressorOn(compressorRpm) - Else - Return _map.GetPowerCompressorOff(compressorRpm) - End If - End Function - - ''' <summary> - ''' Aver - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetAveragePowerDemandPerCompressorUnitFlowRate() As SI _ - Implements IM4_AirCompressor.GetAveragePowerDemandPerCompressorUnitFlowRate - - Return _map.GetAveragePowerDemandPerCompressorUnitFlowRate().SI() - End Function - End Class -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticActuationsMap.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticActuationsMap.vb deleted file mode 100644 index 1af67ca9c9fef1f80875d1f52446778381c2793c..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticActuationsMap.vb +++ /dev/null @@ -1,101 +0,0 @@ -' Copyright 2017 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 System.Globalization -Imports System.IO - -Namespace Pneumatics - Public Class PneumaticActuationsMAP - Implements IPneumaticActuationsMAP - - Private map As Dictionary(Of ActuationsKey, Integer) - Private filePath As String - - - Public Function GetNumActuations(key As ActuationsKey) As Integer Implements IPneumaticActuationsMAP.GetNumActuations - - If map Is Nothing OrElse Not map.ContainsKey(key) Then - Throw _ - New ArgumentException(String.Format("Pneumatic Actuations map does not contain the key '{0}'.", - key.CycleName & ":" & key.ConsumerName)) - End If - - Return map(key) - End Function - - - Public Sub New(filePath As String) - - Me.filePath = filePath - - If filePath.Trim.Length = 0 Then _ - Throw New ArgumentException("A filename for the Pneumatic Actuations Map has not been supplied") - - Initialise() - End Sub - - Public Function Initialise() As Boolean Implements IPneumaticActuationsMAP.Initialise - - Dim newKey As ActuationsKey - Dim numActuations As Integer - - If File.Exists(filePath) Then - Using sr As StreamReader = New StreamReader(filePath) - 'get array of lines from 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.Length < 3 Then _ - Throw _ - New ArgumentException("Pneumatic Actuations Map does not have sufficient rows in file to build a usable map") - - map = New Dictionary(Of ActuationsKey, Integer)() - 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() {","c}, StringSplitOptions.RemoveEmptyEntries) - '3 entries per line required - If (elements.Length <> 3) Then _ - Throw New ArgumentException("Pneumatic Actuations Map has Incorrect number of values in file") - - 'add values to map - - - If Not Integer.TryParse(elements(2), numActuations) Then - Throw New ArgumentException("Pneumatic Actuations Map Contains Non Integer values in actuations column") - End If - - 'Should throw exception if ConsumerName or CycleName are empty. - newKey = New ActuationsKey(elements(0).ToString(), elements(1).ToString()) - - map.Add(newKey, Integer.Parse(elements(2), CultureInfo.InvariantCulture)) - - Else - firstline = False - End If - Next - End Using - - - Else - Throw New ArgumentException(String.Format(" Pneumatic Acutations map '{0}' supplied does not exist", filePath)) - End If - - 'If we get here then all should be well and we can return a True value of success. - Return True - End Function - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticUserInputsConfig.vb deleted file mode 100644 index 47dc0fcca30340d40a4d1b9e2da647aaf705307e..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticUserInputsConfig.vb +++ /dev/null @@ -1,59 +0,0 @@ -' Copyright 2017 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. - -Namespace Pneumatics - Public Class PneumaticUserInputsConfig - Implements IPneumaticUserInputsConfig - - Public Property CompressorMap As String Implements IPneumaticUserInputsConfig.CompressorMap - Public Property CompressorGearRatio As Double Implements IPneumaticUserInputsConfig.CompressorGearRatio - Public Property CompressorGearEfficiency As Double Implements IPneumaticUserInputsConfig.CompressorGearEfficiency - - 'pnmeumatic or electric - Public Property AdBlueDosing As String Implements IPneumaticUserInputsConfig.AdBlueDosing - - 'mechanical or electrical - Public Property AirSuspensionControl As String Implements IPneumaticUserInputsConfig.AirSuspensionControl - - 'pneumatic or electric - Public Property Doors As String Implements IPneumaticUserInputsConfig.Doors - Public Property KneelingHeightMillimeters As Double Implements IPneumaticUserInputsConfig.KneelingHeightMillimeters - - 'PneumaticActuationsMap - Public Property ActuationsMap As String Implements IPneumaticUserInputsConfig.ActuationsMap - - Public Property RetarderBrake As Boolean Implements IPneumaticUserInputsConfig.RetarderBrake - Public Property SmartAirCompression As Boolean Implements IPneumaticUserInputsConfig.SmartAirCompression - Public Property SmartRegeneration As Boolean Implements IPneumaticUserInputsConfig.SmartRegeneration - - Public Sub New(Optional setToDefaults As Boolean = False) - - If setToDefaults Then SetPropertiesToDefaults() - End Sub - - Public Sub SetPropertiesToDefaults() - - CompressorMap = String.Empty - CompressorGearRatio = 1.0 - CompressorGearEfficiency = 0.97 - AdBlueDosing = "Pneumatic" - AirSuspensionControl = "Mechanically" - Doors = "Pneumatic" - KneelingHeightMillimeters = 70 - ActuationsMap = Nothing - RetarderBrake = True - SmartAirCompression = False - SmartRegeneration = False - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb deleted file mode 100644 index 43353ff6fbd9de0cfe598f64d834bfd2bd8614ef..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb +++ /dev/null @@ -1,71 +0,0 @@ -' Copyright 2017 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. - -Namespace Pneumatics - Public Class PneumaticsAuxilliariesConfig - Implements IPneumaticsAuxilliariesConfig - - Public Property AdBlueNIperMinute As Double Implements IPneumaticsAuxilliariesConfig.AdBlueNIperMinute - - Public Property AirControlledSuspensionNIperMinute As Double _ - Implements IPneumaticsAuxilliariesConfig.AirControlledSuspensionNIperMinute - - Public Property BrakingNoRetarderNIperKG As Double Implements IPneumaticsAuxilliariesConfig.BrakingNoRetarderNIperKG - - Public Property BrakingWithRetarderNIperKG As Double _ - Implements IPneumaticsAuxilliariesConfig.BrakingWithRetarderNIperKG - - Public Property BreakingPerKneelingNIperKGinMM As Double _ - Implements IPneumaticsAuxilliariesConfig.BreakingPerKneelingNIperKGinMM - - Public Property DeadVolBlowOutsPerLitresperHour As Double _ - Implements IPneumaticsAuxilliariesConfig.DeadVolBlowOutsPerLitresperHour - - Public Property DeadVolumeLitres As Double Implements IPneumaticsAuxilliariesConfig.DeadVolumeLitres - - Public Property NonSmartRegenFractionTotalAirDemand As Double _ - Implements IPneumaticsAuxilliariesConfig.NonSmartRegenFractionTotalAirDemand - - Public Property OverrunUtilisationForCompressionFraction As Double _ - Implements IPneumaticsAuxilliariesConfig.OverrunUtilisationForCompressionFraction - - Public Property PerDoorOpeningNI As Double Implements IPneumaticsAuxilliariesConfig.PerDoorOpeningNI - - Public Property PerStopBrakeActuationNIperKG As Double _ - Implements IPneumaticsAuxilliariesConfig.PerStopBrakeActuationNIperKG - - Public Property SmartRegenFractionTotalAirDemand As Double _ - Implements IPneumaticsAuxilliariesConfig.SmartRegenFractionTotalAirDemand - - - Public Sub New(Optional setToDefaults As Boolean = False) - - If setToDefaults Then SetDefaults() - End Sub - - Public Sub SetDefaults() - AdBlueNIperMinute = 21.25 - AirControlledSuspensionNIperMinute = 15 - BrakingNoRetarderNIperKG = 0.00081 - BrakingWithRetarderNIperKG = 0.0006 - BreakingPerKneelingNIperKGinMM = 0.000066 - DeadVolBlowOutsPerLitresperHour = 24 - DeadVolumeLitres = 30 - NonSmartRegenFractionTotalAirDemand = 0.26 - OverrunUtilisationForCompressionFraction = 0.97 - PerDoorOpeningNI = 12.7 - PerStopBrakeActuationNIperKG = 0.00064 - SmartRegenFractionTotalAirDemand = 0.12 - End Sub - End Class -End Namespace - - diff --git a/VECTOAux/VectoAuxiliaries/Signals.vb b/VECTOAux/VectoAuxiliaries/Signals.vb deleted file mode 100644 index 18311fd804ca3f915a46808712407bcccb732ace..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/Signals.vb +++ /dev/null @@ -1,50 +0,0 @@ - -Public Class Signals -Implements ISignals - - - - - Private _smartElectrics As Boolean - - Public Property ClutchEngaged As Boolean Implements ISignals.ClutchEngaged - - Public Property EngineDrivelinePower As Single Implements ISignals.EngineDrivelinePower - - Public Property EngineDrivelineTorque As Single Implements ISignals.EngineDrivelineTorque - - Public Property EngineMotoringPower As Single Implements ISignals.EngineMotoringPower - - Public Property EngineSpeed As Integer Implements ISignals.EngineSpeed - - Public Property SmartElectrics As Boolean Implements ISignals.SmartElectrics - Get - Return _smartElectrics - End Get - Set(value As Boolean) - - _smartElectrics=value - - Debug.WriteLine(String.Format("SmartElectrics {0}", _smartElectrics)) - - End Set - - end property - - - Public Property SmartPneumatics As Boolean Implements ISignals.SmartPneumatics - - Public Property TotalCycleTimeSeconds As Integer Implements ISignals.TotalCycleTimeSeconds - - Public Property PreExistingAuxPower As Single Implements ISignals.PreExistingAuxPower - - Public Property Idle As Boolean Implements ISignals.Idle - - Public Property InNeutral As Boolean Implements ISignals.InNeutral - - - -End Class - - - diff --git a/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb b/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb index 6b3d7f6e8817c6cec6e000729f0614b2925b64e1..d2a2f15b70e798811c446961e9c2c79d59fe51a6 100644 --- a/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb +++ b/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb @@ -8,7 +8,6 @@ ' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ' ' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.Collections ''' <summary> ''' File Browser for Open/Save File dialogs and Folder Browser. Features File History and Favorite Folders. @@ -22,143 +21,143 @@ Imports System.Collections ''' File history is unique for each ID. Folder history is global. ''' </remarks> Public Class cFileBrowser - Private Initialized As Boolean - Private MyID As String - Private MyExt As String() - Private Dlog As FB_Dialog - Private NoExt As Boolean - Private bFolderBrowser As Boolean - Private bLightMode As Boolean + Private Initialized As Boolean + Private MyID As String + Private MyExt As String() + Private Dlog As FB_Dialog + Private NoExt As Boolean + Private bFolderBrowser As Boolean + Private bLightMode As Boolean - ''' <summary> - ''' New cFileBrowser instance - ''' </summary> - ''' <param name="ID">Needed to save the file history when not using LightMode.</param> - ''' <param name="folderBrowser">Browse folders instead of files.</param> - ''' <param name="lightMode">If enabled file history is not saved.</param> - ''' <remarks></remarks> - Public Sub New(ByVal ID As String, Optional ByVal folderBrowser As Boolean = False, - Optional ByVal lightMode As Boolean = False) - Initialized = False - MyID = ID - NoExt = True - bFolderBrowser = folderBrowser - bLightMode = LightMode - End Sub + ''' <summary> + ''' New cFileBrowser instance + ''' </summary> + ''' <param name="ID">Needed to save the file history when not using LightMode.</param> + ''' <param name="folderBrowser">Browse folders instead of files.</param> + ''' <param name="lightMode">If enabled file history is not saved.</param> + ''' <remarks></remarks> + Public Sub New(ByVal ID As String, Optional ByVal folderBrowser As Boolean = False, + Optional ByVal lightMode As Boolean = False) + Initialized = False + MyID = ID + NoExt = True + bFolderBrowser = folderBrowser + bLightMode = LightMode + End Sub - ''' <summary> - ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="multiFile">Allow selecting multiple files.</param> - ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function OpenDialog(ByVal path As String, Optional ByVal multiFile As Boolean = False, - Optional ByVal Ext As String = "") As Boolean - Return CustomDialog(path, True, False, tFbExtMode.MultiExt, MultiFile, Ext, "Open") - End Function + ''' <summary> + ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="multiFile">Allow selecting multiple files.</param> + ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function OpenDialog(ByVal path As String, Optional ByVal multiFile As Boolean = False, + Optional ByVal Ext As String = "") As Boolean + Return CustomDialog(path, True, False, tFbExtMode.MultiExt, MultiFile, Ext, "Open") + End Function - ''' <summary> - ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="forceExt">Force predefined file extension.</param> - ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function SaveDialog(ByVal path As String, Optional ByVal forceExt As Boolean = True, - Optional ByVal Ext As String = "") As Boolean - Dim x As tFbExtMode - If ForceExt Then - x = tFbExtMode.ForceExt - Else - x = tFbExtMode.SingleExt - End If - Return CustomDialog(path, False, True, x, False, Ext, "Save As") - End Function + ''' <summary> + ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="forceExt">Force predefined file extension.</param> + ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function SaveDialog(ByVal path As String, Optional ByVal forceExt As Boolean = True, + Optional ByVal Ext As String = "") As Boolean + Dim x As tFbExtMode + If ForceExt Then + x = tFbExtMode.ForceExt + Else + x = tFbExtMode.SingleExt + End If + Return CustomDialog(path, False, True, x, False, Ext, "Save As") + End Function - ''' <summary> - ''' Custom open/save dialog. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="fileMustExist">Selected file must exist.</param> - ''' <param name="overwriteCheck">If file already exists user will be asked to overwrite.</param> - ''' <param name="extMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> - ''' <param name="multiFile">Allow to select multiple files.</param> - ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <param name="title">Dialog title.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function CustomDialog(ByVal path As String, ByVal fileMustExist As Boolean, ByVal overwriteCheck As Boolean, - ByVal extMode As tFbExtMode, ByVal multiFile As Boolean, ByVal ext As String, - Optional title As String = "File Browser") As Boolean - If Not Initialized Then Init() - Return Dlog.Browse(path, fileMustExist, overwriteCheck, extMode, multiFile, ext, Title) - End Function + ''' <summary> + ''' Custom open/save dialog. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="fileMustExist">Selected file must exist.</param> + ''' <param name="overwriteCheck">If file already exists user will be asked to overwrite.</param> + ''' <param name="extMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> + ''' <param name="multiFile">Allow to select multiple files.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <param name="title">Dialog title.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function CustomDialog(ByVal path As String, ByVal fileMustExist As Boolean, ByVal overwriteCheck As Boolean, + ByVal extMode As tFbExtMode, ByVal multiFile As Boolean, ByVal ext As String, + Optional title As String = "File Browser") As Boolean + If Not Initialized Then Init() + Return Dlog.Browse(path, fileMustExist, overwriteCheck, extMode, multiFile, ext, Title) + End Function - 'Manually update File History - ''' <summary> - ''' Add file to file history. - ''' </summary> - ''' <param name="path">File to be added to file history.</param> - ''' <remarks></remarks> - Public Sub UpdateHistory(ByVal path As String) - If Not Initialized Then Init() - Dlog.UpdateHistory(Path) - End Sub + 'Manually update File History + ''' <summary> + ''' Add file to file history. + ''' </summary> + ''' <param name="path">File to be added to file history.</param> + ''' <remarks></remarks> + Public Sub UpdateHistory(ByVal path As String) + If Not Initialized Then Init() + Dlog.UpdateHistory(Path) + End Sub - ''' <summary> - ''' Save file history (if not LightMode) and global folder history. - ''' </summary> - ''' <remarks></remarks> - Public Sub Close() - If Initialized Then - Dlog.SaveAndClose() - Initialized = False - End If - Dlog = Nothing - End Sub + ''' <summary> + ''' Save file history (if not LightMode) and global folder history. + ''' </summary> + ''' <remarks></remarks> + Public Sub Close() + If Initialized Then + Dlog.SaveAndClose() + Initialized = False + End If + Dlog = Nothing + End Sub - Private Sub Init() - Dlog = New FB_Dialog(bLightMode) - Dlog.ID = MyID - If Not NoExt Then Dlog.Extensions = MyExt - If bFolderBrowser Then Dlog.SetFolderBrowser() - Initialized = True - End Sub + Private Sub Init() + Dlog = New FB_Dialog(bLightMode) + Dlog.ID = MyID + If Not NoExt Then Dlog.Extensions = MyExt + If bFolderBrowser Then Dlog.SetFolderBrowser() + Initialized = True + End Sub - ''' <summary> - ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property Extensions() As String() - Get - Return MyExt - End Get - Set(ByVal value As String()) - MyExt = value - NoExt = False - End Set - End Property + ''' <summary> + ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public Property Extensions() As String() + Get + Return MyExt + End Get + Set(ByVal value As String()) + MyExt = value + NoExt = False + End Set + End Property - ''' <summary> - ''' Selected file(s) oder folder (if FolderBrowser) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public ReadOnly Property Files() As String() - Get - If Initialized Then - Return Dlog.Files - Else - Return New String() {""} - End If - End Get - End Property + ''' <summary> + ''' Selected file(s) oder folder (if FolderBrowser) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public ReadOnly Property Files() As String() + Get + If Initialized Then + Return Dlog.Files + Else + Return New String() {""} + End If + End Get + End Property End Class diff --git a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb index bc17e7d3e476e8843b5182d9585956a6b23caba8..aa08822d8c0c4f7612a90afc14ad2b784de1937a 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb @@ -9,7 +9,6 @@ ' ' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports VectoAuxiliaries Imports VectoAuxiliaries.Electrics Imports VectoAuxiliaries.Pneumatics Imports System.ComponentModel @@ -17,1521 +16,1528 @@ Imports System.Windows.Forms Imports System.Drawing Imports VectoAuxiliaries.Hvac Imports System.IO +Imports TUGraz.VectoCore.BusAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Util Public Class frmAuxiliaryConfig #Region "Fields" - Public auxConfig As AuxiliaryConfig - Public originalConfig As AuxiliaryConfig ' required to test if the form is dirty - Private TabColors As Dictionary(Of TabPage, Color) = New Dictionary(Of TabPage, Color)() - Private processing As Boolean = False - Private SecondsIntoCycle As Integer = 0 - Private vectoFile As String = "" - Private aauxPath As String = "" - Private auxFile As String - Private cmFilesList As String() - Private SaveClicked As Boolean - Private electricalConsumerBinding As New BindingList(Of IElectricalConsumer) + Public auxConfig As AuxiliaryConfig + Public originalConfig As AuxiliaryConfig ' required to test if the form is dirty + Private TabColors As Dictionary(Of TabPage, Color) = New Dictionary(Of TabPage, Color)() + Private processing As Boolean = False + Private SecondsIntoCycle As Integer = 0 + Private vectoFile As String = "" + Private aauxPath As String = "" + Private auxFile As String + Private cmFilesList As String() + Private SaveClicked As Boolean + Private electricalConsumerBinding As New BindingList(Of IElectricalConsumer) #End Region - Private Function ValidateAuxFileName(filename As String) As Boolean + Private Function ValidateAuxFileName(filename As String) As Boolean - Dim message As String = String.Empty + Dim message As String = String.Empty - If Not FilePathUtils.ValidateFilePath(filename, ".aaux", message) Then - MessageBox.Show(message) - End If + If Not FilePathUtils.ValidateFilePath(filename, ".aaux", message) Then + MessageBox.Show(message) + End If - Return True - End Function + Return True + End Function - 'Constructor - Public Sub New(ByVal fileName As String, ByVal vectoFileName As String) + 'Constructor + Public Sub New(ByVal fileName As String, ByVal vectoFileName As String) - If Not ValidateAuxFileName(fileName) Then - Me.DialogResult = Windows.Forms.DialogResult.Abort - Me.Close() - End If + If Not ValidateAuxFileName(fileName) Then + Me.DialogResult = Windows.Forms.DialogResult.Abort + Me.Close() + End If - Me.vectoFile = vectoFileName - Me.aauxPath = Path.GetDirectoryName(Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName)) + Me.vectoFile = vectoFileName + Me.aauxPath = Path.GetDirectoryName(Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName)) - ' This call is required by the designer. - InitializeComponent() + ' This call is required by the designer. + InitializeComponent() - ' Add any initialization after the InitializeComponent() call. - auxFile = Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName) + ' Add any initialization after the InitializeComponent() call. + auxFile = Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName) - Try + Try - auxConfig = New AuxiliaryConfig(auxFile) - originalConfig = New AuxiliaryConfig(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) + auxConfig = New AuxiliaryConfig(auxFile) + originalConfig = New AuxiliaryConfig(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) - Catch ex As Exception + Catch ex As Exception - MessageBox.Show("The filename you supplied {0} was invalid or could not be found ", fileName) - Me.DialogResult = Windows.Forms.DialogResult.Abort - Me.Close() + MessageBox.Show("The filename you supplied {0} was invalid or could not be found ", fileName) + Me.DialogResult = Windows.Forms.DialogResult.Abort + Me.Close() - End Try - End Sub + End Try + End Sub - 'Validation + 'Validation #Region "Validation Helpers" - Public Function IsPostiveNumber(ByVal test As String) As Boolean + Public Function IsPostiveNumber(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As Single + Dim number As Single - If Not Single.TryParse(test, number) Then Return False + If Not Single.TryParse(test, number) Then Return False - If number <= 0 Then Return False + If number <= 0 Then Return False - Return True - End Function + Return True + End Function - Public Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean + Public Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As Single + Dim number As Single - If Not Single.TryParse(test, number) Then Return False + If Not Single.TryParse(test, number) Then Return False - If number < 0 Then Return False + If number < 0 Then Return False - Return True - End Function + Return True + End Function - Public Function IsNumberBetweenZeroandOne(test As String) As Boolean + Public Function IsNumberBetweenZeroandOne(test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As Single + Dim number As Single - If Not Single.TryParse(test, number) Then Return False + If Not Single.TryParse(test, number) Then Return False - If number < 0 OrElse number > 1 Then Return False + If number < 0 OrElse number > 1 Then Return False - Return True - End Function + Return True + End Function - Public Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean + Public Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - 'if not integer then return false + 'if not integer then return false - Dim number As Integer + Dim number As Integer - If Not Integer.TryParse(test, number) Then Return False + If Not Integer.TryParse(test, number) Then Return False - If number < 0 Then Return False + If number < 0 Then Return False - Return True - End Function + Return True + End Function #End Region #Region "Validation Control" - '****** PNEUMATIC VALIDATION - Public Sub Validating_PneumaticHandler(sender As Object, e As CancelEventArgs) _ - Handles txtAdBlueNIperMinute.Validating, txtBrakingWithRetarderNIperKG.Validating, - txtBrakingNoRetarderNIperKG.Validating, txtAirControlledSuspensionNIperMinute.Validating, - txtBreakingPerKneelingNIperKGinMM.Validating, txtSmartRegenFractionTotalAirDemand.Validating, - txtPerStopBrakeActuationNIperKG.Validating, txtPerDoorOpeningNI.Validating, - txtOverrunUtilisationForCompressionFraction.Validating, txtNonSmartRegenFractionTotalAirDemand.Validating, - txtDeadVolumeLitres.Validating, txtDeadVolBlowOutsPerLitresperHour.Validating, - txtKneelingHeightMillimeters.Validating, txtCompressorMap.Validating, txtCompressorGearRatio.Validating, - txtCompressorGearEfficiency.Validating, txtActuationsMap.Validating, cboDoors.Validating, - cboAirSuspensionControl.Validating, cboAdBlueDosing.Validating - - e.Cancel = Not Validate_Pneumatics() - End Sub - - Public Function Validate_Pneumatics() As Boolean - - Dim result As Boolean = True - - 'PNEUMATIC AUXILLARIES PART - '*************************** - - - 'AdBlue NI per Minute : txtAdBlueNIperMinute - If Not IsZeroOrPostiveNumber(txtAdBlueNIperMinute.Text) Then - ErrorProvider.SetError(txtAdBlueNIperMinute, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtAdBlueNIperMinute, String.Empty) - End If - - 'Overrun Utilisation For Compression Fraction : txtOverrunUtilisationForCompressionFraction - If Not IsNumberBetweenZeroandOne(txtOverrunUtilisationForCompressionFraction.Text) Then - ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, "Please provide a non negative between 0 and 1.") - result = False - Else - ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, String.Empty) - End If - - 'Braking With Retarder NI per KG : txtBrakingWithRetarderNIperKG - If Not IsZeroOrPostiveNumber(txtBrakingWithRetarderNIperKG.Text) Then - ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, String.Empty) - End If - - 'Braking No Retarder NI per KG : txtBrakingNoRetarderNIperKG - If Not IsZeroOrPostiveNumber(txtBrakingNoRetarderNIperKG.Text) Then - ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, String.Empty) - End If - - 'Breaking Per Kneeling NI per KG in MM : txtBreakingPerKneelingNIperKGinMM - If Not IsZeroOrPostiveNumber(txtBreakingPerKneelingNIperKGinMM.Text) Then - ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, String.Empty) - End If - - 'Per Door Opening NI : txtPerDoorOpeningNI - If Not IsZeroOrPostiveNumber(txtPerDoorOpeningNI.Text) Then - ErrorProvider.SetError(txtPerDoorOpeningNI, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtPerDoorOpeningNI, String.Empty) - End If - - 'Per Stop Brake Actuation NI per KG : txtPerStopBrakeActuationNIperKG - If Not IsZeroOrPostiveNumber(txtPerStopBrakeActuationNIperKG.Text) Then - ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, String.Empty) - End If - - 'Air Controlled Suspension NI per Minute : txtAirControlledSuspensionNIperMinute - If Not IsZeroOrPostiveNumber(txtAirControlledSuspensionNIperMinute.Text) Then - ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, String.Empty) - End If - - 'Non Smart Regen Fraction Total Air Demand : txtNonSmartRegenFractionTotalAirDemand - If Not IsZeroOrPostiveNumber(txtNonSmartRegenFractionTotalAirDemand.Text) Then - ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, String.Empty) - End If - - 'Smart Regen Fraction Total Air Demand : txtSmartRegenFractionTotalAirDemand - If Not IsNumberBetweenZeroandOne(txtSmartRegenFractionTotalAirDemand.Text) Then - ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, "Please provide a non negative between 0 and 1.") - result = False - Else - ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, String.Empty) - End If - - - 'Dead Volume Litres : txtDeadVolumeLitres - If Not IsZeroOrPostiveNumber(txtDeadVolumeLitres.Text) Then - ErrorProvider.SetError(txtDeadVolumeLitres, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtDeadVolumeLitres, String.Empty) - End If - - - 'Dead Vol BlowOuts Per Litresper Hour : txtDeadVolBlowOutsPerLitresperHour - If Not IsZeroOrPostiveNumber(txtDeadVolBlowOutsPerLitresperHour.Text) Then - ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, String.Empty) - End If - - - 'USER CONFIG PART - '***************************************************************************************** - 'Compressor Map path : txtCompressorMap - 'Test for empty after trim - If txtCompressorMap.Text.Trim.Length = 0 Then - ErrorProvider.SetError(txtCompressorMap, "Please enter the localtion of a valid compressor map.") - result = False - Else - ErrorProvider.SetError(txtCompressorMap, String.Empty) - End If - 'Test File is valid - Dim comp As CompressorMap - Try - - comp = New CompressorMap(FilePathUtils.ResolveFilePath(aauxPath, txtCompressorMap.Text)) - comp.Initialise() - ErrorProvider.SetError(txtCompressorMap, String.Empty) - Catch ex As Exception - ErrorProvider.SetError(txtCompressorMap, - "Error : map is invalid or cannot be found, please select a Cvalid compressor map") - result = False - End Try - - 'Compressor Gear Efficiency : txtCompressorGearEfficiency" - If Not IsNumberBetweenZeroandOne(txtCompressorGearEfficiency.Text) Then - ErrorProvider.SetError(txtCompressorGearEfficiency, "Please enter a number between 0 and 1") - result = False - Else - ErrorProvider.SetError(txtCompressorGearEfficiency, String.Empty) - End If - - 'Compressor Gear Ratio : txtCompressorGearRatio - If Not IsPostiveNumber(txtCompressorGearRatio.Text) Then - ErrorProvider.SetError(txtCompressorGearRatio, "Please enter a number greater than 0.") - result = False - Else - ErrorProvider.SetError(txtCompressorGearRatio, String.Empty) - End If - - - 'Actuations Map : txtActuationsMap - If txtActuationsMap.Text.Trim.Length = 0 Then - ErrorProvider.SetError(txtActuationsMap, "Please enter the localtion of a valid Pneumatic Actuations map.") - result = False - Else - ErrorProvider.SetError(txtActuationsMap, String.Empty) - End If - 'Test File is valid - Dim actuations As PneumaticActuationsMAP - Try - - actuations = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(aauxPath, txtActuationsMap.Text)) - actuations.Initialise() - ErrorProvider.SetError(txtActuationsMap, String.Empty) - Catch ex As Exception - ErrorProvider.SetError(txtActuationsMap, - "Error : Pneumatic Actuations map is invalid or cannot be found, please select a valid map") - result = False - End Try - - - 'NOT Required but included here so readers can see this is a positive ommission - '****************************************************************************** - 'Smart Air Compression : chkSmartAirCompression - 'Smart Regeneration : chkSmartRegeneration - 'Retarder Brake : chkRetarderBrake - - 'txtKneelingHeightMillimeters : txtKneelingHeightMillimeters - If Not IsZeroOrPostiveNumber(txtKneelingHeightMillimeters.Text) Then - ErrorProvider.SetError(txtKneelingHeightMillimeters, "Please enter a number greater than 0.") - result = False - Else - ErrorProvider.SetError(txtKneelingHeightMillimeters, String.Empty) - End If - - 'cboAirSuspensionControl : cboAirSuspensionControl - If cboAirSuspensionControl.SelectedIndex < 1 Then - ErrorProvider.SetError(cboAirSuspensionControl, "Please make a selection.") - result = False - Else - ErrorProvider.SetError(cboAirSuspensionControl, String.Empty) - End If - - 'cboAdBlueDosing : cboAdBlueDosing - If cboAdBlueDosing.SelectedIndex < 1 Then - ErrorProvider.SetError(cboAdBlueDosing, "Please make a selection.") - result = False - Else - ErrorProvider.SetError(cboAdBlueDosing, String.Empty) - End If - - 'cboDoors : cboDoors - If cboDoors.SelectedIndex < 1 Then - ErrorProvider.SetError(cboDoors, "Please make a selection.") - result = False - Else - ErrorProvider.SetError(cboDoors, String.Empty) - End If - - - 'Set Tab Color - - UpdateTabStatus("tabPneumaticConfig", result) - - - Return result - End Function - - '***** ELECTRICAL VALIDATION - Public Sub Validating_ElectricsHandler(sender As Object, e As CancelEventArgs) _ - Handles txtPowernetVoltage.Validating, txtAlternatorMapPath.Validating, txtAlternatorGearEfficiency.Validating, - txtDoorActuationTimeSeconds.Validating, txtStoredEnergyEfficiency.Validating - - e.Cancel = Not Validate_Electrics() - End Sub - - Public Function Validate_Electrics() As Boolean - - Dim result As Boolean = True - - - 'Powernet Voltage : txtPowernetVoltage - If Not IsPostiveNumber(txtPowernetVoltage.Text) Then - ErrorProvider.SetError(txtPowernetVoltage, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtPowernetVoltage, String.Empty) - End If - - - 'Alternator Map path : txtAlternatorMapPath - 'Test for empty after trim - If txtAlternatorMapPath.Text.Trim.Length = 0 Then - ErrorProvider.SetError(txtAlternatorMapPath, "Please enter the localtion of a valid alternator map.") - result = False - Else - ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) - End If + '****** PNEUMATIC VALIDATION + Public Sub Validating_PneumaticHandler(sender As Object, e As CancelEventArgs) _ + Handles txtAdBlueNIperMinute.Validating, txtBrakingWithRetarderNIperKG.Validating, + txtBrakingNoRetarderNIperKG.Validating, txtAirControlledSuspensionNIperMinute.Validating, + txtBreakingPerKneelingNIperKGinMM.Validating, txtSmartRegenFractionTotalAirDemand.Validating, + txtPerStopBrakeActuationNIperKG.Validating, txtPerDoorOpeningNI.Validating, + txtOverrunUtilisationForCompressionFraction.Validating, txtNonSmartRegenFractionTotalAirDemand.Validating, + txtDeadVolumeLitres.Validating, txtDeadVolBlowOutsPerLitresperHour.Validating, + txtKneelingHeightMillimeters.Validating, txtCompressorMap.Validating, txtCompressorGearRatio.Validating, + txtCompressorGearEfficiency.Validating, txtActuationsMap.Validating, cboDoors.Validating, + cboAirSuspensionControl.Validating, cboAdBlueDosing.Validating + + e.Cancel = Not Validate_Pneumatics() + End Sub + + Public Function Validate_Pneumatics() As Boolean + + Dim result As Boolean = True + + 'PNEUMATIC AUXILLARIES PART + '*************************** + + + 'AdBlue NI per Minute : txtAdBlueNIperMinute + If Not IsZeroOrPostiveNumber(txtAdBlueNIperMinute.Text) Then + ErrorProvider.SetError(txtAdBlueNIperMinute, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtAdBlueNIperMinute, String.Empty) + End If + + 'Overrun Utilisation For Compression Fraction : txtOverrunUtilisationForCompressionFraction + If Not IsNumberBetweenZeroandOne(txtOverrunUtilisationForCompressionFraction.Text) Then + ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, "Please provide a non negative between 0 and 1.") + result = False + Else + ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, String.Empty) + End If + + 'Braking With Retarder NI per KG : txtBrakingWithRetarderNIperKG + If Not IsZeroOrPostiveNumber(txtBrakingWithRetarderNIperKG.Text) Then + ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, String.Empty) + End If + + 'Braking No Retarder NI per KG : txtBrakingNoRetarderNIperKG + If Not IsZeroOrPostiveNumber(txtBrakingNoRetarderNIperKG.Text) Then + ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, String.Empty) + End If + + 'Breaking Per Kneeling NI per KG in MM : txtBreakingPerKneelingNIperKGinMM + If Not IsZeroOrPostiveNumber(txtBreakingPerKneelingNIperKGinMM.Text) Then + ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, String.Empty) + End If + + 'Per Door Opening NI : txtPerDoorOpeningNI + If Not IsZeroOrPostiveNumber(txtPerDoorOpeningNI.Text) Then + ErrorProvider.SetError(txtPerDoorOpeningNI, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtPerDoorOpeningNI, String.Empty) + End If + + 'Per Stop Brake Actuation NI per KG : txtPerStopBrakeActuationNIperKG + If Not IsZeroOrPostiveNumber(txtPerStopBrakeActuationNIperKG.Text) Then + ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, String.Empty) + End If + + 'Air Controlled Suspension NI per Minute : txtAirControlledSuspensionNIperMinute + If Not IsZeroOrPostiveNumber(txtAirControlledSuspensionNIperMinute.Text) Then + ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, String.Empty) + End If + + 'Non Smart Regen Fraction Total Air Demand : txtNonSmartRegenFractionTotalAirDemand + If Not IsZeroOrPostiveNumber(txtNonSmartRegenFractionTotalAirDemand.Text) Then + ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, String.Empty) + End If + + 'Smart Regen Fraction Total Air Demand : txtSmartRegenFractionTotalAirDemand + If Not IsNumberBetweenZeroandOne(txtSmartRegenFractionTotalAirDemand.Text) Then + ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, "Please provide a non negative between 0 and 1.") + result = False + Else + ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, String.Empty) + End If + + + 'Dead Volume Litres : txtDeadVolumeLitres + If Not IsZeroOrPostiveNumber(txtDeadVolumeLitres.Text) Then + ErrorProvider.SetError(txtDeadVolumeLitres, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtDeadVolumeLitres, String.Empty) + End If + + + 'Dead Vol BlowOuts Per Litresper Hour : txtDeadVolBlowOutsPerLitresperHour + If Not IsZeroOrPostiveNumber(txtDeadVolBlowOutsPerLitresperHour.Text) Then + ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, String.Empty) + End If + + + 'USER CONFIG PART + '***************************************************************************************** + 'Compressor Map path : txtCompressorMap + 'Test for empty after trim + If txtCompressorMap.Text.Trim.Length = 0 Then + ErrorProvider.SetError(txtCompressorMap, "Please enter the localtion of a valid compressor map.") + result = False + Else + ErrorProvider.SetError(txtCompressorMap, String.Empty) + End If + 'Test File is valid + Dim comp As CompressorMap + Try + + comp = New CompressorMap(FilePathUtils.ResolveFilePath(aauxPath, txtCompressorMap.Text)) + comp.Initialise() + ErrorProvider.SetError(txtCompressorMap, String.Empty) + Catch ex As Exception + ErrorProvider.SetError(txtCompressorMap, + "Error : map is invalid or cannot be found, please select a Cvalid compressor map") + result = False + End Try + + 'Compressor Gear Efficiency : txtCompressorGearEfficiency" + If Not IsNumberBetweenZeroandOne(txtCompressorGearEfficiency.Text) Then + ErrorProvider.SetError(txtCompressorGearEfficiency, "Please enter a number between 0 and 1") + result = False + Else + ErrorProvider.SetError(txtCompressorGearEfficiency, String.Empty) + End If + + 'Compressor Gear Ratio : txtCompressorGearRatio + If Not IsPostiveNumber(txtCompressorGearRatio.Text) Then + ErrorProvider.SetError(txtCompressorGearRatio, "Please enter a number greater than 0.") + result = False + Else + ErrorProvider.SetError(txtCompressorGearRatio, String.Empty) + End If + + + 'Actuations Map : txtActuationsMap + If txtActuationsMap.Text.Trim.Length = 0 Then + ErrorProvider.SetError(txtActuationsMap, "Please enter the localtion of a valid Pneumatic Actuations map.") + result = False + Else + ErrorProvider.SetError(txtActuationsMap, String.Empty) + End If + 'Test File is valid + Dim actuations As PneumaticActuationsMAP + Try + + actuations = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(aauxPath, txtActuationsMap.Text)) + actuations.Initialise() + ErrorProvider.SetError(txtActuationsMap, String.Empty) + Catch ex As Exception + ErrorProvider.SetError(txtActuationsMap, + "Error : Pneumatic Actuations map is invalid or cannot be found, please select a valid map") + result = False + End Try + + + 'NOT Required but included here so readers can see this is a positive ommission + '****************************************************************************** + 'Smart Air Compression : chkSmartAirCompression + 'Smart Regeneration : chkSmartRegeneration + 'Retarder Brake : chkRetarderBrake + + 'txtKneelingHeightMillimeters : txtKneelingHeightMillimeters + If Not IsZeroOrPostiveNumber(txtKneelingHeightMillimeters.Text) Then + ErrorProvider.SetError(txtKneelingHeightMillimeters, "Please enter a number greater than 0.") + result = False + Else + ErrorProvider.SetError(txtKneelingHeightMillimeters, String.Empty) + End If + + 'cboAirSuspensionControl : cboAirSuspensionControl + If cboAirSuspensionControl.SelectedIndex < 1 Then + ErrorProvider.SetError(cboAirSuspensionControl, "Please make a selection.") + result = False + Else + ErrorProvider.SetError(cboAirSuspensionControl, String.Empty) + End If + + 'cboAdBlueDosing : cboAdBlueDosing + If cboAdBlueDosing.SelectedIndex < 1 Then + ErrorProvider.SetError(cboAdBlueDosing, "Please make a selection.") + result = False + Else + ErrorProvider.SetError(cboAdBlueDosing, String.Empty) + End If + + 'cboDoors : cboDoors + If cboDoors.SelectedIndex < 1 Then + ErrorProvider.SetError(cboDoors, "Please make a selection.") + result = False + Else + ErrorProvider.SetError(cboDoors, String.Empty) + End If + + + 'Set Tab Color + + UpdateTabStatus("tabPneumaticConfig", result) + + + Return result + End Function + + '***** ELECTRICAL VALIDATION + Public Sub Validating_ElectricsHandler(sender As Object, e As CancelEventArgs) _ + Handles txtPowernetVoltage.Validating, txtAlternatorMapPath.Validating, txtAlternatorGearEfficiency.Validating, + txtDoorActuationTimeSeconds.Validating, txtStoredEnergyEfficiency.Validating + + e.Cancel = Not Validate_Electrics() + End Sub + + Public Function Validate_Electrics() As Boolean + + Dim result As Boolean = True + + + 'Powernet Voltage : txtPowernetVoltage + If Not IsPostiveNumber(txtPowernetVoltage.Text) Then + ErrorProvider.SetError(txtPowernetVoltage, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtPowernetVoltage, String.Empty) + End If + + + 'Alternator Map path : txtAlternatorMapPath + 'Test for empty after trim + If txtAlternatorMapPath.Text.Trim.Length = 0 Then + ErrorProvider.SetError(txtAlternatorMapPath, "Please enter the localtion of a valid alternator map.") + result = False + Else + ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) + End If - 'Test File is valid - Dim alt As ICombinedAlternator - Try - alt = New CombinedAlternator(FilePathUtils.ResolveFilePath(aauxPath, txtAlternatorMapPath.Text)) - ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) - Catch ex As Exception - ErrorProvider.SetError(txtAlternatorMapPath, - "Error : map is invalid or cannot be found, please select a valid alternator map") - result = False - End Try + 'Test File is valid + Dim alt As ICombinedAlternator + Try + alt = New CombinedAlternator(FilePathUtils.ResolveFilePath(aauxPath, txtAlternatorMapPath.Text)) + ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) + Catch ex As Exception + ErrorProvider.SetError(txtAlternatorMapPath, + "Error : map is invalid or cannot be found, please select a valid alternator map") + result = False + End Try - 'Alternator Gear Efficiency : txtAlternatorGearEfficiency - If Not IsNumberBetweenZeroandOne(txtAlternatorGearEfficiency.Text) Then - ErrorProvider.SetError(txtAlternatorGearEfficiency, "Please enter a number between 0 an 1") - result = False - Else - ErrorProvider.SetError(txtAlternatorGearEfficiency, String.Empty) - End If + 'Alternator Gear Efficiency : txtAlternatorGearEfficiency + If Not IsNumberBetweenZeroandOne(txtAlternatorGearEfficiency.Text) Then + ErrorProvider.SetError(txtAlternatorGearEfficiency, "Please enter a number between 0 an 1") + result = False + Else + ErrorProvider.SetError(txtAlternatorGearEfficiency, String.Empty) + End If - 'Door Action Time : txtDoorActuationTimeSeconds - If Not IsPostiveNumber(txtDoorActuationTimeSeconds.Text) Then - ErrorProvider.SetError(txtDoorActuationTimeSeconds, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtDoorActuationTimeSeconds, String.Empty) - End If + 'Door Action Time : txtDoorActuationTimeSeconds + If Not IsPostiveNumber(txtDoorActuationTimeSeconds.Text) Then + ErrorProvider.SetError(txtDoorActuationTimeSeconds, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtDoorActuationTimeSeconds, String.Empty) + End If - 'Stored Energy Efficiency : txtStoredEnergyEfficiency - If Not IsPostiveNumber(txtStoredEnergyEfficiency.Text) Then - ErrorProvider.SetError(txtStoredEnergyEfficiency, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtStoredEnergyEfficiency, String.Empty) - End If + 'Stored Energy Efficiency : txtStoredEnergyEfficiency + If Not IsPostiveNumber(txtStoredEnergyEfficiency.Text) Then + ErrorProvider.SetError(txtStoredEnergyEfficiency, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtStoredEnergyEfficiency, String.Empty) + End If - UpdateTabStatus("tabElectricalConfig", result) + UpdateTabStatus("tabElectricalConfig", result) - Return result - End Function + Return result + End Function - '****** HVAC VALIDATION - Public Sub Validating_HVACHandler(sender As Object, e As CancelEventArgs) _ - Handles txtSSMFilePath.Validating, txtBusDatabaseFilePath.Validating + '****** HVAC VALIDATION + Public Sub Validating_HVACHandler(sender As Object, e As CancelEventArgs) _ + Handles txtSSMFilePath.Validating, txtBusDatabaseFilePath.Validating - e.Cancel = Not Validate_HVAC() - End Sub + e.Cancel = Not Validate_HVAC() + End Sub - Public Function Validate_HVAC() As Boolean + Public Function Validate_HVAC() As Boolean - Dim result As Boolean = True - Dim message As String = "" + Dim result As Boolean = True + Dim message As String = "" - 'Validate abdb - Bus Database - Dim abdbFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text) - Dim bdb As New BusDatabase() - If bdb.Initialise(abdbFile) Then - ErrorProvider.SetError(txtBusDatabaseFilePath, String.Empty) - Else - result = False - ErrorProvider.SetError(Me.txtBusDatabaseFilePath, "Please choose a valid Steady State Model File (*.ABDB") - End If + 'Validate abdb - Bus Database + Dim abdbFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text) + Dim bdb As New BusDatabase() + If bdb.Initialise(abdbFile) Then + ErrorProvider.SetError(txtBusDatabaseFilePath, String.Empty) + Else + result = False + ErrorProvider.SetError(Me.txtBusDatabaseFilePath, "Please choose a valid Steady State Model File (*.ABDB") + End If - 'Try ahsm - HVac Steady State Model - Try + 'Try ahsm - HVac Steady State Model + Try - Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text) - Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) + Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text) + Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) - If ssmTool.Load(ahsmFile) Then - ErrorProvider.SetError(txtSSMFilePath, String.Empty) - Else - result = False - ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") - End If + If ssmTool.Load(ahsmFile) Then + ErrorProvider.SetError(txtSSMFilePath, String.Empty) + Else + result = False + ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") + End If - Catch ex As Exception - 'Just in case - ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") - result = False + Catch ex As Exception + 'Just in case + ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") + result = False - End Try + End Try - UpdateTabStatus("tabHVACConfig", result) + UpdateTabStatus("tabHVACConfig", result) - Return result - End Function + Return result + End Function - Public Function ValidateAll() As Boolean + Public Function ValidateAll() As Boolean - If Validate_Pneumatics() = False Or Validate_Electrics() = False Or Validate_HVAC() = False Then - Return False - End If + If Validate_Pneumatics() = False Or Validate_Electrics() = False Or Validate_HVAC() = False Then + Return False + End If - Return True - End Function + Return True + End Function - '***** IMPUTS VALIDATION + '***** IMPUTS VALIDATION #End Region - 'Form Controls & Events - Private Sub Dashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load + 'Form Controls & Events + Private Sub Dashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load - 'Required for OwnerDraw, this is required in order to color the tabs when a validation error occurs to draw - 'The attention of the user to the fact that attention is required on a particlar tab. - TabColors.Add(tabGeneralConfig, Control.DefaultBackColor) - TabColors.Add(tabElectricalConfig, Control.DefaultBackColor) - TabColors.Add(tabPneumaticConfig, Control.DefaultBackColor) - TabColors.Add(tabHVACConfig, Control.DefaultBackColor) + 'Required for OwnerDraw, this is required in order to color the tabs when a validation error occurs to draw + 'The attention of the user to the fact that attention is required on a particlar tab. + TabColors.Add(tabGeneralConfig, Control.DefaultBackColor) + TabColors.Add(tabElectricalConfig, Control.DefaultBackColor) + TabColors.Add(tabPneumaticConfig, Control.DefaultBackColor) + TabColors.Add(tabHVACConfig, Control.DefaultBackColor) - 'This is here only for testing purposes, the actual cycle will be a result of Vecto input. - cboCycle.SelectedIndex = 0 + 'This is here only for testing purposes, the actual cycle will be a result of Vecto input. + cboCycle.SelectedIndex = 0 - 'General Setup of all controls - SetupControls() + 'General Setup of all controls + SetupControls() - 'Binding Values in Aux environment to the input controls on relevent tabs in the form. - CreateBindings() + 'Binding Values in Aux environment to the input controls on relevent tabs in the form. + CreateBindings() - 'This function is neccesary because binding does not occur when the page is invisible, so a track across all of them - 'Is required in order to set the binding. This only needs to be done once at at setup time. after values are set in the - 'Aux environment either by setting defaults of reading and setting from the Auxillaries persistance file. - EnsureBinding() + 'This function is neccesary because binding does not occur when the page is invisible, so a track across all of them + 'Is required in order to set the binding. This only needs to be done once at at setup time. after values are set in the + 'Aux environment either by setting defaults of reading and setting from the Auxillaries persistance file. + EnsureBinding() - 'Additional atatched events - 'For Tab Coloring, this is the place where the background will get filled on the tab when attention is required. - AddHandler tabMain.DrawItem, New System.Windows.Forms.DrawItemEventHandler(AddressOf tabMain_DrawItem) + 'Additional atatched events + 'For Tab Coloring, this is the place where the background will get filled on the tab when attention is required. + AddHandler tabMain.DrawItem, New System.Windows.Forms.DrawItemEventHandler(AddressOf tabMain_DrawItem) - 'Select Electric Tab - tabMain.SelectTab(tabMain.TabPages("tabElectricalConfig")) + 'Select Electric Tab + tabMain.SelectTab(tabMain.TabPages("tabElectricalConfig")) - 'Enabled / Disables Smart Cards based on chkSmartElectrical - SetSmartCardEmabledStatus() + 'Enabled / Disables Smart Cards based on chkSmartElectrical + SetSmartCardEmabledStatus() - 'Merge Info data from ElectricalConsumer in a Default set into live set - 'This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. - auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.MergeInfoData() - End Sub + 'Merge Info data from ElectricalConsumer in a Default set into live set + 'This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. + auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.MergeInfoData() + End Sub - Private Sub frmAuxiliaryConfig_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + Private Sub frmAuxiliaryConfig_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing - If Me.DialogResult = Windows.Forms.DialogResult.Cancel Then Return + If Me.DialogResult = Windows.Forms.DialogResult.Cancel Then Return - Dim result As DialogResult + Dim result As DialogResult - If Not File.Exists(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) OrElse - Not auxConfig.ConfigValuesAreTheSameAs(originalConfig) Then + If Not File.Exists(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) OrElse + Not auxConfig.ConfigValuesAreTheSameAs(originalConfig) Then - result = - (MessageBox.Show("Would you like to save changes before closing?", "Save Changes", MessageBoxButtons.YesNoCancel, - MessageBoxIcon.Question)) + result = + (MessageBox.Show("Would you like to save changes before closing?", "Save Changes", MessageBoxButtons.YesNoCancel, + MessageBoxIcon.Question)) - Select Case result + Select Case result - Case DialogResult.Yes - 'save - If Not SaveFile() Then - e.Cancel = True - End If + Case DialogResult.Yes + 'save + If Not SaveFile() Then + e.Cancel = True + End If - Case DialogResult.No - 'just allow the form to close - 'without saving - Me.DialogResult = Windows.Forms.DialogResult.Cancel + Case DialogResult.No + 'just allow the form to close + 'without saving + Me.DialogResult = Windows.Forms.DialogResult.Cancel - Case DialogResult.Cancel - 'cancel the close - e.Cancel = True - Me.DialogResult = Windows.Forms.DialogResult.Cancel + Case DialogResult.Cancel + 'cancel the close + e.Cancel = True + Me.DialogResult = Windows.Forms.DialogResult.Cancel - End Select - Else - Me.DialogResult = Windows.Forms.DialogResult.Cancel - e.Cancel = False - End If - End Sub + End Select + Else + Me.DialogResult = Windows.Forms.DialogResult.Cancel + e.Cancel = False + End If + End Sub #Region "GridHandlers" - Private Sub gvElectricalConsumables_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ - Handles gvElectricalConsumables.CellValidating - - Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) - Dim s As Single - - - If e.ColumnIndex = -1 Then - - e.Cancel = True - Exit Sub - - End If + Private Sub gvElectricalConsumables_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ + Handles gvElectricalConsumables.CellValidating + + Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) + Dim s As Single + + + If e.ColumnIndex = -1 Then + + e.Cancel = True + Exit Sub + + End If - If column.ReadOnly Then Return - - Select Case column.Name + If column.ReadOnly Then Return + + Select Case column.Name - Case "NominalConsumptionAmps" - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If + Case "NominalConsumptionAmps" + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If - Case "NumberInActualVehicle" - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - Else - s = Single.Parse(e.FormattedValue.ToString()) - End If - If s Mod 1 > 0 OrElse s < 0 Then - MessageBox.Show("This value must be a positive whole number ( Integer ) ") - e.Cancel = True - End If + Case "NumberInActualVehicle" + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + Else + s = Single.Parse(e.FormattedValue.ToString()) + End If + If s Mod 1 > 0 OrElse s < 0 Then + MessageBox.Show("This value must be a positive whole number ( Integer ) ") + e.Cancel = True + End If - 'Veh Electronics &Engine - If e.RowIndex = 1 Then - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If + 'Veh Electronics &Engine + If e.RowIndex = 1 Then + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If - If chkSmartElectricals.Checked AndAlso s <> 0 Then - MessageBox.Show("This must be set to 0 in smart mode") - e.Cancel = True - ElseIf Not chkSmartElectricals.Checked AndAlso s <> 1 Then - MessageBox.Show("This must be set to 1 in classic mode") - e.Cancel = True - End If - End If + If chkSmartElectricals.Checked AndAlso s <> 0 Then + MessageBox.Show("This must be set to 0 in smart mode") + e.Cancel = True + ElseIf Not chkSmartElectricals.Checked AndAlso s <> 1 Then + MessageBox.Show("This must be set to 1 in classic mode") + e.Cancel = True + End If + End If - 'Exterior Bulb - If e.RowIndex = 14 Then - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - If s <> 1 Then - MessageBox.Show("This must be set 1") - e.Cancel = True - End If - End If + 'Exterior Bulb + If e.RowIndex = 14 Then + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + If s <> 1 Then + MessageBox.Show("This must be set 1") + e.Cancel = True + End If + End If - 'Bonus Bulbs - If e.RowIndex >= 15 AndAlso e.RowIndex <= 19 Then + 'Bonus Bulbs + If e.RowIndex >= 15 AndAlso e.RowIndex <= 19 Then - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - If s <> 0 AndAlso s <> 1 Then - MessageBox.Show("This must be set to 0 or 1") - e.Cancel = True - End If + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + If s <> 0 AndAlso s <> 1 Then + MessageBox.Show("This must be set to 0 or 1") + e.Cancel = True + End If - End If + End If - Case "PhaseIdle_TractionOn" - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - Else - s = Single.Parse(e.FormattedValue.ToString()) - End If - If s < 0 OrElse s > 1 Then - MessageBox.Show("This must be a value between 0 and 1 ") - e.Cancel = True - End If + Case "PhaseIdle_TractionOn" + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + Else + s = Single.Parse(e.FormattedValue.ToString()) + End If + If s < 0 OrElse s > 1 Then + MessageBox.Show("This must be a value between 0 and 1 ") + e.Cancel = True + End If - End Select - End Sub + End Select + End Sub - Private Sub SmartResult_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ - Handles gvResultsCardIdle.CellValidating, gvResultsCardTraction.CellValidating, gvResultsCardOverrun.CellValidating + Private Sub SmartResult_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ + Handles gvResultsCardIdle.CellValidating, gvResultsCardTraction.CellValidating, gvResultsCardOverrun.CellValidating - Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) + Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - End Sub + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + End Sub - Private Sub resultCard_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) _ - Handles gvResultsCardIdle.CellMouseUp, gvResultsCardTraction.CellMouseUp, gvResultsCardOverrun.CellMouseUp + Private Sub resultCard_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) _ + Handles gvResultsCardIdle.CellMouseUp, gvResultsCardTraction.CellMouseUp, gvResultsCardOverrun.CellMouseUp - Dim dgv As DataGridView = CType(sender, DataGridView) + Dim dgv As DataGridView = CType(sender, DataGridView) - If e.Button = MouseButtons.Right Then + If e.Button = MouseButtons.Right Then - resultCardContextMenu.Show(dgv, e.Location) - resultCardContextMenu.Show(Cursor.Position) + resultCardContextMenu.Show(dgv, e.Location) + resultCardContextMenu.Show(Cursor.Position) - End If - End Sub + End If + End Sub - Private Sub resultCardContextMenu_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ - Handles resultCardContextMenu.ItemClicked + Private Sub resultCardContextMenu_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ + Handles resultCardContextMenu.ItemClicked - Dim menu As ContextMenuStrip = CType(sender, ContextMenuStrip) + Dim menu As ContextMenuStrip = CType(sender, ContextMenuStrip) - Dim grid As DataGridView = DirectCast(menu.SourceControl, DataGridView) + Dim grid As DataGridView = DirectCast(menu.SourceControl, DataGridView) - Select Case e.ClickedItem.Text + Select Case e.ClickedItem.Text - Case "Delete" + Case "Delete" - For Each selectedRow As DataGridViewRow In grid.SelectedRows + For Each selectedRow As DataGridViewRow In grid.SelectedRows - If Not selectedRow.IsNewRow Then + If Not selectedRow.IsNewRow Then - grid.Rows.RemoveAt(selectedRow.Index) + grid.Rows.RemoveAt(selectedRow.Index) - End If + End If - Next + Next - Case "Insert" + Case "Insert" - End Select - End Sub + End Select + End Sub - Private Sub gvElectricalConsumables_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) _ - Handles gvElectricalConsumables.CellFormatting - End Sub + Private Sub gvElectricalConsumables_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) _ + Handles gvElectricalConsumables.CellFormatting + End Sub - Private Sub gvElectricalConsumables_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) _ - Handles gvElectricalConsumables.CellBeginEdit + Private Sub gvElectricalConsumables_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) _ + Handles gvElectricalConsumables.CellBeginEdit - If e.ColumnIndex = 4 AndAlso e.RowIndex = 0 Then + If e.ColumnIndex = 4 AndAlso e.RowIndex = 0 Then - MessageBox.Show("This cell is calculated and cannot be edited") - e.Cancel = True + MessageBox.Show("This cell is calculated and cannot be edited") + e.Cancel = True - End If - End Sub + End If + End Sub #End Region #Region "Button Handlers" - Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click - If SaveFile() Then + If SaveFile() Then - originalConfig.AssumeValuesOfOther(auxConfig) - Me.Close() + originalConfig.AssumeValuesOfOther(auxConfig) + Me.Close() - End If - End Sub + End If + End Sub - Private Function SaveFile() As Boolean + Private Function SaveFile() As Boolean - Dim result As Boolean + Dim result As Boolean - If Not ValidateAll() Then - If _ - (MessageBox.Show("There are invalid values. Do you want so save anyway?", "Save Changes", MessageBoxButtons.YesNo, - MessageBoxIcon.Question) = DialogResult.No) Then - Return False - End If - End If + If Not ValidateAll() Then + If _ + (MessageBox.Show("There are invalid values. Do you want so save anyway?", "Save Changes", MessageBoxButtons.YesNo, + MessageBoxIcon.Question) = DialogResult.No) Then + Return False + End If + End If - result = auxConfig.Save(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) + result = auxConfig.Save(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) - If Not result Then MessageBox.Show(String.Format("Unable to Save the file '{0}'", auxFile)) + If Not result Then MessageBox.Show(String.Format("Unable to Save the file '{0}'", auxFile)) - Return result - End Function + Return result + End Function - Private Function LoadFile() As Boolean + Private Function LoadFile() As Boolean - 'JSON METHOD - Dim result As Boolean + 'JSON METHOD + Dim result As Boolean - 'Release existing databindings - UnbindAllControls(Me) + 'Release existing databindings + UnbindAllControls(Me) - result = auxConfig.Load(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) + result = auxConfig.Load(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) - If Not result Then - MessageBox.Show(String.Format("Unable to load the file '{0}'", auxFile)) - Else - CreateBindings() - End If + If Not result Then + MessageBox.Show(String.Format("Unable to load the file '{0}'", auxFile)) + Else + CreateBindings() + End If - Return result - End Function + Return result + End Function - Private Sub btnFuelMap_Click(sender As Object, e As EventArgs) Handles btnFuelMap.Click + Private Sub btnFuelMap_Click(sender As Object, e As EventArgs) Handles btnFuelMap.Click - Dim fbAux As New cFileBrowser("AAUXFuelMap", False, False) + Dim fbAux As New cFileBrowser("AAUXFuelMap", False, False) - ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" - Dim fname As String = fFILE(vectoFile, True) + ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" + Dim fname As String = fFILE(vectoFile, True) - fbAux.Extensions = New String() {"vmap"} - ' If fbAux.OpenDialog(fFileRepl(fname, fPATH(VECTOfile))) Then - If fbAux.OpenDialog(fPATH(vectoFile)) Then + fbAux.Extensions = New String() {"vmap"} + ' If fbAux.OpenDialog(fFileRepl(fname, fPATH(VECTOfile))) Then + If fbAux.OpenDialog(fPATH(vectoFile)) Then - txtFuelMap.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) + txtFuelMap.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) - End If - End Sub + End If + End Sub - Private Sub btnAlternatorMapPath_Click(sender As Object, e As EventArgs) Handles btnAlternatorMapPath.Click + Private Sub btnAlternatorMapPath_Click(sender As Object, e As EventArgs) Handles btnAlternatorMapPath.Click - Dim fbAux As New cFileBrowser("AAUXALT", False, False) - fbAux.Extensions = New String() {"AALT"} + Dim fbAux As New cFileBrowser("AAUXALT", False, False) + fbAux.Extensions = New String() {"AALT"} - Dim suppliedAALTPath As String = txtAlternatorMapPath.Text - Dim absoluteAALTPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedAALTPath) - Dim message As String = String.Empty - Dim newFile As Boolean = False + Dim suppliedAALTPath As String = txtAlternatorMapPath.Text + Dim absoluteAALTPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedAALTPath) + Dim message As String = String.Empty + Dim newFile As Boolean = False - Dim validAALTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteAALTPath, ".aalt", message) - Dim fileExists As Boolean = File.Exists(absoluteAALTPath) + Dim validAALTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteAALTPath, ".aalt", message) + Dim fileExists As Boolean = File.Exists(absoluteAALTPath) - If suppliedAALTPath.Length > 0 AndAlso Not validAALTFile Then - MessageBox.Show(message) - Return - End If + If suppliedAALTPath.Length > 0 AndAlso Not validAALTFile Then + MessageBox.Show(message) + Return + End If - 'If file Exists, Check validity, else fire up a default SSM Config. - If fileExists Then - Try - Dim aaltFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteAALTPath) - Dim combinedAlt As ICombinedAlternator = New CombinedAlternator(aaltFile) - Catch ex As Exception - MessageBox.Show("The supplied .AALT File was invalid, aborting.") - Return - End Try - End If + 'If file Exists, Check validity, else fire up a default SSM Config. + If fileExists Then + Try + Dim aaltFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteAALTPath) + Dim combinedAlt As ICombinedAlternator = New CombinedAlternator(aaltFile) + Catch ex As Exception + MessageBox.Show("The supplied .AALT File was invalid, aborting.") + Return + End Try + End If - If Not fileExists Then + If Not fileExists Then - Dim needToFindOrCreateFile As Boolean = True - While needToFindOrCreateFile + Dim needToFindOrCreateFile As Boolean = True + While needToFindOrCreateFile - 'Find / Create file and configure. - If fbAux.CustomDialog(absoluteAALTPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then - txtAlternatorMapPath.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) - suppliedAALTPath = txtAlternatorMapPath.Text - absoluteAALTPath = FilePathUtils.ResolveFilePath(fPATH(vectoFile), suppliedAALTPath) + 'Find / Create file and configure. + If fbAux.CustomDialog(absoluteAALTPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then + txtAlternatorMapPath.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) + suppliedAALTPath = txtAlternatorMapPath.Text + absoluteAALTPath = FilePathUtils.ResolveFilePath(fPATH(vectoFile), suppliedAALTPath) - If _ - IO.File.Exists(absoluteAALTPath) OrElse - MsgBox("Do you want to create a new .AALT file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - needToFindOrCreateFile = False - newFile = True - End If - Else - needToFindOrCreateFile = False - End If + If _ + IO.File.Exists(absoluteAALTPath) OrElse + MsgBox("Do you want to create a new .AALT file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + needToFindOrCreateFile = False + newFile = True + End If + Else + needToFindOrCreateFile = False + End If - End While + End While - End If + End If - If fileExists OrElse newFile Then + If fileExists OrElse newFile Then - Using frm As New frmCombinedAlternators(absoluteAALTPath, New CombinedAlternatorSignals) - 'If Dialog result is OK, then take action else bail - If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then - If suppliedAALTPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then - txtAlternatorMapPath.Text = - If(suppliedAALTPath.Contains(aauxPath), suppliedAALTPath.Replace(aauxPath, ""), suppliedAALTPath) - Else - txtAlternatorMapPath.Text = fFileWoDir(suppliedAALTPath) - End If - Else - Return - End If - End Using - BindingContext(auxConfig.ElectricalUserInputsConfig).EndCurrentEdit() - Validate_Electrics() + Using frm As New frmCombinedAlternators(absoluteAALTPath, New CombinedAlternatorSignals) + 'If Dialog result is OK, then take action else bail + If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then + If suppliedAALTPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then + txtAlternatorMapPath.Text = + If(suppliedAALTPath.Contains(aauxPath), suppliedAALTPath.Replace(aauxPath, ""), suppliedAALTPath) + Else + txtAlternatorMapPath.Text = fFileWoDir(suppliedAALTPath) + End If + Else + Return + End If + End Using + BindingContext(auxConfig.ElectricalUserInputsConfig).EndCurrentEdit() + Validate_Electrics() - End If - End Sub + End If + End Sub - Private Sub btnCompressorMap_Click(sender As Object, e As EventArgs) Handles btnCompressorMap.Click + Private Sub btnCompressorMap_Click(sender As Object, e As EventArgs) Handles btnCompressorMap.Click - Dim fbAux As New cFileBrowser("AAUXComp", False, False) + Dim fbAux As New cFileBrowser("AAUXComp", False, False) - ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" - Dim fname As String = fFILE(vectoFile, True) + ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" + Dim fname As String = fFILE(vectoFile, True) - fbAux.Extensions = New String() {"ACMP"} - If fbAux.OpenDialog(Path.Combine(aauxPath, txtCompressorMap.Text)) Then + fbAux.Extensions = New String() {"ACMP"} + If fbAux.OpenDialog(Path.Combine(aauxPath, txtCompressorMap.Text)) Then - txtCompressorMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) + txtCompressorMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) - End If + End If - Validate_Pneumatics() + Validate_Pneumatics() - 'Causes binding to fire - txtCompressorMap.Focus() - End Sub + 'Causes binding to fire + txtCompressorMap.Focus() + End Sub - Private Sub btnActuationsMap_BindingContextChanged(sender As Object, e As EventArgs) _ - Handles btnActuationsMap.BindingContextChanged - End Sub + Private Sub btnActuationsMap_BindingContextChanged(sender As Object, e As EventArgs) _ + Handles btnActuationsMap.BindingContextChanged + End Sub - Private Sub btnActuationsMap_Click(sender As Object, e As EventArgs) Handles btnActuationsMap.Click + Private Sub btnActuationsMap_Click(sender As Object, e As EventArgs) Handles btnActuationsMap.Click - Dim fbAux As New cFileBrowser("AAUXPneuAct", False, False) + Dim fbAux As New cFileBrowser("AAUXPneuAct", False, False) - ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" - Dim fname As String = fFILE(vectoFile, True) + ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" + Dim fname As String = fFILE(vectoFile, True) - fbAux.Extensions = New String() {"APAC"} - If fbAux.OpenDialog(Path.Combine(aauxPath, txtActuationsMap.Text)) Then + fbAux.Extensions = New String() {"APAC"} + If fbAux.OpenDialog(Path.Combine(aauxPath, txtActuationsMap.Text)) Then - txtActuationsMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) + txtActuationsMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) - End If + End If - Validate_Pneumatics() + Validate_Pneumatics() - 'Causes Binding to fire. - txtActuationsMap.Focus() - End Sub + 'Causes Binding to fire. + txtActuationsMap.Focus() + End Sub - Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click - Me.DialogResult = Windows.Forms.DialogResult.Cancel - Me.Close() - End Sub + Me.DialogResult = Windows.Forms.DialogResult.Cancel + Me.Close() + End Sub - Private Sub btnBusDatabaseSource_Click(sender As Object, e As EventArgs) Handles btnBusDatabaseSource.Click + Private Sub btnBusDatabaseSource_Click(sender As Object, e As EventArgs) Handles btnBusDatabaseSource.Click - Dim fbAux As New cFileBrowser("AAUXBusDB", False, False) - Dim message As String = String.Empty + Dim fbAux As New cFileBrowser("AAUXBusDB", False, False) + Dim message As String = String.Empty - fbAux.Extensions = New String() {"abdb"} + fbAux.Extensions = New String() {"abdb"} - If fbAux.OpenDialog(Path.Combine(Path.GetDirectoryName(auxFile), txtBusDatabaseFilePath.Text)) Then + If fbAux.OpenDialog(Path.Combine(Path.GetDirectoryName(auxFile), txtBusDatabaseFilePath.Text)) Then - txtBusDatabaseFilePath.Focus() - txtBusDatabaseFilePath.Text = GetRelativePath(fbAux.Files(0), Path.GetDirectoryName(auxFile)) + txtBusDatabaseFilePath.Focus() + txtBusDatabaseFilePath.Text = GetRelativePath(fbAux.Files(0), Path.GetDirectoryName(auxFile)) - Dim busDB As New BusDatabase() + Dim busDB As New BusDatabase() - If Not busDB.Initialise(FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text)) Then + If Not busDB.Initialise(FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text)) Then - MessageBox.Show("Unable to load") + MessageBox.Show("Unable to load") - End If + End If - Validate_HVAC() - End If - End Sub + Validate_HVAC() + End If + End Sub - Private Sub btnSSMBSource_BindingContextChanged(sender As Object, e As EventArgs) _ - Handles btnSSMBSource.BindingContextChanged - End Sub + Private Sub btnSSMBSource_BindingContextChanged(sender As Object, e As EventArgs) _ + Handles btnSSMBSource.BindingContextChanged + End Sub - Private Sub btnSSMBSource_Click(sender As Object, e As EventArgs) Handles btnSSMBSource.Click + Private Sub btnSSMBSource_Click(sender As Object, e As EventArgs) Handles btnSSMBSource.Click - Dim fbAux As New cFileBrowser("AAUXSSM", False, False) - fbAux.Extensions = New String() {"AHSM"} + Dim fbAux As New cFileBrowser("AAUXSSM", False, False) + fbAux.Extensions = New String() {"AHSM"} - Dim suppliedSSMPath As String = txtSSMFilePath.Text.Trim() - Dim absoluteSSMPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) - Dim absoluteBusDatabasePath As String = FilePathUtils.ResolveFilePath(aauxPath, - Me.txtBusDatabaseFilePath.Text.Trim()) - Dim message As String = String.Empty - Dim newFile As Boolean = False + Dim suppliedSSMPath As String = txtSSMFilePath.Text.Trim() + Dim absoluteSSMPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) + Dim absoluteBusDatabasePath As String = FilePathUtils.ResolveFilePath(aauxPath, + Me.txtBusDatabaseFilePath.Text.Trim()) + Dim message As String = String.Empty + Dim newFile As Boolean = False - Dim validSSMTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteSSMPath, ".ahsm", message) - Dim fileExists As Boolean = File.Exists(absoluteSSMPath) + Dim validSSMTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteSSMPath, ".ahsm", message) + Dim fileExists As Boolean = File.Exists(absoluteSSMPath) - If suppliedSSMPath.Length > 0 AndAlso Not validSSMTFile Then - MessageBox.Show(message) - Return - End If + If suppliedSSMPath.Length > 0 AndAlso Not validSSMTFile Then + MessageBox.Show(message) + Return + End If - 'If file Exists, Check validity, else fire up a default SSM Config. - If File.Exists(absoluteSSMPath) Then - 'is file valid Try ahsm - HVac Steady State Model - Try - Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteSSMPath) - Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) - ssmTool.Load(ahsmFile) - Catch ex As Exception - MessageBox.Show("The supplied AHSM File was invalid, aborting.") - Return - End Try - End If + 'If file Exists, Check validity, else fire up a default SSM Config. + If File.Exists(absoluteSSMPath) Then + 'is file valid Try ahsm - HVac Steady State Model + Try + Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteSSMPath) + Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) + ssmTool.Load(ahsmFile) + Catch ex As Exception + MessageBox.Show("The supplied AHSM File was invalid, aborting.") + Return + End Try + End If - If Not fileExists Then + If Not fileExists Then - Dim needToFindOrCreateFile As Boolean = True - While needToFindOrCreateFile + Dim needToFindOrCreateFile As Boolean = True + While needToFindOrCreateFile - 'Find / Create file and configure. - If fbAux.CustomDialog(absoluteSSMPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then - txtSSMFilePath.Text = GetRelativePath(fbAux.Files(0), aauxPath) - suppliedSSMPath = txtSSMFilePath.Text - absoluteSSMPath = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) - If _ - IO.File.Exists(absoluteSSMPath) OrElse - MsgBox("Do you want to create a new .AHSM file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - needToFindOrCreateFile = False - newFile = True - End If - Else - needToFindOrCreateFile = False - End If + 'Find / Create file and configure. + If fbAux.CustomDialog(absoluteSSMPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then + txtSSMFilePath.Text = GetRelativePath(fbAux.Files(0), aauxPath) + suppliedSSMPath = txtSSMFilePath.Text + absoluteSSMPath = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) + If _ + IO.File.Exists(absoluteSSMPath) OrElse + MsgBox("Do you want to create a new .AHSM file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + needToFindOrCreateFile = False + newFile = True + End If + Else + needToFindOrCreateFile = False + End If - End While + End While - End If + End If - If fileExists OrElse newFile Then + If fileExists OrElse newFile Then - Using frm As New frmHVACTool(absoluteBusDatabasePath, absoluteSSMPath, vectoFile, Not fileExists) - If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then - If suppliedSSMPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then - txtSSMFilePath.Text = - If(suppliedSSMPath.Contains(aauxPath), suppliedSSMPath.Replace(aauxPath, ""), suppliedSSMPath) - Else - txtSSMFilePath.Text = fFileWoDir(suppliedSSMPath) - End If - Else - Return - End If - End Using - BindingContext(auxConfig.HvacUserInputsConfig).EndCurrentEdit() - Validate_HVAC() - - End If - End Sub + Using frm As New frmHVACTool(absoluteBusDatabasePath, absoluteSSMPath, vectoFile, Not fileExists) + If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then + If suppliedSSMPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then + txtSSMFilePath.Text = + If(suppliedSSMPath.Contains(aauxPath), suppliedSSMPath.Replace(aauxPath, ""), suppliedSSMPath) + Else + txtSSMFilePath.Text = fFileWoDir(suppliedSSMPath) + End If + Else + Return + End If + End Using + BindingContext(auxConfig.HvacUserInputsConfig).EndCurrentEdit() + Validate_HVAC() + + End If + End Sub #End Region - Private Sub chkSmartElectricals_CheckedChanged(sender As Object, e As EventArgs) _ - Handles chkSmartElectricals.CheckedChanged + Private Sub chkSmartElectricals_CheckedChanged(sender As Object, e As EventArgs) _ + Handles chkSmartElectricals.CheckedChanged - SetSmartCardEmabledStatus() - End Sub + SetSmartCardEmabledStatus() + End Sub #Region "File Viewer Button Events" - Private Sub btnAALTOpen_Click(sender As Object, e As EventArgs) Handles btnAALTOpen.Click + Private Sub btnAALTOpen_Click(sender As Object, e As EventArgs) Handles btnAALTOpen.Click - OpenFiles(fFileRepl(Me.txtAlternatorMapPath.Text, fPATH(vectoFile))) - End Sub + OpenFiles(fFileRepl(Me.txtAlternatorMapPath.Text, fPATH(vectoFile))) + End Sub - Private Sub btnOpenACMP_Click(sender As Object, e As EventArgs) Handles btnOpenACMP.Click + Private Sub btnOpenACMP_Click(sender As Object, e As EventArgs) Handles btnOpenACMP.Click - OpenFiles(fFileRepl(Me.txtCompressorMap.Text, fPATH(vectoFile))) - End Sub + OpenFiles(fFileRepl(Me.txtCompressorMap.Text, fPATH(vectoFile))) + End Sub - Private Sub btnOpenAPAC_Click(sender As Object, e As EventArgs) Handles btnOpenAPAC.Click + Private Sub btnOpenAPAC_Click(sender As Object, e As EventArgs) Handles btnOpenAPAC.Click - OpenFiles(fFileRepl(Me.txtActuationsMap.Text, fPATH(vectoFile))) - End Sub + OpenFiles(fFileRepl(Me.txtActuationsMap.Text, fPATH(vectoFile))) + End Sub - Private Sub btnOpenAHSM_Click(sender As Object, e As EventArgs) Handles btnOpenAHSM.Click + Private Sub btnOpenAHSM_Click(sender As Object, e As EventArgs) Handles btnOpenAHSM.Click - OpenFiles(fFileRepl(Me.txtSSMFilePath.Text, fPATH(vectoFile))) - End Sub + OpenFiles(fFileRepl(Me.txtSSMFilePath.Text, fPATH(vectoFile))) + End Sub - Private Sub btnOpenABDB_Click(sender As Object, e As EventArgs) Handles btnOpenABDB.Click + Private Sub btnOpenABDB_Click(sender As Object, e As EventArgs) Handles btnOpenABDB.Click - OpenFiles(fFileRepl(Me.txtBusDatabaseFilePath.Text, fPATH(vectoFile))) - End Sub + OpenFiles(fFileRepl(Me.txtBusDatabaseFilePath.Text, fPATH(vectoFile))) + End Sub #End Region - 'Overrides - Protected Overrides Function ProcessCmdKey(ByRef msg As Message, keyData As Keys) As Boolean + 'Overrides + Protected Overrides Function ProcessCmdKey(ByRef msg As Message, keyData As Keys) As Boolean - If keyData = Keys.Enter AndAlso Me.AcceptButton Is Nothing Then + If keyData = Keys.Enter AndAlso Me.AcceptButton Is Nothing Then - If TypeOf (Me.ActiveControl) Is TextBoxBase Then - Dim box As TextBoxBase = CType(Me.ActiveControl, TextBoxBase) + If TypeOf (Me.ActiveControl) Is TextBoxBase Then + Dim box As TextBoxBase = CType(Me.ActiveControl, TextBoxBase) - If box Is Nothing OrElse Not box.Multiline Then + If box Is Nothing OrElse Not box.Multiline Then - Me.SelectNextControl(Me.ActiveControl, True, True, True, True) - Return True + Me.SelectNextControl(Me.ActiveControl, True, True, True, True) + Return True - End If - End If + End If + End If - End If + End If - Return MyBase.ProcessCmdKey(msg, keyData) - End Function + Return MyBase.ProcessCmdKey(msg, keyData) + End Function - 'Helpers - Private Sub OpenFiles(ParamArray files() As String) + 'Helpers + Private Sub OpenFiles(ParamArray files() As String) - If files.Length = 0 Then Exit Sub + If files.Length = 0 Then Exit Sub - cmFilesList = files + cmFilesList = files - OpenWithToolStripMenuItem.Text = "Open with notepad" + OpenWithToolStripMenuItem.Text = "Open with notepad" - CmFiles.Show(Cursor.Position) - End Sub + CmFiles.Show(Cursor.Position) + End Sub - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ - Handles OpenWithToolStripMenuItem.Click - If Not FileOpenAlt(cmFilesList(0)) Then MsgBox("Failed to open file!") - End Sub + Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ + Handles OpenWithToolStripMenuItem.Click + If Not FileOpenAlt(cmFilesList(0)) Then MsgBox("Failed to open file!") + End Sub - Private Sub ShowInFolderToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ - Handles ShowInFolderToolStripMenuItem.Click - If IO.File.Exists(cmFilesList(0)) Then - Try - System.Diagnostics.Process.Start("explorer", "/select,""" & cmFilesList(0) & "") - Catch ex As Exception - MsgBox("Failed to open file!") - End Try - Else - MsgBox("File not found!") - End If - End Sub + Private Sub ShowInFolderToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ + Handles ShowInFolderToolStripMenuItem.Click + If IO.File.Exists(cmFilesList(0)) Then + Try + System.Diagnostics.Process.Start("explorer", "/select,""" & cmFilesList(0) & "") + Catch ex As Exception + MsgBox("Failed to open file!") + End Try + Else + MsgBox("File not found!") + End If + End Sub #Region "Tab Header Color Change" - Private Sub UpdateTabStatus(pageName As String, resultGood As Boolean) + Private Sub UpdateTabStatus(pageName As String, resultGood As Boolean) - Dim page As TabPage = tabMain.TabPages(pageName) + Dim page As TabPage = tabMain.TabPages(pageName) - If Not resultGood Then + If Not resultGood Then - SetTabHeader(page, Color.Red) + SetTabHeader(page, Color.Red) - Else - SetTabHeader(page, Control.DefaultBackColor) + Else + SetTabHeader(page, Control.DefaultBackColor) - End If - End Sub + End If + End Sub - Private Sub SetTabHeader(page As TabPage, color As Color) + Private Sub SetTabHeader(page As TabPage, color As Color) - TabColors(page) = color - tabMain.Invalidate() - End Sub + TabColors(page) = color + tabMain.Invalidate() + End Sub - Private Sub tabMain_DrawItem(sender As Object, e As DrawItemEventArgs) + Private Sub tabMain_DrawItem(sender As Object, e As DrawItemEventArgs) - Dim br As Brush = New SolidBrush(TabColors(tabMain.TabPages(e.Index))) + Dim br As Brush = New SolidBrush(TabColors(tabMain.TabPages(e.Index))) - Using (br) + Using (br) - e.Graphics.FillRectangle(br, e.Bounds) - Dim sz As SizeF = e.Graphics.MeasureString(tabMain.TabPages(e.Index).Text, e.Font) - e.Graphics.DrawString(tabMain.TabPages(e.Index).Text, e.Font, Brushes.Black, - e.Bounds.Left + (e.Bounds.Width - sz.Width) / 2, e.Bounds.Top + (e.Bounds.Height - sz.Height) / 2 + 1) + e.Graphics.FillRectangle(br, e.Bounds) + Dim sz As SizeF = e.Graphics.MeasureString(tabMain.TabPages(e.Index).Text, e.Font) + e.Graphics.DrawString(tabMain.TabPages(e.Index).Text, e.Font, Brushes.Black, + e.Bounds.Left + (e.Bounds.Width - sz.Width) / 2, e.Bounds.Top + (e.Bounds.Height - sz.Height) / 2 + 1) - Dim rect As Rectangle = e.Bounds - rect.Offset(-1, -1) - rect.Inflate(1, 1) - ' e.Graphics.DrawRectangle(Pens.DarkGray, rect) - 'e.DrawFocusRectangle() + Dim rect As Rectangle = e.Bounds + rect.Offset(-1, -1) + rect.Inflate(1, 1) + ' e.Graphics.DrawRectangle(Pens.DarkGray, rect) + 'e.DrawFocusRectangle() - End Using - End Sub + End Using + End Sub #End Region - Public Sub UnbindAllControls(ByRef container As Control) - 'Clear all of the controls within the container object - 'If "Recurse" is true, then also clear controls within any sub-containers - Dim ctrl As Control = Nothing + Public Sub UnbindAllControls(ByRef container As Control) + 'Clear all of the controls within the container object + 'If "Recurse" is true, then also clear controls within any sub-containers + Dim ctrl As Control = Nothing - For Each ctrl In container.Controls + For Each ctrl In container.Controls - ctrl.DataBindings.Clear() + ctrl.DataBindings.Clear() - If ctrl.HasChildren Then - UnbindAllControls(ctrl) - End If + If ctrl.HasChildren Then + UnbindAllControls(ctrl) + End If - Next - End Sub + Next + End Sub - Private Function GetSSMMAP(ByVal filePath As String, ByRef message As String) As Hvac.IHVACSteadyStateModel + Private Function GetSSMMAP(ByVal filePath As String, ByRef message As String) As IHVACSteadyStateModel - Dim ssmMap As New Hvac.HVACSteadyStateModel() + Dim ssmMap As New HVACSteadyStateModel() - Try + Try - If ssmMap.SetValuesFromMap(FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text), message) Then + If ssmMap.SetValuesFromMap(FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text), message) Then - Return ssmMap + Return ssmMap - End If + End If - Catch ex As Exception + Catch ex As Exception - MessageBox.Show("Unable to retreive values from map") + MessageBox.Show("Unable to retreive values from map") - End Try + End Try - Return Nothing - End Function + Return Nothing + End Function - Private Sub SetupControls() + Private Sub SetupControls() - Dim cIndex As Integer = 0 + Dim cIndex As Integer = 0 - gvElectricalConsumables.AutoGenerateColumns = False + gvElectricalConsumables.AutoGenerateColumns = False - 'ElectricalConsumerGrid - 'Columns - cIndex = gvElectricalConsumables.Columns.Add("Category", "Category") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Category" - gvElectricalConsumables.Columns(cIndex).MinimumWidth = 150 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + 'ElectricalConsumerGrid + 'Columns + cIndex = gvElectricalConsumables.Columns.Add("Category", "Category") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Category" + gvElectricalConsumables.Columns(cIndex).MinimumWidth = 150 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - cIndex = gvElectricalConsumables.Columns.Add("ConsumerName", "Name") + cIndex = gvElectricalConsumables.Columns.Add("ConsumerName", "Name") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "ConsumerName" - gvElectricalConsumables.Columns(cIndex).MinimumWidth = 308 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "ConsumerName" + gvElectricalConsumables.Columns(cIndex).MinimumWidth = 308 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - Dim baseVehicle As New DataGridViewCheckBoxColumn(False) - baseVehicle.HeaderText = "Base Vehicle" - cIndex = gvElectricalConsumables.Columns.Add(baseVehicle) - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "BaseVehicle" - gvElectricalConsumables.Columns(cIndex).Width = 75 - gvElectricalConsumables.Columns(cIndex).Visible = False - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Energy included in the calculations of base vehicle" + Dim baseVehicle As New DataGridViewCheckBoxColumn(False) + baseVehicle.HeaderText = "Base Vehicle" + cIndex = gvElectricalConsumables.Columns.Add(baseVehicle) + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "BaseVehicle" + gvElectricalConsumables.Columns(cIndex).Width = 75 + gvElectricalConsumables.Columns(cIndex).Visible = False + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Energy included in the calculations of base vehicle" - cIndex = gvElectricalConsumables.Columns.Add("NominalConsumptionAmps", "Nominal Amps") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NominalConsumptionAmps" - gvElectricalConsumables.Columns(cIndex).Width = 60 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ - With {.BackColor = Color.LightGray} - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Nominal consumption in AMPS" + cIndex = gvElectricalConsumables.Columns.Add("NominalConsumptionAmps", "Nominal Amps") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NominalConsumptionAmps" + gvElectricalConsumables.Columns(cIndex).Width = 60 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ + With {.BackColor = Color.LightGray} + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Nominal consumption in AMPS" - cIndex = gvElectricalConsumables.Columns.Add("PhaseIdle_TractionOn", "PhaseIdle/ TractionOn") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "PhaseIdle_TractionOn" - gvElectricalConsumables.Columns(cIndex).Width = 60 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ - With {.BackColor = Color.LightGray} - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = - "Represents the amount of time (during engine fueling) as " & vbCrLf & - "percentage that the consumer is active during the cycle." + cIndex = gvElectricalConsumables.Columns.Add("PhaseIdle_TractionOn", "PhaseIdle/ TractionOn") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "PhaseIdle_TractionOn" + gvElectricalConsumables.Columns(cIndex).Width = 60 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ + With {.BackColor = Color.LightGray} + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = + "Represents the amount of time (during engine fueling) as " & vbCrLf & + "percentage that the consumer is active during the cycle." - cIndex = gvElectricalConsumables.Columns.Add("NumberInActualVehicle", "Num in Vehicle") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NumberInActualVehicle" - gvElectricalConsumables.Columns(cIndex).Width = 55 - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Number of consumables of this" & vbCrLf & - "type installed on the vehicle." + cIndex = gvElectricalConsumables.Columns.Add("NumberInActualVehicle", "Num in Vehicle") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NumberInActualVehicle" + gvElectricalConsumables.Columns(cIndex).Width = 55 + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Number of consumables of this" & vbCrLf & + "type installed on the vehicle." - 'INFO COLUMN - cIndex = gvElectricalConsumables.Columns.Add("info", "Info") - ' cIndex = gvElectricalConsumables.Columns.Add( New ImageColumn()) + 'INFO COLUMN + cIndex = gvElectricalConsumables.Columns.Add("info", "Info") + ' cIndex = gvElectricalConsumables.Columns.Add( New ImageColumn()) - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Info" - gvElectricalConsumables.Columns(cIndex).Width = 120 - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Further Information" + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Info" + gvElectricalConsumables.Columns(cIndex).Width = 120 + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Further Information" - ' ResultCard Grids + ' ResultCard Grids - 'IDLE + 'IDLE - cIndex = gvResultsCardIdle.Columns.Add("Amps", "Amps") - gvResultsCardIdle.Columns(cIndex).DataPropertyName = "Amps" - gvResultsCardIdle.Columns(cIndex).Width = 65 + cIndex = gvResultsCardIdle.Columns.Add("Amps", "Amps") + gvResultsCardIdle.Columns(cIndex).DataPropertyName = "Amps" + gvResultsCardIdle.Columns(cIndex).Width = 65 - cIndex = gvResultsCardIdle.Columns.Add("SmartAmps", "SmartAmps") - gvResultsCardIdle.Columns(cIndex).DataPropertyName = "SmartAmps" - gvResultsCardIdle.Columns(cIndex).Width = 65 - - 'TRACTION - cIndex = gvResultsCardTraction.Columns.Add("Amps", "Amps") - gvResultsCardTraction.Columns(cIndex).DataPropertyName = "Amps" - gvResultsCardTraction.Columns(cIndex).Width = 65 - - cIndex = gvResultsCardTraction.Columns.Add("SmartAmps", "SmartAmps") - gvResultsCardTraction.Columns(cIndex).DataPropertyName = "SmartAmps" - gvResultsCardTraction.Columns(cIndex).Width = 65 - - 'OVERRUN - cIndex = gvResultsCardOverrun.Columns.Add("Amps", "Amps") - gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "Amps" - gvResultsCardOverrun.Columns(cIndex).Width = 65 - - cIndex = gvResultsCardOverrun.Columns.Add("SmartAmps", "SmartAmps") - gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "SmartAmps" - gvResultsCardOverrun.Columns(cIndex).Width = 65 - End Sub + cIndex = gvResultsCardIdle.Columns.Add("SmartAmps", "SmartAmps") + gvResultsCardIdle.Columns(cIndex).DataPropertyName = "SmartAmps" + gvResultsCardIdle.Columns(cIndex).Width = 65 + + 'TRACTION + cIndex = gvResultsCardTraction.Columns.Add("Amps", "Amps") + gvResultsCardTraction.Columns(cIndex).DataPropertyName = "Amps" + gvResultsCardTraction.Columns(cIndex).Width = 65 + + cIndex = gvResultsCardTraction.Columns.Add("SmartAmps", "SmartAmps") + gvResultsCardTraction.Columns(cIndex).DataPropertyName = "SmartAmps" + gvResultsCardTraction.Columns(cIndex).Width = 65 + + 'OVERRUN + cIndex = gvResultsCardOverrun.Columns.Add("Amps", "Amps") + gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "Amps" + gvResultsCardOverrun.Columns(cIndex).Width = 65 + + cIndex = gvResultsCardOverrun.Columns.Add("SmartAmps", "SmartAmps") + gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "SmartAmps" + gvResultsCardOverrun.Columns(cIndex).Width = 65 + End Sub #Region "Binding Control" - Private Sub CreateBindings() - - 'auxConfig.Vecto Bindings - txtPowernetVoltage.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "PowerNetVoltage") - 'txtVehicleWeightKG.DataBindings.Add("Text", auxConfig.VectoInputs, "VehicleWeightKG") - 'cboCycle.DataBindings.Add("Text", auxConfig.VectoInputs, "Cycle") - txtFuelMap.DataBindings.Add("Text", auxConfig.VectoInputs, "FuelMap") - - 'Electricals General - txtAlternatorMapPath.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorMap") - txtAlternatorGearEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorGearEfficiency") - txtDoorActuationTimeSeconds.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "DoorActuationTimeSecond") - txtStoredEnergyEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "StoredEnergyEfficiency") - chkSmartElectricals.DataBindings.Add("Checked", auxConfig.ElectricalUserInputsConfig, "SmartElectrical", False, - DataSourceUpdateMode.OnPropertyChanged) - - - 'Electrical ConsumablesGrid - electricalConsumerBinding = - New BindingList(Of IElectricalConsumer)(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.Items) - gvElectricalConsumables.DataSource = electricalConsumerBinding - - - 'ResultCards - - 'IDLE - Dim idleBinding As BindingList(Of SmartResult) - idleBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardIdle.Results) - idleBinding.AllowNew = True - idleBinding.AllowRemove = True - gvResultsCardIdle.DataSource = idleBinding - - 'TRACTION - Dim tractionBinding As BindingList(Of SmartResult) - tractionBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardTraction.Results) - tractionBinding.AllowNew = True - tractionBinding.AllowRemove = True - gvResultsCardTraction.DataSource = tractionBinding - - 'OVERRUN - Dim overrunBinding As BindingList(Of SmartResult) - overrunBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardOverrun.Results) - overrunBinding.AllowNew = True - overrunBinding.AllowRemove = True - gvResultsCardOverrun.DataSource = overrunBinding - - - 'Pneumatic Auxillaries Binding - txtAdBlueNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "AdBlueNIperMinute") - - txtOverrunUtilisationForCompressionFraction.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "OverrunUtilisationForCompressionFraction") - txtBrakingWithRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "BrakingWithRetarderNIperKG") - txtBrakingNoRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "BrakingNoRetarderNIperKG") - txtBreakingPerKneelingNIperKGinMM.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "BreakingPerKneelingNIperKGinMM", True, DataSourceUpdateMode.OnPropertyChanged, Nothing, "0.########") - txtPerDoorOpeningNI.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "PerDoorOpeningNI") - txtPerStopBrakeActuationNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "PerStopBrakeActuationNIperKG") - txtAirControlledSuspensionNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "AirControlledSuspensionNIperMinute") - txtNonSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "NonSmartRegenFractionTotalAirDemand") - txtSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "SmartRegenFractionTotalAirDemand") - txtDeadVolumeLitres.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "DeadVolumeLitres") - txtDeadVolBlowOutsPerLitresperHour.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "DeadVolBlowOutsPerLitresperHour") - - 'Pneumatic UserInputsConfig Binding - txtCompressorMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorMap") - txtCompressorGearEfficiency.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearEfficiency") - txtCompressorGearRatio.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearRatio") - txtActuationsMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "ActuationsMap") - chkSmartAirCompression.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartAirCompression", False, - DataSourceUpdateMode.OnPropertyChanged) - - chkSmartRegeneration.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartRegeneration", False, - DataSourceUpdateMode.OnPropertyChanged) - chkRetarderBrake.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "RetarderBrake") - txtKneelingHeightMillimeters.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "KneelingHeightMillimeters") - cboAirSuspensionControl.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AirSuspensionControl", False) - cboAdBlueDosing.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AdBlueDosing") - cboDoors.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "Doors") - - txtSSMFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "SSMFilePath") - txtBusDatabaseFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "BusDatabasePath") - chkDisableHVAC.DataBindings.Add("Checked", auxConfig.HvacUserInputsConfig, "SSMDisabled", False, - DataSourceUpdateMode.OnPropertyChanged) - - SetSmartCardEmabledStatus() - End Sub - - Private Sub EnsureBinding() - With tabMain - Dim lastSelectedTabIndex As Integer = .SelectedIndex - If lastSelectedTabIndex < 0 OrElse lastSelectedTabIndex > .TabCount Then lastSelectedTabIndex = 0 - For currentTab As Integer = 0 To .TabCount - 1 - .SelectedIndex = currentTab - Next - .SelectedIndex = 0 - End With - - SetSmartCardEmabledStatus() - End Sub + Private Sub CreateBindings() + + 'auxConfig.Vecto Bindings + txtPowernetVoltage.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "PowerNetVoltage") + 'txtVehicleWeightKG.DataBindings.Add("Text", auxConfig.VectoInputs, "VehicleWeightKG") + 'cboCycle.DataBindings.Add("Text", auxConfig.VectoInputs, "Cycle") + txtFuelMap.DataBindings.Add("Text", auxConfig.VectoInputs, "FuelMap") + + 'Electricals General + txtAlternatorMapPath.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorMap") + txtAlternatorGearEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorGearEfficiency") + txtDoorActuationTimeSeconds.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "DoorActuationTimeSecond") + txtStoredEnergyEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "StoredEnergyEfficiency") + chkSmartElectricals.DataBindings.Add("Checked", auxConfig.ElectricalUserInputsConfig, "SmartElectrical", False, + DataSourceUpdateMode.OnPropertyChanged) + + + 'Electrical ConsumablesGrid + electricalConsumerBinding = + New BindingList(Of IElectricalConsumer)(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.Items) + gvElectricalConsumables.DataSource = electricalConsumerBinding + + + 'ResultCards + + 'IDLE + Dim idleBinding As BindingList(Of SmartResult) + idleBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardIdle.Results) + idleBinding.AllowNew = True + idleBinding.AllowRemove = True + gvResultsCardIdle.DataSource = idleBinding + + 'TRACTION + Dim tractionBinding As BindingList(Of SmartResult) + tractionBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardTraction.Results) + tractionBinding.AllowNew = True + tractionBinding.AllowRemove = True + gvResultsCardTraction.DataSource = tractionBinding + + 'OVERRUN + Dim overrunBinding As BindingList(Of SmartResult) + overrunBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardOverrun.Results) + overrunBinding.AllowNew = True + overrunBinding.AllowRemove = True + gvResultsCardOverrun.DataSource = overrunBinding + + + 'Pneumatic Auxillaries Binding + txtAdBlueNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "AdBlueNIperMinute") + + txtOverrunUtilisationForCompressionFraction.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "OverrunUtilisationForCompressionFraction") + txtBrakingWithRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "BrakingWithRetarderNIperKG") + txtBrakingNoRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "BrakingNoRetarderNIperKG") + txtBreakingPerKneelingNIperKGinMM.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "BreakingPerKneelingNIperKGinMM", True, DataSourceUpdateMode.OnPropertyChanged, Nothing, "0.########") + txtPerDoorOpeningNI.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "PerDoorOpeningNI") + txtPerStopBrakeActuationNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "PerStopBrakeActuationNIperKG") + txtAirControlledSuspensionNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "AirControlledSuspensionNIperMinute") + txtNonSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "NonSmartRegenFractionTotalAirDemand") + txtSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "SmartRegenFractionTotalAirDemand") + txtDeadVolumeLitres.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "DeadVolumeLitres") + txtDeadVolBlowOutsPerLitresperHour.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "DeadVolBlowOutsPerLitresperHour") + + 'Pneumatic UserInputsConfig Binding + txtCompressorMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorMap") + txtCompressorGearEfficiency.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearEfficiency") + txtCompressorGearRatio.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearRatio") + txtActuationsMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "ActuationsMap") + chkSmartAirCompression.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartAirCompression", False, + DataSourceUpdateMode.OnPropertyChanged) + + chkSmartRegeneration.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartRegeneration", False, + DataSourceUpdateMode.OnPropertyChanged) + chkRetarderBrake.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "RetarderBrake") + txtKneelingHeightMillimeters.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "KneelingHeightMillimeters") + cboAirSuspensionControl.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AirSuspensionControl", False) + cboAdBlueDosing.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AdBlueDosing") + cboDoors.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "Doors") + + txtSSMFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "SSMFilePath") + txtBusDatabaseFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "BusDatabasePath") + chkDisableHVAC.DataBindings.Add("Checked", auxConfig.HvacUserInputsConfig, "SSMDisabled", False, + DataSourceUpdateMode.OnPropertyChanged) + + SetSmartCardEmabledStatus() + End Sub + + Private Sub EnsureBinding() + With tabMain + Dim lastSelectedTabIndex As Integer = .SelectedIndex + If lastSelectedTabIndex < 0 OrElse lastSelectedTabIndex > .TabCount Then lastSelectedTabIndex = 0 + For currentTab As Integer = 0 To .TabCount - 1 + .SelectedIndex = currentTab + Next + .SelectedIndex = 0 + End With + + SetSmartCardEmabledStatus() + End Sub #End Region - Protected Sub SetSmartCardEmabledStatus() + Protected Sub SetSmartCardEmabledStatus() - If chkSmartElectricals.Checked Then + If chkSmartElectricals.Checked Then - gvResultsCardIdle.Enabled = True - gvResultsCardTraction.Enabled = True - gvResultsCardOverrun.Enabled = True + gvResultsCardIdle.Enabled = True + gvResultsCardTraction.Enabled = True + gvResultsCardOverrun.Enabled = True - gvResultsCardIdle.BackgroundColor = Color.Gray - gvResultsCardTraction.BackgroundColor = Color.Gray - gvResultsCardOverrun.BackgroundColor = Color.Gray + gvResultsCardIdle.BackgroundColor = Color.Gray + gvResultsCardTraction.BackgroundColor = Color.Gray + gvResultsCardOverrun.BackgroundColor = Color.Gray - electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 0 - Else + electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 0 + Else - gvResultsCardIdle.Enabled = False - gvResultsCardTraction.Enabled = False - gvResultsCardOverrun.Enabled = False + gvResultsCardIdle.Enabled = False + gvResultsCardTraction.Enabled = False + gvResultsCardOverrun.Enabled = False - gvResultsCardIdle.BackgroundColor = Color.White - gvResultsCardTraction.BackgroundColor = Color.White - gvResultsCardOverrun.BackgroundColor = Color.White + gvResultsCardIdle.BackgroundColor = Color.White + gvResultsCardTraction.BackgroundColor = Color.White + gvResultsCardOverrun.BackgroundColor = Color.White - electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 1 - End If - End Sub + electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 1 + End If + End Sub - Public Function FileOpenAlt(ByVal file As String) As Boolean - Dim PSI As New ProcessStartInfo + Public Function FileOpenAlt(ByVal file As String) As Boolean + Dim PSI As New ProcessStartInfo - If Not IO.File.Exists(file) Then Return False + If Not IO.File.Exists(file) Then Return False - PSI.FileName = "notepad.exe" - PSI.Arguments = ChrW(34) & file & ChrW(34) - Try - Process.Start(PSI) - Return True - Catch ex As Exception - Return False - End Try - End Function + PSI.FileName = "notepad.exe" + PSI.Arguments = ChrW(34) & file & ChrW(34) + Try + Process.Start(PSI) + Return True + Catch ex As Exception + Return False + End Try + End Function - Private Sub chkDisableHVAC_CheckedChanged(sender As Object, e As EventArgs) Handles chkDisableHVAC.CheckedChanged + Private Sub chkDisableHVAC_CheckedChanged(sender As Object, e As EventArgs) Handles chkDisableHVAC.CheckedChanged - If chkDisableHVAC.Checked Then + If chkDisableHVAC.Checked Then - txtSSMFilePath.ReadOnly = True - txtBusDatabaseFilePath.ReadOnly = True - btnSSMBSource.Enabled = False - btnBusDatabaseSource.Enabled = False - btnOpenAHSM.Enabled = False - btnOpenABDB.Enabled = False + txtSSMFilePath.ReadOnly = True + txtBusDatabaseFilePath.ReadOnly = True + btnSSMBSource.Enabled = False + btnBusDatabaseSource.Enabled = False + btnOpenAHSM.Enabled = False + btnOpenABDB.Enabled = False - Else + Else - txtSSMFilePath.ReadOnly = False - txtBusDatabaseFilePath.ReadOnly = False - btnSSMBSource.Enabled = True - btnBusDatabaseSource.Enabled = True - btnOpenAHSM.Enabled = True - btnOpenABDB.Enabled = True + txtSSMFilePath.ReadOnly = False + txtBusDatabaseFilePath.ReadOnly = False + btnSSMBSource.Enabled = True + btnBusDatabaseSource.Enabled = True + btnOpenAHSM.Enabled = True + btnOpenABDB.Enabled = True - End If - End Sub + End If + End Sub - Protected Overrides Sub Finalize() - MyBase.Finalize() - End Sub + Protected Overrides Sub Finalize() + MyBase.Finalize() + End Sub End Class \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb b/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb index 8b14f2d0f64343a5684c01ce4ee87b46d8ebeeba..a63696eea530c601d774ad130e6ae46f001c63da 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb @@ -4,639 +4,641 @@ Imports System.Drawing Imports System.Windows.Forms Imports VectoAuxiliaries.Electrics Imports System.ComponentModel -Imports VectoAuxiliaries.Hvac +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Public Class frmCombinedAlternators - Private combinedAlt As CombinedAlternator - Private originalAlt As CombinedAlternator - Private altSignals As ICombinedAlternatorSignals - Protected gbColor As System.Drawing.Color = Color.LightGreen - Private UserHitCancel As Boolean = False - Private UserHitSave As Boolean = False - Private aaltPath As String = "" + Private combinedAlt As CombinedAlternator + Private originalAlt As CombinedAlternator + Private altSignals As ICombinedAlternatorSignals + Protected gbColor As System.Drawing.Color = Color.LightGreen + Private UserHitCancel As Boolean = False + Private UserHitSave As Boolean = False + Private aaltPath As String = "" - 'Constructor(s) - Public Sub New(aaltPath As String, altSignals As ICombinedAlternatorSignals) + 'Constructor(s) + Public Sub New(aaltPath As String, altSignals As ICombinedAlternatorSignals) - ' This call is required by the designer. - InitializeComponent() + ' This call is required by the designer. + InitializeComponent() - ' Add any initialization after the InitializeComponent() call. - Me.aaltpath = aaltPath + ' Add any initialization after the InitializeComponent() call. + Me.aaltpath = aaltPath - combinedAlt = New CombinedAlternator(aaltPath) - originalAlt = New CombinedAlternator(aaltPath) + combinedAlt = New CombinedAlternator(aaltPath) + originalAlt = New CombinedAlternator(aaltPath) - SetupControls() - BindGrid() - End Sub + SetupControls() + BindGrid() + End Sub - 'General Helpders - Private Sub BindGrid() + 'General Helpders + Private Sub BindGrid() - gvAlternators.DataSource = - New BindingList(Of IAlternator)(combinedAlt.Alternators.OrderBy(Function(o) o.AlternatorName).ToList()) - End Sub + gvAlternators.DataSource = + New BindingList(Of IAlternator)(combinedAlt.Alternators.OrderBy(Function(o) o.AlternatorName).ToList()) + End Sub - Private Sub SetupControls() + Private Sub SetupControls() - 'gvAlternators - gvAlternators.AutoGenerateColumns = False + 'gvAlternators + gvAlternators.AutoGenerateColumns = False - Dim cIndex As Integer + Dim cIndex As Integer - 'Column - AlternatorName - cIndex = gvAlternators.Columns.Add("AlternatorName", "AlternatorName") - gvAlternators.Columns(cIndex).DataPropertyName = "AlternatorName" - gvAlternators.Columns(cIndex).Width = 250 - gvAlternators.Columns(cIndex).ReadOnly = True - gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + 'Column - AlternatorName + cIndex = gvAlternators.Columns.Add("AlternatorName", "AlternatorName") + gvAlternators.Columns(cIndex).DataPropertyName = "AlternatorName" + gvAlternators.Columns(cIndex).Width = 250 + gvAlternators.Columns(cIndex).ReadOnly = True + gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - 'Column - PulleyRatio - cIndex = gvAlternators.Columns.Add("PulleyRatio", "PulleyRatio") - gvAlternators.Columns(cIndex).DataPropertyName = "PulleyRatio" - gvAlternators.Columns(cIndex).Width = 70 - gvAlternators.Columns(cIndex).ReadOnly = True - gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + 'Column - PulleyRatio + cIndex = gvAlternators.Columns.Add("PulleyRatio", "PulleyRatio") + gvAlternators.Columns(cIndex).DataPropertyName = "PulleyRatio" + gvAlternators.Columns(cIndex).Width = 70 + gvAlternators.Columns(cIndex).ReadOnly = True + gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - Dim deleteColumn As New DeleteAlternatorColumn() - With deleteColumn - .HeaderText = "" - .ToolTipText = "Delete this row" - .Name = "Delete" - .Width = 25 - .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter - End With + Dim deleteColumn As New DeleteAlternatorColumn() + With deleteColumn + .HeaderText = "" + .ToolTipText = "Delete this row" + .Name = "Delete" + .Width = 25 + .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter + End With - ' deleteColumn.CellTemplate.ToolTipText="Delete this alternator" - gvAlternators.Columns.Add(deleteColumn) - End Sub + ' deleteColumn.CellTemplate.ToolTipText="Delete this alternator" + gvAlternators.Columns.Add(deleteColumn) + End Sub - Public Sub UpdateButtonText() + Public Sub UpdateButtonText() - If txtIndex.Text = String.Empty Then - btnUpdate.Text = "Add" - Else - btnUpdate.Text = "Update" - End If - End Sub + If txtIndex.Text = String.Empty Then + btnUpdate.Text = "Add" + Else + btnUpdate.Text = "Update" + End If + End Sub - Private Sub CreateDiagnostics() + Private Sub CreateDiagnostics() - txtDiagnostics.Text = combinedAlt.ToString() - End Sub + txtDiagnostics.Text = combinedAlt.ToString() + End Sub - 'Validation Helpers - Private Sub IsTextBoxNumber(control As TextBox, errorProviderMessage As String, ByRef result As Boolean) + 'Validation Helpers + Private Sub IsTextBoxNumber(control As TextBox, errorProviderMessage As String, ByRef result As Boolean) - If Not IsNumeric(control.Text) Then - ErrorProvider1.SetError(control, errorProviderMessage) - result = False - Else - ErrorProvider1.SetError(control, String.Empty) + If Not IsNumeric(control.Text) Then + ErrorProvider1.SetError(control, errorProviderMessage) + result = False + Else + ErrorProvider1.SetError(control, String.Empty) - End If - End Sub + End If + End Sub - Private Sub IsEmptyString(text As String, control As Control, errorProviderMessage As String, ByRef result As Boolean) + Private Sub IsEmptyString(text As String, control As Control, errorProviderMessage As String, ByRef result As Boolean) - If String.IsNullOrEmpty(text) Then - ErrorProvider1.SetError(control, errorProviderMessage) - result = False - Else - ErrorProvider1.SetError(control, String.Empty) + If String.IsNullOrEmpty(text) Then + ErrorProvider1.SetError(control, errorProviderMessage) + result = False + Else + ErrorProvider1.SetError(control, String.Empty) - End If - End Sub + End If + End Sub - Private Function IsPostiveInteger(ByVal test As String) As Boolean + Private Function IsPostiveInteger(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As Integer + Dim number As Integer - If Not Integer.TryParse(test, number) Then Return False + If Not Integer.TryParse(test, number) Then Return False - If number <= 0 Then Return False + If number <= 0 Then Return False - Return True - End Function + Return True + End Function - Private Function IsPostiveNumber(ByVal test As String) As Boolean + Private Function IsPostiveNumber(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As Double + Dim number As Double - If Not Double.TryParse(test, number) Then Return False + If Not Double.TryParse(test, number) Then Return False - If number <= 0 Then Return False + If number <= 0 Then Return False - Return True - End Function + Return True + End Function - Private Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean + Private Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As Double + Dim number As Double - If Not Double.TryParse(test, number) Then Return False + If Not Double.TryParse(test, number) Then Return False - If number < 0 Then Return False + If number < 0 Then Return False - Return True - End Function + Return True + End Function - Private Function IsNumberBetweenZeroandOne(test As String) As Boolean + Private Function IsNumberBetweenZeroandOne(test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As Double + Dim number As Double - If Not Double.TryParse(test, number) Then Return False + If Not Double.TryParse(test, number) Then Return False - If number < 0 OrElse number > 1 Then Return False + If number < 0 OrElse number > 1 Then Return False - Return True - End Function + Return True + End Function - Private Function IsNumberBetweenOverZeroAndLessThan100(txtBox As TextBox) As Boolean + Private Function IsNumberBetweenOverZeroAndLessThan100(txtBox As TextBox) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(txtBox.Text) Then - ErrorProvider1.SetError(txtBox, "Please enter a number") - Return False - Else - ErrorProvider1.SetError(txtBox, "") - End If + 'Is this numeric sanity check. + If Not IsNumeric(txtBox.Text) Then + ErrorProvider1.SetError(txtBox, "Please enter a number") + Return False + Else + ErrorProvider1.SetError(txtBox, "") + End If - Dim number As Double = 0 + Dim number As Double = 0 - If Not Double.TryParse(txtBox.Text, number) Then - ErrorProvider1.SetError(txtBox, "Please enter a number >0 and <100") - Return False + If Not Double.TryParse(txtBox.Text, number) Then + ErrorProvider1.SetError(txtBox, "Please enter a number >0 and <100") + Return False - Else - ErrorProvider1.SetError(txtBox, String.Empty) - End If + Else + ErrorProvider1.SetError(txtBox, String.Empty) + End If - If number <= 0 OrElse number >= 100 Then + If number <= 0 OrElse number >= 100 Then - ErrorProvider1.SetError(txtBox, "Please enter a number >0 and <100") - Return False - Else - ErrorProvider1.SetError(txtBox, String.Empty) - Return True + ErrorProvider1.SetError(txtBox, "Please enter a number >0 and <100") + Return False + Else + ErrorProvider1.SetError(txtBox, String.Empty) + Return True - End If + End If - Return True - End Function + Return True + End Function - Private Function IsNumberGreaterThan10(txtBox As TextBox) As Boolean + Private Function IsNumberGreaterThan10(txtBox As TextBox) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(txtBox.Text) Then - ErrorProvider1.SetError(txtBox, "Please enter a number") - Return False - Else - ErrorProvider1.SetError(txtBox, "") - End If + 'Is this numeric sanity check. + If Not IsNumeric(txtBox.Text) Then + ErrorProvider1.SetError(txtBox, "Please enter a number") + Return False + Else + ErrorProvider1.SetError(txtBox, "") + End If - Dim number As Double = 0 + Dim number As Double = 0 - If Not Double.TryParse(txtBox.Text, number) Then - ErrorProvider1.SetError(txtBox, "Please enter a number >10") - Return False + If Not Double.TryParse(txtBox.Text, number) Then + ErrorProvider1.SetError(txtBox, "Please enter a number >10") + Return False - Else - ErrorProvider1.SetError(txtBox, String.Empty) - End If + Else + ErrorProvider1.SetError(txtBox, String.Empty) + End If - If number <= 10 Then + If number <= 10 Then - ErrorProvider1.SetError(txtBox, "Please enter a number > 10") - Return False - Else - ErrorProvider1.SetError(txtBox, String.Empty) - Return True - End If + ErrorProvider1.SetError(txtBox, "Please enter a number > 10") + Return False + Else + ErrorProvider1.SetError(txtBox, String.Empty) + Return True + End If - Return True - End Function + Return True + End Function - Private Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean + Private Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - 'if not integer then return false + 'if not integer then return false - Dim number As Integer + Dim number As Integer - If Not Integer.TryParse(test, number) Then Return False + If Not Integer.TryParse(test, number) Then Return False - If number < 0 Then Return False + If number < 0 Then Return False - Return True - End Function + Return True + End Function - 'Other events - Private Sub groupBoxUserInput_Paint(sender As Object, e As Windows.Forms.PaintEventArgs) _ - Handles grpTable2000PRM.Paint, grpTable6000PRM.Paint, grpTable4000PRM.Paint + 'Other events + Private Sub groupBoxUserInput_Paint(sender As Object, e As Windows.Forms.PaintEventArgs) _ + Handles grpTable2000PRM.Paint, grpTable6000PRM.Paint, grpTable4000PRM.Paint - Dim p As Pen = Nothing + Dim p As Pen = Nothing - Dim sdr As Control = DirectCast(sender, Control) + Dim sdr As Control = DirectCast(sender, Control) - Select Case sdr.Name + Select Case sdr.Name - Case "grpTable2000PRM" - p = New Pen(Color.LightGreen, 3) - Case "grpTable4000PRM" - p = New Pen(Color.Yellow, 3) - Case "grpTable6000PRM" - p = New Pen(Color.LightPink, 3) - Case Else - p = New Pen(Color.Black, 3) + Case "grpTable2000PRM" + p = New Pen(Color.LightGreen, 3) + Case "grpTable4000PRM" + p = New Pen(Color.Yellow, 3) + Case "grpTable6000PRM" + p = New Pen(Color.LightPink, 3) + Case Else + p = New Pen(Color.Black, 3) - End Select + End Select - Dim gfx As Graphics = e.Graphics + Dim gfx As Graphics = e.Graphics - gfx.DrawLine(p, 0, 5, 0, e.ClipRectangle.Height - 2) - gfx.DrawLine(p, 0, 5, 10, 5) - gfx.DrawLine(p, 85, 5, e.ClipRectangle.Width - 2, 5) - gfx.DrawLine(p, e.ClipRectangle.Width - 2, 5, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2) - gfx.DrawLine(p, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2, 0, e.ClipRectangle.Height - 2) - End Sub + gfx.DrawLine(p, 0, 5, 0, e.ClipRectangle.Height - 2) + gfx.DrawLine(p, 0, 5, 10, 5) + gfx.DrawLine(p, 85, 5, e.ClipRectangle.Width - 2, 5) + gfx.DrawLine(p, e.ClipRectangle.Width - 2, 5, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2) + gfx.DrawLine(p, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2, 0, e.ClipRectangle.Height - 2) + End Sub - 'Grid Events - Private Sub gvAlternators_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles gvAlternators.CellClick + 'Grid Events + Private Sub gvAlternators_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles gvAlternators.CellClick - If e.ColumnIndex < 0 OrElse e.RowIndex < 0 Then Return + If e.ColumnIndex < 0 OrElse e.RowIndex < 0 Then Return - If gvAlternators.Columns(e.ColumnIndex).Name = "Delete" Then + If gvAlternators.Columns(e.ColumnIndex).Name = "Delete" Then - Dim feedback As String = String.Empty - Dim alternatorName As String = gvAlternators.Rows(e.RowIndex).Cells(0).Value.ToString() + Dim feedback As String = String.Empty + Dim alternatorName As String = gvAlternators.Rows(e.RowIndex).Cells(0).Value.ToString() - Select Case gvAlternators.Columns(e.ColumnIndex).Name + Select Case gvAlternators.Columns(e.ColumnIndex).Name - Case "Delete" - Dim dr As DialogResult = MessageBox.Show(String.Format("Do you want to delete '{0}' ?", alternatorName), "", - MessageBoxButtons.YesNo) - If dr = Windows.Forms.DialogResult.Yes Then - If combinedAlt.DeleteAlternator(alternatorName, feedback, True) Then - BindGrid() - Else - MessageBox.Show(feedback) + Case "Delete" + Dim dr As DialogResult = MessageBox.Show(String.Format("Do you want to delete '{0}' ?", alternatorName), "", + MessageBoxButtons.YesNo) + If dr = Windows.Forms.DialogResult.Yes Then + If combinedAlt.DeleteAlternator(alternatorName, feedback, True) Then + BindGrid() + Else + MessageBox.Show(feedback) - End If + End If - End If + End If - End Select + End Select - End If - End Sub + End If + End Sub - Private Sub gvAlternators_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) _ - Handles gvAlternators.CellDoubleClick + Private Sub gvAlternators_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) _ + Handles gvAlternators.CellDoubleClick - If gvAlternators.SelectedCells.Count < 1 Then Return + If gvAlternators.SelectedCells.Count < 1 Then Return - Dim row As Integer = gvAlternators.SelectedCells(0).OwningRow.Index + Dim row As Integer = gvAlternators.SelectedCells(0).OwningRow.Index - Dim alternatorName As String + Dim alternatorName As String - alternatorName = gvAlternators.Rows(row).Cells("AlternatorName").Value.ToString() + alternatorName = gvAlternators.Rows(row).Cells("AlternatorName").Value.ToString() - Dim alt As IAlternator = combinedAlt.Alternators.First(Function(w) w.AlternatorName = alternatorName) + Dim alt As IAlternator = combinedAlt.Alternators.First(Function(w) w.AlternatorName = alternatorName) - FillEditPanel(row) + FillEditPanel(row) - UpdateButtonText() - End Sub + UpdateButtonText() + End Sub - 'Button Events - Private Sub btnClearForm_Click(sender As Object, e As EventArgs) Handles btnClearForm.Click + 'Button Events + Private Sub btnClearForm_Click(sender As Object, e As EventArgs) Handles btnClearForm.Click - ClearEditPanel() - UpdateButtonText() - End Sub + ClearEditPanel() + UpdateButtonText() + End Sub - Public Function GetAlternatorFromPanel() As List(Of ICombinedAlternatorMapRow) + Public Function GetAlternatorFromPanel() As List(Of ICombinedAlternatorMapRow) - Dim newAlt As New List(Of ICombinedAlternatorMapRow) + Dim newAlt As New List(Of ICombinedAlternatorMapRow) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2K10Amps.Text), - Convert.ToSingle(txt2K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMax2Amps.Text), - Convert.ToSingle(txt2KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMaxAmps.Text), - Convert.ToSingle(txt2KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2K10Amps.Text), + Convert.ToSingle(txt2K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMax2Amps.Text), + Convert.ToSingle(txt2KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMaxAmps.Text), + Convert.ToSingle(txt2KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4K10Amps.Text), - Convert.ToSingle(txt4K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMax2Amps.Text), - Convert.ToSingle(txt4KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMaxAmps.Text), - Convert.ToSingle(txt4KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4K10Amps.Text), + Convert.ToSingle(txt4K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMax2Amps.Text), + Convert.ToSingle(txt4KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMaxAmps.Text), + Convert.ToSingle(txt4KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6K10Amps.Text), - Convert.ToSingle(txt6K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMax2Amps.Text), - Convert.ToSingle(txt6KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMaxAmps.Text), - Convert.ToSingle(txt6KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6K10Amps.Text), + Convert.ToSingle(txt6K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMax2Amps.Text), + Convert.ToSingle(txt6KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMaxAmps.Text), + Convert.ToSingle(txt6KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - Return newAlt - End Function + Return newAlt + End Function - Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click + Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click - Dim feedback As String = String.Empty + Dim feedback As String = String.Empty - If Not Validate_UpdatePanel() Then Return + If Not Validate_UpdatePanel() Then Return - If txtIndex.Text.Trim.Length = 0 Then - 'This is an Add - If Not combinedAlt.AddAlternator(GetAlternatorFromPanel(), feedback) Then - MessageBox.Show(feedback) - Else + If txtIndex.Text.Trim.Length = 0 Then + 'This is an Add + If Not combinedAlt.AddAlternator(GetAlternatorFromPanel(), feedback) Then + MessageBox.Show(feedback) + Else - BindGrid() + BindGrid() - UpdateButtonText() + UpdateButtonText() - End If + End If - Else + Else - 'Get Existing row name. - Dim altName As String = gvAlternators.Rows(Convert.ToInt32(txtIndex.Text)).Cells("AlternatorName").Value.ToString() + 'Get Existing row name. + Dim altName As String = gvAlternators.Rows(Convert.ToInt32(txtIndex.Text)).Cells("AlternatorName").Value.ToString() - 'Does name used in update exist in other alternators excluding the original being edited ?, if so abort. - If _ - combinedAlt.Alternators.Where( - Function(f) f.AlternatorName <> altName AndAlso f.AlternatorName = txtAlternatorName.Text).Count > 0 Then - MessageBox.Show( - String.Format( - "The lternator '{0}' name you are using to update the alternator '{1}' already exists, operation aborted", - txtAlternatorName.Text, altName)) - Return - End If + 'Does name used in update exist in other alternators excluding the original being edited ?, if so abort. + If _ + combinedAlt.Alternators.Where( + Function(f) f.AlternatorName <> altName AndAlso f.AlternatorName = txtAlternatorName.Text).Count > 0 Then + MessageBox.Show( + String.Format( + "The lternator '{0}' name you are using to update the alternator '{1}' already exists, operation aborted", + txtAlternatorName.Text, altName)) + Return + End If - 'This is an update so delete the one being updated + 'This is an update so delete the one being updated - If _ - combinedAlt.DeleteAlternator(altName, feedback, False) AndAlso - combinedAlt.AddAlternator(GetAlternatorFromPanel(), feedback) Then + If _ + combinedAlt.DeleteAlternator(altName, feedback, False) AndAlso + combinedAlt.AddAlternator(GetAlternatorFromPanel(), feedback) Then - BindGrid() - ClearEditPanel() - UpdateButtonText() + BindGrid() + ClearEditPanel() + UpdateButtonText() - Else - MessageBox.Show(feedback) - End If + Else + MessageBox.Show(feedback) + End If - End If - End Sub + End If + End Sub - Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click - UserHitCancel = True - Me.close() - End Sub + UserHitCancel = True + Me.close() + End Sub - Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click - ' If Not ValidateAll then Return + ' If Not ValidateAll then Return - UserHitSave = True + UserHitSave = True - Me.DialogResult = Windows.Forms.DialogResult.OK - Me.Close() - End Sub + Me.DialogResult = Windows.Forms.DialogResult.OK + Me.Close() + End Sub - 'Form / Tab Events - Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged + 'Form / Tab Events + Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged - If TabControl1.SelectedIndex = 1 Then - CreateDiagnostics() - End If - End Sub + If TabControl1.SelectedIndex = 1 Then + CreateDiagnostics() + End If + End Sub - Private Sub frmCombinedAlternators_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + Private Sub frmCombinedAlternators_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing - Dim result As DialogResult + Dim result As DialogResult - 'If UserHitCancel then bail - If UserHitCancel Then - DialogResult = Windows.Forms.DialogResult.Cancel - UserHitCancel = False - Return - End If + 'If UserHitCancel then bail + If UserHitCancel Then + DialogResult = Windows.Forms.DialogResult.Cancel + UserHitCancel = False + Return + End If - 'UserHitSave - If UserHitSave Then - DialogResult = Windows.Forms.DialogResult.Cancel - If Not combinedAlt.Save(aaltPath) Then - MessageBox.Show("Unable to save file, aborting.") - e.Cancel = True - End If - UserHitSave = False - DialogResult = Windows.Forms.DialogResult.OK - Return - End If + 'UserHitSave + If UserHitSave Then + DialogResult = Windows.Forms.DialogResult.Cancel + If Not combinedAlt.Save(aaltPath) Then + MessageBox.Show("Unable to save file, aborting.") + e.Cancel = True + End If + UserHitSave = False + DialogResult = Windows.Forms.DialogResult.OK + Return + End If - ''This must be a close box event. If nothing changed, then bail, otherwise ask user if they wanna save - If Not combinedAlt.IsEqualTo(originalAlt) Then + ''This must be a close box event. If nothing changed, then bail, otherwise ask user if they wanna save + If Not combinedAlt.IsEqualTo(originalAlt) Then - result = - (MessageBox.Show("Would you like to save changes before closing?", "Save Changes", MessageBoxButtons.YesNoCancel, - MessageBoxIcon.Question)) + result = + (MessageBox.Show("Would you like to save changes before closing?", "Save Changes", MessageBoxButtons.YesNoCancel, + MessageBoxIcon.Question)) - Select Case result + Select Case result - Case DialogResult.Yes - 'save + Case DialogResult.Yes + 'save - If Not combinedAlt.Save(aaltPath) Then - e.Cancel = True - End If + If Not combinedAlt.Save(aaltPath) Then + e.Cancel = True + End If - Case DialogResult.No - 'just allow the form to close - 'without saving - Me.DialogResult = Windows.Forms.DialogResult.Cancel + Case DialogResult.No + 'just allow the form to close + 'without saving + Me.DialogResult = Windows.Forms.DialogResult.Cancel - Case DialogResult.Cancel - 'cancel the close - e.Cancel = True - Me.DialogResult = Windows.Forms.DialogResult.Cancel + Case DialogResult.Cancel + 'cancel the close + e.Cancel = True + Me.DialogResult = Windows.Forms.DialogResult.Cancel - End Select + End Select - End If + End If - UserHitCancel = False - UserHitSave = False - End Sub + UserHitCancel = False + UserHitSave = False + End Sub - 'List Management - Private Sub ClearEditPanel() + 'List Management + Private Sub ClearEditPanel() - txtIndex.Text = String.Empty - txtAlternatorName.Text = String.Empty - txt2K10Efficiency.Text = String.Empty - txt2KMax2Efficiency.Text = String.Empty - txt2KMaxEfficiency.Text = String.Empty + txtIndex.Text = String.Empty + txtAlternatorName.Text = String.Empty + txt2K10Efficiency.Text = String.Empty + txt2KMax2Efficiency.Text = String.Empty + txt2KMaxEfficiency.Text = String.Empty - txt4K10Efficiency.Text = String.Empty - txt4KMax2Efficiency.Text = String.Empty - txt4KMaxEfficiency.Text = String.Empty + txt4K10Efficiency.Text = String.Empty + txt4KMax2Efficiency.Text = String.Empty + txt4KMaxEfficiency.Text = String.Empty - txt6K10Efficiency.Text = String.Empty - txt6KMax2Efficiency.Text = String.Empty - txt6KMaxEfficiency.Text = String.Empty + txt6K10Efficiency.Text = String.Empty + txt6KMax2Efficiency.Text = String.Empty + txt6KMaxEfficiency.Text = String.Empty - txt2KMax2Amps.Text = String.Empty - txt2KMaxAmps.Text = String.Empty + txt2KMax2Amps.Text = String.Empty + txt2KMaxAmps.Text = String.Empty - txt4KMax2Amps.Text = String.Empty - txt4KMaxAmps.Text = String.Empty + txt4KMax2Amps.Text = String.Empty + txt4KMaxAmps.Text = String.Empty - txt6KMax2Amps.Text = String.Empty - txt6KMaxAmps.Text = String.Empty + txt6KMax2Amps.Text = String.Empty + txt6KMaxAmps.Text = String.Empty - txtPulleyRatio.Text = String.Empty + txtPulleyRatio.Text = String.Empty - ErrorProvider1.SetError(txtAlternatorName, String.empty) - ErrorProvider1.SetError(txt2K10Efficiency, String.empty) - ErrorProvider1.SetError(txt2KMax2Efficiency, String.empty) - ErrorProvider1.SetError(txt2KMaxEfficiency, String.empty) - ErrorProvider1.SetError(txt4K10Efficiency, String.empty) - ErrorProvider1.SetError(txt4KMax2Efficiency, String.empty) - ErrorProvider1.SetError(txt4KMaxEfficiency, String.empty) - ErrorProvider1.SetError(txt6K10Efficiency, String.empty) - ErrorProvider1.SetError(txt6KMax2Efficiency, String.empty) - ErrorProvider1.SetError(txt6KMaxEfficiency, String.empty) + ErrorProvider1.SetError(txtAlternatorName, String.empty) + ErrorProvider1.SetError(txt2K10Efficiency, String.empty) + ErrorProvider1.SetError(txt2KMax2Efficiency, String.empty) + ErrorProvider1.SetError(txt2KMaxEfficiency, String.empty) + ErrorProvider1.SetError(txt4K10Efficiency, String.empty) + ErrorProvider1.SetError(txt4KMax2Efficiency, String.empty) + ErrorProvider1.SetError(txt4KMaxEfficiency, String.empty) + ErrorProvider1.SetError(txt6K10Efficiency, String.empty) + ErrorProvider1.SetError(txt6KMax2Efficiency, String.empty) + ErrorProvider1.SetError(txt6KMaxEfficiency, String.empty) - ErrorProvider1.SetError(txtPulleyRatio, String.empty) - End Sub + ErrorProvider1.SetError(txtPulleyRatio, String.empty) + End Sub - Public Function Validate_UpdatePanel() As Boolean + Public Function Validate_UpdatePanel() As Boolean - Dim returnResult As Boolean = True + Dim returnResult As Boolean = True - IsEmptyString(txtAlternatorName.Text, txtAlternatorName, - "Please enter a name for the alternator, names must be unique", returnResult) + IsEmptyString(txtAlternatorName.Text, txtAlternatorName, + "Please enter a name for the alternator, names must be unique", returnResult) - If Not IsNumberBetweenOverZeroAndLessThan100(txt2K10Efficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMax2Efficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMaxEfficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt2K10Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMax2Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMaxEfficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt4K10Efficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMax2Efficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMaxEfficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt4K10Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMax2Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMaxEfficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt6K10Efficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMax2Efficiency) Then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMaxEfficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt6K10Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMax2Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMaxEfficiency) Then returnResult = False - If Not IsNumberGreaterThan10(txt2KMax2Amps) Then returnResult = False - If Not IsNumberGreaterThan10(txt2KMaxAmps) Then returnResult = False + If Not IsNumberGreaterThan10(txt2KMax2Amps) Then returnResult = False + If Not IsNumberGreaterThan10(txt2KMaxAmps) Then returnResult = False - If Not IsNumberGreaterThan10(txt4KMax2Amps) Then returnResult = False - If Not IsNumberGreaterThan10(txt4KMaxAmps) Then returnResult = False + If Not IsNumberGreaterThan10(txt4KMax2Amps) Then returnResult = False + If Not IsNumberGreaterThan10(txt4KMaxAmps) Then returnResult = False - If Not IsNumberGreaterThan10(txt6KMax2Amps) Then returnResult = False - If Not IsNumberGreaterThan10(txt6KMaxAmps) Then returnResult = False + If Not IsNumberGreaterThan10(txt6KMax2Amps) Then returnResult = False + If Not IsNumberGreaterThan10(txt6KMaxAmps) Then returnResult = False - If Not IsPostiveNumber(txtPulleyRatio.text) Then - ErrorProvider1.SetError(txtPulleyRatio, "Please enter a sensible positive number") - returnResult = False - Else - ErrorProvider1.SetError(txtPulleyRatio, String.Empty) - End If + If Not IsPostiveNumber(txtPulleyRatio.text) Then + ErrorProvider1.SetError(txtPulleyRatio, "Please enter a sensible positive number") + returnResult = False + Else + ErrorProvider1.SetError(txtPulleyRatio, String.Empty) + End If - Return returnResult - End Function + Return returnResult + End Function - Private Sub FillEditPanel(index As Integer) + Private Sub FillEditPanel(index As Integer) - Dim alt As IAlternator - Dim alternatorName As String = gvAlternators.Rows(index).Cells("AlternatorName").Value.ToString() + Dim alt As IAlternator + Dim alternatorName As String = gvAlternators.Rows(index).Cells("AlternatorName").Value.ToString() - alt = combinedAlt.Alternators.First(Function(f) f.AlternatorName = alternatorName) + alt = combinedAlt.Alternators.First(Function(f) f.AlternatorName = alternatorName) - txtIndex.Text = index.ToString() - txtAlternatorName.Text = alt.AlternatorName + txtIndex.Text = index.ToString() + txtAlternatorName.Text = alt.AlternatorName - 'Table1 - 2K Table - txt2K10Amps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() - txt2K10Efficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() + 'Table1 - 2K Table + txt2K10Amps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() + txt2K10Efficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() - txt2KMax2Amps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() - txt2KMax2Efficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() + txt2KMax2Amps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() + txt2KMax2Efficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() - txt2KMaxAmps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() - txt2KMaxEfficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() + txt2KMaxAmps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() + txt2KMaxEfficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() - 'Table2 - 4K Table - txt4K10Amps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() - txt4K10Efficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() + 'Table2 - 4K Table + txt4K10Amps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() + txt4K10Efficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() - txt4KMax2Amps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() - txt4KMax2Efficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() + txt4KMax2Amps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() + txt4KMax2Efficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() - txt4KMaxAmps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() - txt4KMaxEfficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() + txt4KMaxAmps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() + txt4KMaxEfficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() - 'Table3 - 6K Table - txt6K10Amps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() - txt6K10Efficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() + 'Table3 - 6K Table + txt6K10Amps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() + txt6K10Efficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() - txt6KMax2Amps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() - txt6KMax2Efficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() + txt6KMax2Amps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() + txt6KMax2Efficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() - txt6KMaxAmps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() - txt6KMaxEfficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() + txt6KMaxAmps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() + txt6KMaxEfficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() - txtPulleyRatio.Text = alt.PulleyRatio.ToString() - End Sub + txtPulleyRatio.Text = alt.PulleyRatio.ToString() + End Sub End Class diff --git a/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb b/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb index 0d96c240f22b73072c6c0bfaba6cb0b8aeaa4a80..d8bdf80d1ad1e93226fda1ce5856879e55b06bc0 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmHVACTool.vb @@ -3,6 +3,9 @@ Imports VectoAuxiliaries.Hvac Imports System.ComponentModel Imports System.Drawing Imports System.Globalization +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Util Public Class frmHVACTool 'Fields diff --git a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj index 287a7e548c315be9eb2acf1dc419fa31c16920b9..8f603b7556f9a0c0c1bbf2cdf1f9470b60245782 100644 --- a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj +++ b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj @@ -7,7 +7,7 @@ <ProjectGuid>{FDEEE460-0B8A-4EF6-8D9E-72F203A50F65}</ProjectGuid> <OutputType>Library</OutputType> <RootNamespace>VectoAuxiliaries</RootNamespace> - <AssemblyName>BusAuxiliaries</AssemblyName> + <AssemblyName>BusAuxiliariesGUI</AssemblyName> <FileAlignment>512</FileAlignment> <MyType>Windows</MyType> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> @@ -27,7 +27,7 @@ <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> - <DocumentationFile>BusAuxiliaries.xml</DocumentationFile> + <DocumentationFile>BusAuxiliariesGUI.xml</DocumentationFile> <NoWarn> </NoWarn> <WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors> @@ -39,7 +39,7 @@ <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> - <DocumentationFile>BusAuxiliaries.xml</DocumentationFile> + <DocumentationFile>BusAuxiliariesGUI.xml</DocumentationFile> <NoWarn> </NoWarn> <WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors> @@ -90,99 +90,6 @@ <Import Include="System.Threading.Tasks" /> </ItemGroup> <ItemGroup> - <Compile Include="AdvancedAuxiliaries.vb" /> - <Compile Include="AuxiliaryConfig.vb" /> - <Compile Include="DownstreamModules\cDelaunayMap.vb" /> - <Compile Include="DownstreamModules\cFile V3.vb" /> - <Compile Include="DownstreamModules\cMAP.vb" /> - <Compile Include="DownstreamModules\IM10.vb" /> - <Compile Include="DownstreamModules\IM11.vb" /> - <Compile Include="DownstreamModules\IM12.vb" /> - <Compile Include="DownstreamModules\IM13.vb" /> - <Compile Include="DownstreamModules\IM14.vb" /> - <Compile Include="DownstreamModules\IM6.vb" /> - <Compile Include="DownstreamModules\IM7.vb" /> - <Compile Include="DownstreamModules\IM8.vb" /> - <Compile Include="DownstreamModules\IM9.vb" /> - <Compile Include="DownstreamModules\M10.vb" /> - <Compile Include="DownstreamModules\M11.vb" /> - <Compile Include="DownstreamModules\M12.vb" /> - <Compile Include="DownstreamModules\M13.vb" /> - <Compile Include="DownstreamModules\M14.vb" /> - <Compile Include="DownstreamModules\M7.vb" /> - <Compile Include="DownstreamModules\M8.vb" /> - <Compile Include="DownstreamModules\M9.vb" /> - <Compile Include="Electrics\Alternator.vb" /> - <Compile Include="Electrics\AlternatorMapValues.vb" /> - <Compile Include="Electrics\AlternatorMap.vb" /> - <Compile Include="Electrics\AltUserInput.vb" /> - <Compile Include="Electrics\CombinedAlternator.vb" /> - <Compile Include="Electrics\CombinedAlternatorMapRow.vb" /> - <Compile Include="Electrics\CombinedAlternatorSignals.vb" /> - <Compile Include="Electrics\ElectricsUserInputsConfig.vb" /> - <Compile Include="Electrics\IAlternator.vb" /> - <Compile Include="Electrics\ICombinedAlternator.vb" /> - <Compile Include="Electrics\ICombinedAlternatorMapRow.vb" /> - <Compile Include="Electrics\ICombinedAlternatorSignals.vb" /> - <Compile Include="Electrics\IElectricsUserInputsConfig.vb" /> - <Compile Include="Electrics\IM0_5_SmartAlternatorSetEfficiency.vb" /> - <Compile Include="Electrics\IM2_AverageElectricalLoadDemand.vb" /> - <Compile Include="Electrics\IM5_SmartAlternatorSetGeneration.vb" /> - <Compile Include="Electrics\IResultCard.vb" /> - <Compile Include="Electrics\M0_5_SmartAlternatorSetEfficiency.vb" /> - <Compile Include="Electrics\M0_NonSmart_AlternatorsSetEfficiency.vb" /> - <Compile Include="Electrics\ElectricalConsumerList.vb" /> - <Compile Include="Electrics\ElectricConstants.vb" /> - <Compile Include="Electrics\IM0_NonSmart_AlternatorsSetEfficiency.vb" /> - <Compile Include="Electrics\M5__SmartAlternatorSetGeneration.vb" /> - <Compile Include="Electrics\ResultCard.vb" /> - <Compile Include="Electrics\SmartResult.vb" /> - <Compile Include="FilePathUtils.vb" /> - <Compile Include="Hvac\Bus.vb" /> - <Compile Include="Hvac\BusDatabase.vb" /> - <Compile Include="Hvac\BusEngineType.vb" /> - <Compile Include="Hvac\DeleteCell.vb" /> - <Compile Include="Hvac\DeleteColumn.vb" /> - <Compile Include="Hvac\EnvironmentalCondition.vb" /> - <Compile Include="Hvac\EnvironmentalConditionsMap.vb" /> - <Compile Include="Hvac\HVACConstants.vb" /> - <Compile Include="Electrics\IElectricalConsumerList.vb" /> - <Compile Include="Hvac\HVACSteadyStateModel.vb" /> - <Compile Include="Hvac\HVACUserInputsConfig.vb" /> - <Compile Include="Hvac\IBus.vb" /> - <Compile Include="Hvac\IBusDatabase.vb" /> - <Compile Include="Hvac\IEnvironmentalCondition.vb" /> - <Compile Include="Hvac\IEnvironmentalConditionsMap.vb" /> - <Compile Include="Hvac\IHVACConstants.vb" /> - <Compile Include="Hvac\IHVACSteadyStateModel.vb" /> - <Compile Include="Hvac\IHVACUserInputsConfig.vb" /> - <Compile Include="Hvac\IM1_AverageHVACLoadDemand.vb" /> - <Compile Include="Hvac\ISSMCalculate.vb" /> - <Compile Include="Hvac\ISSMGenInputs.vb" /> - <Compile Include="Hvac\ISSMRun.vb" /> - <Compile Include="Hvac\ISSMTechList.vb" /> - <Compile Include="Hvac\ISSMTOOL.vb" /> - <Compile Include="Hvac\ITechListBenefitLine.vb" /> - <Compile Include="Hvac\SSMCalculate.vb" /> - <Compile Include="Hvac\SSMGenInputs.vb" /> - <Compile Include="Hvac\SSMRun.vb" /> - <Compile Include="Hvac\SSMTechList.vb" /> - <Compile Include="Hvac\SSMTOOL.vb" /> - <Compile Include="Hvac\TechListBenefitLine.vb" /> - <Compile Include="IAuxiliaryConfig.vb" /> - <Compile Include="DownstreamModules\M6.vb" /> - <Compile Include="Pneumatics\ActuationsKey.vb" /> - <Compile Include="Pneumatics\IM3_AveragePneumaticLoadDemand.vb" /> - <Compile Include="Pneumatics\M4_AirCompressor.vb" /> - <Compile Include="Electrics\M2_AverageElectricalLoadDemand.vb" /> - <Compile Include="Hvac\M1_AverageHVACLoadDemand.vb" /> - <Compile Include="Pneumatics\M3_AveragePneumaticLoadDemand.vb" /> - <Compile Include="Pneumatics\CompressorMap.vb" /> - <Compile Include="Electrics\ElectricalConsumer.vb" /> - <Compile Include="Electrics\IAlternatorMap.vb" /> - <Compile Include="Pneumatics\IM4_AirCompressor.vb" /> - <Compile Include="Pneumatics\ICompressorMap.vb" /> - <Compile Include="Electrics\IElectricalConsumer.vb" /> <Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\Application.Designer.vb"> <AutoGen>True</AutoGen> @@ -198,12 +105,6 @@ <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> - <Compile Include="Pneumatics\IPneumaticActuationsMAP.vb" /> - <Compile Include="Pneumatics\IPneumaticsAuxilliariesConfig.vb" /> - <Compile Include="Pneumatics\IPneumaticUserInputsConfig.vb" /> - <Compile Include="Pneumatics\PneumaticActuationsMap.vb" /> - <Compile Include="Pneumatics\PneumaticsAuxilliariesConfig.vb" /> - <Compile Include="Pneumatics\PneumaticUserInputsConfig.vb" /> <Compile Include="UI\cFileBrowser.vb" /> <Compile Include="UI\FB_Dialog.designer.vb"> <DependentUpon>FB_Dialog.vb</DependentUpon> @@ -278,6 +179,10 @@ </ItemGroup> <ItemGroup> <Folder Include="3rdPartyLibraries\" /> + <Folder Include="DownstreamModules\" /> + <Folder Include="Electrics\" /> + <Folder Include="Hvac\" /> + <Folder Include="Pneumatics\" /> </ItemGroup> <ItemGroup> <None Include="Images\application-export-icon-small.png" /> @@ -292,14 +197,14 @@ </Resource> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\VectoCommon\AdvancedAuxiliaryInterfaces\AdvancedAuxiliaryInterfaces.vbproj"> - <Project>{b4b9bd2f-fd8f-4bb8-82fa-e2154d2c7fbd}</Project> - <Name>AdvancedAuxiliaryInterfaces</Name> - </ProjectReference> <ProjectReference Include="..\..\VectoCommon\VectoCommon\VectoCommon.csproj"> <Project>{79A066AD-69A9-4223-90F6-6ED5D2D084F4}</Project> <Name>VectoCommon</Name> </ProjectReference> + <ProjectReference Include="..\BusAuxiliaries\BusAuxiliaries.csproj"> + <Project>{550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}</Project> + <Name>BusAuxiliaries</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <None Include="Resources\Open-icon.png" /> diff --git a/VECTOAux/VectoAuxiliaries/VectoInputs.vb b/VECTOAux/VectoAuxiliaries/VectoInputs.vb deleted file mode 100644 index 198cd7ba8ffcd732c67fb6cf2c4f6926d969494a..0000000000000000000000000000000000000000 --- a/VECTOAux/VectoAuxiliaries/VectoInputs.vb +++ /dev/null @@ -1,18 +0,0 @@ - - -Public Class VectoInputs - -Implements IVectoInputs - - Public Property Cycle As String Implements IVectoInputs.Cycle - - Public Property VehicleWeightKG As Single Implements IVectoInputs.VehicleWeightKG - - Public Property PowerNetVoltage As Single Implements IVectoInputs.PowerNetVoltage - - Public Property CycleDurationMinutes As Single Implements IVectoInputs.CycleDurationMinutes - - Public Property FuelMap As String Implements IVectoInputs.FuelMap - -End Class - diff --git a/VECTOAux/VectoAuxiliariesTests/IntegrationTests/AuxDemandTest.vb b/VECTOAux/VectoAuxiliariesTests/IntegrationTests/AuxDemandTest.vb index a02db65f7dad4e57fbee31f9f190a56b2b284fa5..6ae0157c8ac076fbcf3e42907c87d35e2656d816 100644 --- a/VECTOAux/VectoAuxiliariesTests/IntegrationTests/AuxDemandTest.vb +++ b/VECTOAux/VectoAuxiliariesTests/IntegrationTests/AuxDemandTest.vb @@ -1,7 +1,9 @@ Imports System.IO Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Legacy Namespace IntegrationTests <TestFixture> @@ -68,7 +70,7 @@ Namespace IntegrationTests Dim engineFCMapFilePath = "TestFiles\Integration\24t Coach.vmap" Dim auxFilePath = "TestFiles\Integration\AdvAuxTest.aaux" - Dim aux As AdvancedAuxiliaries = New AdvancedAuxiliaries + Dim aux As IAdvancedAuxiliaries = New AdvancedAuxiliaries aux.VectoInputs.Cycle = "Coach" aux.VectoInputs.VehicleWeightKG = 12000.SI(Of Kilogram)() @@ -84,7 +86,7 @@ Namespace IntegrationTests aux.Signals.TotalCycleTimeSeconds = 15000 aux.Signals.EngineIdleSpeed = 560.RPMtoRad() - aux.Initialise(Path.GetFileName(auxFilePath), Path.GetDirectoryName(Path.GetFullPath(auxFilePath)) + "\") + CType(aux, AdvancedAuxiliaries).Initialise(Path.GetFileName(auxFilePath), Path.GetDirectoryName(Path.GetFullPath(auxFilePath)) + "\") aux.Signals.ClutchEngaged = True aux.Signals.EngineDrivelinePower = (driveLinePower * 1000).SI(Of Watt)() 'kW @@ -100,9 +102,10 @@ Namespace IntegrationTests Dim msg As String = String.Empty For i As Integer = 0 To 9 + aux.ResetCalculations() Assert.AreEqual(6087.0317, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001) aux.CycleStep(1.SI(Of Second), msg) - Debug.Print("{0}", aux.AA_TotalCycleFC_Grams) + Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams) Next Assert.AreEqual(79.303.SI(Unit.SI.Gramm).Value(), aux.AA_TotalCycleFC_Grams().Value(), 0.0001) @@ -112,9 +115,10 @@ Namespace IntegrationTests aux.Signals.InternalEnginePower = (-50 * 1000).SI(Of Watt)() For i As Integer = 0 To 9 + aux.ResetCalculations() Assert.AreEqual(8954.1435, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001) aux.CycleStep(1.SI(Of Second), msg) - Debug.Print("{0}", aux.AA_TotalCycleFC_Grams) + Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams) Next Assert.AreEqual(82.5783.SI(Unit.SI.Gramm).Value(), aux.AA_TotalCycleFC_Grams().Value(), 0.0001) @@ -124,8 +128,10 @@ Namespace IntegrationTests aux.Signals.InternalEnginePower = (internalPower * 1000).SI(Of Watt)() 'kW For i As Integer = 0 To 9 + aux.ResetCalculations() Assert.AreEqual(6087.0317, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001) aux.CycleStep(1.SI(Of Second), msg) + Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams) Next Assert.AreEqual(162.4655.SI(Unit.SI.Gramm).Value(), aux.AA_TotalCycleFC_Grams().Value(), 0.0001) diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb index 99df79b2500a3a5dbbf232c825d41352bce00469..c13004cbdb01ba71475f3685097f805567f29143 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb @@ -1,5 +1,7 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics + +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Namespace Mocks @@ -27,10 +29,7 @@ Namespace Mocks End Function - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As VectoAuxiliaries.AdvancedAuxiliaryMessageType) Implements VectoAuxiliaries.IAuxiliaryEvent.AuxiliaryEvent - - - + Public Event IAuxiliaryEvent_AuxiliaryEvent As AuxiliaryEventEventHandler Implements IAuxiliaryEvent.AuxiliaryEvent End Class End Namespace diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/CompressorMapMock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/CompressorMapMock.vb index f78f43a9a8a8b659be61479230e4ef11a94b7db1..be027357db4805f1d284f49249bbf563614e6a68 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/CompressorMapMock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/CompressorMapMock.vb @@ -1,6 +1,7 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Pneumatics + +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem Namespace Mocks Public Class CompressorMapMock @@ -40,7 +41,6 @@ Namespace Mocks End Function - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent + Public Event AuxiliaryEvent As AuxiliaryEventEventHandler Implements IAuxiliaryEvent.AuxiliaryEvent End Class End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/ElectricalConsumerMock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/ElectricalConsumerMock.vb index ac0e67d58b37ef2c83ba6ac07679bf4283f404e8..8b2fe74f735497034620518d4645610ca89cdfd3 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/ElectricalConsumerMock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/ElectricalConsumerMock.vb @@ -1,6 +1,7 @@ -Imports VectoAuxiliaries.Electrics + Imports System.ComponentModel Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Namespace Mocks Public Class ElectricalConsumerMock diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/M1_Mock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/M1_Mock.vb index bf564858d1ea3a3d4fb03a4201bfc7e8a7baafcb..7cb81d51438b98db0f903341d31f98d80ab12006 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/M1_Mock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/M1_Mock.vb @@ -1,9 +1,7 @@  + Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Public Class M1_Mock @@ -51,5 +49,9 @@ Public Class M1_Mock _HVACFuelingLitresPerHour = HVACFuelingLitresPerHour.SI(Unit.SI.Liter.Per.Hour).Cast(Of LiterPerSecond)() _ '(Of LiterPerHour)() End Sub + + Public Sub ResetCalculations() Implements IAbstractModule.ResetCalculations + Throw New NotImplementedException + End Sub End Class diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/M2_Mock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/M2_Mock.vb index e555250bf37b42e723a7985e69793943ef09084d..af8377fc9c92ae0153e658b2e373b5578fd69b18 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/M2_Mock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/M2_Mock.vb @@ -1,8 +1,6 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Public Class M2_Mock Implements IM2_AverageElectricalLoadDemand @@ -32,5 +30,9 @@ Public Class M2_Mock _GetAveragePowerAtCrankFromElectrics = GetAveragePowerAtCrankFromElectrics.SI(Of Watt)() _GetAveragePowerDemandAtAlternator = GetAveragePowerDemandAtAlternator.SI(Of Watt)() End Sub + + Public Sub ResetCalculations() Implements IAbstractModule.ResetCalculations + Throw New NotImplementedException + End Sub End Class diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/M3_Mock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/M3_Mock.vb index c7d3bd5e9f70bb10c5985934395ffb2808729113..8cffe6ccac68d43d9d2357a9dcb9275e3817ab3e 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/M3_Mock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/M3_Mock.vb @@ -1,14 +1,13 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Public Class M3_Mock Implements IM3_AveragePneumaticLoadDemand Public _GetAveragePowerDemandAtCrankFromPneumatics As Watt Public _TotalAirConsumedPerCycle As NormLiterPerSecond + Private _totalAirDemand As NormLiter Public Function GetAveragePowerDemandAtCrankFromPneumatics() As Watt _ @@ -16,6 +15,12 @@ Public Class M3_Mock Return _GetAveragePowerDemandAtCrankFromPneumatics End Function + Public ReadOnly Property TotalAirDemand As NormLiter Implements IM3_AveragePneumaticLoadDemand.TotalAirDemand + Get + Return _totalAirDemand + End Get + End Property + Public Function TotalAirConsumedPerCycle() As NormLiterPerSecond _ Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumedPerSecondLitre Return _TotalAirConsumedPerCycle @@ -30,5 +35,9 @@ Public Class M3_Mock _GetAveragePowerDemandAtCrankFromPneumatics = GetAveragePowerDemandAtCrankFromPneumatics.SI(Of Watt)() _TotalAirConsumedPerCycle = TotalAirConsumedPerCycle.SI(Of NormLiterPerSecond)() End Sub + + Public Sub ResetCalculations() Implements IAbstractModule.ResetCalculations + Throw New NotImplementedException + End Sub End Class diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/M4_Mock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/M4_Mock.vb index 7eb7e8e7447dfd252a0d14a980b5a6f6f8565227..d7a3fe769a85ac8a0ee8494d1beb46a7dfe27030 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/M4_Mock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/M4_Mock.vb @@ -1,8 +1,6 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Public Class M4_Mock Implements IM4_AirCompressor @@ -63,6 +61,8 @@ Public Class M4_Mock Public Property PulleyGearRatio As Double Implements IM4_AirCompressor.PulleyGearRatio - + Public Sub ResetCalculations() Implements IAbstractModule.ResetCalculations + Throw New NotImplementedException + End Sub End Class diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/M5_Mock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/M5_Mock.vb index 1b53fb739f6a5c3722772ab834fac0a3f8f69021..60dacc78a7955db333aacd794fb698909dc63d47 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/M5_Mock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/M5_Mock.vb @@ -1,8 +1,6 @@ -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Public Class M5_Mock Implements IM5_SmartAlternatorSetGeneration @@ -40,5 +38,9 @@ Public Class M5_Mock _AlternatorsGenerationPowerAtCrankOverrunWatts = AlternatorsGenerationPowerAtCrankOverrunWatts.SI(Of Watt)() _AlternatorsGenerationPowerAtCrankTractionOnWatts = AlternatorsGenerationPowerAtCrankTractionOnWatts.SI(Of Watt)() End Sub + + Public Sub ResetCalculations() Implements IAbstractModule.ResetCalculations + Throw New NotImplementedException + End Sub End Class diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/M6_Mock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/M6_Mock.vb index 3ccbc1173173cd1b75825a336202bb0001bbefad..f90b846efc7d79d98e34513baaa82f8b1efa2ea0 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/M6_Mock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/M6_Mock.vb @@ -1,9 +1,7 @@  + Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Public Class M6_Mock @@ -105,5 +103,9 @@ Public Class M6_Mock _SmartPneumaticOnlyAirCompPowerGenAtCrank = SmartPneumaticOnlyAirCompPowerGenAtCrank.SI(Of Watt)() _SmartPneumaticsOnlyCompressorFlag = SmartPneumaticsOnlyCompressorFlag End Sub + + Public Sub ResetCalculations() Implements IAbstractModule.ResetCalculations + Throw New NotImplementedException + End Sub End Class diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/M7_Mock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/M7_Mock.vb index 4bae96687221cf91fe6828d1d4268ecb05a85976..ff82f3186877ce16072a10492589df86106292ba 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/M7_Mock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/M7_Mock.vb @@ -1,9 +1,7 @@  + Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Public Class M7_Mock @@ -57,4 +55,8 @@ Public Class M7_Mock _SmartElectricalOnlyAuxAltPowerGenAtCrank = SmartElectricalOnlyAuxAltPowerGenAtCrank _SmartPneumaticOnlyAuxAirCompPowerGenAtCrank = SmartPneumaticOnlyAuxAirCompPowerGenAtCrank End Sub + + Public Sub ResetCalculations() Implements IAbstractModule.ResetCalculations + Throw New NotImplementedException + End Sub End Class \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/MockFuel50PC.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/MockFuel50PC.vb index 0c46f104e4bd1bb1d10426391ed241842553ee99..e2bd2bc8bc07e4a761b5630854d95e7641ea0af2 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/MockFuel50PC.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/MockFuel50PC.vb @@ -1,10 +1,6 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules -Imports NUnit.Framework + Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries +Imports IFuelConsumptionMap = TUGraz.VectoCore.BusAuxiliaries.Interfaces.IFuelConsumptionMap Public Class MockFuel50PC Implements IFuelConsumptionMap diff --git a/VECTOAux/VectoAuxiliariesTests/My Project/AssemblyInfo.vb b/VECTOAux/VectoAuxiliariesTests/My Project/AssemblyInfo.vb index 8a817cbc687327d3de4fa623c2dc293936de6bc9..eeac372c0e73ddab5c087750ab04c70a241a0429 100644 --- a/VECTOAux/VectoAuxiliariesTests/My Project/AssemblyInfo.vb +++ b/VECTOAux/VectoAuxiliariesTests/My Project/AssemblyInfo.vb @@ -1,4 +1,4 @@ -Imports System + Imports System.Reflection Imports System.Runtime.InteropServices diff --git a/VECTOAux/VectoAuxiliariesTests/My Project/Resources.Designer.vb b/VECTOAux/VectoAuxiliariesTests/My Project/Resources.Designer.vb index 1d5344126ac3f53250286b2a06eb565859f05b2c..85d6bfb2c066b018577c7780b757506fe17b5b51 100644 --- a/VECTOAux/VectoAuxiliariesTests/My Project/Resources.Designer.vb +++ b/VECTOAux/VectoAuxiliariesTests/My Project/Resources.Designer.vb @@ -11,7 +11,6 @@ Option Strict On Option Explicit On -Imports System Namespace My.Resources diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/AdvAuxTest.aaux b/VECTOAux/VectoAuxiliariesTests/TestFiles/AdvAuxTest.aaux index 5e8e8ba738e7af19ca1838a86afaa7de8a4b6730..af74193dca3536190cf722465d2563e5b20201d8 100644 --- a/VECTOAux/VectoAuxiliariesTests/TestFiles/AdvAuxTest.aaux +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/AdvAuxTest.aaux @@ -1,7 +1,7 @@ { - "$type": "VectoAuxiliaries.AuxiliaryConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.AuxiliaryConfig, BusAuxiliaries", "VectoInputs": { - "$type": "VectoAuxiliaries.VectoInputs, AdvancedAuxiliaryInterfaces", + "$type": "TUGraz.VectoCore.BusAuxiliaries.Interfaces.VectoInputs, AdvancedAuxiliaryInterfaces", "Cycle": "Urban", "VehicleWeightKG": 16500.0, "PowerNetVoltage": 28.3, @@ -9,16 +9,16 @@ "FuelDensity": 0.832 }, "ElectricalUserInputsConfig": { - "$type": "VectoAuxiliaries.Electrics.ElectricsUserInputsConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricsUserInputsConfig, BusAuxiliaries", "PowerNetVoltage": 28.3, "AlternatorMap": "testCombAlternatorMap_1Alt.AALT", "AlternatorGearEfficiency": 0.92, "ElectricalConsumers": { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumerList, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumerList, BusAuxiliaries", "DoorDutyCycleFraction": 0.096, "Items": [ { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Doors", "ConsumerName": "Doors per Door", @@ -29,7 +29,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": true, "Category": "Veh Electronics &Engine", "ConsumerName": "Controllers,Valves etc", @@ -40,7 +40,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Radio City", @@ -51,7 +51,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Radio Intercity", @@ -62,7 +62,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Radio/Audio Tourism", @@ -73,7 +73,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Fridge", @@ -84,7 +84,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Kitchen Standard", @@ -95,7 +95,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Interior lights City/ Intercity + Doorlights [1/m]", @@ -106,7 +106,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "LED Interior lights ceiling city/ontercity + door [1/m]", @@ -117,7 +117,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Interior lights Tourism + reading [1/m]", @@ -128,7 +128,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "LED Interior lights ceiling Tourism + LED reading [1/m]", @@ -139,7 +139,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Customer Specific Equipment", "ConsumerName": "External Displays Font/Side/Rear", @@ -150,7 +150,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Customer Specific Equipment", "ConsumerName": "Internal display per unit ( front side rear)", @@ -161,7 +161,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Customer Specific Equipment", "ConsumerName": "CityBus Ref EBSF Table4 Devices ITS No Displays", @@ -172,7 +172,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Exterior Lights BULB", @@ -183,7 +183,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Day running lights LED bonus", @@ -194,7 +194,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Antifog rear lights LED bonus", @@ -205,7 +205,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Position lights LED bonus", @@ -216,7 +216,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Direction lights LED bonus", @@ -227,7 +227,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Brake Lights LED bonus", @@ -241,21 +241,21 @@ }, "DoorActuationTimeSecond": 4, "ResultCardIdle": { - "$type": "VectoAuxiliaries.Electrics.ResultCard, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ResultCard, BusAuxiliaries", "Results": [] }, "ResultCardTraction": { - "$type": "VectoAuxiliaries.Electrics.ResultCard, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ResultCard, BusAuxiliaries", "Results": [] }, "ResultCardOverrun": { - "$type": "VectoAuxiliaries.Electrics.ResultCard, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ResultCard, BusAuxiliaries", "Results": [] }, "SmartElectrical": false }, "PneumaticUserInputsConfig": { - "$type": "VectoAuxiliaries.Pneumatics.PneumaticUserInputsConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics.PneumaticUserInputsConfig, BusAuxiliaries", "CompressorMap": "DEFAULT_2-Cylinder_1-Stage_650ccm.ACMP", "CompressorGearRatio": 1.0, "CompressorGearEfficiency": 0.8, @@ -269,7 +269,7 @@ "SmartRegeneration": true }, "PneumaticAuxillariesConfig": { - "$type": "VectoAuxiliaries.Pneumatics.PneumaticsAuxilliariesConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics.PneumaticsAuxilliariesConfig, BusAuxiliaries", "AdBlueNIperMinute": 21.25, "AirControlledSuspensionNIperMinute": 15.0, "BrakingNoRetarderNIperKG": 0.00081, @@ -284,13 +284,13 @@ "SmartRegenFractionTotalAirDemand": 0.12 }, "HvacUserInputsConfig": { - "$type": "VectoAuxiliaries.Hvac.HVACUserInputsConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Hvac.HVACUserInputsConfig, BusAuxiliaries", "SSMFilePath": "testHVACssm.AHSM", "BusDatabasePath": "BusDatabase.abdb", "SSMDisabled": false }, "Signals": { - "$type": "VectoAuxiliaries.Signals, AdvancedAuxiliaryInterfaces", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Signals, AdvancedAuxiliaryInterfaces", "ClutchEngaged": false, "EngineDrivelinePower": 0.0, "EngineDrivelineTorque": 0.0, diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/AdvAuxTest.aaux b/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/AdvAuxTest.aaux index 5e8e8ba738e7af19ca1838a86afaa7de8a4b6730..134d8d901c17358f2696ef08718a1e026429eadd 100644 --- a/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/AdvAuxTest.aaux +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/AdvAuxTest.aaux @@ -1,7 +1,7 @@ { - "$type": "VectoAuxiliaries.AuxiliaryConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.AuxiliaryConfig, BusAuxiliaries", "VectoInputs": { - "$type": "VectoAuxiliaries.VectoInputs, AdvancedAuxiliaryInterfaces", + "$type": "TUGraz.VectoCore.BusAuxiliaries.Interfaces.VectoInputs, BusAuxiliaries", "Cycle": "Urban", "VehicleWeightKG": 16500.0, "PowerNetVoltage": 28.3, @@ -9,16 +9,16 @@ "FuelDensity": 0.832 }, "ElectricalUserInputsConfig": { - "$type": "VectoAuxiliaries.Electrics.ElectricsUserInputsConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricsUserInputsConfig, BusAuxiliaries", "PowerNetVoltage": 28.3, "AlternatorMap": "testCombAlternatorMap_1Alt.AALT", "AlternatorGearEfficiency": 0.92, "ElectricalConsumers": { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumerList, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumerList, BusAuxiliaries", "DoorDutyCycleFraction": 0.096, "Items": [ { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Doors", "ConsumerName": "Doors per Door", @@ -29,7 +29,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": true, "Category": "Veh Electronics &Engine", "ConsumerName": "Controllers,Valves etc", @@ -40,7 +40,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Radio City", @@ -51,7 +51,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Radio Intercity", @@ -62,7 +62,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Radio/Audio Tourism", @@ -73,7 +73,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Fridge", @@ -84,7 +84,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Kitchen Standard", @@ -95,7 +95,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Interior lights City/ Intercity + Doorlights [1/m]", @@ -106,7 +106,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "LED Interior lights ceiling city/ontercity + door [1/m]", @@ -117,7 +117,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "Interior lights Tourism + reading [1/m]", @@ -128,7 +128,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Vehicle basic equipment", "ConsumerName": "LED Interior lights ceiling Tourism + LED reading [1/m]", @@ -139,7 +139,7 @@ "Info": "1 Per metre length of bus" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Customer Specific Equipment", "ConsumerName": "External Displays Font/Side/Rear", @@ -150,7 +150,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Customer Specific Equipment", "ConsumerName": "Internal display per unit ( front side rear)", @@ -161,7 +161,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Customer Specific Equipment", "ConsumerName": "CityBus Ref EBSF Table4 Devices ITS No Displays", @@ -172,7 +172,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Exterior Lights BULB", @@ -183,7 +183,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Day running lights LED bonus", @@ -194,7 +194,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Antifog rear lights LED bonus", @@ -205,7 +205,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Position lights LED bonus", @@ -216,7 +216,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Direction lights LED bonus", @@ -227,7 +227,7 @@ "Info": "" }, { - "$type": "VectoAuxiliaries.Electrics.ElectricalConsumer, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ElectricalConsumer, BusAuxiliaries", "BaseVehicle": false, "Category": "Lights", "ConsumerName": "Brake Lights LED bonus", @@ -241,21 +241,21 @@ }, "DoorActuationTimeSecond": 4, "ResultCardIdle": { - "$type": "VectoAuxiliaries.Electrics.ResultCard, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ResultCard, BusAuxiliaries", "Results": [] }, "ResultCardTraction": { - "$type": "VectoAuxiliaries.Electrics.ResultCard, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ResultCard, BusAuxiliaries", "Results": [] }, "ResultCardOverrun": { - "$type": "VectoAuxiliaries.Electrics.ResultCard, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics.ResultCard, BusAuxiliaries", "Results": [] }, "SmartElectrical": false }, "PneumaticUserInputsConfig": { - "$type": "VectoAuxiliaries.Pneumatics.PneumaticUserInputsConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics.PneumaticUserInputsConfig, BusAuxiliaries", "CompressorMap": "DEFAULT_2-Cylinder_1-Stage_650ccm.ACMP", "CompressorGearRatio": 1.0, "CompressorGearEfficiency": 0.8, @@ -269,7 +269,7 @@ "SmartRegeneration": true }, "PneumaticAuxillariesConfig": { - "$type": "VectoAuxiliaries.Pneumatics.PneumaticsAuxilliariesConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics.PneumaticsAuxilliariesConfig, BusAuxiliaries", "AdBlueNIperMinute": 21.25, "AirControlledSuspensionNIperMinute": 15.0, "BrakingNoRetarderNIperKG": 0.00081, @@ -284,13 +284,13 @@ "SmartRegenFractionTotalAirDemand": 0.12 }, "HvacUserInputsConfig": { - "$type": "VectoAuxiliaries.Hvac.HVACUserInputsConfig, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.HVACUserInputsConfig, BusAuxiliaries", "SSMFilePath": "testHVACssm.AHSM", "BusDatabasePath": "BusDatabase.abdb", "SSMDisabled": false }, "Signals": { - "$type": "VectoAuxiliaries.Signals, AdvancedAuxiliaryInterfaces", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Signals, AdvancedAuxiliaryInterfaces", "ClutchEngaged": false, "EngineDrivelinePower": 0.0, "EngineDrivelineTorque": 0.0, diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/testHVACssm.AHSM b/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/testHVACssm.AHSM index 1b75fdccf61a231b57c06ef0c59738fd45ee3520..770ed286eaae206903b3ef3909f2573e24854e67 100644 --- a/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/testHVACssm.AHSM +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/Integration/testHVACssm.AHSM @@ -1,7 +1,7 @@ { - "$type": "VectoAuxiliaries.Hvac.SSMTOOL, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMTOOL, BusAuxiliaries", "GenInputs": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -41,7 +41,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -61,12 +61,12 @@ "AH_CoolantHeatTransferredToAirCabinHeater": 0.75 }, "TechList": { - "$type": "VectoAuxiliaries.Hvac.SSMTechList, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMTechList, BusAuxiliaries", "TechLines": [ { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -106,7 +106,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -149,9 +149,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -191,7 +191,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -234,9 +234,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -276,7 +276,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -319,9 +319,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -361,7 +361,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -404,9 +404,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -446,7 +446,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -489,9 +489,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -531,7 +531,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -574,9 +574,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -616,7 +616,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -659,9 +659,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "DummyBus", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -701,7 +701,7 @@ "EC_EnviromentalTemperature": 25.0, "EC_Solar": 400.0, "EC_EnvironmentalConditionsMap": { - "$type": "VectoAuxiliaries.Hvac.EnvironmentalConditionsMap, BusAuxiliaries" + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.EnvironmentalConditionsMap, BusAuxiliaries" }, "EC_EnviromentalConditions_BatchFile": "DefaultClimatic.aenv", "EC_EnviromentalConditions_BatchEnabled": true, @@ -756,7 +756,7 @@ "VVValueVariationKW": 0.0 }, "Calculate": { - "$type": "VectoAuxiliaries.Hvac.SSMCalculate, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMCalculate, BusAuxiliaries", "ElectricalWBase": 692.2979, "MechanicalWBase": 349.774, "FuelLPerHBase": 0.151278213, @@ -790,7 +790,7 @@ }, "SSMDisabled": false, "HVACConstants": { - "$type": "VectoAuxiliaries.Hvac.HVACConstants, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.HVACConstants, BusAuxiliaries", "DieselGCVJperGram": 44800.0, "FuelDensity": 0.832 }, diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/ssm.Ahsm b/VECTOAux/VectoAuxiliariesTests/TestFiles/ssm.Ahsm index 138a5abfef72318cd488c8ecd343b4e6e436f275..54e3c00b5286a0685630aeef7d78bcdee763c9df 100644 --- a/VECTOAux/VectoAuxiliariesTests/TestFiles/ssm.Ahsm +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/ssm.Ahsm @@ -1,7 +1,7 @@ { - "$type": "VectoAuxiliaries.Hvac.SSMTOOL, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMTOOL, BusAuxiliaries", "GenInputs": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -52,12 +52,12 @@ "AH_FuelFiredHeaterkW": 10.0 }, "TechList": { - "$type": "VectoAuxiliaries.Hvac.SSMTechList, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMTechList, BusAuxiliaries", "TechLines": [ { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -131,9 +131,9 @@ "C": 0.01 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -207,9 +207,9 @@ "C": 0.025 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -283,9 +283,9 @@ "C": 0.024 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -359,9 +359,9 @@ "C": -0.032 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -435,9 +435,9 @@ "C": 0.05 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -511,9 +511,9 @@ "C": 0.012 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -587,9 +587,9 @@ "C": 0.021 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -663,9 +663,9 @@ "C": 0.041 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -739,9 +739,9 @@ "C": 0.029 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -815,9 +815,9 @@ "C": 0.025 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -891,9 +891,9 @@ "C": 0.012 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -967,9 +967,9 @@ "C": 0.02 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1043,9 +1043,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1119,9 +1119,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1195,9 +1195,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1271,9 +1271,9 @@ "C": -0.032 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1347,9 +1347,9 @@ "C": -0.032 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1423,9 +1423,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1499,9 +1499,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1575,9 +1575,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1651,9 +1651,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1727,9 +1727,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1803,9 +1803,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1879,9 +1879,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -1955,9 +1955,9 @@ "C": 0.02 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -2031,9 +2031,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -2107,9 +2107,9 @@ "C": -0.2 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -2183,9 +2183,9 @@ "C": 0.0 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -2259,9 +2259,9 @@ "C": 0.012 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -2335,9 +2335,9 @@ "C": 0.021 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -2411,9 +2411,9 @@ "C": 0.012 }, { - "$type": "VectoAuxiliaries.Hvac.TechListBenefitLine, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.TechListBenefitLine, BusAuxiliaries", "inputSheet": { - "$type": "VectoAuxiliaries.Hvac.SSMGenInputs, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMGenInputs, BusAuxiliaries", "BP_BusModel": "IVECO - Arway Intercity 10.6m", "BP_NumberOfPassengers": 47.0, "BP_BusFloorType": "raised floor", @@ -2499,7 +2499,7 @@ "VVValueVariationKW": 0.0 }, "Calculate": { - "$type": "VectoAuxiliaries.Hvac.SSMCalculate, BusAuxiliaries", + "$type": "TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC.SSMCalculate, BusAuxiliaries", "ElectricalWBase": 296.699127, "MechanicalWBase": 1180.55444, "FuelLPerHBase": 0.0, diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AirCompressorTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AirCompressorTests.vb index b8e0c115ebfa219922a6059d9c747944efb96e7c..87e07497cd7d1cb791db48bda2144db9fb813969 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AirCompressorTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AirCompressorTests.vb @@ -1,8 +1,11 @@ Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries + Namespace UnitTests @@ -40,56 +43,56 @@ Namespace UnitTests Return New CompressorMapMock(True) End Function - Private Function GetGoodCompressor() As M4_AirCompressor + Private Function GetGoodCompressor() As IM4_AirCompressor Dim map As ICompressorMap = GetNonFailingCompressorMapMock() - Dim target As M4_AirCompressor = New M4_AirCompressor(map, GoodRatio, GoodEfficiency, _signals) + Dim target As IM4_AirCompressor = New M04Impl(map, GoodRatio, GoodEfficiency, _signals) Return target End Function #End Region - <Test()> + <TestCase()> Public Sub CreateNewJustPathTest() Dim map As ICompressorMap = GetNonFailingCompressorMapMock() _signals.EngineSpeed = 100.RPMtoRad() - Dim target As M4_AirCompressor = New M4_AirCompressor(map, 2, 0.8, _signals) + Dim target As IM4_AirCompressor = New M04Impl(map, 2, 0.8, _signals) Assert.IsNotNull(target) End Sub - <Test()> + <TestCase()> Public Sub CreateNewAllParametersTest() Dim map As ICompressorMap = GetNonFailingCompressorMapMock() - Dim target As M4_AirCompressor = New M4_AirCompressor(map, GoodRatio, GoodEfficiency, _signals) + Dim target As IM4_AirCompressor = New M04Impl(map, GoodRatio, GoodEfficiency, _signals) Assert.IsNotNull(target) End Sub - <Test()> + <TestCase()> Public Sub InitialiseTest() Dim map As ICompressorMap = GetNonFailingCompressorMapMock() _signals.EngineSpeed = 100.RPMtoRad() - Dim target As M4_AirCompressor = New M4_AirCompressor(map, 2, 0.8, _signals) + Dim target As IM4_AirCompressor = New M04Impl(map, 2, 0.8, _signals) Assert.IsTrue(target.Initialise()) End Sub - <Test()> + <TestCase()> Public Sub InitialiseInvalidMapTest() Dim map As ICompressorMap = GetFailingCompressorMapMock() _signals.EngineSpeed = 100.RPMtoRad() - Dim target As M4_AirCompressor = New M4_AirCompressor(map, 2, 0.8, _signals) + Dim target As IM4_AirCompressor = New M04Impl(map, 2, 0.8, _signals) Assert.That(Sub() target.Initialise(), Throws.InstanceOf(Of System.ArgumentException)) End Sub - <Test()> + <TestCase()> Public Sub GetEfficiencyTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim target = comp.PulleyGearEfficiency Assert.AreEqual(target, GoodEfficiency) End Sub - <Test()> + <TestCase()> Public Sub SetEfficiencyTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim target As Single = 0.3 comp.PulleyGearEfficiency = target Dim actual As Single = comp.PulleyGearEfficiency @@ -99,22 +102,22 @@ Namespace UnitTests <TestCase(TooLowEfficiency)> <TestCase(TooHighEfficiency)> Public Sub SetEfficiencyOutOfRangeTest(ByVal efficiency As Single) - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Assert.That(Sub() comp.PulleyGearEfficiency = efficiency, Throws.InstanceOf(Of ArgumentException)) End Sub - <Test()> + <TestCase()> Public Sub GetRatioTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim target = comp.PulleyGearRatio Assert.AreEqual(target, GoodRatio) End Sub - <Test()> + <TestCase()> Public Sub SetRatioTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim target As Single = 3 comp.PulleyGearRatio = target Dim actual As Single = comp.PulleyGearRatio @@ -124,50 +127,50 @@ Namespace UnitTests <TestCase(TooLowRatio)> <TestCase(TooHighRatio)> Public Sub SetRatioOutOfRangeTest(ByVal ratio As Single) - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Assert.That(Sub() comp.PulleyGearRatio = ratio, Throws.InstanceOf(Of ArgumentException)) End Sub - <Test()> + <TestCase()> Public Sub GetCompressorFlowRateTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim expected As Double = 0.0333333351 Dim actual = comp.GetFlowRate() Assert.AreEqual(expected, actual.Value(), 0.00000001) End Sub - <Test()> + <TestCase()> Public Sub GetPowerCompressorOffTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim expected As Double = 5.0 Dim actual = comp.GetPowerCompressorOff() Assert.AreEqual(expected, actual.Value(), 0.00000001) End Sub - <Test()> + <TestCase()> Public Sub GetPowerCompressorOnTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim expected As Double = 8.0 Dim actual = comp.GetPowerCompressorOn() Assert.AreEqual(expected, actual.Value(), 0.00000001) End Sub - <Test()> + <TestCase()> Public Sub GetPowerDifferenceTest() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim expected As Double = 3.0 Dim actual = comp.GetPowerDifference() Assert.AreEqual(expected, actual.Value(), 0.00000001) End Sub - <Test> + <TestCase> Public Sub GetAveragePowerDemandPerCompressorUnitFlowRate() - Dim comp As M4_AirCompressor = GetGoodCompressor() + Dim comp As IM4_AirCompressor = GetGoodCompressor() Dim expected As Single = 0.01 Dim actual As SI = comp.GetAveragePowerDemandPerCompressorUnitFlowRate diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb index 082bfb8ec092f7b402eb49b3ae2b2cb18ae0f992..54d5a03dd5273d11b2e072ef023a4853c9058984 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb @@ -1,7 +1,8 @@ -Imports VectoAuxiliaries.Electrics +Imports System.IO Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Namespace UnitTests @@ -17,6 +18,11 @@ Namespace UnitTests Private Const _ASYMETRICALCOMBINEDROWSMAP As String = "TestFiles\testAlternatorMapAsymetricalRowsCombined.aalt" Private Const _ASYMETRICALCOMBINEDXYPAIRSMAP As String = "TestFiles\testAlternatorMapAsymetricalXYPairsCombined.aalt" + <OneTimeSetUp> + Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + end Sub + <Test()> <TestCase(10, 1500, 0.615F)> _ diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentComparisonTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentComparisonTests.vb index 89291cbd1aeac1ae6531010cd76960e1ede9b9ae..bca8b75ec5595abde65e0fe083f2dacbfd27862c 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentComparisonTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentComparisonTests.vb @@ -1,11 +1,8 @@ -Imports System.Text + Imports NUnit.Framework -Imports NUnit -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac +Imports TUGraz.VectoCore.BusAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics + Namespace UnitTests <TestFixture()> diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb index 9c5ee5828b132c42c63a184441dbb544689ddc58..9fc040fe60e7f9c0b32249593529a69a39c96de8 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AuxiliaryEnvironmentPersistanceTests.vb @@ -1,10 +1,7 @@ -Imports System.Text + Imports NUnit.Framework -Imports NUnit -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac +Imports TUGraz.VectoCore.BusAuxiliaries + Namespace UnitTests diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb index f21248343a08496c1201f51952d344b8ba921688..8fb626626647a7434209c867643affb7d99f719f 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb @@ -1,10 +1,10 @@  -Imports VectoAuxiliaries.Pneumatics +Imports System.IO Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries - +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem Namespace UnitTests <TestFixture> @@ -24,6 +24,10 @@ Namespace UnitTests Private _defaultInputConfig As IPneumaticUserInputsConfig Private _Signals As ISignals = New Signals + <OneTimeSetUp> + Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + end Sub 'Constructors Public Sub New() @@ -51,7 +55,7 @@ Namespace UnitTests End Sub - <Test> + <TestCase()> Public Sub CreateNewtest() Dim psUserInputsConfig = CType(New PneumaticUserInputsConfig(), IPneumaticUserInputsConfig) @@ -68,14 +72,14 @@ Namespace UnitTests psCompressorMap.Initialise() Dim _ target As _ - New M3_AveragePneumaticLoadDemand(psUserInputsConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(psUserInputsConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Assert.IsNotNull(target) End Sub - <Test()> + <TestCase()> Public Sub AverageLoadValueUsingDefaultAuxValuesTest() initialise() @@ -88,11 +92,11 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Double = 7947.684 - Dim actual As NormLiter = target.TotalAirDemand() + Dim actual As NormLiter = target.TotalAirDemand Assert.AreEqual(expected, actual.Value(), 0.000001) End Sub @@ -110,7 +114,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Single = 5832.091 @@ -135,7 +139,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Single = 5832.091 @@ -156,7 +160,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Single = 7947.55127 / _Signals.TotalCycleTimeSeconds @@ -180,7 +184,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Double = 8863.378 / _Signals.TotalCycleTimeSeconds @@ -204,7 +208,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Double = 8541.45 / _Signals.TotalCycleTimeSeconds @@ -229,7 +233,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Double = 8557.524 / _Signals.TotalCycleTimeSeconds @@ -253,10 +257,10 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) - Dim expected As Double = 7947.68457 / _Signals.TotalCycleTimeSeconds + Dim expected As Double = 8726.1840 / _Signals.TotalCycleTimeSeconds Assert.AreEqual(expected, target.AverageAirConsumedPerSecondLitre().Value(), 0.001) End Sub @@ -277,7 +281,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Double = 7947.68457 / _Signals.TotalCycleTimeSeconds @@ -301,7 +305,7 @@ Namespace UnitTests Dim _ target As _ - New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, + New M03Impl(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG.SI(Of Kilogram), "Urban", _Signals) Dim expected As Double = 6880.88428 / _Signals.TotalCycleTimeSeconds diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/BusDatabaseTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/BusDatabaseTests.vb index 6b529e596a9973ca916e5d4abca48dcb8a7a1f05..9ca701d372f1bde2771a83c56e682406f345c456 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/BusDatabaseTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/BusDatabaseTests.vb @@ -1,8 +1,6 @@ -Imports NUnit.Framework -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Hvac + +Imports NUnit.Framework +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC Namespace UnitTests diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/CombinedAlternatorTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/CombinedAlternatorTests.vb index e75c41b58f060b50f5b3f28a0aa34b3d5f875737..1dce66661c549810a14a9f04dbc7225d0933b022 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/CombinedAlternatorTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/CombinedAlternatorTests.vb @@ -2,11 +2,11 @@ Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Hvac Imports System.IO +Imports Newtonsoft.Json +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Namespace UnitTests diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/CompressorMapTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/CompressorMapTests.vb index 1f397fee6e5e4dd324f1c30d394cdc7248b34c33..917d3945b657f24d56bdf04b8ac0c6cbf20eeb23 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/CompressorMapTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/CompressorMapTests.vb @@ -1,7 +1,8 @@ Imports System.IO Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics + Namespace UnitTests <TestFixture()> diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerListTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerListTests.vb index 046f8f674670c68a0d40bca297eee6fd6944db2c..014e74c5ae01fc2b58492e394351f60b153c97a3 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerListTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerListTests.vb @@ -1,6 +1,8 @@ -Imports NUnit.Framework + +Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics + <TestFixture()> Public Class ElectricalConsumerListTests diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerTests.vb index e2b17d7dedef210ccfd096f7d2143ef78fa0ce72..f7429fd830b4db22ce6140c8fda723f653eced91 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/ElectricalConsumerTests.vb @@ -1,6 +1,8 @@ -Imports VectoAuxiliaries.Electrics + + Imports NUnit.Framework -Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics Namespace UnitTests <TestFixture()> diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/FilePathUtilityTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/FilePathUtilityTests.vb index 1d2bad92c376a593fea25e49a95b40d86fcdaf3f..80506f039ba468ef4d245a7cb6d28738ac7d3401 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/FilePathUtilityTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/FilePathUtilityTests.vb @@ -1,11 +1,8 @@  -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries -Imports Moq +Imports TUGraz.VectoCore.BusAuxiliaries.Util + Namespace UnitTests diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb index d09e6f2f93b6df506ebb603eb0b39cd1a375c6e8..25e6d4860069d277e0743e3c047b7aa87b47bc5f 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb @@ -1,5 +1,6 @@ -Imports NUnit.Framework -Imports VectoAuxiliaries.Hvac + +Imports NUnit.Framework +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC Namespace UnitTests diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb index c8bb4610d3731cae15c7d1756ffd1ad56faf3c03..8c2ec0e6f98c49e5a61e87aba50ff9c6aeb3c6e9 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb @@ -1,20 +1,35 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries +Imports System.IO Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl + +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC + Namespace UnitTests + + <TestFixture()> Public Class M0_5_SmartAlternatorSetEfficiencyTests - Private target As M0_5_SmartAlternatorSetEfficiency + Private target As IM0_5_SmartAlternatorSetEfficiency Private signals = New Signals Public Sub New() - Initialise() + End Sub + <OneTimeSetUp> + Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + + Initialise() + end Sub Private Function GetSSM() As ISSMTOOL @@ -45,7 +60,7 @@ Namespace UnitTests Dim signals = New Signals() signals.EngineSpeed = 2000.RPMtoRad() - Dim m0 As New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, alternatoMap, 26.3.SI(Of Volt), signals, ssm) + Dim m0 As New M00Impl(elecConsumers, alternatoMap, 26.3.SI(Of Volt), signals, ssm) 'Results Cards Dim readings = New List(Of SmartResult) @@ -58,7 +73,7 @@ Namespace UnitTests signals.EngineSpeed = 2000.RPMtoRad() - target = New M0_5_SmartAlternatorSetEfficiency(m0, elecConsumers, alternatoMap, idleResult, tractionResult, + target = New M0_5Impl(m0, elecConsumers, alternatoMap, idleResult, tractionResult, overrunResult, signals) End Sub @@ -117,6 +132,8 @@ Namespace UnitTests Assert.AreEqual(expected, actual, 0.000001) End Sub + + End Class End Namespace diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb index 5edaabf086cbc5256535df17cac5202947137ff0..c4457aed1a5dbeac8564595b97f8f14c97d8d8b2 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb @@ -1,11 +1,13 @@ Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Hvac Imports System.IO +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC +Imports Signals = TUGraz.VectoCore.BusAuxiliaries.Interfaces.Signals Namespace UnitTests <TestFixture()> @@ -54,27 +56,26 @@ Namespace UnitTests <Test()> Public Sub CreateNewTest() - Dim target As M0_NonSmart_AlternatorsSetEfficiency = New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, - alternatorMap, powernetVoltage, signals, GetSSM()) + Dim target As IM0_NonSmart_AlternatorsSetEfficiency = New M00Impl(elecConsumers,alternatorMap, powernetVoltage, signals, GetSSM()) Assert.IsNotNull(target) End Sub <Test()> Public Sub CreateNew_MissingElecConsumers_ThrowArgumentExceptionTest() - Dim target As M0_NonSmart_AlternatorsSetEfficiency - Assert.That(Sub() target = New M0_NonSmart_AlternatorsSetEfficiency(Nothing, alternatorMap, powernetVoltage, signals, GetSSM()), Throws.InstanceOf(Of ArgumentException)) + Dim target As IM0_NonSmart_AlternatorsSetEfficiency + Assert.That(Sub() target = New M00Impl(Nothing, alternatorMap, powernetVoltage, signals, GetSSM()), Throws.InstanceOf(Of ArgumentException)) End Sub <Test()> Public Sub CreateNew_MissingAlternatorMap_ThrowArgumentExceptionTest() - Dim target As M0_NonSmart_AlternatorsSetEfficiency - Assert.That(Sub() target = New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, Nothing, powernetVoltage, signals, GetSSM()), Throws.InstanceOf(Of ArgumentException)) + Dim target As IM0_NonSmart_AlternatorsSetEfficiency + Assert.That(Sub() target = New M00Impl(elecConsumers, Nothing, powernetVoltage, signals, GetSSM()), Throws.InstanceOf(Of ArgumentException)) End Sub <Test()> Public Sub EfficiencyValueTest() - Dim target As M0_NonSmart_AlternatorsSetEfficiency = New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, + Dim target As IM0_NonSmart_AlternatorsSetEfficiency = New M00Impl(elecConsumers, alternatorMap, powernetVoltage, signals, GetSSM()) Dim actual As Single = target.AlternatorsEfficiency @@ -87,7 +88,7 @@ Namespace UnitTests <Test()> Public Sub HVAC_PowerDemandAmpsTest() - Dim target As M0_NonSmart_AlternatorsSetEfficiency = New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, + Dim target As IM0_NonSmart_AlternatorsSetEfficiency = New M00Impl(elecConsumers, alternatorMap, powernetVoltage, signals, GetSSM()) Dim actual As Ampere diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb index e4e02b6bc869c3ad6046099b8bd7def8ae30e8eb..c47d8994419025ef8c61a60940eed592a406433f 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M10Tests.vb @@ -1,11 +1,11 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries Imports Moq Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules + Namespace UnitTests <TestFixture()> @@ -28,12 +28,12 @@ Namespace UnitTests m9.Setup(Function(x) x.TotalCycleFuelConsumptionCompressorOffContinuously).Returns((y3 / 1000).SI(Of Kilogram)) - Dim target As IM10 = New M10(m3.Object, m9.Object, signals) + Dim target As IM10 = New M10Impl(m3.Object, m9.Object, signals) target.CycleStep(1.SI(Of Second)) - Assert.AreEqual(out1.SI(Unit.SI.Gramm).Value(), target.AverageLoadsFuelConsumptionInterpolatedForPneumatics.Value(), 0.001) - Assert.AreEqual(out2.SI(Unit.SI.Gramm).Value(), target.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand.Value(), 0.001) + Assert.AreEqual(out1.SI(Unit.SI.Gramm).Value(), target.AverageLoadsFuelConsumptionInterpolatedForPneumatics.Value(), 0.001) + Assert.AreEqual(out2.SI(Unit.SI.Gramm).Value(), target.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand.Value(), 0.001) End Sub End Class End Namespace diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M11Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M11Tests.vb index b793e5b91cd3ffdc72b497f93492dd40af02826e..9f4105f4e0c740d1a3c6ad641b6dfb921836342f 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M11Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M11Tests.vb @@ -1,11 +1,11 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries Imports Moq Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules + Namespace UnitTests <TestFixture()> @@ -53,7 +53,7 @@ Namespace UnitTests 'Act - Dim target = New M11(m1Mock.Object, m3Mock.Object, m6Mock.Object, m8Mock.Object, fmap, sgnlsMock.Object) _ + Dim target = New M11Impl(m1Mock.Object, m3Mock.Object, m6Mock.Object, m8Mock.Object, fmap, sgnlsMock.Object) _ ',m3Mock.Object,m6Mock.Object,m8Mock.Object,fmap,sgnlsMock.Object) 'Add Current Calculation to Internal Aggregates ( Accesseed by public output properties which are external interface ) @@ -109,7 +109,7 @@ Namespace UnitTests 'Act - Dim target = New M11(m1Mock.Object, m3Mock.Object, m6Mock.Object, m8Mock.Object, fmap, sgnlsMock.Object) _ + Dim target = New M11Impl(m1Mock.Object, m3Mock.Object, m6Mock.Object, m8Mock.Object, fmap, sgnlsMock.Object) _ ',m3Mock.Object,m6Mock.Object,m8Mock.Object,fmap,sgnlsMock.Object) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M12Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M12Tests.vb index dcf15b98513f455c84b3fbbc8d67f31b7ad48dbf..99588d83ba1821d8eb1f4e7cfd0de502c963cf9d 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M12Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M12Tests.vb @@ -1,11 +1,11 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries Imports Moq Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules + Namespace UnitTests <TestFixture()> @@ -39,7 +39,7 @@ Namespace UnitTests M10Mock.Setup(Function(x) x.AverageLoadsFuelConsumptionInterpolatedForPneumatics).Returns((IP7 / 1000).SI(Of Kilogram)) 'Act - Dim target = New M12(M10Mock.Object, m11Mock.Object, sgnlsMock.Object) + Dim target = New M12Impl(M10Mock.Object, m11Mock.Object, sgnlsMock.Object) 'Assert Assert.AreEqual(target.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand().Value(), diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb index 2f0e864310d7278c723d833c5194f13bf7893409..c2fedc9abac07892947548f73661cf96e7332be3 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M13Tests.vb @@ -1,12 +1,10 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries Imports Moq Imports TUGraz.VectoCommon.Utils - +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Namespace UnitTests <TestFixture()> @@ -53,7 +51,7 @@ Namespace UnitTests Signals.Setup(Function(x) x.CurrentCycleTimeInSeconds).Returns(3114) 'Act - Dim target = New M13(m10.Object, m11.Object, m12.Object, Signals.Object) + Dim target = New M13Impl(m10.Object, m11.Object, m12.Object, Signals.Object) 'Assert Assert.AreEqual(OUT1.SI(Unit.SI.Gramm).Value(), target.WHTCTotalCycleFuelConsumptionGrams.Value(), 0.001) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb index e40d9156e1722c368c2f19b73e0208d16a16b9a5..8da2682fce90cf7a3ffdd64e6a7b3d8c1233c657 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb @@ -1,11 +1,14 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics + + Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules Imports NUnit.Framework -Imports VectoAuxiliaries Imports Moq Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC Namespace UnitTests @@ -115,7 +118,7 @@ Namespace UnitTests 'Act - Dim m14 As New M14(m13.Object, ssmMock, constants, signals.Object) + Dim m14 As New M14Impl(m13.Object, ssmMock, constants, signals.Object) 'Assert Assert.AreEqual(expectedOut1.SI(Unit.SI.Gramm).Value(), m14.TotalCycleFCGrams.Value(), 0.1) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb index 02251b0ee0c4d5e00c763385c5da3df17519c670..0e2b0aae17d5ee9dc8dc2f9e98f5a83d5b526d36 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb @@ -1,9 +1,15 @@ -Imports NUnit.Framework + +Imports System.IO +Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC + Namespace UnitTests @@ -19,18 +25,19 @@ Namespace UnitTests Private m0 As IM0_NonSmart_AlternatorsSetEfficiency - Private alternatorMap As IAlternatorMap = New AlternatorMap(_GOODMAP) + Private alternatorMap As IAlternatorMap Private alternatorGearEfficiency As Single = 0.8 Private compressorGrearEfficiency As Single = 0.8 - - Public Sub New() - + + Public Sub New() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + alternatorMap = New AlternatorMap(_GOODMAP) alternatorMap.Initialise() ssm.Load(_SSMMAP) - m0 = New M0_NonSmart_AlternatorsSetEfficiency(New ElectricalConsumerList(powernetVoltage, 0.096, True), + m0 = New M00Impl(New ElectricalConsumerList(powernetVoltage, 0.096, True), alternatorMap, powernetVoltage.SI(Of Volt), signals, ssm) End Sub @@ -38,8 +45,7 @@ Namespace UnitTests ssm.Load(_SSMMAP) - Return New M1_AverageHVACLoadDemand(m0, - alternatorGearEfficiency, + Return New M01Impl(m0, alternatorGearEfficiency, compressorGrearEfficiency, powernetVoltage.SI(Of Volt), signals, diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb index 4aba3ace562def96f5a1c8d23dc12f7eafe5e290..b0d038648805d22f0ade8725f82ad02886236c47 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb @@ -1,9 +1,16 @@ -Imports VectoAuxiliaries.Electrics + +Imports VectoAuxiliaries.Electrics Imports VectoAuxiliaries.Hvac Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC + Namespace UnitTests <TestFixture()> @@ -31,7 +38,7 @@ Namespace UnitTests #Region "Helpers" - Private Function GetAverageElectricalDemandInstance() As M2_AverageElectricalLoadDemand + Private Function GetAverageElectricalDemandInstance() As IM2_AverageElectricalLoadDemand signals.EngineSpeed = 2000.RPMtoRad() @@ -41,19 +48,19 @@ Namespace UnitTests Dim altMap As IAlternatorMap = CType(New AlternatorMap("testfiles\testAlternatorMap.aalt"), IAlternatorMap) altMap.Initialise() - Dim m0 As New M0_NonSmart_AlternatorsSetEfficiency(consumers, altMap, 26.3.SI(Of Volt), signals, GetSSM()) + Dim m0 As New M00Impl(consumers, altMap, 26.3.SI(Of Volt), signals, GetSSM()) 'Get Consumers. - Return New M2_AverageElectricalLoadDemand(consumers, m0, 0.8, 26.3.SI(Of Volt), signals) + Return New M02Impl(consumers, m0, 0.8, 26.3.SI(Of Volt), signals) End Function #End Region <Test()> Public Sub NewTest() - Dim target As M2_AverageElectricalLoadDemand = GetAverageElectricalDemandInstance() + Dim target As IM2_AverageElectricalLoadDemand = GetAverageElectricalDemandInstance() Assert.IsNotNull(target) End Sub @@ -63,14 +70,14 @@ Namespace UnitTests Dim expected As Single = 1594.61572 - Dim target As M2_AverageElectricalLoadDemand = GetAverageElectricalDemandInstance() + Dim target As IM2_AverageElectricalLoadDemand = GetAverageElectricalDemandInstance() Dim actual As Watt = target.GetAveragePowerDemandAtAlternator() Assert.AreEqual(expected, actual.Value(), 0.001) End Sub <Test()> Public Sub GetAveragePowerAtCrankTest() - Dim target As M2_AverageElectricalLoadDemand = GetAverageElectricalDemandInstance() + Dim target As IM2_AverageElectricalLoadDemand = GetAverageElectricalDemandInstance() Dim expected As Single = 10914.6543 Dim actual As Watt = target.GetAveragePowerAtCrankFromElectrics() Assert.AreEqual(expected, actual.Value(), 0.001) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb index 42fe64dcda9c37dd5e04504b1aef96ddf016d2e7..6a21a735f469941c40e1c254926151f6cebbe958 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb @@ -1,10 +1,13 @@ -Imports NUnit.Framework + +Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC Namespace UnitTests <TestFixture()> @@ -17,8 +20,8 @@ Namespace UnitTests Private Const _altGearPullyEfficiency As Single = 0.8 'Private fields - Private _m05 As M0_5_SmartAlternatorSetEfficiency - Private _target As M5__SmartAlternatorSetGeneration + Private _m05 As IM0_5_SmartAlternatorSetEfficiency + Private _target As IM5_SmartAlternatorSetGeneration Private _signals As ISignals = New Signals Private ssmHVac As IHVACSteadyStateModel = New HVACSteadyStateModel(100, 100, 100) @@ -48,7 +51,7 @@ Namespace UnitTests alternatoMap.Initialise() Dim _ m0 As _ - New M0_NonSmart_AlternatorsSetEfficiency(elecConsumers, alternatoMap, _powerNetVoltage.SI(Of Volt), _signals, + New M00Impl(elecConsumers, alternatoMap, _powerNetVoltage.SI(Of Volt), _signals, GetSSM()) 'Results Cards @@ -63,45 +66,45 @@ Namespace UnitTests Dim signals As ISignals = New Signals signals.EngineSpeed = 2000.RPMtoRad() - _m05 = New M0_5_SmartAlternatorSetEfficiency(m0, elecConsumers, alternatoMap, idleResult, tractionResult, + _m05 = New M0_5Impl(m0, elecConsumers, alternatoMap, idleResult, tractionResult, overrunResult, signals) End Sub - <Test()> + <TestCase()> Public Sub CreateNewTest() Initialise() - _target = New M5__SmartAlternatorSetGeneration(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) + _target = New M05Impl(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) Assert.IsNotNull(_target) End Sub - <Test()> + <TestCase()> Public Sub PowerAtCrankIdleWatts() Initialise() - _target = New M5__SmartAlternatorSetGeneration(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) + _target = New M05Impl(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) Dim expected As Single = 1641.35791 Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankIdleWatts() Assert.AreEqual(expected, actual.Value(), 0.001) End Sub - <Test()> + <TestCase()> Public Sub PowerAtCrankTractionWatts() Initialise() - _target = New M5__SmartAlternatorSetGeneration(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) + _target = New M05Impl(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) Dim expected As Single = 1641.35791 Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankTractionOnWatts() Assert.AreEqual(expected, actual.Value(), 0.001) End Sub - <Test()> + <TestCase()> Public Sub PowerAtCrankOverrunWatts() Initialise() - _target = New M5__SmartAlternatorSetGeneration(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) + _target = New M05Impl(_m05, _powerNetVoltage.SI(Of Volt), _altGearPullyEfficiency) Dim expected As Single = 1641.35791F Dim actual As Watt = _target.AlternatorsGenerationPowerAtCrankOverrunWatts() diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M6Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M6Tests.vb index b3dc1caa4129040d077e3beaa3eb9cef74ea9374..98577b8a27b23328e59370c115fdaccb83eebd76 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M6Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M6Tests.vb @@ -1,11 +1,10 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries -Imports Moq Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules + Namespace UnitTests <TestFixture()> @@ -25,7 +24,7 @@ Namespace UnitTests M4 = New M4_Mock(100, 2, 200, 100, 100) M5 = New M5_Mock(200, 50, 80) - Return New M6(M1, M2, M3, M4, M5, Signals) + Return New M06Impl(M1, M2, M3, M4, M5, Signals) End Function Public Sub New() @@ -103,7 +102,7 @@ Namespace UnitTests signals.SmartElectrics = SM - Dim target As New M6(M1, M2, M3, M4, M5, signals) + Dim target As New M06Impl(M1, M2, M3, M4, M5, signals) Assert.AreEqual(OUT1, target.OverrunFlag) Assert.AreEqual(OUT2, target.SmartElecAndPneumaticsCompressorFlag) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M7Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M7Tests.vb index a984dacfe80db2fdb52f0d0c8197fffc5f4b4ed6..67c209e30d745e388c97f3cd8adb6eca849a40e4 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M7Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M7Tests.vb @@ -1,10 +1,9 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Namespace UnitTests <TestFixture()> @@ -20,9 +19,9 @@ Namespace UnitTests Signals = New Signals() End Sub - <Test()> + <TestCase()> Public Sub CreateNew_M7InstanceTest() - Dim target As IM7 = New M7(M5, M6, Signals) + Dim target As IM7 = New M07Impl(M5, M6, Signals) Assert.IsNotNull(target) End Sub @@ -83,7 +82,7 @@ Namespace UnitTests 'Create Instance of M7 from - Dim target As IM7 = New M7(M5, M6, Signals) + Dim target As IM7 = New M07Impl(M5, M6, Signals) Dim OP1act As Double = target.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank().Value() Dim OP2act As Double = target.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank().Value() diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M8Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M8Tests.vb index 6f180ab8bf72a75c4dfcfcc7af65748030945f64..c3da60c0531df9a80de1a69f82a43a06a7367681 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M8Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M8Tests.vb @@ -1,16 +1,15 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries Imports Moq Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules Namespace UnitTests <TestFixture()> Public Class M8Tests - <Test()> + <TestCase()> Public Sub CreateInstanceTest() 'Arrange @@ -20,7 +19,7 @@ Namespace UnitTests Dim sigsMock = New Mock(Of ISignals)() 'Act - Dim target As IM8 = New M8(m1MOCK.Object, m6Mock.Object, m7MOCK.Object, sigsMock.Object) + Dim target As IM8 = New M08Impl(m1MOCK.Object, m6Mock.Object, m7MOCK.Object, sigsMock.Object) 'Assert Assert.IsNotNull(target) @@ -66,7 +65,7 @@ Namespace UnitTests sigsMock.Setup(Function(x) x.SmartElectrics).Returns(IP11) 'Act - Dim target As IM8 = New M8(m1MOCK.Object, m6Mock.Object, m7MOCK.Object, sigsMock.Object) + Dim target As IM8 = New M08Impl(m1MOCK.Object, m6Mock.Object, m7MOCK.Object, sigsMock.Object) 'Assert Assert.AreEqual(OUT1, target.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries.Value(), 0.001) @@ -114,7 +113,7 @@ Namespace UnitTests 'Act - Dim target As IM8 = New M8(m1MOCK.Object, m6Mock.Object, m7MOCK.Object, sigsMock.Object) + Dim target As IM8 = New M08Impl(m1MOCK.Object, m6Mock.Object, m7MOCK.Object, sigsMock.Object) 'Assert Assert.AreEqual(OUT1, target.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries.Value(), 0.001) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb index 18e38c82b155b2b191848063f4c994e1a70138f4..7c40d547f0c98dc2e810056f6d0ea572beadf21a 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M9Tests.vb @@ -1,11 +1,13 @@ -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules + Imports NUnit.Framework -Imports VectoAuxiliaries Imports Moq Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem +Imports IFuelConsumptionMap = TUGraz.VectoCore.BusAuxiliaries.Interfaces.IFuelConsumptionMap + Namespace UnitTests <TestFixture()> @@ -55,7 +57,7 @@ Namespace UnitTests Dim _ target As _ - New M9(m1Mock.Object, m4Mock.Object, m6Mock.Object, m8Mock.Object, fMapMock, psac.Object, sgnlsMock.Object) + New M09Impl(m1Mock.Object, m4Mock.Object, m6Mock.Object, m8Mock.Object, fMapMock, psac.Object, sgnlsMock.Object) target.CycleStep(1.SI(Of Second)) @@ -109,7 +111,7 @@ Namespace UnitTests Dim _ target As _ - New M9(m1Mock.Object, m4Mock.Object, m6Mock.Object, m8Mock.Object, fMapMock.Object, psac.Object, sgnlsMock.Object) + New M09Impl(m1Mock.Object, m4Mock.Object, m6Mock.Object, m8Mock.Object, fMapMock.Object, psac.Object, sgnlsMock.Object) target.CycleStep(1.SI(Of Second)) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/PneumaticActuationsMapTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/PneumaticActuationsMapTests.vb index 7eeb49bcdea9def31aac31d85c26b13b48354783..2a9e89fc7b06cb9a885acebf62158755a64bc7d2 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/PneumaticActuationsMapTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/PneumaticActuationsMapTests.vb @@ -1,7 +1,8 @@ -Imports NUnit -Imports VectoAuxiliaries.Pneumatics + Imports NUnit.Framework Imports System.IO +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Pneumatics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem Namespace Pneumatics diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/ResultCardTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/ResultCardTests.vb index 9678eb0013ebcecc4c7b516cecf85ecfc63057cb..607019ffdedee0e13e32714073a994a4c6385e66 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/ResultCardTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/ResultCardTests.vb @@ -1,6 +1,9 @@ -Imports NUnit.Framework + +Imports NUnit.Framework Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.Electrics +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.Electrics + <TestFixture()> Public Class ResultCardTests diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb index 568ab56168241e1d61e2458d3992c5e595cf835d..d2fc56627e5708a861c7f8333117204a188c68b8 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb @@ -1,8 +1,8 @@ -Imports NUnit.Framework -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliariesTests.Mocks -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Hvac +Imports System.IO +Imports NUnit.Framework +Imports TUGraz.VectoCore.BusAuxiliaries.DownstreamModules.Impl.HVAC +Imports TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.HVAC + Namespace UnitTests <TestFixture()> @@ -47,6 +47,11 @@ Namespace UnitTests Assert.IsTrue(src.TechList.Add(newItem, feedback)) End Sub + <OneTimeSetUp> + Sub RunBeforeAnyTests() + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) + end Sub + 'SSMGenInputTests <Test()> _ <TestCase("BusParameterisation")> _ diff --git a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj index 6867dba58e26c439576cb42816a723c308805370..56cbca9581ff0d0e38548bf84e6912eb2b0d3217 100644 --- a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj +++ b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj @@ -391,17 +391,13 @@ </ItemGroup> <ItemGroup /> <ItemGroup> - <ProjectReference Include="..\..\VectoCommon\AdvancedAuxiliaryInterfaces\AdvancedAuxiliaryInterfaces.vbproj"> - <Project>{b4b9bd2f-fd8f-4bb8-82fa-e2154d2c7fbd}</Project> - <Name>AdvancedAuxiliaryInterfaces</Name> - </ProjectReference> <ProjectReference Include="..\..\VectoCommon\VectoCommon\VectoCommon.csproj"> <Project>{79a066ad-69a9-4223-90f6-6ed5d2d084f4}</Project> <Name>VectoCommon</Name> </ProjectReference> - <ProjectReference Include="..\VectoAuxiliaries\VectoAuxiliaries.vbproj"> - <Project>{fdeee460-0b8a-4ef6-8d9e-72f203a50f65}</Project> - <Name>VectoAuxiliaries</Name> + <ProjectReference Include="..\BusAuxiliaries\BusAuxiliaries.csproj"> + <Project>{550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}</Project> + <Name>BusAuxiliaries</Name> </ProjectReference> </ItemGroup> <Choose> diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/AdvancedAuxiliaryInterfaces.vbproj b/VectoCommon/AdvancedAuxiliaryInterfaces/AdvancedAuxiliaryInterfaces.vbproj deleted file mode 100644 index 8b5131f2fb75083cf03466e9fd2920fd92f41d94..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/AdvancedAuxiliaryInterfaces.vbproj +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{B4B9BD2F-FD8F-4BB8-82FA-E2154D2C7FBD}</ProjectGuid> - <OutputType>Library</OutputType> - <RootNamespace>VectoAuxiliaries</RootNamespace> - <AssemblyName>AdvancedAuxiliaryInterfaces</AssemblyName> - <FileAlignment>512</FileAlignment> - <MyType>Windows</MyType> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - <TargetFrameworkProfile /> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <DefineDebug>true</DefineDebug> - <DefineTrace>true</DefineTrace> - <OutputPath>bin\Debug\</OutputPath> - <DocumentationFile>AdvancedAuxiliaryInterfaces.xml</DocumentationFile> - <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <DefineDebug>false</DefineDebug> - <DefineTrace>true</DefineTrace> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DocumentationFile>AdvancedAuxiliaryInterfaces.xml</DocumentationFile> - <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup> - <OptionExplicit>On</OptionExplicit> - </PropertyGroup> - <PropertyGroup> - <OptionCompare>Binary</OptionCompare> - </PropertyGroup> - <PropertyGroup> - <OptionStrict>Off</OptionStrict> - </PropertyGroup> - <PropertyGroup> - <OptionInfer>On</OptionInfer> - </PropertyGroup> - <ItemGroup> - <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - </ItemGroup> - <ItemGroup> - <Import Include="Microsoft.VisualBasic" /> - <Import Include="System" /> - <Import Include="System.Collections" /> - <Import Include="System.Collections.Generic" /> - <Import Include="System.Data" /> - <Import Include="System.Diagnostics" /> - <Import Include="System.Linq" /> - <Import Include="System.Xml.Linq" /> - <Import Include="System.Threading.Tasks" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Enumerations.vb" /> - <Compile Include="IAdvancedAuxiliaries.vb" /> - <Compile Include="IAuxiliaryEvent.vb" /> - <Compile Include="IFuelConsumptionMap.vb" /> - <Compile Include="ISignals.vb" /> - <Compile Include="IVectoInputs.vb" /> - <Compile Include="My Project\AssemblyInfo.vb" /> - <Compile Include="My Project\Application.Designer.vb"> - <AutoGen>True</AutoGen> - <DependentUpon>Application.myapp</DependentUpon> - </Compile> - <Compile Include="My Project\Resources.Designer.vb"> - <AutoGen>True</AutoGen> - <DesignTime>True</DesignTime> - <DependentUpon>Resources.resx</DependentUpon> - </Compile> - <Compile Include="My Project\Settings.Designer.vb"> - <AutoGen>True</AutoGen> - <DependentUpon>Settings.settings</DependentUpon> - <DesignTimeSharedInput>True</DesignTimeSharedInput> - </Compile> - <Compile Include="Signals.vb" /> - <Compile Include="VectoInputs.vb" /> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="My Project\Resources.resx"> - <Generator>VbMyResourcesResXFileCodeGenerator</Generator> - <LastGenOutput>Resources.Designer.vb</LastGenOutput> - <CustomToolNamespace>My.Resources</CustomToolNamespace> - <SubType>Designer</SubType> - </EmbeddedResource> - </ItemGroup> - <ItemGroup> - <None Include="My Project\Application.myapp"> - <Generator>MyApplicationCodeGenerator</Generator> - <LastGenOutput>Application.Designer.vb</LastGenOutput> - </None> - <None Include="My Project\Settings.settings"> - <Generator>SettingsSingleFileGenerator</Generator> - <CustomToolNamespace>My</CustomToolNamespace> - <LastGenOutput>Settings.Designer.vb</LastGenOutput> - </None> - <None Include="packages.config" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\VectoCommon\VectoCommon.csproj"> - <Project>{79A066AD-69A9-4223-90F6-6ED5D2D084F4}</Project> - <Name>VectoCommon</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/Diagnostics.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/Diagnostics.vb deleted file mode 100644 index f79919703e1d7fe21ba4d90407632d08866ecb8d..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/Diagnostics.vb +++ /dev/null @@ -1,44 +0,0 @@ -' 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. - -Public Class Diagnostics -Implements IDiagnostics - - - Public Property AA_CompressorFlag As Integer Implements IDiagnostics.AA_CompressorFlag - - Public Property AA_CompressorFlowRate_LitrePerSec As Single Implements IDiagnostics.AA_CompressorFlowRate_LitrePerSec - - Public Property AA_EngineIdleFlag As Integer Implements IDiagnostics.AA_EngineIdleFlag - - Public Property AA_NonSmartAlternatorsEfficiency As Single Implements IDiagnostics.AA_NonSmartAlternatorsEfficiency - - Public Property AA_OverrunFlag As Integer Implements IDiagnostics.AA_OverrunFlag - - Public Property AA_SmartIdleAlternatorsEfficiency As Single Implements IDiagnostics.AA_SmartIdleAlternatorsEfficiency - - Public Property AA_SmartIdleCurrent_Amps As Single Implements IDiagnostics.AA_SmartIdleCurrent_Amps - - Public Property AA_SmartOverrunAlternatorEfficiency As Single Implements IDiagnostics.AA_SmartOverrunAlternatorEfficiency - - Public Property AA_SmartOverrunCurrent_Amps As Single Implements IDiagnostics.AA_SmartOverrunCurrent_Amps - - Public Property AA_SmartTractionAlternatorEfficiency As Single Implements IDiagnostics.AA_SmartTractionAlternatorEfficiency - - Public Property AA_SmartTractionCurrent_Amps As Single Implements IDiagnostics.AA_SmartTractionCurrent_Amps - - Public Property AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams As Single Implements IDiagnostics.AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams - - Public Property AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres As Single Implements IDiagnostics.AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres - - -End Class - diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/Enumerations.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/Enumerations.vb deleted file mode 100644 index 91fbeb08363b89ef8d3d4c34d8d54b650a38c340..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/Enumerations.vb +++ /dev/null @@ -1,22 +0,0 @@ -' Copyright 2017 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. - -'Used to classify messages to the invoking host. - -Public Enum AdvancedAuxiliaryMessageType - - Information=1 - Warning=2 - Critical=3 - - -End Enum - diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb deleted file mode 100644 index 233cdb1d58a98d13321a44e3939b103f17fb3927..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb +++ /dev/null @@ -1,133 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Public Interface IAdvancedAuxiliaries - ' Inherits IAuxiliaryEvent - - Event AuxiliaryEvent(ByRef sender As Object, ByVal message As String, ByVal messageType As AdvancedAuxiliaryMessageType) - - - 'Information - ReadOnly Property Running As Boolean - - ReadOnly Property AuxiliaryName As String - ReadOnly Property AuxiliaryVersion As String - - 'Additional Permenent Monitoring Signals - Required by engineering - ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double - ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere - ReadOnly Property AA_SmartIdleAlternatorsEfficiency As Double - ReadOnly Property AA_SmartTractionCurrent_Amps As Ampere - ReadOnly Property AA_SmartTractionAlternatorEfficiency As Double - ReadOnly Property AA_SmartOverrunCurrent_Amps As Ampere - ReadOnly Property AA_SmartOverrunAlternatorEfficiency As Double - ReadOnly Property AA_CompressorFlowRate_LitrePerSec As NormLiterPerSecond - ReadOnly Property AA_OverrunFlag As Boolean - ReadOnly Property AA_EngineIdleFlag As Integer? - ReadOnly Property AA_CompressorFlag As Boolean - ReadOnly Property AA_TotalCycleFC_Grams As Kilogram - ReadOnly Property AA_TotalCycleFC_Litres As Liter - ReadOnly Property AA_AveragePowerDemandCrankHVACMechanicals As Watt - ReadOnly Property AA_AveragePowerDemandCrankHVACElectricals As Watt - ReadOnly Property AA_AveragePowerDemandCrankElectrics As Watt - ReadOnly Property AA_AveragePowerDemandCrankPneumatics As Watt - ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOff As Kilogram - ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOn As Kilogram - - ''' <summary> - ''' Total Cycle Fuel In Grams - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalFuelGRAMS As Kilogram - - ''' <summary> - ''' Total Cycle Fuel in Litres - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalFuelLITRES As Liter - - ''' <summary> - ''' Total Power Demans At Crank From Auxuliaries (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AuxiliaryPowerAtCrankWatts As Watt - - - ''' <summary> - ''' Vecto Inputs - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property VectoInputs As IVectoInputs - - ''' <summary> - ''' Signals From Vecto - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property Signals As ISignals - - ''' <summary> - ''' Configure Auxuliaries ( Launches Config Form ) - ''' </summary> - ''' <param name="filePath"></param> - ''' <param name="vectoFilePath"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function Configure(filePath As String, vectoFilePath As String) As Boolean - - ''' <summary> - ''' Validate AAUX file path supplied. - ''' </summary> - ''' <param name="filePath"></param> - ''' <param name="message"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function ValidateAAUXFile(ByVal filePath As String, ByRef message As String) As Boolean - - 'Command - ''' <summary> - ''' Cycle Step - Used to calculate fuelling - ''' </summary> - ''' <param name="seconds"></param> - ''' <param name="message"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function CycleStep(seconds As Second, ByRef message As String) As Boolean - - ''' <summary> - ''' Initialises AAUX Environment ( Begin Processs ) - ''' </summary> - ''' <param name="auxFilePath"></param> - ''' <param name="vectoFilePath"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function RunStart(ByVal auxFilePath As String, ByVal vectoFilePath As String) As Boolean - - ''' <summary> - ''' Any Termination Which Needs to be done ( Model depenent ) - ''' </summary> - ''' <param name="message"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function RunStop(ByRef message As String) As Boolean -End Interface - - diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IAuxiliaryEvent.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IAuxiliaryEvent.vb deleted file mode 100644 index 44721ccf1654fd45fabbc944a1378353d32fe982..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IAuxiliaryEvent.vb +++ /dev/null @@ -1,17 +0,0 @@ -' Copyright 2017 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. - -Public Interface IAuxiliaryEvent - - Event AuxiliaryEvent( ByRef sender As Object, byval message As String, ByVal messageType As AdvancedAuxiliaryMessageType ) - -End interface - diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IDiagnostics.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IDiagnostics.vb deleted file mode 100644 index 0ac7de6ec64d5d3f674d7b8feabf7cd0bf79e922..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IDiagnostics.vb +++ /dev/null @@ -1,32 +0,0 @@ - -' 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. - -Public Interface IDiagnostics - - - Property AA_NonSmartAlternatorsEfficiency As single - Property AA_SmartIdleCurrent_Amps As single - Property AA_SmartIdleAlternatorsEfficiency As single - Property AA_SmartTractionCurrent_Amps As single - Property AA_SmartTractionAlternatorEfficiency As single - Property AA_SmartOverrunCurrent_Amps As Single - Property AA_SmartOverrunAlternatorEfficiency As Single - Property AA_CompressorFlowRate_LitrePerSec As Single - Property AA_OverrunFlag As integer - Property AA_EngineIdleFlag As integer - Property AA_CompressorFlag As integer - Property AA_TotalCycleFC_BeforeSSandWHTCcorrection_Grams As single - Property AA_TotalCycleFC_BeforeSSandWHTCcorrection_Litres As single - - - -End Interface diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IFuelConsumptionMap.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IFuelConsumptionMap.vb deleted file mode 100644 index 3d5d0a3e3e2e64748680372c98ac37128e6804b1..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IFuelConsumptionMap.vb +++ /dev/null @@ -1,12 +0,0 @@ -Imports TUGraz.VectoCommon.Utils - -Public Interface IFuelConsumptionMap - ''' <summary> - ''' - ''' </summary> - ''' <param name="torque"></param> - ''' <param name="angularVelocity"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetFuelConsumption(torque As NewtonMeter, angularVelocity As PerSecond) As KilogramPerSecond -End Interface \ No newline at end of file diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/ISignals.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/ISignals.vb deleted file mode 100644 index 3d3095e85ab630485a5e42c88b892904f46a6d6a..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/ISignals.vb +++ /dev/null @@ -1,181 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Public Interface ISignals - ''' <summary> - ''' Pre Existing Aux Power (KW) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property PreExistingAuxPower As Watt - - ''' <summary> - ''' Engine Motoring Power (KW) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property EngineMotoringPower As Watt - - ''' <summary> - ''' Engine Driveline Power (KW) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property EngineDrivelinePower As Watt - - ''' <summary> - ''' Smart Electrics - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Should be true if fitted to the vehicle - AAUX Input</remarks> - Property SmartElectrics As Boolean - - ''' <summary> - ''' Clucth Engaged - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property ClutchEngaged As Boolean - - ''' <summary> - ''' Engine Speed 1/NU - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' - Property EngineSpeed As PerSecond - - ''' <summary> - ''' Smart Pneumatics - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>should be true if fitted to the vehicle- AAux Config Input</remarks> - Property SmartPneumatics As Boolean - - ''' <summary> - ''' Total Cycle Time In Seconds - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property TotalCycleTimeSeconds As Integer - - ''' <summary> - ''' Current Cycle Time In Seconds - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>( Will Increment during Cycle )</remarks> - Property CurrentCycleTimeInSeconds As Double - - ''' <summary> - ''' Engine Driveline Torque - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property EngineDrivelineTorque As NewtonMeter - - ''' <summary> - ''' Engine Idle - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property Idle As Boolean - - ''' <summary> - ''' In Neutral - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property InNeutral As Boolean - - ''' <summary> - ''' Auxiliary Event Reporting Level - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Can be used by Vecto to choose the level of reporting</remarks> - Property AuxiliaryEventReportingLevel As AdvancedAuxiliaryMessageType - - ''' <summary> - ''' Engine Stopped - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>'Vecto Input - Used to Cut Fueling in AAux model</remarks> - Property EngineStopped As Boolean - - ''' <summary> - ''' WHTC ( Correction factor to be applied ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>'Vecto Input</remarks> - Property WHTC As Double - - ''' <summary> - ''' Declaration Mode - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input - Used to decide if to apply WHTC/Possiblye other things in future</remarks> - Property DeclarationMode As Boolean - - ''' <summary> - ''' Engine Idle Speed ( Associated with the vehicle bein tested ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property EngineIdleSpeed As PerSecond - - ''' <summary> - ''' Pneumatic Overrun Utilisation - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PneumaticOverrunUtilisation As Double - - ''' <summary> - ''' Stored Energy Efficiency - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property StoredEnergyEfficiency As Double - - ''' <summary> - ''' Running Calc - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property RunningCalc As Boolean - - ''' <summary> - ''' Running Calc - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property InternalEnginePower As Watt -End Interface diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IVectoInputs.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IVectoInputs.vb deleted file mode 100644 index 491315a4500253780dc6426125310d2d2a77b3a8..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IVectoInputs.vb +++ /dev/null @@ -1,55 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Public Interface IVectoInputs - ''' <summary> - ''' Vehicle Mass (KG) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property VehicleWeightKG As Kilogram - - ''' <summary> - ''' Cycle ( Urban, Interurban etc ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property Cycle As String - - ''' <summary> - ''' PowerNet Voltage (V) Volts available on the bus by Batteries - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PowerNetVoltage As Volt - - ''' <summary> - ''' Fuel Map Used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property FuelMap As IFuelConsumptionMap - - Property FuelMapFile As String - - ''' <summary> - ''' Fuel density used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property FuelDensity As KilogramPerCubicMeter -End Interface diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Application.Designer.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Application.Designer.vb deleted file mode 100644 index 8ab460ba03644d647f67a62136b9e8f010a0d561..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Application.Designer.vb +++ /dev/null @@ -1,13 +0,0 @@ -'------------------------------------------------------------------------------ -' <auto-generated> -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' </auto-generated> -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Application.myapp b/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Application.myapp deleted file mode 100644 index 758895def250c4f622eef515e9cd04fd155619a9..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <MySubMain>false</MySubMain> - <SingleInstance>false</SingleInstance> - <ShutdownMode>0</ShutdownMode> - <EnableVisualStyles>true</EnableVisualStyles> - <AuthenticationMode>0</AuthenticationMode> - <ApplicationType>1</ApplicationType> - <SaveMySettingsOnExit>true</SaveMySettingsOnExit> -</MyApplicationData> diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/AssemblyInfo.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/AssemblyInfo.vb deleted file mode 100644 index b0d273e2a828b90e5360b43c022058488ff1572b..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/AssemblyInfo.vb +++ /dev/null @@ -1,35 +0,0 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' General Information about an assembly is controlled through the following -' set of attributes. Change these attribute values to modify the information -' associated with an assembly. - -' Review the values of the assembly attributes - -<Assembly: AssemblyTitle("AdvancedAuxiliaryInterfaces")> -<Assembly: AssemblyDescription("")> -<Assembly: AssemblyCompany("AEA Group")> -<Assembly: AssemblyProduct("AdvancedAuxiliaryInterfaces")> -<Assembly: AssemblyCopyright("Copyright © AEA Group 2014")> -<Assembly: AssemblyTrademark("")> - -<Assembly: ComVisible(False)> - -'The following GUID is for the ID of the typelib if this project is exposed to COM -<Assembly: Guid("199bde21-c55e-4442-a77c-90f437a7cf27")> - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' <Assembly: AssemblyVersion("1.0.*")> - -<Assembly: AssemblyVersion("1.0.0.0")> -<Assembly: AssemblyFileVersion("1.0.0.0")> diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Resources.Designer.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Resources.Designer.vb deleted file mode 100644 index 0b266d4e9cfcd30bd01867faccb0b7e472138e7d..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Resources.Designer.vb +++ /dev/null @@ -1,63 +0,0 @@ -'------------------------------------------------------------------------------ -' <auto-generated> -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' </auto-generated> -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - '''<summary> - ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - '''</summary> - <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _ - Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ - Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ - Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - '''<summary> - ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - '''</summary> - <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("VectoAuxiliaries.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - '''<summary> - ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - '''</summary> - <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - End Module -End Namespace diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Resources.resx b/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Resources.resx deleted file mode 100644 index af7dbebbacef595e3089c01c05671016c21a8304..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> -</root> \ No newline at end of file diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Settings.Designer.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Settings.Designer.vb deleted file mode 100644 index 950881703c2b39c67a8cc31aaeef5425505c0b26..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Settings.Designer.vb +++ /dev/null @@ -1,73 +0,0 @@ -'------------------------------------------------------------------------------ -' <auto-generated> -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' </auto-generated> -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ - Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _ - Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) - -#Region "Funktion zum automatischen Speichern von My.Settings" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _ - Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ - Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _ - Friend Module MySettingsProperty - - <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ - Friend ReadOnly Property Settings() As Global.VectoAuxiliaries.My.MySettings - Get - Return Global.VectoAuxiliaries.My.MySettings.Default - End Get - End Property - End Module -End Namespace diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Settings.settings b/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Settings.settings deleted file mode 100644 index 85b890b3c66b9beee248abaddd2ec71f8b1df2b2..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/My Project/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true"> - <Profiles> - <Profile Name="(Default)" /> - </Profiles> - <Settings /> -</SettingsFile> diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/Signals.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/Signals.vb deleted file mode 100644 index 37e4d27d57631d5e77a317469ddf10ce918f0d27..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/Signals.vb +++ /dev/null @@ -1,64 +0,0 @@ -' Copyright 2017 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 TUGraz.VectoCommon.Utils - -Public Class Signals - Implements ISignals - - 'Backing variables - Private _WHTCCorretion As Single = 1 - Private _smartElectrics As Boolean - - Public Property ClutchEngaged As Boolean Implements ISignals.ClutchEngaged - Public Property EngineDrivelinePower As Watt Implements ISignals.EngineDrivelinePower - Public Property EngineDrivelineTorque As NewtonMeter Implements ISignals.EngineDrivelineTorque - Public Property EngineMotoringPower As Watt Implements ISignals.EngineMotoringPower - Public Property EngineSpeed As PerSecond Implements ISignals.EngineSpeed - - Public Property SmartElectrics As Boolean Implements ISignals.SmartElectrics - Get - Return _smartElectrics - End Get - Set(value As Boolean) - _smartElectrics = value - End Set - End Property - - Public Property SmartPneumatics As Boolean Implements ISignals.SmartPneumatics - Public Property TotalCycleTimeSeconds As Integer Implements ISignals.TotalCycleTimeSeconds - Public Property CurrentCycleTimeInSeconds As Double Implements ISignals.CurrentCycleTimeInSeconds - Public Property PreExistingAuxPower As Watt Implements ISignals.PreExistingAuxPower - Public Property Idle As Boolean Implements ISignals.Idle - Public Property InNeutral As Boolean Implements ISignals.InNeutral - - Public Property AuxiliaryEventReportingLevel As AdvancedAuxiliaryMessageType _ - Implements ISignals.AuxiliaryEventReportingLevel - - Public Property EngineStopped As Boolean Implements ISignals.EngineStopped - Public Property DeclarationMode As Boolean Implements ISignals.DeclarationMode - - Public Property WHTC As Double Implements ISignals.WHTC - Set(value As Double) - _WHTCCorretion = value - End Set - Get - Return _WHTCCorretion - End Get - End Property - - Public Property EngineIdleSpeed As PerSecond Implements ISignals.EngineIdleSpeed - Public Property PneumaticOverrunUtilisation As Double Implements ISignals.PneumaticOverrunUtilisation - Public Property StoredEnergyEfficiency As Double Implements ISignals.StoredEnergyEfficiency - Public Property RunningCalc As Boolean Implements ISignals.RunningCalc - Public Property InternalEnginePower As Watt Implements ISignals.InternalEnginePower -End Class - - diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/VectoInputs.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/VectoInputs.vb deleted file mode 100644 index 657a8727798307b1c5f71f5b2cd15ca01bf9fdb9..0000000000000000000000000000000000000000 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/VectoInputs.vb +++ /dev/null @@ -1,91 +0,0 @@ -' Copyright 2017 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 Newtonsoft.Json -Imports TUGraz.VectoCommon.Utils - -Public Class VectoInputs - Implements IVectoInputs - - ''' <summary> - ''' Name of the Cycle ( Urban, Interurban etc ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property Cycle As String Implements IVectoInputs.Cycle - - ''' <summary> - ''' Vehicle Mass (KG) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - <JsonIgnore> - Public Property VehicleWeightKG As Kilogram Implements IVectoInputs.VehicleWeightKG - Get - Return _vehicleWeight.SI(Of Kilogram)() - End Get - Set(value As Kilogram) - _vehicleWeight = value.Value() - End Set - End Property - - <JsonProperty("VehicleWeightKG")> Dim _vehicleWeight As Double - - ''' <summary> - ''' Powernet Voltage (V) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>This is the power voltage available in the bus - usually 26.3 Volts</remarks> - <JsonIgnore> - Public Property PowerNetVoltage As Volt Implements IVectoInputs.PowerNetVoltage - Get - Return _powerNetVoltage.SI(Of Volt)() - End Get - Set(value As Volt) - _powerNetVoltage = value.Value() - End Set - End Property - - <JsonProperty("PowerNetVoltage")> Dim _powerNetVoltage As Double - - ''' <summary> - ''' Fuel Map Same One as used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - <JsonIgnore> - Public Property FuelMap As IFuelConsumptionMap Implements IVectoInputs.FuelMap - - <JsonProperty("FuelMap")> - Public Property FuelMapFile As String Implements IVectoInputs.FuelMapFile - - ''' <summary> - ''' Fuel Density as used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - <JsonIgnore> - Public Property FuelDensity As KilogramPerCubicMeter Implements IVectoInputs.FuelDensity - Get - Return _fuelDensity.SI(Of KilogramPerCubicMeter)() - End Get - Set(value As KilogramPerCubicMeter) - _fuelDensity = value.Value() - End Set - End Property - - <JsonProperty("FuelDensity")> Dim _fuelDensity As Double -End Class - diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs index f9c211ec699c7bdc99821c874399be909f95e2ae..566210bfa5f9f5af0e1b3fa8bf1ba8358fc402ac 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs @@ -34,6 +34,9 @@ using System.IO; using System.Linq; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.BusAuxiliaries; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces; +using TUGraz.VectoCore.BusAuxiliaries.Interfaces.DownstreamModules.PneumaticSystem; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; @@ -41,256 +44,257 @@ using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.OutputData; using VectoAuxiliaries; -using VectoAuxiliaries.Pneumatics; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class BusAuxiliariesAdapter : LoggingObject, IAuxInProvider, IAuxPort - { - protected readonly IDataBus DataBus; - protected internal BusAuxState CurrentState; - protected internal BusAuxState PreviousState; - - protected internal readonly IAuxPort AdditionalAux; - - protected IAdvancedAuxiliaries Auxiliaries; - private readonly FuelConsumptionAdapter _fcMapAdapter; - - public BusAuxiliariesAdapter(IDataBus container, string aauxFile, string cycleName, Kilogram vehicleWeight, - FuelConsumptionMap fcMap, PerSecond engineIdleSpeed, IAuxPort additionalAux = null) - { - // mAAUX_Global.advancedAuxModel.Signals.DeclarationMode = Cfg.DeclMode - // mAAUX_Global.advancedAuxModel.Signals.WHTC = Declaration.WHTCcorrFactor - CurrentState = new BusAuxState(); - PreviousState = new BusAuxState { AngularSpeed = engineIdleSpeed }; - - AdditionalAux = additionalAux; - - DataBus = container; - var tmpAux = new AdvancedAuxiliaries { - VectoInputs = { - Cycle = DetermineCycle(cycleName), - VehicleWeightKG = vehicleWeight - } - }; - - _fcMapAdapter = new FuelConsumptionAdapter() { FcMap = fcMap }; - tmpAux.VectoInputs.FuelMap = _fcMapAdapter; - // TODO: MQ 2019-07-30: how to handle fuel in aaux? - tmpAux.VectoInputs.FuelDensity = FuelData.Instance().Lookup((container as IVehicleContainer).RunData.EngineData.Fuels.First().FuelData.FuelType).FuelDensity; - - //'Set Signals - tmpAux.Signals.EngineIdleSpeed = engineIdleSpeed; - tmpAux.Initialise(Path.GetFileName(aauxFile), Path.GetDirectoryName(Path.GetFullPath(aauxFile)) + @"\"); - - tmpAux.Signals.TotalCycleTimeSeconds = - tmpAux.actuationsMap.GetNumActuations(new ActuationsKey("CycleTime", tmpAux.VectoInputs.Cycle)); - - // call initialize again _after_ setting the cycle time to get the correct consumtions - tmpAux.Initialise(Path.GetFileName(aauxFile), Path.GetDirectoryName(Path.GetFullPath(aauxFile)) + @"\"); - - - Auxiliaries = tmpAux; - } - - private static string DetermineCycle(string cycleName) - { - var cycle = cycleName.ToLower(); - - if (cycle.Contains("bus")) { - if (cycle.Contains("heavy_urban")) { - return "Heavy urban"; - } - if (cycle.Contains("suburban")) { - return "Suburban"; - } - if (cycle.Contains("interurban")) { - return "Interurban"; - } - if (cycle.Contains("urban")) { - return "Urban"; - } - } - if (cycle.Contains("coach")) { - return "Coach"; - } - Logger<BusAuxiliariesAdapter>() - .Warn("UnServiced Cycle Name '{0}' in Pneumatics Actuations Map 0 Actuations returned", cycleName); - return cycleName; - } - - public IAuxPort Port() - { - return this; - } - - public NewtonMeter Initialize(NewtonMeter torque, PerSecond angularSpeed) - { - //PreviousState.TotalFuelConsumption = 0.SI<Kilogram>(); - PreviousState.AngularSpeed = angularSpeed; - CurrentState.AngularSpeed = angularSpeed; - if (AdditionalAux != null) { - AdditionalAux.Initialize(torque, angularSpeed); - } - PreviousState.PowerDemand = GetBusAuxPowerDemand(0.SI<Second>(), 1.SI<Second>(), torque, torque, angularSpeed); - return PreviousState.PowerDemand / angularSpeed; - } - - - public NewtonMeter TorqueDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, - PerSecond angularSpeed, bool dryRun = false) - { - CurrentState.AngularSpeed = angularSpeed; - CurrentState.dt = dt; - CurrentState.PowerDemand = GetBusAuxPowerDemand(absTime, dt, torquePowerTrain, torqueEngine, angularSpeed, dryRun); - - var avgAngularSpeed = (CurrentState.AngularSpeed + PreviousState.AngularSpeed) / 2.0; - return CurrentState.PowerDemand / avgAngularSpeed; - } - - public Watt PowerDemandEngineOn(PerSecond engineSpeed) - { - throw new NotImplementedException(); - } - - public Watt PowerDemandEngineOff() - { - throw new NotImplementedException(); - } - - - protected internal void DoWriteModalResults(IModalDataContainer container) - { - _fcMapAdapter.AllowExtrapolation = true; - // cycleStep has to be called here and not in DoCommit, write is called before Commit! - var message = String.Empty; - Auxiliaries.CycleStep(CurrentState.dt, ref message); - Log.Warn(message); - - CurrentState.TotalFuelConsumption = Auxiliaries.TotalFuelGRAMS; - container[ModalResultField.P_aux] = CurrentState.PowerDemand; - - container[ModalResultField.AA_NonSmartAlternatorsEfficiency] = Auxiliaries.AA_NonSmartAlternatorsEfficiency; - if (Auxiliaries.AA_SmartIdleCurrent_Amps != null) { - container[ModalResultField.AA_SmartIdleCurrent_Amps] = Auxiliaries.AA_SmartIdleCurrent_Amps; - } - container[ModalResultField.AA_SmartIdleAlternatorsEfficiency] = Auxiliaries.AA_SmartIdleAlternatorsEfficiency; - if (Auxiliaries.AA_SmartTractionCurrent_Amps != null) { - container[ModalResultField.AA_SmartTractionCurrent_Amps] = - Auxiliaries.AA_SmartTractionCurrent_Amps; - } - container[ModalResultField.AA_SmartTractionAlternatorEfficiency] = Auxiliaries.AA_SmartTractionAlternatorEfficiency; - if (Auxiliaries.AA_SmartOverrunCurrent_Amps != null) { - container[ModalResultField.AA_SmartOverrunCurrent_Amps] = Auxiliaries.AA_SmartOverrunCurrent_Amps; - } - container[ModalResultField.AA_SmartOverrunAlternatorEfficiency] = Auxiliaries.AA_SmartOverrunAlternatorEfficiency; - if (Auxiliaries.AA_CompressorFlowRate_LitrePerSec != null) { - container[ModalResultField.AA_CompressorFlowRate_LitrePerSec] = - Auxiliaries.AA_CompressorFlowRate_LitrePerSec; - } - container[ModalResultField.AA_OverrunFlag] = Auxiliaries.AA_OverrunFlag; - container[ModalResultField.AA_EngineIdleFlag] = Auxiliaries.AA_EngineIdleFlag; - container[ModalResultField.AA_CompressorFlag] = Auxiliaries.AA_CompressorFlag; - if (Auxiliaries.AA_TotalCycleFC_Grams != null) { - container[ModalResultField.AA_TotalCycleFC_Grams] = Auxiliaries.AA_TotalCycleFC_Grams; - } - if (Auxiliaries.AA_TotalCycleFC_Litres != null) { - container[ModalResultField.AA_TotalCycleFC_Litres] = Auxiliaries.AA_TotalCycleFC_Litres; - } - if (Auxiliaries.AA_AveragePowerDemandCrankHVACMechanicals != null) { - container[ModalResultField.AA_AveragePowerDemandCrankHVACMechanicals] = - Auxiliaries.AA_AveragePowerDemandCrankHVACMechanicals; - } - if (Auxiliaries.AA_AveragePowerDemandCrankHVACElectricals != null) { - container[ModalResultField.AA_AveragePowerDemandCrankHVACElectricals] = - Auxiliaries.AA_AveragePowerDemandCrankHVACElectricals; - } - if (Auxiliaries.AA_AveragePowerDemandCrankElectrics != null) { - container[ModalResultField.AA_AveragePowerDemandCrankElectrics] = - Auxiliaries.AA_AveragePowerDemandCrankElectrics; - } - if (Auxiliaries.AA_AveragePowerDemandCrankPneumatics != null) { - container[ModalResultField.AA_AveragePowerDemandCrankPneumatics] = - Auxiliaries.AA_AveragePowerDemandCrankPneumatics; - } - if (Auxiliaries.AA_TotalCycleFuelConsumptionCompressorOff != null) { - container[ModalResultField.AA_TotalCycleFuelConsumptionCompressorOff] = - Auxiliaries.AA_TotalCycleFuelConsumptionCompressorOff; - } - container[ModalResultField.AA_TotalCycleFuelConsumptionCompressorOn] = - Auxiliaries.AA_TotalCycleFuelConsumptionCompressorOn; - } - - protected internal void DoCommitSimulationStep() - { - PreviousState = CurrentState; - CurrentState = new BusAuxState(); - } - - protected internal KilogramPerSecond AAuxFuelConsumption - { - get { return (CurrentState.TotalFuelConsumption - PreviousState.TotalFuelConsumption) / CurrentState.dt; } - } - - private Watt GetBusAuxPowerDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, - PerSecond angularSpeed, bool dryRun = false) - { - _fcMapAdapter.AllowExtrapolation = true; - - Auxiliaries.Signals.ClutchEngaged = DataBus.ClutchClosed(absTime); - Auxiliaries.Signals.EngineDrivelinePower = torquePowerTrain * angularSpeed; - Auxiliaries.Signals.EngineDrivelineTorque = torquePowerTrain; - Auxiliaries.Signals.InternalEnginePower = torqueEngine * angularSpeed - DataBus.BrakePower; - if (DataBus.DriverBehavior == DrivingBehavior.Coasting) { - // make sure smart aux are _not_ enabled for now - // set internal_engine_power a little bit lower so there is no excessive power for smart aux - Auxiliaries.Signals.InternalEnginePower = 0.9 * torqueEngine * angularSpeed /*- DataBus.BrakePower*/; - // if smart aux should be on during coasting use the following line - // set internal_engine_power to a large value (*10) so that there's excessive power for smart aux (alreadin during search operating point) - //(float)DataBus.EngineDragPower(angularSpeed).Value() / 100; - } else { - if (DataBus.DriverBehavior != DrivingBehavior.Braking) { - Auxiliaries.Signals.InternalEnginePower = 0.SI<Watt>(); - //(float)((0.9 * torqueEngine * angularSpeed - DataBus.BrakePower) / 1000).Value(); - } else { - // smart aux should be on during braking - } - } - Auxiliaries.Signals.EngineMotoringPower = -DataBus.EngineDragPower(angularSpeed); - Auxiliaries.Signals.EngineSpeed = angularSpeed; - var avgAngularSpeed = (PreviousState.AngularSpeed + CurrentState.AngularSpeed) / 2; - Auxiliaries.Signals.PreExistingAuxPower = AdditionalAux != null - ? AdditionalAux.TorqueDemand(absTime, dt, torquePowerTrain, torqueEngine, angularSpeed, dryRun) * avgAngularSpeed - : 0.SI<Watt>(); - //mAAUX_Global.PreExistingAuxPower; - Auxiliaries.Signals.Idle = DataBus.VehicleStopped; - Auxiliaries.Signals.InNeutral = DataBus.Gear == 0; - Auxiliaries.Signals.RunningCalc = true; - - //mAAUX_Global.Internal_Engine_Power; - //'Power coming out of Advanced Model is in Watts. - - return Auxiliaries.AuxiliaryPowerAtCrankWatts + Auxiliaries.Signals.PreExistingAuxPower; - } - - protected class FuelConsumptionAdapter : IFuelConsumptionMap - { - protected internal FuelConsumptionMap FcMap; - - public bool AllowExtrapolation { get; set; } - - public KilogramPerSecond GetFuelConsumption(NewtonMeter torque, PerSecond angularVelocity) - { - return FcMap.GetFuelConsumption(torque, angularVelocity, AllowExtrapolation).Value; - } - } - - public class BusAuxState - { - public Second dt; - public PerSecond AngularSpeed; - public Watt PowerDemand; - public Kilogram TotalFuelConsumption = 0.SI<Kilogram>(); - } - } + public class BusAuxiliariesAdapter : LoggingObject, IAuxInProvider, IAuxPort + { + protected readonly IDataBus DataBus; + protected internal BusAuxState CurrentState; + protected internal BusAuxState PreviousState; + + protected internal readonly IAuxPort AdditionalAux; + + protected IAdvancedAuxiliaries Auxiliaries; + private readonly FuelConsumptionAdapter _fcMapAdapter; + + public BusAuxiliariesAdapter(IDataBus container, string aauxFile, string cycleName, Kilogram vehicleWeight, + FuelConsumptionMap fcMap, PerSecond engineIdleSpeed, IAuxPort additionalAux = null) + { + // mAAUX_Global.advancedAuxModel.Signals.DeclarationMode = Cfg.DeclMode + // mAAUX_Global.advancedAuxModel.Signals.WHTC = Declaration.WHTCcorrFactor + CurrentState = new BusAuxState(); + PreviousState = new BusAuxState { AngularSpeed = engineIdleSpeed }; + + AdditionalAux = additionalAux; + + DataBus = container; + var tmpAux = new AdvancedAuxiliaries { + VectoInputs = { + Cycle = DetermineCycle(cycleName), + VehicleWeightKG = vehicleWeight + } + }; + + _fcMapAdapter = new FuelConsumptionAdapter() { FcMap = fcMap }; + tmpAux.VectoInputs.FuelMap = _fcMapAdapter; + // TODO: MQ 2019-07-30: how to handle fuel in aaux? + tmpAux.VectoInputs.FuelDensity = FuelData.Instance().Lookup((container as IVehicleContainer).RunData.EngineData.Fuels.First().FuelData.FuelType).FuelDensity; + + //'Set Signals + tmpAux.Signals.EngineIdleSpeed = engineIdleSpeed; + tmpAux.Initialise(Path.GetFileName(aauxFile), Path.GetDirectoryName(Path.GetFullPath(aauxFile)) + @"\"); + + tmpAux.Signals.TotalCycleTimeSeconds = + tmpAux.actuationsMap.GetNumActuations(new ActuationsKey("CycleTime", tmpAux.VectoInputs.Cycle)); + + // call initialize again _after_ setting the cycle time to get the correct consumtions + tmpAux.Initialise(Path.GetFileName(aauxFile), Path.GetDirectoryName(Path.GetFullPath(aauxFile)) + @"\"); + + + Auxiliaries = tmpAux; + } + + private static string DetermineCycle(string cycleName) + { + var cycle = cycleName.ToLower(); + + if (cycle.Contains("bus")) { + if (cycle.Contains("heavy_urban")) { + return "Heavy urban"; + } + if (cycle.Contains("suburban")) { + return "Suburban"; + } + if (cycle.Contains("interurban")) { + return "Interurban"; + } + if (cycle.Contains("urban")) { + return "Urban"; + } + } + if (cycle.Contains("coach")) { + return "Coach"; + } + Logger<BusAuxiliariesAdapter>() + .Warn("UnServiced Cycle Name '{0}' in Pneumatics Actuations Map 0 Actuations returned", cycleName); + return cycleName; + } + + public IAuxPort Port() + { + return this; + } + + public NewtonMeter Initialize(NewtonMeter torque, PerSecond angularSpeed) + { + //PreviousState.TotalFuelConsumption = 0.SI<Kilogram>(); + PreviousState.AngularSpeed = angularSpeed; + CurrentState.AngularSpeed = angularSpeed; + if (AdditionalAux != null) { + AdditionalAux.Initialize(torque, angularSpeed); + } + PreviousState.PowerDemand = GetBusAuxPowerDemand(0.SI<Second>(), 1.SI<Second>(), torque, torque, angularSpeed); + return PreviousState.PowerDemand / angularSpeed; + } + + + public NewtonMeter TorqueDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, + PerSecond angularSpeed, bool dryRun = false) + { + CurrentState.AngularSpeed = angularSpeed; + CurrentState.dt = dt; + CurrentState.PowerDemand = GetBusAuxPowerDemand(absTime, dt, torquePowerTrain, torqueEngine, angularSpeed, dryRun); + + var avgAngularSpeed = (CurrentState.AngularSpeed + PreviousState.AngularSpeed) / 2.0; + return CurrentState.PowerDemand / avgAngularSpeed; + } + + public Watt PowerDemandEngineOn(PerSecond engineSpeed) + { + throw new NotImplementedException(); + } + + public Watt PowerDemandEngineOff() + { + throw new NotImplementedException(); + } + + + protected internal void DoWriteModalResults(IModalDataContainer container) + { + _fcMapAdapter.AllowExtrapolation = true; + // cycleStep has to be called here and not in DoCommit, write is called before Commit! + var message = String.Empty; + Auxiliaries.CycleStep(CurrentState.dt, ref message); + Log.Warn(message); + + CurrentState.TotalFuelConsumption = Auxiliaries.TotalFuelGRAMS; + container[ModalResultField.P_aux] = CurrentState.PowerDemand; + + container[ModalResultField.AA_NonSmartAlternatorsEfficiency] = Auxiliaries.AA_NonSmartAlternatorsEfficiency; + if (Auxiliaries.AA_SmartIdleCurrent_Amps != null) { + container[ModalResultField.AA_SmartIdleCurrent_Amps] = Auxiliaries.AA_SmartIdleCurrent_Amps; + } + container[ModalResultField.AA_SmartIdleAlternatorsEfficiency] = Auxiliaries.AA_SmartIdleAlternatorsEfficiency; + if (Auxiliaries.AA_SmartTractionCurrent_Amps != null) { + container[ModalResultField.AA_SmartTractionCurrent_Amps] = + Auxiliaries.AA_SmartTractionCurrent_Amps; + } + container[ModalResultField.AA_SmartTractionAlternatorEfficiency] = Auxiliaries.AA_SmartTractionAlternatorEfficiency; + if (Auxiliaries.AA_SmartOverrunCurrent_Amps != null) { + container[ModalResultField.AA_SmartOverrunCurrent_Amps] = Auxiliaries.AA_SmartOverrunCurrent_Amps; + } + container[ModalResultField.AA_SmartOverrunAlternatorEfficiency] = Auxiliaries.AA_SmartOverrunAlternatorEfficiency; + if (Auxiliaries.AA_CompressorFlowRate_LitrePerSec != null) { + container[ModalResultField.AA_CompressorFlowRate_LitrePerSec] = + Auxiliaries.AA_CompressorFlowRate_LitrePerSec; + } + container[ModalResultField.AA_OverrunFlag] = Auxiliaries.AA_OverrunFlag; + container[ModalResultField.AA_EngineIdleFlag] = Auxiliaries.AA_EngineIdleFlag; + container[ModalResultField.AA_CompressorFlag] = Auxiliaries.AA_CompressorFlag; + if (Auxiliaries.AA_TotalCycleFC_Grams != null) { + container[ModalResultField.AA_TotalCycleFC_Grams] = Auxiliaries.AA_TotalCycleFC_Grams; + } + if (Auxiliaries.AA_TotalCycleFC_Litres != null) { + container[ModalResultField.AA_TotalCycleFC_Litres] = Auxiliaries.AA_TotalCycleFC_Litres; + } + if (Auxiliaries.AA_AveragePowerDemandCrankHVACMechanicals != null) { + container[ModalResultField.AA_AveragePowerDemandCrankHVACMechanicals] = + Auxiliaries.AA_AveragePowerDemandCrankHVACMechanicals; + } + if (Auxiliaries.AA_AveragePowerDemandCrankHVACElectricals != null) { + container[ModalResultField.AA_AveragePowerDemandCrankHVACElectricals] = + Auxiliaries.AA_AveragePowerDemandCrankHVACElectricals; + } + if (Auxiliaries.AA_AveragePowerDemandCrankElectrics != null) { + container[ModalResultField.AA_AveragePowerDemandCrankElectrics] = + Auxiliaries.AA_AveragePowerDemandCrankElectrics; + } + if (Auxiliaries.AA_AveragePowerDemandCrankPneumatics != null) { + container[ModalResultField.AA_AveragePowerDemandCrankPneumatics] = + Auxiliaries.AA_AveragePowerDemandCrankPneumatics; + } + if (Auxiliaries.AA_TotalCycleFuelConsumptionCompressorOff != null) { + container[ModalResultField.AA_TotalCycleFuelConsumptionCompressorOff] = + Auxiliaries.AA_TotalCycleFuelConsumptionCompressorOff; + } + container[ModalResultField.AA_TotalCycleFuelConsumptionCompressorOn] = + Auxiliaries.AA_TotalCycleFuelConsumptionCompressorOn; + } + + protected internal void DoCommitSimulationStep() + { + PreviousState = CurrentState; + CurrentState = new BusAuxState(); + } + + protected internal KilogramPerSecond AAuxFuelConsumption + { + get { return (CurrentState.TotalFuelConsumption - PreviousState.TotalFuelConsumption) / CurrentState.dt; } + } + + private Watt GetBusAuxPowerDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, + PerSecond angularSpeed, bool dryRun = false) + { + Auxiliaries.ResetCalculations(); + + _fcMapAdapter.AllowExtrapolation = true; + + Auxiliaries.Signals.ClutchEngaged = DataBus.ClutchClosed(absTime); + Auxiliaries.Signals.EngineDrivelinePower = torquePowerTrain * angularSpeed; + Auxiliaries.Signals.EngineDrivelineTorque = torquePowerTrain; + Auxiliaries.Signals.InternalEnginePower = torqueEngine * angularSpeed - DataBus.BrakePower; + if (DataBus.DriverBehavior == DrivingBehavior.Coasting) { + // make sure smart aux are _not_ enabled for now + // set internal_engine_power a little bit lower so there is no excessive power for smart aux + Auxiliaries.Signals.InternalEnginePower = 0.9 * torqueEngine * angularSpeed /*- DataBus.BrakePower*/; + // if smart aux should be on during coasting use the following line + // set internal_engine_power to a large value (*10) so that there's excessive power for smart aux (alreadin during search operating point) + //(float)DataBus.EngineDragPower(angularSpeed).Value() / 100; + } else { + if (DataBus.DriverBehavior != DrivingBehavior.Braking) { + Auxiliaries.Signals.InternalEnginePower = 0.SI<Watt>(); + //(float)((0.9 * torqueEngine * angularSpeed - DataBus.BrakePower) / 1000).Value(); + } else { + // smart aux should be on during braking + } + } + Auxiliaries.Signals.EngineMotoringPower = -DataBus.EngineDragPower(angularSpeed); + Auxiliaries.Signals.EngineSpeed = angularSpeed; + var avgAngularSpeed = (PreviousState.AngularSpeed + CurrentState.AngularSpeed) / 2; + Auxiliaries.Signals.PreExistingAuxPower = AdditionalAux != null + ? AdditionalAux.TorqueDemand(absTime, dt, torquePowerTrain, torqueEngine, angularSpeed, dryRun) * avgAngularSpeed + : 0.SI<Watt>(); + //mAAUX_Global.PreExistingAuxPower; + Auxiliaries.Signals.Idle = DataBus.VehicleStopped; + Auxiliaries.Signals.InNeutral = DataBus.Gear == 0; + Auxiliaries.Signals.RunningCalc = true; + + //mAAUX_Global.Internal_Engine_Power; + //'Power coming out of Advanced Model is in Watts. + + return Auxiliaries.AuxiliaryPowerAtCrankWatts + Auxiliaries.Signals.PreExistingAuxPower; + } + + protected class FuelConsumptionAdapter : IFuelConsumptionMap + { + protected internal FuelConsumptionMap FcMap; + + public bool AllowExtrapolation { get; set; } + + public KilogramPerSecond GetFuelConsumption(NewtonMeter torque, PerSecond angularVelocity) + { + return FcMap.GetFuelConsumption(torque, angularVelocity, AllowExtrapolation).Value; + } + } + + public class BusAuxState + { + public Second dt; + public PerSecond AngularSpeed; + public Watt PowerDemand; + public Kilogram TotalFuelConsumption = 0.SI<Kilogram>(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 2c1299b072a6f7fa9c68da8f691cb5fda5e5ef50..95cd85ccd4c5cd8956329006e137ed2fbd267576 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -719,9 +719,9 @@ <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\VectoCommon\AdvancedAuxiliaryInterfaces\AdvancedAuxiliaryInterfaces.vbproj"> - <Project>{b4b9bd2f-fd8f-4bb8-82fa-e2154d2c7fbd}</Project> - <Name>AdvancedAuxiliaryInterfaces</Name> + <ProjectReference Include="..\..\VECTOAux\BusAuxiliaries\BusAuxiliaries.csproj"> + <Project>{550D99D4-25F7-48D9-B0F0-E5DD6CB3485D}</Project> + <Name>BusAuxiliaries</Name> </ProjectReference> <ProjectReference Include="..\..\VECTOAux\VectoAuxiliaries\VectoAuxiliaries.vbproj"> <Project>{fdeee460-0b8a-4ef6-8d9e-72f203a50f65}</Project>