From 3dbe2c585aef1074ff9c00e02b474dbb00f59d7b Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Tue, 26 Jul 2022 12:22:44 +0200
Subject: [PATCH] adding gyre version 2.3

---
 .../XMLDeclarationTyreDataProvider.cs          | 18 ++++++++++++++++++
 .../XMLDeclarationInputDataV23InjectModule.cs  |  3 +++
 .../OutputData/XML/XMLCustomerReport.cs        | 15 +++++++++------
 .../OutputData/XML/XMLManufacturerReport.cs    |  4 ++--
 .../XSD/VectoOutputCustomer.0.7.2.xsd          |  4 ++--
 .../XSD/VectoOutputManufacturer.0.7.2.xsd      |  2 +-
 VectoCore/VectoCore/VectoCore.csproj           |  1 +
 7 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationTyreDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationTyreDataProvider.cs
index 8771014c85..0b4130a690 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationTyreDataProvider.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationTyreDataProvider.cs
@@ -126,4 +126,22 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
 			get { return NAMESPACE_URI; }
 		}
 	}
+
+	// ---------------------------------------------------------------------------------------
+
+	public class XMLDeclarationTyreDataProviderV23 : XMLDeclarationTyreDataProviderV10
+	{
+		public new static readonly XNamespace NAMESPACE_URI = XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V23;
+
+		//public new const string XSD_TYPE = "TyreComponentDeclarationType";
+
+		public new static readonly string QUALIFIED_XSD_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_TYPE);
+
+		public XMLDeclarationTyreDataProviderV23(IXMLDeclarationVehicleData vehicle, XmlNode componentNode, string sourceFile)
+			: base(vehicle, componentNode, sourceFile) { }
+
+		protected override XNamespace SchemaNamespace => NAMESPACE_URI;
+
+		//public override string FuelEfficiencyClass => GetString("FuelEfficiencyClass");
+	}
 }
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV23InjectModule.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV23InjectModule.cs
index dc2fb66dd0..1f52aad43d 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV23InjectModule.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/NinjectModules/XMLDeclarationInputDataV23InjectModule.cs
@@ -9,6 +9,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.NinjectModules
 		public override void Load() {
 			Bind<IXMLEngineDeclarationInputData>().To<XMLDeclarationEngineDataProviderV23>().Named(
 				XMLDeclarationEngineDataProviderV23.QUALIFIED_XSD_TYPE);
+
+			Bind<IXMLTyreDeclarationInputData>().To<XMLDeclarationTyreDataProviderV23>().Named(
+				XMLDeclarationTyreDataProviderV23.QUALIFIED_XSD_TYPE);
 		}
 	}
 }
\ No newline at end of file
diff --git a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs
index a00fa6f007..5b1aa0be71 100644
--- a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs
+++ b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs
@@ -96,7 +96,7 @@ namespace TUGraz.VectoCore.OutputData.XML
 				new XElement(tns + XMLNames.Vehicle_ZeroEmissionVehicle, modelData.VehicleData.ZeroEmissionVehicle),
 				new XElement(tns + XMLNames.Vehicle_HybridElectricHDV, modelData.VehicleData.HybridElectricHDV),
 				new XElement(tns + "WasteHeatRecovery", modelData.EngineData.WHRType != WHRType.None),
