From 94f37b30b5addb0bebf3f9be0605d9964e32e19c Mon Sep 17 00:00:00 2001 From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at> Date: Thu, 8 Sep 2022 15:30:14 +0200 Subject: [PATCH] dont write angledrive component if Angledrive.Type == NONE --- .../PrimaryComponents/VIFAngleDriveType.cs | 3 +- .../XML/XMLDeclarationReport_0_9.cs | 46 +++++++++++++++++-- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VehicleInformationFile/VehicleInformationFile_0_1/PrimaryComponents/VIFAngleDriveType.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VehicleInformationFile/VehicleInformationFile_0_1/PrimaryComponents/VIFAngleDriveType.cs index 71665bdef4..d39ddf2bc9 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VehicleInformationFile/VehicleInformationFile_0_1/PrimaryComponents/VIFAngleDriveType.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/VehicleInformationFile/VehicleInformationFile_0_1/PrimaryComponents/VIFAngleDriveType.cs @@ -17,8 +17,9 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationF public XElement GetElement(IDeclarationInputDataProvider inputData) { var angelDrive = inputData.JobInputData.Vehicle.Components.AngledriveInputData; - if (angelDrive == null) + if (angelDrive?.Type == AngledriveType.None || angelDrive == null) { return null; + } return new XElement(_vif + XMLNames.Component_Angledrive, new XElement(_vif + XMLNames.ComponentDataWrapper, diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs index e6946487e5..1255de6fb7 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Xml.Linq; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Interfaces; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; @@ -14,21 +15,56 @@ namespace TUGraz.VectoCore.OutputData.XML /// <summary> /// Create MRF and VIF for primary bus /// </summary> - public class XMLDeclarationReportPrimaryVehicle_09 : XMLDeclarationReportPrimaryVehicle + public class XMLDeclarationReportPrimaryVehicle_09 : XMLDeclarationReport09 { - private readonly IManufacturerReportFactory _mrfFactory; + private readonly IManufacturerReportFactory _mrfFactory; private readonly IVIFReportFactory _vifFactory; + protected IXMLVehicleInformationFile VehicleInformationFile; + + public override XDocument CustomerReport => null; + + public override XDocument PrimaryVehicleReport => VehicleInformationFile?.Report; + public XMLDeclarationReportPrimaryVehicle_09(IReportWriter writer, IManufacturerReportFactory mrfFactory, ICustomerInformationFileFactory cifFactory, - IVIFReportFactory vifFactory) : base(writer) + IVIFReportFactory vifFactory) : base(writer, mrfFactory, cifFactory) { _mrfFactory = mrfFactory; //_cifFactory = cifFactory; _vifFactory = vifFactory; } + public override void InitializeReport(VectoRunData modelData, List<List<FuelData.Entry>> fuelModes) + { + base.InitializeReport(modelData, fuelModes); + VehicleInformationFile.Initialize(modelData, fuelModes); + } + + + + protected override void WriteResult(ResultEntry result) + { + base.WriteResult(result); + VehicleInformationFile.WriteResult(result); + } + + protected override void GenerateReports() + { + ManufacturerRpt.GenerateReport(); + var fullReportHash = GetSignature(ManufacturerRpt.Report); + CustomerRpt.GenerateReport(fullReportHash); + VehicleInformationFile.GenerateReport(fullReportHash); + } + + + + protected override void OutputReports() + { + Writer.WriteReport(ReportType.DeclarationReportManufacturerXML, ManufacturerRpt.Report); + Writer.WriteReport(ReportType.DeclarationReportPrimaryVehicleXML, VehicleInformationFile.Report); + } @@ -63,7 +99,7 @@ namespace TUGraz.VectoCore.OutputData.XML /// <summary> /// Create VIF of an interim (or the complete(d) step /// </summary> - public class XMLDeclarationReportInterimVehicle_09 : XMLDeclarationReport + public class XMLDeclarationReportInterimVehicle_09 : XMLDeclarationReport09 { protected readonly IVIFReportFactory _vifFactory; @@ -73,7 +109,7 @@ namespace TUGraz.VectoCore.OutputData.XML public XMLDeclarationReportInterimVehicle_09(IReportWriter writer, IManufacturerReportFactory mrfFactory, ICustomerInformationFileFactory cifFactory, - IVIFReportFactory vifFactory, IVIFReportInterimFactory interimFactory) : base(writer) + IVIFReportFactory vifFactory, IVIFReportInterimFactory interimFactory) : base(writer, mrfFactory, cifFactory) { _vifFactory = vifFactory; _interimFactory = interimFactory; -- GitLab