diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs index 711b9bce5ee50f17ffc5f82927e7ae4157edfa7b..ef6b6f00fdb464a26c1108e1e35ceb7db083a679 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs @@ -216,6 +216,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation foreach (var multistageParameterViewModel in _parameterViewModels.Values) { + //TODO: Nullable values getting enabled on loading a file. multistageParameterViewModel.UpdateEditingEnabled(); } OnPropertyChanged(String.Empty); diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs index 46321f06615803cd907c5dde33d629546ce02e82..2758ae395721f36917ab67f6c55bb7b1bd6de133 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs @@ -542,11 +542,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Reader.Impl private IAdvancedDriverAssistantSystemDeclarationInputData GetADAS() { - if (GetVehiclePropertyValue<IAdvancedDriverAssistantSystemDeclarationInputData>(nameof(ADAS)) == null) - return null; - return _consolidatedADAS - ?? (_consolidatedADAS = new ConsolidatedADASData(_manufacturingStages)); + ?? (_consolidatedADAS = new ConsolidatedADASData( + manufacturingStages: _manufacturingStages, + primaryVehicleData: _primaryVehicle.Vehicle, + usePrimaryData: GetVehiclePropertyValue<IAdvancedDriverAssistantSystemDeclarationInputData>(nameof(ADAS)) == null)); } @@ -777,8 +777,16 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Reader.Impl public class ConsolidatedADASData : ConsolidatedDataBase, IAdvancedDriverAssistantSystemDeclarationInputData { - public ConsolidatedADASData(IEnumerable<IManufacturingStageInputData> manufacturingStages) - : base(manufacturingStages) { } + private readonly bool _usePrimaryData; + private readonly IAdvancedDriverAssistantSystemDeclarationInputData _primaryAdas; + + public ConsolidatedADASData(IEnumerable<IManufacturingStageInputData> manufacturingStages, + IVehicleDeclarationInputData primaryVehicleData, bool usePrimaryData) + : base(manufacturingStages) + { + _usePrimaryData = usePrimaryData; + _primaryAdas = primaryVehicleData.ADAS; + } public bool EngineStopStart => GetADASPropertyValue<bool>(nameof(EngineStopStart)); @@ -793,6 +801,10 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Reader.Impl private T GetADASPropertyValue<T>(string propertyName) { + if (_usePrimaryData) { + return GetPropertyValue<T>(_primaryAdas, propertyName); + } + foreach (var manufacturingStage in _manufacturingStages) { var adas = manufacturingStage.Vehicle.ADAS; if (adas == null) diff --git a/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs b/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs index f90b6bed15cc584b646ae91c95393089d23bea68..53fa908bf7f368e13a99546c1166969a7f5c3b48 100644 --- a/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Multistage/MultistageMultipleRunsTest.cs @@ -24,6 +24,8 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage private const string CompletedDiesel = TestDataDir + "newVifCompletedConventional.vecto"; private const string CompletedExempted = TestDataDir + "newVifExempted.vecto"; private const string CompletedExemptedWithoutTPMLM = TestDataDir + "newVifExempted-noTPMLM.vecto"; + private string CompletedWithoutADAS = TestDataDir + "newVifCompletedConventional-noADAS.vecto"; + @@ -141,6 +143,21 @@ namespace TUGraz.VectoCore.Tests.Integration.Multistage } + [Test] + public void PrimaryAndCompletedWithoutADAS() + { + StartSimulation(CompletedWithoutADAS); + + var writtenFiles = GetWrittenFiles(); + ShowWrittenFiles(writtenFiles); + + Assert.IsTrue(writtenFiles.Contains(_tempFileOutputWriter.XMLFullReportName)); + Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLFullReportName)); + Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLCustomerReportName)); + Assert.IsTrue(writtenFiles.Contains(_fileoutputWriter.XMLMultistageReportFileName)); + + } + //SpecialCase I [Test, Timeout(1000 * 10 * 60)] public void PrimaryAndInterimTest() diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Multistage/newVifCompletedConventional-noADAS.vecto b/VectoCore/VectoCoreTest/TestData/Integration/Multistage/newVifCompletedConventional-noADAS.vecto new file mode 100644 index 0000000000000000000000000000000000000000..e96721c11b45053511438a5e64cf352725d6225d --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Integration/Multistage/newVifCompletedConventional-noADAS.vecto @@ -0,0 +1,13 @@ +{ + "Header": { + "CreatedBy": "Harry", + "Date": "2021-09-20T00:00:00+02:00", + "AppVersion": "Vecto3GUI2020", + "FileVersion": 10 + }, + "Body": { + "PrimaryVehicle": "..\\..\\XML\\XMLReaderDeclaration\\SchemaVersion2.10\\vecto_vehicle-primary_heavyBus-sample.xml", + "InterimStage": "..\\..\\XML\\XMLReaderDeclaration\\SchemaVersion2.10\\vecto_vehicle-stage_input_full-sample-final-noADAS.xml", + "Completed": false + } +} \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/SchemaVersion2.10/vecto_vehicle-stage_input_full-sample-final-noADAS.xml b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/SchemaVersion2.10/vecto_vehicle-stage_input_full-sample-final-noADAS.xml new file mode 100644 index 0000000000000000000000000000000000000000..247ae2e564f5d43eb1e138dc7e00aaf33e912c78 --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/SchemaVersion2.10/vecto_vehicle-stage_input_full-sample-final-noADAS.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<tns:VectoInputDeclaration xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationInput:v2.0" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.10.2" schemaVersion="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" xmlns:di="http://www.w3.org/2000/09/xmldsig#" xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationJob V:\VectoCore\VectoCore\Resources\XSD\VectoDeclarationJob.xsd"> + <v2.0:Vehicle id="VEH-1234567890" xsi:type="Vehicle_Conventional_CompletedBusDeclarationType"> + <Manufacturer>Some Manufacturer</Manufacturer> + <ManufacturerAddress>Some Manufacturer Address</ManufacturerAddress> + <VIN>VEH-1234567890</VIN> + <Date>2021-09-19T22:00:00Z</Date> + <Model>Sample Bus Model</Model> + <LegislativeCategory>M3</LegislativeCategory> + <CorrectedActualMass>500</CorrectedActualMass> + <TechnicalPermissibleMaximumLadenMass>3500</TechnicalPermissibleMaximumLadenMass> + <AirdragModifiedMultistage>true</AirdragModifiedMultistage> + <ClassBus>II+III</ClassBus> + <NgTankSystem>Compressed</NgTankSystem> + <NumberPassengerSeatsLowerDeck>1</NumberPassengerSeatsLowerDeck> + <NumberPassengersStandingLowerDeck>10</NumberPassengersStandingLowerDeck> + <NumberPassengerSeatsUpperDeck>11</NumberPassengerSeatsUpperDeck> + <NumberPassengersStandingUpperDeck>2</NumberPassengersStandingUpperDeck> + <BodyworkCode>CB</BodyworkCode> + <LowEntry>false</LowEntry> + <HeightIntegratedBody>2500</HeightIntegratedBody> + <VehicleLength>9500</VehicleLength> + <VehicleWidth>2500</VehicleWidth> + <EntranceHeight>2000</EntranceHeight> + <DoorDriveTechnology>electric</DoorDriveTechnology> + <VehicleDeclarationType>final</VehicleDeclarationType> + <VehicleTypeApprovalNumber>123456789</VehicleTypeApprovalNumber> + <Components xsi:type="Components_Conventional_CompletedBusType"> + <AirDrag> + <v2.0:Data id="CabinX23h" xsi:type="v2.0:AirDragDataDeclarationType"> + <v2.0:Manufacturer>Generic Manufacturer</v2.0:Manufacturer> + <v2.0:Model>Generic Model</v2.0:Model> + <v2.0:CertificationNumber>e12*0815/8051*2017/05E0000*00</v2.0:CertificationNumber> + <v2.0:Date>2017-03-24T15:00:00Z</v2.0:Date> + <v2.0:AppVersion>Vecto AirDrag x.y</v2.0:AppVersion> + <v2.0:CdxA_0>6.31</v2.0:CdxA_0> + <v2.0:TransferredCdxA>6.32</v2.0:TransferredCdxA> + <v2.0:DeclaredCdxA>6.34</v2.0:DeclaredCdxA> + </v2.0:Data> + <v2.0:Signature> + <di:Reference URI="#CabinX23h"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization" /> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> + <di:DigestValue>b9SHCfOoVrBxFQ8wwDK32OO+9bd85DuaUdgs6j/29N8=</di:DigestValue> + </di:Reference> + </v2.0:Signature> + </AirDrag> + <Auxiliaries> + <Data xsi:type="AUX_Conventional_CompletedBusType"> + <ElectricSystem> + <LEDLights> + <Interiorlights>false</Interiorlights> + <Dayrunninglights>true</Dayrunninglights> + <Positionlights>true</Positionlights> + <Brakelights>true</Brakelights> + <Headlights>false</Headlights> + </LEDLights> + </ElectricSystem> + <HVAC> + <SystemConfiguration>6</SystemConfiguration> + <HeatPumpTypeDriverCompartment> + <Cooling>none</Cooling> + <Heating>non R-744 3-stage</Heating> + </HeatPumpTypeDriverCompartment> + <HeatPumpTypePassengerCompartment> + <Cooling>non R-744 2-stage</Cooling> + <Heating>non R-744 4-stage</Heating> + </HeatPumpTypePassengerCompartment> + <AuxiliaryHeaterPower>50</AuxiliaryHeaterPower> + <DoubleGlazing>false</DoubleGlazing> + <AdjustableAuxiliaryHeater>true</AdjustableAuxiliaryHeater> + <SeparateAirDistributionDucts>true</SeparateAirDistributionDucts> + </HVAC> + </Data> + </Auxiliaries> + </Components> + </v2.0:Vehicle> +</tns:VectoInputDeclaration> \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index 8461bb5eddacfdfee03420960207b291921c2655..fe4562175674687b28beabafad457174a3104af8 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -2359,6 +2359,9 @@ <None Include="TestData\Integration\Buses\SingleBus.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="TestData\Integration\Multistage\newVifCompletedConventional-noADAS.vecto"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> <None Include="TestData\Integration\Multistage\newVifCompletedConventional.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -6041,6 +6044,9 @@ <Content Include="TestData\XML\XMLReaderDeclaration\SchemaVersion2.10\vecto_vehicle-exempted_input_interim-sample.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="TestData\XML\XMLReaderDeclaration\SchemaVersion2.10\vecto_vehicle-stage_input_full-sample-final-noADAS.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="TestData\XML\XMLReaderDeclaration\SchemaVersion2.10\vecto_vehicle-stage_input_full-sample-final.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content>