Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 9c445bfd authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

Merge pull request #694 in VECTO/vecto-sim from...

Merge pull request #694 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:feature/VECTO-808-add-moitoring-report to develop

* commit '771448a2':
  adding testcase for monitoring report of exempted vehicle
  Make component data in Monitoring Report optional
parents e19b0abb 771448a2
No related branches found
No related tags found
No related merge requests found
......@@ -81,33 +81,41 @@ namespace TUGraz.VectoCore.OutputData.XML
public void Initialize(VectoRunData modelData)
{
var numAxles = modelData.VehicleData.AxleData.Count(x => x.AxleType != AxleType.Trailer);
var numAxles = modelData.VehicleData.AxleData?.Count(x => x.AxleType != AxleType.Trailer) ?? 0;
var axleData = new object[numAxles];
for (var i = 0; i < axleData.Length; i++) {
axleData[i] = new XElement(tns + "Axle",
new XAttribute("axleNumber", i+1),
new XElement(tns + "Tyre", GetStandardFields(string.Format("TYRE_{0}", i+1))
));
}
}
var components = new object[0];
if (!modelData.Exempted) {
components = new object[] {
new XElement(
tns + "Engine",
new XElement(
tns + "WHTC",
new XElement(tns + "CO2", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0)),
new XElement(tns + "FuelConsumption", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0))
),
new XElement(
tns + "WHSC",
new XElement(tns + "CO2", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0)),
new XElement(tns + "FuelConsumption", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0))
)
),
new XElement(tns + "Gearbox", GetStandardFields("GEARBOX")),
new XElement(tns + "Axlegear", GetStandardFields("AXLEGEAR")),
new XElement(tns + "AxleWheels", axleData),
};
}
_additionalFields = new XElement(
tns + "AdditionalData",
new XElement(tns + "Vehicle",
new XElement(tns + "Make", "##VEHICLE_MAKE##")),
new XElement(tns + "Engine",
new XElement(tns + "WHTC",
new XElement(tns + "CO2", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0)),
new XElement(tns + "FuelConsumption", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0))
),
new XElement(tns + "WHSC",
new XElement(tns + "CO2", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0)),
new XElement(tns + "FuelConsumption", XMLHelper.ValueAsUnit(double.NaN, "g/kWh", 0))
)
),
new XElement(tns + "Gearbox",GetStandardFields("GEARBOX")),
new XElement(tns + "Axlegear", GetStandardFields("AXLEGEAR")),
new XElement(tns + "AxleWheels", axleData),
components,
new XElement(tns + "AdvancedReducingTechnologies", new XComment(GetReducingTechnologiesExample())),
new XElement(tns + "VectoLicenseNbr", "##VECTO_LICENSE_NUMBER##")
);
......
......@@ -107,10 +107,10 @@ namespace TUGraz.VectoCore.Tests.Integration
}
}
[TestCase()]
public void TestValidationXMLReports()
[TestCase(@"Testdata\XML\XMLReaderDeclaration\vecto_vehicle-sample.xml"),
TestCase(@"TestData\Integration\DeclarationMode\ExemptedVehicle\vecto_vehicle-sample_exempted.xml")]
public void TestValidationXMLReports(string jobfile)
{
var jobfile = @"Testdata\XML\XMLReaderDeclaration\vecto_vehicle-sample.xml";
var dataProvider = new XMLDeclarationInputDataProvider(XmlReader.Create(jobfile), true);
var writer = new FileOutputWriter(jobfile);
var xmlReport = new XMLDeclarationReport(writer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment