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

Skip to content
Snippets Groups Projects
Commit c299d2a3 authored by Harald Martini's avatar Harald Martini
Browse files

exempted heavy and medium lorries now work in mockup mode

parent 9b36ba44
No related branches found
No related tags found
No related merge requests found
Showing
with 103 additions and 36 deletions
......@@ -55,7 +55,6 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation
public override void InitializeVehicleData(IDeclarationInputDataProvider inputData)
{
var vehicle = _cifFactory.GetHEV_PxLorryVehicleType();
Vehicle = _cifFactory.GetHEV_PxLorryVehicleType().GetElement(inputData);
}
#endregion
......
......@@ -102,9 +102,9 @@ namespace TUGraz.VectoCore.OutputData.XML
protected override void InstantiateReports(VectoRunData modelData)
{
var vehicleData = modelData.VehicleData.InputData;
var iepc = vehicleData.Components.IEPC != null;
var iepc = vehicleData.Components?.IEPC != null;
var ihpc =
vehicleData.Components.ElectricMachines?.Entries?.Count(e => e.ElectricMachine.IHPCType != "None") > 0;
vehicleData.Components?.ElectricMachines?.Entries?.Count(e => e.ElectricMachine.IHPCType != "None") > 0;
ManufacturerRpt = _mrfFactory.GetManufacturerReport(vehicleData.VehicleCategory,
vehicleData.VehicleType,
......
......@@ -40,7 +40,7 @@ namespace TUGraz.VectoMockup.Ninject
public IXMLCustomerReport GetCustomerReport(VehicleCategory vehicleType, VectoSimulationJobType jobType, ArchitectureID archId,
bool exempted, bool iepc, bool ihpc)
{
return new MockupCustomerReport(_cifFactory.GetCustomerReport(vehicleType, jobType, archId, exempted, iepc, ihpc));
return new MockupCustomerReport(_cifFactory.GetCustomerReport(vehicleType, jobType, archId, exempted, iepc, ihpc), exempted);
}
public IXmlTypeWriter GetConventionalLorryVehicleType()
......
......@@ -44,7 +44,7 @@ namespace TUGraz.VectoMockup.Ninject
public IXMLManufacturerReport GetManufacturerReport(VehicleCategory vehicleType, VectoSimulationJobType jobType,
ArchitectureID archId, bool exempted, bool iepc, bool ihpc)
{
return new MockupManufacturerReport(_manufacturerReportFactoryImplementation.GetManufacturerReport(vehicleType, jobType, archId, exempted, iepc, ihpc));
return new MockupManufacturerReport(_manufacturerReportFactoryImplementation.GetManufacturerReport(vehicleType, jobType, archId, exempted, iepc, ihpc), exempted);
}
public IXmlTypeWriter GetConventionalLorryVehicleType()
......
......@@ -6,5 +6,6 @@ namespace TUGraz.VectoMockup.Reports
{
void WriteMockupResult(XMLDeclarationReport.ResultEntry resultValue);
void WriteMockupSummary(XMLDeclarationReport.ResultEntry resultValue);
void WriteExemptedResults();
}
}
\ No newline at end of file
......@@ -14,11 +14,13 @@ namespace TUGraz.VectoMockup.Reports
{
public class MockupCustomerReport : IXMLCustomerReport, IXMLMockupReport
{
private readonly AbstractCustomerReport _originalCustomerReport;
private readonly bool _exempted;
private readonly AbstractCustomerReport _originalCustomerReport;
private XNamespace Cif = AbstractCustomerReport.Cif;
public MockupCustomerReport(IXMLCustomerReport originalReport)
public MockupCustomerReport(IXMLCustomerReport originalReport, bool exempted)
{
_originalCustomerReport = originalReport as AbstractCustomerReport;
_exempted = exempted;
_originalCustomerReport = originalReport as AbstractCustomerReport;
_outputDataType = _originalCustomerReport.OutputDataType;
Results = new XElement(Cif + XMLNames.Report_Results);
}
......@@ -74,6 +76,12 @@ namespace TUGraz.VectoMockup.Reports
Results.Add(MockupResultReader.GetCIFMockupResult(_outputDataType, resultValue, Cif + "Summary", _modelData));
}
#endregion
public void WriteExemptedResults()
{
Results.Add(new XElement(Cif + "Status", "success"));
Results.Add(new XElement(Cif + "ExemptedVehicle"));
}
#endregion
}
}
\ No newline at end of file
......@@ -14,14 +14,16 @@ namespace TUGraz.VectoMockup.Reports
{
public class MockupManufacturerReport : IXMLManufacturerReport, IXMLMockupReport
{
private readonly bool _exempted;
private AbstractManufacturerReport _ixmlManufacturerReportImplementation;
private VectoRunData _modelData;
private XNamespace Mrf = AbstractManufacturerReport.Mrf;
private readonly string _outputData;
private XElement Results { get; set; }
public MockupManufacturerReport(IXMLManufacturerReport originalManufacturerReport)
public MockupManufacturerReport(IXMLManufacturerReport originalManufacturerReport, bool exempted)
{
_exempted = exempted;
_ixmlManufacturerReportImplementation = originalManufacturerReport as AbstractManufacturerReport;
_outputData = _ixmlManufacturerReportImplementation.OutputDataType;
......@@ -44,6 +46,12 @@ namespace TUGraz.VectoMockup.Reports
//Results.Add(MockupResultReader.GetMRFMockupResult(OutputDataType, resultValue, Mrf + "Summary", _ovc));
}
public void WriteExemptedResults()
{
Results.Add(new XElement(Mrf + "Status", "success"));
Results.Add(new XElement(Mrf + "ExemptedVehicle"));
}
#region Implementation of IXMLManufacturerReport
......
......@@ -60,6 +60,12 @@ namespace TUGraz.VectoMockup.Reports
Results.AddFirst(new XComment("Always prints success at the moment"));
}
public void WriteExemptedResults()
{
Results.Add(new XElement(Tns + "Status", "success"));
Results.Add(new XElement(Tns + "ExemptedVehicle"));
}
public void GenerateReport(XElement fullReportHash)
{
......
......@@ -88,7 +88,7 @@ namespace TUGraz.VectoMockup.Reports
var vehicleCategory = declarationInputDataProvider.JobInputData.Vehicle.VehicleCategory;
if (vehicleCategory.IsLorry())
{
return new XMLDeclarationMockupReport(outputDataWriter, _mrfFactory, _cifFactory);
return new XMLDeclarationMockupReport(outputDataWriter, _mrfFactory, _cifFactory, declarationInputDataProvider.JobInputData.Vehicle.ExemptedVehicle);
}
if (vehicleCategory.IsBus())
......@@ -105,6 +105,7 @@ namespace TUGraz.VectoMockup.Reports
};
case VehicleCategory.HeavyBusPrimaryVehicle:
return new XMLDeclarationMockupPrimaryReport(outputDataWriter, _mrfFactory, _cifFactory,
declarationInputDataProvider.JobInputData.Vehicle.ExemptedVehicle,
declarationInputDataProvider.JobInputData.Vehicle.VehicleCategory ==
VehicleCategory.HeavyBusPrimaryVehicle);
......
......@@ -12,22 +12,17 @@ namespace TUGraz.VectoMockup.Reports
{
public class XMLDeclarationMockupPrimaryReport : XMLDeclarationReportPrimaryVehicle_09
{
private readonly bool _exempted;
public XMLDeclarationMockupPrimaryReport(IReportWriter writer,
IManufacturerReportFactory mrfFactory,
ICustomerInformationFileFactory cifFactory,
ICustomerInformationFileFactory cifFactory, bool exempted,
bool writePIF = false) : base(writer,
mrfFactory,
cifFactory,
writePIF)
{
_exempted = exempted;
}
protected override void InstantiateReports(VectoRunData modelData)
......@@ -55,8 +50,14 @@ namespace TUGraz.VectoMockup.Reports
protected override void GenerateReports()
{
(ManufacturerRpt as IXMLMockupReport).WriteMockupSummary(Results.First());
(PrimaryReport as IXMLMockupReport).WriteMockupSummary(Results.First());
if (!_exempted) {
(ManufacturerRpt as IXMLMockupReport).WriteMockupSummary(Results.First());
(PrimaryReport as IXMLMockupReport).WriteMockupSummary(Results.First());
} else {
(ManufacturerRpt as IXMLMockupReport).WriteExemptedResults();
(PrimaryReport as IXMLMockupReport).WriteExemptedResults();
}
ManufacturerRpt.GenerateReport();
var fullReportHash = CreateDummySig();
//CustomerRpt.GenerateReport(fullReportHash);
......
......@@ -14,11 +14,13 @@ namespace TUGraz.VectoMockup.Reports
{
internal class XMLDeclarationMockupReport : XMLDeclarationReport09
{
private readonly bool _exempted;
public XMLDeclarationMockupReport(IReportWriter writer, IManufacturerReportFactory mrfFactory,
ICustomerInformationFileFactory cifFactory) :
ICustomerInformationFileFactory cifFactory, bool exempted) :
base(writer, mrfFactory, cifFactory)
{
_exempted = exempted;
}
#region Overrides of XMLDeclarationReport09
......@@ -36,8 +38,16 @@ namespace TUGraz.VectoMockup.Reports
protected override void GenerateReports()
{
(ManufacturerRpt as IXMLMockupReport).WriteMockupSummary(Results.First());
(CustomerRpt as IXMLMockupReport).WriteMockupSummary(Results.First());
if (!_exempted) {
(ManufacturerRpt as IXMLMockupReport).WriteMockupSummary(Results.First());
(CustomerRpt as IXMLMockupReport).WriteMockupSummary(Results.First());
} else {
(ManufacturerRpt as IXMLMockupReport).WriteExemptedResults();
(CustomerRpt as IXMLMockupReport).WriteExemptedResults();
}
base.GenerateReports();
}
......
using System;
using TUGraz.VectoCore.Models.Simulation.Impl;
using TUGraz.VectoCore.OutputData;
namespace TUGraz.VectoMockup.Simulation
{
internal class MockupExemptedRun : ExemptedRun
{
public MockupExemptedRun(VehicleContainer data, Action<ModalDataContainer> writeSumData) : base(data, writeSumData) { }
#region Overrides of ExemptedRun
protected override void CheckValidInput()
{
return;
}
#endregion
}
}
\ No newline at end of file
......@@ -69,14 +69,15 @@ namespace TUGraz.VectoMockup.Simulation.RundataFactories
if (InputDataProvider.JobInputData.Vehicle.ExemptedVehicle)
{
runData = new VectoRunData
{
{
Exempted = true,
Report = Report,
Mission = new Mission() { MissionType = MissionType.ExemptedMission },
VehicleData = CreateMockupVehicleData(vehicle),
InputDataHash = InputDataProvider.XMLHash
};
}
runData.VehicleData.InputData = vehicle;
}
else
{
......
......@@ -72,7 +72,15 @@ namespace TUGraz.VectoMockup.Simulation.RundataFactories
VectoRunData runData;
if (InputDataProvider.JobInputData.Vehicle.ExemptedVehicle)
{
throw new NotImplementedException();
runData = new VectoRunData
{
Exempted = true,
Report = Report,
Mission = new Mission() { MissionType = MissionType.ExemptedMission },
VehicleData = CreateMockupVehicleData(vehicle, _segment, loading),
InputDataHash = InputDataProvider.XMLHash
};
runData.VehicleData.InputData = vehicle;
}
else
{
......
......@@ -38,12 +38,16 @@ namespace TUGraz.VectoMockup.Simulation.SimulatorFactory
protected override IVectoRun GetExemptedRun(VectoRunData data)
{
//var addReportResult = PrepareReport(data);
//return new MockupRun(new VehicleContainer(ExecutionMode.Declaration,
// new ModalDataContainer(data, ReportWriter, addReportResult))
// { RunData = data });
return base.GetExemptedRun(data);
if (data.Report != null)
{
data.Report.PrepareResult(data.Loading, data.Mission, data.EngineData?.FuelMode ?? 0, data);
}
return new MockupExemptedRun(new ExemptedRunContainer(data.ExecutionMode) { RunData = data }, modData => {
if (data.Report != null)
{
data.Report.AddResult(data.Loading, data.Mission, data.EngineData?.FuelMode ?? 0, data, modData);
}
});
}
protected override IVectoRun GetNonExemptedRun(VectoRunData data, int current, VectoRunData d, ref bool warning1Hz)
......
......@@ -23,7 +23,7 @@ namespace TUGraz.VectoMockup.Simulation.SimulatorFactory
inputDataReader, validate)
{
_currentStageDeclarationReport =
new XMLDeclarationMockupPrimaryReport(_currentStageOutputDataWriter, mrfFactory, cifFactory, true);
new XMLDeclarationMockupPrimaryReport(_currentStageOutputDataWriter, mrfFactory, cifFactory, originalStageInputData.StageInputData.ExemptedVehicle,true);
}
#region Overrides of InterimAfterPrimaryFactoryCreator
......
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