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

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

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

Merge pull request #740 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:feature/VECTO-922-integrate-vecto-into-vecto-git to develop

* commit '9f9f7ef2':
  refactoring: move digestData class to separate file
  extending xml declaration data provider to allwo reading component data from separate XML documents
parents 12a40378 9f9f7ef2
No related branches found
No related tags found
No related merge requests found
Showing
with 435 additions and 197 deletions
......@@ -69,6 +69,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HashingCmd", "HashingCmd\Ha
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Article10Notifications", "..\VECTO-Article10\Article10Notifications\Article10Notifications.csproj", "{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VECTO_GIT", "..\STUDENTEN_PROJEKTE\Kober_VectoGIT\VECTO_GIT\VECTO_GIT\VECTO_GIT.csproj", "{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug PerformanceStats|Any CPU = Debug PerformanceStats|Any CPU
......@@ -724,6 +726,48 @@ Global
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x64.Build.0 = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x86.Build.0 = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceStats|Any CPU.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceStats|x64.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceStats|x86.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceStats|x86.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceTrace|Any CPU.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceTrace|Any CPU.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceTrace|x64.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceTrace|x64.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceTrace|x86.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug PerformanceTrace|x86.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug|x64.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug|x64.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug|x86.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Debug|x86.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.DebugTUG|Any CPU.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.DebugTUG|Any CPU.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.DebugTUG|x64.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.DebugTUG|x64.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.DebugTUG|x86.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.DebugTUG|x86.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Deploy|Any CPU.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Deploy|x64.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Deploy|x64.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Deploy|x86.ActiveCfg = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Deploy|x86.Build.0 = Debug|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Release|Any CPU.Build.0 = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Release|x64.ActiveCfg = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Release|x64.Build.0 = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Release|x86.ActiveCfg = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.Release|x86.Build.0 = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.ReleaseTUG|Any CPU.ActiveCfg = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.ReleaseTUG|x64.Build.0 = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU
{A684BC49-C9B3-4C0C-8D2E-A13077853EDA}.ReleaseTUG|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
namespace TUGraz.VectoCommon.InputData {
public class DigestData
{
private const string ReferenceElementXPath = ".//*[local-name()='Reference']";
private const string TransformElementXPath = ".//*[local-name()='Transform']";
private const string DigestMethodElementXPath = ".//*[local-name()='DigestMethod']";
private const string UriAttr = "URI";
private const string AlgorithmAttr = "Algorithm";
private const string ReferenceUriAttrXPath = ReferenceElementXPath + "/@" + UriAttr;
private const string TransformAlgorithmAttrXPath = TransformElementXPath + "/@" + AlgorithmAttr;
private const string DigestMethodAlgorithmAttrXPath = DigestMethodElementXPath + "/@" + AlgorithmAttr;
private const string DigestValueElementXPath = ".//*[local-name()='DigestValue']";
public DigestData(string reference, string[] c14n, string digestMethod, string digestValue)
{
Reference = reference;
CanonicalizationMethods = c14n;
DigestMethod = digestMethod;
DigestValue = digestValue;
}
public DigestData(XPathNavigator navigator)
{
Reference = navigator.SelectSingleNode(ReferenceUriAttrXPath)?.InnerXml;
var nodes = navigator.Select(TransformAlgorithmAttrXPath);
var c14n = new List<string>();
while (nodes.MoveNext()) {
c14n.Add(nodes.Current.InnerXml);
}
CanonicalizationMethods = c14n.ToArray();
DigestMethod = navigator.SelectSingleNode(DigestMethodAlgorithmAttrXPath)?.InnerXml;
DigestValue = navigator.SelectSingleNode(DigestValueElementXPath)?.InnerXml;
}
public DigestData(XmlNode xmlNode)
{
Reference = xmlNode.SelectSingleNode(ReferenceUriAttrXPath)?.InnerXml;
var nodes = xmlNode.SelectNodes(TransformAlgorithmAttrXPath);
var c14n = new List<string>();
if (nodes != null) {
for (var i = 0; i < nodes.Count; i++) {
c14n.Add(nodes[i].InnerXml);
}
}
CanonicalizationMethods = c14n.ToArray();
DigestMethod = xmlNode.SelectSingleNode(DigestMethodAlgorithmAttrXPath)?.InnerXml;
DigestValue = xmlNode.SelectSingleNode(DigestValueElementXPath)?.InnerXml;
}
public DigestData(XNode xmlNode)
{
Reference = xmlNode.XPathSelectElement(ReferenceElementXPath)?.Attribute(XName.Get(UriAttr))?.Value;
var nodes = xmlNode.XPathSelectElements(TransformElementXPath);
var c14n = new List<string>();
foreach (var node in nodes) {
c14n.Add(node.Attribute(XName.Get(AlgorithmAttr))?.Value);
}
CanonicalizationMethods = c14n.ToArray();
DigestMethod = xmlNode.XPathSelectElement(DigestMethodElementXPath)?.Attribute(XName.Get(AlgorithmAttr))?.Value;
DigestValue = xmlNode.XPathSelectElement(DigestValueElementXPath)?.Value;
}
public string DigestValue { get; }
public string Reference { get; }
public string[] CanonicalizationMethods { get; }
public string DigestMethod { get; }
}
}
\ No newline at end of file
......@@ -30,8 +30,7 @@
*/
using System.Collections.Generic;
using System.Xml;
using System.Xml.XPath;
using System.Linq;
using TUGraz.VectoCommon.Hashing;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoHashing;
......@@ -73,56 +72,4 @@ namespace TUGraz.VectoCommon.InputData
DigestData JobDigest { get; }
}
public class DigestData
{
private const string ReferenceQueryXPath = ".//*[local-name()='Reference']/@URI";
private const string AlgorithmQueryXPath = ".//*[local-name()='Transform']/@Algorithm";
private const string DigestMethodQueryXPath = ".//*[local-name()='DigestMethod']/@Algorithm";
private const string DigestValueQuerXPath = ".//*[local-name()='DigestValue']";
public DigestData(string reference, string[] c14n, string digestMethod, string digestValue)
{
Reference = reference;
CanonicalizationMethods = c14n;
DigestMethod = digestMethod;
DigestValue = digestValue;
}
public DigestData(XPathNavigator navigator)
{
Reference = navigator.SelectSingleNode(ReferenceQueryXPath)?.InnerXml;
var nodes = navigator.Select(AlgorithmQueryXPath);
var c14n = new List<string>();
while (nodes.MoveNext()) {
c14n.Add(nodes.Current.InnerXml);
}
CanonicalizationMethods = c14n.ToArray();
DigestMethod = navigator.SelectSingleNode(DigestMethodQueryXPath)?.InnerXml;
DigestValue = navigator.SelectSingleNode(DigestValueQuerXPath)?.InnerXml;
}
public DigestData(XmlNode xmlNode)
{
Reference = xmlNode.SelectSingleNode(ReferenceQueryXPath)?.InnerXml;
var nodes = xmlNode.SelectNodes(AlgorithmQueryXPath);
var c14n = new List<string>();
if (nodes != null) {
for (var i = 0; i < nodes.Count; i++) {
c14n.Add(nodes[i].InnerXml);
}
}
CanonicalizationMethods = c14n.ToArray();
DigestMethod = xmlNode.SelectSingleNode(DigestMethodQueryXPath)?.InnerXml;
DigestValue = xmlNode.SelectSingleNode(DigestValueQuerXPath)?.InnerXml;
}
public string DigestValue { get; }
public string Reference { get; }
public string[] CanonicalizationMethods { get; }
public string DigestMethod { get; }
}
}
......@@ -53,6 +53,7 @@
<Compile Include="Hashing\IVectoHash.cs" />
<Compile Include="Hashing\VectoComponents.cs" />
<Compile Include="InputData\DataSourceType.cs" />
<Compile Include="InputData\DigestData.cs" />
<Compile Include="InputData\TableData.cs">
<SubType>Component</SubType>
</Compile>
......
......@@ -175,6 +175,8 @@ namespace TUGraz.VectoCore.Configuration
public const string VectoDeclarationDefinitionsNS =
"urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v" + XSDDeclarationVersion;
public const string VectoDeclarationComponentNS = "urn:tugraz:ivt:VectoAPI:DeclarationComponent:v" + XSDDeclarationVersion;
public const string VectoEngineeringDefinitionsNS =
"urn:tugraz:ivt:VectoAPI:EngineeringDefinitions:v" + XSDEngineeringVersion;
......
......@@ -29,10 +29,16 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
......@@ -48,6 +54,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper);
}
public XMLDeclarationAirdragDataProvider(XDocument xml)
{
if (xml.Document == null) {
throw new ArgumentException("No Document found");
}
Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
Helper = new XPathHelper(ExecutionMode.Declaration);
Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
Helper.NSPrefix(XMLNames.Component_AirDrag, Constants.XML.RootNSPrefix),
XMLNames.ComponentDataWrapper);
SourceType = DataSourceType.Embedded;
}
public new CertificationMethod CertificationMethod
{
get { return CertificationMethod.Measured; }
......
......@@ -29,11 +29,17 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
......@@ -47,6 +53,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper);
}
public XMLDeclarationAngledriveDataProvider(XDocument xml)
{
if (xml.Document == null) {
throw new ArgumentException("No Document found");
}
Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
Helper = new XPathHelper(ExecutionMode.Declaration);
Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
Helper.NSPrefix(XMLNames.Component_Angledrive, Constants.XML.RootNSPrefix),
XMLNames.ComponentDataWrapper);
SourceType = DataSourceType.Embedded;
}
public AngledriveType Type
{
get { return InputData.XMLJob.XMLVehicle.AngulargearType; }
......
......@@ -29,50 +29,73 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
public class XMLDeclarationAxlegearDataProvider : AbstractDeclarationXMLComponentDataProvider, IAxleGearInputData
{
public XMLDeclarationAxlegearDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider)
: base(xmlInputDataProvider)
{
XBasePath = Helper.Query(VehiclePath,
XMLNames.Vehicle_Components,
XMLNames.Component_Axlegear,
XMLNames.ComponentDataWrapper);
}
public double Ratio
{
get { return GetDoubleElementValue(XMLNames.Axlegear_Ratio); }
}
public TableData LossMap
{
get {
return ReadTableData(AttributeMappings.TransmissionLossmapMapping,
Helper.Query(XMLNames.Axlegear_TorqueLossMap, XMLNames.Axlegear_TorqueLossMap_Entry));
}
}
public double Efficiency
{
get { throw new VectoException("Efficiency not supported in Declaration Mode!"); }
}
public AxleLineType LineType
{
get {
var value = GetElementValue(XMLNames.Axlegear_LineType);
return value.ParseEnum<AxleLineType>();
}
}
}
using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
public class XMLDeclarationAxlegearDataProvider : AbstractDeclarationXMLComponentDataProvider, IAxleGearInputData
{
public XMLDeclarationAxlegearDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider)
: base(xmlInputDataProvider)
{
XBasePath = Helper.Query(VehiclePath,
XMLNames.Vehicle_Components,
XMLNames.Component_Axlegear,
XMLNames.ComponentDataWrapper);
}
public XMLDeclarationAxlegearDataProvider(XDocument xml)
{
if (xml.Document == null) {
throw new ArgumentException("No Document found");
}
Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
Helper = new XPathHelper(ExecutionMode.Declaration);
Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
Helper.NSPrefix(XMLNames.Component_Axlegear, Constants.XML.RootNSPrefix),
XMLNames.ComponentDataWrapper);
SourceType = DataSourceType.Embedded;
}
public double Ratio
{
get { return GetDoubleElementValue(XMLNames.Axlegear_Ratio); }
}
public TableData LossMap
{
get {
return ReadTableData(AttributeMappings.TransmissionLossmapMapping,
Helper.Query(XMLNames.Axlegear_TorqueLossMap, XMLNames.Axlegear_TorqueLossMap_Entry));
}
}
public double Efficiency
{
get { throw new VectoException("Efficiency not supported in Declaration Mode!"); }
}
public AxleLineType LineType
{
get {
var value = GetElementValue(XMLNames.Axlegear_LineType);
return value.ParseEnum<AxleLineType>();
}
}
}
}
\ No newline at end of file
......@@ -30,11 +30,16 @@
*/
using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
......@@ -50,6 +55,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper);
}
public XMLDeclarationEngineDataProvider(XDocument xml)
{
if (xml.Document == null) {
throw new ArgumentException("No Document found");
}
Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
Helper = new XPathHelper(ExecutionMode.Declaration);
Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
Helper.NSPrefix(XMLNames.Component_Engine, Constants.XML.RootNSPrefix),
XMLNames.ComponentDataWrapper);
SourceType = DataSourceType.Embedded;
}
public CubicMeter Displacement
{
get { return GetDoubleElementValue(XMLNames.Engine_Displacement).SI(Unit.SI.Cubic.Centi.Meter).Cast<CubicMeter>(); }
......
......@@ -29,95 +29,116 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Collections.Generic;
using System.Xml;
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.Impl;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
public class XMLDeclarationGearboxDataProvider : AbstractDeclarationXMLComponentDataProvider,
IGearboxDeclarationInputData
{
public XMLDeclarationGearboxDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider)
: base(xmlInputDataProvider)
{
XBasePath = Helper.Query(VehiclePath,
XMLNames.Vehicle_Components,
XMLNames.Component_Gearbox,
XMLNames.ComponentDataWrapper);
}
public new CertificationMethod CertificationMethod
{
get { return GetElementValue(XMLNames.Component_Gearbox_CertificationMethod).ParseEnum<CertificationMethod>(); }
}
public GearboxType Type
{
get {
var value = GetElementValue(XMLNames.Gearbox_TransmissionType);
switch (value) {
case "MT":
case "SMT":
return GearboxType.MT;
case "AMT":
return GearboxType.AMT;
case "APT-S":
case "AT - Serial":
return GearboxType.ATSerial;
case "APT-P":
case "AT - PowerSplit":
return GearboxType.ATPowerSplit;
}
throw new ArgumentOutOfRangeException("GearboxType", value);
}
}
public IList<ITransmissionInputData> Gears
{
get {
var retVal = new List<ITransmissionInputData>();
var gears = Navigator.Select(
Helper.Query(XBasePath, XMLNames.Gearbox_Gears, XMLNames.Gearbox_Gears_Gear),
Manager);
while (gears.MoveNext()) {
var gear = gears.Current.GetAttribute(XMLNames.Gearbox_Gear_GearNumber_Attr, "");
retVal.Add(ReadGear(gear));
}
return retVal;
}
}
public ITorqueConverterDeclarationInputData TorqueConverter
{
get {
return new XMLDeclarationTorqueConverterDataProvider(InputData);
}
}
protected ITransmissionInputData ReadGear(string gearNr)
{
var retVal = new TransmissionInputData();
var gearPath = Helper.Query(XMLNames.Gearbox_Gears,
Helper.QueryConstraint(XMLNames.Gearbox_Gears_Gear, XMLNames.Gearbox_Gear_GearNumber_Attr, gearNr));
retVal.Ratio = GetDoubleElementValue(Helper.Query(gearPath, XMLNames.Gearbox_Gear_Ratio));
retVal.Gear = XmlConvert.ToUInt16(gearNr);
retVal.LossMap = ReadTableData(AttributeMappings.TransmissionLossmapMapping,
Helper.Query(gearPath, XMLNames.Gearbox_Gear_TorqueLossMap, XMLNames.Gearbox_Gear_TorqueLossMap_Entry));
if (ElementExists(Helper.Query(gearPath, XMLNames.Gearbox_Gears_MaxTorque))) {
retVal.MaxTorque = GetDoubleElementValue(Helper.Query(gearPath, XMLNames.Gearbox_Gears_MaxTorque)).SI<NewtonMeter>();
}
if (ElementExists(Helper.Query(gearPath, XMLNames.Gearbox_Gear_MaxSpeed))) {
retVal.MaxInputSpeed = GetDoubleElementValue(Helper.Query(gearPath, XMLNames.Gearbox_Gear_MaxSpeed)).RPMtoRad();
}
return retVal;
}
}
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.InputData.Impl;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
public class XMLDeclarationGearboxDataProvider : AbstractDeclarationXMLComponentDataProvider,
IGearboxDeclarationInputData
{
public XMLDeclarationGearboxDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider)
: base(xmlInputDataProvider)
{
XBasePath = Helper.Query(VehiclePath,
XMLNames.Vehicle_Components,
XMLNames.Component_Gearbox,
XMLNames.ComponentDataWrapper);
}
public XMLDeclarationGearboxDataProvider(XDocument xml)
{
if (xml.Document == null) {
throw new ArgumentException("No Document found");
}
Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
Helper = new XPathHelper(ExecutionMode.Declaration);
Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
Helper.NSPrefix(XMLNames.Component_Gearbox, Constants.XML.RootNSPrefix),
XMLNames.ComponentDataWrapper);
SourceType = DataSourceType.Embedded;
}
public new CertificationMethod CertificationMethod
{
get { return GetElementValue(XMLNames.Component_Gearbox_CertificationMethod).ParseEnum<CertificationMethod>(); }
}
public GearboxType Type
{
get {
var value = GetElementValue(XMLNames.Gearbox_TransmissionType);
switch (value) {
case "MT":
case "SMT":
return GearboxType.MT;
case "AMT":
return GearboxType.AMT;
case "APT-S":
case "AT - Serial":
return GearboxType.ATSerial;
case "APT-P":
case "AT - PowerSplit":
return GearboxType.ATPowerSplit;
}
throw new ArgumentOutOfRangeException("GearboxType", value);
}
}
public IList<ITransmissionInputData> Gears
{
get {
var retVal = new List<ITransmissionInputData>();
var gears = Navigator.Select(
Helper.Query(XBasePath, XMLNames.Gearbox_Gears, XMLNames.Gearbox_Gears_Gear),
Manager);
while (gears.MoveNext()) {
var gear = gears.Current.GetAttribute(XMLNames.Gearbox_Gear_GearNumber_Attr, "");
retVal.Add(ReadGear(gear));
}
return retVal;
}
}
public ITorqueConverterDeclarationInputData TorqueConverter
{
get {
return new XMLDeclarationTorqueConverterDataProvider(InputData);
}
}
protected ITransmissionInputData ReadGear(string gearNr)
{
var retVal = new TransmissionInputData();
var gearPath = Helper.Query(XMLNames.Gearbox_Gears,
Helper.QueryConstraint(XMLNames.Gearbox_Gears_Gear, XMLNames.Gearbox_Gear_GearNumber_Attr, gearNr));
retVal.Ratio = GetDoubleElementValue(Helper.Query(gearPath, XMLNames.Gearbox_Gear_Ratio));
retVal.Gear = XmlConvert.ToUInt16(gearNr);
retVal.LossMap = ReadTableData(AttributeMappings.TransmissionLossmapMapping,
Helper.Query(gearPath, XMLNames.Gearbox_Gear_TorqueLossMap, XMLNames.Gearbox_Gear_TorqueLossMap_Entry));
if (ElementExists(Helper.Query(gearPath, XMLNames.Gearbox_Gears_MaxTorque))) {
retVal.MaxTorque = GetDoubleElementValue(Helper.Query(gearPath, XMLNames.Gearbox_Gears_MaxTorque)).SI<NewtonMeter>();
}
if (ElementExists(Helper.Query(gearPath, XMLNames.Gearbox_Gear_MaxSpeed))) {
retVal.MaxInputSpeed = GetDoubleElementValue(Helper.Query(gearPath, XMLNames.Gearbox_Gear_MaxSpeed)).RPMtoRad();
}
return retVal;
}
}
}
\ No newline at end of file
......@@ -29,15 +29,24 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
public class XMLDeclarationRetarderDataProvider : AbstractDeclarationXMLComponentDataProvider, IRetarderInputData
{
private RetarderType? _type;
private double? _ratio;
public XMLDeclarationRetarderDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider) : base(xmlInputDataProvider)
{
XBasePath = Helper.Query(VehiclePath,
......@@ -46,6 +55,24 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper);
}
public XMLDeclarationRetarderDataProvider(XDocument xml, RetarderType type, double ratio)
{
_type = type;
_ratio = ratio;
if (xml.Document != null) {
Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
Helper = new XPathHelper(ExecutionMode.Declaration);
Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
Helper.NSPrefix(XMLNames.Component_Retarder, Constants.XML.RootNSPrefix),
XMLNames.ComponentDataWrapper);
SourceType = DataSourceType.Embedded;
}
}
public override bool SavedInDeclarationMode
{
......@@ -54,12 +81,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
public RetarderType Type
{
get { return InputData.XMLJob.XMLVehicle.RetarderType; }
get { return _type ?? InputData.XMLJob.XMLVehicle.RetarderType; }
}
public double Ratio
{
get { return InputData.XMLJob.XMLVehicle.RetarderRatio; }
get { return _ratio ?? InputData.XMLJob.XMLVehicle.RetarderRatio; }
}
public TableData LossMap
......
......@@ -29,9 +29,16 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{
......@@ -48,6 +55,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper);
}
public XMLDeclarationTorqueConverterDataProvider(XDocument xml)
{
if (xml.Document == null) {
throw new ArgumentException("No Document found");
}
Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
Helper = new XPathHelper(ExecutionMode.Declaration);
Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
Helper.NSPrefix(XMLNames.Component_TorqueConverter, Constants.XML.RootNSPrefix),
XMLNames.ComponentDataWrapper);
SourceType = DataSourceType.Embedded;
}
public TableData TCData
{
get
......
......@@ -148,9 +148,9 @@ namespace TUGraz.VectoCore.InputData.Impl
public string ID { get; internal set; }
public AuxiliaryType Type { get; internal set; }
public AuxiliaryType Type { get; set; }
public IList<string> Technology { get; internal set; }
public IList<string> Technology { get; set; }
public double TransmissionRatio { get; internal set; }
......
......@@ -232,7 +232,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
internal AngledriveData DoCreateAngledriveData(IAngledriveInputData data, bool useEfficiencyFallback)
{
try {
var type = data.Type;
var type = data?.Type ?? AngledriveType.None;
switch (type) {
case AngledriveType.LossesIncludedInGearbox:
......
......@@ -50,4 +50,5 @@ using System.Runtime.InteropServices;
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoCoreTest")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPITest")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoXML")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("XMLTest")]
\ No newline at end of file
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("XMLTest")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VECTO_GIT")]
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