diff --git a/VectoCore/Models/Connector/Connector.cs b/VectoCore/Models/Connector/Connector.cs deleted file mode 100644 index b73a4396def74f699f6419b9b7f48229383982c0..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Connector.cs +++ /dev/null @@ -1,20 +0,0 @@ -using TUGraz.VectoCore.Models.Connector.Ports.Impl; - -namespace TUGraz.VectoCore.Models.Connector -{ - internal class Connector<TI, TO, TP> - where TI : InPort, TP - where TO : OutPort, TP - { - protected TI InPort; - protected TO OutPort; - - public void Connect(TI inPort, TO outPort) - { - InPort = inPort; - OutPort = outPort; - - InPort.Connect(OutPort); - } - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDriverDemandInPort.cs b/VectoCore/Models/Connector/Ports/IDriverDemandInPort.cs deleted file mode 100644 index aa79be1129e7ac4de36efa60d58f0bb83647ebef..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IDriverDemandInPort.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IDriverDemandInPort - { - void Connect(IDriverDemandOutPort other); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDriverDemandInProvider.cs b/VectoCore/Models/Connector/Ports/IDriverDemandInProvider.cs deleted file mode 100644 index 05244674fdeb562b607ac44ec51d6113b3594d47..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IDriverDemandInProvider.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IDriverDemandInProvider - { - IDriverDemandInPort InPort(); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDriverDemandOutPort.cs b/VectoCore/Models/Connector/Ports/IDriverDemandOutPort.cs deleted file mode 100644 index e24d487844c575a27cddd143a0e00d7b4ae82a4f..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IDriverDemandOutPort.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IDriverDemandOutPort - { - IResponse Request(TimeSpan absTime, TimeSpan dt, MeterPerSecond velocity, double gradient); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDriverDemandOutProvider.cs b/VectoCore/Models/Connector/Ports/IDriverDemandOutProvider.cs deleted file mode 100644 index 0ab63571bc0d4aaacceeb42e5cfd33181c03e478..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IDriverDemandOutProvider.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IDriverDemandOutProvider - { - IDriverDemandOutPort OutPort(); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDriverDemandPort.cs b/VectoCore/Models/Connector/Ports/IDriverDemandPort.cs new file mode 100644 index 0000000000000000000000000000000000000000..4d2c1741a2dc4040b35af6a1459967a098fdde59 --- /dev/null +++ b/VectoCore/Models/Connector/Ports/IDriverDemandPort.cs @@ -0,0 +1,31 @@ +using System; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a connect method to connect the inport to an outport. + /// </summary> + public interface IDriverDemandInPort + { + /// <summary> + /// Connects the inport to another outport. + /// </summary> + void Connect(IDriverDemandOutPort other); + } + + /// <summary> + /// Defines a request method for a DriverDemand-Out-Port. + /// </summary> + public interface IDriverDemandOutPort + { + /// <summary> + /// Requests the Outport with the given velocity [m/s] and road gradient [rad]. + /// </summary> + /// <param name="absTime">[s]</param> + /// <param name="dt">[s]</param> + /// <param name="velocity">[m/s]</param> + /// <param name="gradient">[rad]</param> + IResponse Request(TimeSpan absTime, TimeSpan dt, MeterPerSecond velocity, Radian gradient); + } +} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDriverDemandProvider.cs b/VectoCore/Models/Connector/Ports/IDriverDemandProvider.cs new file mode 100644 index 0000000000000000000000000000000000000000..f8de813d1f209430f1ba6ebc02ab1bf419f02877 --- /dev/null +++ b/VectoCore/Models/Connector/Ports/IDriverDemandProvider.cs @@ -0,0 +1,26 @@ +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an DriverDemand in port. + /// </summary> + public interface IDriverDemandInProvider + { + /// <summary> + /// Returns the inport to connect it to another outport. + /// </summary> + /// <returns></returns> + IDriverDemandInPort InPort(); + } + + /// <summary> + /// Defines a method to acquire an DriverDemand out port. + /// </summary> + public interface IDriverDemandOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + IDriverDemandOutPort OutPort(); + } +} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDrivingCyclePort.cs b/VectoCore/Models/Connector/Ports/IDrivingCyclePort.cs new file mode 100644 index 0000000000000000000000000000000000000000..ba04f9ad721f6910babcd0cbd40f2eb45ba4ed84 --- /dev/null +++ b/VectoCore/Models/Connector/Ports/IDrivingCyclePort.cs @@ -0,0 +1,18 @@ +using System; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to request the outport. + /// </summary> + public interface IDrivingCycleOutPort + { + /// <summary> + /// Requests a demand for a specific absolute time and a time interval dt. + /// </summary> + /// <param name="absTime">The absolute time of the simulation.</param> + /// <param name="dt">The current time interval.</param> + /// <returns></returns> + IResponse Request(TimeSpan absTime, TimeSpan dt); + } +} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IDrivingCycleProvider.cs b/VectoCore/Models/Connector/Ports/IDrivingCycleProvider.cs new file mode 100644 index 0000000000000000000000000000000000000000..efefcf1f8f6d956e6957827435a8900723d2240a --- /dev/null +++ b/VectoCore/Models/Connector/Ports/IDrivingCycleProvider.cs @@ -0,0 +1,14 @@ +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an DriverCycle Demand out port. + /// </summary> + public interface IDrivingCycleOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + IDrivingCycleOutPort OutPort(); + } +} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IFvPort.cs b/VectoCore/Models/Connector/Ports/IFvPort.cs new file mode 100644 index 0000000000000000000000000000000000000000..1155a32776c60af99d2f9fa88aadf004dd71e425 --- /dev/null +++ b/VectoCore/Models/Connector/Ports/IFvPort.cs @@ -0,0 +1,31 @@ +using System; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a connect method to connect the inport to an outport. + /// </summary> + public interface IFvInPort + { + /// <summary> + /// Connects the inport to another outport. + /// </summary> + void Connect(IFvOutPort other); + } + + /// <summary> + /// Defines a request method for a Fv-Out-Port. + /// </summary> + public interface IFvOutPort + { + /// <summary> + /// Requests the Outport with the given force [N] and vehicle velocity [m/s]. + /// </summary> + /// <param name="absTime">[s]</param> + /// <param name="dt">[s]</param> + /// <param name="force">[N]</param> + /// <param name="velocity">[m/s]</param> + IResponse Request(TimeSpan absTime, TimeSpan dt, Newton force, MeterPerSecond velocity); + } +} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IInPort.cs b/VectoCore/Models/Connector/Ports/IInPort.cs deleted file mode 100644 index 878abe6577ac13f753b3093c56001ae44c2f1097..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IInPort.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IInPort {} -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IInShaft.cs b/VectoCore/Models/Connector/Ports/IInShaft.cs deleted file mode 100644 index 32d8156bbc126c209009c4d9a11a196de66de966..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IInShaft.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IInShaft - { - ITnInPort InShaft(); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IOutPort.cs b/VectoCore/Models/Connector/Ports/IOutPort.cs deleted file mode 100644 index 0aff780b6a2e9ca6ed3005327cb2a0b7170d705f..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IOutPort.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IOutPort {} -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IOutShaft.cs b/VectoCore/Models/Connector/Ports/IOutShaft.cs deleted file mode 100644 index d6378e09280c9d0f124d4ccfe379cf9de7322976..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/IOutShaft.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface IOutShaft - { - ITnOutPort OutShaft(); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IResponse.cs b/VectoCore/Models/Connector/Ports/IResponse.cs index 897aecd0d0e6b124d351083bc9500fe2a2b5d85f..a1d76d8ca1619ea5c0725ce6c27698152213fd95 100644 --- a/VectoCore/Models/Connector/Ports/IResponse.cs +++ b/VectoCore/Models/Connector/Ports/IResponse.cs @@ -1,4 +1,7 @@ namespace TUGraz.VectoCore.Models.Connector.Ports { - public interface IResponse {} + /// <summary> + /// Defines an interface for a Response. + /// </summary> + public interface IResponse {} } \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IRoadPortProvider.cs b/VectoCore/Models/Connector/Ports/IRoadPortProvider.cs new file mode 100644 index 0000000000000000000000000000000000000000..646295907a9ce73ed3a45f95e6ce237f2bdca940 --- /dev/null +++ b/VectoCore/Models/Connector/Ports/IRoadPortProvider.cs @@ -0,0 +1,26 @@ +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an Fv in port. + /// </summary> + public interface IRoadPortInProvider + { + /// <summary> + /// Returns the inport to connect it to another outport. + /// </summary> + /// <returns></returns> + IFvInPort InPort(); + } + + /// <summary> + /// Defines a method to acquire an Fv out port. + /// </summary> + public interface IRoadPortOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + IFvOutPort OutPort(); + } +} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/IShaft.cs b/VectoCore/Models/Connector/Ports/IShaft.cs new file mode 100644 index 0000000000000000000000000000000000000000..46a672e1db6fff6f7ec597171992c2cee681aa7b --- /dev/null +++ b/VectoCore/Models/Connector/Ports/IShaft.cs @@ -0,0 +1,26 @@ +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an Tn in port. + /// </summary> + public interface IInShaft + { + /// <summary> + /// Returns the inport to connect it to another outport. + /// </summary> + /// <returns></returns> + ITnInPort InShaft(); + } + + /// <summary> + /// Defines a method to acquire an Tn out port. + /// </summary> + public interface IOutShaft + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + ITnOutPort OutShaft(); + } +} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/ITnInPort.cs b/VectoCore/Models/Connector/Ports/ITnInPort.cs deleted file mode 100644 index 015943ddb1e7d00db223fc2ab5f74a68b4f9335a..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/ITnInPort.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface ITnInPort : ITnPort, IInPort - { - void Connect(ITnOutPort other); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/ITnOutPort.cs b/VectoCore/Models/Connector/Ports/ITnOutPort.cs deleted file mode 100644 index 6a7a10b010b31e897c1af928b34f173e5fecccb4..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/ITnOutPort.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - public interface ITnOutPort : ITnPort, IOutPort - { - /// <summary> - /// Requests the Outport with the given torque [Nm] and angularVelocity [rad/s]. - /// </summary> - /// <param name="absTime">[s]</param> - /// <param name="dt">[s]</param> - /// <param name="torque">[Nm]</param> - /// <param name="angularVelocity">[rad/s]</param> - IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond angularVelocity); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/ITnPort.cs b/VectoCore/Models/Connector/Ports/ITnPort.cs index af3861a9fe72bd748543b50dd04fab3a408c2436..f3df1dd0c8f1a4d839150851878c5068618e3450 100644 --- a/VectoCore/Models/Connector/Ports/ITnPort.cs +++ b/VectoCore/Models/Connector/Ports/ITnPort.cs @@ -1,4 +1,31 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports +using System; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports { - public interface ITnPort {} + /// <summary> + /// Defines a connect method to connect the inport to an outport. + /// </summary> + public interface ITnInPort + { + /// <summary> + /// Connects the inport to another outport. + /// </summary> + void Connect(ITnOutPort other); + } + + /// <summary> + /// Defines a request method for a Tn-Out-Port. + /// </summary> + public interface ITnOutPort + { + /// <summary> + /// Requests the Outport with the given torque [Nm] and angularVelocity [rad/s]. + /// </summary> + /// <param name="absTime">[s]</param> + /// <param name="dt">[s]</param> + /// <param name="torque">[Nm]</param> + /// <param name="angularVelocity">[rad/s]</param> + IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond angularVelocity); + } } \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/Impl/InPort.cs b/VectoCore/Models/Connector/Ports/Impl/InPort.cs deleted file mode 100644 index 83d8755e0a8edcc5ed63acca1deafffa11556138..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/Impl/InPort.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports.Impl -{ - public abstract class InPort : IInPort - { - public abstract void Connect(IOutPort other); - } -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/Impl/OutPort.cs b/VectoCore/Models/Connector/Ports/Impl/OutPort.cs deleted file mode 100644 index 6ece52e14c202dfcd2620754da5d03e254b9584d..0000000000000000000000000000000000000000 --- a/VectoCore/Models/Connector/Ports/Impl/OutPort.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace TUGraz.VectoCore.Models.Connector.Ports.Impl -{ - public abstract class OutPort : IOutPort {} -} \ No newline at end of file diff --git a/VectoCore/Models/Connector/Ports/Impl/Response.cs b/VectoCore/Models/Connector/Ports/Impl/Response.cs index 32d8dfd7227e5df03a8cbf8e2212924cf25e8a46..1e6c0cc929c34ca3ae6c675ca932d997b11c5ecb 100644 --- a/VectoCore/Models/Connector/Ports/Impl/Response.cs +++ b/VectoCore/Models/Connector/Ports/Impl/Response.cs @@ -2,14 +2,30 @@ using System; namespace TUGraz.VectoCore.Models.Connector.Ports.Impl { - public class ResponseCycleFinished : IResponse {} + /// <summary> + /// Response when the Cycle is finished. + /// </summary> + public class ResponseCycleFinished : IResponse {} - public class ResponseSuccess : IResponse {} + /// <summary> + /// Response when a request was successful. + /// </summary> + public class ResponseSuccess : IResponse {} - public class ResponseFailOverload : IResponse {} + /// <summary> + /// Response when the request resulted in an engine overload. + /// </summary> + public class ResponseFailOverload : IResponse + { + public double Delta { get; set; } + public double Gradient { get; set; } + } - public class ResponseFailTimeInterval : IResponse - { - public TimeSpan DeltaT { get; set; } - } + /// <summary> + /// Response when the request should have another time interval. + /// </summary> + public class ResponseFailTimeInterval : IResponse + { + public TimeSpan DeltaT { get; set; } + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Cockpit/ICockpit.cs b/VectoCore/Models/Simulation/Cockpit/ICockpit.cs index 543268a636b682e59f41ba4ad339adba6c34a229..d7809ba5454387689b48d3343e783beee512d016 100644 --- a/VectoCore/Models/Simulation/Cockpit/ICockpit.cs +++ b/VectoCore/Models/Simulation/Cockpit/ICockpit.cs @@ -1,4 +1,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Cockpit { - public interface ICockpit : IGearboxCockpit, IEngineCockpit, IVehicleCockpit {} + /// <summary> + /// Defines interfaces for all different cockpits to access shared data of the powertrain. + /// </summary> + public interface ICockpit : IGearboxCockpit, IEngineCockpit, IVehicleCockpit {} } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Cockpit/IEngineCockpit.cs b/VectoCore/Models/Simulation/Cockpit/IEngineCockpit.cs index 17cba3ee11a4f947737accd8929024d49d313143..e1844efc5802e3a74f000371116d53f1dcd0b502 100644 --- a/VectoCore/Models/Simulation/Cockpit/IEngineCockpit.cs +++ b/VectoCore/Models/Simulation/Cockpit/IEngineCockpit.cs @@ -2,11 +2,14 @@ namespace TUGraz.VectoCore.Models.Simulation.Cockpit { - public interface IEngineCockpit - { - /// <summary> - /// [rad/s] - /// </summary> - RadianPerSecond EngineSpeed(); - } + /// <summary> + /// Defines a method to access shared data of the engine. + /// </summary> + public interface IEngineCockpit + { + /// <summary> + /// [rad/s] The current engine speed. + /// </summary> + RadianPerSecond EngineSpeed(); + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Cockpit/IGearboxCockpit.cs b/VectoCore/Models/Simulation/Cockpit/IGearboxCockpit.cs index b6c17603a652b3e31da89713286018d7ca6fe269..41fa13a72d6fcfe91ea8ca812d9c6a8fae4c8b2f 100644 --- a/VectoCore/Models/Simulation/Cockpit/IGearboxCockpit.cs +++ b/VectoCore/Models/Simulation/Cockpit/IGearboxCockpit.cs @@ -1,7 +1,14 @@ namespace TUGraz.VectoCore.Models.Simulation.Cockpit { - public interface IGearboxCockpit - { - uint Gear(); - } + /// <summary> + /// Defines a method to access shared data of the gearbox. + /// </summary> + public interface IGearboxCockpit + { + /// <summary> + /// Returns the current gear. + /// </summary> + /// <returns></returns> + uint Gear(); + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Cockpit/IVehicleCockpit.cs b/VectoCore/Models/Simulation/Cockpit/IVehicleCockpit.cs index 220847c5b4122ce4bdecb3c163079dbe5cf621fc..005304c69a1081fa00c8c46e7e3e2bca18303edb 100644 --- a/VectoCore/Models/Simulation/Cockpit/IVehicleCockpit.cs +++ b/VectoCore/Models/Simulation/Cockpit/IVehicleCockpit.cs @@ -1,7 +1,16 @@ -namespace TUGraz.VectoCore.Models.Simulation.Cockpit +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.Cockpit { - public interface IVehicleCockpit - { - double VehicleSpeed(); - } + /// <summary> + /// Defines a method to access shared data of the vehicle. + /// </summary> + public interface IVehicleCockpit + { + /// <summary> + /// Returns the current vehicle speed. + /// </summary> + /// <returns></returns> + MeterPerSecond VehicleSpeed(); + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/IVectoSimulator.cs b/VectoCore/Models/Simulation/IVectoSimulator.cs index 71e3cc5741e87757bb1193d472b10b670759efe1..53737997cb2312f81dba36f08e4cc2232e761715 100644 --- a/VectoCore/Models/Simulation/IVectoSimulator.cs +++ b/VectoCore/Models/Simulation/IVectoSimulator.cs @@ -1,8 +1,19 @@ namespace TUGraz.VectoCore.Models.Simulation { - public interface IVectoSimulator - { - void Run(); - IVehicleContainer GetContainer(); - } + /// <summary> + /// Defines the methods for the vecto simulator. + /// </summary> + public interface IVectoSimulator + { + /// <summary> + /// Run the simulation. + /// </summary> + void Run(); + + /// <summary> + /// Return the vehicle container. + /// </summary> + /// <returns></returns> + IVehicleContainer GetContainer(); + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/IVehicleContainer.cs b/VectoCore/Models/Simulation/IVehicleContainer.cs index fa7422d031bab8717eb332ee622cc3116f081882..16a89af63adcd1325d8b7d4925e22d9a79e61db9 100644 --- a/VectoCore/Models/Simulation/IVehicleContainer.cs +++ b/VectoCore/Models/Simulation/IVehicleContainer.cs @@ -4,10 +4,28 @@ using TUGraz.VectoCore.Models.SimulationComponent; namespace TUGraz.VectoCore.Models.Simulation { - public interface IVehicleContainer : ICockpit - { - void AddComponent(VectoSimulationComponent component); - void CommitSimulationStep(IModalDataWriter dataWriter); - void FinishSimulation(IModalDataWriter dataWriter); - } + /// <summary> + /// Defines Methods for adding components, commiting a simulation step and finishing the simulation. + /// Also defines interfaces for all cockpit access to data. + /// </summary> + public interface IVehicleContainer : ICockpit + { + /// <summary> + /// Adds a component to the vehicle container. + /// </summary> + /// <param name="component"></param> + void AddComponent(VectoSimulationComponent component); + + /// <summary> + /// Commits the current simulation step. + /// </summary> + /// <param name="dataWriter"></param> + void CommitSimulationStep(IModalDataWriter dataWriter); + + /// <summary> + /// Finishes the simulation. + /// </summary> + /// <param name="dataWriter"></param> + void FinishSimulation(IModalDataWriter dataWriter); + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index 17e5fff0935b348c3c358d6800acf4cf57d93a78..a337ea4ceea0b1527916704f61dd811bfe752999 100644 --- a/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -6,44 +6,52 @@ using TUGraz.VectoCore.Models.SimulationComponent.Impl; namespace TUGraz.VectoCore.Models.Simulation.Impl { - public class SimulatorFactory - { - public static IVectoSimulator CreateTimeBasedEngineOnlyJob(string engineFile, string cycleFile, string resultFile) - { - Action<string> debug = LogManager.GetLogger<SimulatorFactory>().Debug; - - debug("Creating VehicleContainer."); - var container = new VehicleContainer(); - - debug("SimulationFactory creating cycle."); - var cycleData = DrivingCycleData.ReadFromFileEngineOnly(cycleFile); - var cycle = new EngineOnlyDrivingCycle(container, cycleData); - - debug("SimulationFactory creating engine."); - var engineData = CombustionEngineData.ReadFromFile(engineFile); - var engine = new CombustionEngine(container, engineData); - - debug("Creating gearbox."); - var gearBox = new EngineOnlyGearbox(container); - - debug("SimulationFactory creating auxiliary"); - var aux = new EngineOnlyAuxiliary(container, new AuxiliariesDemandAdapter(cycleData)); - - debug("SimulationFactory connecting auxiliary with engine."); - aux.Connect(engine.OutShaft()); - - debug("SimulationFactory connecting gearbox with auxiliary."); - gearBox.InShaft().Connect(aux.OutShaft()); - - debug("SimulationFactory connecting cycle with gearbox."); - cycle.InShaft().Connect(gearBox.OutShaft()); - - var dataWriter = new ModalDataWriter(resultFile); - - debug("Creating Simulator."); - var simulator = new VectoSimulator(container, cycle, dataWriter); - - return simulator; - } - } + public class SimulatorFactory + { + /// <summary> + /// Creates a time based engine only powertrain and simulation job for the given files. + /// </summary> + /// <param name="engineFile"></param> + /// <param name="cycleFile"></param> + /// <param name="resultFile"></param> + /// <returns></returns> + public static IVectoSimulator CreateTimeBasedEngineOnlyJob(string engineFile, string cycleFile, + string resultFile) + { + Action<string> debug = LogManager.GetLogger<SimulatorFactory>().Debug; + + debug("Creating VehicleContainer."); + var container = new VehicleContainer(); + + debug("SimulationFactory creating cycle."); + var cycleData = DrivingCycleData.ReadFromFileEngineOnly(cycleFile); + var cycle = new EngineOnlyDrivingCycle(container, cycleData); + + debug("SimulationFactory creating engine."); + var engineData = CombustionEngineData.ReadFromFile(engineFile); + var engine = new CombustionEngine(container, engineData); + + debug("Creating gearbox."); + var gearBox = new EngineOnlyGearbox(container); + + debug("SimulationFactory creating auxiliary"); + var aux = new EngineOnlyAuxiliary(container, new AuxiliariesDemandAdapter(cycleData)); + + debug("SimulationFactory connecting auxiliary with engine."); + aux.InShaft().Connect(engine.OutShaft()); + + debug("SimulationFactory connecting gearbox with auxiliary."); + gearBox.InShaft().Connect(aux.OutShaft()); + + debug("SimulationFactory connecting cycle with gearbox."); + cycle.InShaft().Connect(gearBox.OutShaft()); + + var dataWriter = new ModalDataWriter(resultFile); + + debug("Creating Simulator."); + var simulator = new VectoSimulator(container, cycle, dataWriter); + + return simulator; + } + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Impl/VectoSimulator.cs b/VectoCore/Models/Simulation/Impl/VectoSimulator.cs index 3c551a88aeff860518b3cc91f5c2a4f15036cb86..e2056f9105ee0e17f65e0830f20e5b5ec177772a 100644 --- a/VectoCore/Models/Simulation/Impl/VectoSimulator.cs +++ b/VectoCore/Models/Simulation/Impl/VectoSimulator.cs @@ -3,62 +3,61 @@ using Common.Logging; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.SimulationComponent; namespace TUGraz.VectoCore.Models.Simulation.Impl { - public class VectoSimulator : IVectoSimulator - { - private TimeSpan _absTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0); - private TimeSpan _dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0); - - public VectoSimulator(IVehicleContainer container, IDrivingCycle cycle, IModalDataWriter dataWriter) - { - Container = container; - Cycle = cycle; - DataWriter = dataWriter; - } - - protected IDrivingCycle Cycle { get; set; } - protected IModalDataWriter DataWriter { get; set; } - protected IVehicleContainer Container { get; set; } - - public IVehicleContainer GetContainer() - { - return Container; - } - - public void Run() - { - LogManager.GetLogger(GetType()).Info("VectoJob started running."); - IResponse response; - do { - response = Cycle.Request(_absTime, _dt); - while (response is ResponseFailTimeInterval) { - _dt = (response as ResponseFailTimeInterval).DeltaT; - response = Cycle.Request(_absTime, _dt); - } - - if (response is ResponseCycleFinished) { - break; - } - - - DataWriter[ModalResultField.time] = (_absTime + TimeSpan.FromTicks(_dt.Ticks / 2)).TotalSeconds; - DataWriter[ModalResultField.simulationInterval] = _dt.TotalSeconds; - - Container.CommitSimulationStep(DataWriter); - - // set _dt to difference to next full second. - _absTime += _dt; - _dt = TimeSpan.FromSeconds(1) - TimeSpan.FromMilliseconds(_dt.Milliseconds); - } while (response is ResponseSuccess); - - Container.FinishSimulation(DataWriter); - - //todo: write vsum file - - LogManager.GetLogger(GetType()).Info("VectoJob finished."); - } - } + public class VectoSimulator : IVectoSimulator + { + private TimeSpan _absTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0); + private TimeSpan _dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0); + + public VectoSimulator(IVehicleContainer container, IDrivingCycleOutPort cycle, IModalDataWriter dataWriter) + { + Container = container; + Cycle = cycle; + DataWriter = dataWriter; + } + + protected IDrivingCycleOutPort Cycle { get; set; } + protected IModalDataWriter DataWriter { get; set; } + protected IVehicleContainer Container { get; set; } + + public IVehicleContainer GetContainer() + { + return Container; + } + + public void Run() + { + LogManager.GetLogger(GetType()).Info("VectoJob started running."); + IResponse response; + do { + response = Cycle.Request(_absTime, _dt); + while (response is ResponseFailTimeInterval) { + _dt = (response as ResponseFailTimeInterval).DeltaT; + response = Cycle.Request(_absTime, _dt); + } + + if (response is ResponseCycleFinished) { + break; + } + + + DataWriter[ModalResultField.time] = (_absTime + TimeSpan.FromTicks(_dt.Ticks / 2)).TotalSeconds; + DataWriter[ModalResultField.simulationInterval] = _dt.TotalSeconds; + + Container.CommitSimulationStep(DataWriter); + + // set _dt to difference to next full second. + _absTime += _dt; + _dt = TimeSpan.FromSeconds(1) - TimeSpan.FromMilliseconds(_dt.Milliseconds); + } while (response is ResponseSuccess); + + Container.FinishSimulation(DataWriter); + + //todo: write vsum file + + LogManager.GetLogger(GetType()).Info("VectoJob finished."); + } + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index 1e9da44a3ef1029d8aab7203a20739684c185c1a..c1de88ce572721a10032d879c1f97f1ce32d63b0 100644 --- a/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -9,84 +9,84 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Simulation.Impl { - public class VehicleContainer : IVehicleContainer - { - private readonly IList<VectoSimulationComponent> _components = new List<VectoSimulationComponent>(); - private IEngineCockpit _engine; - private IGearboxCockpit _gearbox; - - #region IGearCockpit - - public uint Gear() - { - if (_gearbox == null) { - throw new VectoException("no gearbox available!"); - } - return _gearbox.Gear(); - } - - #endregion - - #region IEngineCockpit - - public RadianPerSecond EngineSpeed() - { - if (_engine == null) { - throw new VectoException("no engine available!"); - } - return _engine.EngineSpeed(); - } - - #endregion - - #region IVehicleCockpit - - public double VehicleSpeed() - { - throw new VectoException("no vehicle available!"); - } - - #endregion - - public IReadOnlyCollection<VectoSimulationComponent> SimulationComponents() - { - return new ReadOnlyCollection<VectoSimulationComponent>(_components); - } - - #region IVehicleContainer - - public virtual void AddComponent(VectoSimulationComponent component) - { - _components.Add(component); - - // TODO: refactor the following to use polymorphism? - var engine = component as IEngineCockpit; - if (engine != null) { - _engine = engine; - } - - var gearbox = component as IGearboxCockpit; - if (gearbox != null) { - _gearbox = gearbox; - } - } - - - public void CommitSimulationStep(IModalDataWriter dataWriter) - { - LogManager.GetLogger(GetType()).Info("VehicleContainer committing simulation."); - foreach (var component in _components) { - component.CommitSimulationStep(dataWriter); - } - dataWriter.CommitSimulationStep(); - } - - public void FinishSimulation(IModalDataWriter dataWriter) - { - LogManager.GetLogger(GetType()).Info("VehicleContainer finishing simulation."); - dataWriter.Finish(); - } - - #endregion - } + public class VehicleContainer : IVehicleContainer + { + private readonly IList<VectoSimulationComponent> _components = new List<VectoSimulationComponent>(); + private IEngineCockpit _engine; + private IGearboxCockpit _gearbox; + + #region IGearCockpit + + public uint Gear() + { + if (_gearbox == null) { + throw new VectoException("no gearbox available!"); + } + return _gearbox.Gear(); + } + + #endregion + + #region IEngineCockpit + + public RadianPerSecond EngineSpeed() + { + if (_engine == null) { + throw new VectoException("no engine available!"); + } + return _engine.EngineSpeed(); + } + + #endregion + + #region IVehicleCockpit + + public MeterPerSecond VehicleSpeed() + { + throw new VectoException("no vehicle available!"); + } + + #endregion + + #region IVehicleContainer + + public virtual void AddComponent(VectoSimulationComponent component) + { + _components.Add(component); + + // TODO: refactor the following to use polymorphism? + var engine = component as IEngineCockpit; + if (engine != null) { + _engine = engine; + } + + var gearbox = component as IGearboxCockpit; + if (gearbox != null) { + _gearbox = gearbox; + } + } + + + public void CommitSimulationStep(IModalDataWriter dataWriter) + { + LogManager.GetLogger(GetType()).Info("VehicleContainer committing simulation."); + foreach (var component in _components) { + component.CommitSimulationStep(dataWriter); + } + dataWriter.CommitSimulationStep(); + } + + public void FinishSimulation(IModalDataWriter dataWriter) + { + LogManager.GetLogger(GetType()).Info("VehicleContainer finishing simulation."); + dataWriter.Finish(); + } + + #endregion + + public IReadOnlyCollection<VectoSimulationComponent> SimulationComponents() + { + return new ReadOnlyCollection<VectoSimulationComponent>(_components); + } + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs b/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs index 6d61a3aa5722158fe84369a5c57c050ee0ae80fb..63ebdcee2af3a5a16ef065734fbca55f0c2dff7e 100644 --- a/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs +++ b/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs @@ -13,493 +13,499 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Data { - /// <summary> - /// Represents the CombustionEngineData. Fileformat: .veng - /// </summary> - /// <code> - /// { - /// "Header": { - /// "CreatedBy": " ()", - /// "Date": "3/4/2015 12:26:24 PM", - /// "AppVersion": "2.0.4-beta3", - /// "FileVersion": 2 - /// }, - /// "Body": { - /// "SavedInDeclMode": false, - /// "ModelName": "Generic 24t Coach", - /// "Displacement": 12730.0, - /// "IdlingSpeed": 560.0, - /// "Inertia": 3.8, - /// "FullLoadCurves": [ - /// { - /// "Path": "24t Coach.vfld", - /// "Gears": "0 - 99" - /// } - /// ], - /// "FuelMap": "24t Coach.vmap", - /// "WHTC-Urban": 0.0, - /// "WHTC-Rural": 0.0, - /// "WHTC-Motorway": 0.0 - /// } - /// } - /// </code> - [DataContract] - public class CombustionEngineData : SimulationComponentData - { - [DataMember] private readonly Dictionary<Range, FullLoadCurve> _fullLoadCurves = - new Dictionary<Range, FullLoadCurve>(); - - [DataMember] private Data _data; - - public bool SavedInDeclarationMode - { - get { return _data.Body.SavedInDeclarationMode; } - protected set { _data.Body.SavedInDeclarationMode = value; } - } - - public string ModelName - { - get { return _data.Body.ModelName; } - protected set { _data.Body.ModelName = value; } - } - - /// <summary> - /// [m^3] - /// </summary> - public SI Displacement - { - get { return _data.Body.Displacement.SI().Cubic.Centi.Meter.To().Cubic.Meter.Value(); } - protected set { _data.Body.Displacement = (double) value.To().Cubic.Centi.Meter; } - } - - /// <summary> - /// [rad/s] - /// </summary> - public RadianPerSecond IdleSpeed - { - get { return _data.Body.IdleSpeed.SI().Rounds.Per.Minute.To<RadianPerSecond>(); } - protected set { _data.Body.IdleSpeed = (double) value.To().Rounds.Per.Minute; } - } - - /// <summary> - /// [kgm^2] - /// </summary> - public SI Inertia - { - get { return _data.Body.Inertia.SI().Kilo.Gramm.Square.Meter; } - protected set { _data.Body.Inertia = (double) value.To().Kilo.Gramm.Square.Meter; } - } - - /// <summary> - /// [kg/Ws] - /// </summary> - public SI WHTCUrban - { - get { return _data.Body.WHTCUrban.SI().Gramm.Per.Kilo.Watt.Hour.To().Kilo.Gramm.Per.Watt.Second.Value(); } - protected set { _data.Body.WHTCUrban = (double) value.To().Gramm.Per.Kilo.Watt.Hour; } - } - - /// <summary> - /// [kg/Ws] - /// </summary> - public SI WHTCRural - { - get { return _data.Body.WHTCRural.SI().Gramm.Per.Kilo.Watt.Hour.To().Kilo.Gramm.Per.Watt.Second.Value(); } - protected set { _data.Body.WHTCRural = (double) value.To().Gramm.Per.Kilo.Watt.Hour; } - } - - /// <summary> - /// [g/Ws] - /// </summary> - public SI WHTCMotorway - { - get { return _data.Body.WHTCMotorway.SI().Gramm.Per.Kilo.Watt.Hour.To().Kilo.Gramm.Per.Watt.Second.Value(); } - protected set { _data.Body.WHTCMotorway = (double) value.To().Gramm.Per.Kilo.Watt.Hour; } - } - - [DataMember] - public FuelConsumptionMap ConsumptionMap { get; set; } - - public static CombustionEngineData ReadFromFile(string fileName) - { - return ReadFromJson(File.ReadAllText(fileName), Path.GetDirectoryName(fileName)); - } - - public static CombustionEngineData ReadFromJson(string json, string basePath = "") - { - var combustionEngineData = new CombustionEngineData(); - //todo handle conversion errors - var d = JsonConvert.DeserializeObject<Data>(json); - - combustionEngineData._data = d; - - if (d.Header.FileVersion > 2) { - throw new UnsupportedFileVersionException("Unsupported Version of .veng file. Got Version: " + d.Header.FileVersion); - } - - combustionEngineData.ConsumptionMap = FuelConsumptionMap.ReadFromFile(Path.Combine(basePath, d.Body.FuelMap)); - - foreach (var loadCurve in d.Body.FullLoadCurves) { - var fullLoadCurve = FullLoadCurve.ReadFromFile(Path.Combine(basePath, loadCurve.Path)); - var gearRange = new Range(loadCurve.Gears); - combustionEngineData._fullLoadCurves[gearRange] = fullLoadCurve; - } - - return combustionEngineData; - } - - public void WriteToFile(string fileName) - { - //todo handle file exceptions - File.WriteAllText(fileName, ToJson()); - } - - public string ToJson() - { - _data.Header.Date = DateTime.Now; - _data.Header.FileVersion = 2; - _data.Header.AppVersion = "3.0.0"; // todo: get current app version! - _data.Header.CreatedBy = ""; // todo: get current user - _data.Body.SavedInDeclarationMode = false; //todo: get declaration mode setting - return JsonConvert.SerializeObject(_data, Formatting.Indented); - } - - public FullLoadCurve GetFullLoadCurve(uint gear) - { - var curve = _fullLoadCurves.FirstOrDefault(kv => kv.Key.Contains(gear)); - if (curve.Key.Equals(null)) { - throw new KeyNotFoundException(string.Format("Gear '{0}' was not found in the FullLoadCurves.", gear)); - } - - return curve.Value; - } - - /// <summary> - /// A class which represents the json data format for serializing and deserializing the EngineData files. - /// </summary> - public class Data - { - [JsonProperty(Required = Required.Always)] public DataBody Body; - [JsonProperty(Required = Required.Always)] public DataHeader Header; - - public class DataHeader - { - [JsonProperty(Required = Required.Always)] public string AppVersion; - [JsonProperty(Required = Required.Always)] public string CreatedBy; - [JsonProperty(Required = Required.Always)] public DateTime Date; - [JsonProperty(Required = Required.Always)] public double FileVersion; - - #region Equality members - - protected bool Equals(DataHeader other) - { - return string.Equals(CreatedBy, other.CreatedBy) && Date.Equals(other.Date) && - string.Equals(AppVersion, other.AppVersion) && FileVersion.Equals(other.FileVersion); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - if (obj.GetType() != GetType()) { - return false; - } - return Equals((DataHeader) obj); - } - - public override int GetHashCode() - { - unchecked { - var hashCode = (CreatedBy != null ? CreatedBy.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ Date.GetHashCode(); - hashCode = (hashCode * 397) ^ (AppVersion != null ? AppVersion.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ FileVersion.GetHashCode(); - return hashCode; - } - } - - #endregion - } - - public class DataBody - { - /// <summary> - /// [ccm] Displacement in cubic centimeter. - /// Used in Declaration Mode to calculate inertia. - /// </summary> - [JsonProperty(Required = Required.Always)] public double Displacement; - - /// <summary> - /// The Fuel Consumption Map is used to calculate the base Fuel Consumption (FC) value. - /// </summary> - [JsonProperty(Required = Required.Always)] public string FuelMap; - - [JsonProperty(Required = Required.Always)] public IList<DataFullLoadCurve> FullLoadCurves; - - /// <summary> - /// [rpm] Idling Engine Speed - /// Low idle, applied in simulation for vehicle standstill in neutral gear position. - /// </summary> - [JsonProperty("IdlingSpeed", Required = Required.Always)] public double IdleSpeed; - - /// <summary> - /// [kgm^2] Inertia including Flywheel - /// Inertia for rotating parts including engine flywheel. - /// In Declaration Mode the inertia is calculated automatically. - /// </summary> - [JsonProperty(Required = Required.Always)] public double Inertia; - - /// <summary> - /// Model. Free text defining the engine model, type, etc. - /// </summary> - [JsonProperty(Required = Required.Always)] public string ModelName; - - [JsonProperty("SavedInDeclMode")] public bool SavedInDeclarationMode; - - /// <summary> - /// [g/kWh] The WHTC test results are required in Declaration Mode for the motorway WHTC FC Correction. - /// </summary> - [JsonProperty("WHTC-Motorway")] public double WHTCMotorway; - - /// <summary> - /// [g/kWh] The WHTC test results are required in Declaration Mode for the rural WHTC FC Correction. - /// </summary> - [JsonProperty("WHTC-Rural")] public double WHTCRural; - - /// <summary> - /// [g/kWh] The WHTC test results are required in Declaration Mode for the urban WHTC FC Correction. - /// </summary> - [JsonProperty("WHTC-Urban")] public double WHTCUrban; - - /// <summary> - /// Multiple Full Load and Drag Curves (.vfld) can be defined and assigned to different gears. - /// Gear "0" must be assigned for idling and Engine Only Mode. - /// </summary> - public class DataFullLoadCurve - { - [JsonProperty(Required = Required.Always)] public string Gears; - [JsonProperty(Required = Required.Always)] public string Path; - - #region Equality Members - - protected bool Equals(DataFullLoadCurve other) - { - return string.Equals(Path, other.Path) && string.Equals(Gears, other.Gears); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - if (obj.GetType() != GetType()) { - return false; - } - return Equals((DataFullLoadCurve) obj); - } - - public override int GetHashCode() - { - unchecked { - return ((Path != null ? Path.GetHashCode() : 0) * 397) ^ - (Gears != null ? Gears.GetHashCode() : 0); - } - } - - #endregion - } - - #region Equality members - - protected bool Equals(DataBody other) - { - return SavedInDeclarationMode.Equals(other.SavedInDeclarationMode) - && string.Equals(ModelName, other.ModelName) - && Displacement.Equals(other.Displacement) - && IdleSpeed.Equals(other.IdleSpeed) - && Inertia.Equals(other.Inertia) - && FullLoadCurves.SequenceEqual(other.FullLoadCurves) - && string.Equals(FuelMap, other.FuelMap) - && WHTCUrban.Equals(other.WHTCUrban) - && WHTCRural.Equals(other.WHTCRural) - && WHTCMotorway.Equals(other.WHTCMotorway); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - if (obj.GetType() != GetType()) { - return false; - } - return Equals((DataBody) obj); - } - - public override int GetHashCode() - { - unchecked { - var hashCode = SavedInDeclarationMode.GetHashCode(); - hashCode = (hashCode * 397) ^ (ModelName != null ? ModelName.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ Displacement.GetHashCode(); - hashCode = (hashCode * 397) ^ IdleSpeed.GetHashCode(); - hashCode = (hashCode * 397) ^ Inertia.GetHashCode(); - hashCode = (hashCode * 397) ^ (FullLoadCurves != null ? FullLoadCurves.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (FuelMap != null ? FuelMap.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ WHTCUrban.GetHashCode(); - hashCode = (hashCode * 397) ^ WHTCRural.GetHashCode(); - hashCode = (hashCode * 397) ^ WHTCMotorway.GetHashCode(); - return hashCode; - } - } - - #endregion - } - - #region Equality members - - protected bool Equals(Data other) - { - return Equals(Header, other.Header) && Equals(Body, other.Body); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - if (obj.GetType() != GetType()) { - return false; - } - return Equals((Data) obj); - } - - public override int GetHashCode() - { - unchecked { - return ((Header != null ? Header.GetHashCode() : 0) * 397) ^ (Body != null ? Body.GetHashCode() : 0); - } - } - - #endregion - } - - public class RangeConverter : TypeConverter - { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return sourceType == typeof (string) || base.CanConvertFrom(context, sourceType); - } - - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - return value.GetType() == typeof (string) ? new Range((string) value) : base.ConvertFrom(context, culture, value); - } - } - - [TypeConverter(typeof (RangeConverter))] - private class Range - { - private readonly uint _end; - private readonly uint _start; - - public Range(string range) - { - Contract.Requires(range != null); - - _start = uint.Parse(range.Split('-').First().Trim()); - _end = uint.Parse(range.Split('-').Last().Trim()); - } - - public override string ToString() - { - return string.Format("{0} - {1}", _start, _end); - } - - public bool Contains(uint value) - { - return _start <= value && value <= _end; - } - - #region Equality members - - protected bool Equals(Range other) - { - Contract.Requires(other != null); - return _start == other._start && _end == other._end; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - if (obj.GetType() != GetType()) { - return false; - } - return Equals((Range) obj); - } - - public override int GetHashCode() - { - unchecked { - return (int) ((_start * 397) ^ _end); - } - } - - #endregion - } - - #region Equality members - - protected bool Equals(CombustionEngineData other) - { - return Equals(_data, other._data) - && _fullLoadCurves.Keys.SequenceEqual(other._fullLoadCurves.Keys) - && _fullLoadCurves.Values.SequenceEqual(other._fullLoadCurves.Values) - && Equals(ConsumptionMap, other.ConsumptionMap); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - if (obj.GetType() != GetType()) { - return false; - } - return Equals((CombustionEngineData) obj); - } - - public override int GetHashCode() - { - unchecked { - var hashCode = _data.GetHashCode(); - hashCode = (hashCode * 397) ^ (_fullLoadCurves != null ? _fullLoadCurves.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (ConsumptionMap != null ? ConsumptionMap.GetHashCode() : 0); - return hashCode; - } - } - - #endregion - } + /// <summary> + /// Represents the CombustionEngineData. Fileformat: .veng + /// </summary> + /// <code> + /// { + /// "Header": { + /// "CreatedBy": " ()", + /// "Date": "3/4/2015 12:26:24 PM", + /// "AppVersion": "2.0.4-beta3", + /// "FileVersion": 2 + /// }, + /// "Body": { + /// "SavedInDeclMode": false, + /// "ModelName": "Generic 24t Coach", + /// "Displacement": 12730.0, + /// "IdlingSpeed": 560.0, + /// "Inertia": 3.8, + /// "FullLoadCurves": [ + /// { + /// "Path": "24t Coach.vfld", + /// "Gears": "0 - 99" + /// } + /// ], + /// "FuelMap": "24t Coach.vmap", + /// "WHTC-Urban": 0.0, + /// "WHTC-Rural": 0.0, + /// "WHTC-Motorway": 0.0 + /// } + /// } + /// </code> + [DataContract] + public class CombustionEngineData : SimulationComponentData + { + [DataMember] private readonly Dictionary<Range, FullLoadCurve> _fullLoadCurves = + new Dictionary<Range, FullLoadCurve>(); + + [DataMember] private Data _data; + + public bool SavedInDeclarationMode + { + get { return _data.Body.SavedInDeclarationMode; } + protected set { _data.Body.SavedInDeclarationMode = value; } + } + + public string ModelName + { + get { return _data.Body.ModelName; } + protected set { _data.Body.ModelName = value; } + } + + /// <summary> + /// [m^3] + /// </summary> + public SI Displacement + { + get { return _data.Body.Displacement.SI().Cubic.Centi.Meter.To().Cubic.Meter.Value(); } + protected set { _data.Body.Displacement = (double) value.To().Cubic.Centi.Meter; } + } + + /// <summary> + /// [rad/s] + /// </summary> + public RadianPerSecond IdleSpeed + { + get { return _data.Body.IdleSpeed.SI().Rounds.Per.Minute.To<RadianPerSecond>(); } + protected set { _data.Body.IdleSpeed = (double) value.To().Rounds.Per.Minute; } + } + + /// <summary> + /// [kgm^2] + /// </summary> + public SI Inertia + { + get { return _data.Body.Inertia.SI().Kilo.Gramm.Square.Meter; } + protected set { _data.Body.Inertia = (double) value.To().Kilo.Gramm.Square.Meter; } + } + + /// <summary> + /// [kg/Ws] + /// </summary> + public SI WHTCUrban + { + get { return _data.Body.WHTCUrban.SI().Gramm.Per.Kilo.Watt.Hour.To().Kilo.Gramm.Per.Watt.Second.Value(); } + protected set { _data.Body.WHTCUrban = (double) value.To().Gramm.Per.Kilo.Watt.Hour; } + } + + /// <summary> + /// [kg/Ws] + /// </summary> + public SI WHTCRural + { + get { return _data.Body.WHTCRural.SI().Gramm.Per.Kilo.Watt.Hour.To().Kilo.Gramm.Per.Watt.Second.Value(); } + protected set { _data.Body.WHTCRural = (double) value.To().Gramm.Per.Kilo.Watt.Hour; } + } + + /// <summary> + /// [g/Ws] + /// </summary> + public SI WHTCMotorway + { + get + { + return _data.Body.WHTCMotorway.SI().Gramm.Per.Kilo.Watt.Hour.To().Kilo.Gramm.Per.Watt.Second.Value(); + } + protected set { _data.Body.WHTCMotorway = (double) value.To().Gramm.Per.Kilo.Watt.Hour; } + } + + [DataMember] + public FuelConsumptionMap ConsumptionMap { get; set; } + + public static CombustionEngineData ReadFromFile(string fileName) + { + return ReadFromJson(File.ReadAllText(fileName), Path.GetDirectoryName(fileName)); + } + + public static CombustionEngineData ReadFromJson(string json, string basePath = "") + { + var combustionEngineData = new CombustionEngineData(); + //todo handle conversion errors + var d = JsonConvert.DeserializeObject<Data>(json); + + combustionEngineData._data = d; + + if (d.Header.FileVersion > 2) { + throw new UnsupportedFileVersionException("Unsupported Version of .veng file. Got Version: " + + d.Header.FileVersion); + } + + combustionEngineData.ConsumptionMap = FuelConsumptionMap.ReadFromFile(Path.Combine(basePath, d.Body.FuelMap)); + + foreach (var loadCurve in d.Body.FullLoadCurves) { + var fullLoadCurve = FullLoadCurve.ReadFromFile(Path.Combine(basePath, loadCurve.Path)); + var gearRange = new Range(loadCurve.Gears); + combustionEngineData._fullLoadCurves[gearRange] = fullLoadCurve; + } + + return combustionEngineData; + } + + public void WriteToFile(string fileName) + { + //todo handle file exceptions + File.WriteAllText(fileName, ToJson()); + } + + public string ToJson() + { + _data.Header.Date = DateTime.Now; + _data.Header.FileVersion = 2; + _data.Header.AppVersion = "3.0.0"; // todo: get current app version! + _data.Header.CreatedBy = ""; // todo: get current user + _data.Body.SavedInDeclarationMode = false; //todo: get declaration mode setting + return JsonConvert.SerializeObject(_data, Formatting.Indented); + } + + public FullLoadCurve GetFullLoadCurve(uint gear) + { + var curve = _fullLoadCurves.FirstOrDefault(kv => kv.Key.Contains(gear)); + if (curve.Key.Equals(null)) { + throw new KeyNotFoundException(string.Format("Gear '{0}' was not found in the FullLoadCurves.", gear)); + } + + return curve.Value; + } + + /// <summary> + /// A class which represents the json data format for serializing and deserializing the EngineData files. + /// </summary> + public class Data + { + [JsonProperty(Required = Required.Always)] public DataBody Body; + [JsonProperty(Required = Required.Always)] public DataHeader Header; + + public class DataHeader + { + [JsonProperty(Required = Required.Always)] public string AppVersion; + [JsonProperty(Required = Required.Always)] public string CreatedBy; + [JsonProperty(Required = Required.Always)] public DateTime Date; + [JsonProperty(Required = Required.Always)] public double FileVersion; + + #region Equality members + + protected bool Equals(DataHeader other) + { + return string.Equals(CreatedBy, other.CreatedBy) && Date.Equals(other.Date) && + string.Equals(AppVersion, other.AppVersion) && FileVersion.Equals(other.FileVersion); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + if (obj.GetType() != GetType()) { + return false; + } + return Equals((DataHeader) obj); + } + + public override int GetHashCode() + { + unchecked { + var hashCode = (CreatedBy != null ? CreatedBy.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ Date.GetHashCode(); + hashCode = (hashCode * 397) ^ (AppVersion != null ? AppVersion.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ FileVersion.GetHashCode(); + return hashCode; + } + } + + #endregion + } + + public class DataBody + { + /// <summary> + /// [ccm] Displacement in cubic centimeter. + /// Used in Declaration Mode to calculate inertia. + /// </summary> + [JsonProperty(Required = Required.Always)] public double Displacement; + + /// <summary> + /// The Fuel Consumption Map is used to calculate the base Fuel Consumption (FC) value. + /// </summary> + [JsonProperty(Required = Required.Always)] public string FuelMap; + + [JsonProperty(Required = Required.Always)] public IList<DataFullLoadCurve> FullLoadCurves; + + /// <summary> + /// [rpm] Idling Engine Speed + /// Low idle, applied in simulation for vehicle standstill in neutral gear position. + /// </summary> + [JsonProperty("IdlingSpeed", Required = Required.Always)] public double IdleSpeed; + + /// <summary> + /// [kgm^2] Inertia including Flywheel + /// Inertia for rotating parts including engine flywheel. + /// In Declaration Mode the inertia is calculated automatically. + /// </summary> + [JsonProperty(Required = Required.Always)] public double Inertia; + + /// <summary> + /// Model. Free text defining the engine model, type, etc. + /// </summary> + [JsonProperty(Required = Required.Always)] public string ModelName; + + [JsonProperty("SavedInDeclMode")] public bool SavedInDeclarationMode; + + /// <summary> + /// [g/kWh] The WHTC test results are required in Declaration Mode for the motorway WHTC FC Correction. + /// </summary> + [JsonProperty("WHTC-Motorway")] public double WHTCMotorway; + + /// <summary> + /// [g/kWh] The WHTC test results are required in Declaration Mode for the rural WHTC FC Correction. + /// </summary> + [JsonProperty("WHTC-Rural")] public double WHTCRural; + + /// <summary> + /// [g/kWh] The WHTC test results are required in Declaration Mode for the urban WHTC FC Correction. + /// </summary> + [JsonProperty("WHTC-Urban")] public double WHTCUrban; + + /// <summary> + /// Multiple Full Load and Drag Curves (.vfld) can be defined and assigned to different gears. + /// Gear "0" must be assigned for idling and Engine Only Mode. + /// </summary> + public class DataFullLoadCurve + { + [JsonProperty(Required = Required.Always)] public string Gears; + [JsonProperty(Required = Required.Always)] public string Path; + + #region Equality Members + + protected bool Equals(DataFullLoadCurve other) + { + return string.Equals(Path, other.Path) && string.Equals(Gears, other.Gears); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + if (obj.GetType() != GetType()) { + return false; + } + return Equals((DataFullLoadCurve) obj); + } + + public override int GetHashCode() + { + unchecked { + return ((Path != null ? Path.GetHashCode() : 0) * 397) ^ + (Gears != null ? Gears.GetHashCode() : 0); + } + } + + #endregion + } + + #region Equality members + + protected bool Equals(DataBody other) + { + return SavedInDeclarationMode.Equals(other.SavedInDeclarationMode) + && string.Equals(ModelName, other.ModelName) + && Displacement.Equals(other.Displacement) + && IdleSpeed.Equals(other.IdleSpeed) + && Inertia.Equals(other.Inertia) + && FullLoadCurves.SequenceEqual(other.FullLoadCurves) + && string.Equals(FuelMap, other.FuelMap) + && WHTCUrban.Equals(other.WHTCUrban) + && WHTCRural.Equals(other.WHTCRural) + && WHTCMotorway.Equals(other.WHTCMotorway); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + if (obj.GetType() != GetType()) { + return false; + } + return Equals((DataBody) obj); + } + + public override int GetHashCode() + { + unchecked { + var hashCode = SavedInDeclarationMode.GetHashCode(); + hashCode = (hashCode * 397) ^ (ModelName != null ? ModelName.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ Displacement.GetHashCode(); + hashCode = (hashCode * 397) ^ IdleSpeed.GetHashCode(); + hashCode = (hashCode * 397) ^ Inertia.GetHashCode(); + hashCode = (hashCode * 397) ^ (FullLoadCurves != null ? FullLoadCurves.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (FuelMap != null ? FuelMap.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ WHTCUrban.GetHashCode(); + hashCode = (hashCode * 397) ^ WHTCRural.GetHashCode(); + hashCode = (hashCode * 397) ^ WHTCMotorway.GetHashCode(); + return hashCode; + } + } + + #endregion + } + + #region Equality members + + protected bool Equals(Data other) + { + return Equals(Header, other.Header) && Equals(Body, other.Body); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + if (obj.GetType() != GetType()) { + return false; + } + return Equals((Data) obj); + } + + public override int GetHashCode() + { + unchecked { + return ((Header != null ? Header.GetHashCode() : 0) * 397) ^ (Body != null ? Body.GetHashCode() : 0); + } + } + + #endregion + } + + public class RangeConverter : TypeConverter + { + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof (string) || base.CanConvertFrom(context, sourceType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + return value.GetType() == typeof (string) + ? new Range((string) value) + : base.ConvertFrom(context, culture, value); + } + } + + [TypeConverter(typeof (RangeConverter))] + private class Range + { + private readonly uint _end; + private readonly uint _start; + + public Range(string range) + { + Contract.Requires(range != null); + + _start = uint.Parse(range.Split('-').First().Trim()); + _end = uint.Parse(range.Split('-').Last().Trim()); + } + + public override string ToString() + { + return string.Format("{0} - {1}", _start, _end); + } + + public bool Contains(uint value) + { + return _start <= value && value <= _end; + } + + #region Equality members + + protected bool Equals(Range other) + { + Contract.Requires(other != null); + return _start == other._start && _end == other._end; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + if (obj.GetType() != GetType()) { + return false; + } + return Equals((Range) obj); + } + + public override int GetHashCode() + { + unchecked { + return (int) ((_start * 397) ^ _end); + } + } + + #endregion + } + + #region Equality members + + protected bool Equals(CombustionEngineData other) + { + return Equals(_data, other._data) + && _fullLoadCurves.Keys.SequenceEqual(other._fullLoadCurves.Keys) + && _fullLoadCurves.Values.SequenceEqual(other._fullLoadCurves.Values) + && Equals(ConsumptionMap, other.ConsumptionMap); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + if (obj.GetType() != GetType()) { + return false; + } + return Equals((CombustionEngineData) obj); + } + + public override int GetHashCode() + { + unchecked { + var hashCode = _data.GetHashCode(); + hashCode = (hashCode * 397) ^ (_fullLoadCurves != null ? _fullLoadCurves.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (ConsumptionMap != null ? ConsumptionMap.GetHashCode() : 0); + return hashCode; + } + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs b/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs index 992e93332383c8040b0846eb776520c82037676d..51e88ab862b42af6687a404d24f63b0e171e19d2 100644 --- a/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs +++ b/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs @@ -9,263 +9,267 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine { - public class FullLoadCurve : SimulationComponentData - { - [JsonProperty] private List<FullLoadCurveEntry> _entries; - - public static FullLoadCurve ReadFromFile(string fileName) - { - var data = VectoCSVFile.Read(fileName); - - //todo Contract.Requires<VectoException>(data.Columns.Count != 4, "FullLoadCurve Data File must consist of 4 columns."); - if (data.Columns.Count != 4) { - throw new VectoException("FullLoadCurve Data File must consist of 4 columns."); - } - - //todo Contract.Requires<VectoException>(data.Rows.Count < 2, "FullLoadCurve must consist of at least two lines with numeric values (below file header)"); - if (data.Rows.Count < 2) { - throw new VectoException("FullLoadCurve must consist of at least two lines with numeric values (below file header)"); - } - - List<FullLoadCurveEntry> entries; - if (HeaderIsValid(data.Columns)) { - entries = CreateFromColumnNames(data); - } else { - var log = LogManager.GetLogger<FullLoadCurve>(); - log.WarnFormat( - "FullLoadCurve: Header Line is not valid. Expected: '{0}, {1}, {2}, {3}', Got: '{4}'. Falling back to column index.", - Fields.EngineSpeed, Fields.TorqueFullLoad, Fields.TorqueDrag, Fields.PT1, - string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName).Reverse())); - - entries = CreateFromColumnIndizes(data); - } - - return new FullLoadCurve {_entries = entries}; - } - - private static bool HeaderIsValid(DataColumnCollection columns) - { - Contract.Requires(columns != null); - return columns.Contains(Fields.EngineSpeed) - && columns.Contains(Fields.TorqueDrag) - && columns.Contains(Fields.TorqueFullLoad) - && columns.Contains(Fields.PT1); - } - - private static List<FullLoadCurveEntry> CreateFromColumnNames(DataTable data) - { - Contract.Requires(data != null); - return (from DataRow row in data.Rows - select new FullLoadCurveEntry { - EngineSpeed = row.ParseDouble(Fields.EngineSpeed).SI().Rounds.Per.Minute.To<RadianPerSecond>(), - TorqueFullLoad = row.ParseDouble(Fields.TorqueFullLoad).SI<NewtonMeter>(), - TorqueDrag = row.ParseDouble(Fields.TorqueDrag).SI<NewtonMeter>(), - PT1 = row.ParseDouble(Fields.PT1).SI<Second>() - }).ToList(); - } - - private static List<FullLoadCurveEntry> CreateFromColumnIndizes(DataTable data) - { - Contract.Requires(data != null); - return (from DataRow row in data.Rows - select new FullLoadCurveEntry { - EngineSpeed = row.ParseDouble(0).SI().Rounds.Per.Minute.To<RadianPerSecond>(), - TorqueFullLoad = row.ParseDouble(1).SI<NewtonMeter>(), - TorqueDrag = row.ParseDouble(2).SI<NewtonMeter>(), - PT1 = row.ParseDouble(3).SI<Second>() - }).ToList(); - } - - /// <summary> - /// [rad/s] => [Nm] - /// </summary> - /// <param name="angularFrequency">[rad/s]</param> - /// <returns>[Nm]</returns> - public NewtonMeter FullLoadStationaryTorque(RadianPerSecond angularFrequency) - { - var idx = FindIndex(angularFrequency); - return VectoMath.Interpolate((double) _entries[idx - 1].EngineSpeed, (double) _entries[idx].EngineSpeed, - (double) _entries[idx - 1].TorqueFullLoad, (double) _entries[idx].TorqueFullLoad, - (double) angularFrequency).SI<NewtonMeter>(); - } - - /// <summary> - /// [rad/s] => [W] - /// </summary> - /// <param name="angularFrequency">[rad/s]</param> - /// <returns>[W]</returns> - public Watt FullLoadStationaryPower(RadianPerSecond angularFrequency) - { - return Formulas.TorqueToPower(FullLoadStationaryTorque(angularFrequency), angularFrequency); - } - - /// <summary> - /// [rad/s] => [Nm] - /// </summary> - /// <param name="angularFrequency">[rad/s]</param> - /// <returns>[Nm]</returns> - public NewtonMeter DragLoadStationaryTorque(RadianPerSecond angularFrequency) - { - var idx = FindIndex(angularFrequency); - return VectoMath.Interpolate((double) _entries[idx - 1].EngineSpeed, (double) _entries[idx].EngineSpeed, - (double) _entries[idx - 1].TorqueDrag, (double) _entries[idx].TorqueDrag, - (double) angularFrequency).SI<NewtonMeter>(); - } - - /// <summary> - /// [rad/s] => [W]. - /// </summary> - /// <param name="angularFrequency">[rad/s]</param> - /// <returns>[W]</returns> - public Watt DragLoadStationaryPower(RadianPerSecond angularFrequency) - { - Contract.Requires(angularFrequency.HasEqualUnit(new SI().Radian.Per.Second)); - Contract.Ensures(Contract.Result<SI>().HasEqualUnit(new SI().Watt)); - - return Formulas.TorqueToPower(DragLoadStationaryTorque(angularFrequency), angularFrequency); - } - - /// <summary> - /// [rad/s] => [-] - /// </summary> - /// <param name="angularFrequency">[rad/s]</param> - /// <returns>[-]</returns> - public SI PT1(SI angularFrequency) - { - Contract.Requires(angularFrequency.HasEqualUnit(new SI().Radian.Per.Second)); - Contract.Ensures(Contract.Result<SI>().HasEqualUnit(new SI())); - - var idx = FindIndex(angularFrequency); - return VectoMath.Interpolate((double) _entries[idx - 1].EngineSpeed, (double) _entries[idx].EngineSpeed, - (double) _entries[idx - 1].PT1, (double) _entries[idx].PT1, - (double) angularFrequency).SI(); - } - - /// <summary> - /// [rad/s] => index. Get item index for engineSpeed. - /// </summary> - /// <param name="engineSpeed">[rad/s]</param> - /// <returns>index</returns> - protected int FindIndex(SI engineSpeed) - { - Contract.Requires(engineSpeed.HasEqualUnit(new SI().Radian.Per.Second)); - - int idx; - if (engineSpeed < _entries[0].EngineSpeed) { - Log.ErrorFormat("requested rpm below minimum rpm in FLD curve - extrapolating. n: {0}, rpm_min: {1}", - engineSpeed.To().Rounds.Per.Minute, _entries[0].EngineSpeed.To().Rounds.Per.Minute); - idx = 1; - } else { - idx = _entries.FindIndex(x => x.EngineSpeed > engineSpeed); - } - if (idx <= 0) { - idx = engineSpeed > _entries[0].EngineSpeed ? _entries.Count - 1 : 1; - } - return idx; - } - - private static class Fields - { - /// <summary> - /// [rpm] engine speed - /// </summary> - public const string EngineSpeed = "engine speed"; - - /// <summary> - /// [Nm] full load torque - /// </summary> - public const string TorqueFullLoad = "full load torque"; - - /// <summary> - /// [Nm] motoring torque - /// </summary> - public const string TorqueDrag = "motoring torque"; - - /// <summary> - /// [s] time constant - /// </summary> - public const string PT1 = "PT1"; - } - - private class FullLoadCurveEntry - { - /// <summary> - /// [rad/s] engine speed - /// </summary> - public RadianPerSecond EngineSpeed { get; set; } - - /// <summary> - /// [Nm] full load torque - /// </summary> - public NewtonMeter TorqueFullLoad { get; set; } - - /// <summary> - /// [Nm] motoring torque - /// </summary> - public NewtonMeter TorqueDrag { get; set; } - - /// <summary> - /// [s] PT1 time constant - /// </summary> - public Second PT1 { get; set; } - - #region Equality members - - protected bool Equals(FullLoadCurveEntry other) - { - Contract.Requires(other != null); - return EngineSpeed.Equals(other.EngineSpeed) - && TorqueFullLoad.Equals(other.TorqueFullLoad) - && TorqueDrag.Equals(other.TorqueDrag) - && PT1.Equals(other.PT1); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - return obj.GetType() == GetType() && Equals((FullLoadCurveEntry) obj); - } - - public override int GetHashCode() - { - var hashCode = EngineSpeed.GetHashCode(); - hashCode = (hashCode * 397) ^ TorqueFullLoad.GetHashCode(); - hashCode = (hashCode * 397) ^ TorqueDrag.GetHashCode(); - hashCode = (hashCode * 397) ^ PT1.GetHashCode(); - return hashCode; - } - - #endregion - } - - #region Equality members - - protected bool Equals(FullLoadCurve other) - { - return _entries.SequenceEqual(other._entries); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - return obj.GetType() == GetType() && Equals((FullLoadCurve) obj); - } - - public override int GetHashCode() - { - return (_entries != null ? _entries.GetHashCode() : 0); - } - - #endregion - } + /// <summary> + /// Represents the Full load curve. + /// </summary> + public class FullLoadCurve : SimulationComponentData + { + [JsonProperty] private List<FullLoadCurveEntry> _entries; + + public static FullLoadCurve ReadFromFile(string fileName) + { + var data = VectoCSVFile.Read(fileName); + + //todo Contract.Requires<VectoException>(data.Columns.Count != 4, "FullLoadCurve Data File must consist of 4 columns."); + if (data.Columns.Count != 4) { + throw new VectoException("FullLoadCurve Data File must consist of 4 columns."); + } + + //todo Contract.Requires<VectoException>(data.Rows.Count < 2, "FullLoadCurve must consist of at least two lines with numeric values (below file header)"); + if (data.Rows.Count < 2) { + throw new VectoException( + "FullLoadCurve must consist of at least two lines with numeric values (below file header)"); + } + + List<FullLoadCurveEntry> entries; + if (HeaderIsValid(data.Columns)) { + entries = CreateFromColumnNames(data); + } else { + var log = LogManager.GetLogger<FullLoadCurve>(); + log.WarnFormat( + "FullLoadCurve: Header Line is not valid. Expected: '{0}, {1}, {2}, {3}', Got: '{4}'. Falling back to column index.", + Fields.EngineSpeed, Fields.TorqueFullLoad, Fields.TorqueDrag, Fields.PT1, + string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName).Reverse())); + + entries = CreateFromColumnIndizes(data); + } + + return new FullLoadCurve { _entries = entries }; + } + + private static bool HeaderIsValid(DataColumnCollection columns) + { + Contract.Requires(columns != null); + return columns.Contains(Fields.EngineSpeed) + && columns.Contains(Fields.TorqueDrag) + && columns.Contains(Fields.TorqueFullLoad) + && columns.Contains(Fields.PT1); + } + + private static List<FullLoadCurveEntry> CreateFromColumnNames(DataTable data) + { + Contract.Requires(data != null); + return (from DataRow row in data.Rows + select new FullLoadCurveEntry { + EngineSpeed = row.ParseDouble(Fields.EngineSpeed).SI().Rounds.Per.Minute.To<RadianPerSecond>(), + TorqueFullLoad = row.ParseDouble(Fields.TorqueFullLoad).SI<NewtonMeter>(), + TorqueDrag = row.ParseDouble(Fields.TorqueDrag).SI<NewtonMeter>(), + PT1 = row.ParseDouble(Fields.PT1).SI<Second>() + }).ToList(); + } + + private static List<FullLoadCurveEntry> CreateFromColumnIndizes(DataTable data) + { + Contract.Requires(data != null); + return (from DataRow row in data.Rows + select new FullLoadCurveEntry { + EngineSpeed = row.ParseDouble(0).SI().Rounds.Per.Minute.To<RadianPerSecond>(), + TorqueFullLoad = row.ParseDouble(1).SI<NewtonMeter>(), + TorqueDrag = row.ParseDouble(2).SI<NewtonMeter>(), + PT1 = row.ParseDouble(3).SI<Second>() + }).ToList(); + } + + /// <summary> + /// [rad/s] => [Nm] + /// </summary> + /// <param name="angularFrequency">[rad/s]</param> + /// <returns>[Nm]</returns> + public NewtonMeter FullLoadStationaryTorque(RadianPerSecond angularFrequency) + { + var idx = FindIndex(angularFrequency); + return VectoMath.Interpolate((double) _entries[idx - 1].EngineSpeed, (double) _entries[idx].EngineSpeed, + (double) _entries[idx - 1].TorqueFullLoad, (double) _entries[idx].TorqueFullLoad, + (double) angularFrequency).SI<NewtonMeter>(); + } + + /// <summary> + /// [rad/s] => [W] + /// </summary> + /// <param name="angularFrequency">[rad/s]</param> + /// <returns>[W]</returns> + public Watt FullLoadStationaryPower(RadianPerSecond angularFrequency) + { + return Formulas.TorqueToPower(FullLoadStationaryTorque(angularFrequency), angularFrequency); + } + + /// <summary> + /// [rad/s] => [Nm] + /// </summary> + /// <param name="angularFrequency">[rad/s]</param> + /// <returns>[Nm]</returns> + public NewtonMeter DragLoadStationaryTorque(RadianPerSecond angularFrequency) + { + var idx = FindIndex(angularFrequency); + return VectoMath.Interpolate((double) _entries[idx - 1].EngineSpeed, (double) _entries[idx].EngineSpeed, + (double) _entries[idx - 1].TorqueDrag, (double) _entries[idx].TorqueDrag, + (double) angularFrequency).SI<NewtonMeter>(); + } + + /// <summary> + /// [rad/s] => [W]. + /// </summary> + /// <param name="angularFrequency">[rad/s]</param> + /// <returns>[W]</returns> + public Watt DragLoadStationaryPower(RadianPerSecond angularFrequency) + { + Contract.Requires(angularFrequency.HasEqualUnit(new SI().Radian.Per.Second)); + Contract.Ensures(Contract.Result<SI>().HasEqualUnit(new SI().Watt)); + + return Formulas.TorqueToPower(DragLoadStationaryTorque(angularFrequency), angularFrequency); + } + + /// <summary> + /// [rad/s] => [-] + /// </summary> + /// <param name="angularFrequency">[rad/s]</param> + /// <returns>[-]</returns> + public SI PT1(SI angularFrequency) + { + Contract.Requires(angularFrequency.HasEqualUnit(new SI().Radian.Per.Second)); + Contract.Ensures(Contract.Result<SI>().HasEqualUnit(new SI())); + + var idx = FindIndex(angularFrequency); + return VectoMath.Interpolate((double) _entries[idx - 1].EngineSpeed, (double) _entries[idx].EngineSpeed, + (double) _entries[idx - 1].PT1, (double) _entries[idx].PT1, + (double) angularFrequency).SI(); + } + + /// <summary> + /// [rad/s] => index. Get item index for engineSpeed. + /// </summary> + /// <param name="engineSpeed">[rad/s]</param> + /// <returns>index</returns> + protected int FindIndex(SI engineSpeed) + { + Contract.Requires(engineSpeed.HasEqualUnit(new SI().Radian.Per.Second)); + + int idx; + if (engineSpeed < _entries[0].EngineSpeed) { + Log.ErrorFormat("requested rpm below minimum rpm in FLD curve - extrapolating. n: {0}, rpm_min: {1}", + engineSpeed.To().Rounds.Per.Minute, _entries[0].EngineSpeed.To().Rounds.Per.Minute); + idx = 1; + } else { + idx = _entries.FindIndex(x => x.EngineSpeed > engineSpeed); + } + if (idx <= 0) { + idx = engineSpeed > _entries[0].EngineSpeed ? _entries.Count - 1 : 1; + } + return idx; + } + + private static class Fields + { + /// <summary> + /// [rpm] engine speed + /// </summary> + public const string EngineSpeed = "engine speed"; + + /// <summary> + /// [Nm] full load torque + /// </summary> + public const string TorqueFullLoad = "full load torque"; + + /// <summary> + /// [Nm] motoring torque + /// </summary> + public const string TorqueDrag = "motoring torque"; + + /// <summary> + /// [s] time constant + /// </summary> + public const string PT1 = "PT1"; + } + + private class FullLoadCurveEntry + { + /// <summary> + /// [rad/s] engine speed + /// </summary> + public RadianPerSecond EngineSpeed { get; set; } + + /// <summary> + /// [Nm] full load torque + /// </summary> + public NewtonMeter TorqueFullLoad { get; set; } + + /// <summary> + /// [Nm] motoring torque + /// </summary> + public NewtonMeter TorqueDrag { get; set; } + + /// <summary> + /// [s] PT1 time constant + /// </summary> + public Second PT1 { get; set; } + + #region Equality members + + protected bool Equals(FullLoadCurveEntry other) + { + Contract.Requires(other != null); + return EngineSpeed.Equals(other.EngineSpeed) + && TorqueFullLoad.Equals(other.TorqueFullLoad) + && TorqueDrag.Equals(other.TorqueDrag) + && PT1.Equals(other.PT1); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + return obj.GetType() == GetType() && Equals((FullLoadCurveEntry) obj); + } + + public override int GetHashCode() + { + var hashCode = EngineSpeed.GetHashCode(); + hashCode = (hashCode * 397) ^ TorqueFullLoad.GetHashCode(); + hashCode = (hashCode * 397) ^ TorqueDrag.GetHashCode(); + hashCode = (hashCode * 397) ^ PT1.GetHashCode(); + return hashCode; + } + + #endregion + } + + #region Equality members + + protected bool Equals(FullLoadCurve other) + { + return _entries.SequenceEqual(other._entries); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + return obj.GetType() == GetType() && Equals((FullLoadCurve) obj); + } + + public override int GetHashCode() + { + return (_entries != null ? _entries.GetHashCode() : 0); + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/IAuxiliary.cs b/VectoCore/Models/SimulationComponent/IAuxiliary.cs index 381760949687048e15f80385bd946317309ffdc4..480f5de6515a2d2d15697216048cd3d1a3b36861 100644 --- a/VectoCore/Models/SimulationComponent/IAuxiliary.cs +++ b/VectoCore/Models/SimulationComponent/IAuxiliary.cs @@ -2,5 +2,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent { - public interface IAuxiliary : IInShaft, IOutShaft {} + /// <summary> + /// Defines interfaces for auxiliary components. + /// </summary> + public interface IAuxiliary : IInShaft, IOutShaft {} } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/ICombustionEngine.cs b/VectoCore/Models/SimulationComponent/ICombustionEngine.cs index 637f1e3c84034ea024d91ad03d80bf578d8b4140..92b3a6fdff71f4ef399137a88e96588f00de57c1 100644 --- a/VectoCore/Models/SimulationComponent/ICombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/ICombustionEngine.cs @@ -3,5 +3,8 @@ using TUGraz.VectoCore.Models.Simulation.Cockpit; namespace TUGraz.VectoCore.Models.SimulationComponent { - public interface ICombustionEngine : IOutShaft, IEngineCockpit {} + /// <summary> + /// Defines Interfaces for a combustion engine. + /// </summary> + public interface ICombustionEngine : IOutShaft, IEngineCockpit {} } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/IDriverDemandDrivingCycle.cs b/VectoCore/Models/SimulationComponent/IDriverDemandDrivingCycle.cs new file mode 100644 index 0000000000000000000000000000000000000000..4a4eb2dc8148044abe53732fa7f088e011e81a1d --- /dev/null +++ b/VectoCore/Models/SimulationComponent/IDriverDemandDrivingCycle.cs @@ -0,0 +1,9 @@ +using TUGraz.VectoCore.Models.Connector.Ports; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines interfaces for a driver demand driving cycle. + /// </summary> + public interface IDriverDemandDrivingCycle : IDrivingCycleOutProvider, IDriverDemandInProvider {} +} \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/IDrivingCycle.cs b/VectoCore/Models/SimulationComponent/IDrivingCycle.cs deleted file mode 100644 index 9907e5fc503d5950ccff5bbabe2a11b7ebcbe448..0000000000000000000000000000000000000000 --- a/VectoCore/Models/SimulationComponent/IDrivingCycle.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using TUGraz.VectoCore.Models.Connector.Ports; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IDrivingCycle - { - IResponse Request(TimeSpan absTime, TimeSpan dt); - } - - public interface IDriverDemandDrivingCycle : IDrivingCycle, IDriverDemandInProvider {} - - public interface IEngineOnlyDrivingCycle : IDrivingCycle, IInShaft {} -} \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/IEngineOnlyDrivingCycle.cs b/VectoCore/Models/SimulationComponent/IEngineOnlyDrivingCycle.cs new file mode 100644 index 0000000000000000000000000000000000000000..9d496e763db9758e023b6e38f5b1e231f6d774ff --- /dev/null +++ b/VectoCore/Models/SimulationComponent/IEngineOnlyDrivingCycle.cs @@ -0,0 +1,9 @@ +using TUGraz.VectoCore.Models.Connector.Ports; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines interfaces for a engine only driving cycle. + /// </summary> + public interface IEngineOnlyDrivingCycle : IDrivingCycleOutProvider, IInShaft {} +} \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/IGearbox.cs b/VectoCore/Models/SimulationComponent/IGearbox.cs index 4fb3f4fdad0d681f157febdd10f678e2dc93f987..f0741cdb0972ef6588fdd42e6613e3f46865b677 100644 --- a/VectoCore/Models/SimulationComponent/IGearbox.cs +++ b/VectoCore/Models/SimulationComponent/IGearbox.cs @@ -3,5 +3,8 @@ using TUGraz.VectoCore.Models.Simulation.Cockpit; namespace TUGraz.VectoCore.Models.SimulationComponent { - public interface IGearbox : IInShaft, IOutShaft, IGearboxCockpit {} + /// <summary> + /// Defines interfaces for a gearbox. + /// </summary> + public interface IGearbox : IInShaft, IOutShaft, IGearboxCockpit {} } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/IWheels.cs b/VectoCore/Models/SimulationComponent/IWheels.cs index 1ddb859526229d3efb346b966d997a70c3240afb..d5727dd0f14da26a98ffa8b73ca9af944dd60457 100644 --- a/VectoCore/Models/SimulationComponent/IWheels.cs +++ b/VectoCore/Models/SimulationComponent/IWheels.cs @@ -1,4 +1,9 @@ -namespace TUGraz.VectoCore.Models.SimulationComponent +using TUGraz.VectoCore.Models.Connector.Ports; + +namespace TUGraz.VectoCore.Models.SimulationComponent { - internal interface IWheels {} + /// <summary> + /// Defines interfaces for a wheels component. + /// </summary> + public interface IWheels : IRoadPortOutProvider, IInShaft {} } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 1940a7c0b61bbd32394db3a8eb1cc76c47a6daf4..9033a3df5b2202c7e1ce10fa6eac82d9d9ce3d83 100644 --- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -1,397 +1,422 @@ using System; using System.Collections.Generic; using System.Diagnostics.Contracts; +using NLog.LayoutRenderers; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Cockpit; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class CombustionEngine : VectoSimulationComponent, ICombustionEngine, ITnOutPort, IMemento - { - public enum EngineOperationMode - { - Idle, - Drag, - FullDrag, - Load, - FullLoad, - Stopped, - Undef - } - - private const int EngineIdleSpeedStopThreshold = 100; - private const double MaxPowerExceededThreshold = 1.05; - private const double ZeroThreshold = 0.0001; - private const double FullLoadMargin = 0.01; - [NonSerialized] private readonly List<TimeSpan> _enginePowerCorrections = new List<TimeSpan>(); - - /// <summary> - /// Current state is computed in request method - /// </summary> - private EngineState _currentState = new EngineState(); - - private CombustionEngineData _data = new CombustionEngineData(); - private EngineState _previousState = new EngineState(); - - public CombustionEngine(IVehicleContainer cockpit, CombustionEngineData data) - : base(cockpit) - { - _data = data; - - _previousState.OperationMode = EngineOperationMode.Idle; - _previousState.EnginePower = 0.SI<Watt>(); - _previousState.EngineSpeed = _data.IdleSpeed; - } - - #region IEngineCockpit - - /// <summary> - /// [rad/s] - /// </summary> - public RadianPerSecond EngineSpeed() - { - return _previousState.EngineSpeed; - } - - #endregion - - public ITnOutPort OutShaft() - { - return this; - } - - public IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) - { - _currentState.EngineSpeed = engineSpeed; - _currentState.AbsTime = absTime; - - var requestedPower = Formulas.TorqueToPower(torque, engineSpeed); - _currentState.EnginePowerLoss = InertiaPowerLoss(torque, engineSpeed); - var requestedEnginePower = (requestedPower + _currentState.EnginePowerLoss).To<Watt>(); - - if (engineSpeed < (double) _data.IdleSpeed - EngineIdleSpeedStopThreshold) { - _currentState.OperationMode = EngineOperationMode.Stopped; - //todo: _currentState.EnginePowerLoss = enginePowerLoss; - } - - var currentGear = Cockpit.Gear(); - - _currentState.FullDragTorque = _data.GetFullLoadCurve(currentGear).DragLoadStationaryTorque(engineSpeed); - _currentState.FullDragPower = Formulas.TorqueToPower(_currentState.FullDragTorque, engineSpeed); - - ComputeFullLoadPower(currentGear, engineSpeed, dt); - - ValidatePowerDemand(requestedEnginePower); - - requestedEnginePower = LimitEnginePower(requestedEnginePower); - - UpdateEngineState(requestedEnginePower); - - _currentState.EnginePower = requestedEnginePower; //todo + _currentState.EnginePowerLoss; - _currentState.EngineTorque = Formulas.PowerToTorque(_currentState.EnginePower, - _currentState.EngineSpeed); - - //todo: use ResponseOverloadFail in case of overload - return new ResponseSuccess(); - } - - public override void CommitSimulationStep(IModalDataWriter writer) - { - writer[ModalResultField.PaEng] = (double) _currentState.EnginePowerLoss; - writer[ModalResultField.Pe_drag] = (double) _currentState.FullDragPower; - writer[ModalResultField.Pe_full] = (double) _currentState.DynamicFullLoadPower; - writer[ModalResultField.Pe_eng] = (double) _currentState.EnginePower; - - writer[ModalResultField.Tq_drag] = (double) _currentState.FullDragTorque; - writer[ModalResultField.Tq_full] = (double) _currentState.DynamicFullLoadTorque; - writer[ModalResultField.Tq_eng] = (double) _currentState.EngineTorque; - writer[ModalResultField.n] = (double) _currentState.EngineSpeed.To().Rounds.Per.Minute; - - try { - writer[ModalResultField.FC] = - (double) - _data.ConsumptionMap.GetFuelConsumption(_currentState.EngineTorque, _currentState.EngineSpeed).To().Gramm.Per.Hour; - } catch (VectoException ex) { - Log.WarnFormat("t: {0} - {1} n: {2} Tq: {3}", _currentState.AbsTime.TotalSeconds, ex.Message, - _currentState.EngineSpeed, _currentState.EngineTorque); - writer[ModalResultField.FC] = Double.NaN; - } - - _previousState = _currentState; - _currentState = new EngineState(); - } - - /// <summary> - /// Validates the requested power demand [W]. - /// </summary> - /// <param name="requestedEnginePower">[W]</param> - protected void ValidatePowerDemand(SI requestedEnginePower) - { - Contract.Requires(requestedEnginePower.HasEqualUnit(new SI().Watt)); - - if (_currentState.FullDragPower >= 0 && requestedEnginePower < 0) { - throw new VectoSimulationException(String.Format("t: {0} P_engine_drag > 0! n: {1} [1/min] ", - _currentState.AbsTime, _currentState.EngineSpeed.To().Rounds.Per.Minute)); - } - if (_currentState.DynamicFullLoadPower <= 0 && requestedEnginePower > 0) { - throw new VectoSimulationException(String.Format("t: {0} P_engine_full < 0! n: {1} [1/min] ", - _currentState.AbsTime, _currentState.EngineSpeed.To().Rounds.Per.Minute)); - } - } - - /// <summary> - /// [W] => [W] - /// </summary> - /// <param name="requestedEnginePower">[W]</param> - /// <returns>[W]</returns> - protected Watt LimitEnginePower(Watt requestedEnginePower) - { - if (requestedEnginePower > _currentState.DynamicFullLoadPower) { - if (requestedEnginePower / _currentState.DynamicFullLoadPower > MaxPowerExceededThreshold) { - _enginePowerCorrections.Add(_currentState.AbsTime); - Log.WarnFormat("t: {0} requested power > P_engine_full * 1.05 - corrected. P_request: {1} P_engine_full: {2}", - _currentState.AbsTime, requestedEnginePower, _currentState.DynamicFullLoadPower); - } - return _currentState.DynamicFullLoadPower; - } - if (requestedEnginePower < _currentState.FullDragPower) { - if (requestedEnginePower / _currentState.FullDragPower > MaxPowerExceededThreshold && requestedEnginePower > -99999) { - _enginePowerCorrections.Add(_currentState.AbsTime); - Log.WarnFormat("t: {0} requested power < P_engine_drag * 1.05 - corrected. P_request: {1} P_engine_drag: {2}", - _currentState.AbsTime, requestedEnginePower, _currentState.FullDragPower); - } - return _currentState.FullDragPower; - } - return requestedEnginePower; - } - - /// <summary> - /// Updates the engine state dependend on the requested power [W]. - /// </summary> - /// <param name="requestedEnginePower">[W]</param> - protected void UpdateEngineState(Watt requestedEnginePower) - { - if (requestedEnginePower < -ZeroThreshold) { - _currentState.OperationMode = IsFullLoad(requestedEnginePower, _currentState.DynamicFullLoadPower) - ? EngineOperationMode.FullLoad - : EngineOperationMode.Load; - } else if (requestedEnginePower > ZeroThreshold) { - _currentState.OperationMode = IsFullLoad(requestedEnginePower, _currentState.FullDragPower) - ? EngineOperationMode.FullDrag - : EngineOperationMode.Drag; - } else { - // -ZeroThreshold <= requestedEnginePower <= ZeroThreshold - _currentState.OperationMode = EngineOperationMode.Idle; - } - } - - public IList<string> Warnings() - { - IList<string> retVal = new List<string>(); - retVal.Add(string.Format("Engine power corrected (>5%) in {0} time steps ", _enginePowerCorrections.Count)); - return retVal; - } - - /// <summary> - /// computes full load power from gear [-], angularFrequency [rad/s] and dt [s]. - /// </summary> - /// <param name="gear"></param> - /// <param name="angularFrequency">[rad/s]</param> - /// <param name="dt">[s]</param> - protected void ComputeFullLoadPower(uint gear, RadianPerSecond angularFrequency, TimeSpan dt) - { - Contract.Requires(dt.Ticks != 0); - // TODO @@@quam: handle dynamic timesteps - Contract.Requires(dt.TotalSeconds.IsSmallerOrEqual(1), "simulation steps other than 1s can not be handled ATM"); - Contract.Ensures(_currentState.DynamicFullLoadPower <= _currentState.StationaryFullLoadPower); - - //_currentState.StationaryFullLoadPower = _data.GetFullLoadCurve(gear).FullLoadStationaryPower(rpm); - _currentState.StationaryFullLoadTorque = _data.GetFullLoadCurve(gear).FullLoadStationaryTorque(angularFrequency); - _currentState.StationaryFullLoadPower = Formulas.TorqueToPower(_currentState.StationaryFullLoadTorque, - angularFrequency); - - var pt1 = _data.GetFullLoadCurve(gear).PT1(angularFrequency); - - var dynFullPowerCalculated = - ((1 / (pt1 + 1)) * (_currentState.StationaryFullLoadPower + pt1 * _previousState.EnginePower)).To<Watt>(); - _currentState.DynamicFullLoadPower = dynFullPowerCalculated < _currentState.StationaryFullLoadPower - ? dynFullPowerCalculated - : _currentState.StationaryFullLoadPower; - _currentState.DynamicFullLoadTorque = Formulas.PowerToTorque(_currentState.DynamicFullLoadPower, angularFrequency); - } - - protected bool IsFullLoad(Watt requestedPower, Watt maxPower) - { - var testValue = requestedPower / maxPower - 1.0; - return testValue.Abs() < FullLoadMargin; - } - - /// <summary> - /// Calculates power loss. [W] - /// </summary> - /// <param name="torque">[Nm]</param> - /// <param name="engineSpeed">[rad/s]</param> - /// <returns>[W]</returns> - protected Watt InertiaPowerLoss(NewtonMeter torque, RadianPerSecond engineSpeed) - { - var deltaEngineSpeed = engineSpeed - _previousState.EngineSpeed; - var avgEngineSpeed = (_previousState.EngineSpeed + engineSpeed) / new SI(2).Second; - var result = _data.Inertia * deltaEngineSpeed * avgEngineSpeed; - return result.To<Watt>(); - } - - public class EngineState - { - public EngineOperationMode OperationMode { get; set; } - - /// <summary> - /// [s] - /// </summary> - public TimeSpan AbsTime { get; set; } - - /// <summary> - /// [W] - /// </summary> - public Watt EnginePower { get; set; } - - /// <summary> - /// [rad/s] - /// </summary> - public RadianPerSecond EngineSpeed { get; set; } - - /// <summary> - /// [W] - /// </summary> - public Watt EnginePowerLoss { get; set; } - - /// <summary> - /// [W] - /// </summary> - public Watt StationaryFullLoadPower { get; set; } - - /// <summary> - /// [W] - /// </summary> - public Watt DynamicFullLoadPower { get; set; } - - /// <summary> - /// [Nm] - /// </summary> - public NewtonMeter StationaryFullLoadTorque { get; set; } - - /// <summary> - /// [Nm] - /// </summary> - public NewtonMeter DynamicFullLoadTorque { get; set; } - - /// <summary> - /// [W] - /// </summary> - public Watt FullDragPower { get; set; } - - /// <summary> - /// [Nm] - /// </summary> - public NewtonMeter FullDragTorque { get; set; } - - /// <summary> - /// [Nm] - /// </summary> - public NewtonMeter EngineTorque { get; set; } - - #region Equality members - - protected bool Equals(EngineState other) - { - return OperationMode == other.OperationMode - && Equals(EnginePower, other.EnginePower) - && Equals(EngineSpeed, other.EngineSpeed) - && Equals(EnginePowerLoss, other.EnginePowerLoss) - && AbsTime.Equals(other.AbsTime); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - var other = obj as EngineState; - return other != null && Equals(other); - } - - public override int GetHashCode() - { - unchecked { - var hashCode = (int) OperationMode; - hashCode = (hashCode * 397) ^ (EnginePower != null ? EnginePower.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (EngineSpeed != null ? EngineSpeed.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (EnginePowerLoss != null ? EnginePowerLoss.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ AbsTime.GetHashCode(); - return hashCode; - } - } - - #endregion - } - - #region Equality members - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - return obj.GetType() == GetType() && Equals((CombustionEngine) obj); - } - - protected bool Equals(CombustionEngine other) - { - return Equals(_data, other._data) - && Equals(_previousState, other._previousState) - && Equals(_currentState, other._currentState); - } - - public override int GetHashCode() - { - unchecked { - var hashCode = base.GetHashCode(); - hashCode = (hashCode * 397) ^ (_data != null ? _data.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (_previousState != null ? _previousState.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (_currentState != null ? _currentState.GetHashCode() : 0); - return hashCode; - } - } - - #endregion - - #region IMemento - - public string Serialize() - { - var mem = new {Data = _data, PreviousState = _previousState}; - return Memento.Serialize(mem); - } - - public void Deserialize(string data) - { - var mem = new {Data = _data, PreviousState = _previousState}; - mem = Memento.Deserialize(data, mem); - - _data = mem.Data; - _previousState = mem.PreviousState; - } - - #endregion - } + /// <summary> + /// Component for a combustion engine. + /// </summary> + public class CombustionEngine : VectoSimulationComponent, ICombustionEngine, ITnOutPort, IMemento + { + public enum EngineOperationMode + { + Idle, + Drag, + FullDrag, + Load, + FullLoad, + Stopped, + Undef + } + + private const int EngineIdleSpeedStopThreshold = 100; + private const double MaxPowerExceededThreshold = 1.05; + private const double ZeroThreshold = 0.0001; + private const double FullLoadMargin = 0.01; + [NonSerialized] private readonly List<TimeSpan> _enginePowerCorrections = new List<TimeSpan>(); + + /// <summary> + /// Current state is computed in request method + /// </summary> + private EngineState _currentState = new EngineState(); + + private CombustionEngineData _data; + private EngineState _previousState = new EngineState(); + + public CombustionEngine(IVehicleContainer cockpit, CombustionEngineData data) + : base(cockpit) + { + _data = data; + + _previousState.OperationMode = EngineOperationMode.Idle; + _previousState.EnginePower = 0.SI<Watt>(); + _previousState.EngineSpeed = _data.IdleSpeed; + } + + #region IEngineCockpit + + RadianPerSecond IEngineCockpit.EngineSpeed() + { + return _previousState.EngineSpeed; + } + + #endregion + + #region IOutShaft + + public ITnOutPort OutShaft() + { + return this; + } + + #endregion + + #region ITnOutPort + + IResponse ITnOutPort.Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) + { + _currentState.EngineSpeed = engineSpeed; + _currentState.AbsTime = absTime; + + var requestedPower = Formulas.TorqueToPower(torque, engineSpeed); + _currentState.EnginePowerLoss = InertiaPowerLoss(torque, engineSpeed); + var requestedEnginePower = (requestedPower + _currentState.EnginePowerLoss).To<Watt>(); + + if (engineSpeed < (double) _data.IdleSpeed - EngineIdleSpeedStopThreshold) { + _currentState.OperationMode = EngineOperationMode.Stopped; + //todo: _currentState.EnginePowerLoss = enginePowerLoss; + } + + var currentGear = Cockpit.Gear(); + + _currentState.FullDragTorque = _data.GetFullLoadCurve(currentGear).DragLoadStationaryTorque(engineSpeed); + _currentState.FullDragPower = Formulas.TorqueToPower(_currentState.FullDragTorque, engineSpeed); + + ComputeFullLoadPower(currentGear, engineSpeed, dt); + + ValidatePowerDemand(requestedEnginePower); + + requestedEnginePower = LimitEnginePower(requestedEnginePower); + + UpdateEngineState(requestedEnginePower); + + _currentState.EnginePower = requestedEnginePower; //todo + _currentState.EnginePowerLoss; + _currentState.EngineTorque = Formulas.PowerToTorque(_currentState.EnginePower, + _currentState.EngineSpeed); + + //todo: use ResponseOverloadFail in case of overload + return new ResponseSuccess(); + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) + { + writer[ModalResultField.PaEng] = (double) _currentState.EnginePowerLoss; + writer[ModalResultField.Pe_drag] = (double) _currentState.FullDragPower; + writer[ModalResultField.Pe_full] = (double) _currentState.DynamicFullLoadPower; + writer[ModalResultField.Pe_eng] = (double) _currentState.EnginePower; + + writer[ModalResultField.Tq_drag] = (double) _currentState.FullDragTorque; + writer[ModalResultField.Tq_full] = (double) _currentState.DynamicFullLoadTorque; + writer[ModalResultField.Tq_eng] = (double) _currentState.EngineTorque; + writer[ModalResultField.n] = (double) _currentState.EngineSpeed.To().Rounds.Per.Minute; + + try { + writer[ModalResultField.FC] = + (double) + _data.ConsumptionMap.GetFuelConsumption(_currentState.EngineTorque, _currentState.EngineSpeed) + .To() + .Gramm.Per.Hour; + } catch (VectoException ex) { + Log.WarnFormat("t: {0} - {1} n: {2} Tq: {3}", _currentState.AbsTime.TotalSeconds, ex.Message, + _currentState.EngineSpeed, _currentState.EngineTorque); + writer[ModalResultField.FC] = Double.NaN; + } + + _previousState = _currentState; + _currentState = new EngineState(); + } + + #endregion + + /// <summary> + /// Validates the requested power demand [W]. + /// </summary> + /// <param name="requestedEnginePower">[W]</param> + protected void ValidatePowerDemand(SI requestedEnginePower) + { + Contract.Requires(requestedEnginePower.HasEqualUnit(new SI().Watt)); + + if (_currentState.FullDragPower >= 0 && requestedEnginePower < 0) { + throw new VectoSimulationException(String.Format("t: {0} P_engine_drag > 0! n: {1} [1/min] ", + _currentState.AbsTime, _currentState.EngineSpeed.To().Rounds.Per.Minute)); + } + if (_currentState.DynamicFullLoadPower <= 0 && requestedEnginePower > 0) { + throw new VectoSimulationException(String.Format("t: {0} P_engine_full < 0! n: {1} [1/min] ", + _currentState.AbsTime, _currentState.EngineSpeed.To().Rounds.Per.Minute)); + } + } + + /// <summary> + /// [W] => [W] + /// </summary> + /// <param name="requestedEnginePower">[W]</param> + /// <returns>[W]</returns> + protected Watt LimitEnginePower(Watt requestedEnginePower) + { + if (requestedEnginePower > _currentState.DynamicFullLoadPower) { + if (requestedEnginePower / _currentState.DynamicFullLoadPower > MaxPowerExceededThreshold) { + _enginePowerCorrections.Add(_currentState.AbsTime); + Log.WarnFormat( + "t: {0} requested power > P_engine_full * 1.05 - corrected. P_request: {1} P_engine_full: {2}", + _currentState.AbsTime, requestedEnginePower, _currentState.DynamicFullLoadPower); + } + return _currentState.DynamicFullLoadPower; + } + if (requestedEnginePower < _currentState.FullDragPower) { + if (requestedEnginePower / _currentState.FullDragPower > MaxPowerExceededThreshold && + requestedEnginePower > -99999) { + _enginePowerCorrections.Add(_currentState.AbsTime); + Log.WarnFormat( + "t: {0} requested power < P_engine_drag * 1.05 - corrected. P_request: {1} P_engine_drag: {2}", + _currentState.AbsTime, requestedEnginePower, _currentState.FullDragPower); + } + return _currentState.FullDragPower; + } + return requestedEnginePower; + } + + /// <summary> + /// Updates the engine state dependend on the requested power [W]. + /// </summary> + /// <param name="requestedEnginePower">[W]</param> + protected void UpdateEngineState(Watt requestedEnginePower) + { + if (requestedEnginePower < -ZeroThreshold) { + _currentState.OperationMode = IsFullLoad(requestedEnginePower, _currentState.DynamicFullLoadPower) + ? EngineOperationMode.FullLoad + : EngineOperationMode.Load; + } else if (requestedEnginePower > ZeroThreshold) { + _currentState.OperationMode = IsFullLoad(requestedEnginePower, _currentState.FullDragPower) + ? EngineOperationMode.FullDrag + : EngineOperationMode.Drag; + } else { + // -ZeroThreshold <= requestedEnginePower <= ZeroThreshold + _currentState.OperationMode = EngineOperationMode.Idle; + } + } + + public IList<string> Warnings() + { + IList<string> retVal = new List<string>(); + retVal.Add(string.Format("Engine power corrected (>5%) in {0} time steps ", _enginePowerCorrections.Count)); + return retVal; + } + + /// <summary> + /// computes full load power from gear [-], angularFrequency [rad/s] and dt [s]. + /// </summary> + /// <param name="gear"></param> + /// <param name="angularFrequency">[rad/s]</param> + /// <param name="dt">[s]</param> + protected void ComputeFullLoadPower(uint gear, RadianPerSecond angularFrequency, TimeSpan dt) + { + if (dt.Ticks == 0) { + throw new VectoException("ComputeFullLoadPower cannot compute at time 0."); + } + + // TODO @@@quam: handle dynamic timesteps + if (!dt.TotalSeconds.IsEqual(1)) { + throw new VectoException("simulation steps other than 1s can not be handled ATM"); + } + + //_currentState.StationaryFullLoadPower = _data.GetFullLoadCurve(gear).FullLoadStationaryPower(rpm); + _currentState.StationaryFullLoadTorque = + _data.GetFullLoadCurve(gear).FullLoadStationaryTorque(angularFrequency); + _currentState.StationaryFullLoadPower = Formulas.TorqueToPower(_currentState.StationaryFullLoadTorque, + angularFrequency); + + var pt1 = _data.GetFullLoadCurve(gear).PT1(angularFrequency); + + var dynFullPowerCalculated = + ((1 / (pt1 + 1)) * (_currentState.StationaryFullLoadPower + pt1 * _previousState.EnginePower)).To<Watt>(); + _currentState.DynamicFullLoadPower = dynFullPowerCalculated < _currentState.StationaryFullLoadPower + ? dynFullPowerCalculated + : _currentState.StationaryFullLoadPower; + _currentState.DynamicFullLoadTorque = Formulas.PowerToTorque(_currentState.DynamicFullLoadPower, + angularFrequency); + } + + protected bool IsFullLoad(Watt requestedPower, Watt maxPower) + { + var testValue = requestedPower / maxPower - 1.0; + return testValue.Abs() < FullLoadMargin; + } + + /// <summary> + /// Calculates power loss. [W] + /// </summary> + /// <param name="torque">[Nm]</param> + /// <param name="engineSpeed">[rad/s]</param> + /// <returns>[W]</returns> + protected Watt InertiaPowerLoss(NewtonMeter torque, RadianPerSecond engineSpeed) + { + var deltaEngineSpeed = engineSpeed - _previousState.EngineSpeed; + var avgEngineSpeed = (_previousState.EngineSpeed + engineSpeed) / new SI(2).Second; + var result = _data.Inertia * deltaEngineSpeed * avgEngineSpeed; + return result.To<Watt>(); + } + + public class EngineState + { + public EngineOperationMode OperationMode { get; set; } + + /// <summary> + /// [s] + /// </summary> + public TimeSpan AbsTime { get; set; } + + /// <summary> + /// [W] + /// </summary> + public Watt EnginePower { get; set; } + + /// <summary> + /// [rad/s] + /// </summary> + public RadianPerSecond EngineSpeed { get; set; } + + /// <summary> + /// [W] + /// </summary> + public Watt EnginePowerLoss { get; set; } + + /// <summary> + /// [W] + /// </summary> + public Watt StationaryFullLoadPower { get; set; } + + /// <summary> + /// [W] + /// </summary> + public Watt DynamicFullLoadPower { get; set; } + + /// <summary> + /// [Nm] + /// </summary> + public NewtonMeter StationaryFullLoadTorque { get; set; } + + /// <summary> + /// [Nm] + /// </summary> + public NewtonMeter DynamicFullLoadTorque { get; set; } + + /// <summary> + /// [W] + /// </summary> + public Watt FullDragPower { get; set; } + + /// <summary> + /// [Nm] + /// </summary> + public NewtonMeter FullDragTorque { get; set; } + + /// <summary> + /// [Nm] + /// </summary> + public NewtonMeter EngineTorque { get; set; } + + #region Equality members + + protected bool Equals(EngineState other) + { + return OperationMode == other.OperationMode + && Equals(EnginePower, other.EnginePower) + && Equals(EngineSpeed, other.EngineSpeed) + && Equals(EnginePowerLoss, other.EnginePowerLoss) + && AbsTime.Equals(other.AbsTime); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + var other = obj as EngineState; + return other != null && Equals(other); + } + + public override int GetHashCode() + { + unchecked { + var hashCode = (int) OperationMode; + hashCode = (hashCode * 397) ^ (EnginePower != null ? EnginePower.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (EngineSpeed != null ? EngineSpeed.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (EnginePowerLoss != null ? EnginePowerLoss.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ AbsTime.GetHashCode(); + return hashCode; + } + } + + #endregion + } + + #region Equality members + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + return obj.GetType() == GetType() && Equals((CombustionEngine) obj); + } + + protected bool Equals(CombustionEngine other) + { + return Equals(_data, other._data) + && Equals(_previousState, other._previousState) + && Equals(_currentState, other._currentState); + } + + public override int GetHashCode() + { + unchecked { + var hashCode = base.GetHashCode(); + hashCode = (hashCode * 397) ^ (_data != null ? _data.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (_previousState != null ? _previousState.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (_currentState != null ? _currentState.GetHashCode() : 0); + return hashCode; + } + } + + #endregion + + #region IMemento + + public string Serialize() + { + var mem = new { Data = _data, PreviousState = _previousState }; + return Memento.Serialize(mem); + } + + public void Deserialize(string data) + { + var mem = new { Data = _data, PreviousState = _previousState }; + mem = Memento.Deserialize(data, mem); + + _data = mem.Data; + _previousState = mem.PreviousState; + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index 4de2c0795710c622d2b0491fd7bea894cb6d11ba..74b47549b1b9ed88662296fcb77689402a0c3130 100644 --- a/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -6,43 +6,67 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - /// <summary> - /// Class representing one Distance Based Driving Cycle - /// </summary> - public class DistanceBasedDrivingCycle : VectoSimulationComponent, IDrivingCycle, IDriverDemandInPort - { - protected TimeSpan AbsTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0); - protected DrivingCycleData Data; - protected double Distance = 0; - protected TimeSpan Dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0); - - public DistanceBasedDrivingCycle(IVehicleContainer container, DrivingCycleData cycle) : base(container) - { - Data = cycle; - } - - private IDriverDemandOutPort OutPort { get; set; } - private int CurrentStep { get; set; } - - public void Connect(IDriverDemandOutPort other) - { - OutPort = other; - } - - public IResponse Request(TimeSpan absTime, TimeSpan dt) - { - //todo: Distance calculation and comparison!!! - throw new NotImplementedException("Distance based Cycle is not yet implemented."); - } - - public override void CommitSimulationStep(IModalDataWriter writer) - { - throw new NotImplementedException("Distance based Cycle is not yet implemented."); - } - - public IDriverDemandInPort InPort() - { - return this; - } - } + /// <summary> + /// Class representing one Distance Based Driving Cycle + /// </summary> + public class DistanceBasedDrivingCycle : VectoSimulationComponent, IDriverDemandDrivingCycle, IDrivingCycleOutPort, + IDriverDemandInPort + { + protected TimeSpan AbsTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0); + protected DrivingCycleData Data; + protected double Distance = 0; + protected TimeSpan Dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0); + private IDriverDemandOutPort _outPort; + + public DistanceBasedDrivingCycle(IVehicleContainer container, DrivingCycleData cycle) : base(container) + { + Data = cycle; + } + + #region IDriverDemandInProvider + + public IDriverDemandInPort InPort() + { + return this; + } + + #endregion + + #region IDrivingCycleOutProvider + + public IDrivingCycleOutPort OutPort() + { + return this; + } + + #endregion + + #region IDriverDemandInPort + + void IDriverDemandInPort.Connect(IDriverDemandOutPort other) + { + _outPort = other; + } + + #endregion + + #region IDrivingCycleOutPort + + IResponse IDrivingCycleOutPort.Request(TimeSpan absTime, TimeSpan dt) + { + //todo: Distance calculation and comparison!!! + throw new NotImplementedException("Distance based Cycle is not yet implemented."); + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) + { + throw new NotImplementedException("Distance based Cycle is not yet implemented."); + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyAuxiliary.cs b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyAuxiliary.cs index 6f92211a47e9f22ab5af4d084391528487fe44e1..3f666e37e14f6dc7d26ef72d9153b2a3469d76e6 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyAuxiliary.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyAuxiliary.cs @@ -8,47 +8,68 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class EngineOnlyAuxiliary : VectoSimulationComponent, IAuxiliary, ITnInPort, ITnOutPort - { - private readonly AuxiliariesDemandAdapter _demand; - private ITnOutPort _outPort; - private Watt _powerDemand; - - public EngineOnlyAuxiliary(IVehicleContainer container, AuxiliariesDemandAdapter demand) : base(container) - { - _demand = demand; - } - - public ITnInPort InShaft() - { - return this; - } - - public ITnOutPort OutShaft() - { - return this; - } - - public void Connect(ITnOutPort other) - { - _outPort = other; - } - - public IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) - { - if (_outPort == null) { - Log.ErrorFormat("{0} cannot handle incoming request - no outport available", absTime); - throw new VectoSimulationException(String.Format("{0} cannot handle incoming request - no outport available", - absTime.TotalSeconds)); - } - _powerDemand = _demand.GetPowerDemand(absTime, dt); - var tq = Formulas.PowerToTorque(_powerDemand, engineSpeed); - return _outPort.Request(absTime, dt, (torque + tq).To<NewtonMeter>(), engineSpeed); - } - - public override void CommitSimulationStep(IModalDataWriter writer) - { - writer[ModalResultField.Paux] = (double) _powerDemand; - } - } + public class EngineOnlyAuxiliary : VectoSimulationComponent, IAuxiliary, ITnInPort, ITnOutPort + { + private readonly AuxiliariesDemandAdapter _demand; + private ITnOutPort _outPort; + private Watt _powerDemand; + + public EngineOnlyAuxiliary(IVehicleContainer container, AuxiliariesDemandAdapter demand) : base(container) + { + _demand = demand; + } + + #region IInShaft + + public ITnInPort InShaft() + { + return this; + } + + #endregion + + #region IOutShaft + + public ITnOutPort OutShaft() + { + return this; + } + + #endregion + + #region ITnInPort + + void ITnInPort.Connect(ITnOutPort other) + { + _outPort = other; + } + + #endregion + + #region ITnOutPort + + IResponse ITnOutPort.Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) + { + if (_outPort == null) { + Log.ErrorFormat("{0} cannot handle incoming request - no outport available", absTime); + throw new VectoSimulationException( + String.Format("{0} cannot handle incoming request - no outport available", + absTime.TotalSeconds)); + } + _powerDemand = _demand.GetPowerDemand(absTime, dt); + var tq = Formulas.PowerToTorque(_powerDemand, engineSpeed); + return _outPort.Request(absTime, dt, (torque + tq).To<NewtonMeter>(), engineSpeed); + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) + { + writer[ModalResultField.Paux] = (double) _powerDemand; + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs index 77a65c5c6f640158ce34b7b39b145bbc1fb45bec..5a41e36ba4bf1015da0ff95df60e1346739c4997 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs @@ -7,50 +7,66 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - /// <summary> - /// Class representing one EngineOnly Driving Cycle - /// </summary> - public class EngineOnlyDrivingCycle : VectoSimulationComponent, IEngineOnlyDrivingCycle, ITnInPort - { - protected DrivingCycleData Data; + /// <summary> + /// Class representing one EngineOnly Driving Cycle + /// </summary> + public class EngineOnlyDrivingCycle : VectoSimulationComponent, IEngineOnlyDrivingCycle, ITnInPort, + IDrivingCycleOutPort + { + protected DrivingCycleData Data; + private ITnOutPort _outPort; - public EngineOnlyDrivingCycle(IVehicleContainer container, DrivingCycleData cycle) : base(container) - { - Data = cycle; - } + public EngineOnlyDrivingCycle(IVehicleContainer container, DrivingCycleData cycle) : base(container) + { + Data = cycle; + } - private ITnOutPort OutPort { get; set; } - private int CurrentStep { get; set; } + #region IInShaft - #region ITnInPort + public ITnInPort InShaft() + { + return this; + } - public void Connect(ITnOutPort other) - { - OutPort = other; - } + #endregion - #endregion + #region IDrivingCycleOutProvider - public override void CommitSimulationStep(IModalDataWriter writer) {} + public IDrivingCycleOutPort OutPort() + { + return this; + } - #region IInShaft + #endregion - public ITnInPort InShaft() - { - return this; - } + #region IDrivingCycleOutPort - public IResponse Request(TimeSpan absTime, TimeSpan dt) - { - //todo: change to variable time steps - var index = (int) Math.Floor(absTime.TotalSeconds); - if (index >= Data.Entries.Count) { - return new ResponseCycleFinished(); - } + IResponse IDrivingCycleOutPort.Request(TimeSpan absTime, TimeSpan dt) + { + //todo: change to variable time steps + var index = (int) Math.Floor(absTime.TotalSeconds); + if (index >= Data.Entries.Count) { + return new ResponseCycleFinished(); + } - return OutPort.Request(absTime, dt, Data.Entries[index].EngineTorque, Data.Entries[index].EngineSpeed); - } + return _outPort.Request(absTime, dt, Data.Entries[index].EngineTorque, Data.Entries[index].EngineSpeed); + } - #endregion - } + #endregion + + #region ITnInPort + + void ITnInPort.Connect(ITnOutPort other) + { + _outPort = other; + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) {} + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs index 417cb40f9e26a86d2200f0a7140917c97fa6c1fe..a7a01d930a843d1a7c70b6f1bbaf84c77f7e594a 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs @@ -2,51 +2,72 @@ using System; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Cockpit; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class EngineOnlyGearbox : VectoSimulationComponent, IGearbox, ITnInPort, ITnOutPort - { - private ITnOutPort _outPort; - public EngineOnlyGearbox(IVehicleContainer cockpit) : base(cockpit) {} - - public ITnInPort InShaft() - { - return this; - } - - public ITnOutPort OutShaft() - { - return this; - } - - public uint Gear() - { - return 0; - } - - public void Connect(ITnOutPort other) - { - _outPort = other; - } - - public IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) - { - if (_outPort == null) { - Log.ErrorFormat("{0} cannot handle incoming request - no outport available", absTime); - throw new VectoSimulationException(String.Format("{0} cannot handle incoming request - no outport available", - absTime.TotalSeconds)); - } - return _outPort.Request(absTime, dt, torque, engineSpeed); - } - - public void Connect(IOutPort other) - { - throw new NotImplementedException(); - } - - public override void CommitSimulationStep(IModalDataWriter writer) {} - } + public class EngineOnlyGearbox : VectoSimulationComponent, IGearbox, ITnInPort, ITnOutPort + { + private ITnOutPort _outPort; + public EngineOnlyGearbox(IVehicleContainer cockpit) : base(cockpit) {} + + #region IInShaft + + public ITnInPort InShaft() + { + return this; + } + + #endregion IOutShaft + + #region IOutShaft + + public ITnOutPort OutShaft() + { + return this; + } + + #endregion + + #region IGearboxCockpit + + uint IGearboxCockpit.Gear() + { + return 0; + } + + #endregion + + #region ITnInPort + + void ITnInPort.Connect(ITnOutPort other) + { + _outPort = other; + } + + #endregion + + #region ITnOutPort + + IResponse ITnOutPort.Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) + { + if (_outPort == null) { + Log.ErrorFormat("{0} cannot handle incoming request - no outport available", absTime); + throw new VectoSimulationException( + String.Format("{0} cannot handle incoming request - no outport available", + absTime.TotalSeconds)); + } + return _outPort.Request(absTime, dt, torque, engineSpeed); + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) {} + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 9cf868c94f5a5c89a6ac5f4693e8e215d3aeaac6..0611b0706f2f29b728178d52a22a3fa59ad86189 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -1,38 +1,68 @@ using System; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Cockpit; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class Gearbox : VectoSimulationComponent, IGearbox, ITnOutPort - { - public Gearbox(IVehicleContainer container) : base(container) {} - - public ITnInPort InShaft() - { - throw new NotImplementedException(); - } - - public ITnOutPort OutShaft() - { - throw new NotImplementedException(); - } - - public uint Gear() - { - throw new NotImplementedException(); - } - - public IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) - { - throw new NotImplementedException(); - } - - public override void CommitSimulationStep(IModalDataWriter writer) - { - throw new NotImplementedException(); - } - } + public class Gearbox : VectoSimulationComponent, IGearbox, ITnOutPort, ITnInPort + { + public Gearbox(IVehicleContainer container) : base(container) {} + + #region IInShaft + + public ITnInPort InShaft() + { + throw new NotImplementedException(); + } + + #endregion + + #region IOutShaft + + public ITnOutPort OutShaft() + { + throw new NotImplementedException(); + } + + #endregion + + #region IGearboxCockpit + + uint IGearboxCockpit.Gear() + { + throw new NotImplementedException(); + } + + #endregion + + #region ITnOutPort + + IResponse ITnOutPort.Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond engineSpeed) + { + throw new NotImplementedException(); + } + + #endregion + + #region ITnInPort + + void ITnInPort.Connect(ITnOutPort other) + { + throw new NotImplementedException(); + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) + { + throw new NotImplementedException(); + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs index a785120b0c31c262f320a6e847ac60d0b79c24ec..973f35ba1f97f68e26804567578201b7e40a3d5f 100644 --- a/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs @@ -4,44 +4,71 @@ using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - /// <summary> - /// Class representing one Time Based Driving Cycle - /// </summary> - public class TimeBasedDrivingCycle : VectoSimulationComponent, IDriverDemandDrivingCycle, IDriverDemandInPort - { - protected DrivingCycleData Data; - - public TimeBasedDrivingCycle(IVehicleContainer container, DrivingCycleData cycle) : base(container) - { - Data = cycle; - } - - private IDriverDemandOutPort OutPort { get; set; } - - public IDriverDemandInPort InPort() - { - return this; - } - - public IResponse Request(TimeSpan absTime, TimeSpan dt) - { - //todo: change to variable time steps - var index = (int) Math.Floor(absTime.TotalSeconds); - if (index >= Data.Entries.Count) { - return new ResponseCycleFinished(); - } - - return OutPort.Request(absTime, dt, Data.Entries[index].VehicleSpeed, Data.Entries[index].RoadGradient); - } - - public void Connect(IDriverDemandOutPort other) - { - OutPort = other; - } - - public override void CommitSimulationStep(IModalDataWriter writer) {} - } + /// <summary> + /// Class representing one Time Based Driving Cycle + /// </summary> + public class TimeBasedDrivingCycle : VectoSimulationComponent, IDriverDemandDrivingCycle, IDriverDemandInPort, + IDrivingCycleOutPort + { + protected DrivingCycleData Data; + private IDriverDemandOutPort _outPort; + + public TimeBasedDrivingCycle(IVehicleContainer container, DrivingCycleData cycle) : base(container) + { + Data = cycle; + } + + #region IDrivingCycleOutProvider + + public IDrivingCycleOutPort OutPort() + { + return this; + } + + #endregion + + #region IDriverDemandInProvider + + public IDriverDemandInPort InPort() + { + return this; + } + + #endregion + + #region IDrivingCycleOutPort + + IResponse IDrivingCycleOutPort.Request(TimeSpan absTime, TimeSpan dt) + { + //todo: change to variable time steps + var index = (int) Math.Floor(absTime.TotalSeconds); + if (index >= Data.Entries.Count) { + return new ResponseCycleFinished(); + } + + return _outPort.Request(absTime, dt, Data.Entries[index].VehicleSpeed, + Data.Entries[index].RoadGradient.SI().GradientPercent.To<Radian>()); + } + + #endregion + + #region IDriverDemandInPort + + void IDriverDemandInPort.Connect(IDriverDemandOutPort other) + { + _outPort = other; + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) {} + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/Wheels.cs b/VectoCore/Models/SimulationComponent/Impl/Wheels.cs index c3bc4452d8e04d0620db3d70942618f416877e75..04a97a11a400ee4cb1b550e869790e7da0bc87fe 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Wheels.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Wheels.cs @@ -2,27 +2,60 @@ using System; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class Wheels : VectoSimulationComponent - { - public Wheels(IVehicleContainer cockpit) - : base(cockpit) {} - - public IInPort InPort() - { - throw new NotImplementedException(); - } - - public IOutPort OutPort() - { - throw new NotImplementedException(); - } - - public override void CommitSimulationStep(IModalDataWriter writer) - { - throw new NotImplementedException(); - } - } + public class Wheels : VectoSimulationComponent, IWheels, IFvOutPort, ITnInPort + { + private ITnOutPort _outPort; + + public Wheels(IVehicleContainer cockpit) + : base(cockpit) {} + + #region IRoadPortOutProvider + + IFvOutPort IRoadPortOutProvider.OutPort() + { + throw new NotImplementedException(); + } + + #endregion + + #region IInShaft + + ITnInPort IInShaft.InShaft() + { + throw new NotImplementedException(); + } + + #endregion + + #region IFvOutPort + + IResponse IFvOutPort.Request(TimeSpan absTime, TimeSpan dt, Newton force, MeterPerSecond velocity) + { + throw new NotImplementedException(); + } + + #endregion + + #region ITnInPort + + void ITnInPort.Connect(ITnOutPort other) + { + _outPort = other; + } + + #endregion + + #region VectoSimulationComponent + + public override void CommitSimulationStep(IModalDataWriter writer) + { + throw new NotImplementedException(); + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs b/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs index 750051fdd9c1deeb840e79d6488a8624fed18dc9..65acf8428deac58410ac21887d05d09475c0e3da 100644 --- a/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs +++ b/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs @@ -6,19 +6,32 @@ using TUGraz.VectoCore.Models.Simulation.Data; namespace TUGraz.VectoCore.Models.SimulationComponent { - public abstract class VectoSimulationComponent - { - [NonSerialized] protected ICockpit Cockpit; - [NonSerialized] protected ILog Log; + /// <summary> + /// Base class for all vecto simulation components. + /// </summary> + public abstract class VectoSimulationComponent + { + [NonSerialized] protected ICockpit Cockpit; + [NonSerialized] protected ILog Log; - protected VectoSimulationComponent(IVehicleContainer cockpit) - { - Cockpit = cockpit; - Log = LogManager.GetLogger(GetType()); + /// <summary> + /// Constructor. Registers the component in the cockpit. + /// </summary> + /// <param name="cockpit">The vehicle container</param> + protected VectoSimulationComponent(IVehicleContainer cockpit) + { + Cockpit = cockpit; + Log = LogManager.GetLogger(GetType()); - cockpit.AddComponent(this); - } + cockpit.AddComponent(this); + } - public abstract void CommitSimulationStep(IModalDataWriter writer); - } + /// <summary> + /// Commits the simulation step. + /// Writes the moddata into the data writer. + /// Commits the internal state of the object if needed. + /// </summary> + /// <param name="writer">a data writer to write the data into.</param> + public abstract void CommitSimulationStep(IModalDataWriter writer); + } } \ No newline at end of file diff --git a/VectoCore/Utils/SI.cs b/VectoCore/Utils/SI.cs index 1e1617ae7eee9408382b3473a33d6f0b3b8a0bdb..6e4cd52ffd653ed481e65f1ce06ad2e02ca0c48b 100644 --- a/VectoCore/Utils/SI.cs +++ b/VectoCore/Utils/SI.cs @@ -8,560 +8,580 @@ using TUGraz.VectoCore.Exceptions; namespace TUGraz.VectoCore.Utils { - public class MeterPerSecond : SI - { - public MeterPerSecond(double val = 0) : base(val, new SI().Meter.Per.Second) {} - } - - public class Second : SI - { - public Second(double val = 0) : base(val, new SI().Second) {} - } - - public class Watt : SI - { - public Watt(double val = 0) : base(val, new SI().Watt) {} - } - - public class RadianPerSecond : SI - { - public RadianPerSecond(double val = 0) : base(val, new SI().Radian.Per.Second) {} - } - - public class RoundsPerMinute : SI - { - public RoundsPerMinute(double val = 0) : base(val, new SI().Rounds.Per.Minute) {} - } - - public class NewtonMeter : SI - { - public NewtonMeter(double val = 0) : base(val, new SI().Newton.Meter) {} - } - - [DataContract] - public class SI - { - [DataMember] protected readonly string[] Denominator; - [DataMember] protected readonly int Exponent; - [DataMember] protected readonly string[] Numerator; - [DataMember] protected readonly bool Reciproc; - [DataMember] protected readonly bool Reverse; - [DataMember] protected readonly double Val; - - public SI(double val = 0.0) - { - Val = val; - Reciproc = false; - Reverse = false; - Numerator = new string[0]; - Denominator = new string[0]; - Exponent = 1; - } - - protected SI(double val, IEnumerable<string> numerator, IEnumerable<string> denominator, bool reciproc = false, - bool reverse = false, int exponent = 1) - { - Contract.Requires(numerator != null); - Contract.Requires(denominator != null); - - Val = val; - Reciproc = reciproc; - Reverse = reverse; - Exponent = exponent; - - var tmpNumerator = numerator.ToList(); - var tmpDenominator = denominator.ToList(); - - foreach (var v in tmpDenominator.ToArray().Where(v => tmpNumerator.Contains(v))) { - tmpNumerator.Remove(v); - tmpDenominator.Remove(v); - } - - Numerator = tmpNumerator.ToArray(); - Denominator = tmpDenominator.ToArray(); - } - - protected SI(double val, SI unit) - : this(val, unit.Numerator, unit.Denominator) {} - - protected SI(SI si, double? factor = null, string fromUnit = null, string toUnit = null, - bool? reciproc = null, bool? reverse = null, int? exponent = null) - { - Contract.Requires(si != null); - Contract.Requires(si.Denominator != null); - Contract.Requires(si.Numerator != null); - - var numerator = si.Denominator.ToList(); - var denominator = si.Numerator.ToList(); - - Val = si.Val; - Reciproc = reciproc ?? si.Reciproc; - Reverse = reverse ?? si.Reverse; - Exponent = exponent ?? si.Exponent; - - if (Reverse) { - var tmp = fromUnit; - fromUnit = toUnit; - toUnit = tmp; - factor = 1 / factor; - } - - for (var i = 0; i < Exponent; i++) { - if (!Reciproc) { - UpdateUnit(fromUnit, toUnit, denominator); - if (factor.HasValue) { - Val *= factor.Value; - } - } else { - UpdateUnit(fromUnit, toUnit, numerator); - if (factor.HasValue) { - Val /= factor.Value; - } - } - } - - foreach (var v in numerator.ToArray().Where(v => denominator.Contains(v))) { - denominator.Remove(v); - numerator.Remove(v); - } - - Numerator = denominator.ToArray(); - Denominator = numerator.ToArray(); - } - - private void UpdateUnit(string fromUnit, string toUnit, ICollection<string> units) - { - if (Reverse && !string.IsNullOrEmpty(fromUnit)) { - if (units.Contains(fromUnit)) { - units.Remove(fromUnit); - } else { - throw new VectoException("Unit missing. Conversion not possible."); - } - } - - if (!string.IsNullOrEmpty(toUnit)) { - units.Add(toUnit); - } - } - - /// <summary> - /// Convert an SI unit into another SI unit, defined by term following after the To(). - /// </summary> - /// <returns></returns> - public SI To() - { - return new SI(Linear, reciproc: false, reverse: true); - } - - public T To<T>() where T : SI - { - var t = (T) Activator.CreateInstance(typeof (T), Val); - Contract.Assert(HasEqualUnit(t), string.Format("SI Unit Conversion failed: From {0} to {1}", this, t)); - return t; - } - - public SI ToBasicUnits() - { - var numerator = new List<string>(); - var denominator = new List<string>(); - Numerator.ToList().ForEach(unit => ConvertToBasicUnits(unit, numerator, denominator)); - Denominator.ToList().ForEach(unit => ConvertToBasicUnits(unit, denominator, numerator)); - return new SI(Val, numerator, denominator); - } - - private static void ConvertToBasicUnits(string unit, ICollection<string> numerator, ICollection<string> denominator) - { - switch (unit) { - case "W": - numerator.Add("k"); - numerator.Add("g"); - numerator.Add("m"); - numerator.Add("m"); - denominator.Add("s"); - denominator.Add("s"); - denominator.Add("s"); - break; - case "N": - numerator.Add("k"); - numerator.Add("g"); - numerator.Add("m"); - denominator.Add("s"); - denominator.Add("s"); - break; - default: - numerator.Add(unit); - break; - } - } - - /// <summary> - /// Gets the basic scalar value. - /// </summary> - protected double ScalarValue() - { - return Val; - } - - public SI Value() - { - return new SI(Val, Numerator, Denominator); - } - - public SI Abs() - { - return new SI(Math.Abs(Val), this); - } - - #region Unit Definitions - - /// <summary> - /// Defines the denominator by the terms following after the Per. - /// </summary> - [DebuggerHidden] - public SI Per - { - get { return new SI(Linear, reciproc: !Reciproc); } - } - - /// <summary> - /// Takes all following terms as cubic terms (=to the power of 3). - /// </summary> - [DebuggerHidden] - public SI Cubic - { - get { return new SI(this, exponent: 3); } - } - - /// <summary> - /// Takes all following terms as quadratic terms (=to the power of 2). - /// </summary> - [DebuggerHidden] - public SI Square - { - get { return new SI(this, exponent: 2); } - } - - /// <summary> - /// Takes all following terms as linear terms (=to the power of 1). - /// </summary> - [DebuggerHidden] - public SI Linear - { - get { return new SI(this, exponent: 1); } - } - - /// <summary> - /// [g] (to basic unit: [kg]) - /// </summary> - [DebuggerHidden] - public SI Gramm - { - get { return new SI(new SI(this, toUnit: "k"), 0.001, "g", "g"); } - } - - /// <summary> - /// [N] - /// </summary> - [DebuggerHidden] - public SI Newton - { - get { return new SI(this, fromUnit: "N", toUnit: "N"); } - } - - /// <summary> - /// [W] - /// </summary> - [DebuggerHidden] - public SI Watt - { - get { return new SI(this, fromUnit: "W", toUnit: "W"); } - } - - /// <summary> - /// [m] - /// </summary> - [DebuggerHidden] - public SI Meter - { - get { return new SI(this, fromUnit: "m", toUnit: "m"); } - } - - /// <summary> - /// [s] - /// </summary> - [DebuggerHidden] - public SI Second - { - get { return new SI(this, fromUnit: "s", toUnit: "s"); } - } - - /// <summary> - /// [rad] - /// </summary> - [DebuggerHidden] - public SI Radian - { - get { return new SI(this, fromUnit: "rad", toUnit: "rad"); } - } - - /// <summary> - /// Converts to/from Radiant - /// </summary> - [DebuggerHidden] - public SI Rounds - { - get { return new SI(this, 2 * Math.PI, toUnit: "rad"); } - } - - /// <summary> - /// Converts to/from Second - /// </summary> - [DebuggerHidden] - public SI Hour - { - get { return new SI(this, 3600.0, "h", "s"); } - } - - /// <summary> - /// Converts to/from Second - /// </summary> - [DebuggerHidden] - public SI Minute - { - get { return new SI(this, 60.0, "min", "s"); } - } - - /// <summary> - /// Converts to/from 1000 * Basic Unit - /// </summary> - [DebuggerHidden] - public SI Kilo - { - get { return new SI(this, 1000.0, "k"); } - } - - /// <summary> - /// Converts to/from Basic Unit / 100 - /// </summary> - [DebuggerHidden] - public SI Centi - { - get { return new SI(this, 1.0 / 100.0, "c"); } - } - - #endregion - - #region Operators - - public static SI operator +(SI si1, SI si2) - { - Contract.Requires(si1.HasEqualUnit(si2)); - - return new SI(si1.Val + si2.Val, si1.Numerator, si1.Denominator); - } - - public static SI operator -(SI si1, SI si2) - { - Contract.Requires(si1.HasEqualUnit(si2)); - - return new SI(si1.Val - si2.Val, si1.Numerator, si1.Denominator); - } - - public static SI operator *(SI si1, SI si2) - { - var numerator = si1.Numerator.Concat(si2.Numerator).Where(d => d != "rad"); - var denominator = si1.Denominator.Concat(si2.Denominator).Where(d => d != "rad"); - return new SI(si1.Val * si2.Val, numerator, denominator); - } - - public static SI operator /(SI si1, SI si2) - { - var numerator = si1.Numerator.Concat(si2.Denominator).Where(d => d != "rad"); - var denominator = si1.Denominator.Concat(si2.Numerator).Where(d => d != "rad"); - return new SI(si1.Val / si2.Val, numerator, denominator); - } - - public static SI operator +(SI si1, double d) - { - return new SI(si1.Val + d, si1); - } - - public static SI operator -(SI si1, double d) - { - return new SI(si1.Val - d, si1); - } - - public static SI operator *(SI si1, double d) - { - return new SI(si1.Val * d, si1); - } - - public static SI operator *(double d, SI si1) - { - return new SI(d * si1.Val, si1); - } - - public static SI operator /(SI si1, double d) - { - return new SI(si1.Val / d, si1); - } - - public static SI operator /(double d, SI si1) - { - return new SI(d / si1.Val, si1); - } - - public static bool operator <(SI si1, SI si2) - { - Contract.Requires(si1.HasEqualUnit(si2)); - return si1.Val < si2.Val; - } - - public static bool operator >(SI si1, SI si2) - { - Contract.Requires(si1.HasEqualUnit(si2)); - return si1.Val > si2.Val; - } - - public static bool operator <=(SI si1, SI si2) - { - Contract.Requires(si1.HasEqualUnit(si2)); - return si1.Val <= si2.Val; - } - - public static bool operator >=(SI si1, SI si2) - { - Contract.Requires(si1.HasEqualUnit(si2)); - return si1.Val >= si2.Val; - } - - public static bool operator <(SI si1, double d) - { - return si1.Val < d; - } - - public static bool operator >(SI si1, double d) - { - return si1.Val > d; - } - - public static bool operator <=(SI si1, double d) - { - return si1.Val <= d; - } - - public static bool operator >=(SI si1, double d) - { - return si1.Val >= d; - } - - #endregion - - #region Double Conversion - - /// <summary> - /// Casts an SI Unit to an double. - /// </summary> - /// <param name="si"></param> - /// <returns></returns> - public static explicit operator double(SI si) - { - return si.Val; - } - - /// <summary> - /// Casts a double to an SI Unit. - /// </summary> - /// <param name="d"></param> - /// <returns></returns> - public static explicit operator SI(double d) - { - return new SI(d); - } - - #endregion - - #region ToString - - /// <summary> - /// Returns the Unit Part of the SI Unit Expression. - /// </summary> - private string GetUnitString() - { - if (Denominator.Any()) { - if (Numerator.Any()) { - return string.Format("{0}/{1}", string.Join("", Numerator), string.Join("", Denominator)); - } else { - return string.Format("1/{0}", string.Join("", Denominator)); - } - } - - if (Numerator.Any()) { - return string.Format("{0}", string.Join("", Numerator)); - } - - return "-"; - } - - /// <summary> - /// Returns the String representation. - /// </summary> - public override string ToString() - { - return string.Format("{0} [{1}]", Val, GetUnitString()); - } - - #endregion - - #region Equality members - - /// <summary> - /// Compares the Unit-Parts of two SI Units. - /// </summary> - [Pure] - public bool HasEqualUnit(SI si) - { - return ToBasicUnits().Denominator.OrderBy(x => x).SequenceEqual(si.ToBasicUnits().Denominator.OrderBy(x => x)) - && ToBasicUnits().Numerator.OrderBy(x => x).SequenceEqual(si.ToBasicUnits().Numerator.OrderBy(x => x)); - } - - protected bool Equals(SI other) - { - return Val.Equals(other.Val) && HasEqualUnit(other); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) { - return false; - } - if (ReferenceEquals(this, obj)) { - return true; - } - var other = obj as SI; - return other != null && Equals(other); - } - - public override int GetHashCode() - { - unchecked { - var hashCode = Val.GetHashCode(); - hashCode = (hashCode * 397) ^ (Numerator != null ? Numerator.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (Denominator != null ? Denominator.GetHashCode() : 0); - return hashCode; - } - } - - public static bool operator ==(SI left, SI right) - { - return Equals(left, right); - } - - public static bool operator !=(SI left, SI right) - { - return !Equals(left, right); - } - - #endregion - } + public class MeterPerSecond : SI + { + public MeterPerSecond(double val = 0) : base(val, new SI().Meter.Per.Second) {} + } + + public class Radian : SI + { + public Radian(double val = 0) : base(val, new SI().Radian) {} + } + + public class Second : SI + { + public Second(double val = 0) : base(val, new SI().Second) {} + } + + public class Watt : SI + { + public Watt(double val = 0) : base(val, new SI().Watt) {} + } + + public class RadianPerSecond : SI + { + public RadianPerSecond(double val = 0) : base(val, new SI().Radian.Per.Second) {} + } + + public class RoundsPerMinute : SI + { + public RoundsPerMinute(double val = 0) : base(val, new SI().Rounds.Per.Minute) {} + } + + public class NewtonMeter : SI + { + public NewtonMeter(double val = 0) : base(val, new SI().Newton.Meter) {} + } + + public class Newton : SI + { + public Newton(double val = 0) : base(val, new SI().Newton) {} + } + + + [DataContract] + public class SI + { + [DataMember] protected readonly string[] Denominator; + [DataMember] protected readonly int Exponent; + [DataMember] protected readonly string[] Numerator; + [DataMember] protected readonly bool Reciproc; + [DataMember] protected readonly bool Reverse; + [DataMember] protected readonly double Val; + + public SI(double val = 0.0) + { + Val = val; + Reciproc = false; + Reverse = false; + Numerator = new string[0]; + Denominator = new string[0]; + Exponent = 1; + } + + protected SI(double val, IEnumerable<string> numerator, IEnumerable<string> denominator, bool reciproc = false, + bool reverse = false, int exponent = 1) + { + Contract.Requires(numerator != null); + Contract.Requires(denominator != null); + + Val = val; + Reciproc = reciproc; + Reverse = reverse; + Exponent = exponent; + + var tmpNumerator = numerator.ToList(); + var tmpDenominator = denominator.ToList(); + + foreach (var v in tmpDenominator.ToArray().Where(v => tmpNumerator.Contains(v))) { + tmpNumerator.Remove(v); + tmpDenominator.Remove(v); + } + + Numerator = tmpNumerator.ToArray(); + Denominator = tmpDenominator.ToArray(); + } + + protected SI(double val, SI unit) + : this(val, unit.Numerator, unit.Denominator) {} + + protected SI(SI si, double? factor = null, string fromUnit = null, string toUnit = null, + bool? reciproc = null, bool? reverse = null, int? exponent = null) + { + Contract.Requires(si != null); + Contract.Requires(si.Denominator != null); + Contract.Requires(si.Numerator != null); + + var numerator = si.Denominator.ToList(); + var denominator = si.Numerator.ToList(); + + Val = si.Val; + Reciproc = reciproc ?? si.Reciproc; + Reverse = reverse ?? si.Reverse; + Exponent = exponent ?? si.Exponent; + + if (Reverse) { + var tmp = fromUnit; + fromUnit = toUnit; + toUnit = tmp; + factor = 1 / factor; + } + + for (var i = 0; i < Exponent; i++) { + if (!Reciproc) { + UpdateUnit(fromUnit, toUnit, denominator); + if (factor.HasValue) { + Val *= factor.Value; + } + } else { + UpdateUnit(fromUnit, toUnit, numerator); + if (factor.HasValue) { + Val /= factor.Value; + } + } + } + + foreach (var v in numerator.ToArray().Where(v => denominator.Contains(v))) { + denominator.Remove(v); + numerator.Remove(v); + } + + Numerator = denominator.ToArray(); + Denominator = numerator.ToArray(); + } + + private void UpdateUnit(string fromUnit, string toUnit, ICollection<string> units) + { + if (Reverse && !string.IsNullOrEmpty(fromUnit)) { + if (units.Contains(fromUnit)) { + units.Remove(fromUnit); + } else { + throw new VectoException("Unit missing. Conversion not possible."); + } + } + + if (!string.IsNullOrEmpty(toUnit)) { + units.Add(toUnit); + } + } + + /// <summary> + /// Convert an SI unit into another SI unit, defined by term following after the To(). + /// </summary> + /// <returns></returns> + public SI To() + { + return new SI(Linear, reciproc: false, reverse: true); + } + + public T To<T>() where T : SI + { + var t = (T) Activator.CreateInstance(typeof (T), Val); + Contract.Assert(HasEqualUnit(t), string.Format("SI Unit Conversion failed: From {0} to {1}", this, t)); + return t; + } + + public SI ToBasicUnits() + { + var numerator = new List<string>(); + var denominator = new List<string>(); + Numerator.ToList().ForEach(unit => ConvertToBasicUnits(unit, numerator, denominator)); + Denominator.ToList().ForEach(unit => ConvertToBasicUnits(unit, denominator, numerator)); + return new SI(Val, numerator, denominator); + } + + private static void ConvertToBasicUnits(string unit, ICollection<string> numerator, + ICollection<string> denominator) + { + switch (unit) { + case "W": + numerator.Add("k"); + numerator.Add("g"); + numerator.Add("m"); + numerator.Add("m"); + denominator.Add("s"); + denominator.Add("s"); + denominator.Add("s"); + break; + case "N": + numerator.Add("k"); + numerator.Add("g"); + numerator.Add("m"); + denominator.Add("s"); + denominator.Add("s"); + break; + default: + numerator.Add(unit); + break; + } + } + + /// <summary> + /// Gets the basic scalar value. + /// </summary> + protected double ScalarValue() + { + return Val; + } + + public SI Value() + { + return new SI(Val, Numerator, Denominator); + } + + public SI Abs() + { + return new SI(Math.Abs(Val), this); + } + + #region Unit Definitions + + /// <summary> + /// Defines the denominator by the terms following after the Per. + /// </summary> + [DebuggerHidden] + public SI Per + { + get { return new SI(Linear, reciproc: !Reciproc); } + } + + /// <summary> + /// Takes all following terms as cubic terms (=to the power of 3). + /// </summary> + [DebuggerHidden] + public SI Cubic + { + get { return new SI(this, exponent: 3); } + } + + /// <summary> + /// Takes all following terms as quadratic terms (=to the power of 2). + /// </summary> + [DebuggerHidden] + public SI Square + { + get { return new SI(this, exponent: 2); } + } + + /// <summary> + /// Takes all following terms as linear terms (=to the power of 1). + /// </summary> + [DebuggerHidden] + public SI Linear + { + get { return new SI(this, exponent: 1); } + } + + /// <summary> + /// [g] (to basic unit: [kg]) + /// </summary> + [DebuggerHidden] + public SI Gramm + { + get { return new SI(new SI(this, toUnit: "k"), 0.001, "g", "g"); } + } + + /// <summary> + /// [N] + /// </summary> + [DebuggerHidden] + public SI Newton + { + get { return new SI(this, fromUnit: "N", toUnit: "N"); } + } + + /// <summary> + /// [W] + /// </summary> + [DebuggerHidden] + public SI Watt + { + get { return new SI(this, fromUnit: "W", toUnit: "W"); } + } + + /// <summary> + /// [m] + /// </summary> + [DebuggerHidden] + public SI Meter + { + get { return new SI(this, fromUnit: "m", toUnit: "m"); } + } + + /// <summary> + /// [s] + /// </summary> + [DebuggerHidden] + public SI Second + { + get { return new SI(this, fromUnit: "s", toUnit: "s"); } + } + + /// <summary> + /// [rad] + /// </summary> + [DebuggerHidden] + public SI Radian + { + get { return new SI(this, fromUnit: "rad", toUnit: "rad"); } + } + + public SI GradientPercent + { + get { return new SI(this, factor: Math.Atan(Val) / Val, fromUnit: "%", toUnit: "rad"); } + } + + /// <summary> + /// Converts to/from Radiant + /// </summary> + [DebuggerHidden] + public SI Rounds + { + get { return new SI(this, 2 * Math.PI, toUnit: "rad"); } + } + + /// <summary> + /// Converts to/from Second + /// </summary> + [DebuggerHidden] + public SI Hour + { + get { return new SI(this, 3600.0, "h", "s"); } + } + + /// <summary> + /// Converts to/from Second + /// </summary> + [DebuggerHidden] + public SI Minute + { + get { return new SI(this, 60.0, "min", "s"); } + } + + /// <summary> + /// Converts to/from 1000 * Basic Unit + /// </summary> + [DebuggerHidden] + public SI Kilo + { + get { return new SI(this, 1000.0, "k"); } + } + + /// <summary> + /// Converts to/from Basic Unit / 100 + /// </summary> + [DebuggerHidden] + public SI Centi + { + get { return new SI(this, 1.0 / 100.0, "c"); } + } + + #endregion + + #region Operators + + public static SI operator +(SI si1, SI si2) + { + Contract.Requires(si1.HasEqualUnit(si2)); + + return new SI(si1.Val + si2.Val, si1.Numerator, si1.Denominator); + } + + public static SI operator -(SI si1, SI si2) + { + Contract.Requires(si1.HasEqualUnit(si2)); + + return new SI(si1.Val - si2.Val, si1.Numerator, si1.Denominator); + } + + public static SI operator *(SI si1, SI si2) + { + var numerator = si1.Numerator.Concat(si2.Numerator).Where(d => d != "rad"); + var denominator = si1.Denominator.Concat(si2.Denominator).Where(d => d != "rad"); + return new SI(si1.Val * si2.Val, numerator, denominator); + } + + public static SI operator /(SI si1, SI si2) + { + var numerator = si1.Numerator.Concat(si2.Denominator).Where(d => d != "rad"); + var denominator = si1.Denominator.Concat(si2.Numerator).Where(d => d != "rad"); + return new SI(si1.Val / si2.Val, numerator, denominator); + } + + public static SI operator +(SI si1, double d) + { + return new SI(si1.Val + d, si1); + } + + public static SI operator -(SI si1, double d) + { + return new SI(si1.Val - d, si1); + } + + public static SI operator *(SI si1, double d) + { + return new SI(si1.Val * d, si1); + } + + public static SI operator *(double d, SI si1) + { + return new SI(d * si1.Val, si1); + } + + public static SI operator /(SI si1, double d) + { + return new SI(si1.Val / d, si1); + } + + public static SI operator /(double d, SI si1) + { + return new SI(d / si1.Val, si1); + } + + public static bool operator <(SI si1, SI si2) + { + Contract.Requires(si1.HasEqualUnit(si2)); + return si1.Val < si2.Val; + } + + public static bool operator >(SI si1, SI si2) + { + Contract.Requires(si1.HasEqualUnit(si2)); + return si1.Val > si2.Val; + } + + public static bool operator <=(SI si1, SI si2) + { + Contract.Requires(si1.HasEqualUnit(si2)); + return si1.Val <= si2.Val; + } + + public static bool operator >=(SI si1, SI si2) + { + Contract.Requires(si1.HasEqualUnit(si2)); + return si1.Val >= si2.Val; + } + + public static bool operator <(SI si1, double d) + { + return si1.Val < d; + } + + public static bool operator >(SI si1, double d) + { + return si1.Val > d; + } + + public static bool operator <=(SI si1, double d) + { + return si1.Val <= d; + } + + public static bool operator >=(SI si1, double d) + { + return si1.Val >= d; + } + + #endregion + + #region Double Conversion + + /// <summary> + /// Casts an SI Unit to an double. + /// </summary> + /// <param name="si"></param> + /// <returns></returns> + public static explicit operator double(SI si) + { + return si.Val; + } + + /// <summary> + /// Casts a double to an SI Unit. + /// </summary> + /// <param name="d"></param> + /// <returns></returns> + public static explicit operator SI(double d) + { + return new SI(d); + } + + #endregion + + #region ToString + + /// <summary> + /// Returns the Unit Part of the SI Unit Expression. + /// </summary> + private string GetUnitString() + { + if (Denominator.Any()) { + if (Numerator.Any()) { + return string.Format("{0}/{1}", string.Join("", Numerator), string.Join("", Denominator)); + } else { + return string.Format("1/{0}", string.Join("", Denominator)); + } + } + + if (Numerator.Any()) { + return string.Format("{0}", string.Join("", Numerator)); + } + + return "-"; + } + + /// <summary> + /// Returns the String representation. + /// </summary> + public override string ToString() + { + return string.Format("{0} [{1}]", Val, GetUnitString()); + } + + #endregion + + #region Equality members + + /// <summary> + /// Compares the Unit-Parts of two SI Units. + /// </summary> + [Pure] + public bool HasEqualUnit(SI si) + { + return ToBasicUnits() + .Denominator.OrderBy(x => x) + .SequenceEqual(si.ToBasicUnits().Denominator.OrderBy(x => x)) + && + ToBasicUnits().Numerator.OrderBy(x => x).SequenceEqual(si.ToBasicUnits().Numerator.OrderBy(x => x)); + } + + protected bool Equals(SI other) + { + return Val.Equals(other.Val) && HasEqualUnit(other); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { + return false; + } + if (ReferenceEquals(this, obj)) { + return true; + } + var other = obj as SI; + return other != null && Equals(other); + } + + public override int GetHashCode() + { + unchecked { + var hashCode = Val.GetHashCode(); + hashCode = (hashCode * 397) ^ (Numerator != null ? Numerator.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (Denominator != null ? Denominator.GetHashCode() : 0); + return hashCode; + } + } + + public static bool operator ==(SI left, SI right) + { + return Equals(left, right); + } + + public static bool operator !=(SI left, SI right) + { + return !Equals(left, right); + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/Utils/VectoCSVFile.cs b/VectoCore/Utils/VectoCSVFile.cs index b17f6b5b9aa88e25a0fa4e995e108c44a35a2103..a8e47b1f94d033b20763e570390144882906d2a8 100644 --- a/VectoCore/Utils/VectoCSVFile.cs +++ b/VectoCore/Utils/VectoCSVFile.cs @@ -12,124 +12,126 @@ using TUGraz.VectoCore.Exceptions; namespace TUGraz.VectoCore.Utils { - /// <summary> - /// Class for Reading and Writing VECTO CSV Files. - /// </summary> - /// <remarks> - /// The following format applies to all CSV (Comma-separated values) Input Files used in VECTO: - /// List Separator: Comma "," - /// Decimal-Mark: Dot "." - /// Comments: "#" at the beginning of the comment line. Number and position of comment lines is not limited. - /// Header: One header line (not a comment line) at the beginning of the file. - /// All Combinations between max-format and min-format possible. Only "id"-field is used. - /// max: id (name) [unit], id (name) [unit], ... - /// min: id,id,... - /// </remarks> - public static class VectoCSVFile - { - private const char Separator = ','; - private const char Comment = '#'; - - /// <summary> - /// Reads a CSV file which is stored in Vecto-CSV-Format. - /// </summary> - /// <param name="fileName"></param> - /// <exception cref="FileIOException"></exception> - /// <returns>A DataTable which represents the CSV File.</returns> - public static DataTable Read(string fileName) - { - try { - var lines = File.ReadAllLines(fileName); - lines = RemoveComments(lines); - - var validColumns = GetValidHeaderColumns(lines.First()); - - if (validColumns.Length > 0) { - // Valid Columns found => header was valid => skip header line - lines = lines.Skip(1).ToArray(); - } else { - var log = LogManager.GetLogger(typeof (VectoCSVFile)); - log.Warn("No valid Data Header found. Interpreting the first line as data line."); - // set the validColumns to: {"0", "1", "2", "3", ...} for all columns in first line. - validColumns = GetColumns(lines.First()).Select((_, index) => index.ToString()).ToArray(); - } - - var table = new DataTable(); - foreach (var col in validColumns) { - table.Columns.Add(col); - } - - for (var i = 0; i < lines.Length; i++) { - var line = lines[i]; - - var cells = line.Split(Separator); - if (cells.Length != table.Columns.Count) { - throw new CSVReadException(string.Format("Line {0}: The number of values is not correct.", i)); - } - - try { - table.Rows.Add(line.Split(Separator)); - } catch (InvalidCastException e) { - throw new CSVReadException( - string.Format("Line {0}: The data format of a value is not correct. {1}", i, e.Message), e); - } - } - - return table; - } catch (Exception e) { - throw new VectoException(string.Format("File {0}: {1}", fileName, e.Message)); - } - } - - private static string[] GetValidHeaderColumns(string line) - { - Contract.Requires(line != null); - double test; - var validColumns = GetColumns(line). - Where(col => !double.TryParse(col, NumberStyles.Any, CultureInfo.InvariantCulture, out test)); - return validColumns.ToArray(); - } - - private static IEnumerable<string> GetColumns(string line) - { - Contract.Requires(line != null); - - line = Regex.Replace(line, @"\[.*?\]", ""); - line = Regex.Replace(line, @"\(.*?\)", ""); - line = line.Replace("<", ""); - line = line.Replace(">", ""); - return line.Split(Separator).Select(col => col.Trim()); - } - - private static string[] RemoveComments(string[] lines) - { - Contract.Requires(lines != null); - - lines = lines. - Select(line => line.Contains('#') ? line.Substring(0, line.IndexOf(Comment)) : line). - Where(line => !string.IsNullOrEmpty(line)). - ToArray(); - return lines; - } - - public static void Write(string fileName, DataTable table) - { - var sb = new StringBuilder(); - - var header = table.Columns.Cast<DataColumn>().Select(col => col.Caption ?? col.ColumnName); - sb.AppendLine(string.Join(", ", header)); - - foreach (DataRow row in table.Rows) { - var formattedList = new List<string>(); - foreach (var item in row.ItemArray) { - var formattable = item as IFormattable; - var formattedValue = formattable != null ? formattable.ToString("", CultureInfo.InvariantCulture) : item.ToString(); - formattedList.Add(formattedValue); - } - sb.AppendLine(string.Join(Separator.ToString(), formattedList)); - } - - File.WriteAllText(fileName, sb.ToString()); - } - } + /// <summary> + /// Class for Reading and Writing VECTO CSV Files. + /// </summary> + /// <remarks> + /// The following format applies to all CSV (Comma-separated values) Input Files used in VECTO: + /// List Separator: Comma "," + /// Decimal-Mark: Dot "." + /// Comments: "#" at the beginning of the comment line. Number and position of comment lines is not limited. + /// Header: One header line (not a comment line) at the beginning of the file. + /// All Combinations between max-format and min-format possible. Only "id"-field is used. + /// max: id (name) [unit], id (name) [unit], ... + /// min: id,id,... + /// </remarks> + public static class VectoCSVFile + { + private const char Separator = ','; + private const char Comment = '#'; + + /// <summary> + /// Reads a CSV file which is stored in Vecto-CSV-Format. + /// </summary> + /// <param name="fileName"></param> + /// <exception cref="FileIOException"></exception> + /// <returns>A DataTable which represents the CSV File.</returns> + public static DataTable Read(string fileName) + { + try { + var lines = File.ReadAllLines(fileName); + lines = RemoveComments(lines); + + var validColumns = GetValidHeaderColumns(lines.First()); + + if (validColumns.Length > 0) { + // Valid Columns found => header was valid => skip header line + lines = lines.Skip(1).ToArray(); + } else { + var log = LogManager.GetLogger(typeof (VectoCSVFile)); + log.Warn("No valid Data Header found. Interpreting the first line as data line."); + // set the validColumns to: {"0", "1", "2", "3", ...} for all columns in first line. + validColumns = GetColumns(lines.First()).Select((_, index) => index.ToString()).ToArray(); + } + + var table = new DataTable(); + foreach (var col in validColumns) { + table.Columns.Add(col); + } + + for (var i = 0; i < lines.Length; i++) { + var line = lines[i]; + + var cells = line.Split(Separator); + if (cells.Length != table.Columns.Count) { + throw new CSVReadException(string.Format("Line {0}: The number of values is not correct.", i)); + } + + try { + table.Rows.Add(line.Split(Separator)); + } catch (InvalidCastException e) { + throw new CSVReadException( + string.Format("Line {0}: The data format of a value is not correct. {1}", i, e.Message), e); + } + } + + return table; + } catch (Exception e) { + throw new VectoException(string.Format("File {0}: {1}", fileName, e.Message)); + } + } + + private static string[] GetValidHeaderColumns(string line) + { + Contract.Requires(line != null); + double test; + var validColumns = GetColumns(line). + Where(col => !double.TryParse(col, NumberStyles.Any, CultureInfo.InvariantCulture, out test)); + return validColumns.ToArray(); + } + + private static IEnumerable<string> GetColumns(string line) + { + Contract.Requires(line != null); + + line = Regex.Replace(line, @"\[.*?\]", ""); + line = Regex.Replace(line, @"\(.*?\)", ""); + line = line.Replace("<", ""); + line = line.Replace(">", ""); + return line.Split(Separator).Select(col => col.Trim()); + } + + private static string[] RemoveComments(string[] lines) + { + Contract.Requires(lines != null); + + lines = lines. + Select(line => line.Contains('#') ? line.Substring(0, line.IndexOf(Comment)) : line). + Where(line => !string.IsNullOrEmpty(line)). + ToArray(); + return lines; + } + + public static void Write(string fileName, DataTable table) + { + var sb = new StringBuilder(); + + var header = table.Columns.Cast<DataColumn>().Select(col => col.Caption ?? col.ColumnName); + sb.AppendLine(string.Join(", ", header)); + + foreach (DataRow row in table.Rows) { + var formattedList = new List<string>(); + foreach (var item in row.ItemArray) { + var formattable = item as IFormattable; + var formattedValue = formattable != null + ? formattable.ToString("", CultureInfo.InvariantCulture) + : item.ToString(); + formattedList.Add(formattedValue); + } + sb.AppendLine(string.Join(Separator.ToString(), formattedList)); + } + + File.WriteAllText(fileName, sb.ToString()); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore.csproj b/VectoCore/VectoCore.csproj index ab58902dc33a6e64fce8093cd2278ff8bad1c202..6ec8778bcf767c81e8dae10618b9c49dd96d9b09 100644 --- a/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore.csproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> @@ -108,34 +108,30 @@ <ItemGroup> <Compile Include="Exceptions\VectoExceptions.cs" /> <Compile Include="Exceptions\VectoSimulationException.cs" /> - <Compile Include="Models\Connector\Connector.cs" /> - <Compile Include="Models\Connector\Ports\IDriverDemandInPort.cs" /> - <Compile Include="Models\Connector\Ports\IDriverDemandInProvider.cs" /> - <Compile Include="Models\Connector\Ports\IInShaft.cs" /> - <Compile Include="Models\Connector\Ports\IDriverDemandOutPort.cs" /> - <Compile Include="Models\Connector\Ports\IDriverDemandOutProvider.cs" /> - <Compile Include="Models\Connector\Ports\Impl\InPort.cs" /> + <Compile Include="Models\Connector\Ports\IDriverDemandPort.cs" /> + <Compile Include="Models\Connector\Ports\IDrivingCycleProvider.cs" /> + <Compile Include="Models\Connector\Ports\IDriverDemandProvider.cs" /> <Compile Include="Models\Connector\Ports\IResponse.cs" /> - <Compile Include="Models\Connector\Ports\Impl\OutPort.cs" /> - <Compile Include="Models\Connector\Ports\IOutShaft.cs" /> + <Compile Include="Models\Connector\Ports\IRoadPortProvider.cs" /> + <Compile Include="Models\Connector\Ports\IShaft.cs" /> <Compile Include="Models\Connector\Ports\Impl\Response.cs" /> - <Compile Include="Models\Connector\Ports\ITnInPort.cs" /> - <Compile Include="Models\Connector\Ports\ITnOutPort.cs" /> + <Compile Include="Models\Connector\Ports\IFvPort.cs" /> <Compile Include="Models\Connector\Ports\ITnPort.cs" /> <Compile Include="Models\SimulationComponent\Data\AuxiliariesDemandAdapter.cs" /> <Compile Include="Models\SimulationComponent\Data\CombustionEngineData.cs" /> <Compile Include="Models\SimulationComponent\Data\DrivingCycleData.cs" /> <Compile Include="Models\SimulationComponent\Data\Engine\FuelConsumptionMap.cs" /> <Compile Include="Models\SimulationComponent\Data\Engine\FullLoadCurve.cs" /> + <Compile Include="Models\SimulationComponent\IEngineOnlyDrivingCycle.cs" /> + <Compile Include="Models\SimulationComponent\IDriverDemandDrivingCycle.cs" /> <Compile Include="Utils\Formulas.cs" /> <Compile Include="Utils\IntExtensionMethods.cs" /> <Compile Include="Utils\SI.cs" /> <Compile Include="Models\SimulationComponent\Data\SimulationComponentData.cs" /> <Compile Include="Models\SimulationComponent\IAuxiliary.cs" /> <Compile Include="Models\SimulationComponent\ICombustionEngine.cs" /> - <Compile Include="Models\Connector\Ports\IInPort.cs" /> <Compile Include="Models\SimulationComponent\IGearbox.cs" /> - <Compile Include="Models\SimulationComponent\IDrivingCycle.cs" /> + <Compile Include="Models\Connector\Ports\IDrivingCyclePort.cs" /> <Compile Include="Models\SimulationComponent\Impl\DistanceBasedDrivingCycle.cs" /> <Compile Include="Models\SimulationComponent\Impl\EngineOnlyAuxiliary.cs" /> <Compile Include="Models\SimulationComponent\Impl\TimeBasedDrivingCycle.cs" /> @@ -144,7 +140,6 @@ <Compile Include="Models\SimulationComponent\Impl\EngineOnlyGearbox.cs" /> <Compile Include="Models\SimulationComponent\Impl\Gearbox.cs" /> <Compile Include="Models\SimulationComponent\Impl\Wheels.cs" /> - <Compile Include="Models\Connector\Ports\IOutPort.cs" /> <Compile Include="Models\SimulationComponent\IWheels.cs" /> <Compile Include="Utils\Memento.cs" /> <Compile Include="Models\SimulationComponent\VectoSimulationComponent.cs" /> diff --git a/VectoCoreArchitecture/ModelDefinition/VectoArchitecture.uml b/VectoCoreArchitecture/ModelDefinition/VectoArchitecture.uml index bce66016fcb9b8525a2eb80b606dc7c4eecc4a9b..9266568b1387c5af3e161cddc8ce22e4c6234520 100644 --- a/VectoCoreArchitecture/ModelDefinition/VectoArchitecture.uml +++ b/VectoCoreArchitecture/ModelDefinition/VectoArchitecture.uml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<modelStoreModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:dm1="http://schemas.microsoft.com/dsltools/Kernel" xmlns:dm2="http://schemas.microsoft.com/dsltools/Component" xmlns:dm3="http://schemas.microsoft.com/dsltools/UseCase" xmlns:dm4="http://schemas.microsoft.com/dsltools/Activity" xmlns:dm5="http://schemas.microsoft.com/dsltools/Interaction" xmlns:dm6="http://schemas.microsoft.com/dsltools/UmlModelLibrary" xmlns:dm7="http://schemas.microsoft.com/dsltools/UmlDiagrams" xmlns:dm8="http://schemas.microsoft.com/VisualStudio/TeamArchitect/SequenceDesigner" +<modelStoreModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:dm1="http://schemas.microsoft.com/dsltools/Kernel" xmlns:dm2="http://schemas.microsoft.com/dsltools/Component" xmlns:dm3="http://schemas.microsoft.com/dsltools/Activity" xmlns:dm4="http://schemas.microsoft.com/dsltools/Interaction" xmlns:dm5="http://schemas.microsoft.com/dsltools/UseCase" xmlns:dm6="http://schemas.microsoft.com/dsltools/UmlModelLibrary" xmlns:dm7="http://schemas.microsoft.com/dsltools/UmlDiagrams" xmlns:dm8="http://schemas.microsoft.com/dsltools/LogicalClassDesigner" xmlns:dm9="http://schemas.microsoft.com/VisualStudio/TeamArchitect/SequenceDesigner" dslVersion="1.0.0.0" Id="d70f4262-18df-49eb-a245-704a07d56711" name="VectoArchitecture" xmlns="http://schemas.microsoft.com/dsltools/ModelStore"> @@ -1307,22 +1307,22 @@ return OutPort.Request(...)</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="38579256-57dd-4025-8c13-36df6f512aff" - name="MessageOccurrenceSpecification240"> + Id="c1cbabd0-7ce7-4740-8251-456c87c0bd02" + name="MessageOccurrenceSpecification239"> <covered> <lifelineMoniker - Id="a31fac8f-b2d3-4dce-91c2-2b79010969e8" - LastKnownName="OutPort" + Id="48320ba0-5a08-48d7-9295-883ab984fd27" + LastKnownName="InPort" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="c1cbabd0-7ce7-4740-8251-456c87c0bd02" - name="MessageOccurrenceSpecification239"> + Id="38579256-57dd-4025-8c13-36df6f512aff" + name="MessageOccurrenceSpecification240"> <covered> <lifelineMoniker - Id="48320ba0-5a08-48d7-9295-883ab984fd27" - LastKnownName="InPort" + Id="a31fac8f-b2d3-4dce-91c2-2b79010969e8" + LastKnownName="OutPort" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -1589,22 +1589,22 @@ return OutPort.Request(...)</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="a9b966fc-80de-431c-9343-0b7861c7ca70" - name="MessageOccurrenceSpecification254"> + Id="1b832d00-ed75-4eca-9d69-45a0860074a2" + name="MessageOccurrenceSpecification253"> <covered> <lifelineMoniker - Id="ccd3a4e8-efe0-4ffc-b72b-cdd8ebd3fa3b" - LastKnownName="C2 : VectoSimulationComponent" + Id="48320ba0-5a08-48d7-9295-883ab984fd27" + LastKnownName="InPort" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="1b832d00-ed75-4eca-9d69-45a0860074a2" - name="MessageOccurrenceSpecification253"> + Id="a9b966fc-80de-431c-9343-0b7861c7ca70" + name="MessageOccurrenceSpecification254"> <covered> <lifelineMoniker - Id="48320ba0-5a08-48d7-9295-883ab984fd27" - LastKnownName="InPort" + Id="ccd3a4e8-efe0-4ffc-b72b-cdd8ebd3fa3b" + LastKnownName="C2 : VectoSimulationComponent" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -2791,7 +2791,7 @@ return OutPort.Request(...)</body> Id="a9c25587-52d9-4b03-8b23-8ae45e1b5adc"> <body>Request Failed with TimeFail: Adjust dt -Repeat Cycle 2</body> +Repeat Step 2</body> </comment> <comment Id="722f3338-2c54-4b7a-8884-8cf5dba38f2c"> @@ -2800,17 +2800,17 @@ Adjust driver demands</body> </comment> <comment Id="6db0e2e1-ec56-437e-a1ac-9c6d7fc54f0f"> - <body>Start Cycle 1</body> + <body>Start Step 1</body> </comment> <comment Id="a516f816-b8c2-41bb-bb19-140d84a49ed8"> - <body>Cycle 1 commited. -Start Cycle 2</body> + <body>Step 1 commited. +Start Step 2</body> </comment> <comment Id="aa66ccff-8d12-4a12-bf31-026e399088b0"> - <body>Cycle 2 commited. -Start Cycle 3 ...</body> + <body>Step 2 commited. +Start Step 3 ...</body> </comment> <comment Id="2abf9533-9791-414d-bb10-edcda9455296"> @@ -2884,8 +2884,8 @@ Start Cycle 3 ...</body> </comment> <comment Id="fccccb9d-bd53-4838-856d-f3324d92e257"> - <body>Commit Cycle 2 -Start Cycle 3...</body> + <body>Commit Step 2 +Start Step 3...</body> </comment> </ownedCommentsInternal> <fragments> @@ -3132,22 +3132,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="417e6cff-c640-4bf4-b049-4ec22d604875" - name="MessageOccurrenceSpecification11"> + Id="67e58904-6e2e-4250-a429-8028713a9b54" + name="MessageOccurrenceSpecification12"> <covered> <lifelineMoniker - Id="cadafa83-5906-4eb6-b560-60b9f1e4b926" - LastKnownName="Driving Cycle" + Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" + LastKnownName="Driver" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="67e58904-6e2e-4250-a429-8028713a9b54" - name="MessageOccurrenceSpecification12"> + Id="417e6cff-c640-4bf4-b049-4ec22d604875" + name="MessageOccurrenceSpecification11"> <covered> <lifelineMoniker - Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" - LastKnownName="Driver" + Id="cadafa83-5906-4eb6-b560-60b9f1e4b926" + LastKnownName="Driving Cycle" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -3728,22 +3728,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="b0d458a4-57a4-48d0-bac6-c43b24244bc7" - name="MessageOccurrenceSpecification37"> + Id="0db6c4d1-99f9-4bcf-a049-942138a8ccfb" + name="MessageOccurrenceSpecification38"> <covered> <lifelineMoniker - Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" - LastKnownName="Auxiliaries" + Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" + LastKnownName="Clutch" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="0db6c4d1-99f9-4bcf-a049-942138a8ccfb" - name="MessageOccurrenceSpecification38"> + Id="b0d458a4-57a4-48d0-bac6-c43b24244bc7" + name="MessageOccurrenceSpecification37"> <covered> <lifelineMoniker - Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" - LastKnownName="Clutch" + Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" + LastKnownName="Auxiliaries" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -4244,22 +4244,22 @@ Start Cycle 3...</body> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="8aa50cc8-8d72-48a1-891c-aab1c78495cd" - name="MessageOccurrenceSpecification53"> + Id="15c6a09f-faf1-4c12-8978-07d33269a2c2" + name="MessageOccurrenceSpecification54"> <covered> <lifelineMoniker - Id="cadafa83-5906-4eb6-b560-60b9f1e4b926" - LastKnownName="Driving Cycle" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="15c6a09f-faf1-4c12-8978-07d33269a2c2" - name="MessageOccurrenceSpecification54"> + Id="8aa50cc8-8d72-48a1-891c-aab1c78495cd" + name="MessageOccurrenceSpecification53"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="cadafa83-5906-4eb6-b560-60b9f1e4b926" + LastKnownName="Driving Cycle" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -4439,16 +4439,6 @@ Start Cycle 3...</body> LastKnownLocation="VectoArchitecture.uml" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification - Id="b2ef8d83-44af-431e-a55a-601e9a285e4a" - name="MessageOccurrenceSpecification60"> - <covered> - <lifelineMoniker - Id="97ec316f-5206-40fd-9519-15c98c5c9c35" - LastKnownName="Vehicle" - LastKnownLocation="VectoArchitecture.uml" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="0639b6b2-f50f-403e-99c2-9502c8956a04" name="MessageOccurrenceSpecification59"> @@ -4460,12 +4450,12 @@ Start Cycle 3...</body> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="bc91813d-90aa-479f-9965-02d78d0fd42d" - name="MessageOccurrenceSpecification62"> + Id="b2ef8d83-44af-431e-a55a-601e9a285e4a" + name="MessageOccurrenceSpecification60"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="97ec316f-5206-40fd-9519-15c98c5c9c35" + LastKnownName="Vehicle" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -4479,6 +4469,16 @@ Start Cycle 3...</body> LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification + Id="bc91813d-90aa-479f-9965-02d78d0fd42d" + name="MessageOccurrenceSpecification62"> + <covered> + <lifelineMoniker + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" + LastKnownLocation="VectoArchitecture.uml" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="2cffef1d-5429-4605-b42d-b470edb1da05" name="ExecutionOccurrenceSpecification32"> @@ -4656,22 +4656,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="c5bce4ec-d3b7-4ff1-ae2c-d492d88b3e43" - name="MessageOccurrenceSpecification67"> + Id="1b51a46a-42ec-479f-9c28-24f8197d5f04" + name="MessageOccurrenceSpecification68"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" + LastKnownName="Axle Gear" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="1b51a46a-42ec-479f-9c28-24f8197d5f04" - name="MessageOccurrenceSpecification68"> + Id="c5bce4ec-d3b7-4ff1-ae2c-d492d88b3e43" + name="MessageOccurrenceSpecification67"> <covered> <lifelineMoniker - Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" - LastKnownName="Axle Gear" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -4980,22 +4980,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="bc4c08f7-8e69-442e-ad27-099ac320fc97" - name="MessageOccurrenceSpecification80"> + Id="f34713c0-f5f2-4655-84bd-528358cf726c" + name="MessageOccurrenceSpecification79"> <covered> <lifelineMoniker - Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" - LastKnownName="Auxiliaries" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="f34713c0-f5f2-4655-84bd-528358cf726c" - name="MessageOccurrenceSpecification79"> + Id="bc4c08f7-8e69-442e-ad27-099ac320fc97" + name="MessageOccurrenceSpecification80"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" + LastKnownName="Auxiliaries" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -5108,22 +5108,22 @@ Start Cycle 3...</body> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="306ce72f-8613-467f-abcb-7e8bf6312608" - name="MessageOccurrenceSpecification85"> + Id="05e976da-a330-499c-96c7-b3916fb20180" + name="MessageOccurrenceSpecification86"> <covered> <lifelineMoniker - Id="a1232aec-9f73-4278-80cd-447cd7a32be8" - LastKnownName="Engine" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="05e976da-a330-499c-96c7-b3916fb20180" - name="MessageOccurrenceSpecification86"> + Id="306ce72f-8613-467f-abcb-7e8bf6312608" + name="MessageOccurrenceSpecification85"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="a1232aec-9f73-4278-80cd-447cd7a32be8" + LastKnownName="Engine" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -5146,22 +5146,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="38e425d7-1df8-4aa3-8fb6-cfe2b13c7cb0" - name="MessageOccurrenceSpecification50"> + Id="e478c6df-e55b-4f1f-aef6-41cd2a1e4746" + name="MessageOccurrenceSpecification49"> <covered> <lifelineMoniker - Id="c47938d6-3f92-41f2-be72-cf03eb9ebe27" - LastKnownName="Simulator" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="e478c6df-e55b-4f1f-aef6-41cd2a1e4746" - name="MessageOccurrenceSpecification49"> + Id="38e425d7-1df8-4aa3-8fb6-cfe2b13c7cb0" + name="MessageOccurrenceSpecification50"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="c47938d6-3f92-41f2-be72-cf03eb9ebe27" + LastKnownName="Simulator" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -5720,22 +5720,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="e7bae871-38af-4460-8cae-5adee8955203" - name="MessageOccurrenceSpecification21"> + Id="bc637b7e-47bc-417f-a67f-48baa1438881" + name="MessageOccurrenceSpecification22"> <covered> <lifelineMoniker - Id="a6b6f904-3d3e-41c7-95bb-76fdabc6f043" - LastKnownName="Wheels" + Id="97ec316f-5206-40fd-9519-15c98c5c9c35" + LastKnownName="Vehicle" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="bc637b7e-47bc-417f-a67f-48baa1438881" - name="MessageOccurrenceSpecification22"> + Id="e7bae871-38af-4460-8cae-5adee8955203" + name="MessageOccurrenceSpecification21"> <covered> <lifelineMoniker - Id="97ec316f-5206-40fd-9519-15c98c5c9c35" - LastKnownName="Vehicle" + Id="a6b6f904-3d3e-41c7-95bb-76fdabc6f043" + LastKnownName="Wheels" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -6094,22 +6094,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="8cc6a169-70eb-4957-92df-74cfc35178e1" - name="MessageOccurrenceSpecification16"> + Id="7fa51ceb-5d28-4194-bf5a-99af331165a7" + name="MessageOccurrenceSpecification15"> <covered> <lifelineMoniker - Id="97ec316f-5206-40fd-9519-15c98c5c9c35" - LastKnownName="Vehicle" + Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" + LastKnownName="Driver" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="7fa51ceb-5d28-4194-bf5a-99af331165a7" - name="MessageOccurrenceSpecification15"> + Id="8cc6a169-70eb-4957-92df-74cfc35178e1" + name="MessageOccurrenceSpecification16"> <covered> <lifelineMoniker - Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" - LastKnownName="Driver" + Id="97ec316f-5206-40fd-9519-15c98c5c9c35" + LastKnownName="Vehicle" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -6328,22 +6328,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="315a2167-197a-4884-bafc-a2e86ec2ed41" - name="MessageOccurrenceSpecification27"> + Id="f781b4cc-d7cf-4caf-9ca3-15343e5bb173" + name="MessageOccurrenceSpecification28"> <covered> <lifelineMoniker - Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" - LastKnownName="Axle Gear" + Id="e27045e5-ed2f-4939-93ae-698821f6262f" + LastKnownName="Gearbox" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="f781b4cc-d7cf-4caf-9ca3-15343e5bb173" - name="MessageOccurrenceSpecification28"> + Id="315a2167-197a-4884-bafc-a2e86ec2ed41" + name="MessageOccurrenceSpecification27"> <covered> <lifelineMoniker - Id="e27045e5-ed2f-4939-93ae-698821f6262f" - LastKnownName="Gearbox" + Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" + LastKnownName="Axle Gear" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -6650,22 +6650,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="ff14005c-360d-4e94-841a-d79c5a2c700c" - name="MessageOccurrenceSpecification33"> + Id="453ee2fa-470e-4eaa-8cda-f68db0823400" + name="MessageOccurrenceSpecification34"> <covered> <lifelineMoniker - Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" - LastKnownName="Clutch" + Id="e27045e5-ed2f-4939-93ae-698821f6262f" + LastKnownName="Gearbox" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="453ee2fa-470e-4eaa-8cda-f68db0823400" - name="MessageOccurrenceSpecification34"> + Id="ff14005c-360d-4e94-841a-d79c5a2c700c" + name="MessageOccurrenceSpecification33"> <covered> <lifelineMoniker - Id="e27045e5-ed2f-4939-93ae-698821f6262f" - LastKnownName="Gearbox" + Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" + LastKnownName="Clutch" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -6688,22 +6688,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="f30bb8f0-a8f9-40b0-aa87-6c1ed079b495" - name="MessageOccurrenceSpecification29"> + Id="fb8b076b-2cec-4202-bff2-1c36f1c9cb18" + name="MessageOccurrenceSpecification30"> <covered> <lifelineMoniker - Id="e27045e5-ed2f-4939-93ae-698821f6262f" - LastKnownName="Gearbox" + Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" + LastKnownName="Axle Gear" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="fb8b076b-2cec-4202-bff2-1c36f1c9cb18" - name="MessageOccurrenceSpecification30"> + Id="f30bb8f0-a8f9-40b0-aa87-6c1ed079b495" + name="MessageOccurrenceSpecification29"> <covered> <lifelineMoniker - Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" - LastKnownName="Axle Gear" + Id="e27045e5-ed2f-4939-93ae-698821f6262f" + LastKnownName="Gearbox" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -7054,22 +7054,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="1d42585a-84ee-4997-bf9f-2455203105cf" - name="MessageOccurrenceSpecification24"> + Id="e9436dc3-8123-4fe8-9aca-70998d0bc949" + name="MessageOccurrenceSpecification23"> <covered> <lifelineMoniker - Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" - LastKnownName="Axle Gear" + Id="a6b6f904-3d3e-41c7-95bb-76fdabc6f043" + LastKnownName="Wheels" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="e9436dc3-8123-4fe8-9aca-70998d0bc949" - name="MessageOccurrenceSpecification23"> + Id="1d42585a-84ee-4997-bf9f-2455203105cf" + name="MessageOccurrenceSpecification24"> <covered> <lifelineMoniker - Id="a6b6f904-3d3e-41c7-95bb-76fdabc6f043" - LastKnownName="Wheels" + Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" + LastKnownName="Axle Gear" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -7210,22 +7210,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="d6254845-c861-484f-8be1-070d19359f9e" - name="MessageOccurrenceSpecification31"> + Id="42aafd8a-dd51-4dc2-a241-ac3982accd4e" + name="MessageOccurrenceSpecification32"> <covered> <lifelineMoniker - Id="e27045e5-ed2f-4939-93ae-698821f6262f" - LastKnownName="Gearbox" + Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" + LastKnownName="Clutch" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="42aafd8a-dd51-4dc2-a241-ac3982accd4e" - name="MessageOccurrenceSpecification32"> + Id="d6254845-c861-484f-8be1-070d19359f9e" + name="MessageOccurrenceSpecification31"> <covered> <lifelineMoniker - Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" - LastKnownName="Clutch" + Id="e27045e5-ed2f-4939-93ae-698821f6262f" + LastKnownName="Gearbox" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -7378,22 +7378,22 @@ Start Cycle 3...</body> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="794c6e0a-d848-44da-bc23-8d689bf6c51d" - name="MessageOccurrenceSpecification41"> + Id="a45995cd-994c-47ae-be0d-109f806b8f07" + name="MessageOccurrenceSpecification42"> <covered> <lifelineMoniker - Id="a1232aec-9f73-4278-80cd-447cd7a32be8" - LastKnownName="Engine" + Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" + LastKnownName="Auxiliaries" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="a45995cd-994c-47ae-be0d-109f806b8f07" - name="MessageOccurrenceSpecification42"> + Id="794c6e0a-d848-44da-bc23-8d689bf6c51d" + name="MessageOccurrenceSpecification41"> <covered> <lifelineMoniker - Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" - LastKnownName="Auxiliaries" + Id="a1232aec-9f73-4278-80cd-447cd7a32be8" + LastKnownName="Engine" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -7416,22 +7416,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="5ed1eec9-f4c3-417c-848f-40ed6fc01603" - name="MessageOccurrenceSpecification38"> + Id="e84ae988-421e-4a97-8459-8da79235484f" + name="MessageOccurrenceSpecification37"> <covered> <lifelineMoniker - Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" - LastKnownName="Clutch" + Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" + LastKnownName="Auxiliaries" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="e84ae988-421e-4a97-8459-8da79235484f" - name="MessageOccurrenceSpecification37"> + Id="5ed1eec9-f4c3-417c-848f-40ed6fc01603" + name="MessageOccurrenceSpecification38"> <covered> <lifelineMoniker - Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" - LastKnownName="Auxiliaries" + Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" + LastKnownName="Clutch" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -7454,22 +7454,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="b2d8f799-cd5d-43ce-98a4-0cca657e6adf" - name="MessageOccurrenceSpecification34"> + Id="66a01015-4f89-478b-8de7-b8e36ca15c12" + name="MessageOccurrenceSpecification33"> <covered> <lifelineMoniker - Id="e27045e5-ed2f-4939-93ae-698821f6262f" - LastKnownName="Gearbox" + Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" + LastKnownName="Clutch" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="66a01015-4f89-478b-8de7-b8e36ca15c12" - name="MessageOccurrenceSpecification33"> + Id="b2d8f799-cd5d-43ce-98a4-0cca657e6adf" + name="MessageOccurrenceSpecification34"> <covered> <lifelineMoniker - Id="564fdb2f-55e8-42cb-ae05-065ad174d3a2" - LastKnownName="Clutch" + Id="e27045e5-ed2f-4939-93ae-698821f6262f" + LastKnownName="Gearbox" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -7606,22 +7606,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="97c31d14-272e-499f-baab-82460be06433" - name="MessageOccurrenceSpecification18"> + Id="c5d6da90-e749-4847-9a11-5d7e6634e839" + name="MessageOccurrenceSpecification17"> <covered> <lifelineMoniker - Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" - LastKnownName="Driver" + Id="97ec316f-5206-40fd-9519-15c98c5c9c35" + LastKnownName="Vehicle" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="c5d6da90-e749-4847-9a11-5d7e6634e839" - name="MessageOccurrenceSpecification17"> + Id="97c31d14-272e-499f-baab-82460be06433" + name="MessageOccurrenceSpecification18"> <covered> <lifelineMoniker - Id="97ec316f-5206-40fd-9519-15c98c5c9c35" - LastKnownName="Vehicle" + Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" + LastKnownName="Driver" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -7842,22 +7842,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="1c1e0d07-8e05-4a5f-b4d0-eefac7499e18" - name="MessageOccurrenceSpecification47"> + Id="2c3f480b-fd10-4a8b-a208-f523a3f7227d" + name="MessageOccurrenceSpecification48"> <covered> <lifelineMoniker - Id="c47938d6-3f92-41f2-be72-cf03eb9ebe27" - LastKnownName="Simulator" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="2c3f480b-fd10-4a8b-a208-f523a3f7227d" - name="MessageOccurrenceSpecification48"> + Id="1c1e0d07-8e05-4a5f-b4d0-eefac7499e18" + name="MessageOccurrenceSpecification47"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="c47938d6-3f92-41f2-be72-cf03eb9ebe27" + LastKnownName="Simulator" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -8020,22 +8020,22 @@ Start Cycle 3...</body> </covered> </executionOccurrenceSpecification> <messageOccurrenceSpecification - Id="537fb6a8-2342-44b2-9ee3-efa7509bd851" - name="MessageOccurrenceSpecification56"> + Id="9dbc7a28-64b3-49a7-b978-043f32b8cbc3" + name="MessageOccurrenceSpecification55"> <covered> <lifelineMoniker - Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" - LastKnownName="Driver" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="9dbc7a28-64b3-49a7-b978-043f32b8cbc3" - name="MessageOccurrenceSpecification55"> + Id="537fb6a8-2342-44b2-9ee3-efa7509bd851" + name="MessageOccurrenceSpecification56"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="55fcd3a9-c10c-478b-b0f5-6d78b332255d" + LastKnownName="Driver" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -8148,22 +8148,22 @@ Start Cycle 3...</body> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="97b3d7b1-5d64-4c6c-b797-0b34c9498e6b" - name="MessageOccurrenceSpecification61"> + Id="46b99c2a-80db-43a0-8acf-8f0c043858bc" + name="MessageOccurrenceSpecification62"> <covered> <lifelineMoniker - Id="97ec316f-5206-40fd-9519-15c98c5c9c35" - LastKnownName="Vehicle" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="46b99c2a-80db-43a0-8acf-8f0c043858bc" - name="MessageOccurrenceSpecification62"> + Id="97b3d7b1-5d64-4c6c-b797-0b34c9498e6b" + name="MessageOccurrenceSpecification61"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="97ec316f-5206-40fd-9519-15c98c5c9c35" + LastKnownName="Vehicle" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -8364,22 +8364,22 @@ Start Cycle 3...</body> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="65a4eee1-1527-438d-8bc6-46bf80067657" - name="MessageOccurrenceSpecification69"> + Id="c0a5ade8-3b88-471c-ae4e-0dbd20c396d1" + name="MessageOccurrenceSpecification70"> <covered> <lifelineMoniker - Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" - LastKnownName="Axle Gear" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="c0a5ade8-3b88-471c-ae4e-0dbd20c396d1" - name="MessageOccurrenceSpecification70"> + Id="65a4eee1-1527-438d-8bc6-46bf80067657" + name="MessageOccurrenceSpecification69"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="0735efff-0cf9-43ad-b349-ae64bd5b7a90" + LastKnownName="Axle Gear" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> @@ -8688,22 +8688,22 @@ Start Cycle 3...</body> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="e01ea421-00e1-4183-a3c9-550fcd66be2c" - name="MessageOccurrenceSpecification82"> + Id="dd2db548-0550-40ad-b6d8-24cd51928e11" + name="MessageOccurrenceSpecification81"> <covered> <lifelineMoniker - Id="d8672f86-5730-494c-ab88-46c04ba2800e" - LastKnownName="VehicleContainer" + Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" + LastKnownName="Auxiliaries" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification - Id="dd2db548-0550-40ad-b6d8-24cd51928e11" - name="MessageOccurrenceSpecification81"> + Id="e01ea421-00e1-4183-a3c9-550fcd66be2c" + name="MessageOccurrenceSpecification82"> <covered> <lifelineMoniker - Id="063a31ea-ee94-4f46-9431-c34025dd4fc3" - LastKnownName="Auxiliaries" + Id="d8672f86-5730-494c-ab88-46c04ba2800e" + LastKnownName="VehicleContainer" LastKnownLocation="VectoArchitecture.uml" /> </covered> </messageOccurrenceSpecification> diff --git a/VectoCoreArchitecture/Request.sequencediagram b/VectoCoreArchitecture/Request.sequencediagram index 79bfdde708a2d93c0b4c263cee3566f72db18e05..2d0152bd81165be4a1698bcb5d283aeb8b9ff4bc 100644 --- a/VectoCoreArchitecture/Request.sequencediagram +++ b/VectoCoreArchitecture/Request.sequencediagram @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<SequenceDesignerModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:dm1="http://schemas.microsoft.com/dsltools/Kernel" xmlns:dm2="http://schemas.microsoft.com/dsltools/Component" xmlns:dm3="http://schemas.microsoft.com/dsltools/UseCase" xmlns:dm4="http://schemas.microsoft.com/dsltools/Activity" xmlns:dm5="http://schemas.microsoft.com/dsltools/Interaction" xmlns:dm6="http://schemas.microsoft.com/dsltools/UmlModelLibrary" xmlns:dm7="http://schemas.microsoft.com/dsltools/UmlDiagrams" xmlns:dm8="http://schemas.microsoft.com/dsltools/ModelStore" dslVersion="1.0.0.0" Id="784de59c-9096-4010-b35c-fa2e1ce01da2" name="Request Sequence" linkedPackageId="d9536f1a-29ae-4998-a61d-8ed09f4ae8e4" xmlns="http://schemas.microsoft.com/VisualStudio/TeamArchitect/SequenceDesigner"> +<SequenceDesignerModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:dm1="http://schemas.microsoft.com/dsltools/Kernel" xmlns:dm2="http://schemas.microsoft.com/dsltools/Component" xmlns:dm3="http://schemas.microsoft.com/dsltools/Activity" xmlns:dm4="http://schemas.microsoft.com/dsltools/Interaction" xmlns:dm5="http://schemas.microsoft.com/dsltools/UseCase" xmlns:dm6="http://schemas.microsoft.com/dsltools/UmlModelLibrary" xmlns:dm7="http://schemas.microsoft.com/dsltools/UmlDiagrams" xmlns:dm8="http://schemas.microsoft.com/dsltools/ModelStore" xmlns:dm9="http://schemas.microsoft.com/dsltools/LogicalClassDesigner" dslVersion="1.0.0.0" Id="784de59c-9096-4010-b35c-fa2e1ce01da2" name="Request Sequence" linkedPackageId="d9536f1a-29ae-4998-a61d-8ed09f4ae8e4" xmlns="http://schemas.microsoft.com/VisualStudio/TeamArchitect/SequenceDesigner"> <packagedElements> <packageHasNamedElement> <interaction Id="60558488-6e4a-41e5-b61d-87aa0c2c6371" name="Request Sequence" collapseFragmentsFlag="false" isActiveClass="false" isAbstract="false" isLeaf="false" isReentrant="false"> diff --git a/VectoCoreArchitecture/Request.sequencediagram.layout b/VectoCoreArchitecture/Request.sequencediagram.layout index b977e44572ae5cb97dff9e2b775cb077a5a070f5..31a94600aab8689834bc11117d66af61e6413995 100644 --- a/VectoCoreArchitecture/Request.sequencediagram.layout +++ b/VectoCoreArchitecture/Request.sequencediagram.layout @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8"?> -<sequenceDesignerDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 13.25, 8.5" name="UMLSequenceDiagram1"> +<sequenceDesignerDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 13.25, 10.375" name="UMLSequenceDiagram1"> <SequenceDesignerModelMoniker Id="784de59c-9096-4010-b35c-fa2e1ce01da2" /> <nestedChildShapes> - <lifelineShape Id="d323ad9d-719d-4227-8b5e-b708249b1bbe" absoluteBounds="1.025, 1, 0.15, 6.7468749999999984" visible="true" visualStyleMode="Modified"> + <lifelineShape Id="d323ad9d-719d-4227-8b5e-b708249b1bbe" absoluteBounds="1.025, 1, 0.15, 9.1218750000000028" visible="true" visualStyleMode="Modified"> <lifelineMoniker Id="c2ec8124-ce7d-46ff-9852-989e99d965d8" LastKnownName="C1 : VectoSimulationComponent" /> <relativeChildShapes> <umlLifelineHeadShape Id="d7af58ba-3a6d-4191-9533-bdd8c7f5d03a" absoluteBounds="0.099999999999999867, 0.6, 2, 0.4" customColor="White" visualStyleMode="Modified"> <lifelineMoniker Id="c2ec8124-ce7d-46ff-9852-989e99d965d8" LastKnownName="C1 : VectoSimulationComponent" /> <relativeChildShapes /> </umlLifelineHeadShape> - <lifelineHoverShape Id="43b0bd74-1492-4175-9e9e-46cc1fc67e49" absoluteBounds="1.025, 1, 0, 6.75"> + <lifelineHoverShape Id="43b0bd74-1492-4175-9e9e-46cc1fc67e49" absoluteBounds="1.025, 1, 0, 9.125"> <lifelineMoniker Id="c2ec8124-ce7d-46ff-9852-989e99d965d8" LastKnownName="C1 : VectoSimulationComponent" /> </lifelineHoverShape> </relativeChildShapes> </lifelineShape> - <lifelineShape Id="326bf236-de9d-44ba-8e67-7be9311757a7" absoluteBounds="3.325, 1, 0.15, 6.7781250000000028" visible="true" visualStyleMode="Modified"> + <lifelineShape Id="326bf236-de9d-44ba-8e67-7be9311757a7" absoluteBounds="3.325, 1, 0.15, 9.1218750000000028" visible="true" visualStyleMode="Modified"> <lifelineMoniker Id="3dab1444-620e-4fd1-ae01-53b756b8f552" LastKnownName="OutPort" /> <relativeChildShapes> <umlLifelineHeadShape Id="694f5ae7-3acc-4c33-9782-d5556713ecd3" absoluteBounds="2.9000000000000004, 0.6, 1, 0.4" customColor="White" visualStyleMode="Modified"> <lifelineMoniker Id="3dab1444-620e-4fd1-ae01-53b756b8f552" LastKnownName="OutPort" /> <relativeChildShapes /> </umlLifelineHeadShape> - <lifelineHoverShape Id="6fdccce7-9753-47be-92c2-bfc8847db69c" absoluteBounds="3.325, 1, 0, 6.75"> + <lifelineHoverShape Id="6fdccce7-9753-47be-92c2-bfc8847db69c" absoluteBounds="3.325, 1, 0, 9.125"> <lifelineMoniker Id="3dab1444-620e-4fd1-ae01-53b756b8f552" LastKnownName="OutPort" /> </lifelineHoverShape> <umlExecutionSpecificationShape Id="5665dd2f-6c09-47d9-acac-031998a2ab47" absoluteBounds="3.325, 1.3, 0.15, 1.7499999999999998" customColor="184, 204, 215" visualStyleMode="Modified"> @@ -30,19 +30,19 @@ <umlExecutionSpecificationShape Id="ad29c161-6034-4b19-92da-b75591df90ed" absoluteBounds="3.325, 3.3499999999999996, 0.15, 1.7499999999999991" customColor="184, 204, 215" visualStyleMode="Modified"> <behaviorExecutionSpecificationMoniker Id="bf94af39-3fc7-499e-8b97-548b4e261ab7" LastKnownName="BehaviorExecutionSpecification63" /> </umlExecutionSpecificationShape> - <umlExecutionSpecificationShape Id="fe7e5932-ea74-4abe-9652-d00e85644e71" absoluteBounds="3.325, 5.3999999999999995, 0.15, 2.0468749999999991" customColor="184, 204, 215" visualStyleMode="Modified"> + <umlExecutionSpecificationShape Id="fe7e5932-ea74-4abe-9652-d00e85644e71" absoluteBounds="3.325, 7.775, 0.15, 2.0468750000000018" customColor="184, 204, 215" visualStyleMode="Modified"> <behaviorExecutionSpecificationMoniker Id="228017de-0378-4c7f-b8d0-6d7e75e2b868" LastKnownName="BehaviorExecutionSpecification66" /> </umlExecutionSpecificationShape> </relativeChildShapes> </lifelineShape> - <lifelineShape Id="095e6096-674a-4c86-ba6c-0f02db859753" absoluteBounds="5.614583333333333, 1, 0.15, 6.7385416666666682" visible="true" visualStyleMode="Modified"> + <lifelineShape Id="095e6096-674a-4c86-ba6c-0f02db859753" absoluteBounds="5.614583333333333, 1, 0.15, 8.8218750000000021" visible="true" visualStyleMode="Modified"> <lifelineMoniker Id="e837a4db-825f-43dd-9a33-4614cbad36e2" LastKnownName="InPort" /> <relativeChildShapes> <umlLifelineHeadShape Id="19eb5f34-e3e7-44b5-afb3-cf2503579bc1" absoluteBounds="5.1895833333333332, 0.6, 1, 0.4" customColor="White" visualStyleMode="Modified"> <lifelineMoniker Id="e837a4db-825f-43dd-9a33-4614cbad36e2" LastKnownName="InPort" /> <relativeChildShapes /> </umlLifelineHeadShape> - <lifelineHoverShape Id="dfb84293-eee0-4675-86de-ec406bd2f258" absoluteBounds="5.614583333333333, 1, 0, 6.75"> + <lifelineHoverShape Id="dfb84293-eee0-4675-86de-ec406bd2f258" absoluteBounds="5.614583333333333, 1, 0, 8.875"> <lifelineMoniker Id="e837a4db-825f-43dd-9a33-4614cbad36e2" LastKnownName="InPort" /> </lifelineHoverShape> <umlExecutionSpecificationShape Id="b38fc75e-383a-4eef-8cb7-3da064053513" absoluteBounds="5.614583333333333, 1.6, 0.15, 1.15" customColor="184, 204, 215" visualStyleMode="Modified"> @@ -51,19 +51,19 @@ <umlExecutionSpecificationShape Id="cb77e937-53d8-46b5-908c-d10c4da3843f" absoluteBounds="5.614583333333333, 3.6499999999999995, 0.15, 1.1499999999999995" customColor="184, 204, 215" visualStyleMode="Modified"> <behaviorExecutionSpecificationMoniker Id="648f6929-1eb1-49c2-a48a-21105918465d" LastKnownName="BehaviorExecutionSpecification64" /> </umlExecutionSpecificationShape> - <umlExecutionSpecificationShape Id="fb3cd6df-edf5-48ed-ad41-0d129be85581" absoluteBounds="5.614583333333333, 5.6999999999999993, 0.15, 1.4468749999999995" customColor="184, 204, 215" visualStyleMode="Modified"> + <umlExecutionSpecificationShape Id="fb3cd6df-edf5-48ed-ad41-0d129be85581" absoluteBounds="5.614583333333333, 8.0750000000000011, 0.15, 1.4468750000000004" customColor="184, 204, 215" visualStyleMode="Modified"> <behaviorExecutionSpecificationMoniker Id="08253098-cf44-4ad0-8143-3383d435d7d9" LastKnownName="BehaviorExecutionSpecification67" /> </umlExecutionSpecificationShape> </relativeChildShapes> </lifelineShape> - <lifelineShape Id="d4d922a8-4088-4b17-aa08-35b4c2e9163d" absoluteBounds="7.9250000000000007, 1, 0.15, 6.7770833333333336" visible="true" visualStyleMode="Modified"> + <lifelineShape Id="d4d922a8-4088-4b17-aa08-35b4c2e9163d" absoluteBounds="7.9250000000000007, 1, 0.15, 8.5218750000000014" visible="true" visualStyleMode="Modified"> <lifelineMoniker Id="8251abbd-da3f-4ad8-827f-ff4a45d8811e" LastKnownName="C2 : VectoSimulationComponent" /> <relativeChildShapes> <umlLifelineHeadShape Id="2bf707c3-0ff6-4ffc-a968-cb91575f2da5" absoluteBounds="7.0000000000000009, 0.6, 2, 0.4" customColor="White" visualStyleMode="Modified"> <lifelineMoniker Id="8251abbd-da3f-4ad8-827f-ff4a45d8811e" LastKnownName="C2 : VectoSimulationComponent" /> <relativeChildShapes /> </umlLifelineHeadShape> - <lifelineHoverShape Id="5701e285-d6cd-4c3b-8d62-e1b7685fe4a6" absoluteBounds="7.9250000000000007, 1, 0, 6.75"> + <lifelineHoverShape Id="5701e285-d6cd-4c3b-8d62-e1b7685fe4a6" absoluteBounds="7.9250000000000007, 1, 0, 8.5"> <lifelineMoniker Id="8251abbd-da3f-4ad8-827f-ff4a45d8811e" LastKnownName="C2 : VectoSimulationComponent" /> </lifelineHoverShape> <umlExecutionSpecificationShape Id="48314357-8587-4e2a-85b4-e72b0a5032cd" absoluteBounds="7.9250000000000007, 1.9000000000000001, 0.15, 0.55" customColor="184, 204, 215" visualStyleMode="Modified"> @@ -72,7 +72,7 @@ <umlExecutionSpecificationShape Id="263d0974-e3fc-4b92-bb33-95b32b6f7af8" absoluteBounds="7.9250000000000007, 3.9499999999999993, 0.15, 0.55" customColor="184, 204, 215" visualStyleMode="Modified"> <behaviorExecutionSpecificationMoniker Id="1a77a542-8f63-4686-a8e0-63ae9d3144d6" LastKnownName="BehaviorExecutionSpecification65" /> </umlExecutionSpecificationShape> - <umlExecutionSpecificationShape Id="c37d6806-caa3-4853-ae90-1f84f4a74378" absoluteBounds="7.9250000000000007, 5.9999999999999991, 0.15, 0.84687499999999982" customColor="184, 204, 215" visualStyleMode="Modified"> + <umlExecutionSpecificationShape Id="c37d6806-caa3-4853-ae90-1f84f4a74378" absoluteBounds="7.9250000000000007, 8.3750000000000018, 0.15, 0.84687499999999893" customColor="184, 204, 215" visualStyleMode="Modified"> <behaviorExecutionSpecificationMoniker Id="e6d27219-f03e-4644-bd83-f58afbe98e80" LastKnownName="BehaviorExecutionSpecification68" /> </umlExecutionSpecificationShape> </relativeChildShapes> @@ -161,42 +161,42 @@ <umlExecutionSpecificationShapeMoniker Id="cb77e937-53d8-46b5-908c-d10c4da3843f" /> </nodes> </returnMessageConnector> - <syncMessageConnector edgePoints="[(1.1 : 5.4); (3.325 : 5.4)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> + <syncMessageConnector edgePoints="[(1.1 : 7.775); (3.325 : 7.775)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> <relativeChildShapes /> <nodes> <lifelineShapeMoniker Id="d323ad9d-719d-4227-8b5e-b708249b1bbe" /> <umlExecutionSpecificationShapeMoniker Id="fe7e5932-ea74-4abe-9652-d00e85644e71" /> </nodes> </syncMessageConnector> - <returnMessageConnector edgePoints="[(3.325 : 7.446875); (1.1 : 7.446875)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> + <returnMessageConnector edgePoints="[(3.325 : 9.821875); (1.1 : 9.821875)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> <relativeChildShapes /> <nodes> <umlExecutionSpecificationShapeMoniker Id="fe7e5932-ea74-4abe-9652-d00e85644e71" /> <lifelineShapeMoniker Id="d323ad9d-719d-4227-8b5e-b708249b1bbe" /> </nodes> </returnMessageConnector> - <syncMessageConnector edgePoints="[(3.475 : 5.7); (5.61458333333333 : 5.7)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> + <syncMessageConnector edgePoints="[(3.475 : 8.075); (5.61458333333333 : 8.075)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> <relativeChildShapes /> <nodes> <umlExecutionSpecificationShapeMoniker Id="fe7e5932-ea74-4abe-9652-d00e85644e71" /> <umlExecutionSpecificationShapeMoniker Id="fb3cd6df-edf5-48ed-ad41-0d129be85581" /> </nodes> </syncMessageConnector> - <returnMessageConnector edgePoints="[(5.61458333333333 : 7.146875); (3.475 : 7.146875)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> + <returnMessageConnector edgePoints="[(5.61458333333333 : 9.521875); (3.475 : 9.521875)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> <relativeChildShapes /> <nodes> <umlExecutionSpecificationShapeMoniker Id="fb3cd6df-edf5-48ed-ad41-0d129be85581" /> <umlExecutionSpecificationShapeMoniker Id="fe7e5932-ea74-4abe-9652-d00e85644e71" /> </nodes> </returnMessageConnector> - <syncMessageConnector edgePoints="[(5.76458333333333 : 6); (7.925 : 6)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> + <syncMessageConnector edgePoints="[(5.76458333333333 : 8.375); (7.925 : 8.375)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> <relativeChildShapes /> <nodes> <umlExecutionSpecificationShapeMoniker Id="fb3cd6df-edf5-48ed-ad41-0d129be85581" /> <umlExecutionSpecificationShapeMoniker Id="c37d6806-caa3-4853-ae90-1f84f4a74378" /> </nodes> </syncMessageConnector> - <returnMessageConnector edgePoints="[(7.925 : 6.846875); (5.76458333333333 : 6.846875)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> + <returnMessageConnector edgePoints="[(7.925 : 9.221875); (5.76458333333333 : 9.221875)]" fixedFrom="Caller" fixedTo="Caller" TargetRelationshipDomainClassId="e24617ce-6c7e-4c7d-802a-63014f02e313" customColor="Black" visible="true" visualStyleMode="Modified" messageId="00000000-0000-0000-0000-000000000000"> <relativeChildShapes /> <nodes> <umlExecutionSpecificationShapeMoniker Id="c37d6806-caa3-4853-ae90-1f84f4a74378" /> @@ -211,7 +211,7 @@ <commentMoniker Id="17609423-9b86-46f1-a26b-6924a1735f19" /> <relativeChildShapes /> </commentShape> - <commentShape Id="22f74edf-0319-4176-bf40-17207be2fc3b" absoluteBounds="0.125, 5.5, 1.25, 1.625" customColor="251, 247, 200"> + <commentShape Id="22f74edf-0319-4176-bf40-17207be2fc3b" absoluteBounds="0.125, 7.875, 1.25, 1.625" customColor="251, 247, 200"> <commentMoniker Id="3bf7abb5-724e-4ce2-ba63-58eeaf68dcf3" /> <relativeChildShapes /> </commentShape> diff --git a/VectoCoreArchitecture/Simulation.sequencediagram b/VectoCoreArchitecture/Simulation.sequencediagram index 823388b7399966a205616bfd9ef456596e503f40..95ee9e01cd6b93f6772db90b1cdc03acee265f48 100644 --- a/VectoCoreArchitecture/Simulation.sequencediagram +++ b/VectoCoreArchitecture/Simulation.sequencediagram @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<SequenceDesignerModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:dm1="http://schemas.microsoft.com/dsltools/Kernel" xmlns:dm2="http://schemas.microsoft.com/dsltools/Component" xmlns:dm3="http://schemas.microsoft.com/dsltools/UseCase" xmlns:dm4="http://schemas.microsoft.com/dsltools/Activity" xmlns:dm5="http://schemas.microsoft.com/dsltools/Interaction" xmlns:dm6="http://schemas.microsoft.com/dsltools/UmlModelLibrary" xmlns:dm7="http://schemas.microsoft.com/dsltools/UmlDiagrams" xmlns:dm8="http://schemas.microsoft.com/dsltools/ModelStore" dslVersion="1.0.0.0" Id="0bcb8d92-48a7-4b95-9226-642597bdbda4" name="Simulation" linkedPackageId="ce4f6e12-d118-4ade-be24-06da87c4e4d8" xmlns="http://schemas.microsoft.com/VisualStudio/TeamArchitect/SequenceDesigner"> +<SequenceDesignerModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:dm1="http://schemas.microsoft.com/dsltools/Kernel" xmlns:dm2="http://schemas.microsoft.com/dsltools/Component" xmlns:dm3="http://schemas.microsoft.com/dsltools/Activity" xmlns:dm4="http://schemas.microsoft.com/dsltools/Interaction" xmlns:dm5="http://schemas.microsoft.com/dsltools/UseCase" xmlns:dm6="http://schemas.microsoft.com/dsltools/UmlModelLibrary" xmlns:dm7="http://schemas.microsoft.com/dsltools/UmlDiagrams" xmlns:dm8="http://schemas.microsoft.com/dsltools/ModelStore" xmlns:dm9="http://schemas.microsoft.com/dsltools/LogicalClassDesigner" dslVersion="1.0.0.0" Id="0bcb8d92-48a7-4b95-9226-642597bdbda4" name="Simulation" linkedPackageId="ce4f6e12-d118-4ade-be24-06da87c4e4d8" xmlns="http://schemas.microsoft.com/VisualStudio/TeamArchitect/SequenceDesigner"> <packagedElements> <packageHasNamedElement> <interaction Id="38829ed0-f832-41a5-b55e-301311151345" name="Simulation" collapseFragmentsFlag="false" isActiveClass="false" isAbstract="false" isLeaf="false" isReentrant="false"> @@ -8,7 +8,7 @@ <elementDefinition Id="a9c25587-52d9-4b03-8b23-8ae45e1b5adc" /> <body>Request Failed with TimeFail: Adjust dt -Repeat Cycle 2</body> +Repeat Step 2</body> </comment> <comment Id="fbfb4ecb-9a07-4747-b894-6ba2d1e08d6d"> <elementDefinition Id="722f3338-2c54-4b7a-8884-8cf5dba38f2c" /> @@ -17,17 +17,17 @@ Adjust driver demands</body> </comment> <comment Id="2e649ed8-e8ab-494d-be01-a95a6db010e0"> <elementDefinition Id="6db0e2e1-ec56-437e-a1ac-9c6d7fc54f0f" /> - <body>Start Cycle 1</body> + <body>Start Step 1</body> </comment> <comment Id="784fbb90-7666-493e-8dbd-c7ebe7e8a0cd"> <elementDefinition Id="a516f816-b8c2-41bb-bb19-140d84a49ed8" /> - <body>Cycle 1 commited. -Start Cycle 2</body> + <body>Step 1 commited. +Start Step 2</body> </comment> <comment Id="0f1f92bd-ced5-408a-8db9-c2edcb5aa0df"> <elementDefinition Id="aa66ccff-8d12-4a12-bf31-026e399088b0" /> - <body>Cycle 2 commited. -Start Cycle 3 ...</body> + <body>Step 2 commited. +Start Step 3 ...</body> </comment> <comment Id="28faa847-b49d-4568-8cb3-07cd8c89f0e8"> <elementDefinition Id="2abf9533-9791-414d-bb10-edcda9455296" /> @@ -101,8 +101,8 @@ Start Cycle 3 ...</body> </comment> <comment Id="0167b631-e895-4804-b3db-829a68de9a47"> <elementDefinition Id="fccccb9d-bd53-4838-856d-f3324d92e257" /> - <body>Commit Cycle 2 -Start Cycle 3...</body> + <body>Commit Step 2 +Start Step 3...</body> </comment> </ownedCommentsInternal> <elementDefinition Id="16d41b2b-d917-4614-85c9-523ad415ee1a" /> @@ -225,18 +225,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="874449e5-34ff-4421-b741-c172af51502b" name="MessageOccurrenceSpecification11"> - <elementDefinition Id="417e6cff-c640-4bf4-b049-4ec22d604875" /> - <covered> - <lifelineMoniker Id="690feee8-1752-48bf-be6b-3aaf45e44e31" LastKnownName="Driving Cycle" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="693aaa2b-8043-4475-8350-4f1c1b05854b" name="MessageOccurrenceSpecification12"> <elementDefinition Id="67e58904-6e2e-4250-a429-8028713a9b54" /> <covered> <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="874449e5-34ff-4421-b741-c172af51502b" name="MessageOccurrenceSpecification11"> + <elementDefinition Id="417e6cff-c640-4bf4-b049-4ec22d604875" /> + <covered> + <lifelineMoniker Id="690feee8-1752-48bf-be6b-3aaf45e44e31" LastKnownName="Driving Cycle" /> + </covered> + </messageOccurrenceSpecification> <behaviorExecutionSpecification Id="ee4491c5-056d-4df2-a394-9c65662f65bf" name="BehaviorExecutionSpecification5"> <elementDefinition Id="4f86da9b-0cc7-460e-b57a-d87a471f9b76" /> <coveredLifelines> @@ -545,18 +545,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="dd45522b-956a-44f2-9b6a-e05ae601410c" name="MessageOccurrenceSpecification37"> - <elementDefinition Id="b0d458a4-57a4-48d0-bac6-c43b24244bc7" /> - <covered> - <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="830104b3-c150-4353-8050-5706cfff0144" name="MessageOccurrenceSpecification38"> <elementDefinition Id="0db6c4d1-99f9-4bcf-a049-942138a8ccfb" /> <covered> <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="dd45522b-956a-44f2-9b6a-e05ae601410c" name="MessageOccurrenceSpecification37"> + <elementDefinition Id="b0d458a4-57a4-48d0-bac6-c43b24244bc7" /> + <covered> + <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="bde562d4-4952-4735-965f-eff0b286b2b6" name="ExecutionOccurrenceSpecification20"> <elementDefinition Id="045d0321-12f8-4d09-9632-339a8ab1ce8d" /> <event> @@ -825,18 +825,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> - <messageOccurrenceSpecification Id="2b0c7946-9f35-4b7f-b3b8-2b534507941a" name="MessageOccurrenceSpecification53"> - <elementDefinition Id="8aa50cc8-8d72-48a1-891c-aab1c78495cd" /> - <covered> - <lifelineMoniker Id="690feee8-1752-48bf-be6b-3aaf45e44e31" LastKnownName="Driving Cycle" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="9069a9cb-745e-4c63-aa44-a3edf47d944b" name="MessageOccurrenceSpecification54"> <elementDefinition Id="15c6a09f-faf1-4c12-8978-07d33269a2c2" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="2b0c7946-9f35-4b7f-b3b8-2b534507941a" name="MessageOccurrenceSpecification53"> + <elementDefinition Id="8aa50cc8-8d72-48a1-891c-aab1c78495cd" /> + <covered> + <lifelineMoniker Id="690feee8-1752-48bf-be6b-3aaf45e44e31" LastKnownName="Driving Cycle" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="321828d8-9485-464a-987c-e5f69698bb4e" name="ExecutionOccurrenceSpecification28"> <elementDefinition Id="7777f1f5-9039-4da1-a993-c5ecd471428e" /> <event> @@ -937,22 +937,16 @@ Start Cycle 3...</body> <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="d11052ef-26e9-4659-a6ee-1827baf15ef8" name="MessageOccurrenceSpecification60"> - <elementDefinition Id="b2ef8d83-44af-431e-a55a-601e9a285e4a" /> - <covered> - <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="efdaab8d-cab2-4161-881a-70a76b1e69d0" name="MessageOccurrenceSpecification59"> <elementDefinition Id="0639b6b2-f50f-403e-99c2-9502c8956a04" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> - <messageOccurrenceSpecification Id="09cdcacd-8051-4857-85cf-8fdbbe6bb655" name="MessageOccurrenceSpecification62"> - <elementDefinition Id="bc91813d-90aa-479f-9965-02d78d0fd42d" /> + <messageOccurrenceSpecification Id="d11052ef-26e9-4659-a6ee-1827baf15ef8" name="MessageOccurrenceSpecification60"> + <elementDefinition Id="b2ef8d83-44af-431e-a55a-601e9a285e4a" /> <covered> - <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> + <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> </covered> </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="93d1944c-0f04-4836-9fc8-191fa9b25104" name="MessageOccurrenceSpecification61"> @@ -961,6 +955,12 @@ Start Cycle 3...</body> <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="09cdcacd-8051-4857-85cf-8fdbbe6bb655" name="MessageOccurrenceSpecification62"> + <elementDefinition Id="bc91813d-90aa-479f-9965-02d78d0fd42d" /> + <covered> + <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="df1a3f45-d229-437e-bf5f-c84a814783db" name="ExecutionOccurrenceSpecification32"> <elementDefinition Id="2cffef1d-5429-4605-b42d-b470edb1da05" /> <event> @@ -1061,18 +1061,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="e6e04bda-7abb-4852-bae2-ccbf3b2b3f9e" name="MessageOccurrenceSpecification67"> - <elementDefinition Id="c5bce4ec-d3b7-4ff1-ae2c-d492d88b3e43" /> - <covered> - <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="ecb5c70a-c640-45fb-b2f3-e9a3323b97bf" name="MessageOccurrenceSpecification68"> <elementDefinition Id="1b51a46a-42ec-479f-9c28-24f8197d5f04" /> <covered> <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="e6e04bda-7abb-4852-bae2-ccbf3b2b3f9e" name="MessageOccurrenceSpecification67"> + <elementDefinition Id="c5bce4ec-d3b7-4ff1-ae2c-d492d88b3e43" /> + <covered> + <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> + </covered> + </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="3d86f599-4d59-48e2-b37a-f8d914993ed9" name="MessageOccurrenceSpecification69"> <elementDefinition Id="e6f57232-853e-4b3a-99a9-ee3386777f87" /> <covered> @@ -1247,18 +1247,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="3986cad1-079a-4309-a534-181b0cc5d4b0" name="MessageOccurrenceSpecification80"> - <elementDefinition Id="bc4c08f7-8e69-442e-ad27-099ac320fc97" /> - <covered> - <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="029acab7-bbd5-42f9-823a-cbd9c24406e7" name="MessageOccurrenceSpecification79"> <elementDefinition Id="f34713c0-f5f2-4655-84bd-528358cf726c" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="3986cad1-079a-4309-a534-181b0cc5d4b0" name="MessageOccurrenceSpecification80"> + <elementDefinition Id="bc4c08f7-8e69-442e-ad27-099ac320fc97" /> + <covered> + <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> + </covered> + </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="8acb4969-91cb-44ea-b724-e49e3956b4bc" name="MessageOccurrenceSpecification82"> <elementDefinition Id="a78fb3e9-f91e-42f7-b848-3e8a991aeef2" /> <covered> @@ -1321,18 +1321,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> </covered> </messageOccurrenceSpecification> - <messageOccurrenceSpecification Id="58d0c7ed-7383-4f6a-ac8b-ce4595ce418a" name="MessageOccurrenceSpecification85"> - <elementDefinition Id="306ce72f-8613-467f-abcb-7e8bf6312608" /> - <covered> - <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="2316339c-22e6-4721-9d80-8c8953835b15" name="MessageOccurrenceSpecification86"> <elementDefinition Id="05e976da-a330-499c-96c7-b3916fb20180" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="58d0c7ed-7383-4f6a-ac8b-ce4595ce418a" name="MessageOccurrenceSpecification85"> + <elementDefinition Id="306ce72f-8613-467f-abcb-7e8bf6312608" /> + <covered> + <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="8223f644-ffb0-4d3a-8a29-1511d84ecdb3" name="ExecutionOccurrenceSpecification44"> <elementDefinition Id="287e52d7-f63e-4028-818a-15a63607e987" /> <event> @@ -1344,18 +1344,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="3f08caac-835b-454a-ab5a-8492aa9bb3ae" name="MessageOccurrenceSpecification50"> - <elementDefinition Id="38e425d7-1df8-4aa3-8fb6-cfe2b13c7cb0" /> - <covered> - <lifelineMoniker Id="a3465343-fe19-49e4-858d-be0a7223e7cb" LastKnownName="Simulator" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="de4e770e-512a-4d9f-8c31-31e4a271dc4f" name="MessageOccurrenceSpecification49"> <elementDefinition Id="e478c6df-e55b-4f1f-aef6-41cd2a1e4746" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="3f08caac-835b-454a-ab5a-8492aa9bb3ae" name="MessageOccurrenceSpecification50"> + <elementDefinition Id="38e425d7-1df8-4aa3-8fb6-cfe2b13c7cb0" /> + <covered> + <lifelineMoniker Id="a3465343-fe19-49e4-858d-be0a7223e7cb" LastKnownName="Simulator" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="b34ab207-7d30-4742-97dc-5c507d7be57d" name="ExecutionOccurrenceSpecification26"> <elementDefinition Id="71b70efc-d025-4cf1-a709-88e177ec6ebd" /> <event> @@ -1657,18 +1657,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="efc08870-1993-49c1-be7a-5cd8823d649a" name="MessageOccurrenceSpecification21"> - <elementDefinition Id="e7bae871-38af-4460-8cae-5adee8955203" /> - <covered> - <lifelineMoniker Id="df75922f-09f1-4453-aab2-094ae9f4183e" LastKnownName="Wheels" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="d3c80559-aed1-403f-ae8e-99274054180a" name="MessageOccurrenceSpecification22"> <elementDefinition Id="bc637b7e-47bc-417f-a67f-48baa1438881" /> <covered> <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="efc08870-1993-49c1-be7a-5cd8823d649a" name="MessageOccurrenceSpecification21"> + <elementDefinition Id="e7bae871-38af-4460-8cae-5adee8955203" /> + <covered> + <lifelineMoniker Id="df75922f-09f1-4453-aab2-094ae9f4183e" LastKnownName="Wheels" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="f2ab6508-edcc-4e70-ac6e-fe91ce8ec9f6" name="ExecutionOccurrenceSpecification12"> <elementDefinition Id="fd727e2c-010c-442f-bea5-cc34f8c6dc8d" /> <event> @@ -1862,18 +1862,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="7df08509-74dd-4b9d-97a8-067fb38251a9" name="MessageOccurrenceSpecification16"> - <elementDefinition Id="8cc6a169-70eb-4957-92df-74cfc35178e1" /> - <covered> - <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="f174cd3c-6e07-437c-9e26-a7b8ef56af22" name="MessageOccurrenceSpecification15"> <elementDefinition Id="7fa51ceb-5d28-4194-bf5a-99af331165a7" /> <covered> <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="7df08509-74dd-4b9d-97a8-067fb38251a9" name="MessageOccurrenceSpecification16"> + <elementDefinition Id="8cc6a169-70eb-4957-92df-74cfc35178e1" /> + <covered> + <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> + </covered> + </messageOccurrenceSpecification> <behaviorExecutionSpecification Id="05ca094a-8fce-4122-a5a0-842c69592c99" name="BehaviorExecutionSpecification6"> <elementDefinition Id="fa60bf4b-c70d-4a99-af24-0b15f056a619" /> <coveredLifelines> @@ -1985,18 +1985,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="8d0e1584-cca8-49e4-a8f5-eb1982a76092" name="MessageOccurrenceSpecification27"> - <elementDefinition Id="315a2167-197a-4884-bafc-a2e86ec2ed41" /> - <covered> - <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="02f28d16-fb87-498f-8f6f-191560be050d" name="MessageOccurrenceSpecification28"> <elementDefinition Id="f781b4cc-d7cf-4caf-9ca3-15343e5bb173" /> <covered> <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="8d0e1584-cca8-49e4-a8f5-eb1982a76092" name="MessageOccurrenceSpecification27"> + <elementDefinition Id="315a2167-197a-4884-bafc-a2e86ec2ed41" /> + <covered> + <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> + </covered> + </messageOccurrenceSpecification> <behaviorExecutionSpecification Id="aacce5fc-39f9-444c-bccc-45028328533b" name="BehaviorExecutionSpecification9"> <elementDefinition Id="ded001ec-b95d-4f48-8312-a653203d4482" /> <coveredLifelines> @@ -2164,18 +2164,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="cb0a7ba3-ec3f-4ae3-8250-c7676bb828bd" name="MessageOccurrenceSpecification33"> - <elementDefinition Id="ff14005c-360d-4e94-841a-d79c5a2c700c" /> - <covered> - <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="d8323287-2344-4118-8523-2e796a58ef4e" name="MessageOccurrenceSpecification34"> <elementDefinition Id="453ee2fa-470e-4eaa-8cda-f68db0823400" /> <covered> <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="cb0a7ba3-ec3f-4ae3-8250-c7676bb828bd" name="MessageOccurrenceSpecification33"> + <elementDefinition Id="ff14005c-360d-4e94-841a-d79c5a2c700c" /> + <covered> + <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="51a43830-82bf-4398-a9ee-cde36c0afeb1" name="ExecutionOccurrenceSpecification18"> <elementDefinition Id="8fbfa7fe-642d-40f5-a8ec-e37a163a36b0" /> <event> @@ -2187,18 +2187,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="3ed18ee0-5e31-4833-91ef-4c55ad73dec9" name="MessageOccurrenceSpecification29"> - <elementDefinition Id="f30bb8f0-a8f9-40b0-aa87-6c1ed079b495" /> - <covered> - <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="e214e0d6-8e6d-4a0d-8105-fe263b2da177" name="MessageOccurrenceSpecification30"> <elementDefinition Id="fb8b076b-2cec-4202-bff2-1c36f1c9cb18" /> <covered> <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="3ed18ee0-5e31-4833-91ef-4c55ad73dec9" name="MessageOccurrenceSpecification29"> + <elementDefinition Id="f30bb8f0-a8f9-40b0-aa87-6c1ed079b495" /> + <covered> + <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="0ffdba82-3c99-4eb4-9ced-d0e610369a8a" name="ExecutionOccurrenceSpecification16"> <elementDefinition Id="7aa60581-9a67-41e6-af45-a458a7cdab49" /> <event> @@ -2390,18 +2390,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="9faf28c4-369f-4366-92e9-c118da7e9829" name="MessageOccurrenceSpecification24"> - <elementDefinition Id="1d42585a-84ee-4997-bf9f-2455203105cf" /> - <covered> - <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="329838cd-bacc-40ab-962c-31788b1e3277" name="MessageOccurrenceSpecification23"> <elementDefinition Id="e9436dc3-8123-4fe8-9aca-70998d0bc949" /> <covered> <lifelineMoniker Id="df75922f-09f1-4453-aab2-094ae9f4183e" LastKnownName="Wheels" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="9faf28c4-369f-4366-92e9-c118da7e9829" name="MessageOccurrenceSpecification24"> + <elementDefinition Id="1d42585a-84ee-4997-bf9f-2455203105cf" /> + <covered> + <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> + </covered> + </messageOccurrenceSpecification> <behaviorExecutionSpecification Id="b2ed3e1a-17ce-4024-89f2-5951d275b16d" name="BehaviorExecutionSpecification8"> <elementDefinition Id="bd050965-ab97-42d0-94b2-7eef385d8a9c" /> <coveredLifelines> @@ -2472,18 +2472,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="2f703f07-e3ca-45c8-a356-8e46fafaf77f" name="MessageOccurrenceSpecification31"> - <elementDefinition Id="d6254845-c861-484f-8be1-070d19359f9e" /> - <covered> - <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="8fc3969a-9c7e-4631-8774-84df6bc2cabd" name="MessageOccurrenceSpecification32"> <elementDefinition Id="42aafd8a-dd51-4dc2-a241-ac3982accd4e" /> <covered> <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="2f703f07-e3ca-45c8-a356-8e46fafaf77f" name="MessageOccurrenceSpecification31"> + <elementDefinition Id="d6254845-c861-484f-8be1-070d19359f9e" /> + <covered> + <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> + </covered> + </messageOccurrenceSpecification> <behaviorExecutionSpecification Id="b7feb4d7-0ee9-40a3-9043-96abe7c633b0" name="BehaviorExecutionSpecification10"> <elementDefinition Id="234fc1d9-db97-41eb-a537-282588a5d1b2" /> <coveredLifelines> @@ -2564,18 +2564,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </messageOccurrenceSpecification> - <messageOccurrenceSpecification Id="545cc109-f346-4059-a6b2-24c6dc4387a7" name="MessageOccurrenceSpecification41"> - <elementDefinition Id="794c6e0a-d848-44da-bc23-8d689bf6c51d" /> - <covered> - <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="383bd73d-587e-4ca2-b7fa-47dd0a7868e7" name="MessageOccurrenceSpecification42"> <elementDefinition Id="a45995cd-994c-47ae-be0d-109f806b8f07" /> <covered> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="545cc109-f346-4059-a6b2-24c6dc4387a7" name="MessageOccurrenceSpecification41"> + <elementDefinition Id="794c6e0a-d848-44da-bc23-8d689bf6c51d" /> + <covered> + <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="324a63a2-9ccb-408b-b1ca-40e5b02d39fb" name="ExecutionOccurrenceSpecification22"> <elementDefinition Id="cc6bf94c-4943-48e6-b8f5-fe4b24068f27" /> <event> @@ -2587,18 +2587,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="9e8b219b-ded8-42aa-8042-1f2e0d0e61d3" LastKnownName="Engine" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="01f40978-f50f-435c-a485-b0951a029b94" name="MessageOccurrenceSpecification38"> - <elementDefinition Id="5ed1eec9-f4c3-417c-848f-40ed6fc01603" /> - <covered> - <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="8b781ed4-afa8-43c6-8dc7-ef1d4eeb85c3" name="MessageOccurrenceSpecification37"> <elementDefinition Id="e84ae988-421e-4a97-8459-8da79235484f" /> <covered> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="01f40978-f50f-435c-a485-b0951a029b94" name="MessageOccurrenceSpecification38"> + <elementDefinition Id="5ed1eec9-f4c3-417c-848f-40ed6fc01603" /> + <covered> + <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="b7eee2c3-28ad-45da-91ba-25c6ac46571c" name="ExecutionOccurrenceSpecification20"> <elementDefinition Id="563588e3-3de8-41fc-8452-4e5a0dc252cf" /> <event> @@ -2610,18 +2610,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="e6fee4ba-1bf1-4ad9-8333-c4ede23f14e0" name="MessageOccurrenceSpecification34"> - <elementDefinition Id="b2d8f799-cd5d-43ce-98a4-0cca657e6adf" /> - <covered> - <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="02581308-9e0e-48e6-90b7-c9cfa6e25d31" name="MessageOccurrenceSpecification33"> <elementDefinition Id="66a01015-4f89-478b-8de7-b8e36ca15c12" /> <covered> <lifelineMoniker Id="55911250-3a82-45d0-843f-f44d3a1d3f06" LastKnownName="Clutch" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="e6fee4ba-1bf1-4ad9-8333-c4ede23f14e0" name="MessageOccurrenceSpecification34"> + <elementDefinition Id="b2d8f799-cd5d-43ce-98a4-0cca657e6adf" /> + <covered> + <lifelineMoniker Id="57a747b8-4d69-4c5a-8a78-15e428eb44ec" LastKnownName="Gearbox" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="02108544-81eb-473d-9822-003205acaf69" name="ExecutionOccurrenceSpecification18"> <elementDefinition Id="8ac78984-e930-4c45-be4c-41f4ac6a7306" /> <event> @@ -2702,18 +2702,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="df75922f-09f1-4453-aab2-094ae9f4183e" LastKnownName="Wheels" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="9a6e2dfc-1a6b-4ff4-9c90-b53335478de9" name="MessageOccurrenceSpecification18"> - <elementDefinition Id="97c31d14-272e-499f-baab-82460be06433" /> - <covered> - <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="b16fab72-ddef-44e4-b146-b225eb7efcd1" name="MessageOccurrenceSpecification17"> <elementDefinition Id="c5d6da90-e749-4847-9a11-5d7e6634e839" /> <covered> <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="9a6e2dfc-1a6b-4ff4-9c90-b53335478de9" name="MessageOccurrenceSpecification18"> + <elementDefinition Id="97c31d14-272e-499f-baab-82460be06433" /> + <covered> + <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="37f6735f-45f4-4b7b-a648-f7f5bd5f5883" name="ExecutionOccurrenceSpecification10"> <elementDefinition Id="eac74654-fe7a-4c32-abc4-d8826fd1129e" /> <event> @@ -2816,18 +2816,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="ce4294ca-83fe-4f75-b2bf-33e2a2dd15d4" name="MessageOccurrenceSpecification47"> - <elementDefinition Id="1c1e0d07-8e05-4a5f-b4d0-eefac7499e18" /> - <covered> - <lifelineMoniker Id="a3465343-fe19-49e4-858d-be0a7223e7cb" LastKnownName="Simulator" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="2e11b92d-2a27-48a3-9f7c-2ad501e4e054" name="MessageOccurrenceSpecification48"> <elementDefinition Id="2c3f480b-fd10-4a8b-a208-f523a3f7227d" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="ce4294ca-83fe-4f75-b2bf-33e2a2dd15d4" name="MessageOccurrenceSpecification47"> + <elementDefinition Id="1c1e0d07-8e05-4a5f-b4d0-eefac7499e18" /> + <covered> + <lifelineMoniker Id="a3465343-fe19-49e4-858d-be0a7223e7cb" LastKnownName="Simulator" /> + </covered> + </messageOccurrenceSpecification> <behaviorExecutionSpecification Id="135cbe64-fa23-4579-9bd4-4d14bc3825b5" name="BehaviorExecutionSpecification14"> <elementDefinition Id="ec9e0d5d-c54c-472c-9f57-693ee0c997bc" /> <coveredLifelines> @@ -2917,18 +2917,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> </covered> </executionOccurrenceSpecification> - <messageOccurrenceSpecification Id="13b0ef7c-3b7b-42c5-a140-a4936c3b4bfe" name="MessageOccurrenceSpecification56"> - <elementDefinition Id="537fb6a8-2342-44b2-9ee3-efa7509bd851" /> - <covered> - <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="bb58e4c0-0a02-4dd8-acf5-814f371e49e1" name="MessageOccurrenceSpecification55"> <elementDefinition Id="9dbc7a28-64b3-49a7-b978-043f32b8cbc3" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="13b0ef7c-3b7b-42c5-a140-a4936c3b4bfe" name="MessageOccurrenceSpecification56"> + <elementDefinition Id="537fb6a8-2342-44b2-9ee3-efa7509bd851" /> + <covered> + <lifelineMoniker Id="228a2cc1-7ca4-44ec-880b-76b9fd48c941" LastKnownName="Driver" /> + </covered> + </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="286d7e4b-3a88-4eba-83ad-295494a63176" name="MessageOccurrenceSpecification57"> <elementDefinition Id="8059b667-2bb8-45db-9cab-fd8477a62ab0" /> <covered> @@ -2991,18 +2991,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> - <messageOccurrenceSpecification Id="56855ae2-2f6e-4d89-913b-5c6d71af8b04" name="MessageOccurrenceSpecification61"> - <elementDefinition Id="97b3d7b1-5d64-4c6c-b797-0b34c9498e6b" /> - <covered> - <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="1dae1695-1e5d-4578-9c1a-0b01558916c8" name="MessageOccurrenceSpecification62"> <elementDefinition Id="46b99c2a-80db-43a0-8acf-8f0c043858bc" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="56855ae2-2f6e-4d89-913b-5c6d71af8b04" name="MessageOccurrenceSpecification61"> + <elementDefinition Id="97b3d7b1-5d64-4c6c-b797-0b34c9498e6b" /> + <covered> + <lifelineMoniker Id="b602094b-ccfa-4078-b198-49bf9545a388" LastKnownName="Vehicle" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="d5380b47-71ec-44bf-a519-5def71dc98ee" name="ExecutionOccurrenceSpecification32"> <elementDefinition Id="a0d237ed-3399-4ca5-bd3f-1b3918394131" /> <event> @@ -3115,18 +3115,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> </covered> </messageOccurrenceSpecification> - <messageOccurrenceSpecification Id="48f7d866-96a2-4b3c-a57a-7f9053cdaf2b" name="MessageOccurrenceSpecification69"> - <elementDefinition Id="65a4eee1-1527-438d-8bc6-46bf80067657" /> - <covered> - <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="8b1fddea-8e7d-4648-8585-c9622ec313d1" name="MessageOccurrenceSpecification70"> <elementDefinition Id="c0a5ade8-3b88-471c-ae4e-0dbd20c396d1" /> <covered> <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="48f7d866-96a2-4b3c-a57a-7f9053cdaf2b" name="MessageOccurrenceSpecification69"> + <elementDefinition Id="65a4eee1-1527-438d-8bc6-46bf80067657" /> + <covered> + <lifelineMoniker Id="151040ee-3253-47e4-ab7f-eda1d42486f4" LastKnownName="Axle Gear" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="64e97608-ba17-467a-a8af-56901cd539ad" name="ExecutionOccurrenceSpecification36"> <elementDefinition Id="667a1cad-9ec3-4760-a8f8-a9ee124e35e9" /> <event> @@ -3301,18 +3301,18 @@ Start Cycle 3...</body> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </messageOccurrenceSpecification> - <messageOccurrenceSpecification Id="4c1d2fb8-b382-48d5-8e84-6eec51e78548" name="MessageOccurrenceSpecification82"> - <elementDefinition Id="e01ea421-00e1-4183-a3c9-550fcd66be2c" /> - <covered> - <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> - </covered> - </messageOccurrenceSpecification> <messageOccurrenceSpecification Id="e20daacb-d986-46a9-ae6e-a804f670ba96" name="MessageOccurrenceSpecification81"> <elementDefinition Id="dd2db548-0550-40ad-b6d8-24cd51928e11" /> <covered> <lifelineMoniker Id="41baedb3-8303-43a4-a013-f492eac395ca" LastKnownName="Auxiliaries" /> </covered> </messageOccurrenceSpecification> + <messageOccurrenceSpecification Id="4c1d2fb8-b382-48d5-8e84-6eec51e78548" name="MessageOccurrenceSpecification82"> + <elementDefinition Id="e01ea421-00e1-4183-a3c9-550fcd66be2c" /> + <covered> + <lifelineMoniker Id="9606f6bf-c5f9-47c7-b643-9a908e694c63" LastKnownName="VehicleContainer" /> + </covered> + </messageOccurrenceSpecification> <executionOccurrenceSpecification Id="f22c69af-7c6f-49ff-abc5-b23a32531242" name="ExecutionOccurrenceSpecification42"> <elementDefinition Id="b7768a20-8506-4acf-a936-7c4ff11d8327" /> <event> diff --git a/VectoCoreArchitecture/Simulation.sequencediagram.layout b/VectoCoreArchitecture/Simulation.sequencediagram.layout index ae75148fe246a4ab058c2fd0be0f0c27e7d936cc..6e85428e71e431ba998d8096fc8f02fb9de2b82d 100644 --- a/VectoCoreArchitecture/Simulation.sequencediagram.layout +++ b/VectoCoreArchitecture/Simulation.sequencediagram.layout @@ -1103,7 +1103,7 @@ <commentMoniker Id="933f0530-1bee-4a27-8753-50dd1b19f465" /> <relativeChildShapes /> </commentShape> - <commentShape Id="1373bee0-2462-4404-baa3-c5ab90cfbdfd" absoluteBounds="2.625, 34, 1.25, 0.375" customColor="251, 247, 200"> + <commentShape Id="1373bee0-2462-4404-baa3-c5ab90cfbdfd" absoluteBounds="2.625, 34, 1.25, 0.5" customColor="251, 247, 200"> <commentMoniker Id="0167b631-e895-4804-b3db-829a68de9a47" /> <relativeChildShapes /> </commentShape> diff --git a/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs b/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs index 9312ca5488afd9b8059f40868f5b6fe7ab261028..88358b4f8c7f01bda09f273c3c7813f51d3ebdc7 100644 --- a/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs +++ b/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs @@ -9,103 +9,106 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Integration.EngineOnlyCycle { - [TestClass] - public class EngineOnlyCycleTest - { - private const string EngineFile = @"TestData\Components\24t Coach.veng"; - public TestContext TestContext { get; set; } + [TestClass] + public class EngineOnlyCycleTest + { + private const string EngineFile = @"TestData\Components\24t Coach.veng"; + public TestContext TestContext { get; set; } - [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\TestData\\EngineTests.csv", - "EngineTests#csv", DataAccessMethod.Sequential)] - [TestMethod] - public void TestEngineOnlyDrivingCycle() - { - var data = DrivingCycleData.ReadFromFileEngineOnly(TestContext.DataRow["CycleFile"].ToString()); - var expectedResults = ModalResults.ReadFromFile(TestContext.DataRow["ModalResultFile"].ToString()); + [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\TestData\\EngineTests.csv", + "EngineTests#csv", DataAccessMethod.Sequential)] + [TestMethod] + public void TestEngineOnlyDrivingCycle() + { + var data = DrivingCycleData.ReadFromFileEngineOnly(TestContext.DataRow["CycleFile"].ToString()); + var expectedResults = ModalResults.ReadFromFile(TestContext.DataRow["ModalResultFile"].ToString()); - var vehicle = new VehicleContainer(); - var engineData = CombustionEngineData.ReadFromFile(TestContext.DataRow["EngineFile"].ToString()); + var vehicle = new VehicleContainer(); + var engineData = CombustionEngineData.ReadFromFile(TestContext.DataRow["EngineFile"].ToString()); - var aux = new EngineOnlyAuxiliary(vehicle, new AuxiliariesDemandAdapter(data)); - var gearbox = new EngineOnlyGearbox(vehicle); + var aux = new EngineOnlyAuxiliary(vehicle, new AuxiliariesDemandAdapter(data)); + var gearbox = new EngineOnlyGearbox(vehicle); - var engine = new CombustionEngine(vehicle, engineData); + var engine = new CombustionEngine(vehicle, engineData); - aux.Connect(engine); - gearbox.Connect(aux); - var port = aux.OutShaft(); + aux.InShaft().Connect(engine); + gearbox.InShaft().Connect(aux); + var port = aux.OutShaft(); // IVectoJob job = SimulationFactory.CreateTimeBasedEngineOnlyJob(TestContext.DataRow["EngineFile"].ToString(), // TestContext.DataRow["CycleFile"].ToString(), "test2.csv"); - var absTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0); - var dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0); - - var dataWriter = new TestModalDataWriter(); - - var i = 0; - var results = new[] { - ModalResultField.n, ModalResultField.PaEng, ModalResultField.Tq_drag, ModalResultField.Pe_drag, - ModalResultField.Pe_eng, ModalResultField.Tq_eng, ModalResultField.Tq_full, ModalResultField.Pe_full - }; - //, ModalResultField.FC }; - var siFactor = new[] { 1, 1000, 1, 1000, 1000, 1, 1, 1000, 1 }; - var tolerances = new[] { 0.0001, 0.1, 0.0001, 0.1, 0.1, 0.001, 0.001, 0.1, 0.01 }; - foreach (var cycle in data.Entries) { - port.Request(absTime, dt, cycle.EngineTorque, cycle.EngineSpeed); - foreach (var sc in vehicle.SimulationComponents()) { - sc.CommitSimulationStep(dataWriter); - } - - // TODO: handle initial state of engine - var row = expectedResults.Rows[i++]; - if (i > 2) { - for (var j = 0; j < results.Length; j++) { - var field = results[j]; + var absTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0); + var dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0); + + var dataWriter = new TestModalDataWriter(); + + var i = 0; + var results = new[] { + ModalResultField.n, ModalResultField.PaEng, ModalResultField.Tq_drag, ModalResultField.Pe_drag, + ModalResultField.Pe_eng, ModalResultField.Tq_eng, ModalResultField.Tq_full, ModalResultField.Pe_full + }; + //, ModalResultField.FC }; + var siFactor = new[] { 1, 1000, 1, 1000, 1000, 1, 1, 1000, 1 }; + var tolerances = new[] { 0.0001, 0.1, 0.0001, 0.1, 0.1, 0.001, 0.001, 0.1, 0.01 }; + foreach (var cycle in data.Entries) { + port.Request(absTime, dt, cycle.EngineTorque, cycle.EngineSpeed); + foreach (var sc in vehicle.SimulationComponents()) { + sc.CommitSimulationStep(dataWriter); + } + + // TODO: handle initial state of engine + var row = expectedResults.Rows[i++]; + if (i > 2) { + for (var j = 0; j < results.Length; j++) { + var field = results[j]; // if (!Double.IsNaN(dataWriter.GetDouble(field))) - Assert.AreEqual((double) row[field.GetName()] * siFactor[j], dataWriter.GetDouble(field), tolerances[j], - String.Format("t: {0} field: {1}", i, field)); - } - if (row[ModalResultField.FC.GetName()] is double) { - Assert.AreEqual((double) row[ModalResultField.FC.GetName()], dataWriter.GetDouble(ModalResultField.FC), 0.01, - "t: {0} field: {1}", i, ModalResultField.FC); - } else { - Assert.IsTrue(Double.IsNaN(dataWriter.GetDouble(ModalResultField.FC)), String.Format("t: {0}", i)); - } - } - - dataWriter.CommitSimulationStep(absTime, dt); - absTime += dt; - } - dataWriter.Data.WriteToFile("test2.csv"); - } - - [TestMethod] - public void AssembleEngineOnlyPowerTrain() - { - var dataWriter = new TestModalDataWriter(); - - var vehicleContainer = new VehicleContainer(); - - var gearbox = new EngineOnlyGearbox(vehicleContainer); - var engine = new CombustionEngine(vehicleContainer, CombustionEngineData.ReadFromFile(EngineFile)); - - gearbox.InShaft().Connect(engine.OutShaft()); - - var absTime = new TimeSpan(); - var dt = TimeSpan.FromSeconds(1); - - var angularVelocity = 644.4445.RPMtoRad(); - var power = 2329.973.SI<Watt>(); - - gearbox.Request(absTime, dt, Formulas.PowerToTorque(power, angularVelocity), angularVelocity); - - foreach (var sc in vehicleContainer.SimulationComponents()) { - sc.CommitSimulationStep(dataWriter); - } - - Assert.IsNotNull(dataWriter.CurrentRow); - } - } + Assert.AreEqual((double) row[field.GetName()] * siFactor[j], dataWriter.GetDouble(field), + tolerances[j], + String.Format("t: {0} field: {1}", i, field)); + } + if (row[ModalResultField.FC.GetName()] is double) { + Assert.AreEqual((double) row[ModalResultField.FC.GetName()], + dataWriter.GetDouble(ModalResultField.FC), 0.01, + "t: {0} field: {1}", i, ModalResultField.FC); + } else { + Assert.IsTrue(Double.IsNaN(dataWriter.GetDouble(ModalResultField.FC)), + String.Format("t: {0}", i)); + } + } + + dataWriter.CommitSimulationStep(absTime, dt); + absTime += dt; + } + dataWriter.Data.WriteToFile("test2.csv"); + } + + [TestMethod] + public void AssembleEngineOnlyPowerTrain() + { + var dataWriter = new TestModalDataWriter(); + + var vehicleContainer = new VehicleContainer(); + + var gearbox = new EngineOnlyGearbox(vehicleContainer); + var engine = new CombustionEngine(vehicleContainer, CombustionEngineData.ReadFromFile(EngineFile)); + + gearbox.InShaft().Connect(engine.OutShaft()); + + var absTime = new TimeSpan(); + var dt = TimeSpan.FromSeconds(1); + + var angularVelocity = 644.4445.RPMtoRad(); + var power = 2329.973.SI<Watt>(); + + gearbox.OutShaft().Request(absTime, dt, Formulas.PowerToTorque(power, angularVelocity), angularVelocity); + + foreach (var sc in vehicleContainer.SimulationComponents()) { + sc.CommitSimulationStep(dataWriter); + } + + Assert.IsNotNull(dataWriter.CurrentRow); + } + } } \ No newline at end of file diff --git a/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs b/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs index e5c4f3a179a8dbe84adcdb5ed85cf1e44493b69b..fed1acc518e77191ac550ada18debb9d8436c498 100644 --- a/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs +++ b/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs @@ -10,88 +10,91 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] - public class DrivingCycleTests - { - [TestMethod] - public void TestEngineOnly() - { - var container = new VehicleContainer(); + [TestClass] + public class DrivingCycleTests + { + [TestMethod] + public void TestEngineOnly() + { + var container = new VehicleContainer(); - var cycleData = DrivingCycleData.ReadFromFileEngineOnly(@"TestData\Cycles\Coach Engine Only.vdri"); - var cycle = new EngineOnlyDrivingCycle(container, cycleData); + var cycleData = DrivingCycleData.ReadFromFileEngineOnly(@"TestData\Cycles\Coach Engine Only.vdri"); + var cycle = new EngineOnlyDrivingCycle(container, cycleData); - var outPort = new MockTnOutPort(); - var inPort = cycle.InShaft(); + var outPort = new MockTnOutPort(); + var inPort = cycle.InShaft(); + var cycleOut = cycle.OutPort(); - inPort.Connect(outPort); + inPort.Connect(outPort); - var absTime = new TimeSpan(); - var dt = TimeSpan.FromSeconds(1); + var absTime = new TimeSpan(); + var dt = TimeSpan.FromSeconds(1); - var response = cycle.Request(absTime, dt); - Assert.IsInstanceOfType(response, typeof (ResponseSuccess)); + var response = cycleOut.Request(absTime, dt); + Assert.IsInstanceOfType(response, typeof (ResponseSuccess)); - var dataWriter = new TestModalDataWriter(); - container.CommitSimulationStep(dataWriter); + var dataWriter = new TestModalDataWriter(); + container.CommitSimulationStep(dataWriter); - Assert.AreEqual(absTime, outPort.AbsTime); - Assert.AreEqual(dt, outPort.Dt); - Assert.AreEqual(600.0.RPMtoRad(), outPort.AngularFrequency); - Assert.AreEqual(0.SI<NewtonMeter>(), outPort.Torque); - } + Assert.AreEqual(absTime, outPort.AbsTime); + Assert.AreEqual(dt, outPort.Dt); + Assert.AreEqual(600.0.RPMtoRad(), outPort.AngularFrequency); + Assert.AreEqual(0.SI<NewtonMeter>(), outPort.Torque); + } - [TestMethod] - public void Test_TimeBased_FirstCycle() - { - var container = new VehicleContainer(); + [TestMethod] + public void Test_TimeBased_FirstCycle() + { + var container = new VehicleContainer(); - var cycleData = DrivingCycleData.ReadFromFileTimeBased(@"TestData\Cycles\Coach time based.vdri"); - var cycle = new TimeBasedDrivingCycle(container, cycleData); + var cycleData = DrivingCycleData.ReadFromFileTimeBased(@"TestData\Cycles\Coach time based.vdri"); + var cycle = new TimeBasedDrivingCycle(container, cycleData); - var outPort = new MockDriverDemandOutPort(); + var outPort = new MockDriverDemandOutPort(); - var inPort = cycle.InPort(); + var inPort = cycle.InPort(); + var cycleOut = cycle.OutPort(); - inPort.Connect(outPort); + inPort.Connect(outPort); - var absTime = new TimeSpan(); - var dt = TimeSpan.FromSeconds(1); + var absTime = new TimeSpan(); + var dt = TimeSpan.FromSeconds(1); - var response = cycle.Request(absTime, dt); - Assert.IsInstanceOfType(response, typeof (ResponseSuccess)); + var response = cycleOut.Request(absTime, dt); + Assert.IsInstanceOfType(response, typeof (ResponseSuccess)); - Assert.AreEqual(absTime, outPort.AbsTime); - Assert.AreEqual(dt, outPort.Dt); - Assert.AreEqual(0.0.SI<MeterPerSecond>(), outPort.Velocity); - Assert.AreEqual(-0.020237973, outPort.Gradient); - } + Assert.AreEqual(absTime, outPort.AbsTime); + Assert.AreEqual(dt, outPort.Dt); + Assert.AreEqual(0.0.SI<MeterPerSecond>(), outPort.Velocity); + Assert.AreEqual((-0.020237973).SI().GradientPercent.To<Radian>(), outPort.Gradient); + } - [TestMethod] - public void Test_TimeBased_TimeFieldMissing() - { - var container = new VehicleContainer(); + [TestMethod] + public void Test_TimeBased_TimeFieldMissing() + { + var container = new VehicleContainer(); - var cycleData = DrivingCycleData.ReadFromFileTimeBased(@"TestData\Cycles\Cycle time field missing.vdri"); - var cycle = new TimeBasedDrivingCycle(container, cycleData); + var cycleData = DrivingCycleData.ReadFromFileTimeBased(@"TestData\Cycles\Cycle time field missing.vdri"); + var cycle = new TimeBasedDrivingCycle(container, cycleData); - var outPort = new MockDriverDemandOutPort(); + var outPort = new MockDriverDemandOutPort(); - var inPort = cycle.InPort(); + var inPort = cycle.InPort(); + var cycleOut = cycle.OutPort(); - inPort.Connect(outPort); + inPort.Connect(outPort); - var dataWriter = new TestModalDataWriter(); - var absTime = new TimeSpan(); - var dt = TimeSpan.FromSeconds(1); + var dataWriter = new TestModalDataWriter(); + var absTime = new TimeSpan(); + var dt = TimeSpan.FromSeconds(1); - while (cycle.Request(absTime, dt) is ResponseSuccess) { - Assert.AreEqual(absTime, outPort.AbsTime); - Assert.AreEqual(dt, outPort.Dt); - container.CommitSimulationStep(dataWriter); + while (cycleOut.Request(absTime, dt) is ResponseSuccess) { + Assert.AreEqual(absTime, outPort.AbsTime); + Assert.AreEqual(dt, outPort.Dt); + container.CommitSimulationStep(dataWriter); - absTime += dt; - } - } - } + absTime += dt; + } + } + } } \ No newline at end of file diff --git a/VectoCoreTest/Models/Simulation/SimulationTests.cs b/VectoCoreTest/Models/Simulation/SimulationTests.cs index e20a04cab733b2b64beb3c37de71134681a74bec..a4fe1e3ac6cf03c53b4bdc6e5d9945a169be85aa 100644 --- a/VectoCoreTest/Models/Simulation/SimulationTests.cs +++ b/VectoCoreTest/Models/Simulation/SimulationTests.cs @@ -7,88 +7,89 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] - public class SimulationTests - { - private const string EngineFile = @"TestData\Components\24t Coach.veng"; - private const string CycleFile = @"TestData\Cycles\Coach Engine Only.vdri"; - - [TestMethod] - public void TestSimulationEngineOnly() - { - var job = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, "TestEngineOnly-result.vmod"); - - var container = job.GetContainer(); - - Assert.AreEqual(560.0.RPMtoRad(), container.EngineSpeed()); - Assert.AreEqual(0U, container.Gear()); - - try { - container.VehicleSpeed(); - Assert.Fail("Access to Vehicle speed should fail, because there should be no vehicle in EngineOnly Mode."); - } catch (VectoException ex) { - Assert.AreEqual(ex.Message, "no vehicle available!", "Vehicle speed wrong exception message."); - } - } - - [TestMethod] - public void TestEngineOnly_JobRun() - { - var resultFileName = "TestEngineOnly_JobRun-result.vmod"; - var expectedResultsName = @"TestData\Results\EngineOnlyCycles\24tCoach_EngineOnly.vmod"; - - var job = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, resultFileName); - job.Run(); - - var results = ModalResults.ReadFromFile(resultFileName); - var expectedResults = ModalResults.ReadFromFile(expectedResultsName); - - Assert.AreEqual(expectedResults.Rows.Count, results.Rows.Count, "Moddata: Row count differs."); - - for (var i = 0; i < expectedResults.Rows.Count; i++) { - var row = results.Rows[i]; - var expectedRow = expectedResults.Rows[i]; - - foreach (DataColumn col in expectedResults.Columns) { - Assert.AreEqual(expectedRow[col], row[col], "Moddata: Value differs (Row {0}, Col {1}): {2} != {3}"); - } - } - } - - [TestMethod] - public void TestEngineOnly_SimulatorRun() - { - var sim = new JobContainer(); - var job = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, - "TestEngineOnly-SimulatorRun-result.vmod"); - sim.AddJob(job); - sim.RunSimulation(); - - // todo: Add additional assertions. - Assert.Fail("Todo: Add additional assertions."); - } - - [TestMethod] - public void TestEngineOnly_MultipleJobs() - { - var simulation = new JobContainer(); - - var sim1 = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, - "TestEngineOnly-MultipleJobs-result1.vmod"); - simulation.AddJob(sim1); - - var sim2 = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, - "TestEngineOnly-MultipleJobs-result2.vmod"); - simulation.AddJob(sim2); - - var sim3 = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, - "TestEngineOnly-MultipleJobs-result3.vmod"); - simulation.AddJob(sim3); - - simulation.RunSimulation(); - - // todo: Add additional assertions. - Assert.Fail("Todo: Add additional assertions."); - } - } + [TestClass] + public class SimulationTests + { + private const string EngineFile = @"TestData\Components\24t Coach.veng"; + private const string CycleFile = @"TestData\Cycles\Coach Engine Only.vdri"; + + [TestMethod] + public void TestSimulationEngineOnly() + { + var job = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, "TestEngineOnly-result.vmod"); + + var container = job.GetContainer(); + + Assert.AreEqual(560.0.RPMtoRad(), container.EngineSpeed()); + Assert.AreEqual(0U, container.Gear()); + + try { + container.VehicleSpeed(); + Assert.Fail( + "Access to Vehicle speed should fail, because there should be no vehicle in EngineOnly Mode."); + } catch (VectoException ex) { + Assert.AreEqual(ex.Message, "no vehicle available!", "Vehicle speed wrong exception message."); + } + } + + [TestMethod] + public void TestEngineOnly_JobRun() + { + var resultFileName = "TestEngineOnly_JobRun-result.vmod"; + var expectedResultsName = @"TestData\Results\EngineOnlyCycles\24tCoach_EngineOnly.vmod"; + + var job = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, resultFileName); + job.Run(); + + var results = ModalResults.ReadFromFile(resultFileName); + var expectedResults = ModalResults.ReadFromFile(expectedResultsName); + + Assert.AreEqual(expectedResults.Rows.Count, results.Rows.Count, "Moddata: Row count differs."); + + for (var i = 0; i < expectedResults.Rows.Count; i++) { + var row = results.Rows[i]; + var expectedRow = expectedResults.Rows[i]; + + foreach (DataColumn col in expectedResults.Columns) { + Assert.AreEqual(expectedRow[col], row[col], "Moddata: Value differs (Row {0}, Col {1}): {2} != {3}"); + } + } + } + + [TestMethod] + public void TestEngineOnly_SimulatorRun() + { + var sim = new JobContainer(); + var job = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, + "TestEngineOnly-SimulatorRun-result.vmod"); + sim.AddJob(job); + sim.RunSimulation(); + + // todo: Add additional assertions. + Assert.Fail("Todo: Add additional assertions."); + } + + [TestMethod] + public void TestEngineOnly_MultipleJobs() + { + var simulation = new JobContainer(); + + var sim1 = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, + "TestEngineOnly-MultipleJobs-result1.vmod"); + simulation.AddJob(sim1); + + var sim2 = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, + "TestEngineOnly-MultipleJobs-result2.vmod"); + simulation.AddJob(sim2); + + var sim3 = SimulatorFactory.CreateTimeBasedEngineOnlyJob(EngineFile, CycleFile, + "TestEngineOnly-MultipleJobs-result3.vmod"); + simulation.AddJob(sim3); + + simulation.RunSimulation(); + + // todo: Add additional assertions. + Assert.Fail("Todo: Add additional assertions."); + } + } } \ No newline at end of file diff --git a/VectoCoreTest/Models/SimulationComponent/MockPorts.cs b/VectoCoreTest/Models/SimulationComponent/MockPorts.cs index 77617c0b32204491d9cfb0f62f67aec8a4cbd752..46bd7188f3a2b00464b48a1c29a02e387a710530 100644 --- a/VectoCoreTest/Models/SimulationComponent/MockPorts.cs +++ b/VectoCoreTest/Models/SimulationComponent/MockPorts.cs @@ -6,41 +6,41 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent { - public class MockTnOutPort : ITnOutPort - { - public TimeSpan AbsTime { get; set; } - public TimeSpan Dt { get; set; } - public NewtonMeter Torque { get; set; } - public RadianPerSecond AngularFrequency { get; set; } + public class MockTnOutPort : ITnOutPort + { + public TimeSpan AbsTime { get; set; } + public TimeSpan Dt { get; set; } + public NewtonMeter Torque { get; set; } + public RadianPerSecond AngularFrequency { get; set; } - public IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond angularFrequency) - { - AbsTime = absTime; - Dt = dt; - Torque = torque; - AngularFrequency = angularFrequency; - LogManager.GetLogger(GetType()).DebugFormat("Request: absTime: {0}, dt: {1}, torque: {3}, engineSpeed: {4}", - absTime, dt, torque, angularFrequency); - return new ResponseSuccess(); - } - } + public IResponse Request(TimeSpan absTime, TimeSpan dt, NewtonMeter torque, RadianPerSecond angularFrequency) + { + AbsTime = absTime; + Dt = dt; + Torque = torque; + AngularFrequency = angularFrequency; + LogManager.GetLogger(GetType()).DebugFormat("Request: absTime: {0}, dt: {1}, torque: {3}, engineSpeed: {4}", + absTime, dt, torque, angularFrequency); + return new ResponseSuccess(); + } + } - public class MockDriverDemandOutPort : IDriverDemandOutPort - { - public TimeSpan AbsTime { get; set; } - public TimeSpan Dt { get; set; } - public MeterPerSecond Velocity { get; set; } - public double Gradient { get; set; } + public class MockDriverDemandOutPort : IDriverDemandOutPort + { + public TimeSpan AbsTime { get; set; } + public TimeSpan Dt { get; set; } + public MeterPerSecond Velocity { get; set; } + public Radian Gradient { get; set; } - public IResponse Request(TimeSpan absTime, TimeSpan dt, MeterPerSecond velocity, double gradient) - { - AbsTime = absTime; - Dt = dt; - Velocity = velocity; - Gradient = gradient; - LogManager.GetLogger(GetType()).DebugFormat("Request: absTime: {0}, dt: {1}, velocity: {3}, gradient: {4}", - absTime, dt, velocity, gradient); - return new ResponseSuccess(); - } - } + public IResponse Request(TimeSpan absTime, TimeSpan dt, MeterPerSecond velocity, Radian gradient) + { + AbsTime = absTime; + Dt = dt; + Velocity = velocity; + Gradient = gradient; + LogManager.GetLogger(GetType()).DebugFormat("Request: absTime: {0}, dt: {1}, velocity: {3}, gradient: {4}", + absTime, dt, velocity, gradient); + return new ResponseSuccess(); + } + } } \ No newline at end of file