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

Skip to content
Snippets Groups Projects
Commit d04b3b38 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Merge remote-tracking branch 'origin/develop' into...

Merge remote-tracking branch 'origin/develop' into bugfix/VECTO-425-vectocmd-invalid-handle-progress
parents fd6bd650 3dee632a
No related branches found
No related tags found
No related merge requests found
......@@ -369,7 +369,7 @@ namespace TUGraz.VectoCore.OutputData
public static SI FuelConsumptionFinalLiterPer100Kilometer(this IModalDataContainer data)
{
var fuelConsumptionFinal = data.FuelConsumptionFinal();
if (fuelConsumptionFinal == null) {
if (fuelConsumptionFinal == null || data.FuelData.FuelDensity == null) {
return null;
}
......@@ -538,12 +538,15 @@ namespace TUGraz.VectoCore.OutputData
retVal[i] = 0.SI<Scalar>();
}
data.GetValues(x => {
var gear = x.Field<uint>((int)ModalResultField.Gear);
retVal[gear] += x.Field<Second>((int)ModalResultField.simulationInterval).Value();
return gear; // not used
var gearData = data.GetValues(x => new {
Gear = x.Field<uint>((int)ModalResultField.Gear),
dt = x.Field<Second>((int)ModalResultField.simulationInterval)
});
foreach (var entry in gearData) {
retVal[entry.Gear] += entry.dt.Value();
}
var duration = Duration(data).Value();
for (uint i = 0; i <= gearCount; i++) {
retVal[i] = 100 * retVal[i] / duration;
......
......@@ -462,13 +462,15 @@ namespace TUGraz.VectoCore.OutputData
if (fcfinal != null) {
row[FCFINAL_KM] = fcfinal.ConvertTo().Gramm.Per.Kilo.Meter;
}
row[FCFINAL_LITERPER100KM] = modData.FuelConsumptionFinalLiterPer100Kilometer();
if (vehicleLoading != null && !vehicleLoading.IsEqual(0)) {
row[FCFINAL_LITERPER100TKM] = (modData.FuelConsumptionFinalLiterPer100Kilometer() ?? 0.SI()) /
var fcPer100lkm = modData.FuelConsumptionFinalLiterPer100Kilometer();
row[FCFINAL_LITERPER100KM] = fcPer100lkm;
if (vehicleLoading != null && !vehicleLoading.IsEqual(0) && fcPer100lkm != null) {
row[FCFINAL_LITERPER100TKM] = fcPer100lkm /
vehicleLoading.ConvertTo().Ton;
}
if (cargoVolume > 0) {
row[FCFINAL_LiterPer100M3KM] = (modData.FuelConsumptionFinalLiterPer100Kilometer() ?? 0.SI()) / cargoVolume;
if (cargoVolume > 0 && fcPer100lkm != null) {
row[FCFINAL_LiterPer100M3KM] = fcPer100lkm / cargoVolume;
}
var kilogramPerMeter = modData.CO2PerMeter();
......
......@@ -88,7 +88,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(tns + "GearsCount", modelData.GearboxData.Gears.Count),
new XElement(tns + "Retarder", modelData.Retarder.Type.IsDedicatedComponent()),
new XElement(tns + "AxleRatio", modelData.AxleGearData.AxleGear.Ratio.ToXMLFormat(3))
);
);
InputDataIntegrity = new XElement(tns + "InputDataSignature",
modelData.InputDataHash == null ? CreateDummySig() : new XElement(modelData.InputDataHash));
}
......@@ -99,7 +99,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(di + XMLNames.DI_Signature_Reference_DigestMethod,
new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "null")),
new XElement(di + XMLNames.DI_Signature_Reference_DigestValue, "NOT AVAILABLE")
);
);
}
public void AddResult(
......@@ -144,7 +144,7 @@ namespace TUGraz.VectoCore.OutputData.XML
private XElement GetApplicationInfo()
{
var vectodll = AssemblyName.GetAssemblyName("VectoCore.dll");
var vectodll = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "VectoCore.dll").GetName();
return new XElement(tns + "ApplicationInformation",
new XElement(tns + "SimulationToolVersion", vectodll.Version),
new XElement(tns + "Date", XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc)));
......@@ -159,19 +159,19 @@ namespace TUGraz.VectoCore.OutputData.XML
var vehicle = new XElement(VehiclePart);
vehicle.Add(InputDataIntegrity);
retVal.Add(new XElement(tns + "VectoCustomerInformation",
new XAttribute("schemaVersion", "0.4"),
new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName),
new XAttribute("xmlns", tns),
new XAttribute(XNamespace.Xmlns + "di", di),
new XAttribute(xsi + "schemaLocation",
string.Format("{0} {1}VectoCOC.xsd", tns, AbstractXMLWriter.SchemaLocationBaseUrl)),
new XElement(tns + "Data",
vehicle,
new XElement(tns + "ResultDataSignature", resultSignature),
results,
GetApplicationInfo())
new XAttribute("schemaVersion", "0.4"),
new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName),
new XAttribute("xmlns", tns),
new XAttribute(XNamespace.Xmlns + "di", di),
new XAttribute(xsi + "schemaLocation",
string.Format("{0} {1}VectoCOC.xsd", tns, AbstractXMLWriter.SchemaLocationBaseUrl)),
new XElement(tns + "Data",
vehicle,
new XElement(tns + "ResultDataSignature", resultSignature),
results,
GetApplicationInfo())
)
);
);
var stream = new MemoryStream();
var writer = new StreamWriter(stream);
writer.Write(retVal);
......
......@@ -61,7 +61,6 @@ namespace TUGraz.VectoCore.OutputData.XML
protected XNamespace di;
private bool allSuccess = true;
public XMLFullReport()
{
di = "http://www.w3.org/2000/09/xmldsig#";
......@@ -91,8 +90,8 @@ namespace TUGraz.VectoCore.OutputData.XML
GetAirDragDescription(modelData.AirdragData),
GetAxleWheelsDescription(modelData.VehicleData),
GetAuxiliariesDescription(modelData.Aux)
)
);
)
);
InputDataIntegrity = new XElement(tns + "InputDataSignature",
modelData.InputDataHash == null ? CreateDummySig() : new XElement(modelData.InputDataHash));
}
......@@ -103,7 +102,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(di + XMLNames.DI_Signature_Reference_DigestMethod,
new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "null")),
new XElement(di + XMLNames.DI_Signature_Reference_DigestValue, "NOT AVAILABLE")
);
);
}
private XElement GetTorqueLimits(CombustionEngineData modelData)
......@@ -134,7 +133,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(tns + XMLNames.Engine_Displacement,
engineData.Displacement.ConvertTo().Cubic.Centi.Meter.ToXMLFormat(0)),
new XElement(tns + XMLNames.Engine_FuelType, engineData.FuelType.ToXMLFormat())
);
);
}
private XElement GetGearboxDescription(GearboxData gearboxData)
......@@ -144,7 +143,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(tns + XMLNames.Gearbox_TransmissionType, gearboxData.Type.ToXMLFormat()),
new XElement(tns + "GearsCount", gearboxData.Gears.Count),
new XElement(tns + "TransmissionRatioFinalGear", gearboxData.Gears.Last().Value.Ratio.ToXMLFormat(3))
);
);
}
private XElement GetTorqueConverterDescription(TorqueConverterData torqueConverterData)
......@@ -187,7 +186,7 @@ namespace TUGraz.VectoCore.OutputData.XML
return new XElement(tns + XMLNames.Component_AirDrag,
new XElement(tns + "CertificationMethod", airdragData.CertificationMethod.ToXMLFormat()),
new XElement(tns + "CdxA", airdragData.DeclaredAirdragArea.ToXMLFormat(2))
);
);
}
return new XElement(tns + XMLNames.Component_AirDrag,
new XElement(tns + XMLNames.Component_Model, airdragData.ModelName),
......@@ -195,7 +194,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(tns + "CertificationNumber", airdragData.CertificationNumber),
new XElement(tns + XMLNames.DI_Signature_Reference_DigestValue, airdragData.DigestValueInput),
new XElement(tns + "CdxA", airdragData.DeclaredAirdragArea.ToXMLFormat(2))
);
);
}
private XElement GetAxleWheelsDescription(VehicleData vehicleData)
......@@ -303,7 +302,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(tns + "TotalVehicleMass", new XAttribute("unit", "kg"), result.TotalVehicleWeight.ToXMLFormat(0)),
new XElement(tns + "Payload", new XAttribute("unit", "kg"), result.Payload.ToXMLFormat(0)),
new XElement(tns + "FuelType", result.FuelType.ToXMLFormat())
),
),
new XElement(tns + "VehiclePerformance",
new XElement(tns + "AverageSpeed", new XAttribute("unit", "km/h"), result.AverageSpeed.AsKmph.ToXMLFormat(1)),
new XElement(tns + "MinSpeed", new XAttribute("unit", "km/h"), result.MinSpeed.AsKmph.ToXMLFormat(1)),
......@@ -312,7 +311,7 @@ namespace TUGraz.VectoCore.OutputData.XML
new XElement(tns + "MaxAcceleration", new XAttribute("unit", "m/s²"), result.MaxAcceleration.ToXMLFormat(2)),
new XElement(tns + "FullLoadDrivingtimePercentage", result.FullLoadPercentage.ToXMLFormat(0)),
new XElement(tns + "GearshiftCount", result.GearshiftCount.ToXMLFormat(0))
),
),
//FC
XMLDeclarationReport.GetResults(result, tns, true).Cast<object>().ToArray()
};
......@@ -320,7 +319,7 @@ namespace TUGraz.VectoCore.OutputData.XML
private XElement GetApplicationInfo()
{
var vectodll = AssemblyName.GetAssemblyName("VectoCore.dll");
var vectodll = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "VectoCore.dll").GetName();
return new XElement(tns + "ApplicationInformation",
new XElement(tns + "SimulationToolVersion", vectodll.Version),
new XElement(tns + "Date", XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc)));
......@@ -335,18 +334,18 @@ namespace TUGraz.VectoCore.OutputData.XML
var vehicle = new XElement(VehiclePart);
vehicle.Add(InputDataIntegrity);
retVal.Add(new XElement(tns + "VectoOutput",
new XAttribute("schemaVersion", "0.4"),
new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName),
new XAttribute("xmlns", tns),
new XAttribute(XNamespace.Xmlns + "di", di),
new XAttribute(xsi + "schemaLocation",
string.Format("{0} {1}VectoOutput.xsd", tns, AbstractXMLWriter.SchemaLocationBaseUrl)),
new XElement(tns + "Data",
vehicle,
results,
GetApplicationInfo())
new XAttribute("schemaVersion", "0.4"),
new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName),
new XAttribute("xmlns", tns),
new XAttribute(XNamespace.Xmlns + "di", di),
new XAttribute(xsi + "schemaLocation",
string.Format("{0} {1}VectoOutput.xsd", tns, AbstractXMLWriter.SchemaLocationBaseUrl)),
new XElement(tns + "Data",
vehicle,
results,
GetApplicationInfo())
)
);
);
var stream = new MemoryStream();
var writer = new StreamWriter(stream);
writer.Write(retVal);
......
FuelType , FuelDensity [kg/m3] , CO2 per FuelWeight [kgCo2/kgFuel] , Lower Heating Value [kJ/kg]
Diesel CI , 832 , 3.16 , 42700
Ethanol CI , 794 , 1.91 , 29200
Petrol PI , 745 , 3.17 , 41500
Ethanol PI , 794 , 1.91 , 29200
Diesel CI , 836 , 3.13 , 42700
Ethanol CI , 820 , 1.83 , 25400
Petrol PI , 750 , 3.04 , 41500
Ethanol PI , 786 , 2.09 , 29200
LPG , , 3.02 , 46000
NG , , 2.54 , 45100
\ No newline at end of file
......@@ -210,7 +210,7 @@ namespace TUGraz.VectoCore.Utils
return;
}
if (addVersionHeader) {
var vectodll = AssemblyName.GetAssemblyName("VectoCore.dll");
var vectodll = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "VectoCore.dll").GetName();
writer.WriteLine("# VECTO {0} - {1}", vectodll.Version, DateTime.Now.ToString("dd.MM.yyyy HH:mm"));
}
var header = table.Columns.Cast<DataColumn>().Select(col => col.Caption ?? col.ColumnName);
......
......@@ -401,7 +401,7 @@
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Resources\XSD\VectoOutput.xsd">
<EmbeddedResource Include="Resources\XSD\VectoOutputManufacturer.xsd">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\XSD\xmldsig-core-schema.xsd">
......@@ -413,6 +413,9 @@
<EmbeddedResource Include="Resources\XSD\VectoDeclarationDefinitions.1.0.xsd">
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="Resources\XSD\VectoOutputCustomer.xsd">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Declaration\Report\4x2r.png" />
......
......@@ -43,16 +43,16 @@ namespace TUGraz.VectoCore.Tests.Integration
public class FuelTypesTest
{
[TestCase(FuelType.DieselCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.0006944, 9394.4751,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.0006886, 9394.4751,
TestName = "Diesel LH Low"),
TestCase(FuelType.EthanolCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.0004197, 6424.3249,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.00040262, 5588.282,
TestName = "Ethanol LH Low"),
TestCase(FuelType.DieselCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0008048, 10875.0171,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0007971, 10875.0171,
TestName = "Diesel LH Ref"),
TestCase(FuelType.EthanolCI,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0004864, 7436.7798,
@"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0004660, 6468.9797,
TestName = "Ethanol LH Ref"),]
public void TestFuelTypesCO2(FuelType fuelType, string jobName, int runIdx, double expectedCo2, double expectedMJ)
{
......
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