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 ...@@ -69,6 +69,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HashingCmd", "HashingCmd\Ha
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Article10Notifications", "..\VECTO-Article10\Article10Notifications\Article10Notifications.csproj", "{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Article10Notifications", "..\VECTO-Article10\Article10Notifications\Article10Notifications.csproj", "{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}"
EndProject 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug PerformanceStats|Any CPU = Debug PerformanceStats|Any CPU Debug PerformanceStats|Any CPU = Debug PerformanceStats|Any CPU
...@@ -724,6 +726,48 @@ Global ...@@ -724,6 +726,48 @@ Global
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x64.Build.0 = Release|Any CPU {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.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x86.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE 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 @@ ...@@ -30,8 +30,7 @@
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml; using System.Linq;
using System.Xml.XPath;
using TUGraz.VectoCommon.Hashing; using TUGraz.VectoCommon.Hashing;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoHashing; using TUGraz.VectoHashing;
...@@ -73,56 +72,4 @@ namespace TUGraz.VectoCommon.InputData ...@@ -73,56 +72,4 @@ namespace TUGraz.VectoCommon.InputData
DigestData JobDigest { get; } 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 @@ ...@@ -53,6 +53,7 @@
<Compile Include="Hashing\IVectoHash.cs" /> <Compile Include="Hashing\IVectoHash.cs" />
<Compile Include="Hashing\VectoComponents.cs" /> <Compile Include="Hashing\VectoComponents.cs" />
<Compile Include="InputData\DataSourceType.cs" /> <Compile Include="InputData\DataSourceType.cs" />
<Compile Include="InputData\DigestData.cs" />
<Compile Include="InputData\TableData.cs"> <Compile Include="InputData\TableData.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
......
...@@ -175,6 +175,8 @@ namespace TUGraz.VectoCore.Configuration ...@@ -175,6 +175,8 @@ namespace TUGraz.VectoCore.Configuration
public const string VectoDeclarationDefinitionsNS = public const string VectoDeclarationDefinitionsNS =
"urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v" + XSDDeclarationVersion; "urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v" + XSDDeclarationVersion;
public const string VectoDeclarationComponentNS = "urn:tugraz:ivt:VectoAPI:DeclarationComponent:v" + XSDDeclarationVersion;
public const string VectoEngineeringDefinitionsNS = public const string VectoEngineeringDefinitionsNS =
"urn:tugraz:ivt:VectoAPI:EngineeringDefinitions:v" + XSDEngineeringVersion; "urn:tugraz:ivt:VectoAPI:EngineeringDefinitions:v" + XSDEngineeringVersion;
......
...@@ -29,10 +29,16 @@ ...@@ -29,10 +29,16 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * 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.InputData;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{ {
...@@ -48,6 +54,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration ...@@ -48,6 +54,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper); 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 public new CertificationMethod CertificationMethod
{ {
get { return CertificationMethod.Measured; } get { return CertificationMethod.Measured; }
......
...@@ -29,11 +29,17 @@ ...@@ -29,11 +29,17 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * 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.IVT.VectoXML;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{ {
...@@ -47,6 +53,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration ...@@ -47,6 +53,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper); 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 public AngledriveType Type
{ {
get { return InputData.XMLJob.XMLVehicle.AngulargearType; } get { return InputData.XMLJob.XMLVehicle.AngulargearType; }
......
...@@ -29,50 +29,73 @@ ...@@ -29,50 +29,73 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/ */
using TUGraz.IVT.VectoXML; using System;
using TUGraz.VectoCommon.Exceptions; using System.Xml;
using TUGraz.VectoCommon.InputData; using System.Xml.Linq;
using TUGraz.VectoCommon.Models; using System.Xml.XPath;
using TUGraz.VectoCommon.Resources; using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration using TUGraz.VectoCommon.Models;
{ using TUGraz.VectoCommon.Resources;
public class XMLDeclarationAxlegearDataProvider : AbstractDeclarationXMLComponentDataProvider, IAxleGearInputData using TUGraz.VectoCommon.Utils;
{ using TUGraz.VectoCore.Configuration;
public XMLDeclarationAxlegearDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider) using TUGraz.VectoCore.Utils;
: base(xmlInputDataProvider)
{ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XBasePath = Helper.Query(VehiclePath, {
XMLNames.Vehicle_Components, public class XMLDeclarationAxlegearDataProvider : AbstractDeclarationXMLComponentDataProvider, IAxleGearInputData
XMLNames.Component_Axlegear, {
XMLNames.ComponentDataWrapper); public XMLDeclarationAxlegearDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider)
} : base(xmlInputDataProvider)
{
public double Ratio XBasePath = Helper.Query(VehiclePath,
{ XMLNames.Vehicle_Components,
get { return GetDoubleElementValue(XMLNames.Axlegear_Ratio); } XMLNames.Component_Axlegear,
} XMLNames.ComponentDataWrapper);
}
public TableData LossMap
{ public XMLDeclarationAxlegearDataProvider(XDocument xml)
get { {
return ReadTableData(AttributeMappings.TransmissionLossmapMapping, if (xml.Document == null) {
Helper.Query(XMLNames.Axlegear_TorqueLossMap, XMLNames.Axlegear_TorqueLossMap_Entry)); throw new ArgumentException("No Document found");
} }
} Navigator = xml.Document.CreateNavigator();
Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
public double Efficiency Helper = new XPathHelper(ExecutionMode.Declaration);
{ Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
get { throw new VectoException("Efficiency not supported in Declaration Mode!"); } Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
}
XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
public AxleLineType LineType Helper.NSPrefix(XMLNames.Component_Axlegear, Constants.XML.RootNSPrefix),
{ XMLNames.ComponentDataWrapper);
get { SourceType = DataSourceType.Embedded;
var value = GetElementValue(XMLNames.Axlegear_LineType); }
return value.ParseEnum<AxleLineType>();
} 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 @@ ...@@ -30,11 +30,16 @@
*/ */
using System; using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using TUGraz.IVT.VectoXML; using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{ {
...@@ -50,6 +55,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration ...@@ -50,6 +55,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper); 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 public CubicMeter Displacement
{ {
get { return GetDoubleElementValue(XMLNames.Engine_Displacement).SI(Unit.SI.Cubic.Centi.Meter).Cast<CubicMeter>(); } get { return GetDoubleElementValue(XMLNames.Engine_Displacement).SI(Unit.SI.Cubic.Centi.Meter).Cast<CubicMeter>(); }
......
...@@ -29,95 +29,116 @@ ...@@ -29,95 +29,116 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml; using System.Xml;
using TUGraz.IVT.VectoXML; using System.Xml.Linq;
using TUGraz.VectoCommon.InputData; using System.Xml.XPath;
using TUGraz.VectoCommon.Models; using TUGraz.IVT.VectoXML;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCore.InputData.Impl; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration using TUGraz.VectoCore.Configuration;
{ using TUGraz.VectoCore.InputData.Impl;
public class XMLDeclarationGearboxDataProvider : AbstractDeclarationXMLComponentDataProvider, using TUGraz.VectoCore.Utils;
IGearboxDeclarationInputData
{ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
public XMLDeclarationGearboxDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider) {
: base(xmlInputDataProvider) public class XMLDeclarationGearboxDataProvider : AbstractDeclarationXMLComponentDataProvider,
{ IGearboxDeclarationInputData
XBasePath = Helper.Query(VehiclePath, {
XMLNames.Vehicle_Components, public XMLDeclarationGearboxDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider)
XMLNames.Component_Gearbox, : base(xmlInputDataProvider)
XMLNames.ComponentDataWrapper); {
} XBasePath = Helper.Query(VehiclePath,
XMLNames.Vehicle_Components,
public new CertificationMethod CertificationMethod XMLNames.Component_Gearbox,
{ XMLNames.ComponentDataWrapper);
get { return GetElementValue(XMLNames.Component_Gearbox_CertificationMethod).ParseEnum<CertificationMethod>(); } }
}
public XMLDeclarationGearboxDataProvider(XDocument xml)
public GearboxType Type {
{ if (xml.Document == null) {
get { throw new ArgumentException("No Document found");
var value = GetElementValue(XMLNames.Gearbox_TransmissionType); }
switch (value) { Navigator = xml.Document.CreateNavigator();
case "MT": Manager = new XmlNamespaceManager(Navigator.NameTable ?? new NameTable());
case "SMT": Helper = new XPathHelper(ExecutionMode.Declaration);
return GearboxType.MT; Manager.AddNamespace(Constants.XML.DeclarationNSPrefix, Constants.XML.VectoDeclarationDefinitionsNS);
case "AMT": Manager.AddNamespace(Constants.XML.RootNSPrefix, Constants.XML.VectoDeclarationComponentNS);
return GearboxType.AMT;
case "APT-S": XBasePath = Helper.Query(Helper.NSPrefix(XMLNames.VectoInputDeclaration, Constants.XML.RootNSPrefix),
case "AT - Serial": Helper.NSPrefix(XMLNames.Component_Gearbox, Constants.XML.RootNSPrefix),
return GearboxType.ATSerial; XMLNames.ComponentDataWrapper);
case "APT-P": SourceType = DataSourceType.Embedded;
case "AT - PowerSplit": }
return GearboxType.ATPowerSplit;
} public new CertificationMethod CertificationMethod
throw new ArgumentOutOfRangeException("GearboxType", value); {
} get { return GetElementValue(XMLNames.Component_Gearbox_CertificationMethod).ParseEnum<CertificationMethod>(); }
} }
public IList<ITransmissionInputData> Gears public GearboxType Type
{ {
get { get {
var retVal = new List<ITransmissionInputData>(); var value = GetElementValue(XMLNames.Gearbox_TransmissionType);
var gears = Navigator.Select( switch (value) {
Helper.Query(XBasePath, XMLNames.Gearbox_Gears, XMLNames.Gearbox_Gears_Gear), case "MT":
Manager); case "SMT":
while (gears.MoveNext()) { return GearboxType.MT;
var gear = gears.Current.GetAttribute(XMLNames.Gearbox_Gear_GearNumber_Attr, ""); case "AMT":
retVal.Add(ReadGear(gear)); return GearboxType.AMT;
} case "APT-S":
return retVal; case "AT - Serial":
} return GearboxType.ATSerial;
} case "APT-P":
case "AT - PowerSplit":
public ITorqueConverterDeclarationInputData TorqueConverter return GearboxType.ATPowerSplit;
{ }
get { throw new ArgumentOutOfRangeException("GearboxType", value);
return new XMLDeclarationTorqueConverterDataProvider(InputData); }
} }
}
public IList<ITransmissionInputData> Gears
protected ITransmissionInputData ReadGear(string gearNr) {
{ get {
var retVal = new TransmissionInputData(); var retVal = new List<ITransmissionInputData>();
var gearPath = Helper.Query(XMLNames.Gearbox_Gears, var gears = Navigator.Select(
Helper.QueryConstraint(XMLNames.Gearbox_Gears_Gear, XMLNames.Gearbox_Gear_GearNumber_Attr, gearNr)); Helper.Query(XBasePath, XMLNames.Gearbox_Gears, XMLNames.Gearbox_Gears_Gear),
retVal.Ratio = GetDoubleElementValue(Helper.Query(gearPath, XMLNames.Gearbox_Gear_Ratio)); Manager);
retVal.Gear = XmlConvert.ToUInt16(gearNr); while (gears.MoveNext()) {
retVal.LossMap = ReadTableData(AttributeMappings.TransmissionLossmapMapping, var gear = gears.Current.GetAttribute(XMLNames.Gearbox_Gear_GearNumber_Attr, "");
Helper.Query(gearPath, XMLNames.Gearbox_Gear_TorqueLossMap, XMLNames.Gearbox_Gear_TorqueLossMap_Entry)); retVal.Add(ReadGear(gear));
}
if (ElementExists(Helper.Query(gearPath, XMLNames.Gearbox_Gears_MaxTorque))) { return retVal;
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(); public ITorqueConverterDeclarationInputData TorqueConverter
} {
return retVal; 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 @@ ...@@ -29,15 +29,24 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * 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.IVT.VectoXML;
using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{ {
public class XMLDeclarationRetarderDataProvider : AbstractDeclarationXMLComponentDataProvider, IRetarderInputData public class XMLDeclarationRetarderDataProvider : AbstractDeclarationXMLComponentDataProvider, IRetarderInputData
{ {
private RetarderType? _type;
private double? _ratio;
public XMLDeclarationRetarderDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider) : base(xmlInputDataProvider) public XMLDeclarationRetarderDataProvider(XMLDeclarationInputDataProvider xmlInputDataProvider) : base(xmlInputDataProvider)
{ {
XBasePath = Helper.Query(VehiclePath, XBasePath = Helper.Query(VehiclePath,
...@@ -46,6 +55,24 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration ...@@ -46,6 +55,24 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper); 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 public override bool SavedInDeclarationMode
{ {
...@@ -54,12 +81,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration ...@@ -54,12 +81,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
public RetarderType Type public RetarderType Type
{ {
get { return InputData.XMLJob.XMLVehicle.RetarderType; } get { return _type ?? InputData.XMLJob.XMLVehicle.RetarderType; }
} }
public double Ratio public double Ratio
{ {
get { return InputData.XMLJob.XMLVehicle.RetarderRatio; } get { return _ratio ?? InputData.XMLJob.XMLVehicle.RetarderRatio; }
} }
public TableData LossMap public TableData LossMap
......
...@@ -29,9 +29,16 @@ ...@@ -29,9 +29,16 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * 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.IVT.VectoXML;
using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
{ {
...@@ -48,6 +55,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration ...@@ -48,6 +55,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
XMLNames.ComponentDataWrapper); 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 public TableData TCData
{ {
get get
......
...@@ -148,9 +148,9 @@ namespace TUGraz.VectoCore.InputData.Impl ...@@ -148,9 +148,9 @@ namespace TUGraz.VectoCore.InputData.Impl
public string ID { get; internal set; } 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; } public double TransmissionRatio { get; internal set; }
......
...@@ -232,7 +232,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter ...@@ -232,7 +232,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
internal AngledriveData DoCreateAngledriveData(IAngledriveInputData data, bool useEfficiencyFallback) internal AngledriveData DoCreateAngledriveData(IAngledriveInputData data, bool useEfficiencyFallback)
{ {
try { try {
var type = data.Type; var type = data?.Type ?? AngledriveType.None;
switch (type) { switch (type) {
case AngledriveType.LossesIncludedInGearbox: case AngledriveType.LossesIncludedInGearbox:
......
...@@ -50,4 +50,5 @@ using System.Runtime.InteropServices; ...@@ -50,4 +50,5 @@ using System.Runtime.InteropServices;
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoCoreTest")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoCoreTest")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPITest")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPITest")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoXML")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoXML")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("XMLTest")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("XMLTest")]
\ No newline at end of file [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