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

Skip to content
Snippets Groups Projects
Commit 9090b603 authored by Franz KOBER josef's avatar Franz KOBER josef
Browse files

added xml vehicle group for Mockup

parent 937cefce
No related branches found
No related tags found
No related merge requests found
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.ManufacturerReport_0_9.ManufacturerReportGroupWriter;
namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationFile.VehicleInformationFile_0_1
{
public abstract class AbstractVIFGroupWriter : IReportOutputGroup
{
protected readonly IVIFReportFactory _vifReportFactory;
protected XNamespace _vif = "urn:tugraz:ivt:VectoAPI:DeclarationOutput:VehicleInterimFile:v0.1";
protected XNamespace _v24 = "urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.4";
protected AbstractVIFGroupWriter(IVIFReportFactory vifReportFactory)
{
_vifReportFactory = vifReportFactory;
}
#region Implementation of IReportOutputGroup
public abstract IList<XElement> GetElements(IDeclarationInputDataProvider inputData);
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationFile.VehicleInformationFile_0_1
{
public class PrimaryBusGeneralParameterGroup : AbstractVIFGroupWriter
{
public PrimaryBusGeneralParameterGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>
{
new XElement(_vif + XMLNames.Component_ManufacturerAddress, vehicle.ManufacturerAddress),
new XElement(_vif + XMLNames.Component_Model, vehicle.Model),
new XElement(_vif + XMLNames.Vehicle_VIN, vehicle.VIN),
new XElement(_vif + XMLNames.Component_Date, XmlConvert.ToString(vehicle.Date, XmlDateTimeSerializationMode.Utc)),
new XElement(_vif + XMLNames.Component_Manufacturer, vehicle.Manufacturer)
};
return result;
}
#endregion
}
public class PrimaryBusChassisParameterGroup : AbstractVIFGroupWriter
{
public PrimaryBusChassisParameterGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>
{
new XElement(_vif + XMLNames.Vehicle_LegislativeCategory, vehicle.LegislativeClass.ToXMLFormat()),
new XElement(_vif + XMLNames.ChassisConfiguration, vehicle.VehicleCategory.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_AxleConfiguration, vehicle.AxleConfiguration.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_Articulated, vehicle.Articulated),
new XElement(_vif + XMLNames.TPMLM, vehicle.GrossVehicleMassRating.ToXMLFormat()),
};
return result;
}
#endregion
}
public class PrimaryBusRetarderParameterGroup : AbstractVIFGroupWriter
{
public PrimaryBusRetarderParameterGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>
{
new XElement(_vif + XMLNames.Vehicle_RetarderType, vehicle.Components.RetarderInputData.Type.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_RetarderRatio, vehicle.Components.RetarderInputData?.Ratio.ToXMLFormat(3)),
};
return result;
}
#endregion
}
public class PrimaryBusXeVParameterGroup : AbstractVIFGroupWriter
{
public PrimaryBusXeVParameterGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>
{
new XElement(_vif + XMLNames.Vehicle_OvcHev, vehicle.Components.RetarderInputData.Type.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_RetarderRatio, vehicle.Components.RetarderInputData?.Ratio.ToXMLFormat(3)),
};
return result;
}
#endregion
}
public class ConventionalVIFVehicleGroup : AbstractVIFGroupWriter
{
public ConventionalVIFVehicleGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement> {
new XElement(_vif + XMLNames.ManufacturerAddressPrimaryVehicle, vehicle.Manufacturer),
new XElement(_vif + XMLNames.ManufacturerAddressPrimaryVehicle, vehicle.ManufacturerAddress),
new XElement(_vif +XMLNames.Component_Model, vehicle.Model),
new XElement(_vif + XMLNames.Vehicle_VIN, vehicle.VIN),
new XElement(_vif + XMLNames.Component_Date, XmlConvert.ToString(vehicle.Date, XmlDateTimeSerializationMode.Utc)),
new XElement(_vif + XMLNames.Vehicle_LegislativeCategory, vehicle.LegislativeClass.ToXMLFormat()),
new XElement(_vif + XMLNames.ChassisConfiguration, vehicle.VehicleCategory.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_AxleConfiguration, vehicle.AxleConfiguration.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_Articulated, vehicle.Articulated),
new XElement(_vif + XMLNames.TPMLM, vehicle.GrossVehicleMassRating.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_IdlingSpeed, vehicle.EngineIdleSpeed.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_RetarderType, vehicle.Components.RetarderInputData.Type.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_RetarderRatio, vehicle.Components.RetarderInputData.Ratio.ToXMLFormat(3)),
new XElement(_vif + XMLNames.Vehicle_AngledriveType, vehicle.Components.AngledriveInputData.Type.ToXMLFormat()),
new XElement(_vif + XMLNames.Vehicle_ZeroEmissionVehicle, vehicle.ZeroEmissionVehicle),
_vifReportFactory.GetAdasType().GetElement(inputData),
_vifReportFactory.GetTorqueLimitsType().GetElement(inputData),
};
return result;
}
#endregion
}
public class HevIepcSVehicleGroup : AbstractVIFGroupWriter
{
public HevIepcSVehicleGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>();
result.AddRange(_vifReportFactory.GetPrimaryBusGeneralParameterGroup().GetElements(inputData));
result.AddRange(_vifReportFactory.GetPrimaryBusChassisParameterGroup().GetElements(inputData));
result.Add(new XElement(_vif + XMLNames.Vehicle_IdlingSpeed, vehicle.EngineIdleSpeed.ToXMLFormat()));
result.AddRange(_vifReportFactory.GetPrimaryBusRetarderParameterGroup().GetElements(inputData));
result.Add(new XElement(_vif + XMLNames.Vehicle_AngledriveType, vehicle.Components.AngledriveInputData.Type.ToXMLFormat()));
result.Add(new XElement(_vif + XMLNames.Vehicle_ZeroEmissionVehicle, vehicle.ZeroEmissionVehicle));
result.Add(new XElement(_vif + XMLNames.Vehicle_ArchitectureID, vehicle.ArchitectureID.GetLabel()));
result.AddRange(_vifReportFactory.GetPrimaryBusXeVParameterGroup().GetElements(inputData));
result.Add(_vifReportFactory.GetAdasType().GetElement(inputData));
var electricMotorTorque = _vifReportFactory.GetElectricMotorTorqueLimitsType().GetElement(inputData);
if(electricMotorTorque != null)
result.Add(electricMotorTorque);
return result;
}
#endregion
}
public class HevSxVehicleGroup : AbstractVIFGroupWriter
{
public HevSxVehicleGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>();
result.AddRange(_vifReportFactory.GetPrimaryBusGeneralParameterGroup().GetElements(inputData));
result.AddRange(_vifReportFactory.GetPrimaryBusChassisParameterGroup().GetElements(inputData));
result.Add(new XElement(_vif + XMLNames.Vehicle_IdlingSpeed, vehicle.EngineIdleSpeed.ToXMLFormat()));
result.AddRange(_vifReportFactory.GetPrimaryBusRetarderParameterGroup().GetElements(inputData));
result.Add(new XElement(_vif + XMLNames.Vehicle_AngledriveType, vehicle.Components.AngledriveInputData.Type.ToXMLFormat()));
result.Add(new XElement(_vif + XMLNames.Vehicle_ZeroEmissionVehicle, vehicle.ZeroEmissionVehicle));
result.Add(new XElement(_vif + XMLNames.Vehicle_ArchitectureID, vehicle.ArchitectureID.GetLabel()));
result.AddRange(_vifReportFactory.GetPrimaryBusXeVParameterGroup().GetElements(inputData));
result.Add(_vifReportFactory.GetAdasType().GetElement(inputData));
var electricMotorTorque = _vifReportFactory.GetElectricMotorTorqueLimitsType().GetElement(inputData);
if (electricMotorTorque != null)
result.Add(electricMotorTorque);
return result;
}
#endregion
}
public class IepcVehicleGroup : AbstractVIFGroupWriter
{
public IepcVehicleGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>();
result.AddRange(_vifReportFactory.GetPrimaryBusGeneralParameterGroup().GetElements(inputData));
result.AddRange(_vifReportFactory.GetPrimaryBusChassisParameterGroup().GetElements(inputData));
result.AddRange(_vifReportFactory.GetPrimaryBusRetarderParameterGroup().GetElements(inputData));
result.Add(new XElement(_vif + XMLNames.Vehicle_AngledriveType, vehicle.Components.AngledriveInputData.Type.ToXMLFormat()));
result.Add(new XElement(_vif + XMLNames.Vehicle_ZeroEmissionVehicle, vehicle.ZeroEmissionVehicle));
result.Add(new XElement(_vif + XMLNames.Vehicle_ArchitectureID, vehicle.ArchitectureID.GetLabel()));
result.AddRange(_vifReportFactory.GetPrimaryBusXeVParameterGroup().GetElements(inputData));
result.Add(_vifReportFactory.GetAdasType().GetElement(inputData));
return result;
}
#endregion
}
public class PEVVehicleGroup : AbstractVIFGroupWriter
{
public PEVVehicleGroup(IVIFReportFactory vifReportFactory) : base(vifReportFactory) { }
#region Overrides of AbstractVIFGroupWriter
public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData)
{
var vehicle = inputData.JobInputData.Vehicle;
var result = new List<XElement>();
result.AddRange(_vifReportFactory.GetPrimaryBusGeneralParameterGroup().GetElements(inputData));
result.AddRange(_vifReportFactory.GetPrimaryBusChassisParameterGroup().GetElements(inputData));
result.AddRange(_vifReportFactory.GetPrimaryBusRetarderParameterGroup().GetElements(inputData));
result.Add(new XElement(_vif + XMLNames.Vehicle_AngledriveType, vehicle.Components.AngledriveInputData.Type.ToXMLFormat()));
result.Add(new XElement(_vif + XMLNames.Vehicle_ZeroEmissionVehicle, vehicle.ZeroEmissionVehicle));
result.Add(new XElement(_vif + XMLNames.Vehicle_ArchitectureID, vehicle.ArchitectureID.GetLabel()));
result.AddRange(_vifReportFactory.GetPrimaryBusXeVParameterGroup().GetElements(inputData));
result.Add(_vifReportFactory.GetAdasType().GetElement(inputData));
var motorTorqueLimits = _vifReportFactory.GetElectricMotorTorqueLimitsType().GetElement(inputData);
if(motorTorqueLimits != null)
result.Add(motorTorqueLimits);
return result;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.ManufacturerReport_0_9.ManufacturerReportXMLTypeWriter;
namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationFile.VehicleInformationFile_0_1
{
public abstract class VehicleWriter : IXmlTypeWriter
{
protected readonly IVIFReportFactory _vifReportFactory;
protected XNamespace _vif = "urn:tugraz:ivt:VectoAPI:DeclarationOutput:VehicleInterimFile:v0.1";
protected XNamespace _xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance");
public VehicleWriter(IVIFReportFactory vifReportFactory)
{
_vifReportFactory = vifReportFactory;
}
#region Implementation of IXmlTypeWriter
public abstract XElement GetElement(IDeclarationInputDataProvider inputData);
#endregion
}
public class VIFConventionalVehicle : VehicleWriter
{
public VIFConventionalVehicle(IVIFReportFactory vifReportFactory) : base(vifReportFactory)
{
}
#region Overrides of VehicleWriter
public override XElement GetElement(IDeclarationInputDataProvider inputData)
{
var commonVehicleGroup = _vifReportFactory.GetConventionalVehicleGroup().GetElements(inputData);
var component = new XElement(_vif + XMLNames.Vehicle_Components,
new XAttribute(_xsi + "type", "vif:Vehicle_Conventional_ComponentsVIFType"),
_vifReportFactory.GetEngineType().GetElement(inputData),
_vifReportFactory.GetTransmissionType().GetElement(inputData),
_vifReportFactory.GetTorqueConvertType().GetElement(inputData),
_vifReportFactory.GetAngelDriveType().GetElement(inputData),
_vifReportFactory.GetAxlegearType().GetElement(inputData),
_vifReportFactory.GetAxleWheelsType().GetElement(inputData),
_vifReportFactory.GetAuxiliaryType().GetElement(inputData));
commonVehicleGroup.Add(component);
return new XElement(_vif + XMLNames.Component_Vehicle, commonVehicleGroup);
}
#endregion
}
}
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