-				new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.VehicleData.DualFuelVehicle),
+				new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.EngineData.Fuels.Count > 1),
 
 				exempted ? ExemptedData(modelData) : new[] {
 					new XElement(tns + XMLNames.Vehicle_AxleConfiguration, modelData.VehicleData.AxleConfiguration.GetName()),
@@ -134,7 +134,7 @@ namespace TUGraz.VectoCore.OutputData.XML
 
 		private XElement[] ComponentData(VectoRunData modelData)
 		{
-			return new[] {
+			var retVal = new List<XElement>() {
 				new XElement(
 					tns + XMLNames.Report_Vehicle_EngineRatedPower,
 					XMLHelper.ValueAsUnit(modelData.EngineData.RatedPowerDeclared, XMLNames.Unit_kW)),
@@ -147,7 +147,10 @@ namespace TUGraz.VectoCore.OutputData.XML
 				//	fuelModes.SelectMany(x => x.Select(f => f.FuelType.ToXMLFormat())).Distinct()
 				//		.Select(x => new XElement(tns + XMLNames.Engine_FuelType, x))
 				//),
-				new XElement(tns + XMLNames.Engine_FuelType, modelData.EngineData.Fuels.First().FuelData.FuelType.ToXMLFormat()),
+			};
+			retVal.AddRange(modelData.EngineData.Fuels.Select(x =>
+				new XElement(tns + XMLNames.Engine_FuelType, x.FuelData.FuelType.ToXMLFormat())));
+			retVal.AddRange(new [] {
 				new XElement(
 					tns + XMLNames.Report_Vehicle_TransmissionCertificationMethod,
 					modelData.GearboxData.CertificationMethod.ToXMLFormat()),
@@ -160,8 +163,8 @@ namespace TUGraz.VectoCore.OutputData.XML
 				new XElement(
 					tns + XMLNames.Report_Vehicle_AverageRRCLabel,
 					DeclarationData.Wheels.TyreClass.Lookup(modelData.VehicleData.AverageRollingResistanceTruck))
-			};
-
+				});
+			return retVal.ToArray();
 		}
 
 		private XElement CreateDummySig()
@@ -210,7 +213,7 @@ namespace TUGraz.VectoCore.OutputData.XML
 		{
 			return new object[] {
 				new XElement(tns + XMLNames.Report_Result_Payload, XMLHelper.ValueAsUnit(result.Payload, XMLNames.Unit_kg, 0)),
-				new XElement(tns + XMLNames.Report_Results_FuelType, XMLHelper.ToXmlStr(DeclarationData.FuelData.Lookup(result.FuelData.First().FuelType, result.FuelData.First().TankSystem))),
+				result.FuelData.Select(x => new XElement(tns + XMLNames.Report_Results_FuelType, XMLHelper.ToXmlStr(DeclarationData.FuelData.Lookup(x.FuelType, x.TankSystem)))),
 				new XElement(tns + XMLNames.Report_Results_AverageSpeed, XMLHelper.ValueAsUnit(result.AverageSpeed, XMLNames.Unit_kmph, 1)),
 				XMLDeclarationReport.GetResults(result, tns, false).Cast<object>().ToArray()
 			};
diff --git a/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs
index 3135a128ed..aecf88b7ef 100644
--- a/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs
+++ b/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs
@@ -91,7 +91,7 @@ namespace TUGraz.VectoCore.OutputData.XML
 				new XElement(tns + XMLNames.Vehicle_CurbMassChassis, XMLHelper.ValueAsUnit(modelData.VehicleData.CurbMass, XMLNames.Unit_kg)),
 				new XElement(tns + XMLNames.Vehicle_ZeroEmissionVehicle, modelData.VehicleData.ZeroEmissionVehicle),
 				new XElement(tns + XMLNames.Vehicle_HybridElectricHDV, modelData.VehicleData.HybridElectricHDV),
-				new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.VehicleData.DualFuelVehicle),
+				new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.EngineData.Fuels.Count > 1),
 				exempted 
 					? ExemptedData(modelData) 
 					: new[] {
@@ -391,7 +391,7 @@ namespace TUGraz.VectoCore.OutputData.XML
 				new XElement(tns + XMLNames.Report_ResultEntry_SimulationParameters,
 					new XElement(tns + XMLNames.Report_ResultEntry_TotalVehicleMass, XMLHelper.ValueAsUnit(result.TotalVehicleWeight, XMLNames.Unit_kg)),
 					new XElement(tns + XMLNames.Report_ResultEntry_Payload, XMLHelper.ValueAsUnit(result.Payload, XMLNames.Unit_kg)),
-					new XElement(tns + XMLNames.Report_ResultEntry_FuelType, XMLHelper.ToXmlStr(DeclarationData.FuelData.Lookup(result.FuelData.First().FuelType, result.FuelData.First().TankSystem)))
+					result.FuelData.Select(x => new XElement(tns + XMLNames.Report_ResultEntry_FuelType, XMLHelper.ToXmlStr(DeclarationData.FuelData.Lookup(x.FuelType, x.TankSystem))))
 					),
 				new XElement(tns + XMLNames.Report_ResultEntry_VehiclePerformance,
 					new XElement(tns + XMLNames.Report_ResultEntry_AverageSpeed, XMLHelper.ValueAsUnit(result.AverageSpeed, XMLNames.Unit_kmph, 1)),
diff --git a/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.2.xsd b/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.2.xsd
index b71ca11975..54bdf20491 100644
--- a/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.2.xsd
+++ b/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.2.xsd
@@ -46,7 +46,7 @@
 							</xs:simpleContent>
 						</xs:complexType>
 					</xs:element>
-					<xs:element name="FuelType" type="xs:string"/>
+					<xs:element name="FuelType" type="xs:string" maxOccurs="unbounded"/>
 					<xs:element name="AverageSpeed">
 						<xs:complexType>
 							<xs:simpleContent>
@@ -301,7 +301,7 @@
 							</xs:simpleContent>
 						</xs:complexType>
 					</xs:element>
-					<xs:element name="FuelType" type="vdecdef:FuelTypeType">
+					<xs:element name="FuelType" type="vdecdef:FuelTypeType" maxOccurs="unbounded">
 						<xs:annotation>
 							<xs:documentation>P193 / II.1.2.3</xs:documentation>
 						</xs:annotation>
diff --git a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.2.xsd b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.2.xsd
index bc76d16d5b..41f1034cf3 100644
--- a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.2.xsd
+++ b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.2.xsd
@@ -441,7 +441,7 @@
 					</xs:simpleContent>
 				</xs:complexType>
 			</xs:element>
-			<xs:element name="FuelType" type="xs:string">
+			<xs:element name="FuelType" type="xs:string" maxOccurs="unbounded">
 				<xs:annotation>
 					<xs:documentation>P193, P275 / I.2.1.3 / #58</xs:documentation>
 				</xs:annotation>
diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj
index c50be45faa..98e7bb8d3e 100644
--- a/VectoCore/VectoCore/VectoCore.csproj
+++ b/VectoCore/VectoCore/VectoCore.csproj
@@ -178,6 +178,7 @@
     <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV21InjectModule.cs" />
     <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV221InjectModule.cs" />
     <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV22InjectModule.cs" />
+    <Compile Include="InputData\FileIO\XML\Declaration\NinjectModules\XMLDeclarationInputDataV23InjectModule.cs" />
     <Compile Include="InputData\FileIO\XML\Declaration\Reader\Impl\AbstractComponentReader.cs" />
     <Compile Include="InputData\FileIO\XML\Declaration\Reader\Impl\XMLADASReader.cs" />
     <Compile Include="InputData\FileIO\XML\Declaration\Reader\Impl\XMLComponentReader.cs" />
-- 
GitLab