diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index a7b802f247852a632347feec06c2858bffb6d1b7..daff362bb4fb1b56bfa696ac008c38cac4e8a23b 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -644,7 +644,7 @@ Public Class DummyVehicle Public Property MaxNetPower1 As Watt Implements IVehicleDeclarationInputData.MaxNetPower1 Public Property MaxNetPower2 As Watt Implements IVehicleDeclarationInputData.MaxNetPower2 Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass - Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck + Public ReadOnly Property NumberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode Public Property CurbMassExtra As Kilogram Implements IVehicleEngineeringInputData.CurbMassExtra diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 26c055418f00655cfa1bd8ae1815fde20d0fac04..84e2d3971eb3b045bb09ebe06558f2e3e7d7ad36 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -832,7 +832,7 @@ Public Class MockEngineeringVehicle Public Property MaxNetPower1 As Watt Implements IVehicleDeclarationInputData.MaxNetPower1 Public Property MaxNetPower2 As Watt Implements IVehicleDeclarationInputData.MaxNetPower2 Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass - Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck + Public ReadOnly Property NumberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode Public ReadOnly Property FloorType As FloorType Implements IVehicleDeclarationInputData.FloorType diff --git a/VECTO/Input Files/MockVehicleInputData.vb b/VECTO/Input Files/MockVehicleInputData.vb index 1d4db634d740657ab876311d7fd95e5b94607126..5d0455823ff38c71eb461b163e9dcd740f5e95e8 100644 --- a/VECTO/Input Files/MockVehicleInputData.vb +++ b/VECTO/Input Files/MockVehicleInputData.vb @@ -40,7 +40,7 @@ Public Class MockVehicleInputData Public Property MaxNetPower1 As Watt Implements IVehicleDeclarationInputData.MaxNetPower1 Public Property MaxNetPower2 As Watt Implements IVehicleDeclarationInputData.MaxNetPower2 Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass - Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck + Public ReadOnly Property NumberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode Public ReadOnly Property FloorType As FloorType Implements IVehicleDeclarationInputData.FloorType diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index a58e6ba3569f600b30ea2ad6ee1913ebe51b1cc2..90a499fa34bac220bbff2999e085be9515f22b45 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -759,7 +759,7 @@ Public Class Vehicle End Property Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass - Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck + Public ReadOnly Property NumberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode Public ReadOnly Property FloorType As FloorType Implements IVehicleDeclarationInputData.FloorType diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs index 474f1a140c55bba96b079ab5a71f20abd357e45b..30ef4c6b78d52d33eca7fb31f74f346a8ed98411 100644 --- a/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs @@ -108,7 +108,7 @@ namespace VECTO3GUI.ViewModel.Adapter.Declaration public Watt MaxNetPower1 { get; } public Watt MaxNetPower2 { get; } public RegistrationClass RegisteredClass { get; } - public int NuberOfPassengersUpperDeck { get; } + public int NumberOfPassengersUpperDeck { get; } public int NumberOfPassengersLowerDeck { get; } public VehicleCode VehicleCode { get; } public FloorType FloorType { get; } diff --git a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs index 5165e4625461148e3b6631c275a2e743fd03e246..5798720446f78a3ce78fd0383108b75c0da209e4 100644 --- a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs @@ -166,7 +166,7 @@ namespace VECTO3GUI.ViewModel.Impl CurbMassChassis = vehicle.CurbMassChassis; TechnicalPermissibleMaximumLadenMass = vehicle.GrossVehicleMassRating; NumberOfPassengersLowerDeck = vehicle.NumberOfPassengersLowerDeck; - NumberOfPassengersUpperDeck = vehicle.NuberOfPassengersUpperDeck; + NumberOfPassengersUpperDeck = vehicle.NumberOfPassengersUpperDeck; FloorType = vehicle.FloorType; HeightIntegratedBody = vehicle.Height; VehicleLength = vehicle.Length; diff --git a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries_x.vbproj b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries_x.vbproj new file mode 100644 index 0000000000000000000000000000000000000000..3d2801c4b28e37460577db276cf11826f8946abc --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries_x.vbproj @@ -0,0 +1,317 @@ +<?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>{FDEEE460-0B8A-4EF6-8D9E-72F203A50F65}</ProjectGuid> + <OutputType>Library</OutputType> + <RootNamespace>VectoAuxiliaries</RootNamespace> + <AssemblyName>BusAuxiliaries</AssemblyName> + <FileAlignment>512</FileAlignment> + <MyType>Windows</MyType> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <TargetFrameworkProfile /> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <DefineDebug>true</DefineDebug> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\Debug\</OutputPath> + <DocumentationFile>BusAuxiliaries.xml</DocumentationFile> + <NoWarn> + </NoWarn> + <WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors> + <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>BusAuxiliaries.xml</DocumentationFile> + <NoWarn> + </NoWarn> + <WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup> + <OptionExplicit>On</OptionExplicit> + </PropertyGroup> + <PropertyGroup> + <OptionCompare>Binary</OptionCompare> + </PropertyGroup> + <PropertyGroup> + <OptionStrict>On</OptionStrict> + </PropertyGroup> + <PropertyGroup> + <OptionInfer>Off</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="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.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Runtime.Serialization" /> + <Reference Include="System.Security" /> + <Reference Include="System.Web.Services" /> + <Reference Include="System.Windows.Forms" /> + <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="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> + <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="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> + </Compile> + <Compile Include="UI\FB_Dialog.vb" /> + <Compile Include="UI\FB_FavDlog.designer.vb"> + <DependentUpon>FB_FavDlog.vb</DependentUpon> + </Compile> + <Compile Include="UI\FB_FavDlog.vb" /> + <Compile Include="UI\frmAuxiliaryConfig.Designer.vb"> + <DependentUpon>frmAuxiliaryConfig.vb</DependentUpon> + </Compile> + <Compile Include="UI\frmAuxiliaryConfig.vb" /> + <Compile Include="UI\FB_Global.vb" /> + <Compile Include="UI\frmCombinedAlternators.Designer.vb"> + <DependentUpon>frmCombinedAlternators.vb</DependentUpon> + </Compile> + <Compile Include="UI\frmCombinedAlternators.vb" /> + <Compile Include="UI\frmHVACTool.Designer.vb"> + <DependentUpon>frmHVACTool.vb</DependentUpon> + </Compile> + <Compile Include="UI\frmHVACTool.vb" /> + <Compile Include="UI\VECTO_Types.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> + <EmbeddedResource Include="UI\FB_Dialog.resx"> + <DependentUpon>FB_Dialog.vb</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="UI\FB_FavDlog.resx"> + <DependentUpon>FB_FavDlog.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="UI\frmAuxiliaryConfig.resx"> + <DependentUpon>frmAuxiliaryConfig.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="UI\frmCombinedAlternators.resx"> + <DependentUpon>frmCombinedAlternators.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="UI\frmHVACTool.resx"> + <DependentUpon>frmHVACTool.vb</DependentUpon> + </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"> + <SubType>Designer</SubType> + </None> + </ItemGroup> + <ItemGroup> + <Folder Include="3rdPartyLibraries\" /> + </ItemGroup> + <ItemGroup> + <None Include="Images\application-export-icon-small.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\Blank.bmp" /> + <None Include="Images\Delete1.png" /> + <None Include="Resources\Info.bmp" /> + <None Include="Resources\Image1.png" /> + <Resource Include="Images\Delete.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </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> + </ItemGroup> + <ItemGroup> + <None Include="Resources\Open-icon.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\new_dir.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\desktop.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\favorites.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\file-history.png" /> + </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/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb index 49bcc5ba19f22270b8e6688939cbd7f53a2da4b0..b9873eb582ab583bcf2b96a13ab3e096423c853a 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb @@ -71,7 +71,7 @@ Namespace UnitTests psUserInputsConfig.Doors = ConsumerTechnology.Pneumatically '"Pneumatic" psUserInputsConfig.AdBlueDosing = ConsumerTechnology.Pneumatically ' "Pneumatic" - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -92,7 +92,7 @@ Namespace UnitTests initialise() - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -116,7 +116,7 @@ Namespace UnitTests initialise() - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap =CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -143,7 +143,7 @@ Namespace UnitTests _defaultInputConfig.CompressorGearEfficiency = 0.8 - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -165,7 +165,7 @@ Namespace UnitTests initialise() - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -194,7 +194,7 @@ Namespace UnitTests _defaultInputConfig.SmartRegeneration = False - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -221,7 +221,7 @@ Namespace UnitTests '_defaultInputConfig.RetarderBrake = False - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.None) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.None) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -249,7 +249,7 @@ Namespace UnitTests _defaultInputConfig.KneelingHeight = 100.SI(Unit.si.Milli.Meter).Cast (Of Meter) - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -274,7 +274,7 @@ Namespace UnitTests _defaultInputConfig.AirSuspensionControl = ConsumerTechnology.Mechanically - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -301,7 +301,7 @@ Namespace UnitTests _defaultInputConfig.AdBlueDosing = ConsumerTechnology.Pneumatically - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) @@ -328,7 +328,7 @@ Namespace UnitTests _defaultInputConfig.Doors = ConsumerTechnology.Electrically - Dim psAuxConfig = New DeclarationDataAdapterPrimaryBus().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0) Dim auxConfig As IAuxiliaryConfig = GetAuxConfig(psAuxConfig) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb index 86600d0caf4494cc52c99fe55850a774fabcd930..f1536d6e8e19ed3f60619f840f597a41e4bd9643 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb @@ -90,7 +90,7 @@ Namespace UnitTests Dim auxInput as IBusAuxiliariesDeclarationData = nothing - Dim dao = New DeclarationDataAdapterPrimaryBus() + Dim dao = New DeclarationDataAdapterCompletedBusGeneric() Dim target As ISSMInputs = dao.CreateSSMModelParameters(auxInput, mission, FuelData.Diesel, LoadingType.ReferenceLoad) If section = "BusParameterisation" Then @@ -597,7 +597,7 @@ Namespace UnitTests Dim auxInput as IBusAuxiliariesDeclarationData = nothing - Dim dao = New DeclarationDataAdapterPrimaryBus() + Dim dao = New DeclarationDataAdapterCompletedBusGeneric() Dim target As SSMTOOL = New SSMTOOL(dao.CreateSSMModelParameters(auxInput, mission, FuelData.Diesel, LoadingType.ReferenceLoad)) diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index 3a50dc4d4416a1e003fff4320c45df646bca97d4..88c2164e024a4e3b74ffa52636d02f7e283dcd87 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -165,7 +165,7 @@ namespace TUGraz.VectoCommon.InputData RegistrationClass RegisteredClass { get; } - int NuberOfPassengersUpperDeck { get; } + int NumberOfPassengersUpperDeck { get; } int NumberOfPassengersLowerDeck { get; } diff --git a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs index 3c2d563b2998275bc142602361bced06e7bb2f56..32a2f4c6a2ee73da9631ea877b5c4ff5f4f4cb27 100644 --- a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs +++ b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs @@ -38,9 +38,10 @@ namespace TUGraz.VectoCommon.Models [SuppressMessage("ReSharper", "InconsistentNaming")] public enum AxleConfiguration { + AxleConfig_Undefined, AxleConfig_4x2, - AxleConfig_4x2F, - AxleConfig_4x4, + AxleConfig_4x2F, + AxleConfig_4x4, AxleConfig_6x2, AxleConfig_6x4, AxleConfig_6x6, @@ -48,7 +49,6 @@ namespace TUGraz.VectoCommon.Models AxleConfig_8x4, AxleConfig_8x6, AxleConfig_8x8, - AxleConfig_Undefined, } public enum AxleType diff --git a/VectoCommon/VectoCommon/Models/VehicleCode.cs b/VectoCommon/VectoCommon/Models/VehicleCode.cs index 65edf4954391e75c6cd73eacc12b44f640f399e9..c161337d2e1ded462453c947b0c360d5ffc8c548 100644 --- a/VectoCommon/VectoCommon/Models/VehicleCode.cs +++ b/VectoCommon/VectoCommon/Models/VehicleCode.cs @@ -1,4 +1,6 @@ -namespace TUGraz.VectoCommon.Models { +using TUGraz.VectoCommon.BusAuxiliaries; + +namespace TUGraz.VectoCommon.Models { public enum VehicleCode { NOT_APPLICABLE, @@ -57,7 +59,7 @@ return self.ToString(); } - public static bool IsDoubleDeckBus(this VehicleCode self) + public static bool IsDoubleDeckerBus(this VehicleCode self) { switch (self) { case VehicleCode.CF: @@ -77,6 +79,19 @@ } } + public static FloorType GetFloorType(this VehicleCode vehicleCode) + { + switch (vehicleCode) { + case VehicleCode.CA: + case VehicleCode.CB: + case VehicleCode.CC: + case VehicleCode.CD: + return FloorType.HighFloor; + default: + return FloorType.LowFloor; + } + } + public static bool IsOpenDeckBus(this VehicleCode self) { switch (self) { diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs index 0c51525c307955e39b7c988f16b30f3d50139ebc..cd69910b56783ba0374e60b0ce2420df01260692 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs @@ -419,7 +419,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } public RegistrationClass RegisteredClass { get { return RegistrationClass.unknown; } } - public int NuberOfPassengersUpperDeck { get { return 0; } } + public int NumberOfPassengersUpperDeck { get { return 0; } } public int NumberOfPassengersLowerDeck { get { return 0; } } public VehicleCode VehicleCode { get { return VehicleCode.NOT_APPLICABLE; } } public FloorType FloorType { get { return VehicleData.FloorType; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index bbc71331921ec93185065d0d2f18461cb5a000dd..6bfe5d446b3e1ec79ab58754c2754bce5aefa7a5 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -593,7 +593,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return RegistrationClass.unknown; } } - public virtual int NuberOfPassengersUpperDeck + public virtual int NumberOfPassengersUpperDeck { get { return 0; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs index 940884541bf7dc1b72d2a486ee160473015bbe54..e116e75cd1941cc48a4ff1f7792d735d4b551121 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs @@ -278,7 +278,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider get { return RegistrationClass.unknown; } } - public virtual int NuberOfPassengersUpperDeck + public virtual int NumberOfPassengersUpperDeck { get { return 0; } } @@ -821,7 +821,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider } } - public override int NuberOfPassengersUpperDeck + public override int NumberOfPassengersUpperDeck { get { var node = GetNode(XMLNames.Bus_UpperDeck); @@ -1015,7 +1015,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider public string Identifier { get; } public bool ExemptedVehicle { get; } public LegislativeClass LegislativeClass { get; } - public int NuberOfPassengersUpperDeck { get; } + public int NumberOfPassengersUpperDeck { get; } public int NumberOfPassengersLowerDeck { get; } public Kilogram CurbMassChassis { get; } public bool VocationalVehicle { get; } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs index b01449cf18aae376b67f08996169ad6524e5b27a..1e3a40890f48eef8eb7051835b71d5d4868e31b5 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs @@ -165,7 +165,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider } public virtual RegistrationClass RegisteredClass { get { return RegistrationClass.unknown;} } - public virtual int NuberOfPassengersUpperDeck { get { return 0; } } + public virtual int NumberOfPassengersUpperDeck { get { return 0; } } public virtual int NumberOfPassengersLowerDeck { get { return 0; } } public virtual VehicleCode VehicleCode { get { return VehicleCode.NOT_APPLICABLE; } } public virtual FloorType FloorType { get { return FloorType.Unknown; } } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterCompletedBusGeneric.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterCompletedBusGeneric.cs new file mode 100644 index 0000000000000000000000000000000000000000..80509bfda167dd40108c0ef30653051651bc6fe1 --- /dev/null +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterCompletedBusGeneric.cs @@ -0,0 +1,599 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.BusAuxiliaries; +using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics; +using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC; +using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; +using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter +{ + public class DeclarationDataAdapterCompletedBusGeneric : DeclarationDataAdapterPrimaryBus + { + + //public VehicleData CreateVehicleData(IVehicleDeclarationInputData pifVehicle, Mission mission, + // KeyValuePair<LoadingType, Kilogram> loading, Meter dynamicTyreRadius) + //{ + + // var vehicleData = new VehicleData + // { + // VIN = pifVehicle.VIN, + // ManufacturerAddress = pifVehicle.ManufacturerAddress, + // LegislativeClass = pifVehicle.LegislativeClass, + // AxleData = GetAxles(pifVehicle.Components.AxleWheels.AxlesDeclaration, mission.AxleWeightDistribution), + // DynamicTyreRadius = dynamicTyreRadius, + // AxleConfiguration = pifVehicle.AxleConfiguration, + // CurbMass = mission.CurbMass, + // BodyAndTrailerMass = 0.SI<Kilogram>(), + // Loading = mission.RefLoad, + // AirDensity = DeclarationData.AirDensity, + // Manufacturer = pifVehicle.Manufacturer, + // ModelName = pifVehicle.Model, + // DigestValueInput = pifVehicle.DigestValue?.DigestValue ?? "", + // SavedInDeclarationMode = pifVehicle.SavedInDeclarationMode, + // }; + + // var adas = new VehicleData.ADASData + // { + // EngineStopStart = pifVehicle.ADAS.EngineStopStart, + // EcoRoll = pifVehicle.ADAS.EcoRoll, + // PredictiveCruiseControl = pifVehicle.ADAS.PredictiveCruiseControl + // }; + + // vehicleData.ADAS = adas; + + // return vehicleData; + //} + + //private List<Axle> GetAxles(IList<IAxleDeclarationInputData> axleWheels, double[] axlesDistribution) + //{ + // var axles = new List<Axle>(); + // for (int i = 0; i < axleWheels.Count; i++) + // { + // var axle = new Axle + // { + // WheelsDimension = axleWheels[i].Tyre.Dimension, + // Inertia = DeclarationData.Wheels + // .Lookup(axleWheels[i].Tyre.Dimension.RemoveWhitespace()).Inertia, + // TyreTestLoad = axleWheels[i].Tyre.TyreTestLoad, + // RollResistanceCoefficient = axleWheels[i].Tyre.RollResistanceCoefficient, + // AxleWeightShare = axlesDistribution[i], + // TwinTyres = axleWheels[i].TwinTyres, + // AxleType = axleWheels[i].AxleType + // }; + // axles.Add(axle); + // } + + // return axles; + //} + + public ElectricsUserInputsConfig CreateElectricalUserInputsConfig(IVehicleDeclarationInputData primaryVehicle, + IAlternatorMap alternatorMap, Mission mission) + { + var primaryBusAuxiliaries = primaryVehicle.Components.BusAuxiliaries; + + var actions = DeclarationData.BusAuxiliaries.ActuationsMap.Lookup(mission.MissionType); + var currentDemand = CalculateAverageCurrent(mission, primaryVehicle, actions); + + var electricsUI = new ElectricsUserInputsConfig { + SmartElectrical = primaryBusAuxiliaries.ElectricSupply.SmartElectrics, + MaxAlternatorPower = primaryBusAuxiliaries.ElectricSupply.MaxAlternatorPower, + ElectricStorageCapacity = primaryBusAuxiliaries.ElectricSupply.ElectricStorageCapacity, + AlternatorMap = alternatorMap, + AlternatorGearEfficiency = Constants.BusAuxiliaries.ElectricSystem.AlternatorGearEfficiency, + AverageCurrentDemandInclBaseLoad = currentDemand.Item1, + AverageCurrentDemandWithoutBaseLoad = currentDemand.Item2, + DoorActuationTimeSecond = Constants.BusAuxiliaries.ElectricalConsumers.DoorActuationTimeSecond + }; + + return electricsUI; + } + + public PneumaticUserInputsConfig CreatePneumaticUserInputsConfig(IBusAuxiliariesDeclarationData primaryBusAuxiliaries, + ICompressorMap compressorMap) + { + var pneumaticUI = new PneumaticUserInputsConfig { + CompressorMap = compressorMap, + CompressorGearEfficiency = Constants.BusAuxiliaries.PneumaticUserConfig.CompressorGearEfficiency, + CompressorGearRatio = primaryBusAuxiliaries.PneumaticSupply.Ratio, + SmartAirCompression = primaryBusAuxiliaries.PneumaticSupply.SmartAirCompression, + SmartRegeneration = primaryBusAuxiliaries.PneumaticSupply.SmartRegeneration, + KneelingHeight =Constants.BusAuxiliaries.PneumaticUserConfig.DefaultKneelingHeight, + AirSuspensionControl = primaryBusAuxiliaries.PneumaticConsumers.AirsuspensionControl, + AdBlueDosing = primaryBusAuxiliaries.PneumaticConsumers.AdBlueDosing, + Doors = ConsumerTechnology.Pneumatically + }; + + return pneumaticUI; + } + + public void SetSSMBusParameters(SSMInputs ssmInputs, Mission mission) + { + var busParams = mission.BusParameter; + + var hvacBusLength = busParams.HVACConfiguration == BusHVACSystemConfiguration.Configuration2 + ? 2 * Constants.BusParameters.DriverCompartmentLength + : busParams.VehicleLength; + + var hvacBusHeight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(busParams.FloorType, + busParams.DoubleDecker, busParams.BodyHeight); + + ssmInputs.NumberOfPassengers = mission.RefLoad.Value(); + ssmInputs.BusFloorType = busParams.FloorType; + + ssmInputs.BusWindowSurface = DeclarationData.BusAuxiliaries.WindowHeight(busParams.DoubleDecker) * hvacBusLength + + DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(busParams.DoubleDecker); + ssmInputs.BusSurfaceArea = 2 * (hvacBusLength * busParams.VehicleWidth + hvacBusLength * + busParams.BodyHeight + busParams.VehicleWidth * busParams.BodyHeight); + ssmInputs.BusVolume = hvacBusLength * busParams.VehicleWidth * hvacBusHeight; + } + + internal CombustionEngineData CreateEngineData(IVehicleDeclarationInputData primaryVehicle) + { + return GenericBusEngineData.Instance.CreateGenericBusEngineData(primaryVehicle); + } + + public TechnologyBenefits CreateTechnologyBenefits(Mission mission, IVehicleDeclarationInputData primaryVehicle) + { + var onVehicle = new List<SSMTechnology>(); + var primaryBusAux = primaryVehicle.Components.BusAuxiliaries; + + foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) + { + if ("Double-glazing".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (mission?.BusParameter?.HVACDoubleGlasing ?? false)){ + onVehicle.Add(item); + } + if ("Heat pump systems".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (mission?.BusParameter?.HVACHeatpump ?? false)){ + onVehicle.Add(item); + } + if ("Adjustable auxiliary heater".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (mission?.BusParameter?.HVACAdjustableAuxHeater ?? false)){ + onVehicle.Add(item); + } + if ("Separate air distribution ducts".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (mission?.BusParameter?.HVACSeparateAirDistributionDucts ?? false)){ + onVehicle.Add(item); + } + if ("Adjustable coolant thermostat".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (primaryBusAux?.HVACAux.AdjustableCoolantThermostat ?? false)){ + onVehicle.Add(item); + } + if ("Engine waste gas heat exchanger".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (primaryBusAux?.HVACAux.EngineWasteGasHeatExchanger ?? false)){ + onVehicle.Add(item); + } + } + + return SelectBenefitForFloorType(mission.BusParameter.FloorType, onVehicle); + } + + public void SetSSMInputs(SSMInputs ssmInputs, Mission mission) + { + var coolingPower = CalculateMaxCoolingPower(mission); + var busParams = mission.BusParameter; + + ssmInputs.NumberOfPassengers = mission.RefLoad.Value(); + ssmInputs.HVACMaxCoolingPower = coolingPower.Item1 + coolingPower.Item2; + ssmInputs.COP = DeclarationData.BusAuxiliaries.CalculateCOP( + coolingPower.Item1, ACCompressorType.None, coolingPower.Item2, busParams.HVACCompressorType, + busParams.FloorType); + + ssmInputs.VentilationOnDuringHeating = true; + ssmInputs.VentilationWhenBothHeatingAndACInactive = true; + ssmInputs.VentilationDuringAC = true; + + ssmInputs.FuelFiredHeaterPower = busParams.HVACAuxHeaterPower; + ssmInputs.FuelEnergyToHeatToCoolant = Constants.BusAuxiliaries.Heater.FuelEnergyToHeatToCoolant; + ssmInputs.CoolantHeatTransferredToAirCabinHeater = + Constants.BusAuxiliaries.Heater.CoolantHeatTransferredToAirCabinHeater; + } + + + //public override AirdragData CreateAirdragData(IAirdragDeclarationInputData airdragInputData, Mission mission, + // Segment segment) + //{ + // var aerodynamicDragArea = mission.DefaultCDxA; + + // var airdragData = new AirdragData + // { + // CrossWindCorrectionMode = CrossWindCorrectionMode.DeclarationModeCorrection, + // CrossWindCorrectionCurve = new CrosswindCorrectionCdxALookup( + // aerodynamicDragArea, + // GetDeclarationAirResistanceCurve(mission.CrossWindCorrectionParameters, aerodynamicDragArea, mission.BusParameter.BodyHeight), + // CrossWindCorrectionMode.DeclarationModeCorrection), + // DeclaredAirdragArea = aerodynamicDragArea, + // Manufacturer = Constants.NOT_AVailABLE, + // ModelName = Constants.NOT_AVailABLE, + // CertificationMethod = CertificationMethod.StandardValues, + // CertificationNumber = Constants.NOT_AVailABLE, + // DigestValueInput = "" + // }; + + // return airdragData; + //} + + //public override IList<VectoRunData.AuxData> CreateAuxiliaryData( + // IAuxiliariesDeclarationInputData auxInputData, IBusAuxiliariesDeclarationData busAuxData, MissionType mission, + // VehicleClass hdvClass, Meter vehicleLength) + //{ + // if (auxInputData != null) + // { + // throw new VectoException("Only BusAuxiliaries can be provided as input!"); + // } + + // var retVal = new List<VectoRunData.AuxData>(); + + // retVal.Add( + // new VectoRunData.AuxData() + // { + // DemandType = AuxiliaryDemandType.Constant, + // Technology = new List<string>() { busAuxData.FanTechnology }, + // ID = Constants.Auxiliaries.IDs.Fan, + // PowerDemand = DeclarationData.Fan.Lookup(hdvClass, mission, busAuxData.FanTechnology).PowerDemand + // }); + // retVal.Add( + // new VectoRunData.AuxData() + // { + // DemandType = AuxiliaryDemandType.Constant, + // Technology = busAuxData.SteeringPumpTechnology, + // ID = Constants.Auxiliaries.IDs.SteeringPump, + // PowerDemand = DeclarationData.SteeringPumpBus.LookupMechanicalPowerDemand( + // mission, busAuxData.SteeringPumpTechnology, vehicleLength) + // }); + // return retVal; + //} + + + //#endregion + + + //#region Overrides + + //public virtual IAuxiliaryConfig CreateBusAuxiliariesData( + // Mission mission, IVehicleDeclarationInputData vehicleData, VectoRunData runData) + //{ + // var actuations = DeclarationData.BusAuxiliaries.ActuationsMap.Lookup(runData.Mission.MissionType); + + // var retVal = new AuxiliaryConfig + // { + // InputData = vehicleData.Components.BusAuxiliaries, + // ElectricalUserInputsConfig = GetElectricalUserConfig(mission, vehicleData, actuations), + // PneumaticUserInputsConfig = GetPneumaticUserConfig(vehicleData, mission), + // PneumaticAuxillariesConfig = CreatePneumaticAuxConfig(runData.Retarder.Type), + // Actuations = actuations, + // SSMInputs = CreateSSMModelParameters( + // vehicleData.Components.BusAuxiliaries, mission, FuelData.Diesel, runData.Loading), + // VehicleData = runData.VehicleData, + // }; + + // return retVal; + //} + + //protected virtual ElectricsUserInputsConfig GetElectricalUserConfig( + // Mission mission, IVehicleDeclarationInputData vehicleData, IActuations actuations) + //{ + // var currentDemand = CalculateAverageCurrent(mission, vehicleData, actuations); + // var busAux = vehicleData.Components.BusAuxiliaries; + + // return new ElectricsUserInputsConfig() + // { + // SmartElectrical = busAux.ElectricSupply.SmartElectrics, + // AverageCurrentDemandInclBaseLoad = currentDemand.Item1, + // AverageCurrentDemandWithoutBaseLoad = currentDemand.Item2, + // AlternatorMap = new SimpleAlternator(CalculateAlternatorEfficiency(busAux.ElectricSupply.Alternators)), + // PowerNetVoltage = Constants.BusAuxiliaries.ElectricSystem.PowernetVoltage, + // StoredEnergyEfficiency = Constants.BusAuxiliaries.ElectricSystem.StoredEnergyEfficiency, + // ResultCardIdle = new DummyResultCard(), + // ResultCardOverrun = new DummyResultCard(), + // ResultCardTraction = new DummyResultCard(), + // AlternatorGearEfficiency = Constants.BusAuxiliaries.ElectricSystem.AlternatorGearEfficiency, + // MaxAlternatorPower = busAux.ElectricSupply.MaxAlternatorPower, + // ElectricStorageCapacity = busAux.ElectricSupply.ElectricStorageCapacity ?? 0.SI<WattSecond>() + // }; + //} + + //protected internal virtual double CalculateAlternatorEfficiency(IList<IAlternatorDeclarationInputData> alternators) + //{ + // var sum = 0.0; + // foreach (var entry in alternators) + // { + // sum += DeclarationData.BusAuxiliaries.AlternatorTechnologies.Lookup(entry.Technology); + // } + + // return sum / alternators.Count; + //} + + //protected virtual Tuple<Ampere, Ampere> CalculateAverageCurrent( + // Mission mission, IVehicleDeclarationInputData vehicleData, IActuations actuations) + //{ + // var avgInclBase = 0.SI<Ampere>(); + // var avgWithoutBase = 0.SI<Ampere>(); + // var doorDutyCycleFraction = + // (actuations.ParkBrakeAndDoors * Constants.BusAuxiliaries.ElectricalConsumers.DoorActuationTimeSecond) / + // actuations.CycleTime; + // var busAux = vehicleData.Components.BusAuxiliaries; + // var electricDoors = false; + // foreach (var consumer in DeclarationData.BusAuxiliaries.DefaultElectricConsumerList.Items) + // { + // var nbr = GetNumberOfElectricalConsumersInVehicle(consumer.NumberInActualVehicle, mission); + // var dutyCycle = electricDoors && consumer.ConsumerName.Equals( + // Constants.BusAuxiliaries.ElectricalConsumers.DoorsPerVehicleConsumer, + // StringComparison.CurrentCultureIgnoreCase) + // ? doorDutyCycleFraction + // : consumer.PhaseIdleTractionOn; + + // var current = consumer.NominalCurrent(mission.MissionType) * dutyCycle * nbr; + // if (consumer.Bonus && !VehicleHasElectricalConsumer(consumer.ConsumerName, busAux)) + // { + // current = 0.SI<Ampere>(); + // } + + // avgInclBase += current; + // if (!consumer.BaseVehicle) + // { + // avgWithoutBase += current; + // } + // } + + // return Tuple.Create(avgInclBase, avgWithoutBase); + //} + + //protected virtual bool VehicleHasElectricalConsumer(string consumerName, IBusAuxiliariesDeclarationData busAux) + //{ + // switch (consumerName) + // { + // case "Day running lights LED bonus": + // case "Position lights LED bonus": + // case "Brake lights LED bonus": return false; + // case "Interior lights LED bonus": + // case "Headlights LED bonus": return true; + // default: return false; + // } + //} + + //protected virtual double GetNumberOfElectricalConsumersInVehicle(string nbr, Mission mission) + //{ + // if ("f_IntLight(L_CoC)".Equals(nbr, StringComparison.InvariantCultureIgnoreCase)) + // { + // var busParams = mission.BusParameter; + // return DeclarationData.BusAuxiliaries.CalculateLengthInteriorLights( + // busParams.VehicleLength, busParams.DoubleDecker, busParams.FloorType, busParams.NumberPassengersLowerDeck) + // .Value(); + // } + + // return nbr.ToDouble(); + //} + + //protected virtual PneumaticUserInputsConfig GetPneumaticUserConfig(IVehicleDeclarationInputData vehicleData, Mission mission) + //{ + // var busAux = vehicleData.Components.BusAuxiliaries; + + // //throw new NotImplementedException(); + // return new PneumaticUserInputsConfig() + // { + // KneelingHeight = mission.BusParameter.FloorType == FloorType.LowFloor + // ? Constants.BusAuxiliaries.PneumaticUserConfig.DefaultKneelingHeight + // : 0.SI<Meter>(), + // CompressorGearEfficiency = Constants.BusAuxiliaries.PneumaticUserConfig.CompressorGearEfficiency, + // CompressorGearRatio = busAux.PneumaticSupply.Ratio, + // CompressorMap = GetCompressorMap(busAux.PneumaticSupply.CompressorSize, busAux.PneumaticSupply.Clutch), + // SmartAirCompression = busAux.PneumaticSupply.SmartAirCompression, + // SmartRegeneration = busAux.PneumaticSupply.SmartRegeneration, + // AdBlueDosing = busAux.PneumaticConsumers.AdBlueDosing, + // Doors = ConsumerTechnology.Pneumatically, + // AirSuspensionControl = busAux.PneumaticConsumers.AirsuspensionControl, + // }; + //} + + //protected internal virtual ICompressorMap GetCompressorMap(string compressorSize, string clutchType) + //{ + // var resource = ""; + // switch (compressorSize) + // { + // case "Small": + // resource = "DEFAULT_1-Cylinder_1-Stage_393ccm.acmp"; + // break; + // case "Medium Supply 1-stage": + // resource = "DEFAULT_1-Cylinder_1-Stage_393ccm.acmp"; + // break; + // case "Medium Supply 2-stage": + // resource = "DEFAULT_2-Cylinder_1-Stage_650ccm.acmp"; + // break; + // case "Large Supply 1-stage": + // resource = "DEFAULT_2-Cylinder_2-Stage_398ccm.acmp"; + // break; + // case "Large Supply 2-stage": + // resource = "DEFAULT_3-Cylinder_2-Stage_598ccm.acmp"; + // break; + // default: throw new ArgumentException(string.Format("unkown compressor size {0}", compressorSize)); + // } + + // var dragCurveFactorClutch = 1.0; + // switch (clutchType) + // { + // case "visco": + // dragCurveFactorClutch = Constants.BusAuxiliaries.PneumaticUserConfig.ViscoClutchDragCurveFactor; + // break; + // case "mechically": + // dragCurveFactorClutch = Constants.BusAuxiliaries.PneumaticUserConfig.MechanicClutchDragCurveFactor; + // break; + // } + + // return CompressorMapReader.ReadStream( + // RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".VAUXBus." + resource), dragCurveFactorClutch); + //} + + //public virtual ISSMInputs CreateSSMModelParameters(IBusAuxiliariesDeclarationData busAuxInputData, Mission mission, IFuelProperties heatingFuel, LoadingType loadingType) + //{ + // var busParams = mission.BusParameter; + + // var hvacBusLength = busParams.HVACConfiguration == BusHVACSystemConfiguration.Configuration2 + // ? 2 * Constants.BusParameters.DriverCompartmentLength + // : busParams.VehicleLength; + // var hvacBusheight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(mission.BusParameter.FloorType, mission.BusParameter.DoubleDecker, busParams.BodyHeight); + // var coolingPower = CalculateMaxCoolingPower(mission); + // var retVal = new SSMInputs(null, heatingFuel) + // { + // BusFloorType = busParams.FloorType, + // Technologies = GetSSMTechnologyBenefits(busAuxInputData, mission.BusParameter.FloorType), + // DefaultConditions = new EnvironmentalConditionMapEntry( + // Constants.BusAuxiliaries.SteadyStateModel.DefaultTemperature, + // Constants.BusAuxiliaries.SteadyStateModel.DefaultSolar, + // 1.0), + // EnvironmentalConditionsMap = DeclarationData.BusAuxiliaries.DefaultEnvironmentalConditions, + // HeatingBoundaryTemperature = Constants.BusAuxiliaries.SteadyStateModel.HeatingBoundaryTemperature, + // CoolingBoundaryTemperature = Constants.BusAuxiliaries.SteadyStateModel.CoolingBoundaryTemperature, + + // SpecificVentilationPower = Constants.BusAuxiliaries.SteadyStateModel.SpecificVentilationPower, + + // AuxHeaterEfficiency = Constants.BusAuxiliaries.SteadyStateModel.AuxHeaterEfficiency, + // FuelFiredHeaterPower = busParams.HVACAuxHeaterPower, + // FuelEnergyToHeatToCoolant = Constants.BusAuxiliaries.Heater.FuelEnergyToHeatToCoolant, + // CoolantHeatTransferredToAirCabinHeater = Constants.BusAuxiliaries.Heater.CoolantHeatTransferredToAirCabinHeater, + // GFactor = Constants.BusAuxiliaries.SteadyStateModel.GFactor, + + // VentilationOnDuringHeating = true, + // VentilationWhenBothHeatingAndACInactive = true, + // VentilationDuringAC = true, + + // MaxPossibleBenefitFromTechnologyList = + // Constants.BusAuxiliaries.SteadyStateModel.MaxPossibleBenefitFromTechnologyList, + + // BusWindowSurface = DeclarationData.BusAuxiliaries.WindowHeight(busParams.DoubleDecker) * hvacBusLength + + // DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(busParams.DoubleDecker), + // BusSurfaceArea = 2 * (hvacBusLength * busParams.VehicleWidth + hvacBusLength * busParams.BodyHeight + + // busParams.VehicleWidth * busParams.BodyHeight), + // BusVolume = hvacBusLength * busParams.VehicleWidth * hvacBusheight, + + // UValue = DeclarationData.BusAuxiliaries.UValue(busParams.FloorType), + // NumberOfPassengers = + // DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(hvacBusLength, busParams.VehicleWidth) * + // busParams.PassengerDensity * (loadingType == LoadingType.LowLoading ? mission.MissionType.GetLowLoadFactorBus() : 1.0) + 1, // add driver for 'heat input' + // VentilationRate = DeclarationData.BusAuxiliaries.VentilationRate(busParams.HVACConfiguration, false), + // VentilationRateHeating = DeclarationData.BusAuxiliaries.VentilationRate(busParams.HVACConfiguration, true), + + // HVACMaxCoolingPower = coolingPower.Item1 + coolingPower.Item2, + // HVACCompressorType = busParams.HVACCompressorType, // use passenger compartment + // COP = DeclarationData.BusAuxiliaries.CalculateCOP( + // coolingPower.Item1, ACCompressorType.None, coolingPower.Item2, busParams.HVACCompressorType, + // busParams.FloorType), + // }; + + // //SetHVACParameters(retVal, vehicleData, mission); + + // return retVal; + //} + + //protected virtual TechnologyBenefits GetSSMTechnologyBenefits(IBusAuxiliariesDeclarationData inputData, FloorType floorType) + //{ + // var onVehicle = new List<SSMTechnology>(); + // foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) + // { + // if ("Adjustable coolant thermostat".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + // (inputData?.HVACAux.AdjustableCoolantThermostat ?? false)) + // { + // onVehicle.Add(item); + // } + + // if ("Engine waste gas heat exchanger".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + // (inputData?.HVACAux.EngineWasteGasHeatExchanger ?? false)) + // { + // onVehicle.Add(item); + // } + // } + + // return SelectBenefitForFloorType(floorType, onVehicle); + //} + + //protected internal virtual TechnologyBenefits SelectBenefitForFloorType(FloorType floorType, List<SSMTechnology> onVehicle) + //{ + // var retVal = new TechnologyBenefits(); + + // switch (floorType) + // { + // case FloorType.LowFloor: + // retVal.CValueVariation = onVehicle.Sum(x => x.LowFloorC); + // retVal.HValueVariation = onVehicle.Sum(x => x.LowFloorH); + // retVal.VCValueVariation = onVehicle.Sum(x => x.ActiveVC ? x.LowFloorV : 0); + // retVal.VHValueVariation = onVehicle.Sum(x => x.ActiveVH ? x.LowFloorV : 0); + // retVal.VVValueVariation = onVehicle.Sum(x => x.ActiveVV ? x.LowFloorV : 0); + // break; + // case FloorType.HighFloor: + // retVal.CValueVariation = onVehicle.Sum(x => x.RaisedFloorC); + // retVal.HValueVariation = onVehicle.Sum(x => x.RaisedFloorH); + // retVal.VCValueVariation = onVehicle.Sum(x => x.ActiveVC ? x.RaisedFloorV : 0); + // retVal.VHValueVariation = onVehicle.Sum(x => x.ActiveVH ? x.RaisedFloorV : 0); + // retVal.VVValueVariation = onVehicle.Sum(x => x.ActiveVV ? x.RaisedFloorV : 0); + // break; + // case FloorType.SemiLowFloor: + // retVal.CValueVariation = onVehicle.Sum(x => x.SemiLowFloorC); + // retVal.HValueVariation = onVehicle.Sum(x => x.SemiLowFloorH); + // retVal.VCValueVariation = onVehicle.Sum(x => x.ActiveVC ? x.SemiLowFloorV : 0); + // retVal.VHValueVariation = onVehicle.Sum(x => x.ActiveVH ? x.SemiLowFloorV : 0); + // retVal.VVValueVariation = onVehicle.Sum(x => x.ActiveVV ? x.SemiLowFloorV : 0); + // break; + // } + + // return retVal; + //} + + + //protected virtual Tuple<Watt, Watt> CalculateMaxCoolingPower(Mission mission) + //{ + // var busParams = mission.BusParameter; + + // var length = DeclarationData.BusAuxiliaries.CalculateInternalLength( + // busParams.VehicleLength, busParams.DoubleDecker, busParams.FloorType, + // busParams.NumberPassengersLowerDeck); + // var height = DeclarationData.BusAuxiliaries.CalculateInternalHeight(busParams.FloorType, busParams.DoubleDecker, busParams.BodyHeight); + // var volume = length * height * busParams.VehicleWidth; + + // var driver = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.DriverMaxCoolingPower( + // busParams.HVACConfiguration, mission.MissionType); + // var passenger = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.PassengerMaxCoolingPower( + // busParams.HVACConfiguration, mission.MissionType, volume); + + // return Tuple.Create(driver, passenger); + //} + + //protected internal virtual IPneumaticsConsumersDemand CreatePneumaticAuxConfig(RetarderType retarderType) + //{ + // return new PneumaticsConsumersDemand() + // { + // AdBlueInjection = Constants.BusAuxiliaries.PneumaticConsumersDemands.AdBlueInjection, + // AirControlledSuspension = Constants.BusAuxiliaries.PneumaticConsumersDemands.AirControlledSuspension, + // Braking = retarderType == RetarderType.None + // ? Constants.BusAuxiliaries.PneumaticConsumersDemands.BrakingNoRetarder + // : Constants.BusAuxiliaries.PneumaticConsumersDemands.BrakingWithRetarder, + // BreakingWithKneeling = Constants.BusAuxiliaries.PneumaticConsumersDemands.BreakingAndKneeling, + // DeadVolBlowOuts = Constants.BusAuxiliaries.PneumaticConsumersDemands.DeadVolBlowOuts, + // DeadVolume = Constants.BusAuxiliaries.PneumaticConsumersDemands.DeadVolume, + // NonSmartRegenFractionTotalAirDemand = + // Constants.BusAuxiliaries.PneumaticConsumersDemands.NonSmartRegenFractionTotalAirDemand, + // SmartRegenFractionTotalAirDemand = + // Constants.BusAuxiliaries.PneumaticConsumersDemands.SmartRegenFractionTotalAirDemand, + // OverrunUtilisationForCompressionFraction = + // Constants.BusAuxiliaries.PneumaticConsumersDemands.OverrunUtilisationForCompressionFraction, + // DoorOpening = Constants.BusAuxiliaries.PneumaticConsumersDemands.DoorOpening, + // StopBrakeActuation = Constants.BusAuxiliaries.PneumaticConsumersDemands.StopBrakeActuation, + // }; + //} + //#endregion + + } +} diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterCompletedBusSpecific.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterCompletedBusSpecific.cs new file mode 100644 index 0000000000000000000000000000000000000000..bbf1f15a1851c8b2eaeb19a5a12830fc0e15ceb2 --- /dev/null +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterCompletedBusSpecific.cs @@ -0,0 +1,306 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.BusAuxiliaries; +using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics; +using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC; +using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; +using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Data; + +namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter +{ + public class DeclarationDataAdapterCompletedBusSpecific : DeclarationDataAdapterCompletedBusGeneric + { + + public AirdragData CreateAirdragData(IVehicleDeclarationInputData completedVehicle, Mission mission) + { + var airdragData = new AirdragData + { + CrossWindCorrectionMode = CrossWindCorrectionMode.DeclarationModeCorrection + + }; + + var airDrag = completedVehicle.Components.AirdragInputData; + SquareMeter aerodynamicDragArea; + if (!mission.BusParameter.AirDragMeasurementAllowed || + completedVehicle.Components.AirdragInputData?.AirDragArea == null) { + aerodynamicDragArea = mission.DefaultCDxA; + airdragData.Manufacturer =Constants.NOT_AVailABLE; + airdragData.ModelName = Constants.NOT_AVailABLE; + airdragData.CertificationMethod = CertificationMethod.StandardValues; + airdragData.CertificationNumber = Constants.NOT_AVailABLE; + airdragData.DigestValueInput = ""; + } else { + aerodynamicDragArea = completedVehicle.Components.AirdragInputData.AirDragArea; + airdragData.Manufacturer = airDrag.Manufacturer; + airdragData.ModelName = airDrag.Model; + airdragData.CertificationMethod = airDrag.CertificationMethod; + airdragData.CertificationNumber = airDrag.CertificationNumber; + airdragData.DigestValueInput = airDrag.DigestValue?.DigestValue ?? ""; + } + + var vehicleHeight = completedVehicle.Height + mission.BusParameter.DeltaHeight; + + airdragData.CrossWindCorrectionCurve = new CrosswindCorrectionCdxALookup( + aerodynamicDragArea, + DeclarationDataAdapterHeavyLorry.GetDeclarationAirResistanceCurve( + mission.CrossWindCorrectionParameters, + aerodynamicDragArea, + vehicleHeight), + CrossWindCorrectionMode.DeclarationModeCorrection); + + airdragData.DeclaredAirdragArea = aerodynamicDragArea; + + return airdragData; + } + + public VehicleData CreateVehicleData(IVehicleDeclarationInputData primaryVehicle, + IVehicleDeclarationInputData completedVehicle, Mission mission, + KeyValuePair<LoadingType, Kilogram> loading) + { + var passengers = GetNumberOfPassengers( + mission, completedVehicle.Length, completedVehicle.Width, + completedVehicle.NumberOfPassengersLowerDeck + completedVehicle.NumberOfPassengersUpperDeck, loading.Key); + + var vehicleData = base.CreateVehicleData(primaryVehicle, mission, loading); + + vehicleData.VIN = completedVehicle.VIN; + vehicleData.LegislativeClass = completedVehicle.LegislativeClass; + vehicleData.VehicleCategory = VehicleCategory.HeavyBusCompletedVehicle; + vehicleData.Manufacturer = completedVehicle.Manufacturer; + vehicleData.ModelName = completedVehicle.Model; + vehicleData.ManufacturerAddress = completedVehicle.ManufacturerAddress; + vehicleData.CurbMass = completedVehicle.CurbMassChassis; + + vehicleData.Loading = passengers * mission.MissionType.GetAveragePassengerMass(); + vehicleData.GrossVehicleMass = completedVehicle.GrossVehicleMassRating; + vehicleData.DigestValueInput = completedVehicle.DigestValue?.DigestValue ?? ""; + + return vehicleData; + } + + public IAuxiliaryConfig CreateBusAuxiliariesData(Mission mission, IVehicleDeclarationInputData primaryVehicle, IVehicleDeclarationInputData completedVehicle, VectoRunData runData) + { + var actuations = DeclarationData.BusAuxiliaries.ActuationsMap.Lookup(runData.Mission.MissionType); + var primaryBusAuxiliaries = primaryVehicle.Components.BusAuxiliaries; + + return new AuxiliaryConfig { + ElectricalUserInputsConfig = CreateElectricsUserInputsConfig( + primaryBusAuxiliaries, completedVehicle, mission, actuations), + PneumaticUserInputsConfig = CreatePneumaticUserInputsConfig( + primaryBusAuxiliaries, completedVehicle), + + PneumaticAuxillariesConfig = CreatePneumaticAuxConfig(runData.Retarder.Type), + SSMInputs = GetCompletedSSMInput(mission, completedVehicle, primaryBusAuxiliaries, runData.Loading) + }; + } + + protected ElectricsUserInputsConfig CreateElectricsUserInputsConfig(IBusAuxiliariesDeclarationData primaryBusAuxiliaries, + IVehicleDeclarationInputData completedVehicle, Mission mission, IActuations actuations) + { + var currentDemand = CalculateAverageCurrent(mission, completedVehicle, actuations); + + return new ElectricsUserInputsConfig { + SmartElectrical = primaryBusAuxiliaries.ElectricSupply.SmartElectrics, + MaxAlternatorPower = primaryBusAuxiliaries.ElectricSupply.MaxAlternatorPower, + ElectricStorageCapacity = primaryBusAuxiliaries.ElectricSupply.ElectricStorageCapacity, + AlternatorMap = new SimpleAlternator(CalculateAlternatorEfficiency(primaryBusAuxiliaries.ElectricSupply.Alternators.Concat(completedVehicle.Components.BusAuxiliaries.ElectricSupply.Alternators).ToList())), + AlternatorGearEfficiency = Constants.BusAuxiliaries.ElectricSystem.AlternatorGearEfficiency, + AverageCurrentDemandInclBaseLoad = currentDemand.Item1, + AverageCurrentDemandWithoutBaseLoad = currentDemand.Item2, + DoorActuationTimeSecond = Constants.BusAuxiliaries.ElectricalConsumers.DoorActuationTimeSecond, + }; + + } + + protected PneumaticUserInputsConfig CreatePneumaticUserInputsConfig(IBusAuxiliariesDeclarationData primaryBusAuxiliaries, + IVehicleDeclarationInputData completedVehicle) + { + return new PneumaticUserInputsConfig { + CompressorMap = GetCompressorMap(primaryBusAuxiliaries.PneumaticSupply.CompressorSize, primaryBusAuxiliaries.PneumaticSupply.Clutch), + CompressorGearEfficiency = Constants.BusAuxiliaries.PneumaticUserConfig.CompressorGearEfficiency, + CompressorGearRatio = primaryBusAuxiliaries.PneumaticSupply.Ratio, + SmartAirCompression = primaryBusAuxiliaries.PneumaticSupply.SmartAirCompression, + SmartRegeneration = primaryBusAuxiliaries.PneumaticSupply.SmartRegeneration, + KneelingHeight = VectoMath.Max(0.SI<Meter>(), + completedVehicle.EntranceHeight - Constants.BusParameters.EntranceHeight), + AirSuspensionControl = primaryBusAuxiliaries.PneumaticConsumers.AirsuspensionControl, + AdBlueDosing = primaryBusAuxiliaries.PneumaticConsumers.AdBlueDosing, + Doors = completedVehicle.Components.BusAuxiliaries.PneumaticConsumers.DoorDriveTechnology + }; + } + + private SSMInputs GetCompletedSSMInput(Mission mission, IVehicleDeclarationInputData completedVehicle, + IBusAuxiliariesDeclarationData primaryBusAux, LoadingType loadingType) + { + var isDoubleDecker = completedVehicle.VehicleCode.IsDoubleDeckerBus(); + var hvacConfiguration = completedVehicle.Components.BusAuxiliaries.HVACAux.SystemConfiguration; + var hvacBusLength = hvacConfiguration == BusHVACSystemConfiguration.Configuration2 + ? 2 * Constants.BusParameters.DriverCompartmentLength + : completedVehicle.Length; + + var hvacBusHeight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(completedVehicle.VehicleCode.GetFloorType(), + isDoubleDecker, completedVehicle.Height); + var hvacBusWidth = DeclarationData.BusAuxiliaries.CorrectedBusWidth(completedVehicle.Width); + var coolingPower = CalculateMaxCoolingPower(completedVehicle, mission); + + var busAux = completedVehicle.Components.BusAuxiliaries.HVACAux; + var floorType = completedVehicle.VehicleCode.GetFloorType(); + + + var ssmInputs =GetDefaulSSMInputs(FuelData.Diesel); + + ssmInputs.BusFloorType = completedVehicle.VehicleCode.GetFloorType(); + ssmInputs.Technologies = CreateTechnologyBenefits(completedVehicle, primaryBusAux); + ssmInputs.FuelFiredHeaterPower = busAux.AuxHeaterPower; + ssmInputs.BusWindowSurface = DeclarationData.BusAuxiliaries.WindowHeight(isDoubleDecker) * hvacBusLength + + DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(isDoubleDecker); + ssmInputs.BusSurfaceArea = 2 * (hvacBusLength * hvacBusWidth + hvacBusLength * + completedVehicle.Height + hvacBusWidth * completedVehicle.Height); + ssmInputs.BusVolume = hvacBusLength * hvacBusWidth * hvacBusHeight; + + ssmInputs.UValue = DeclarationData.BusAuxiliaries.UValue(completedVehicle.VehicleCode.GetFloorType()); + ssmInputs.NumberOfPassengers = GetNumberOfPassengers( + mission, hvacBusLength, hvacBusWidth, + completedVehicle.NumberOfPassengersLowerDeck + completedVehicle.NumberOfPassengersUpperDeck, loadingType); + ssmInputs.VentilationRate = DeclarationData.BusAuxiliaries.VentilationRate(hvacConfiguration, false); + ssmInputs.VentilationRateHeating = DeclarationData.BusAuxiliaries.VentilationRate(hvacConfiguration, true); + + ssmInputs.HVACMaxCoolingPower = coolingPower.Item1 + coolingPower.Item2; + ssmInputs.COP = DeclarationData.BusAuxiliaries.CalculateCOP( + coolingPower.Item1, busAux.CompressorTypeDriver, coolingPower.Item2, busAux.CompressorTypePassenger, + floorType); + + return ssmInputs; + } + + + public TechnologyBenefits CreateTechnologyBenefits(IVehicleDeclarationInputData completedVehicle, + IBusAuxiliariesDeclarationData primaryBusAux) + { + var onVehicle = new List<SSMTechnology>(); + var completedBuxAux = completedVehicle.Components.BusAuxiliaries; + + foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) + { + if ("Double-glazing".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (completedBuxAux?.HVACAux.DoubleGlasing ?? false)) + { + onVehicle.Add(item); + } + if ("Heat pump systems".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (completedBuxAux?.HVACAux.HeatPump ?? false)) + { + onVehicle.Add(item); + } + if ("Adjustable auxiliary heater".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (completedBuxAux?.HVACAux.AdjustableAuxiliaryHeater ?? false)) + { + onVehicle.Add(item); + } + if ("Separate air distribution ducts".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (completedBuxAux?.HVACAux.SeparateAirDistributionDucts ?? false)) + { + onVehicle.Add(item); + } + if ("Adjustable coolant thermostat".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (primaryBusAux?.HVACAux.AdjustableCoolantThermostat ?? false)) + { + onVehicle.Add(item); + } + if ("Engine waste gas heat exchanger".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && + (primaryBusAux?.HVACAux.EngineWasteGasHeatExchanger ?? false)) + { + onVehicle.Add(item); + } + } + + return SelectBenefitForFloorType(completedVehicle.VehicleCode.GetFloorType(), onVehicle); + } + + + + protected override Tuple<Watt, Watt> CalculateMaxCoolingPower(IVehicleDeclarationInputData completedVehicle, + Mission mission) + { + var isDoubleDecker = completedVehicle.VehicleCode.IsDoubleDeckerBus(); + var floorType = completedVehicle.VehicleCode.GetFloorType(); + var hvacConfiguration = completedVehicle.Components.BusAuxiliaries.HVACAux.SystemConfiguration; + + var length = DeclarationData.BusAuxiliaries.CalculateInternalLength( + completedVehicle.Length ,isDoubleDecker, floorType, + completedVehicle.NumberOfPassengersLowerDeck); + var height = DeclarationData.BusAuxiliaries.CalculateInternalHeight(floorType, isDoubleDecker, completedVehicle.Height); + var volume = length * height * completedVehicle.Width; + + var driver = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.DriverMaxCoolingPower( + hvacConfiguration, mission.MissionType); + var passenger = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.PassengerMaxCoolingPower( + hvacConfiguration, mission.MissionType, volume); + + return Tuple.Create(driver, passenger); + } + + + + + #region Avarage Current Demand Calculation + + + protected override bool VehicleHasElectricalConsumer(string consumerName, IBusAuxiliariesDeclarationData busAux) + { + if (consumerName == "Day running lights LED bonus" && busAux.ElectricConsumers.DayrunninglightsLED) + return true; + if (consumerName == "Position lights LED bonus" && busAux.ElectricConsumers.PositionlightsLED) + return true; + if (consumerName == "Brake lights LED bonus" && busAux.ElectricConsumers.BrakelightsLED) + return true; + if (consumerName == "Interior lights LED bonus" && busAux.ElectricConsumers.InteriorLightsLED) + return true; + if (consumerName == "Headlights LED bonus" && busAux.ElectricConsumers.HeadlightsLED) + return true; + + return false; + } + + protected override double CalculateLengthDependentElectricalConsumers(Mission mission, IVehicleDeclarationInputData vehicleData) + { + var busParams = mission.BusParameter; + return DeclarationData.BusAuxiliaries.CalculateLengthInteriorLights( + vehicleData.Length, vehicleData.VehicleCode.IsDoubleDeckerBus(), vehicleData.VehicleCode.GetFloorType(), busParams.NumberPassengersLowerDeck) + .Value(); + } + + + #endregion + + + protected double GetNumberOfPassengers(Mission mission, Meter length, Meter width, double registeredPassengers, LoadingType loading) + { + var busFloorArea = DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(length, width); + var passengerCountRef = busFloorArea * mission.BusParameter.PassengerDensity; + //var passengerCountDecl = completedVehicle.NuberOfPassengersUpperDeck + completedVehicle.NumberOfPassengersLowerDeck; + if (loading != LoadingType.ReferenceLoad && loading != LoadingType.LowLoading) { + throw new VectoException("Unhandled loading type: {0}", loading); + } + + return loading == LoadingType.ReferenceLoad + ? VectoMath.Min(passengerCountRef, registeredPassengers) + : passengerCountRef * mission.MissionType.GetLowLoadFactorBus(); + } + + + + + + } +} diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs index e436a195c96f83f31af3847c63f16ddba65949c2..2cd647501014a92c88daa35e6cdf846ce1b14619 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs @@ -12,10 +12,8 @@ using TUGraz.VectoCore.Models.BusAuxiliaries; using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics; using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC; using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; -using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Utils; @@ -23,192 +21,16 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { public class DeclarationDataAdapterPrimaryBus : DeclarationDataAdapterHeavyLorry { + #region Overrides of DeclarationDataAdapterTruck - public VehicleData CreateVehicleData(IVehicleDeclarationInputData pifVehicle, Mission mission, - KeyValuePair<LoadingType, Kilogram> loading, Meter dynamicTyreRadius) + public override VehicleData CreateVehicleData(IVehicleDeclarationInputData data, Mission mission, KeyValuePair<LoadingType, Kilogram> loading) { - var vehicleData = new VehicleData - { - AxleData = GetAxles(pifVehicle.Components.AxleWheels.AxlesDeclaration, mission.AxleWeightDistribution), - DynamicTyreRadius = dynamicTyreRadius, - AxleConfiguration = pifVehicle.AxleConfiguration, - CurbMass = mission.CurbMass, - BodyAndTrailerMass = 0.SI<Kilogram>(), - Loading = mission.RefLoad - }; - - var adas = new VehicleData.ADASData - { - EngineStopStart = pifVehicle.ADAS.EngineStopStart, - EcoRoll = pifVehicle.ADAS.EcoRoll, - PredictiveCruiseControl = pifVehicle.ADAS.PredictiveCruiseControl - }; - - vehicleData.ADAS = adas; - - return vehicleData; - } - - private List<Axle> GetAxles(IList<IAxleDeclarationInputData> axleWheels, double[] axlesDistribution) - { - var axles = new List<Axle>(); - for (int i = 0; i < axleWheels.Count; i++) - { - var axle = new Axle - { - WheelsDimension = axleWheels[i].Tyre.Dimension, - Inertia = DeclarationData.Wheels - .Lookup(axleWheels[i].Tyre.Dimension.RemoveWhitespace()).Inertia, - TyreTestLoad = axleWheels[i].Tyre.TyreTestLoad, - AxleWeightShare = axlesDistribution[i], - TwinTyres = axleWheels[i].TwinTyres, - AxleType = axleWheels[i].AxleType - }; - axles.Add(axle); - } - - return axles; - } - - public ElectricsUserInputsConfig CreateElectricalUserInputsConfig(IVehicleDeclarationInputData primaryVehicle, - IAlternatorMap alternatorMap, Mission mission) - { - var primaryBusAuxiliaries = primaryVehicle.Components.BusAuxiliaries; - - var actions = DeclarationData.BusAuxiliaries.ActuationsMap.Lookup(mission.MissionType); - var currentDemand = CalculateAverageCurrent(mission, primaryVehicle, actions); - - var electricsUI = new ElectricsUserInputsConfig { - SmartElectrical = primaryBusAuxiliaries.ElectricSupply.SmartElectrics, - MaxAlternatorPower = primaryBusAuxiliaries.ElectricSupply.MaxAlternatorPower, - ElectricStorageCapacity = primaryBusAuxiliaries.ElectricSupply.ElectricStorageCapacity, - AlternatorMap = alternatorMap, - AlternatorGearEfficiency = Constants.BusAuxiliaries.ElectricSystem.AlternatorGearEfficiency, - AverageCurrentDemandInclBaseLoad = currentDemand.Item1, - AverageCurrentDemandWithoutBaseLoad = currentDemand.Item2, - DoorActuationTimeSecond = Constants.BusAuxiliaries.ElectricalConsumers.DoorActuationTimeSecond - }; - - return electricsUI; - } - - public PneumaticUserInputsConfig CreatePneumaticUserInputsConfig(IBusAuxiliariesDeclarationData primaryBusAuxiliaries, - ICompressorMap compressorMap) - { - var pneumaticUI = new PneumaticUserInputsConfig { - CompressorMap = compressorMap, - CompressorGearEfficiency = Constants.BusAuxiliaries.PneumaticUserConfig.CompressorGearEfficiency, - CompressorGearRatio = primaryBusAuxiliaries.PneumaticSupply.Ratio, - SmartAirCompression = primaryBusAuxiliaries.PneumaticSupply.SmartAirCompression, - SmartRegeneration = primaryBusAuxiliaries.PneumaticSupply.SmartRegeneration, - KneelingHeight =Constants.BusAuxiliaries.PneumaticUserConfig.DefaultKneelingHeight, - AirSuspensionControl = primaryBusAuxiliaries.PneumaticConsumers.AirsuspensionControl, - AdBlueDosing = primaryBusAuxiliaries.PneumaticConsumers.AdBlueDosing, - Doors = ConsumerTechnology.Pneumatically - }; - - return pneumaticUI; - } - - public void SetSSMBusParameters(SSMInputs ssmInputs, Mission mission) - { - var busParams = mission.BusParameter; - - var hvacBusLength = busParams.HVACConfiguration == BusHVACSystemConfiguration.Configuration2 - ? 2 * Constants.BusParameters.DriverCompartmentLength - : busParams.VehicleLength; - - var hvacBusHeight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(busParams.FloorType, - busParams.DoubleDecker, busParams.BodyHeight); - - ssmInputs.NumberOfPassengers = mission.RefLoad.Value(); - ssmInputs.BusFloorType = busParams.FloorType; - - ssmInputs.BusWindowSurface = DeclarationData.BusAuxiliaries.WindowHeight(busParams.DoubleDecker) * hvacBusLength + - DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(busParams.DoubleDecker); - ssmInputs.BusSurfaceArea = 2 * (hvacBusLength * busParams.VehicleWidth + hvacBusLength * - busParams.BodyHeight + busParams.VehicleWidth * busParams.BodyHeight); - ssmInputs.BusVolume = hvacBusLength * busParams.VehicleWidth * hvacBusHeight; - } - - public TechnologyBenefits CreateTechnologyBenefits(Mission mission, IVehicleDeclarationInputData primaryVehicle) - { - var onVehicle = new List<SSMTechnology>(); - var primaryBusAux = primaryVehicle.Components.BusAuxiliaries; - - foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) - { - if ("Double-glazing".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (mission?.BusParameter?.HVACDoubleGlasing ?? false)){ - onVehicle.Add(item); - } - if ("Heat pump systems".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (mission?.BusParameter?.HVACHeatpump ?? false)){ - onVehicle.Add(item); - } - if ("Adjustable auxiliary heater".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (mission?.BusParameter?.HVACAdjustableAuxHeater ?? false)){ - onVehicle.Add(item); - } - if ("Separate air distribution ducts".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (mission?.BusParameter?.HVACSeparateAirDistributionDucts ?? false)){ - onVehicle.Add(item); - } - if ("Adjustable coolant thermostat".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (primaryBusAux?.HVACAux.AdjustableCoolantThermostat ?? false)){ - onVehicle.Add(item); - } - if ("Engine waste gas heat exchanger".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (primaryBusAux?.HVACAux.EngineWasteGasHeatExchanger ?? false)){ - onVehicle.Add(item); - } - } - - return SelectBenefitForFloorType(mission.BusParameter.FloorType, onVehicle); - } - - public void SetSSMInputs(SSMInputs ssmInputs, Mission mission) - { - var coolingPower = CalculateMaxCoolingPower(mission); - var busParams = mission.BusParameter; - - ssmInputs.NumberOfPassengers = mission.RefLoad.Value(); - ssmInputs.HVACMaxCoolingPower = coolingPower.Item1 + coolingPower.Item2; - ssmInputs.COP = DeclarationData.BusAuxiliaries.CalculateCOP( - coolingPower.Item1, ACCompressorType.None, coolingPower.Item2, busParams.HVACCompressorType, - busParams.FloorType); - - ssmInputs.VentilationOnDuringHeating = true; - ssmInputs.VentilationWhenBothHeatingAndACInactive = true; - ssmInputs.VentilationDuringAC = true; - - ssmInputs.FuelFiredHeaterPower = busParams.HVACAuxHeaterPower; - ssmInputs.FuelEnergyToHeatToCoolant = Constants.BusAuxiliaries.Heater.FuelEnergyToHeatToCoolant; - ssmInputs.CoolantHeatTransferredToAirCabinHeater = - Constants.BusAuxiliaries.Heater.CoolantHeatTransferredToAirCabinHeater; - } - - - public override AirdragData CreateAirdragData(IAirdragDeclarationInputData airdragInputData, Mission mission, - Segment segment) - { - var aerodynamicDragArea = mission.DefaultCDxA; - - var airdragData = new AirdragData - { - CrossWindCorrectionMode = CrossWindCorrectionMode.DeclarationModeCorrection, - CrossWindCorrectionCurve = new CrosswindCorrectionCdxALookup( - aerodynamicDragArea, - GetDeclarationAirResistanceCurve(mission.CrossWindCorrectionParameters, aerodynamicDragArea, mission.BusParameter.BodyHeight), - CrossWindCorrectionMode.DeclarationModeCorrection), - DeclaredAirdragArea = aerodynamicDragArea - }; - - return airdragData; + var retVal = base.CreateVehicleData(data, mission, loading); + retVal.CurbMass = mission.CurbMass; + return retVal; } - public override PTOData CreatePTOTransmissionData(IPTOTransmissionInputData pto) { return null; @@ -218,24 +40,21 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter IAuxiliariesDeclarationInputData auxInputData, IBusAuxiliariesDeclarationData busAuxData, MissionType mission, VehicleClass hdvClass, Meter vehicleLength) { - if (auxInputData != null) - { + if (auxInputData != null) { throw new VectoException("Only BusAuxiliaries can be provided as input!"); } var retVal = new List<VectoRunData.AuxData>(); retVal.Add( - new VectoRunData.AuxData() - { + new VectoRunData.AuxData() { DemandType = AuxiliaryDemandType.Constant, Technology = new List<string>() { busAuxData.FanTechnology }, ID = Constants.Auxiliaries.IDs.Fan, PowerDemand = DeclarationData.Fan.Lookup(hdvClass, mission, busAuxData.FanTechnology).PowerDemand }); retVal.Add( - new VectoRunData.AuxData() - { + new VectoRunData.AuxData() { DemandType = AuxiliaryDemandType.Constant, Technology = busAuxData.SteeringPumpTechnology, ID = Constants.Auxiliaries.IDs.SteeringPump, @@ -245,19 +64,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return retVal; } - #endregion - - #region Overrides - public virtual IAuxiliaryConfig CreateBusAuxiliariesData( Mission mission, IVehicleDeclarationInputData vehicleData, VectoRunData runData) { var actuations = DeclarationData.BusAuxiliaries.ActuationsMap.Lookup(runData.Mission.MissionType); - var retVal = new AuxiliaryConfig - { + var retVal = new AuxiliaryConfig { InputData = vehicleData.Components.BusAuxiliaries, ElectricalUserInputsConfig = GetElectricalUserConfig(mission, vehicleData, actuations), PneumaticUserInputsConfig = GetPneumaticUserConfig(vehicleData, mission), @@ -277,8 +91,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter var currentDemand = CalculateAverageCurrent(mission, vehicleData, actuations); var busAux = vehicleData.Components.BusAuxiliaries; - return new ElectricsUserInputsConfig() - { + return new ElectricsUserInputsConfig() { SmartElectrical = busAux.ElectricSupply.SmartElectrics, AverageCurrentDemandInclBaseLoad = currentDemand.Item1, AverageCurrentDemandWithoutBaseLoad = currentDemand.Item2, @@ -294,19 +107,18 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter }; } - protected internal virtual double CalculateAlternatorEfficiency(IList<IAlternatorDeclarationInputData> alternators) + protected virtual double CalculateAlternatorEfficiency(IList<IAlternatorDeclarationInputData> alternators) { var sum = 0.0; - foreach (var entry in alternators) - { + foreach (var entry in alternators) { sum += DeclarationData.BusAuxiliaries.AlternatorTechnologies.Lookup(entry.Technology); } return sum / alternators.Count; } - protected virtual Tuple<Ampere, Ampere> CalculateAverageCurrent( - Mission mission, IVehicleDeclarationInputData vehicleData, IActuations actuations) + protected virtual Tuple<Ampere, Ampere> CalculateAverageCurrent(Mission mission, IVehicleDeclarationInputData vehicleData, + IActuations actuations) { var avgInclBase = 0.SI<Ampere>(); var avgWithoutBase = 0.SI<Ampere>(); @@ -315,9 +127,10 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter actuations.CycleTime; var busAux = vehicleData.Components.BusAuxiliaries; var electricDoors = false; - foreach (var consumer in DeclarationData.BusAuxiliaries.DefaultElectricConsumerList.Items) - { - var nbr = GetNumberOfElectricalConsumersInVehicle(consumer.NumberInActualVehicle, mission); + + foreach (var consumer in DeclarationData.BusAuxiliaries.DefaultElectricConsumerList.Items) { + var nbr = GetNumberOfElectricalConsumersInVehicle(consumer.NumberInActualVehicle, mission, vehicleData); + var dutyCycle = electricDoors && consumer.ConsumerName.Equals( Constants.BusAuxiliaries.ElectricalConsumers.DoorsPerVehicleConsumer, StringComparison.CurrentCultureIgnoreCase) @@ -325,14 +138,12 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter : consumer.PhaseIdleTractionOn; var current = consumer.NominalCurrent(mission.MissionType) * dutyCycle * nbr; - if (consumer.Bonus && !VehicleHasElectricalConsumer(consumer.ConsumerName, busAux)) - { + if (consumer.Bonus && !VehicleHasElectricalConsumer(consumer.ConsumerName, busAux)) { current = 0.SI<Ampere>(); } avgInclBase += current; - if (!consumer.BaseVehicle) - { + if (!consumer.BaseVehicle) { avgWithoutBase += current; } } @@ -340,10 +151,11 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return Tuple.Create(avgInclBase, avgWithoutBase); } + + protected virtual bool VehicleHasElectricalConsumer(string consumerName, IBusAuxiliariesDeclarationData busAux) { - switch (consumerName) - { + switch (consumerName) { case "Day running lights LED bonus": case "Position lights LED bonus": case "Brake lights LED bonus": return false; @@ -353,26 +165,29 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } } - protected virtual double GetNumberOfElectricalConsumersInVehicle(string nbr, Mission mission) + protected virtual double GetNumberOfElectricalConsumersInVehicle(string nbr, Mission mission, IVehicleDeclarationInputData vehicleData) { - if ("f_IntLight(L_CoC)".Equals(nbr, StringComparison.InvariantCultureIgnoreCase)) - { - var busParams = mission.BusParameter; - return DeclarationData.BusAuxiliaries.CalculateLengthInteriorLights( - busParams.VehicleLength, busParams.DoubleDecker, busParams.FloorType, busParams.NumberPassengersLowerDeck) - .Value(); + if ("f_IntLight(L_CoC)".Equals(nbr, StringComparison.InvariantCultureIgnoreCase)) { + return CalculateLengthDependentElectricalConsumers(mission, vehicleData); } return nbr.ToDouble(); } + protected virtual double CalculateLengthDependentElectricalConsumers(Mission mission, IVehicleDeclarationInputData vehicleData) + { + var busParams = mission.BusParameter; + return DeclarationData.BusAuxiliaries.CalculateLengthInteriorLights( + busParams.VehicleLength, busParams.DoubleDecker, busParams.FloorType, busParams.NumberPassengersLowerDeck) + .Value(); + } + protected virtual PneumaticUserInputsConfig GetPneumaticUserConfig(IVehicleDeclarationInputData vehicleData, Mission mission) { var busAux = vehicleData.Components.BusAuxiliaries; //throw new NotImplementedException(); - return new PneumaticUserInputsConfig() - { + return new PneumaticUserInputsConfig() { KneelingHeight = mission.BusParameter.FloorType == FloorType.LowFloor ? Constants.BusAuxiliaries.PneumaticUserConfig.DefaultKneelingHeight : 0.SI<Meter>(), @@ -387,11 +202,10 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter }; } - protected internal virtual ICompressorMap GetCompressorMap(string compressorSize, string clutchType) + protected virtual ICompressorMap GetCompressorMap(string compressorSize, string clutchType) { var resource = ""; - switch (compressorSize) - { + switch (compressorSize) { case "Small": resource = "DEFAULT_1-Cylinder_1-Stage_393ccm.acmp"; break; @@ -407,17 +221,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter case "Large Supply 2-stage": resource = "DEFAULT_3-Cylinder_2-Stage_598ccm.acmp"; break; - default: throw new ArgumentException(string.Format("unkown compressor size {0}", compressorSize)); + default: throw new ArgumentException(string.Format("unkown compressor size {0}"), compressorSize); } var dragCurveFactorClutch = 1.0; - switch (clutchType) - { - case "visco": - dragCurveFactorClutch = Constants.BusAuxiliaries.PneumaticUserConfig.ViscoClutchDragCurveFactor; + switch (clutchType) { + case "visco": dragCurveFactorClutch = Constants.BusAuxiliaries.PneumaticUserConfig.ViscoClutchDragCurveFactor; break; - case "mechically": - dragCurveFactorClutch = Constants.BusAuxiliaries.PneumaticUserConfig.MechanicClutchDragCurveFactor; + case "mechically": dragCurveFactorClutch = Constants.BusAuxiliaries.PneumaticUserConfig.MechanicClutchDragCurveFactor; break; } @@ -425,19 +236,9 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".VAUXBus." + resource), dragCurveFactorClutch); } - public virtual ISSMInputs CreateSSMModelParameters(IBusAuxiliariesDeclarationData busAuxInputData, Mission mission, IFuelProperties heatingFuel, LoadingType loadingType) + public SSMInputs GetDefaulSSMInputs(IFuelProperties heatingFuel) { - var busParams = mission.BusParameter; - - var hvacBusLength = busParams.HVACConfiguration == BusHVACSystemConfiguration.Configuration2 - ? 2 * Constants.BusParameters.DriverCompartmentLength - : busParams.VehicleLength; - var hvacBusheight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(mission.BusParameter.FloorType, mission.BusParameter.DoubleDecker, busParams.BodyHeight); - var coolingPower = CalculateMaxCoolingPower(mission); - var retVal = new SSMInputs(null, heatingFuel) - { - BusFloorType = busParams.FloorType, - Technologies = GetSSMTechnologyBenefits(busAuxInputData, mission.BusParameter.FloorType), + return new SSMInputs(null, heatingFuel) { DefaultConditions = new EnvironmentalConditionMapEntry( Constants.BusAuxiliaries.SteadyStateModel.DefaultTemperature, Constants.BusAuxiliaries.SteadyStateModel.DefaultSolar, @@ -449,7 +250,6 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter SpecificVentilationPower = Constants.BusAuxiliaries.SteadyStateModel.SpecificVentilationPower, AuxHeaterEfficiency = Constants.BusAuxiliaries.SteadyStateModel.AuxHeaterEfficiency, - FuelFiredHeaterPower = busParams.HVACAuxHeaterPower, FuelEnergyToHeatToCoolant = Constants.BusAuxiliaries.Heater.FuelEnergyToHeatToCoolant, CoolantHeatTransferredToAirCabinHeater = Constants.BusAuxiliaries.Heater.CoolantHeatTransferredToAirCabinHeater, GFactor = Constants.BusAuxiliaries.SteadyStateModel.GFactor, @@ -460,46 +260,61 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter MaxPossibleBenefitFromTechnologyList = Constants.BusAuxiliaries.SteadyStateModel.MaxPossibleBenefitFromTechnologyList, - - BusWindowSurface = DeclarationData.BusAuxiliaries.WindowHeight(busParams.DoubleDecker) * hvacBusLength + - DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(busParams.DoubleDecker), - BusSurfaceArea = 2 * (hvacBusLength * busParams.VehicleWidth + hvacBusLength * busParams.BodyHeight + - busParams.VehicleWidth * busParams.BodyHeight), - BusVolume = hvacBusLength * busParams.VehicleWidth * hvacBusheight, - - UValue = DeclarationData.BusAuxiliaries.UValue(busParams.FloorType), - NumberOfPassengers = - DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(hvacBusLength, busParams.VehicleWidth) * - busParams.PassengerDensity * (loadingType == LoadingType.LowLoading ? mission.MissionType.GetLowLoadFactorBus() : 1.0) + 1, // add driver for 'heat input' - VentilationRate = DeclarationData.BusAuxiliaries.VentilationRate(busParams.HVACConfiguration, false), - VentilationRateHeating = DeclarationData.BusAuxiliaries.VentilationRate(busParams.HVACConfiguration, true), - - HVACMaxCoolingPower = coolingPower.Item1 + coolingPower.Item2, - HVACCompressorType = busParams.HVACCompressorType, // use passenger compartment - COP = DeclarationData.BusAuxiliaries.CalculateCOP( - coolingPower.Item1, ACCompressorType.None, coolingPower.Item2, busParams.HVACCompressorType, - busParams.FloorType), }; + } + + public virtual ISSMInputs CreateSSMModelParameters(IBusAuxiliariesDeclarationData busAuxInputData, Mission mission, IFuelProperties heatingFuel, LoadingType loadingType) + { + var busParams = mission.BusParameter; + var hvacBusLength = busParams.HVACConfiguration == BusHVACSystemConfiguration.Configuration2 + ? 2 * Constants.BusParameters.DriverCompartmentLength + : busParams.VehicleLength; + var hvacBusheight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(mission.BusParameter.FloorType, mission.BusParameter.DoubleDecker, busParams.BodyHeight); + var coolingPower = CalculateMaxCoolingPower(null, mission); + + var retVal = GetDefaulSSMInputs(heatingFuel); + retVal.BusFloorType = busParams.FloorType; + retVal.Technologies = GetSSMTechnologyBenefits(busAuxInputData, mission.BusParameter.FloorType); + + retVal.FuelFiredHeaterPower = busParams.HVACAuxHeaterPower; + retVal.BusWindowSurface = DeclarationData.BusAuxiliaries.WindowHeight(busParams.DoubleDecker) * hvacBusLength + + DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(busParams.DoubleDecker); + retVal.BusSurfaceArea = 2 * (hvacBusLength * busParams.VehicleWidth + hvacBusLength * busParams.BodyHeight + + busParams.VehicleWidth * busParams.BodyHeight); + retVal.BusVolume = hvacBusLength * busParams.VehicleWidth * hvacBusheight; + + retVal.UValue = DeclarationData.BusAuxiliaries.UValue(busParams.FloorType); + retVal.NumberOfPassengers = + DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(hvacBusLength, busParams.VehicleWidth) * + busParams.PassengerDensity * + (loadingType == LoadingType.LowLoading ? mission.MissionType.GetLowLoadFactorBus() : 1.0) + 1; // add driver for 'heat input' + retVal.VentilationRate = DeclarationData.BusAuxiliaries.VentilationRate(busParams.HVACConfiguration, false); + retVal.VentilationRateHeating = DeclarationData.BusAuxiliaries.VentilationRate(busParams.HVACConfiguration, true); + + retVal.HVACMaxCoolingPower = coolingPower.Item1 + coolingPower.Item2; + retVal.HVACCompressorType = busParams.HVACCompressorType; // use passenger compartment + retVal.COP = DeclarationData.BusAuxiliaries.CalculateCOP( + coolingPower.Item1, ACCompressorType.None, coolingPower.Item2, busParams.HVACCompressorType, + busParams.FloorType); + //SetHVACParameters(retVal, vehicleData, mission); return retVal; } + protected virtual TechnologyBenefits GetSSMTechnologyBenefits(IBusAuxiliariesDeclarationData inputData, FloorType floorType) { var onVehicle = new List<SSMTechnology>(); - foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) - { + foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) { if ("Adjustable coolant thermostat".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (inputData?.HVACAux.AdjustableCoolantThermostat ?? false)) - { + (inputData?.HVACAux.AdjustableCoolantThermostat ?? false)) { onVehicle.Add(item); } if ("Engine waste gas heat exchanger".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (inputData?.HVACAux.EngineWasteGasHeatExchanger ?? false)) - { + (inputData?.HVACAux.EngineWasteGasHeatExchanger ?? false)) { onVehicle.Add(item); } } @@ -507,12 +322,11 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return SelectBenefitForFloorType(floorType, onVehicle); } - protected internal virtual TechnologyBenefits SelectBenefitForFloorType(FloorType floorType, List<SSMTechnology> onVehicle) + protected virtual TechnologyBenefits SelectBenefitForFloorType(FloorType floorType, List<SSMTechnology> onVehicle) { var retVal = new TechnologyBenefits(); - switch (floorType) - { + switch (floorType) { case FloorType.LowFloor: retVal.CValueVariation = onVehicle.Sum(x => x.LowFloorC); retVal.HValueVariation = onVehicle.Sum(x => x.LowFloorH); @@ -540,7 +354,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } - protected virtual Tuple<Watt, Watt> CalculateMaxCoolingPower(Mission mission) + protected virtual Tuple<Watt, Watt> CalculateMaxCoolingPower(IVehicleDeclarationInputData vehicleData, Mission mission) { var busParams = mission.BusParameter; @@ -560,8 +374,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter protected internal virtual IPneumaticsConsumersDemand CreatePneumaticAuxConfig(RetarderType retarderType) { - return new PneumaticsConsumersDemand() - { + return new PneumaticsConsumersDemand() { AdBlueInjection = Constants.BusAuxiliaries.PneumaticConsumersDemands.AdBlueInjection, AirControlledSuspension = Constants.BusAuxiliaries.PneumaticConsumersDemands.AirControlledSuspension, Braking = retarderType == RetarderType.None @@ -580,7 +393,5 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter StopBrakeActuation = Constants.BusAuxiliaries.PneumaticConsumersDemands.StopBrakeActuation, }; } - #endregion - } } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterSingleBus.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterSingleBus.cs index aa897040000405aa973c506f46d7fc5b68ea0a12..e1547a54b0d68fbb8df783f67129f6db580e5dc8 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterSingleBus.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterSingleBus.cs @@ -15,7 +15,7 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { - public class DeclarationDataAdapterSingleBus : DeclarationDataAdapterPrimaryBus + public class DeclarationDataAdapterSingleBus : DeclarationDataAdapterCompletedBusGeneric { #region Implementation of IDeclarationDataAdapter @@ -24,7 +24,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter var busFloorArea = DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(CompletedVehicle.Length, CompletedVehicle.Width); var passengerCountRef = busFloorArea * mission.BusParameter.PassengerDensity; - var passengerCountDecl = CompletedVehicle.NuberOfPassengersUpperDeck + CompletedVehicle.NumberOfPassengersLowerDeck; + var passengerCountDecl = CompletedVehicle.NumberOfPassengersUpperDeck + CompletedVehicle.NumberOfPassengersLowerDeck; //var refLoad = passengerCount * mission.MissionType.GetAveragePassengerMass(); if (loading.Key != LoadingType.ReferenceLoad && loading.Key != LoadingType.LowLoading) { throw new VectoException("Unhandled loading type: {0}", loading.Key); @@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter #region Overrides of DeclarationDataAdapterPrimaryBus - protected internal override double CalculateAlternatorEfficiency(IList<IAlternatorDeclarationInputData> alternators) + protected override double CalculateAlternatorEfficiency(IList<IAlternatorDeclarationInputData> alternators) { var sum = 0.0; foreach (var entry in alternators) { @@ -98,16 +98,13 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } } - protected override double GetNumberOfElectricalConsumersInVehicle(string nbr, Mission mission) - { - if ("f_IntLight(L_CoC)".Equals(nbr, StringComparison.InvariantCultureIgnoreCase)) { - return DeclarationData.BusAuxiliaries.CalculateLengthInteriorLights( - CompletedVehicle.Length, IsDoubleDecker, CompletedVehicle.FloorType, - CompletedVehicle.NumberOfPassengersLowerDeck) - .Value(); - } - return nbr.ToDouble(); + protected override double CalculateLengthDependentElectricalConsumers(Mission mission, IVehicleDeclarationInputData vehicleData) + { + return DeclarationData.BusAuxiliaries.CalculateLengthInteriorLights( + CompletedVehicle.Length, IsDoubleDecker, CompletedVehicle.FloorType, + CompletedVehicle.NumberOfPassengersLowerDeck) + .Value(); } protected override PneumaticUserInputsConfig GetPneumaticUserConfig( @@ -135,7 +132,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter var hvacBusheight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(CompletedVehicle.FloorType, IsDoubleDecker, CompletedVehicle.Height); - var coolingPower = CalculateMaxCoolingPower(mission); + var coolingPower = CalculateMaxCoolingPower(CompletedVehicle, mission); retVal.BusFloorType = CompletedVehicle.FloorType; retVal.Technologies = GetSSMTechnologyBenefits(busAuxInputData, CompletedVehicle.FloorType); @@ -151,7 +148,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter (DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(hvacBusLength, correctedBusWidth) * mission.BusParameter.PassengerDensity * (loading == LoadingType.LowLoading ? mission.MissionType.GetLowLoadFactorBus() : 1.0)).LimitTo( - 0, CompletedVehicle.NuberOfPassengersUpperDeck + CompletedVehicle.NumberOfPassengersLowerDeck) + 1; // add driver for 'heat input' + 0, CompletedVehicle.NumberOfPassengersUpperDeck + CompletedVehicle.NumberOfPassengersLowerDeck) + 1; // add driver for 'heat input' retVal.VentilationRate = DeclarationData.BusAuxiliaries.VentilationRate(busAux.HVACAux.SystemConfiguration, false); retVal.VentilationRateHeating = DeclarationData.BusAuxiliaries.VentilationRate(busAux.HVACAux.SystemConfiguration, true); @@ -164,17 +161,17 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return retVal; } - protected override Tuple<Watt, Watt> CalculateMaxCoolingPower(Mission mission) + protected override Tuple<Watt, Watt> CalculateMaxCoolingPower(IVehicleDeclarationInputData vehicle, Mission mission) { var length = DeclarationData.BusAuxiliaries.CalculateInternalLength( - CompletedVehicle.Length, IsDoubleDecker, CompletedVehicle.FloorType, - CompletedVehicle.NumberOfPassengersLowerDeck); - var height = DeclarationData.BusAuxiliaries.CalculateInternalHeight(CompletedVehicle.FloorType, - IsDoubleDecker, CompletedVehicle.Height); - var volume = length * height * DeclarationData.BusAuxiliaries.CorrectedBusWidth(CompletedVehicle.Width); + vehicle.Length, IsDoubleDecker, vehicle.FloorType, + vehicle.NumberOfPassengersLowerDeck); + var height = DeclarationData.BusAuxiliaries.CalculateInternalHeight(vehicle.FloorType, + IsDoubleDecker, vehicle.Height); + var volume = length * height * DeclarationData.BusAuxiliaries.CorrectedBusWidth(vehicle.Width); - var hvacConfiguration = CompletedVehicle.Components.BusAuxiliaries.HVACAux.SystemConfiguration; + var hvacConfiguration = vehicle.Components.BusAuxiliaries.HVACAux.SystemConfiguration; var driver = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.DriverMaxCoolingPower( hvacConfiguration, mission.MissionType); @@ -223,6 +220,6 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter #endregion - protected bool IsDoubleDecker { get { return CompletedVehicle.NuberOfPassengersUpperDeck > 0; } } + protected bool IsDoubleDecker { get { return CompletedVehicle.NumberOfPassengersUpperDeck > 0; } } } } diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationDataAdapterCompletedBus.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationDataAdapterCompletedBus.cs deleted file mode 100644 index e0e67622880b230d47728b869d480480b19c3151..0000000000000000000000000000000000000000 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationDataAdapterCompletedBus.cs +++ /dev/null @@ -1,369 +0,0 @@ -using System; -using System.Collections.Generic; -using TUGraz.VectoCommon.BusAuxiliaries; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.InputData; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; -using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics; -using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC; -using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; -using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics; -using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.InputData.Reader.Impl -{ - public class DeclarationDataAdapterCompletedBus - { - - public AirdragData CreateAirdragData(IVehicleDeclarationInputData completedVehicle, Mission mission) - { - var airdragData = new AirdragData - { - CrossWindCorrectionMode = CrossWindCorrectionMode.DeclarationModeCorrection - }; - - SquareMeter aerodynamicDragArea; - if (!mission.BusParameter.AirDragMeasurementAllowed || completedVehicle.Components.AirdragInputData.AirDragArea == null) - aerodynamicDragArea = mission.DefaultCDxA; - else - aerodynamicDragArea = completedVehicle.Components.AirdragInputData.AirDragArea; - - var vehicleHeight = completedVehicle.Height + mission.BusParameter.DeltaHeight; - - airdragData.CrossWindCorrectionCurve = new CrosswindCorrectionCdxALookup( - aerodynamicDragArea, - DeclarationDataAdapterHeavyLorry.GetDeclarationAirResistanceCurve( - mission.CrossWindCorrectionParameters, - aerodynamicDragArea, - vehicleHeight), - CrossWindCorrectionMode.DeclarationModeCorrection); - - airdragData.DeclaredAirdragArea = aerodynamicDragArea; - - return airdragData; - } - - public VehicleData CreateVehicleData(IVehicleDeclarationInputData pifVehicle, - IVehicleDeclarationInputData completedVehicle, Mission mission, - KeyValuePair<LoadingType, Kilogram> loading, Meter dynamicTyreRadius) - { - var vehicleData = new VehicleData - { - AxleConfiguration = pifVehicle.AxleConfiguration, - CurbMass = completedVehicle.CurbMassChassis, - BodyAndTrailerMass = 0.SI<Kilogram>(), - Loading = GetLoading(completedVehicle, mission, loading), - GrossVehicleMass = completedVehicle.GrossVehicleMassRating, - DynamicTyreRadius = dynamicTyreRadius, - AxleData = GetAxles(pifVehicle.Components.AxleWheels.AxlesDeclaration, mission.AxleWeightDistribution) - }; - - var adas = new VehicleData.ADASData - { - EngineStopStart = pifVehicle.ADAS.EngineStopStart, - EcoRoll = pifVehicle.ADAS.EcoRoll, - PredictiveCruiseControl = pifVehicle.ADAS.PredictiveCruiseControl - }; - - vehicleData.ADAS = adas; - - return vehicleData; - } - - public ElectricsUserInputsConfig CreateElectricsUserInputsConfig(IBusAuxiliariesDeclarationData primaryBusAuxiliaries, - IVehicleDeclarationInputData completedVehicle, Mission mission, IAlternatorMap alternatorMap) - { - var actions = DeclarationData.BusAuxiliaries.ActuationsMap.Lookup(mission.MissionType); - var currentDemand = CalculateAverageCurrent(mission, completedVehicle, actions); - - var electricUI = new ElectricsUserInputsConfig { - SmartElectrical = primaryBusAuxiliaries.ElectricSupply.SmartElectrics, - MaxAlternatorPower = primaryBusAuxiliaries.ElectricSupply.MaxAlternatorPower, - ElectricStorageCapacity = primaryBusAuxiliaries.ElectricSupply.ElectricStorageCapacity, - AlternatorMap = alternatorMap, - AlternatorGearEfficiency = Constants.BusAuxiliaries.ElectricSystem.AlternatorGearEfficiency, - AverageCurrentDemandInclBaseLoad = currentDemand.Item1, - AverageCurrentDemandWithoutBaseLoad = currentDemand.Item2, - DoorActuationTimeSecond = Constants.BusAuxiliaries.ElectricalConsumers.DoorActuationTimeSecond, - }; - - return electricUI; - } - - public PneumaticUserInputsConfig CreatePneumaticUserInputsConfig(IBusAuxiliariesDeclarationData primaryBusAuxiliaries, - IVehicleDeclarationInputData completedVehicle, ICompressorMap compressorMap) - { - var pneumaticUI = new PneumaticUserInputsConfig { - CompressorMap = compressorMap, - CompressorGearEfficiency = Constants.BusAuxiliaries.PneumaticUserConfig.CompressorGearEfficiency, - CompressorGearRatio = primaryBusAuxiliaries.PneumaticSupply.Ratio, - SmartAirCompression = primaryBusAuxiliaries.PneumaticSupply.SmartAirCompression, - SmartRegeneration = primaryBusAuxiliaries.PneumaticSupply.SmartRegeneration, - KneelingHeight = VectoMath.Max(0.SI<Meter>(), - completedVehicle.EntranceHeight - Constants.BusParameters.EntranceHeight), - AirSuspensionControl = primaryBusAuxiliaries.PneumaticConsumers.AirsuspensionControl, - AdBlueDosing = primaryBusAuxiliaries.PneumaticConsumers.AdBlueDosing, - Doors = completedVehicle.Components.BusAuxiliaries.PneumaticConsumers.DoorDriveTechnology - }; - - return pneumaticUI; - - } - - public void SetSSMBusParameters(SSMInputs ssmInputs, IVehicleDeclarationInputData completedVehicle, Mission mission, - KeyValuePair<LoadingType, Kilogram> loading) - { - var busAuxiliaries = completedVehicle.Components.BusAuxiliaries; - var isDoubleDecker = completedVehicle.VehicleCode.IsDoubleDeckBus(); - var floorType = GetFloorType(completedVehicle.VehicleCode); - - var hvacBusLength = busAuxiliaries.HVACAux.SystemConfiguration == BusHVACSystemConfiguration.Configuration2 - ? 2 * Constants.BusParameters.DriverCompartmentLength - : completedVehicle.Length; - - var hvacBusHeight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(GetFloorType(completedVehicle.VehicleCode), - isDoubleDecker, completedVehicle.Height); - - ssmInputs.NumberOfPassengers = GetLoading(completedVehicle, mission, loading).Value(); - ssmInputs.BusFloorType = floorType; - - ssmInputs.BusWindowSurface = DeclarationData.BusAuxiliaries.WindowHeight(isDoubleDecker) * hvacBusLength + - DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(isDoubleDecker); - ssmInputs.BusSurfaceArea = 2 * (hvacBusLength * completedVehicle.Width + hvacBusLength * - completedVehicle.Height + completedVehicle.Width * completedVehicle.Height); - ssmInputs.BusVolume = hvacBusLength * completedVehicle.Width * hvacBusHeight; - } - - - public TechnologyBenefits CreateTechnologyBenefits(IVehicleDeclarationInputData completedVehicle, - IBusAuxiliariesDeclarationData primaryBusAux, DeclarationDataAdapterPrimaryBus dataAdapterPrimary) - { - var onVehicle = new List<SSMTechnology>(); - var completedBuxAux = completedVehicle.Components.BusAuxiliaries; - var floortype = GetFloorType(completedVehicle.VehicleCode); - - foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) - { - if ("Double-glazing".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (completedBuxAux?.HVACAux.DoubleGlasing ?? false)) - { - onVehicle.Add(item); - } - if ("Heat pump systems".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (completedBuxAux?.HVACAux.HeatPump ?? false)) - { - onVehicle.Add(item); - } - if ("Adjustable auxiliary heater".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (completedBuxAux?.HVACAux.AdjustableAuxiliaryHeater ?? false)) - { - onVehicle.Add(item); - } - if ("Separate air distribution ducts".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (completedBuxAux?.HVACAux.SeparateAirDistributionDucts ?? false)) - { - onVehicle.Add(item); - } - if ("Adjustable coolant thermostat".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (primaryBusAux?.HVACAux.AdjustableCoolantThermostat ?? false)) - { - onVehicle.Add(item); - } - if ("Engine waste gas heat exchanger".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) && - (primaryBusAux?.HVACAux.EngineWasteGasHeatExchanger ?? false)) - { - onVehicle.Add(item); - } - } - - return dataAdapterPrimary.SelectBenefitForFloorType(floortype, onVehicle); - } - - public void SetSSMInputs(SSMInputs ssmInputs, Mission mission, KeyValuePair<LoadingType, Kilogram> loading, - IVehicleDeclarationInputData completedVehicle) - { - var coolingPower = CalculateMaxCoolingPower(completedVehicle, mission.MissionType); - - var busAux = completedVehicle.Components.BusAuxiliaries.HVACAux; - var floorType = GetFloorType(completedVehicle.VehicleCode); - - ssmInputs.NumberOfPassengers = GetLoading(completedVehicle, mission, loading).Value(); - ssmInputs.HVACMaxCoolingPower = coolingPower.Item1 + coolingPower.Item2; - ssmInputs.COP = DeclarationData.BusAuxiliaries.CalculateCOP( - coolingPower.Item1, busAux.CompressorTypeDriver, coolingPower.Item2, busAux.CompressorTypePassenger, - floorType); - - ssmInputs.VentilationOnDuringHeating = true; - ssmInputs.VentilationWhenBothHeatingAndACInactive = true; - ssmInputs.VentilationDuringAC = true; - - ssmInputs.FuelFiredHeaterPower = busAux.AuxHeaterPower; - ssmInputs.FuelEnergyToHeatToCoolant = Constants.BusAuxiliaries.Heater.FuelEnergyToHeatToCoolant; - ssmInputs.CoolantHeatTransferredToAirCabinHeater = - Constants.BusAuxiliaries.Heater.CoolantHeatTransferredToAirCabinHeater; - } - - private Tuple<Watt, Watt> CalculateMaxCoolingPower(IVehicleDeclarationInputData completedVehicle, - MissionType missionType) - { - var isDoubleDecker = VehicleCodeHelper.IsDoubleDeckBus(completedVehicle.VehicleCode); - var floorType = GetFloorType(completedVehicle.VehicleCode); - var hvacConfiguration = completedVehicle.Components.BusAuxiliaries.HVACAux.SystemConfiguration; - - var length = DeclarationData.BusAuxiliaries.CalculateInternalLength( - completedVehicle.Length ,isDoubleDecker, floorType, - completedVehicle.NumberOfPassengersLowerDeck); - var height = DeclarationData.BusAuxiliaries.CalculateInternalHeight(floorType, isDoubleDecker, completedVehicle.Height); - var volume = length * height * completedVehicle.Width; - - var driver = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.DriverMaxCoolingPower( - hvacConfiguration, missionType); - var passenger = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.PassengerMaxCoolingPower( - hvacConfiguration, missionType, volume); - - return Tuple.Create(driver, passenger); - } - - - - - #region Avarage Current Demand Calculation - - - private Tuple<Ampere, Ampere> CalculateAverageCurrent( Mission mission, IVehicleDeclarationInputData vehicleData, - IActuations actuations) - { - var avgInclBase = 0.SI<Ampere>(); - var avgWithoutBase = 0.SI<Ampere>(); - var doorDutyCycleFraction = - (actuations.ParkBrakeAndDoors * Constants.BusAuxiliaries.ElectricalConsumers.DoorActuationTimeSecond) / - actuations.CycleTime; - var busAux = vehicleData.Components.BusAuxiliaries; - var electricDoors = false; - var floorType = GetFloorType(vehicleData.VehicleCode); - - foreach (var consumer in DeclarationData.BusAuxiliaries.DefaultElectricConsumerList.Items) - { - var nbr = GetNumberOfElectricalConsumersInVehicle(consumer.NumberInActualVehicle, mission, - vehicleData.Length, floorType); - - var dutyCycle = electricDoors && consumer.ConsumerName.Equals( - Constants.BusAuxiliaries.ElectricalConsumers.DoorsPerVehicleConsumer, - StringComparison.CurrentCultureIgnoreCase) - ? doorDutyCycleFraction - : consumer.PhaseIdleTractionOn; - - var current = consumer.NominalCurrent(mission.MissionType) * dutyCycle * nbr; - if (consumer.Bonus && !VehicleHasElectricalConsumer(consumer.ConsumerName, busAux)) - { - current = 0.SI<Ampere>(); - } - - avgInclBase += current; - if (!consumer.BaseVehicle) - { - avgWithoutBase += current; - } - } - - return Tuple.Create(avgInclBase, avgWithoutBase); - } - - private bool VehicleHasElectricalConsumer(string consumerName, IBusAuxiliariesDeclarationData busAux) - { - if (consumerName == "Day running lights LED bonus" && busAux.ElectricConsumers.DayrunninglightsLED) - return true; - if (consumerName == "Position lights LED bonus" && busAux.ElectricConsumers.PositionlightsLED) - return true; - if (consumerName == "Brake lights LED bonus" && busAux.ElectricConsumers.BrakelightsLED) - return true; - if (consumerName == "Interior lights LED bonus" && busAux.ElectricConsumers.InteriorLightsLED) - return true; - if (consumerName == "Headlights LED bonus" && busAux.ElectricConsumers.HeadlightsLED) - return true; - - return false; - } - - private double GetNumberOfElectricalConsumersInVehicle(string nbr, Mission mission, Meter vehicleLength, FloorType floorType) - { - if ("f_IntLight(L_CoC)".Equals(nbr, StringComparison.InvariantCultureIgnoreCase)) - { - var busParams = mission.BusParameter; - return DeclarationData.BusAuxiliaries.CalculateLengthInteriorLights( - vehicleLength, busParams.DoubleDecker, floorType, busParams.NumberPassengersLowerDeck) - .Value(); - } - - return nbr.ToDouble(); - } - - private FloorType GetFloorType(VehicleCode vehicleCode) - { - switch (vehicleCode) - { - case VehicleCode.CA: - case VehicleCode.CB: - case VehicleCode.CC: - case VehicleCode.CD: - return FloorType.HighFloor; - default: - return FloorType.LowFloor; - } - } - - #endregion - - #region Vehicle Data Getter - - private List<Axle> GetAxles(IList<IAxleDeclarationInputData> axleWheels, double[] axlesDistribution) - { - var axles = new List<Axle>(); - for (int i = 0; i < axleWheels.Count; i++) - { - var axle = new Axle - { - WheelsDimension = axleWheels[i].Tyre.Dimension, - Inertia = DeclarationData.Wheels - .Lookup(axleWheels[i].Tyre.Dimension.RemoveWhitespace()).Inertia, - TyreTestLoad = axleWheels[i].Tyre.TyreTestLoad, - AxleWeightShare = axlesDistribution[i], - TwinTyres = axleWheels[i].TwinTyres, - AxleType = axleWheels[i].AxleType - }; - axles.Add(axle); - } - - return axles; - } - - private Kilogram GetLoading(IVehicleDeclarationInputData completedVehicle, Mission mission, KeyValuePair<LoadingType, Kilogram> loading) - { - var busFloorArea = DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(completedVehicle.Length, - completedVehicle.Width); - var passengerCountRef = busFloorArea * mission.BusParameter.PassengerDensity; - var passengerCountDecl = completedVehicle.NuberOfPassengersUpperDeck + completedVehicle.NumberOfPassengersLowerDeck; - - if (loading.Key != LoadingType.ReferenceLoad && loading.Key != LoadingType.LowLoading) - { - throw new VectoException("Unhandled loading type: {0}", loading.Key); - } - - - return - (loading.Key == LoadingType.ReferenceLoad - ? VectoMath.Min(passengerCountRef, passengerCountDecl) - : passengerCountRef * mission.MissionType.GetLowLoadFactorBus()) * mission.MissionType.GetAveragePassengerMass(); - } - - #endregion - - - } -} diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs index 37fa283c37e34443594ff5ebeffd410402c12bc4..9e38f8bebdc0185c8172bc8d5529d8c83de1bd89 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs @@ -35,10 +35,8 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl protected IDeclarationReport Report; - protected Segment _segment; + protected Segment _segmentCompletedBus; - protected DriverData _driverdata; - protected AirdragData _airdragData; protected AxleGearData _axlegearData; protected AngledriveData _angledriveData; protected GearboxData _gearboxData; @@ -46,23 +44,21 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl protected IAlternatorMap _alternatorMap; protected ICompressorMap _compressorMap; - protected IPneumaticsConsumersDemand _consumersDeclarationData; + //protected IPneumaticsConsumersDemand _consumersDeclarationData; protected CombustionEngineData _combustionEngineData; //protected Exception InitException; protected ShiftStrategyParameters _gearshiftData; - private VehicleData _tmpVehicleData; + //private VehicleData _tmpVehicleData; private DriverData _driverData; - protected IDeclarationDataAdapter DataAdapter { get; } - - - protected DeclarationDataAdapterCompletedBus DataAdapterCompleted = new DeclarationDataAdapterCompletedBus(); + + protected DeclarationDataAdapterCompletedBusSpecific DataAdapterSpecific = new DeclarationDataAdapterCompletedBusSpecific(); - protected DeclarationDataAdapterPrimaryBus DataAdapterPrimary = new DeclarationDataAdapterPrimaryBus(); + protected DeclarationDataAdapterCompletedBusGeneric DataAdapterGeneric = new DeclarationDataAdapterCompletedBusGeneric(); public DeclarationModeCompletedBusVectoRunDataFactory( IDeclarationInputDataProvider dataProvider, IDeclarationReport report) @@ -71,6 +67,16 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl Report = report; } + protected IVehicleDeclarationInputData PrimaryVehicle + { + get { return InputDataProvider.PrimaryVehicleData.Vehicle; } + } + + protected IVehicleDeclarationInputData CompletedVehicle + { + get { return InputDataProvider.JobInputData.Vehicle; } + } + public IEnumerable<VectoRunData> NextRun() { Initialize(); @@ -83,11 +89,9 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl protected virtual void InitializeReport() { - var vehicle = InputDataProvider.JobInputData.Vehicle; - - var powertrainConfig = _segment.Missions.Select( + var powertrainConfig = _segmentCompletedBus.Missions.Select( mission => CreateVectoRunDataSpecific( - vehicle, InputDataProvider.PrimaryVehicleData.Vehicle, mission, mission.Loadings.First())) + mission, mission.Loadings.First())) .FirstOrDefault(x => x != null); Report.InitializeReport(powertrainConfig, new List<List<FuelData.Entry>>()); @@ -97,83 +101,32 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl protected virtual void Initialize() { - var vehicle = InputDataProvider.JobInputData.Vehicle; - var primaryVehicle = InputDataProvider.PrimaryVehicleData.Vehicle; - if (vehicle.ExemptedVehicle) { + if (CompletedVehicle.ExemptedVehicle || PrimaryVehicle.ExemptedVehicle) { return; } - _segment = GetCompletedSegment(vehicle, primaryVehicle.AxleConfiguration); - - //_driverdata = DataAdapterCompleted.CreateDriverData(); - //_driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(_segment.AccelerationFile); - ////var tempVehicle = DataAdapter.CreateVehicleData( - //// vehicle, _segment.Missions.First(), - //// _segment.Missions.First().Loadings.First()); - //_airdragData = DataAdapterCompleted.CreateAirdragData( - // vehicle.Components.AirdragInputData, - // _segment.Missions.First(), _segment); - - //_axlegearData = DeclarationData.FactorMethodBus.CreateAxlegearData(primaryVehicle.Components.AxleGearInputData); - - //_angledriveData = null; - //var tmpRunData = new VectoRunData() { - // ShiftStrategy = InputDataProvider.JobInputData.ShiftStrategy, - // GearboxData = new GearboxData() { - // Type = vehicle.Components.GearboxInputData.Type, - // } - //}; - - ////var tmpStrategy = PowertrainBuilder.GetShiftStrategy(tmpRunData, new SimplePowertrainContainer(tmpRunData)); - //var tmpEngine = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle.Components.EngineInputData); - //_gearboxData = DeclarationData.FactorMethodBus.CreateGearboxData(primaryVehicle.Components.GearboxInputData); - - //_retarderData = DataAdapterCompleted.CreateRetarderData(vehicle.Components.RetarderInputData); + _segmentCompletedBus = GetCompletedSegment(CompletedVehicle, PrimaryVehicle.AxleConfiguration); - //_ptoTransmissionData = null; + var tmpVehicleData = DataAdapterGeneric.CreateVehicleData(CompletedVehicle, _segmentCompletedBus.Missions.First(), + _segmentCompletedBus.Missions.First().Loadings.First()); - //_municipalPtoTransmissionData = null; + _combustionEngineData = DataAdapterGeneric.CreateEngineData(PrimaryVehicle); - _tmpVehicleData = new VehicleData { - DynamicTyreRadius = DeclarationData.FactorMethodBus.GetDynamicTyreRadius(primaryVehicle), - VehicleCategory = VehicleCategory.GenericBusVehicle - }; - - - _combustionEngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle); - - _axlegearData = DeclarationData.FactorMethodBus.CreateAxlegearData(primaryVehicle.Components.AxleGearInputData); + _axlegearData = GenericTransmissionComponentData.Instance.CreateGenericBusAxlegearData(PrimaryVehicle.Components.AxleGearInputData); - _angledriveData = DeclarationData.FactorMethodBus.CreateAngledriveData( - primaryVehicle.Components.AngledriveInputData, - primaryVehicle.Components.AxleGearInputData.Ratio); + _angledriveData = GenericTransmissionComponentData.Instance.CreateGenericBusAngledriveData(PrimaryVehicle.Components.AngledriveInputData); - - _gearboxData = DeclarationData.FactorMethodBus.CreateGearboxData(primaryVehicle, - new VectoRunData() { EngineData = _combustionEngineData, AxleGearData = _axlegearData, VehicleData = _tmpVehicleData }, + _gearboxData = GenericTransmissionComponentData.Instance.CreateGearboxData(PrimaryVehicle, + new VectoRunData() { EngineData = _combustionEngineData, AxleGearData = _axlegearData, VehicleData = tmpVehicleData }, null); - - _gearshiftData = DataAdapterPrimary.CreateGearshiftData( + _gearshiftData = DataAdapterGeneric.CreateGearshiftData( _gearboxData, _axlegearData.AxleGear.Ratio * (_angledriveData?.Angledrive.Ratio ?? 1.0), _combustionEngineData.IdleSpeed); + _retarderData = GenericBusRetarderData.Instance.CreateGenericBusRetarderData(PrimaryVehicle.Components.RetarderInputData); - var primaryBusAuxiliaries = primaryVehicle.Components.BusAuxiliaries; - - _alternatorMap = new SimpleAlternator( - DataAdapterPrimary.CalculateAlternatorEfficiency(primaryBusAuxiliaries.ElectricSupply.Alternators - .Concat(vehicle.Components.BusAuxiliaries.ElectricSupply.Alternators).ToList())); - - _compressorMap = DataAdapterPrimary.GetCompressorMap(primaryBusAuxiliaries.PneumaticSupply.CompressorSize, - primaryBusAuxiliaries.PneumaticSupply.Clutch); - - var retarderType = primaryVehicle.Components.RetarderInputData.Type; - _consumersDeclarationData = DataAdapterPrimary.CreatePneumaticAuxConfig(retarderType); - - _retarderData = - DeclarationData.FactorMethodBus.CreateRetarderData(primaryVehicle.Components.RetarderInputData); - - _driverData = new GenericBusDriverData().CreateGenericBusDriverData(_segment); + _driverData = DataAdapterGeneric.CreateDriverData(); + _driverData.AccelerationCurve = AccelerationCurveReader.ReadFromStream(_segmentCompletedBus.AccelerationFile); } protected virtual IEnumerable<VectoRunData> GetNextRun() @@ -187,22 +140,20 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl private IEnumerable<VectoRunData> VectoRunDataHeavyBusCompleted() { - var completedVehicle = InputDataProvider.JobInputData.Vehicle; - var primaryVehicle = InputDataProvider.PrimaryVehicleData.Vehicle; - foreach (var mission in _segment.Missions) { + foreach (var mission in _segmentCompletedBus.Missions) { foreach (var loading in mission.Loadings) { - var simulationRunData = CreateVectoRunDataSpecific(primaryVehicle, completedVehicle, mission, loading); + var simulationRunData = CreateVectoRunDataSpecific(mission, loading); if (simulationRunData != null) { yield return simulationRunData; } - var primarySegment = GetPrimarySegment(primaryVehicle); + var primarySegment = GetPrimarySegment(PrimaryVehicle); var primaryMission = primarySegment.Missions.Where( m => { - return m.BusParameter.DoubleDecker == completedVehicle.VehicleCode.IsDoubleDeckBus() && + return m.BusParameter.DoubleDecker == CompletedVehicle.VehicleCode.IsDoubleDeckerBus() && m.MissionType == mission.MissionType; }).First(); - simulationRunData = CreateVectoRunDataGeneric(primaryVehicle, completedVehicle, primaryMission, loading); + simulationRunData = CreateVectoRunDataGeneric(primaryMission, loading, primarySegment); yield return simulationRunData; } } @@ -214,7 +165,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl var primarySegment = DeclarationData.PrimaryBusSegments.Lookup( primaryVehicle.VehicleCategory, primaryVehicle.AxleConfiguration, primaryVehicle.Articulated, - primaryVehicle.FloorType, completedVehicle.VehicleCode.IsDoubleDeckBus()); + primaryVehicle.FloorType, completedVehicle.VehicleCode.IsDoubleDeckerBus()); return primarySegment; } @@ -241,9 +192,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl } - protected VectoRunData CreateVectoRunDataSpecific( - IVehicleDeclarationInputData primaryVehicle, IVehicleDeclarationInputData completedVehicle, - Mission mission, KeyValuePair<LoadingType, Kilogram> loading) + protected VectoRunData CreateVectoRunDataSpecific(Mission mission, KeyValuePair<LoadingType, Kilogram> loading) { DrivingCycleData cycle; lock (CyclesCacheLock) { @@ -254,105 +203,42 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl CyclesCache.Add(mission.MissionType, cycle); } } - - - //var mergedBusAux = new CombinedBusAuxiliaries( - // primaryVehicle.Components.BusAuxiliaries, completedVehicle.Components.BusAuxiliaries); - - //var simulationRunData = new VectoRunData { - // Loading = loading.Key, - // VehicleData = DataAdapterCompleted.CreateVehicleData(primaryVehicle, mission, loading), - // AirdragData = DataAdapterCompleted.CreateAirdragData(null, mission, new Segment()), - // EngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle.Components.EngineInputData), - // GearboxData = _gearboxData, - // AxleGearData = _axlegearData, - // AngledriveData = _angledriveData, - // Aux = DataAdapterCompleted.CreateAuxiliaryData( - // primaryVehicle.Components.AuxiliaryInputData, - // mergedBusAux, mission.MissionType, _segment.VehicleClass, - // primaryVehicle.Length ?? mission.BusParameter.VehicleLength), - // Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), - // Retarder = _retarderData, - // DriverData = _driverdata, - // ExecutionMode = ExecutionMode.Declaration, - // JobName = InputDataProvider.JobInputData.JobName, - // ModFileSuffix = "_specific_" + mission.BusParameter.BusGroup.GetClassNumber() + "_" + loading.Key.ToString(), - // Report = Report, - // Mission = mission, - // InputDataHash = InputDataProvider.XMLHash, - // SimulationType = SimulationType.DistanceCycle, - // GearshiftParameters = _gearshiftData, - // ShiftStrategy = InputDataProvider.JobInputData.ShiftStrategy - //}; - //simulationRunData.EngineData.FuelMode = 0; - //simulationRunData.VehicleData.VehicleClass = _segment.VehicleClass; - //simulationRunData.BusAuxiliaries = DataAdapterPrimary.CreateBusAuxiliariesData( - // mission, InputDataProvider.JobInputData.Vehicle, simulationRunData); - //return simulationRunData; - - var primaryBusAuxiliaries = primaryVehicle.Components.BusAuxiliaries; + + var simulationRunData = new VectoRunData { - Loading = loading.Key, - VehicleData = DataAdapterCompleted.CreateVehicleData(primaryVehicle, completedVehicle, - mission, loading, _tmpVehicleData.DynamicTyreRadius), - AirdragData = DataAdapterCompleted.CreateAirdragData(completedVehicle, mission), + VehicleData = DataAdapterSpecific.CreateVehicleData(PrimaryVehicle, CompletedVehicle, + mission, loading), + AirdragData = DataAdapterSpecific.CreateAirdragData(CompletedVehicle, mission), EngineData = _combustionEngineData, GearboxData = _gearboxData, AxleGearData = _axlegearData, AngledriveData = _angledriveData, + Aux = DataAdapterSpecific.CreateAuxiliaryData(PrimaryVehicle.Components.AuxiliaryInputData, + PrimaryVehicle.Components.BusAuxiliaries, mission.MissionType, _segmentCompletedBus.VehicleClass, CompletedVehicle.Length), + Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), + Retarder = _retarderData, + DriverData = _driverData, + ExecutionMode = ExecutionMode.Declaration, + JobName = InputDataProvider.JobInputData.JobName, + ModFileSuffix = "_" + _segmentCompletedBus.VehicleClass.GetClassNumber() + "-Specific_" + loading.Key.ToString(), + Report = Report, + Mission = mission, + InputDataHash = InputDataProvider.XMLHash, + SimulationType = SimulationType.DistanceCycle, + GearshiftParameters = _gearshiftData, - Aux = DataAdapterPrimary.CreateAuxiliaryData(primaryVehicle.Components.AuxiliaryInputData, - primaryBusAuxiliaries, mission.MissionType, _segment.VehicleClass, - completedVehicle.Length) - }; - - var auxiliaryConfig = new AuxiliaryConfig { - ElectricalUserInputsConfig = DataAdapterCompleted.CreateElectricsUserInputsConfig( - primaryBusAuxiliaries, completedVehicle, mission, _alternatorMap), - - PneumaticUserInputsConfig = DataAdapterCompleted.CreatePneumaticUserInputsConfig( - primaryBusAuxiliaries, completedVehicle, _compressorMap), - - PneumaticAuxillariesConfig = _consumersDeclarationData }; - - auxiliaryConfig.SSMInputs = GetCompletedSSMInput(mission, completedVehicle, primaryBusAuxiliaries, loading); - - simulationRunData.BusAuxiliaries = auxiliaryConfig; - - simulationRunData.Retarder = _retarderData; - - simulationRunData.DriverData = _driverData; - - simulationRunData.Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()); + simulationRunData.EngineData.FuelMode = 0; + simulationRunData.VehicleData.VehicleClass = _segmentCompletedBus.VehicleClass; + simulationRunData.BusAuxiliaries = DataAdapterSpecific.CreateBusAuxiliariesData(mission, PrimaryVehicle, CompletedVehicle, simulationRunData); return simulationRunData; } - private SSMInputs GetCompletedSSMInput(Mission mission, IVehicleDeclarationInputData completedVehicle, - IBusAuxiliariesDeclarationData primaryBusAux, KeyValuePair<LoadingType, Kilogram> loading) - { - var ssmInputs = new SSMInputs(null); - DataAdapterCompleted.SetSSMBusParameters(ssmInputs, completedVehicle, mission, loading); - - ssmInputs.Technologies = DataAdapterCompleted.CreateTechnologyBenefits(completedVehicle, - primaryBusAux, DataAdapterPrimary); - - DeclarationData.FactorMethodBus.SetBoundaryConditions(ssmInputs); - DeclarationData.FactorMethodBus.SetEnvironmentalConditions(ssmInputs); - - DataAdapterCompleted.SetSSMInputs(ssmInputs, mission, loading, completedVehicle); - - return ssmInputs; - } - - - - protected VectoRunData CreateVectoRunDataGeneric( - IVehicleDeclarationInputData primaryVehicle, IVehicleDeclarationInputData completedVehicle, - Mission mission, KeyValuePair<LoadingType, Kilogram> loading) + + protected VectoRunData CreateVectoRunDataGeneric(Mission mission, KeyValuePair<LoadingType, Kilogram> loading, Segment primarySegment) { DrivingCycleData cycle; lock (CyclesCacheLock) { @@ -364,66 +250,33 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl } } - //var simulationRunData = new VectoRunData { - // Loading = loading.Key, - // VehicleData = DataAdapterPrimary.CreateVehicleData(primaryVehicle, mission, loading), - // AirdragData = DataAdapterPrimary.CreateAirdragData(null, mission, new Segment()), - // EngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle.Components.EngineInputData), - // GearboxData = _gearboxData, - // AxleGearData = _axlegearData, - // AngledriveData = _angledriveData, - // Aux = DataAdapterPrimary.CreateAuxiliaryData( - // primaryVehicle.Components.AuxiliaryInputData, - // completedVehicle.Components.BusAuxiliaries, mission.MissionType, _segment.VehicleClass, - // primaryVehicle.Length ?? mission.BusParameter.VehicleLength), - // Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), - // Retarder = _retarderData, - // DriverData = _driverdata, - // ExecutionMode = ExecutionMode.Declaration, - // JobName = InputDataProvider.JobInputData.JobName, - // ModFileSuffix = "_generic_" + mission.BusParameter.BusGroup.GetClassNumber() + "_" + loading.Key.ToString(), - // Report = Report, - // Mission = mission, - // InputDataHash = InputDataProvider.XMLHash, - // SimulationType = SimulationType.DistanceCycle, - // GearshiftParameters = _gearshiftData, - // ShiftStrategy = InputDataProvider.JobInputData.ShiftStrategy - //}; - //simulationRunData.EngineData.FuelMode = 0; - //simulationRunData.VehicleData.VehicleClass = _segment.VehicleClass; - //simulationRunData.BusAuxiliaries = DataAdapterPrimary.CreateBusAuxiliariesData( - // mission, InputDataProvider.JobInputData.Vehicle, simulationRunData); - //return simulationRunData; - - var primarySegment = GetPrimarySegment(primaryVehicle); - var primaryBusAuxiliaries = primaryVehicle.Components.BusAuxiliaries; + var primaryBusAuxiliaries = PrimaryVehicle.Components.BusAuxiliaries; var simulationRunData = new VectoRunData { Loading = loading.Key, - VehicleData = DataAdapterPrimary.CreateVehicleData(primaryVehicle, mission, loading, - _tmpVehicleData.DynamicTyreRadius), - AirdragData = DataAdapterPrimary.CreateAirdragData(null, mission, new Segment()), + VehicleData = DataAdapterGeneric.CreateVehicleData(PrimaryVehicle, mission, loading), + AirdragData = DataAdapterGeneric.CreateAirdragData(null, mission, new Segment()), EngineData = _combustionEngineData, GearboxData = _gearboxData, AxleGearData = _axlegearData, AngledriveData = _angledriveData, GearshiftParameters = _gearshiftData, - Aux = DataAdapterPrimary.CreateAuxiliaryData(primaryVehicle.Components.AuxiliaryInputData, + Aux = DataAdapterGeneric.CreateAuxiliaryData(PrimaryVehicle.Components.AuxiliaryInputData, primaryBusAuxiliaries, mission.MissionType, primarySegment.VehicleClass, - completedVehicle.Length) + CompletedVehicle.Length) }; var auxiliaryConfig = new AuxiliaryConfig { - ElectricalUserInputsConfig = DataAdapterPrimary.CreateElectricalUserInputsConfig( - primaryVehicle, _alternatorMap, mission), + ElectricalUserInputsConfig = DataAdapterGeneric.CreateElectricalUserInputsConfig( + PrimaryVehicle, _alternatorMap, mission), - PneumaticUserInputsConfig = DataAdapterPrimary.CreatePneumaticUserInputsConfig( + PneumaticUserInputsConfig = DataAdapterGeneric.CreatePneumaticUserInputsConfig( primaryBusAuxiliaries, _compressorMap), PneumaticAuxillariesConfig = _consumersDeclarationData }; - auxiliaryConfig.SSMInputs = GetPrimaryVehicleSSMInput(mission, primaryVehicle); + auxiliaryConfig.SSMInputs = GetPrimaryVehicleSSMInput(mission, PrimaryVehicle); simulationRunData.BusAuxiliaries = auxiliaryConfig; @@ -442,14 +295,14 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl { var ssmInputs = new SSMInputs(null); - DataAdapterPrimary.SetSSMBusParameters(ssmInputs, mission); + DataAdapterGeneric.SetSSMBusParameters(ssmInputs, mission); - ssmInputs.Technologies = DataAdapterPrimary.CreateTechnologyBenefits(mission, primaryVehicle); + ssmInputs.Technologies = DataAdapterGeneric.CreateTechnologyBenefits(mission, primaryVehicle); DeclarationData.FactorMethodBus.SetBoundaryConditions(ssmInputs); DeclarationData.FactorMethodBus.SetEnvironmentalConditions(ssmInputs); - DataAdapterPrimary.SetSSMInputs(ssmInputs, mission); + DataAdapterGeneric.SetSSMInputs(ssmInputs, mission); return ssmInputs; } diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeSingleBusVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeSingleBusVectoRunDataFactory.cs index 1de28a85f0d94c07d905c1c0e030c74a1966a214..8a1d561bb4f63cf1977634197c636ca4b4765d4c 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeSingleBusVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeSingleBusVectoRunDataFactory.cs @@ -30,7 +30,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl { protected override VectoRunData CreateVectoRunData(IVehicleDeclarationInputData vehicle, int modeIdx, Mission mission, KeyValuePair<LoadingType, Kilogram> loading) { - var doubleDecker = _singleBusInputData.CompletedVehicle.NuberOfPassengersUpperDeck > 0; + var doubleDecker = _singleBusInputData.CompletedVehicle.NumberOfPassengersUpperDeck > 0; if (mission.BusParameter.DoubleDecker != doubleDecker) { return null; } diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs index 307b67cced36c8baaa1e4da493c5a17f04fed69b..079964e83be8668b3bbbaa065c070b99baa3f002 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json; using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.InputData.Reader.Impl @@ -44,6 +45,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl Entries = cycle.Entries; } + [JsonIgnore] public List<DrivingCycleData.DrivingCycleEntry> Entries { get; private set; } public string Name { get; private set; } diff --git a/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs b/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs index 28bf5152c5e1266cad717e473d170738852286b6..d8202f72ca634d097f19673e7d57419fb47cee02 100644 --- a/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs +++ b/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs @@ -136,7 +136,7 @@ namespace TUGraz.VectoCore.Models.Declaration PassengerDensity = row.ParseDouble(missionType.ToString()).SI<PerSquareMeter>(), AirDragMeasurementAllowed = row.ParseBoolean("airdragmeasurement"), VehicleEquipment = GetVehicleEquipment(row), - DoubleDecker = VehicleCodeHelper.Parse(row.Field<string>("vehiclecode")).IsDoubleDeckBus(), + DoubleDecker = VehicleCodeHelper.Parse(row.Field<string>("vehiclecode")).IsDoubleDeckerBus(), DeltaHeight = row.ParseDouble("deltaheight").SI<Meter>() } }; diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 59f3421862c0586cd3ee746e5ba4899c35b59604..3c570f577e9eff50b85949805222157a840f4473 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -82,8 +82,6 @@ namespace TUGraz.VectoCore.Models.Declaration public static readonly ElectricSystem ElectricSystem = new ElectricSystem(); public static readonly Fan Fan = new Fan(); - public static readonly GenericBusEngineData GenericBusEngineData = new GenericBusEngineData(); - public static readonly GenericBusAxelgearData GenericBusAxelgearData = new GenericBusAxelgearData(); public static readonly GenericBusAngledriveData GenericBusAngledriveData = new GenericBusAngledriveData(); public static readonly GenericBusRetarderData GenericBusRetarderData = new GenericBusRetarderData(); @@ -153,100 +151,9 @@ namespace TUGraz.VectoCore.Models.Declaration public static string GenericTorqueConvert = $"{DeclarationDataResourcePrefix}.GenericBusData.GenericTorqueConverter.csv"; - - #endregion - - #region Create Engine Data - - public static CombustionEngineData CreateBusEngineData(IVehicleDeclarationInputData pifVehicle) - { - return GenericBusEngineData.CreateGenericBusEngineData(pifVehicle); - } - - #endregion - - #region Create Axlegear Data - - public static AxleGearData CreateAxlegearData(IAxleGearInputData axlegearData) - { - return GenericBusAxelgearData.CreateGenericBusAxlegearData(axlegearData); - } - - #endregion - - #region Create Angledrive Data - - public static AngledriveData CreateAngledriveData(IAngledriveInputData angledriveInputData, double axleRatio) - { - return GenericBusAngledriveData.CreateGenericBusAngledriveData(angledriveInputData, axleRatio, - GenericBusAxelgearData.AxleGearInputLossMap); - } - - #endregion - - #region Create Gearbox Data - - public static GearboxData CreateGearboxData(IVehicleDeclarationInputData pifVehicle, VectoRunData runData, - IShiftPolygonCalculator shiftPolygonCalc) - { - return DeclarationDataAdapterHeavyLorry.DoCreateGearboxData(pifVehicle, runData, shiftPolygonCalc); - } - - - #endregion - - # region SSMInputs Methods - - public static void SetBoundaryConditions(SSMInputs input) - { - input.GFactor = Constants.BusAuxiliaries.SteadyStateModel.GFactor; - input.HeatingBoundaryTemperature = Constants.BusAuxiliaries.SteadyStateModel.HeatingBoundaryTemperature; - input.CoolingBoundaryTemperature = Constants.BusAuxiliaries.SteadyStateModel.CoolingBoundaryTemperature; - input.SpecificVentilationPower = Constants.BusAuxiliaries.SteadyStateModel.SpecificVentilationPower; - input.AuxHeaterEfficiency = Constants.BusAuxiliaries.SteadyStateModel.AuxHeaterEfficiency; - input.MaxPossibleBenefitFromTechnologyList = - Constants.BusAuxiliaries.SteadyStateModel.MaxPossibleBenefitFromTechnologyList; - } - - public static void SetEnvironmentalConditions(SSMInputs input) - { - input.DefaultConditions = new EnvironmentalConditionMapEntry( - Constants.BusAuxiliaries.SteadyStateModel.DefaultTemperature, - Constants.BusAuxiliaries.SteadyStateModel.DefaultSolar, 1.0); - input.EnvironmentalConditionsMap = DeclarationData.BusAuxiliaries.DefaultEnvironmentalConditions; - } - - #endregion - - #region Create Retarder - - public static RetarderData CreateRetarderData(IRetarderInputData retarderInput) - { - return GenericBusRetarderData.CreateGenericBusRetarderData(retarderInput); - } #endregion - #region Common Getters - - public static Meter GetDynamicTyreRadius(IVehicleDeclarationInputData primaryVehicle) - { - var axleWheels = primaryVehicle.Components.AxleWheels.AxlesDeclaration; - Meter dynamicTyreRadius = null; - - for (int i = 0; i < axleWheels.Count; i++) - { - if (axleWheels[i].AxleType == AxleType.VehicleDriven) - { - dynamicTyreRadius = DeclarationData.Wheels.Lookup(axleWheels[i].Tyre.Dimension.RemoveWhitespace()).DynamicTyreRadius; - break; - } - } - - return dynamicTyreRadius; - } - - #endregion } diff --git a/VectoCore/VectoCore/Models/Declaration/GenericBusAngledriveData.cs b/VectoCore/VectoCore/Models/Declaration/GenericBusAngledriveData.cs deleted file mode 100644 index d92d0ed3ed5a0288e05aeb547cae0e779a682e93..0000000000000000000000000000000000000000 --- a/VectoCore/VectoCore/Models/Declaration/GenericBusAngledriveData.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Data; -using TUGraz.VectoCommon.InputData; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public class GenericBusAngledriveData - { - public AngledriveData CreateGenericBusAngledriveData(IAngledriveInputData angledriveInputData, double axleRatio, - DataTable axleGearInputLossMap) - { - if (angledriveInputData.DataSource.SourceFile == null) - return null; - - var angledriveData = new AngledriveData - { - Type = angledriveInputData.Type, - InputData = angledriveInputData - }; - - var transmissionAngleDrive = new TransmissionData - { - Ratio = angledriveInputData.Ratio, - LossMap = GetAngleDriveLossMap(axleGearInputLossMap, angledriveInputData.Ratio) - }; - - angledriveData.Angledrive = transmissionAngleDrive; - - return angledriveData; - } - - private TransmissionLossMap GetAngleDriveLossMap(DataTable axleGearInputTable, double ratio) - { - var angleDriveLossMap = new DataTable(); - angleDriveLossMap.Columns.Add(TransmissionLossMapReader.Fields.InputSpeed); - angleDriveLossMap.Columns.Add(TransmissionLossMapReader.Fields.InputTorque); - angleDriveLossMap.Columns.Add(TransmissionLossMapReader.Fields.TorqeLoss); - - var angleDriveFactor = Constants.GenericLossMapSettings.FactorAngleDrive; - foreach (DataRow row in axleGearInputTable.Rows) - { - var inputSpeed = row[0].ToString().ToDouble(); - var inputTorque = row[1].ToString().ToDouble(); - var inputTorqueLoss = row[2].ToString().ToDouble() * angleDriveFactor; - - var newRow = angleDriveLossMap.NewRow(); - newRow[0] = inputSpeed; - newRow[1] = inputTorque; - newRow[2] = inputTorqueLoss; - angleDriveLossMap.Rows.Add(newRow); - } - - return TransmissionLossMapReader.Create(angleDriveFactor, ratio, "AngleDrive"); - } - } -} diff --git a/VectoCore/VectoCore/Models/Declaration/GenericBusEngineData.cs b/VectoCore/VectoCore/Models/Declaration/GenericBusEngineData.cs index 0508826008ceb6249e11f5d2feeed40f377269e1..b84709cd7c7c09c31a227508bfa8040c215ee45f 100644 --- a/VectoCore/VectoCore/Models/Declaration/GenericBusEngineData.cs +++ b/VectoCore/VectoCore/Models/Declaration/GenericBusEngineData.cs @@ -24,23 +24,34 @@ namespace TUGraz.VectoCore.Models.Declaration private static string GenericEngineCM_Normed_PI = $"{DeclarationData.DeclarationDataResourcePrefix}.GenericBusData.EngineConsumptionMap_PI_Normed.vmap"; + private static GenericBusEngineData _instance; + + public static GenericBusEngineData Instance + { + get { return _instance ?? (_instance = new GenericBusEngineData()); } + } + #endregion - public CombustionEngineData CreateGenericBusEngineData(IVehicleDeclarationInputData pifVehicle) + protected GenericBusEngineData() + { + + } + + public CombustionEngineData CreateGenericBusEngineData(IVehicleDeclarationInputData primaryVehicle) { - var enginePif = pifVehicle.Components.EngineInputData; - var gearbox = pifVehicle.Components.GearboxInputData; + var engineData = primaryVehicle.Components.EngineInputData; + var gearbox = primaryVehicle.Components.GearboxInputData; var engine = new CombustionEngineData(); - var limits = pifVehicle.TorqueLimits.ToDictionary(e => e.Gear); + var limits = primaryVehicle.TorqueLimits.ToDictionary(e => e.Gear); var numGears = gearbox.Gears.Count; var fullLoadCurves = new Dictionary<uint, EngineFullLoadCurve>(numGears + 1); - fullLoadCurves[0] = FullLoadCurveReader.Create(enginePif.EngineModes.First().FullLoadCurve, true); + fullLoadCurves[0] = FullLoadCurveReader.Create(engineData.EngineModes.First().FullLoadCurve, true); fullLoadCurves[0].EngineData = engine; - foreach (var gear in gearbox.Gears) - { + foreach (var gear in gearbox.Gears) { var maxTorque = VectoMath.Min( DeclarationDataAdapterHeavyLorry.GbxMaxTorque(gear, numGears, fullLoadCurves[0].MaxTorque), DeclarationDataAdapterHeavyLorry.VehMaxTorque(gear, numGears, limits, fullLoadCurves[0].MaxTorque)); @@ -48,16 +59,17 @@ namespace TUGraz.VectoCore.Models.Declaration } engine.FullLoadCurves = fullLoadCurves; - engine.IdleSpeed = enginePif.EngineModes[0].IdleSpeed; - engine.Displacement = enginePif.Displacement; + engine.IdleSpeed = engineData.EngineModes[0].IdleSpeed; + engine.Displacement = engineData.Displacement; - var fuel = GetCombustionEngineFuelData(pifVehicle, fullLoadCurves[0]); + var fuel = GetCombustionEngineFuelData(primaryVehicle, fullLoadCurves[0]); engine.WHRType = WHRType.None; engine.Fuels = new List<CombustionEngineFuelData> { fuel }; engine.Inertia = DeclarationData.Engine.EngineInertia(engine.Displacement, gearbox.Type); + engine.EngineStartTime = DeclarationData.Engine.DefaultEngineStartTime; return engine; } @@ -88,19 +100,23 @@ namespace TUGraz.VectoCore.Models.Declaration var ressourceId = GetEngineRessourceId(vehiclePif); var nIdle = vehiclePif.Components.EngineInputData.RatedSpeedDeclared.AsRPM; - var nRated = fullLoadCurve.RatedSpeed.Value(); - var mRated = fullLoadCurve.MaxTorque.Value(); + var ratedSpeed = fullLoadCurve.RatedSpeed.Value(); + var maxTorque = fullLoadCurve.MaxTorque.Value(); - var denormalizedData = DenormalizeData(ressourceId, nIdle, nRated, mRated); + var denormalizedData = DenormalizeData(ressourceId, nIdle, ratedSpeed, maxTorque); var engineSpeed = denormalizedData.AsEnumerable().Select(r => r.Field<string>(FuelConsumptionMapReader.Fields.EngineSpeed).ToDouble()).ToArray(); var clusterResult = new MeanShiftClustering().FindClusters(engineSpeed, 1); - - for (int i = 0; i < clusterResult.Length; i++) { - var currentTorque = fullLoadCurve.DragLoadStationaryTorque(clusterResult[i].RPMtoRad()).Value(); - SetDragLoadFuelConsumption(denormalizedData, clusterResult[i], currentTorque); + + foreach (var entry in clusterResult) { + var dragTorque = fullLoadCurve.DragLoadStationaryTorque(entry.RPMtoRad()).Value(); + var newRow = denormalizedData.NewRow(); + newRow[FuelConsumptionMapReader.Fields.EngineSpeed] = entry; + newRow[FuelConsumptionMapReader.Fields.Torque] = dragTorque; + newRow[FuelConsumptionMapReader.Fields.FuelConsumption] = 0; + denormalizedData.Rows.Add(newRow); } var fcMap = FuelConsumptionMapReader.Create(denormalizedData); @@ -118,38 +134,22 @@ namespace TUGraz.VectoCore.Models.Declaration return fuel; } - private void SetDragLoadFuelConsumption(DataTable currentDataTable, double engineSpeed, double torque) - { - for (int i = 0; i < currentDataTable.Rows.Count; i++) { - var currentRowSpeed = currentDataTable.Rows[i] - [FuelConsumptionMapReader.Fields.EngineSpeed].ToString().ToDouble(); - - if (currentRowSpeed.IsEqual(engineSpeed)) { - var newRow = currentDataTable.NewRow(); - newRow[FuelConsumptionMapReader.Fields.EngineSpeed] = engineSpeed; - newRow[FuelConsumptionMapReader.Fields.Torque] = torque; - newRow[FuelConsumptionMapReader.Fields.FuelConsumption] = 0; - currentDataTable.Rows.InsertAt(newRow, i); - break; - } - } - } - private DataTable DenormalizeData(string ressourceId, double nIdle, double nRated, double mRated) + private DataTable DenormalizeData(string ressourceId, double nIdle, double ratedSpeed, double maxTorque) { - var normedData = VectoCSVFile.ReadStream(RessourceHelper.ReadStream(ressourceId), source: ressourceId); + var normalized = VectoCSVFile.ReadStream(RessourceHelper.ReadStream(ressourceId), source: ressourceId); var result = new DataTable(); result.Columns.Add(FuelConsumptionMapReader.Fields.EngineSpeed); result.Columns.Add(FuelConsumptionMapReader.Fields.Torque); result.Columns.Add(FuelConsumptionMapReader.Fields.FuelConsumption); - foreach (DataRow row in normedData.Rows) + foreach (DataRow row in normalized.Rows) { var engineSpeed = DenormalizeEngineSpeed((string)row[FuelConsumptionMapReader.Fields.EngineSpeed], - nIdle, nRated); - var torque = DenormalizeTorque((string)row[FuelConsumptionMapReader.Fields.Torque], mRated); - var fc = DenormalizeFC((string)row[FuelConsumptionMapReader.Fields.FuelConsumption], mRated); + nIdle, ratedSpeed); + var torque = DenormalizeTorque((string)row[FuelConsumptionMapReader.Fields.Torque], maxTorque); + var fc = DenormalizeFC((string)row[FuelConsumptionMapReader.Fields.FuelConsumption], maxTorque); var newRow = result.NewRow(); newRow[FuelConsumptionMapReader.Fields.EngineSpeed] = engineSpeed; diff --git a/VectoCore/VectoCore/Models/Declaration/GenericBusRetarderData.cs b/VectoCore/VectoCore/Models/Declaration/GenericBusRetarderData.cs index 865975904fa460ae945c5b707c29e313fa8123f5..71045db06addffa96ae93cf469061b711d3848ab 100644 --- a/VectoCore/VectoCore/Models/Declaration/GenericBusRetarderData.cs +++ b/VectoCore/VectoCore/Models/Declaration/GenericBusRetarderData.cs @@ -1,6 +1,8 @@ using System; using System.Data; +using System.ServiceModel; using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.Models.SimulationComponent.Data; @@ -9,10 +11,20 @@ namespace TUGraz.VectoCore.Models.Declaration { public class GenericBusRetarderData { + private static GenericBusRetarderData _instance; + + public static GenericBusRetarderData Instance + { + get { return _instance ?? (_instance = new GenericBusRetarderData()); } + } + + protected GenericBusRetarderData() { } + public RetarderData CreateGenericBusRetarderData(IRetarderInputData retarderInput) { - if (retarderInput == null) - return null; + if (retarderInput == null) { + return new RetarderData {Type =RetarderType.None}; + } var retarder = new RetarderData { diff --git a/VectoCore/VectoCore/Models/Declaration/GenericBusAxelgearData.cs b/VectoCore/VectoCore/Models/Declaration/GenericTransmissionComponentData.cs similarity index 55% rename from VectoCore/VectoCore/Models/Declaration/GenericBusAxelgearData.cs rename to VectoCore/VectoCore/Models/Declaration/GenericTransmissionComponentData.cs index d52f7643efe13555466dc45976bd14cd0feab57c..07a38add3a23edb73a212efbbc9690265f814a20 100644 --- a/VectoCore/VectoCore/Models/Declaration/GenericBusAxelgearData.cs +++ b/VectoCore/VectoCore/Models/Declaration/GenericTransmissionComponentData.cs @@ -2,17 +2,37 @@ using System.Data; using System.Runtime.CompilerServices; using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; namespace TUGraz.VectoCore.Models.Declaration { - public class GenericBusAxelgearData + public class GenericTransmissionComponentData { - public DataTable AxleGearInputLossMap { get; private set; } + private static GenericTransmissionComponentData _instance; + + public static GenericTransmissionComponentData Instance + { + get { return _instance ?? (_instance = new GenericTransmissionComponentData()); } + } + + protected GenericTransmissionComponentData () { } + + //public DataTable AxleGearInputLossMap { get; private set; } + + public GearboxData CreateGearboxData( + IVehicleDeclarationInputData pifVehicle, VectoRunData runData, + IShiftPolygonCalculator shiftPolygonCalc) + { + return DeclarationDataAdapterHeavyLorry.DoCreateGearboxData(pifVehicle, runData, shiftPolygonCalc); + } public AxleGearData CreateGenericBusAxlegearData(IAxleGearInputData axlegearData) { @@ -25,12 +45,12 @@ namespace TUGraz.VectoCore.Models.Declaration var ratio = axlegearData.Ratio; var outputLossMap = CreateAxlegearOutputLossMap(ratio); - AxleGearInputLossMap = CalculateAxleInputLossMap(outputLossMap, ratio); + var axleGearInputLossMap = CalculateAxleInputLossMap(outputLossMap, ratio, 1.0); var transmissionData = new TransmissionData { Ratio = axlegearData.Ratio, - LossMap = TransmissionLossMapReader.Create(AxleGearInputLossMap, ratio, "Axlegear") + LossMap = TransmissionLossMapReader.Create(axleGearInputLossMap, ratio, "Axlegear") }; axleGear.AxleGear = transmissionData; @@ -38,6 +58,29 @@ namespace TUGraz.VectoCore.Models.Declaration return axleGear; } + public AngledriveData CreateGenericBusAngledriveData(IAngledriveInputData angledriveData) + { + if (angledriveData == null || angledriveData.Type == AngledriveType.None || angledriveData.Type == AngledriveType.LossesIncludedInGearbox) { + return null; + } + + var axleGear = new AngledriveData() { + InputData = angledriveData + }; + + var outputLossMap = CreateAxlegearOutputLossMap(angledriveData.Ratio); + var axleGearInputLossMap = CalculateAxleInputLossMap(outputLossMap, angledriveData.Ratio, Constants.GenericLossMapSettings.FactorAngleDrive); + + var transmissionData = new TransmissionData { + Ratio = angledriveData.Ratio, + LossMap = TransmissionLossMapReader.Create(axleGearInputLossMap, angledriveData.Ratio, "Angledrive") + }; + + axleGear.Angledrive = transmissionData; + + return axleGear; + } + private DataTable CreateAxlegearOutputLossMap(double axleRatio) { var torques = new[] { @@ -47,14 +90,11 @@ namespace TUGraz.VectoCore.Models.Declaration Constants.GenericLossMapSettings.OutputTorqueEnd }; - var outStart = Constants.GenericLossMapSettings.OutputSpeedStart; - var outEnd = Constants.GenericLossMapSettings.OutputSpeedEnd; - var outputSpeeds = new[] { - 0, 0, 0, 0, - outStart, outStart,outStart, outStart, - outEnd, outEnd, outEnd, outEnd - }; + 0, + Constants.GenericLossMapSettings.OutputSpeedStart, + Constants.GenericLossMapSettings.OutputSpeedEnd + }; var td0 = Constants.GenericLossMapSettings.T0 + axleRatio * Constants.GenericLossMapSettings.T1; @@ -64,33 +104,24 @@ namespace TUGraz.VectoCore.Models.Declaration var td_n = Constants.GenericLossMapSettings.Td_n; var efficiency = Constants.GenericLossMapSettings.Efficiency; - var torqueIndex = 0; - - var lossMap = new DataTable(); lossMap.Columns.Add("output speed"); lossMap.Columns.Add("output torque"); lossMap.Columns.Add("output torque loss"); - for (int i = 0; i < 12; i++) - { - if (i % 4 == 0) - torqueIndex = 0; - - var calculationSpeed = outputSpeeds[i].IsEqual(0) - ? outputSpeeds[4] - : outputSpeeds[i]; - - var torque = torques[torqueIndex++]; - - var newRow = lossMap.NewRow(); - newRow[lossMap.Columns[0]] = outputSpeeds[i]; - newRow[lossMap.Columns[1]] = torque; - newRow[lossMap.Columns[2]] = - CalculateOutputTorqueLoss(td0_, td150_, td_n, calculationSpeed, torque, efficiency); - - lossMap.Rows.Add(newRow); - + foreach (var outputSpeed in outputSpeeds) { + foreach (var torque in torques) { + var calculationSpeed = outputSpeed.IsEqual(0) + ? Constants.GenericLossMapSettings.OutputSpeedStart + : outputSpeed; + + var newRow = lossMap.NewRow(); + newRow[lossMap.Columns[0]] = outputSpeed; + newRow[lossMap.Columns[1]] = torque; + newRow[lossMap.Columns[2]] = CalculateOutputTorqueLoss(td0_, td150_, td_n, calculationSpeed, torque, efficiency); + + lossMap.Rows.Add(newRow); + } } return lossMap; @@ -105,7 +136,7 @@ namespace TUGraz.VectoCore.Models.Declaration return td0_ + td150_ * outputspeed / td_n + ouputTorque / efficiency - ouputTorque; } - private DataTable CalculateAxleInputLossMap(DataTable outputLossMap, double axleRatio) + private DataTable CalculateAxleInputLossMap(DataTable outputLossMap, double axleRatio, double lossCorrectionFactor) { var inputLossMap = new DataTable(); @@ -122,7 +153,7 @@ namespace TUGraz.VectoCore.Models.Declaration var newRow = inputLossMap.NewRow(); newRow[0] = GetInputSpeed(outputSpeed, axleRatio); newRow[1] = GetInputTorque(outputTorque, outputLoss, axleRatio); - newRow[2] = GetInputTorqueLoss(outputLoss, axleRatio); + newRow[2] = GetInputTorqueLoss(outputLoss, axleRatio, lossCorrectionFactor); inputLossMap.Rows.Add(newRow); } @@ -142,9 +173,9 @@ namespace TUGraz.VectoCore.Models.Declaration } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private double GetInputTorqueLoss(double outputLoss, double iAxle) + private double GetInputTorqueLoss(double outputLoss, double iAxle, double lossCorrectionFactor) { - return outputLoss / iAxle; + return outputLoss / iAxle * lossCorrectionFactor; } } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs index a1a86308d60df681489958254b4df4e09829c623..84f0dd1513ef64433ee44e04f2a9541bb892831a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs @@ -34,6 +34,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Linq; +using Newtonsoft.Json; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -72,6 +73,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { internal DrivingCycleData() {} + [JsonIgnore] public List<DrivingCycleEntry> Entries { get; internal set; } public string Name { get; internal set; } diff --git a/VectoCore/VectoCore/OutputData/XML/XMLPrimaryVehicleReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLPrimaryVehicleReport.cs index 107c7a86f7d62971d5a667959660256bc78f2421..66c58a6f174666f74e83f3a653bd038dd4e3bc90 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLPrimaryVehicleReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLPrimaryVehicleReport.cs @@ -292,7 +292,7 @@ namespace TUGraz.VectoCore.OutputData.XML var retVal = WrapComponent( XMLNames.Component_Engine, "EngineDataPIFType", GetCommonDescription(engineData), - new XElement(tns + XMLNames.Engine_Displacement, engineData.Displacement.ConvertToCubicDeziMeter().ToXMLFormat(0)), + new XElement(tns + XMLNames.Engine_Displacement, engineData.Displacement.ConvertToCubicCentiMeter().ToXMLFormat(0)), new XElement(tns + XMLNames.Engine_RatedSpeed, engineData.RatedSpeedDeclared.AsRPM.ToXMLFormat(0)), new XElement(tns + XMLNames.Engine_RatedPower, engineData.RatedPowerDeclared.ToXMLFormat(0)), new XElement(tns + XMLNames.Engine_MaxTorque, engineData.InputData.MaxTorqueDeclared.ToXMLFormat(0)), diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 2f8f9f4b9514a7af3b2d06a5e50166fff05b772d..1f02546db38440ebed9912f1c8b03c3ec72dc83e 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -276,9 +276,10 @@ <Compile Include="InputData\FileIO\XML\Declaration\IXMLDeclarationInputDataReader.cs" /> <Compile Include="InputData\FileIO\XML\IXMLInputDataReader.cs" /> <Compile Include="InputData\FileIO\XML\XMLInputDataNinjectModule.cs" /> + <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterPrimaryBus.cs" /> <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterSingleBus.cs" /> <Compile Include="InputData\Reader\Impl\CombinedBusAuxiliaries.cs" /> - <Compile Include="InputData\Reader\Impl\DeclarationDataAdapterCompletedBus.cs" /> + <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterCompletedBusSpecific.cs" /> <Compile Include="InputData\Reader\Impl\DeclarationModeCompletedBusVectoRunDataFactory.cs" /> <Compile Include="Models\BusAuxiliaries\DownstreamModules\Impl\Electrics\SimpleBattery.cs" /> <Compile Include="Models\BusAuxiliaries\Interfaces\DownstreamModules\Electrics\ISimpleBattery.cs" /> @@ -292,7 +293,7 @@ <Compile Include="InputData\Reader\ComponentData\EnvironmentalContidionsMapReader.cs" /> <Compile Include="InputData\Reader\ComponentData\SSMTechnologiesReader.cs" /> <Compile Include="InputData\Reader\ComponentData\ActuationsMapReader.cs" /> - <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterPrimaryBus.cs" /> + <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterCompletedBusGeneric.cs" /> <Compile Include="InputData\Reader\DataObjectAdapter\IDeclarationDataAdapter.cs" /> <Compile Include="InputData\Reader\Impl\AbstractDeclarationVectoRunDataFactory.cs" /> <Compile Include="InputData\Reader\Impl\DeclarationModeBusVectoRunDataFactory.cs" /> @@ -320,8 +321,7 @@ <Compile Include="Models\BusAuxiliaries\DownstreamModules\Impl\HVAC\SSMRun.cs" /> <Compile Include="Models\BusAuxiliaries\DownstreamModules\Impl\HVAC\SSMTOOL.cs" /> <Compile Include="Models\Declaration\CompletedBusSegments.cs" /> - <Compile Include="Models\Declaration\GenericBusAngledriveData.cs" /> - <Compile Include="Models\Declaration\GenericBusAxelgearData.cs" /> + <Compile Include="Models\Declaration\GenericTransmissionComponentData.cs" /> <Compile Include="Models\Declaration\GenericBusDriverData.cs" /> <Compile Include="Models\Declaration\GenericBusEngineData.cs" /> <Compile Include="Models\Declaration\GenericBusRetarderData.cs" /> diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/primary_heavyBus group41_PIF.xml b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/primary_heavyBus group41_PIF.xml index 0e955e31f17eae2da65fd9e71347e54cfb768672..0db345ee422348737c122f9078b01a090fd2d26c 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/primary_heavyBus group41_PIF.xml +++ b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/primary_heavyBus group41_PIF.xml @@ -34,7 +34,7 @@ <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> <Date>2017-02-15T11:00:00Z</Date> <AppVersion>VectoEngine x.y</AppVersion> - <Displacement>8</Displacement> + <Displacement>7700</Displacement> <RatedSpeed>2200</RatedSpeed> <RatedPower>220000</RatedPower> <MaxEngineTorque>1100</MaxEngineTorque> diff --git a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs index d72f1d8040943e55f65bba6dfa59f725ea108e0e..e51b6ce61301f30f0784925b4978b146482fb7ad 100644 --- a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs +++ b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs @@ -46,7 +46,7 @@ namespace TUGraz.VectoCore.Tests.Utils { public Watt MaxNetPower1 { get; } public Watt MaxNetPower2 { get; } public RegistrationClass RegisteredClass { get; set; } - public int NuberOfPassengersUpperDeck { get; set; } + public int NumberOfPassengersUpperDeck { get; set; } public int NumberOfPassengersLowerDeck { get; set; } public VehicleCode VehicleCode { get; set; } public FloorType FloorType { get; } @@ -108,7 +108,7 @@ namespace TUGraz.VectoCore.Tests.Utils { public Meter EntranceHeight { get; } public Watt MaxNetPower2 { get; } public RegistrationClass RegisteredClass { get; set; } - public int NuberOfPassengersUpperDeck { get; set; } + public int NumberOfPassengersUpperDeck { get; set; } public int NumberOfPassengersLowerDeck { get; set; } public VehicleCode VehicleCode { get; set; } public FloorType FloorType { get; } diff --git a/VectoCore/VectoCoreTest/XML/XMLCompleteBusReaderTest.cs b/VectoCore/VectoCoreTest/XML/XMLCompleteBusReaderTest.cs index 698c8486ab4c8f32db8a37fa55946bc1baa80efb..f261960109970856ba1addc36e5b93416337685c 100644 --- a/VectoCore/VectoCoreTest/XML/XMLCompleteBusReaderTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLCompleteBusReaderTest.cs @@ -57,7 +57,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(15400, vehicle.GrossVehicleMassRating.Value());//TechnicalPermissibleMaximumLadenMass ?!? Assert.That(() => vehicle.TankSystem, Throws.InstanceOf<VectoException>()); Assert.AreEqual(50, vehicle.NumberOfPassengersLowerDeck); - Assert.AreEqual(0, vehicle.NuberOfPassengersUpperDeck); + Assert.AreEqual(0, vehicle.NumberOfPassengersUpperDeck); Assert.AreEqual(FloorType.LowFloor, vehicle.FloorType); Assert.AreEqual(2.700, vehicle.Height.Value()); Assert.AreEqual(11.830, vehicle.Length.Value());