From e449eda5051f70a1218d5ed663b7dba1cb82c001 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <quaritsch@ivt.tugraz.at>
Date: Thu, 9 Mar 2023 16:04:07 +0100
Subject: [PATCH] fix writing aux technologies: allow multiple elements for
 steering pump, correct code for writing

---
 .../CIFWriter/ComponentGroupWriters.cs              | 13 ++++++++-----
 .../AbstractManufacturerReport.cs                   |  4 ----
 .../Components/MRFBusAuxiliaryTypes.cs              |  8 ++++----
 .../Components/MRFLorryAuxiliaryTypes.cs            | 11 +++++------
 .../Resources/XSD/VectoOutputCustomer.0.9.xsd       |  2 +-
 .../Resources/XSD/VectoOutputManufacturer.0.9.xsd   | 12 ++++++------
 6 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs
index 555c08910f..473ec5329c 100644
--- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs
+++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs
@@ -150,11 +150,14 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation
 
 		public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
 		{
-			return new List<XElement>() {
-				new XElement(_cif + "SteeringPumpTechnology",
-					inputData.JobInputData.Vehicle.Components.AuxiliaryInputData.Auxiliaries
-						.Single(aux => aux.Type == AuxiliaryType.SteeringPump).Technology.Join())
-			};
+			return inputData.JobInputData.Vehicle.Components.AuxiliaryInputData.Auxiliaries
+				.Single(aux => aux.Type == AuxiliaryType.SteeringPump).Technology.Select(x =>
+					new XElement(_cif + "SteeringPumpTechnology", x)).ToList();
+			//return new List<XElement>() {
+			//	new XElement(_cif + "SteeringPumpTechnology",
+			//		inputData.JobInputData.Vehicle.Components.AuxiliaryInputData.Auxiliaries
+			//			.Single(aux => aux.Type == AuxiliaryType.SteeringPump).Technology.Join())
+			//};
 		}
 
 		#endregion
diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/AbstractManufacturerReport.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/AbstractManufacturerReport.cs
index c7aa30ff77..f3d7d6acf8 100644
--- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/AbstractManufacturerReport.cs
+++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/AbstractManufacturerReport.cs
@@ -116,10 +116,6 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.
 			
 			Vehicle.XPathSelectElement($"//*[local-name()='{XMLNames.VehicleGroupCO2}']").Value = DeclarationData
 				.GetVehicleGroupCO2StandardsGroup(Input).ToXMLFormat();
-			
-
-
-
 
 			var stream = new MemoryStream();
 			var writer = new StreamWriter(stream);
diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFBusAuxiliaryTypes.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFBusAuxiliaryTypes.cs
index 051f4c84c1..8d9e2e3a03 100644
--- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFBusAuxiliaryTypes.cs
+++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFBusAuxiliaryTypes.cs
@@ -37,7 +37,7 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.
 			return new XElement(_mrf + XMLNames.Component_Auxiliaries,
 				new XElement(_mrf + "CoolingFanTechnology",
 					auxData.FanTechnology),
-				new XElement(_mrf + "SteeringPumpTechnology", string.Join("\n", steeringPumpData)),
+				steeringPumpData.Select(x => new XElement(_mrf + "SteeringPumpTechnology", x)),
 
 
 				_mrfFactory.GetPrimaryBusElectricSystemType_Conventional_HEV().GetElement(auxData),
@@ -62,7 +62,7 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.
 			return new XElement(_mrf + XMLNames.Component_Auxiliaries,
 				new XElement(_mrf + "CoolingFanTechnology",
 					auxData.FanTechnology),
-				new XElement(_mrf + "SteeringPumpTechnology", string.Join("\n", steeringPumpData)),
+				steeringPumpData.Select(x => new XElement(_mrf + "SteeringPumpTechnology", x)),
 				_mrfFactory.GetPrimaryBusElectricSystemType_Conventional_HEV().GetElement(auxData),
 				_mrfFactory.GetPrimaryBusPneumaticSystemType_Conventional_HEV_Px().GetElement(auxData),
 				_mrfFactory.GetPrimaryBusHVACSystemType_Conventional_HEV().GetElement(auxData)
@@ -84,7 +84,7 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.
 			return new XElement(_mrf + XMLNames.Component_Auxiliaries,
 				new XElement(_mrf + "CoolingFanTechnology",
 					auxData.FanTechnology),
-				new XElement(_mrf + "SteeringPumpTechnology", string.Join("\n", steeringPumpData)),
+				steeringPumpData.Select(x => new XElement(_mrf + "SteeringPumpTechnology", x)),
 				_mrfFactory.GetPrimaryBusElectricSystemType_Conventional_HEV().GetElement(auxData),
 
 				_mrfFactory.GetPrimaryBusPneumaticSystemType_HEV_S().GetElement(auxData),
@@ -106,7 +106,7 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.
 			var steeringPumpData = auxData.SteeringPumpTechnology;
 
 			return new XElement(_mrf + XMLNames.Component_Auxiliaries,
-				new XElement(_mrf + "SteeringPumpTechnology", string.Join("\n", steeringPumpData)),
+				steeringPumpData.Select(x => new XElement(_mrf + "SteeringPumpTechnology", x)),
 				_mrfFactory.GetPrimaryBusElectricSystemType_PEV().GetElement(auxData),
 				_mrfFactory.GetPrimaryBusPneumaticSystemType_PEV_IEPC().GetElement(auxData)
 				//_mrfFactory.GetPrimaryBusHVACSystemType_PEV().GetXmlType(auxData)
diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFLorryAuxiliaryTypes.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFLorryAuxiliaryTypes.cs
index 110932396d..9bd0d47114 100644
--- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFLorryAuxiliaryTypes.cs
+++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/ManufacturerReport/ManufacturerReport_0_9/ManufacturerReportXMLTypeWriter/Components/MRFLorryAuxiliaryTypes.cs
@@ -21,10 +21,9 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.
 			var pneumaticSystemData = auxData.Auxiliaries.Single(aux => aux.Type == AuxiliaryType.PneumaticSystem);
 
 			return new XElement(_mrf + XMLNames.Component_Auxiliaries,
-				new XElement(_mrf + "CoolingFanTechnology",
-					string.Join("\n", fanData.Technology)),
-				new XElement(_mrf + "SteeringPumpTechnology", string.Join("\n", steeringPumpData.Technology)),
-				new XElement(_mrf + XMLNames.BusAux_PneumaticSystem, new XElement(_mrf + XMLNames.Auxiliaries_Auxiliary_Technology, string.Join("\n", pneumaticSystemData.Technology))),
+				new XElement(_mrf + "CoolingFanTechnology", fanData.Technology.Single()),
+				steeringPumpData.Technology.Select(x => new XElement(_mrf + "SteeringPumpTechnology", x)),
+				new XElement(_mrf + XMLNames.BusAux_PneumaticSystem, new XElement(_mrf + XMLNames.Auxiliaries_Auxiliary_Technology, pneumaticSystemData.Technology.Single())),
 				new XElement(_mrf + XMLNames.BusAux_ElectricSystem, new XElement(_mrf + "LEDHeadLights", electricSystemData.Technology.Contains("Standard technology - LED headlights, all"))));
 		}
 	}
@@ -50,8 +49,8 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.
 			var pneumaticSystemData = auxData.Auxiliaries.Single(aux => aux.Type == AuxiliaryType.PneumaticSystem);
 
 			return new XElement(_mrf + XMLNames.Component_Auxiliaries,
-				new XElement(_mrf + "SteeringPumpTechnology", string.Join("\n", steeringPumpData.Technology)),
-				new XElement(_mrf + XMLNames.BusAux_PneumaticSystem, new XElement(_mrf + XMLNames.Auxiliaries_Auxiliary_Technology, string.Join("\n", pneumaticSystemData.Technology))),
+				steeringPumpData.Technology.Select(x => new XElement(_mrf + "SteeringPumpTechnology", x)),
+				new XElement(_mrf + XMLNames.BusAux_PneumaticSystem, new XElement(_mrf + XMLNames.Auxiliaries_Auxiliary_Technology, pneumaticSystemData.Technology.Single())),
 				new XElement(_mrf + XMLNames.BusAux_ElectricSystem, new XElement(_mrf + "LEDHeadLights", electricSystemData.Technology.Contains("Standard technology - LED headlights, all"))));
 		}
 
diff --git a/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.9.xsd b/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.9.xsd
index 027ed8126c..933fe88aa6 100644
--- a/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.9.xsd
+++ b/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.9.xsd
@@ -1217,7 +1217,7 @@
 	</xs:group>
 	<xs:group name="LorryAuxGroup">
 		<xs:sequence>
-			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType"/>
+			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType" maxOccurs="unbounded"/>
 		</xs:sequence>
 	</xs:group>
 	<xs:group name="ConventionalCompletedBusAuxGroup">
diff --git a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.9.xsd b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.9.xsd
index 4f494c932f..b89434e6ab 100644
--- a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.9.xsd
+++ b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.9.xsd
@@ -1475,7 +1475,7 @@
 	<xs:complexType name="ConventionalLorryAuxOutputType">
 		<xs:sequence>
 			<xs:element name="CoolingFanTechnology" type="v2.4:AuxFanTechnologyLorryType"/>
-			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType"/>
+			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType" maxOccurs="unbounded"/>
 			<xs:element name="PneumaticSystem" type="mrf:PneumaticSystemType_1"/>
 			<xs:element name="ElectricSystem" type="mrf:LorryElectricSystemType"/>
 		</xs:sequence>
@@ -1483,14 +1483,14 @@
 	<xs:complexType name="HEVLorryAuxOutputType">
 		<xs:sequence>
 			<xs:element name="CoolingFanTechnology" type="v2.4:AuxFanTechnologyLorryType"/>
-			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType"/>
+			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType" maxOccurs="unbounded"/>
 			<xs:element name="PneumaticSystem" type="mrf:PneumaticSystemType_1"/>
 			<xs:element name="ElectricSystem" type="mrf:LorryElectricSystemType"/>
 		</xs:sequence>
 	</xs:complexType>
 	<xs:complexType name="PEVLorryAuxOutputType">
 		<xs:sequence>
-			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType"/>
+			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyLorryType" maxOccurs="unbounded"/>
 			<xs:element name="PneumaticSystem" type="mrf:PneumaticSystemType_1"/>
 			<xs:element name="ElectricSystem" type="mrf:LorryElectricSystemType"/>
 		</xs:sequence>
@@ -1498,7 +1498,7 @@
 	<xs:complexType name="Conventional_HEV_Px_PrimaryBusAuxOutputType">
 		<xs:sequence>
 			<xs:element name="CoolingFanTechnology" type="v2.4:AuxFanTechnologyPrimaryBusType"/>
-			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyPrimaryBusType"/>
+			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyPrimaryBusType" maxOccurs="unbounded"/>
 			<xs:element name="ElectricSystem" type="mrf:PrimaryBusElectricSystemType_Conventional_HEV"/>
 			<xs:element name="PneumaticSystem" type="mrf:PneumaticSystemType_PrimaryBus_Conventional_HEV_P"/>
 			<xs:element name="HVACSystem" type="mrf:HVACSystemType"/>
@@ -1507,7 +1507,7 @@
 	<xs:complexType name="HEVPrimaryBusAuxOutputType">
 		<xs:sequence>
 			<xs:element name="CoolingFanTechnology" type="v2.4:AuxFanTechnologyPrimaryBusType"/>
-			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyPrimaryBusType"/>
+			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyPrimaryBusType" maxOccurs="unbounded"/>
 			<xs:element name="ElectricSystem" type="mrf:PrimaryBusElectricSystemType_Conventional_HEV"/>
 			<xs:element name="PneumaticSystem" type="mrf:PneumaticSystemType_PrimaryBus_HEV_S"/>
 			<xs:element name="HVACSystem">
@@ -1519,7 +1519,7 @@
 	</xs:complexType>
 	<xs:complexType name="PEVPrimaryBusAuxOutputType">
 		<xs:sequence>
-			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyPrimaryBusType"/>
+			<xs:element name="SteeringPumpTechnology" type="v2.4:AuxSPTechnologyPrimaryBusType" maxOccurs="unbounded"/>
 			<xs:element name="ElectricSystem" type="mrf:PrimaryBusElectricSystemType_PEV"/>
 			<xs:element name="PneumaticSystem" type="mrf:PneumaticSystemType_PrimaryBus_PEV_IEPC"/>
 		</xs:sequence>
-- 
GitLab