diff --git a/Technik_FITIPC 2015-09-24 09_36_37.coveragexml b/Technik_FITIPC 2015-09-24 09_36_37.coveragexml new file mode 100644 index 0000000000000000000000000000000000000000..5ca46500c508e8bb506cbcffd478fb5a20213cba Binary files /dev/null and b/Technik_FITIPC 2015-09-24 09_36_37.coveragexml differ diff --git a/VectoCore/Configuration/Constants.cs b/VectoCore/Configuration/Constants.cs index 4e2fa821770d0c5b9935b93b9e796c1b725bd953..7d535c09faa2012d45b4471879cd59b2e0664fbf 100644 --- a/VectoCore/Configuration/Constants.cs +++ b/VectoCore/Configuration/Constants.cs @@ -81,6 +81,10 @@ namespace TUGraz.VectoCore.Configuration /// The initial search interval for the operating point search in the driver. /// </summary> public static MeterPerSquareSecond OperatingPointInitialSearchIntervalAccelerating = 0.1.SI<MeterPerSquareSecond>(); + + public static PerSecond EngineIdlingSearchInterval = 10.SI<PerSecond>(); + + public const int EngineSearchLoopThreshold = 100; } } } \ No newline at end of file diff --git a/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs b/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs index a6c0bed0bbc2750f98b4e204de0ae8818b806f3d..e89301e83a81b221b6d945dcbb25ec7b3fb1a784 100644 --- a/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs +++ b/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs @@ -399,12 +399,7 @@ namespace TUGraz.VectoCore.FileIO.Reader if (row.Field<string>(Fields.EnginePower).Equals("<DRAG>")) { entry.Drag = true; } else { - entry.EngineTorque = - Formulas.PowerToTorque( - row.ParseDouble(Fields.EnginePower) - .SI() - .Kilo.Watt.Cast<Watt>(), - entry.EngineSpeed); + entry.EngineTorque = row.ParseDouble(Fields.EnginePower).SI().Kilo.Watt.Cast<Watt>() / entry.EngineSpeed; } } entry.Time = absTime; diff --git a/VectoCore/Models/Connector/Ports/IResponse.cs b/VectoCore/Models/Connector/Ports/IResponse.cs index 9fac9e0f9870b4e0b076bdfb6193459a0571bdb2..f45df78813ebd0612f0492bef1c595dee399b5c9 100644 --- a/VectoCore/Models/Connector/Ports/IResponse.cs +++ b/VectoCore/Models/Connector/Ports/IResponse.cs @@ -18,6 +18,8 @@ namespace TUGraz.VectoCore.Models.Connector.Ports Watt EnginePowerRequest { get; set; } + Watt AuxiliariesPowerDemand { get; set; } + Watt ClutchPowerRequest { get; set; } Watt GearboxPowerRequest { get; set; } diff --git a/VectoCore/Models/Connector/Ports/Impl/Response.cs b/VectoCore/Models/Connector/Ports/Impl/Response.cs index be9194b0b1877af332433446f7be1e5b8050a9c5..61b70770f523fca10516ff25a1fe511adebd6424 100644 --- a/VectoCore/Models/Connector/Ports/Impl/Response.cs +++ b/VectoCore/Models/Connector/Ports/Impl/Response.cs @@ -15,6 +15,8 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl public Watt EnginePowerRequest { get; set; } + public Watt AuxiliariesPowerDemand { get; set; } + public Watt ClutchPowerRequest { get; set; } public Watt GearboxPowerRequest { get; set; } diff --git a/VectoCore/Models/Simulation/Data/ModalResult.cs b/VectoCore/Models/Simulation/Data/ModalResult.cs index 35d0da032ec222c5ef7e4576bb4abee06e9fd498..9e9ee824357588f099661d0be271c65701c7ac6f 100644 --- a/VectoCore/Models/Simulation/Data/ModalResult.cs +++ b/VectoCore/Models/Simulation/Data/ModalResult.cs @@ -149,7 +149,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// <summary> /// [g/h] Fuel consumption from FC map.. /// </summary> - [ModalResultField(typeof(SI), name: "FC-Map", caption: "FC-Map [g/h]", outputFactor: 3600)] FCMap, + [ModalResultField(typeof(SI), name: "FC-Map", caption: "FC-Map [g/h]", outputFactor: 3600 * 1000)] FCMap, /// <summary> /// [g/h] Fuel consumption after Auxiliary-Start/Stop Correction. (Based on FC.) diff --git a/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 052aaf2825af0bc00d62478132e6c7ddfcea99e6..3ce4cc26db60640e81c506b569fb389f0225113a 100644 --- a/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -70,8 +70,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl break; } + var engine = new CombustionEngine(_container, data.EngineData); + var clutch = new Clutch(_container, data.EngineData, engine.IdleController); + // gearbox --> clutch - tmp = AddComponent(tmp, new Clutch(_container, data.EngineData)); + tmp = AddComponent(tmp, clutch); // clutch --> direct aux --> ... --> aux_XXX --> directAux @@ -94,7 +97,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl tmp = AddComponent(tmp, aux); } // connect aux --> engine - AddComponent(tmp, new CombustionEngine(_container, data.EngineData)); + AddComponent(tmp, engine); + + engine.IdleController.RequestPort = clutch.IdleControlPort; return _container; } diff --git a/VectoCore/Models/SimulationComponent/IClutch.cs b/VectoCore/Models/SimulationComponent/IClutch.cs index 64ee08e9f8675a4c6090c74624d2e06b6db7b943..78ca0c1358d6098cd94a4c9f6a778dbe97432cf9 100644 --- a/VectoCore/Models/SimulationComponent/IClutch.cs +++ b/VectoCore/Models/SimulationComponent/IClutch.cs @@ -1,4 +1,6 @@ -namespace TUGraz.VectoCore.Models.SimulationComponent +using TUGraz.VectoCore.Models.Connector.Ports; + +namespace TUGraz.VectoCore.Models.SimulationComponent { public enum ClutchState { @@ -7,5 +9,8 @@ ClutchSlipping } - public interface IClutch : IPowerTrainComponent {} + public interface IClutch : IPowerTrainComponent + { + ITnOutPort IdleControlPort { get; } + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/ICombustionEngine.cs b/VectoCore/Models/SimulationComponent/ICombustionEngine.cs index 6626e33d7ec3b2e00aef279d8ee3e820bfcda90f..d795974b9a05d7e26b65d21e73252c9a4c3b69e0 100644 --- a/VectoCore/Models/SimulationComponent/ICombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/ICombustionEngine.cs @@ -6,5 +6,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent /// <summary> /// Defines Interfaces for a combustion engine. /// </summary> - public interface ICombustionEngine : ITnOutProvider, IEngineInfo {} + public interface ICombustionEngine : ITnOutProvider, IEngineInfo + { + ICombustionEngineIdleController IdleController { get; } + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/ICombustionEngineIdleController.cs b/VectoCore/Models/SimulationComponent/ICombustionEngineIdleController.cs new file mode 100644 index 0000000000000000000000000000000000000000..e1466b6a711d4d7be7726d619c71583dde5d47c0 --- /dev/null +++ b/VectoCore/Models/SimulationComponent/ICombustionEngineIdleController.cs @@ -0,0 +1,12 @@ +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface ICombustionEngineIdleController : ITnOutPort + { + ITnOutPort RequestPort { set; } + + void Reset(); + } +} \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs b/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs index 1678834d748e6b95fa6d7bde740555ac2d402431..a9305a7974cf123a053ed4f1b9c344ffc1758c46 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs @@ -54,7 +54,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var currentAngularVelocity = angularVelocity ?? DataBus.EngineSpeed; var powerDemand = ComputePowerDemand(currentAngularVelocity); - return NextComponent.Request(absTime, dt, torque + powerDemand / currentAngularVelocity, angularVelocity, dryRun); + var retVal = NextComponent.Request(absTime, dt, torque + powerDemand / currentAngularVelocity, angularVelocity, + dryRun); + retVal.AuxiliariesPowerDemand = powerDemand; + return retVal; } private Watt ComputePowerDemand(PerSecond engineSpeed) @@ -70,10 +73,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return powerDemand; } - public IResponse Initialize(NewtonMeter torque, PerSecond engineSpeed) + public IResponse Initialize(NewtonMeter torque, PerSecond angularSpeed) { - var powerDemand = ComputePowerDemand(engineSpeed); - return NextComponent.Initialize(torque + powerDemand / engineSpeed, engineSpeed); + var powerDemand = ComputePowerDemand(angularSpeed); + return NextComponent.Initialize(torque + powerDemand / angularSpeed, angularSpeed); } #endregion diff --git a/VectoCore/Models/SimulationComponent/Impl/Brakes.cs b/VectoCore/Models/SimulationComponent/Impl/Brakes.cs index d37861b0e38e2d99950e0912e2008a38d299cf43..acaba8dbfcff514bf2c279d2b3d063064c664e39 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Brakes.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Brakes.cs @@ -34,7 +34,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (angularVelocity.IsEqual(0)) { BreakTorque = torque; } else { - BreakTorque = Formulas.PowerToTorque(BreakPower, angularVelocity); + BreakTorque = BreakPower / angularVelocity; } } if (!dryRun && BreakPower < 0) { diff --git a/VectoCore/Models/SimulationComponent/Impl/Clutch.cs b/VectoCore/Models/SimulationComponent/Impl/Clutch.cs index 7efc5dcbbbcbd94ef6c7af6818a32dc0551cc5df..76ec4161601b7a2b5ab5dbc9246be9811603c2e4 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Clutch.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Clutch.cs @@ -17,12 +17,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private const double ClutchEff = 1; private ClutchState _clutchState = SimulationComponent.ClutchState.ClutchSlipping; + protected ICombustionEngineIdleController IdleController; - public Clutch(IVehicleContainer cockpit, CombustionEngineData engineData) + + public Clutch(IVehicleContainer cockpit, CombustionEngineData engineData, + ICombustionEngineIdleController idleController) : base(cockpit) { _idleSpeed = engineData.IdleSpeed; _ratedSpeed = engineData.FullLoadCurve.RatedSpeed; + IdleController = idleController; } public ClutchState State() @@ -53,13 +57,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return this; } + public ITnOutPort IdleControlPort + { + get { return NextComponent; } + } + public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun = false) { if (angularVelocity == null) { - var retval = NextComponent.Request(absTime, dt, torque, null, dryRun); + //var retval = NextComponent.Request(absTime, dt, torque, null, dryRun); + var retval = IdleController.Request(absTime, dt, torque, null, dryRun); retval.ClutchPowerRequest = 0.SI<Watt>(); return retval; } + if (IdleController != null) { + IdleController.Reset(); + } NewtonMeter torqueIn; PerSecond engineSpeedIn; AddClutchLoss(torque, angularVelocity, out torqueIn, out engineSpeedIn); @@ -112,7 +125,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ((clutchSpeedNorm * engineSpeed0 / _ratedSpeed) * (_ratedSpeed - _idleSpeed) + _idleSpeed).Radian .Cast<PerSecond>(); - torqueIn = Formulas.PowerToTorque(Formulas.TorqueToPower(torque, angularVelocity) / ClutchEff, engineSpeedIn); + torqueIn = ((torque * angularVelocity) / ClutchEff / engineSpeedIn); } else { _clutchState = SimulationComponent.ClutchState.ClutchClosed; } diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 718b6c243005a025a0ccd9ec0268fc7b8e1aaa68..1ee267143bc2f362cc67c18a9b7ee8c0dc152001 100644 --- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -1,5 +1,8 @@ using System; +using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using System.Resources; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Connector.Ports; @@ -42,19 +45,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl internal EngineState PreviousState = new EngineState(); - private readonly CombustionEngineData _data; + protected readonly CombustionEngineData Data; public CombustionEngine(IVehicleContainer cockpit, CombustionEngineData data) : base(cockpit) { - _data = data; + Data = data; PreviousState.OperationMode = EngineOperationMode.Idle; PreviousState.EnginePower = 0.SI<Watt>(); - PreviousState.EngineSpeed = _data.IdleSpeed; + PreviousState.EngineSpeed = Data.IdleSpeed; PreviousState.dt = 1.SI<Second>(); - StationaryIdleFullLoadPower = _data.FullLoadCurve.FullLoadStationaryTorque(_data.IdleSpeed) * _data.IdleSpeed; + StationaryIdleFullLoadPower = Data.FullLoadCurve.FullLoadStationaryTorque(Data.IdleSpeed) * Data.IdleSpeed; } #region IEngineCockpit @@ -66,19 +69,26 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Watt EngineStationaryFullPower(PerSecond angularSpeed) { - return _data.FullLoadCurve.FullLoadStationaryTorque(angularSpeed) * angularSpeed; + return Data.FullLoadCurve.FullLoadStationaryTorque(angularSpeed) * angularSpeed; } public PerSecond EngineIdleSpeed { - get { return _data.IdleSpeed; } + get { return Data.IdleSpeed; } } public PerSecond EngineRatedSpeed { - get { return _data.FullLoadCurve.RatedSpeed; } + get { return Data.FullLoadCurve.RatedSpeed; } } + public ICombustionEngineIdleController IdleController + { + get { return EngineIdleController ?? (EngineIdleController = new CombustionEngineIdleController(this)); } + } + + protected CombustionEngineIdleController EngineIdleController { get; set; } + #endregion #region ITnOutProvider @@ -133,49 +143,47 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl UpdateEngineState(CurrentState.EnginePower); // = requestedEnginePower; //todo + _currentState.EnginePowerLoss; - CurrentState.EngineTorque = Formulas.PowerToTorque(CurrentState.EnginePower, - CurrentState.EngineSpeed); + CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed; return new ResponseSuccess { EnginePowerRequest = requestedEnginePower }; } - protected void ComputeRequestedEnginePower(Second absTime, Second dt, NewtonMeter torque, PerSecond engineSpeed, + protected void ComputeRequestedEnginePower(Second absTime, Second dt, NewtonMeter torque, PerSecond angularSpeed, out Watt requestedPower, out Watt requestedEnginePower) { CurrentState.dt = dt; - CurrentState.EngineSpeed = engineSpeed; + CurrentState.EngineSpeed = angularSpeed; CurrentState.AbsTime = absTime; - requestedPower = torque * engineSpeed; - CurrentState.EnginePowerLoss = Formulas.InertiaPower(engineSpeed, PreviousState.EngineSpeed, _data.Inertia, dt); + requestedPower = torque * angularSpeed; + CurrentState.EnginePowerLoss = Formulas.InertiaPower(angularSpeed, PreviousState.EngineSpeed, Data.Inertia, dt); requestedEnginePower = requestedPower + CurrentState.EnginePowerLoss; - if (engineSpeed < _data.IdleSpeed.Value() - EngineIdleSpeedStopThreshold) { + if (angularSpeed < Data.IdleSpeed.Value() - EngineIdleSpeedStopThreshold) { CurrentState.OperationMode = EngineOperationMode.Stopped; //todo: _currentState.EnginePowerLoss = enginePowerLoss; } - CurrentState.FullDragTorque = _data.FullLoadCurve.DragLoadStationaryTorque(engineSpeed); - CurrentState.FullDragPower = Formulas.TorqueToPower(CurrentState.FullDragTorque, engineSpeed); + CurrentState.FullDragTorque = Data.FullLoadCurve.DragLoadStationaryTorque(angularSpeed); + CurrentState.FullDragPower = CurrentState.FullDragTorque * angularSpeed; } - public IResponse Initialize(NewtonMeter torque, PerSecond engineSpeed) + public IResponse Initialize(NewtonMeter torque, PerSecond angularSpeed) { PreviousState = new EngineState { - EngineSpeed = engineSpeed, + EngineSpeed = angularSpeed, dt = 1.SI<Second>(), EnginePowerLoss = 0.SI<Watt>(), StationaryFullLoadTorque = - _data.FullLoadCurve.FullLoadStationaryTorque(engineSpeed), - FullDragTorque = _data.FullLoadCurve.DragLoadStationaryTorque(engineSpeed), + Data.FullLoadCurve.FullLoadStationaryTorque(angularSpeed), + FullDragTorque = Data.FullLoadCurve.DragLoadStationaryTorque(angularSpeed), EngineTorque = torque, - EnginePower = Formulas.TorqueToPower(torque, engineSpeed) + EnginePower = torque * angularSpeed, }; - PreviousState.StationaryFullLoadPower = Formulas.TorqueToPower(PreviousState.StationaryFullLoadTorque, - engineSpeed); + PreviousState.StationaryFullLoadPower = PreviousState.StationaryFullLoadTorque * angularSpeed; PreviousState.DynamicFullLoadTorque = PreviousState.StationaryFullLoadTorque; PreviousState.DynamicFullLoadPower = PreviousState.StationaryFullLoadPower; - PreviousState.FullDragPower = Formulas.TorqueToPower(PreviousState.FullDragTorque, engineSpeed); + PreviousState.FullDragPower = PreviousState.FullDragTorque * angularSpeed; return new ResponseSuccess { Source = this, EnginePowerRequest = PreviousState.EnginePower }; } @@ -198,9 +206,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl try { writer[ModalResultField.FCMap] = - _data.ConsumptionMap.GetFuelConsumption(CurrentState.EngineTorque, CurrentState.EngineSpeed) - .ConvertTo() - .Gramm.Per.Hour; + Data.ConsumptionMap.GetFuelConsumption(CurrentState.EngineTorque, CurrentState.EngineSpeed); } catch (VectoException ex) { Log.Warn("t: {0} - {1} n: {2} Tq: {3}", CurrentState.AbsTime, ex.Message, CurrentState.EngineSpeed, CurrentState.EngineTorque); @@ -273,11 +279,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //_currentState.StationaryFullLoadPower = _data.GetFullLoadCurve(gear).FullLoadStationaryPower(rpm); CurrentState.StationaryFullLoadTorque = - _data.FullLoadCurve.FullLoadStationaryTorque(angularVelocity); - CurrentState.StationaryFullLoadPower = Formulas.TorqueToPower(CurrentState.StationaryFullLoadTorque, - angularVelocity); + Data.FullLoadCurve.FullLoadStationaryTorque(angularVelocity); + CurrentState.StationaryFullLoadPower = CurrentState.StationaryFullLoadTorque * angularVelocity; - double pt1 = _data.FullLoadCurve.PT1(angularVelocity).Value(); + double pt1 = Data.FullLoadCurve.PT1(angularVelocity).Value(); // var dynFullPowerCalculated = (1 / (pt1 + 1)) * // (_currentState.StationaryFullLoadPower + pt1 * _previousState.EnginePower); @@ -290,12 +295,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ? dynFullPowerCalculated : CurrentState.StationaryFullLoadPower; + // new check in vecto 3.x (according to Martin Rexeis) if (CurrentState.DynamicFullLoadPower < StationaryIdleFullLoadPower) { CurrentState.DynamicFullLoadPower = StationaryIdleFullLoadPower; } - CurrentState.DynamicFullLoadTorque = Formulas.PowerToTorque(CurrentState.DynamicFullLoadPower, - angularVelocity); + CurrentState.DynamicFullLoadTorque = CurrentState.DynamicFullLoadPower / angularVelocity; } protected bool IsFullLoad(Watt requestedPower, Watt maxPower) @@ -418,7 +423,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected bool Equals(CombustionEngine other) { - return Equals(_data, other._data) + return Equals(Data, other.Data) && Equals(PreviousState, other.PreviousState) && Equals(CurrentState, other.CurrentState); } @@ -427,7 +432,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { unchecked { var hashCode = base.GetHashCode(); - hashCode = (hashCode * 397) ^ (_data != null ? _data.GetHashCode() : 0); + 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; @@ -435,5 +440,136 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } #endregion + + protected class CombustionEngineIdleController : LoggingObject, ICombustionEngineIdleController + { + protected readonly double PeDropSlope = -0.75; + protected readonly double PeDropOffset = 1.0; + + protected CombustionEngine Engine; + + protected Second IdleStart = null; + protected Watt LastEnginePower = null; + + public CombustionEngineIdleController(CombustionEngine combustionEngine) + { + Engine = combustionEngine; + } + + public ITnOutPort RequestPort { private get; set; } + + public void Reset() + { + IdleStart = null; + } + + public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, + bool dryRun = false) + { + if (angularVelocity != null) { + throw new VectoException("IdleController can only handle idle requests, i.e. angularVelocity == null!"); + } + if (!torque.IsEqual(0)) { + throw new VectoException("Torque has to be 0 for idle requests!"); + } + if (IdleStart == null) { + IdleStart = absTime; + LastEnginePower = Engine.PreviousState.EnginePower; + } + IResponse retVal = null; + + var idleTime = absTime - IdleStart + dt; + var prevEngineSpeed = Engine.PreviousState.EngineSpeed; + var dragLoad = Engine.Data.FullLoadCurve.DragLoadStationaryPower(prevEngineSpeed); + + var nextEnginePower = (LastEnginePower - dragLoad) * VectoMath.Max(idleTime.Value() * PeDropSlope + PeDropOffset, 0) + + dragLoad; + + var auxDemandResponse = RequestPort.Request(absTime, dt, torque, prevEngineSpeed, true); + + var deltaEnginePower = nextEnginePower - auxDemandResponse.AuxiliariesPowerDemand; + var deltaTorque = deltaEnginePower / prevEngineSpeed; + var deltaAngularSpeed = (deltaTorque / Engine.Data.Inertia * dt).Cast<PerSecond>(); + + var nextAngularSpeed = prevEngineSpeed; + if (deltaAngularSpeed > 0) { + retVal = RequestPort.Request(absTime, dt, torque, nextAngularSpeed); + return retVal; + } + + + nextAngularSpeed = prevEngineSpeed + deltaAngularSpeed; + if (nextAngularSpeed < Engine.Data.IdleSpeed) { + // search for EnginePower such that nextAngularSpeed == Engine.Data.IdleSpeed + var tmp = RequestPort.Request(absTime, dt, torque, Engine.Data.IdleSpeed); + return tmp; + //throw new NotImplementedException("Search for PE s.t. n2 = n_idle"); + } + + retVal = RequestPort.Request(absTime, dt, torque, nextAngularSpeed); + retVal.Switch(). + Case<ResponseSuccess>(). + Case<ResponseUnderload>(r => { + retVal = RequestPort.Request(absTime, dt, torque, nextAngularSpeed); + retVal = SearchIdlingSpeed(absTime, dt, torque, nextAngularSpeed, r); + }). + Default(r => { + throw new UnexpectedResponseException("searching Idling point", r); + }); + + return retVal; + } + + private IResponse SearchIdlingSpeed(Second absTime, Second dt, NewtonMeter torque, PerSecond angularSpeed, + ResponseUnderload responseUnderload) + { + var prevEngineSpeed = Engine.PreviousState.EngineSpeed; + + var searchInterval = Constants.SimulationSettings.EngineIdlingSearchInterval; + var intervalFactor = 1.0; + + var debug = new List<dynamic>(); + + var origDelta = responseUnderload.Delta; + var delta = origDelta; + var nextAngularSpeed = angularSpeed; + + debug.Add(new { engineSpeed = angularSpeed, searchInterval, delta }); + var retryCount = 0; + do { + nextAngularSpeed -= searchInterval * delta.Sign(); + + + var response = (ResponseDryRun)RequestPort.Request(absTime, dt, torque, nextAngularSpeed, true); + delta = response.DeltaDragLoad; + debug.Add(new { engineSpeed = nextAngularSpeed, searchInterval, delta }); + if (delta.IsEqual(0, Constants.SimulationSettings.EnginePowerSearchTolerance)) { + Log.Debug("found operating point in {0} iterations. engine speed: {1}, delta: {2}", retryCount, nextAngularSpeed, + delta); + return RequestPort.Request(absTime, dt, torque, nextAngularSpeed); + } + + if (origDelta.Sign() != delta.Sign()) { + intervalFactor = 0.5; + } + searchInterval *= intervalFactor; + } while (retryCount++ < Constants.SimulationSettings.EngineSearchLoopThreshold); + + Log.Warn("Exceeded max iterations when searching for idling point!"); + Log.Warn("acceleration: {0} ... {1}", ", ".Join(debug.Take(5).Select(x => x.acceleration)), + ", ".Join(debug.Slice(-6).Select(x => x.acceleration))); + Log.Warn("exceeded: {0} ... {1}", ", ".Join(debug.Take(5).Select(x => x.delta)), + ", ".Join(debug.Slice(-6).Select(x => x.delta))); + Log.Error("Failed to find operating point! absTime: {0}", absTime); + throw new VectoSimulationException("Failed to find operating point! exceeded: {0} ... {1}", + ", ".Join(debug.Take(5).Select(x => x.delta)), + ", ".Join(debug.Slice(-6).Select(x => x.delta))); + } + + public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) + { + return new ResponseSuccess() { Source = this }; + } + } } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs index fe87710c7e6d73ac24010c372f9301ed6e695429..d99723a8677d0b7ebaca16879856e8c997c5f50d 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs @@ -39,8 +39,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl UpdateEngineState(CurrentState.EnginePower); // = requestedEnginePower; //todo + _currentState.EnginePowerLoss; - CurrentState.EngineTorque = Formulas.PowerToTorque(CurrentState.EnginePower, - CurrentState.EngineSpeed); + CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed; return new ResponseSuccess(); } diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs index 53bec83e1090694b87ef6d7873c845d76d96f616..6b2d83c94eb2659953aa9c02d827cdead2be0e6f 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyGearbox.cs @@ -71,9 +71,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return NextComponent.Request(absTime, dt, torque, angularVelocity, dryRun); } - public IResponse Initialize(NewtonMeter torque, PerSecond engineSpeed) + public IResponse Initialize(NewtonMeter torque, PerSecond angularSpeed) { - return NextComponent.Initialize(torque, engineSpeed); + return NextComponent.Initialize(torque, angularSpeed); } #endregion diff --git a/VectoCore/VectoCore.csproj b/VectoCore/VectoCore.csproj index 2505b4398f5cac850be9a3de0186db4cb98b2869..cdc012fe680190d06d7bcdee22dfc351594fed9f 100644 --- a/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore.csproj @@ -155,6 +155,7 @@ <Compile Include="Models\SimulationComponent\Data\GearboxType.cs" /> <Compile Include="Models\SimulationComponent\IAuxiliary.cs" /> <Compile Include="Models\SimulationComponent\IBrakes.cs" /> + <Compile Include="Models\SimulationComponent\ICombustionEngineIdleController.cs" /> <Compile Include="Models\SimulationComponent\IDriverActions.cs" /> <Compile Include="Models\SimulationComponent\IDriverStrategy.cs" /> <Compile Include="Models\SimulationComponent\IDrivingCycleInfo.cs" /> diff --git a/VectoCore/VectoCore.smproj b/VectoCore/VectoCore.smproj index 574e2442308c6c99999829e1796fdb96fbf8b268..ab6ddb68c4294c9316aa0c17294881873abad4dd 100644 Binary files a/VectoCore/VectoCore.smproj and b/VectoCore/VectoCore.smproj differ diff --git a/VectoCoreTest/Integration/CoachPowerTrain.cs b/VectoCoreTest/Integration/CoachPowerTrain.cs index 24a7ef13c7fcaca364b26f79132c3072687993f9..7c51fe92be39434a251eb020212291e00aef6609 100644 --- a/VectoCoreTest/Integration/CoachPowerTrain.cs +++ b/VectoCoreTest/Integration/CoachPowerTrain.cs @@ -49,20 +49,25 @@ namespace TUGraz.VectoCore.Tests.Integration var driverData = CreateDriverData(AccelerationFile); var cycle = new DistanceBasedDrivingCycle(container, cycleData); + var engine = new CombustionEngine(container, engineData); + var clutch = new Clutch(container, engineData, engine.IdleController); + dynamic tmp = Port.AddComponent(cycle, new Driver(container, driverData, new DefaultDriverStrategy())); tmp = Port.AddComponent(tmp, new Vehicle(container, vehicleData)); tmp = Port.AddComponent(tmp, new Wheels(container, vehicleData.DynamicTyreRadius)); tmp = Port.AddComponent(tmp, new Brakes(container)); tmp = Port.AddComponent(tmp, new AxleGear(container, axleGearData)); tmp = Port.AddComponent(tmp, new Gearbox(container, gearboxData, new AMTShiftStrategy(gearboxData, container))); - tmp = Port.AddComponent(tmp, new Clutch(container, engineData)); + tmp = Port.AddComponent(tmp, clutch); var aux = new Auxiliary(container); aux.AddConstant("", 0.SI<Watt>()); tmp = Port.AddComponent(tmp, aux); - Port.AddComponent(tmp, new CombustionEngine(container, engineData)); + Port.AddComponent(tmp, engine); + + engine.IdleController.RequestPort = clutch.IdleControlPort; return container; } diff --git a/VectoCoreTest/Integration/DriverStrategy/DriverStrategyTestTruck.cs b/VectoCoreTest/Integration/DriverStrategy/DriverStrategyTestTruck.cs index 72554cda7c14b267dddc68f2ca140eb1a8414972..202e73580b58174b1b41487df9799077fbc39216 100644 --- a/VectoCoreTest/Integration/DriverStrategy/DriverStrategyTestTruck.cs +++ b/VectoCoreTest/Integration/DriverStrategy/DriverStrategyTestTruck.cs @@ -1,8 +1,5 @@ -using System.IO; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; using NLog; -using TUGraz.VectoCore.FileIO.Reader; -using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy @@ -74,6 +71,9 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy { var cycle = SimpleDrivingCycles.CreateCycleData(SimpleDrivingCycles.CycleAccelerate_0_85_level); Truck40tPowerTrain.CreateEngineeringRun(cycle, "Truck_DriverStrategy_Accelerate_0_85_level.vmod").Run(); + + GraphWriter.Write("Truck_DriverStrategy_Accelerate_0_85_level.vmod", + @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\40t Truck\40t_Long_Haul_Truck_Cycle_Accelerate_0_85_level.vmod"); } [TestMethod] diff --git a/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs b/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs index 86d87d34843abb7259359d3f3d98cc87747a93f1..751d0df538444d9f95af24050889f3f50c47183b 100644 --- a/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs +++ b/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs @@ -82,7 +82,7 @@ namespace TUGraz.VectoCore.Tests.Integration.EngineOnlyCycle var angularVelocity = 644.4445.RPMtoRad(); var power = 2329.973.SI<Watt>(); - gearbox.OutPort().Request(absTime, dt, Formulas.PowerToTorque(power, angularVelocity), angularVelocity); + gearbox.OutPort().Request(absTime, dt, power / angularVelocity, angularVelocity); foreach (var sc in vehicleContainer.SimulationComponents()) { sc.CommitSimulationStep(dataWriter); diff --git a/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index 8aa3661f5ab9744ac354cc6aa44368c3280f9a29..24895eb4d2d85caa0ff89830670d6a8c4fc06ac9 100644 --- a/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -58,8 +58,11 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns tmp = Port.AddComponent(tmp, new AxleGear(container, axleGearData)); var gbx = new Gearbox(container, gearboxData, new AMTShiftStrategy(gearboxData, container)); tmp = Port.AddComponent(tmp, gbx); - tmp = Port.AddComponent(tmp, new Clutch(container, engineData)); - Port.AddComponent(tmp, new CombustionEngine(container, engineData)); + var engine = new CombustionEngine(container, engineData); + var clutch = new Clutch(container, engineData, engine.IdleController); + tmp = Port.AddComponent(tmp, clutch); + Port.AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; cyclePort.Initialize(); @@ -114,8 +117,11 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns tmp = Port.AddComponent(tmp, new AxleGear(container, axleGearData)); var gbx = new Gearbox(container, gearboxData, new AMTShiftStrategy(gearboxData, container)); tmp = Port.AddComponent(tmp, gbx); - tmp = Port.AddComponent(tmp, new Clutch(container, engineData)); - Port.AddComponent(tmp, new CombustionEngine(container, engineData)); + var engine = new CombustionEngine(container, engineData); + var clutch = new Clutch(container, engineData, engine.IdleController); + tmp = Port.AddComponent(tmp, clutch); + Port.AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; cyclePort.Initialize(); @@ -186,8 +192,11 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns tmp = Port.AddComponent(tmp, new Brakes(container)); tmp = Port.AddComponent(tmp, new AxleGear(container, axleGearData)); tmp = Port.AddComponent(tmp, new Gearbox(container, gearboxData, new AMTShiftStrategy(gearboxData, container))); - tmp = Port.AddComponent(tmp, new Clutch(container, engineData)); - Port.AddComponent(tmp, new CombustionEngine(container, engineData)); + var engine = new CombustionEngine(container, engineData); + var clutch = new Clutch(container, engineData, engine.IdleController); + tmp = Port.AddComponent(tmp, clutch); + Port.AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; cyclePort.Initialize(); diff --git a/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs b/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs index e2f6627baf744eba6b276c10b443ed2c73320770..b913f47b4e88161f80225b99f839ca8630aa161d 100644 --- a/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs +++ b/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs @@ -53,9 +53,11 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns tmp = Port.AddComponent(tmp, new Wheels(vehicleContainer, vehicleData.DynamicTyreRadius)); tmp = Port.AddComponent(tmp, new AxleGear(vehicleContainer, axleGearData)); - tmp = Port.AddComponent(tmp, new Clutch(vehicleContainer, engineData)); var engine = new CombustionEngine(vehicleContainer, engineData); + var clutch = new Clutch(vehicleContainer, engineData, engine.IdleController); + tmp = Port.AddComponent(tmp, clutch); Port.AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; var gbx = new MockGearbox(vehicleContainer); @@ -104,8 +106,11 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns tmp = Port.AddComponent(tmp, new Wheels(vehicleContainer, vehicleData.DynamicTyreRadius)); tmp = Port.AddComponent(tmp, new Brakes(vehicleContainer)); tmp = Port.AddComponent(tmp, new AxleGear(vehicleContainer, axleGearData)); - tmp = Port.AddComponent(tmp, new Clutch(vehicleContainer, engineData)); - Port.AddComponent(tmp, new CombustionEngine(vehicleContainer, engineData)); + var engine = new CombustionEngine(vehicleContainer, engineData); + var clutch = new Clutch(vehicleContainer, engineData, engine.IdleController); + tmp = Port.AddComponent(tmp, clutch); + Port.AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; var gbx = new MockGearbox(vehicleContainer); @@ -173,8 +178,11 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns tmp = Port.AddComponent(tmp, new Wheels(vehicleContainer, vehicleData.DynamicTyreRadius)); tmp = Port.AddComponent(tmp, new Brakes(vehicleContainer)); tmp = Port.AddComponent(tmp, new AxleGear(vehicleContainer, axleGearData)); - tmp = Port.AddComponent(tmp, new Clutch(vehicleContainer, engineData)); - Port.AddComponent(tmp, new CombustionEngine(vehicleContainer, engineData)); + var engine = new CombustionEngine(vehicleContainer, engineData); + var clutch = new Clutch(vehicleContainer, engineData, engine.IdleController); + tmp = Port.AddComponent(tmp, clutch); + Port.AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; var gbx = new MockGearbox(vehicleContainer); diff --git a/VectoCoreTest/Integration/Truck40tPowerTrain.cs b/VectoCoreTest/Integration/Truck40tPowerTrain.cs index 1be12de83630c9fe9085c05f4fd49f24ddb8dffa..46240a310b7ef9dd6ee0b835585f84948cd3c38e 100644 --- a/VectoCoreTest/Integration/Truck40tPowerTrain.cs +++ b/VectoCoreTest/Integration/Truck40tPowerTrain.cs @@ -56,20 +56,24 @@ namespace TUGraz.VectoCore.Tests.Integration var driverData = CreateDriverData(AccelerationFile); var cycle = new DistanceBasedDrivingCycle(container, cycleData); + var engine = new CombustionEngine(container, engineData); + var clutch = new Clutch(container, engineData, engine.IdleController); + dynamic tmp = Port.AddComponent(cycle, new Driver(container, driverData, new DefaultDriverStrategy())); tmp = Port.AddComponent(tmp, new Vehicle(container, vehicleData)); tmp = Port.AddComponent(tmp, new Wheels(container, vehicleData.DynamicTyreRadius)); tmp = Port.AddComponent(tmp, new Brakes(container)); tmp = Port.AddComponent(tmp, new AxleGear(container, axleGearData)); tmp = Port.AddComponent(tmp, new Gearbox(container, gearboxData, new AMTShiftStrategy(gearboxData, container))); - tmp = Port.AddComponent(tmp, new Clutch(container, engineData)); + tmp = Port.AddComponent(tmp, clutch); var aux = new Auxiliary(container); aux.AddConstant("", 0.SI<Watt>()); tmp = Port.AddComponent(tmp, aux); - Port.AddComponent(tmp, new CombustionEngine(container, engineData)); + Port.AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; return container; } diff --git a/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs b/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs index 096a973318fa03dface2330f564496d99e8abb98..24092823959b61078fb8bc8fbb229736a2c89463 100644 --- a/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs +++ b/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs @@ -74,7 +74,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation Assert.AreEqual(absTime, outPort.AbsTime); Assert.AreEqual(dt, outPort.Dt); Assert.AreEqual(743.2361.RPMtoRad(), outPort.AngularVelocity); - Assert.AreEqual(Formulas.PowerToTorque(2779.576.SI<Watt>(), 743.2361.RPMtoRad()), outPort.Torque); + Assert.AreEqual(2779.576.SI<Watt>() / 743.2361.RPMtoRad(), outPort.Torque); // ======================== @@ -95,7 +95,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation Assert.AreEqual(absTime, outPort.AbsTime); Assert.AreEqual(dt, outPort.Dt); Assert.AreEqual(1584.731.RPMtoRad(), outPort.AngularVelocity); - Assert.AreEqual(Formulas.PowerToTorque(3380.548.SI<Watt>(), 1584.731.RPMtoRad()), outPort.Torque); + Assert.AreEqual(3380.548.SI<Watt>() / 1584.731.RPMtoRad(), outPort.Torque); absTime += dt; } diff --git a/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs b/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs index bc726dae75fc21a0da603f167cedb48666442df3..88877f8ffa35350c357ff417891cc4367b3e1a4c 100644 --- a/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs +++ b/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs @@ -22,7 +22,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var engineData = EngineeringModeSimulationDataReader.CreateEngineDataFromFile(CoachEngine); var gearbox = new MockGearbox(container); - var clutch = new Clutch(container, engineData); + var clutch = new Clutch(container, engineData, null); var inPort = clutch.InPort(); var outPort = new MockTnOutPort(); diff --git a/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs b/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs index 1127b0d6a83c60274652c5d66b0a11e44eff1dfd..577cc66758923033820191bbbe894a801e341af7 100644 --- a/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs +++ b/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs @@ -8,6 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.FileIO.Reader.Impl; +using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -21,7 +22,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent [TestClass] public class CombustionEngineTest { + protected double Tolerance = 1E-3; + private const string CoachEngine = @"TestData\Components\24t Coach.veng"; + + private const string TruckEngine = @"TestData\Components\40t_Long_Haul_Truck.veng"; + public TestContext TestContext { get; set; } [ClassInitialize] @@ -204,9 +210,9 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var container = new VehicleContainer(); var gearbox = new MockGearbox(container); var engineData = EngineeringModeSimulationDataReader.CreateEngineDataFromFile(CoachEngine); - var engine = new CombustionEngine(container, engineData); - var clutch = new Clutch(container, engineData); + var engine = new CombustionEngine(container, engineData); + var clutch = new Clutch(container, engineData, engine.IdleController); var driver = new MockDriver(container); @@ -219,6 +225,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent gearbox.InPort().Connect(clutch.OutPort()); clutch.InPort().Connect(aux.OutPort()); aux.InPort().Connect(engine.OutPort()); + engine.IdleController.RequestPort = clutch.IdleControlPort; // var expectedResults = VectoCSVFile.Read(TestContext.DataRow["ResultFile"].ToString()); @@ -265,6 +272,124 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(800.RPMtoRad(), row[ModalResultField.n.GetName()]); } + [TestMethod] + public void EngineIdleControllerTestCoach() + { + VehicleContainer container; + CombustionEngine engine; + ITnOutPort requestPort; + VehicleContainer(CoachEngine, out container, out engine, out requestPort); + + + var absTime = 0.SI<Second>(); + var dt = Constants.SimulationSettings.TargetTimeInterval; + + var angularVelocity = 800.RPMtoRad(); + var torque = 100000.SI<Watt>() / angularVelocity; + + var response = requestPort.Initialize(torque, angularVelocity); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + response = requestPort.Request(absTime, dt, torque, angularVelocity); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.AreEqual(105000, response.EnginePowerRequest.Value(), Tolerance); + container.CommitSimulationStep(absTime, dt); + absTime += dt; + + var engineSpeed = new PerSecond[] { 800.RPMtoRad(), 800.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad() }; + var enginePower = new Watt[] { 5000.SI<Watt>(), 5000.SI<Watt>(), -8601.6308.SI<Watt>(), 5000.SI<Watt>() }; + + for (var i = 0; i < engineSpeed.Count(); i++) { + torque = 0.SI<NewtonMeter>(); + + response = requestPort.Request(absTime, dt, torque, null); + container.CommitSimulationStep(absTime, dt); + absTime += dt; + + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.AreEqual(engineSpeed[i].Value(), engine.PreviousState.EngineSpeed.Value(), Tolerance); + Assert.AreEqual(enginePower[i].Value(), engine.PreviousState.EnginePower.Value(), Tolerance); + } + } + + +/* + * VECTO 2.2 +| time [s] | Pe_eng [kW] | n [1/min] | Tq_eng [Nm] | Gear [-] | +| 59.5 | 349.981 | 1679.281 | 1990.181 | 8 | +| 60.5 | 5 | 1679.281 | 28.43269 | 0 | +| 61.5 | -19.47213 | 1397.271 | -133.0774 | 0 | +| 62.5 | -18.11888 | 1064.296 | -162.5699 | 0 | +| 63.5 | -11.11163 | 714.1923 | -148.571 | 0 | +| 64.5 | -0.5416708 | 560 | -9.236741 | 0 | +| 65.5 | 5 | 560 | 85.26157 | 0 | +| 66.5 | 5 | 560 | 85.26157 | 0 | +| 67.5 | 5 | 560 | 85.26157 | 0 | +| 68.5 | 5 | 560 | 85.26157 | 0 | +| 69.5 | 5 | 560 | 85.26157 | 0 | +| 70.5 | 308.729 | 1284.139 | 2295.815 | 9 | + */ + + [TestMethod] + public void EngineIdleControllerTestTruck() + { + VehicleContainer container; + CombustionEngine engine; + ITnOutPort requestPort; + VehicleContainer(TruckEngine, out container, out engine, out requestPort); + + //var dataWriter = new ModalDataWriter("EngienIdle.vmod"); + //container.DataWriter = dataWriter; + + var absTime = 0.SI<Second>(); + var dt = Constants.SimulationSettings.TargetTimeInterval; + + var angularVelocity = 1680.RPMtoRad(); + var torque = 345000.SI<Watt>() / angularVelocity; + + var response = requestPort.Initialize(torque, angularVelocity); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + response = requestPort.Request(absTime, dt, torque, angularVelocity); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.AreEqual(350000, response.EnginePowerRequest.Value(), Tolerance); + container.CommitSimulationStep(absTime, dt); + absTime += dt; + + var engineSpeed = new PerSecond[] { + 1680.RPMtoRad(), 1680.RPMtoRad(), 1467.014.RPMtoRad(), 1272.8658.RPMtoRad(), 1090.989.RPMtoRad(), + 915.3533.RPMtoRad(), 738.599.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), + 560.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), 560.RPMtoRad(), + 560.RPMtoRad() + }; + var enginePower = new Watt[] { + 5000.SI<Watt>(), 5000.SI<Watt>(), -32832.8834.SI<Watt>(), -25025.1308.SI<Watt>(), -19267.0360.SI<Watt>(), + -14890.1962.SI<Watt>(), -11500.7991.SI<Watt>(), -8091.0577.SI<Watt>(), 5000.SI<Watt>(), 5000.SI<Watt>(), + 5000.SI<Watt>(), 5000.SI<Watt>(), 5000.SI<Watt>(), 5000.SI<Watt>(), 5000.SI<Watt>(), 5000.SI<Watt>(), + 5000.SI<Watt>(), 5000.SI<Watt>(), 5000.SI<Watt>(), 5000.SI<Watt>() + }; + + var engSpeedResults = new List<dynamic>(); + for (var i = 0; i < engineSpeed.Count(); i++) { + torque = 0.SI<NewtonMeter>(); + + response = requestPort.Request(absTime, dt, torque, null); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + container.CommitSimulationStep(absTime, dt); + + engSpeedResults.Add(new { + absTime, + engine.PreviousState.EngineSpeed, + engine.PreviousState.EnginePower + }); + Assert.AreEqual(engineSpeed[i].Value(), engine.PreviousState.EngineSpeed.Value(), Tolerance); + Assert.AreEqual(enginePower[i].Value(), engine.PreviousState.EnginePower.Value(), Tolerance); + + absTime += dt; + } + //dataWriter.Finish(); + } [TestMethod, Ignore] public void TestWriteToFile() @@ -304,5 +429,38 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(58.6430628670095, idle.Value(), 0.000001); Assert.IsTrue(idle.HasEqualUnit(0.SI<PerSecond>())); } + + + private static void VehicleContainer(string engineFile, out VehicleContainer container, out CombustionEngine engine, + out ITnOutPort requestPort) + { + container = new VehicleContainer(); + var gearbox = new MockGearbox(container); + var engineData = EngineeringModeSimulationDataReader.CreateEngineDataFromFile(engineFile); + + engine = new CombustionEngine(container, engineData); + var clutch = new Clutch(container, engineData, engine.IdleController); + + var driver = new MockDriver(container); + + var aux = new Auxiliary(container); + aux.AddConstant("", 5000.SI<Watt>()); + + gearbox.Gear = 1; + + //gearbox.InPort().Connect(engine.OutPort()); + gearbox.InPort().Connect(clutch.OutPort()); + clutch.InPort().Connect(aux.OutPort()); + aux.InPort().Connect(engine.OutPort()); + + // has to be done after connecting components! + engine.IdleController.RequestPort = clutch.IdleControlPort; + + requestPort = gearbox.OutPort(); + + //vehicleContainer.DataWriter = new ModalDataWriter("engine_idle_test.csv"); + var dataWriter = new MockModalDataWriter(); + container.DataWriter = dataWriter; + } } } \ No newline at end of file diff --git a/VectoCoreTest/Models/SimulationComponent/DriverTest.cs b/VectoCoreTest/Models/SimulationComponent/DriverTest.cs index 204c9bfed698e88a0e5cc65fe3e52104491a1a63..1a8d15854c387a7bb09cd080096b6652c427e4f1 100644 --- a/VectoCoreTest/Models/SimulationComponent/DriverTest.cs +++ b/VectoCoreTest/Models/SimulationComponent/DriverTest.cs @@ -47,11 +47,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var driver = new Driver(vehicleContainer, driverData, new DefaultDriverStrategy()); var engine = new CombustionEngine(vehicleContainer, engineData); - + var clutch = new Clutch(vehicleContainer, engineData, engine.IdleController); dynamic tmp = AddComponent(driver, new Vehicle(vehicleContainer, vehicleData)); tmp = AddComponent(tmp, new Wheels(vehicleContainer, vehicleData.DynamicTyreRadius)); - tmp = AddComponent(tmp, new Clutch(vehicleContainer, engineData)); + tmp = AddComponent(tmp, clutch); AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; var gbx = new MockGearbox(vehicleContainer) { Gear = 1 }; @@ -102,11 +103,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var driver = new Driver(vehicleContainer, driverData, new DefaultDriverStrategy()); var engine = new CombustionEngine(vehicleContainer, engineData); + var clutch = new Clutch(vehicleContainer, engineData, engine.IdleController); dynamic tmp = AddComponent(driver, new Vehicle(vehicleContainer, vehicleData)); tmp = AddComponent(tmp, new Wheels(vehicleContainer, vehicleData.DynamicTyreRadius)); - tmp = AddComponent(tmp, new Clutch(vehicleContainer, engineData)); + tmp = AddComponent(tmp, clutch); AddComponent(tmp, engine); + engine.IdleController.RequestPort = clutch.IdleControlPort; var gbx = new MockGearbox(vehicleContainer); gbx.Gear = 1; @@ -163,8 +166,11 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent dynamic tmp = AddComponent(driver, new Vehicle(vehicleContainer, vehicleData)); tmp = AddComponent(tmp, new Wheels(vehicleContainer, vehicleData.DynamicTyreRadius)); - tmp = AddComponent(tmp, new Clutch(vehicleContainer, engineData)); - AddComponent(tmp, new CombustionEngine(vehicleContainer, engineData)); + var engine = new CombustionEngine(vehicleContainer, engineData); + var clutch = new Clutch(vehicleContainer, engineData, engine.IdleController); + engine.IdleController.RequestPort = clutch.IdleControlPort; + tmp = AddComponent(tmp, clutch); + AddComponent(tmp, engine); var gbx = new MockGearbox(vehicleContainer); diff --git a/VectoCoreTest/TestData/Integration/DriverStrategy/Cycles/Cycle_Accelerate_0_85_level_5kWAux.vdri b/VectoCoreTest/TestData/Integration/DriverStrategy/Cycles/Cycle_Accelerate_0_85_level_5kWAux.vdri new file mode 100644 index 0000000000000000000000000000000000000000..1f9c904ae2242f39745002d7431594917e2832d0 --- /dev/null +++ b/VectoCoreTest/TestData/Integration/DriverStrategy/Cycles/Cycle_Accelerate_0_85_level_5kWAux.vdri @@ -0,0 +1,1002 @@ +<s>,<v>,<grad>,<stop>,<Padd> +0,0,0,2,5 +1,85,0,0,5 +2,85,0,0,5 +3,85,0,0,5 +4,85,0,0,5 +5,85,0,0,5 +6,85,0,0,5 +7,85,0,0,5 +8,85,0,0,5 +9,85,0,0,5 +10,85,0,0,5 +11,85,0,0,5 +12,85,0,0,5 +13,85,0,0,5 +14,85,0,0,5 +15,85,0,0,5 +16,85,0,0,5 +17,85,0,0,5 +18,85,0,0,5 +19,85,0,0,5 +20,85,0,0,5 +21,85,0,0,5 +22,85,0,0,5 +23,85,0,0,5 +24,85,0,0,5 +25,85,0,0,5 +26,85,0,0,5 +27,85,0,0,5 +28,85,0,0,5 +29,85,0,0,5 +30,85,0,0,5 +31,85,0,0,5 +32,85,0,0,5 +33,85,0,0,5 +34,85,0,0,5 +35,85,0,0,5 +36,85,0,0,5 +37,85,0,0,5 +38,85,0,0,5 +39,85,0,0,5 +40,85,0,0,5 +41,85,0,0,5 +42,85,0,0,5 +43,85,0,0,5 +44,85,0,0,5 +45,85,0,0,5 +46,85,0,0,5 +47,85,0,0,5 +48,85,0,0,5 +49,85,0,0,5 +50,85,0,0,5 +51,85,0,0,5 +52,85,0,0,5 +53,85,0,0,5 +54,85,0,0,5 +55,85,0,0,5 +56,85,0,0,5 +57,85,0,0,5 +58,85,0,0,5 +59,85,0,0,5 +60,85,0,0,5 +61,85,0,0,5 +62,85,0,0,5 +63,85,0,0,5 +64,85,0,0,5 +65,85,0,0,5 +66,85,0,0,5 +67,85,0,0,5 +68,85,0,0,5 +69,85,0,0,5 +70,85,0,0,5 +71,85,0,0,5 +72,85,0,0,5 +73,85,0,0,5 +74,85,0,0,5 +75,85,0,0,5 +76,85,0,0,5 +77,85,0,0,5 +78,85,0,0,5 +79,85,0,0,5 +80,85,0,0,5 +81,85,0,0,5 +82,85,0,0,5 +83,85,0,0,5 +84,85,0,0,5 +85,85,0,0,5 +86,85,0,0,5 +87,85,0,0,5 +88,85,0,0,5 +89,85,0,0,5 +90,85,0,0,5 +91,85,0,0,5 +92,85,0,0,5 +93,85,0,0,5 +94,85,0,0,5 +95,85,0,0,5 +96,85,0,0,5 +97,85,0,0,5 +98,85,0,0,5 +99,85,0,0,5 +100,85,0,0,5 +101,85,0,0,5 +102,85,0,0,5 +103,85,0,0,5 +104,85,0,0,5 +105,85,0,0,5 +106,85,0,0,5 +107,85,0,0,5 +108,85,0,0,5 +109,85,0,0,5 +110,85,0,0,5 +111,85,0,0,5 +112,85,0,0,5 +113,85,0,0,5 +114,85,0,0,5 +115,85,0,0,5 +116,85,0,0,5 +117,85,0,0,5 +118,85,0,0,5 +119,85,0,0,5 +120,85,0,0,5 +121,85,0,0,5 +122,85,0,0,5 +123,85,0,0,5 +124,85,0,0,5 +125,85,0,0,5 +126,85,0,0,5 +127,85,0,0,5 +128,85,0,0,5 +129,85,0,0,5 +130,85,0,0,5 +131,85,0,0,5 +132,85,0,0,5 +133,85,0,0,5 +134,85,0,0,5 +135,85,0,0,5 +136,85,0,0,5 +137,85,0,0,5 +138,85,0,0,5 +139,85,0,0,5 +140,85,0,0,5 +141,85,0,0,5 +142,85,0,0,5 +143,85,0,0,5 +144,85,0,0,5 +145,85,0,0,5 +146,85,0,0,5 +147,85,0,0,5 +148,85,0,0,5 +149,85,0,0,5 +150,85,0,0,5 +151,85,0,0,5 +152,85,0,0,5 +153,85,0,0,5 +154,85,0,0,5 +155,85,0,0,5 +156,85,0,0,5 +157,85,0,0,5 +158,85,0,0,5 +159,85,0,0,5 +160,85,0,0,5 +161,85,0,0,5 +162,85,0,0,5 +163,85,0,0,5 +164,85,0,0,5 +165,85,0,0,5 +166,85,0,0,5 +167,85,0,0,5 +168,85,0,0,5 +169,85,0,0,5 +170,85,0,0,5 +171,85,0,0,5 +172,85,0,0,5 +173,85,0,0,5 +174,85,0,0,5 +175,85,0,0,5 +176,85,0,0,5 +177,85,0,0,5 +178,85,0,0,5 +179,85,0,0,5 +180,85,0,0,5 +181,85,0,0,5 +182,85,0,0,5 +183,85,0,0,5 +184,85,0,0,5 +185,85,0,0,5 +186,85,0,0,5 +187,85,0,0,5 +188,85,0,0,5 +189,85,0,0,5 +190,85,0,0,5 +191,85,0,0,5 +192,85,0,0,5 +193,85,0,0,5 +194,85,0,0,5 +195,85,0,0,5 +196,85,0,0,5 +197,85,0,0,5 +198,85,0,0,5 +199,85,0,0,5 +200,85,0,0,5 +201,85,0,0,5 +202,85,0,0,5 +203,85,0,0,5 +204,85,0,0,5 +205,85,0,0,5 +206,85,0,0,5 +207,85,0,0,5 +208,85,0,0,5 +209,85,0,0,5 +210,85,0,0,5 +211,85,0,0,5 +212,85,0,0,5 +213,85,0,0,5 +214,85,0,0,5 +215,85,0,0,5 +216,85,0,0,5 +217,85,0,0,5 +218,85,0,0,5 +219,85,0,0,5 +220,85,0,0,5 +221,85,0,0,5 +222,85,0,0,5 +223,85,0,0,5 +224,85,0,0,5 +225,85,0,0,5 +226,85,0,0,5 +227,85,0,0,5 +228,85,0,0,5 +229,85,0,0,5 +230,85,0,0,5 +231,85,0,0,5 +232,85,0,0,5 +233,85,0,0,5 +234,85,0,0,5 +235,85,0,0,5 +236,85,0,0,5 +237,85,0,0,5 +238,85,0,0,5 +239,85,0,0,5 +240,85,0,0,5 +241,85,0,0,5 +242,85,0,0,5 +243,85,0,0,5 +244,85,0,0,5 +245,85,0,0,5 +246,85,0,0,5 +247,85,0,0,5 +248,85,0,0,5 +249,85,0,0,5 +250,85,0,0,5 +251,85,0,0,5 +252,85,0,0,5 +253,85,0,0,5 +254,85,0,0,5 +255,85,0,0,5 +256,85,0,0,5 +257,85,0,0,5 +258,85,0,0,5 +259,85,0,0,5 +260,85,0,0,5 +261,85,0,0,5 +262,85,0,0,5 +263,85,0,0,5 +264,85,0,0,5 +265,85,0,0,5 +266,85,0,0,5 +267,85,0,0,5 +268,85,0,0,5 +269,85,0,0,5 +270,85,0,0,5 +271,85,0,0,5 +272,85,0,0,5 +273,85,0,0,5 +274,85,0,0,5 +275,85,0,0,5 +276,85,0,0,5 +277,85,0,0,5 +278,85,0,0,5 +279,85,0,0,5 +280,85,0,0,5 +281,85,0,0,5 +282,85,0,0,5 +283,85,0,0,5 +284,85,0,0,5 +285,85,0,0,5 +286,85,0,0,5 +287,85,0,0,5 +288,85,0,0,5 +289,85,0,0,5 +290,85,0,0,5 +291,85,0,0,5 +292,85,0,0,5 +293,85,0,0,5 +294,85,0,0,5 +295,85,0,0,5 +296,85,0,0,5 +297,85,0,0,5 +298,85,0,0,5 +299,85,0,0,5 +300,85,0,0,5 +301,85,0,0,5 +302,85,0,0,5 +303,85,0,0,5 +304,85,0,0,5 +305,85,0,0,5 +306,85,0,0,5 +307,85,0,0,5 +308,85,0,0,5 +309,85,0,0,5 +310,85,0,0,5 +311,85,0,0,5 +312,85,0,0,5 +313,85,0,0,5 +314,85,0,0,5 +315,85,0,0,5 +316,85,0,0,5 +317,85,0,0,5 +318,85,0,0,5 +319,85,0,0,5 +320,85,0,0,5 +321,85,0,0,5 +322,85,0,0,5 +323,85,0,0,5 +324,85,0,0,5 +325,85,0,0,5 +326,85,0,0,5 +327,85,0,0,5 +328,85,0,0,5 +329,85,0,0,5 +330,85,0,0,5 +331,85,0,0,5 +332,85,0,0,5 +333,85,0,0,5 +334,85,0,0,5 +335,85,0,0,5 +336,85,0,0,5 +337,85,0,0,5 +338,85,0,0,5 +339,85,0,0,5 +340,85,0,0,5 +341,85,0,0,5 +342,85,0,0,5 +343,85,0,0,5 +344,85,0,0,5 +345,85,0,0,5 +346,85,0,0,5 +347,85,0,0,5 +348,85,0,0,5 +349,85,0,0,5 +350,85,0,0,5 +351,85,0,0,5 +352,85,0,0,5 +353,85,0,0,5 +354,85,0,0,5 +355,85,0,0,5 +356,85,0,0,5 +357,85,0,0,5 +358,85,0,0,5 +359,85,0,0,5 +360,85,0,0,5 +361,85,0,0,5 +362,85,0,0,5 +363,85,0,0,5 +364,85,0,0,5 +365,85,0,0,5 +366,85,0,0,5 +367,85,0,0,5 +368,85,0,0,5 +369,85,0,0,5 +370,85,0,0,5 +371,85,0,0,5 +372,85,0,0,5 +373,85,0,0,5 +374,85,0,0,5 +375,85,0,0,5 +376,85,0,0,5 +377,85,0,0,5 +378,85,0,0,5 +379,85,0,0,5 +380,85,0,0,5 +381,85,0,0,5 +382,85,0,0,5 +383,85,0,0,5 +384,85,0,0,5 +385,85,0,0,5 +386,85,0,0,5 +387,85,0,0,5 +388,85,0,0,5 +389,85,0,0,5 +390,85,0,0,5 +391,85,0,0,5 +392,85,0,0,5 +393,85,0,0,5 +394,85,0,0,5 +395,85,0,0,5 +396,85,0,0,5 +397,85,0,0,5 +398,85,0,0,5 +399,85,0,0,5 +400,85,0,0,5 +401,85,0,0,5 +402,85,0,0,5 +403,85,0,0,5 +404,85,0,0,5 +405,85,0,0,5 +406,85,0,0,5 +407,85,0,0,5 +408,85,0,0,5 +409,85,0,0,5 +410,85,0,0,5 +411,85,0,0,5 +412,85,0,0,5 +413,85,0,0,5 +414,85,0,0,5 +415,85,0,0,5 +416,85,0,0,5 +417,85,0,0,5 +418,85,0,0,5 +419,85,0,0,5 +420,85,0,0,5 +421,85,0,0,5 +422,85,0,0,5 +423,85,0,0,5 +424,85,0,0,5 +425,85,0,0,5 +426,85,0,0,5 +427,85,0,0,5 +428,85,0,0,5 +429,85,0,0,5 +430,85,0,0,5 +431,85,0,0,5 +432,85,0,0,5 +433,85,0,0,5 +434,85,0,0,5 +435,85,0,0,5 +436,85,0,0,5 +437,85,0,0,5 +438,85,0,0,5 +439,85,0,0,5 +440,85,0,0,5 +441,85,0,0,5 +442,85,0,0,5 +443,85,0,0,5 +444,85,0,0,5 +445,85,0,0,5 +446,85,0,0,5 +447,85,0,0,5 +448,85,0,0,5 +449,85,0,0,5 +450,85,0,0,5 +451,85,0,0,5 +452,85,0,0,5 +453,85,0,0,5 +454,85,0,0,5 +455,85,0,0,5 +456,85,0,0,5 +457,85,0,0,5 +458,85,0,0,5 +459,85,0,0,5 +460,85,0,0,5 +461,85,0,0,5 +462,85,0,0,5 +463,85,0,0,5 +464,85,0,0,5 +465,85,0,0,5 +466,85,0,0,5 +467,85,0,0,5 +468,85,0,0,5 +469,85,0,0,5 +470,85,0,0,5 +471,85,0,0,5 +472,85,0,0,5 +473,85,0,0,5 +474,85,0,0,5 +475,85,0,0,5 +476,85,0,0,5 +477,85,0,0,5 +478,85,0,0,5 +479,85,0,0,5 +480,85,0,0,5 +481,85,0,0,5 +482,85,0,0,5 +483,85,0,0,5 +484,85,0,0,5 +485,85,0,0,5 +486,85,0,0,5 +487,85,0,0,5 +488,85,0,0,5 +489,85,0,0,5 +490,85,0,0,5 +491,85,0,0,5 +492,85,0,0,5 +493,85,0,0,5 +494,85,0,0,5 +495,85,0,0,5 +496,85,0,0,5 +497,85,0,0,5 +498,85,0,0,5 +499,85,0,0,5 +500,85,0,0,5 +501,85,0,0,5 +502,85,0,0,5 +503,85,0,0,5 +504,85,0,0,5 +505,85,0,0,5 +506,85,0,0,5 +507,85,0,0,5 +508,85,0,0,5 +509,85,0,0,5 +510,85,0,0,5 +511,85,0,0,5 +512,85,0,0,5 +513,85,0,0,5 +514,85,0,0,5 +515,85,0,0,5 +516,85,0,0,5 +517,85,0,0,5 +518,85,0,0,5 +519,85,0,0,5 +520,85,0,0,5 +521,85,0,0,5 +522,85,0,0,5 +523,85,0,0,5 +524,85,0,0,5 +525,85,0,0,5 +526,85,0,0,5 +527,85,0,0,5 +528,85,0,0,5 +529,85,0,0,5 +530,85,0,0,5 +531,85,0,0,5 +532,85,0,0,5 +533,85,0,0,5 +534,85,0,0,5 +535,85,0,0,5 +536,85,0,0,5 +537,85,0,0,5 +538,85,0,0,5 +539,85,0,0,5 +540,85,0,0,5 +541,85,0,0,5 +542,85,0,0,5 +543,85,0,0,5 +544,85,0,0,5 +545,85,0,0,5 +546,85,0,0,5 +547,85,0,0,5 +548,85,0,0,5 +549,85,0,0,5 +550,85,0,0,5 +551,85,0,0,5 +552,85,0,0,5 +553,85,0,0,5 +554,85,0,0,5 +555,85,0,0,5 +556,85,0,0,5 +557,85,0,0,5 +558,85,0,0,5 +559,85,0,0,5 +560,85,0,0,5 +561,85,0,0,5 +562,85,0,0,5 +563,85,0,0,5 +564,85,0,0,5 +565,85,0,0,5 +566,85,0,0,5 +567,85,0,0,5 +568,85,0,0,5 +569,85,0,0,5 +570,85,0,0,5 +571,85,0,0,5 +572,85,0,0,5 +573,85,0,0,5 +574,85,0,0,5 +575,85,0,0,5 +576,85,0,0,5 +577,85,0,0,5 +578,85,0,0,5 +579,85,0,0,5 +580,85,0,0,5 +581,85,0,0,5 +582,85,0,0,5 +583,85,0,0,5 +584,85,0,0,5 +585,85,0,0,5 +586,85,0,0,5 +587,85,0,0,5 +588,85,0,0,5 +589,85,0,0,5 +590,85,0,0,5 +591,85,0,0,5 +592,85,0,0,5 +593,85,0,0,5 +594,85,0,0,5 +595,85,0,0,5 +596,85,0,0,5 +597,85,0,0,5 +598,85,0,0,5 +599,85,0,0,5 +600,85,0,0,5 +601,85,0,0,5 +602,85,0,0,5 +603,85,0,0,5 +604,85,0,0,5 +605,85,0,0,5 +606,85,0,0,5 +607,85,0,0,5 +608,85,0,0,5 +609,85,0,0,5 +610,85,0,0,5 +611,85,0,0,5 +612,85,0,0,5 +613,85,0,0,5 +614,85,0,0,5 +615,85,0,0,5 +616,85,0,0,5 +617,85,0,0,5 +618,85,0,0,5 +619,85,0,0,5 +620,85,0,0,5 +621,85,0,0,5 +622,85,0,0,5 +623,85,0,0,5 +624,85,0,0,5 +625,85,0,0,5 +626,85,0,0,5 +627,85,0,0,5 +628,85,0,0,5 +629,85,0,0,5 +630,85,0,0,5 +631,85,0,0,5 +632,85,0,0,5 +633,85,0,0,5 +634,85,0,0,5 +635,85,0,0,5 +636,85,0,0,5 +637,85,0,0,5 +638,85,0,0,5 +639,85,0,0,5 +640,85,0,0,5 +641,85,0,0,5 +642,85,0,0,5 +643,85,0,0,5 +644,85,0,0,5 +645,85,0,0,5 +646,85,0,0,5 +647,85,0,0,5 +648,85,0,0,5 +649,85,0,0,5 +650,85,0,0,5 +651,85,0,0,5 +652,85,0,0,5 +653,85,0,0,5 +654,85,0,0,5 +655,85,0,0,5 +656,85,0,0,5 +657,85,0,0,5 +658,85,0,0,5 +659,85,0,0,5 +660,85,0,0,5 +661,85,0,0,5 +662,85,0,0,5 +663,85,0,0,5 +664,85,0,0,5 +665,85,0,0,5 +666,85,0,0,5 +667,85,0,0,5 +668,85,0,0,5 +669,85,0,0,5 +670,85,0,0,5 +671,85,0,0,5 +672,85,0,0,5 +673,85,0,0,5 +674,85,0,0,5 +675,85,0,0,5 +676,85,0,0,5 +677,85,0,0,5 +678,85,0,0,5 +679,85,0,0,5 +680,85,0,0,5 +681,85,0,0,5 +682,85,0,0,5 +683,85,0,0,5 +684,85,0,0,5 +685,85,0,0,5 +686,85,0,0,5 +687,85,0,0,5 +688,85,0,0,5 +689,85,0,0,5 +690,85,0,0,5 +691,85,0,0,5 +692,85,0,0,5 +693,85,0,0,5 +694,85,0,0,5 +695,85,0,0,5 +696,85,0,0,5 +697,85,0,0,5 +698,85,0,0,5 +699,85,0,0,5 +700,85,0,0,5 +701,85,0,0,5 +702,85,0,0,5 +703,85,0,0,5 +704,85,0,0,5 +705,85,0,0,5 +706,85,0,0,5 +707,85,0,0,5 +708,85,0,0,5 +709,85,0,0,5 +710,85,0,0,5 +711,85,0,0,5 +712,85,0,0,5 +713,85,0,0,5 +714,85,0,0,5 +715,85,0,0,5 +716,85,0,0,5 +717,85,0,0,5 +718,85,0,0,5 +719,85,0,0,5 +720,85,0,0,5 +721,85,0,0,5 +722,85,0,0,5 +723,85,0,0,5 +724,85,0,0,5 +725,85,0,0,5 +726,85,0,0,5 +727,85,0,0,5 +728,85,0,0,5 +729,85,0,0,5 +730,85,0,0,5 +731,85,0,0,5 +732,85,0,0,5 +733,85,0,0,5 +734,85,0,0,5 +735,85,0,0,5 +736,85,0,0,5 +737,85,0,0,5 +738,85,0,0,5 +739,85,0,0,5 +740,85,0,0,5 +741,85,0,0,5 +742,85,0,0,5 +743,85,0,0,5 +744,85,0,0,5 +745,85,0,0,5 +746,85,0,0,5 +747,85,0,0,5 +748,85,0,0,5 +749,85,0,0,5 +750,85,0,0,5 +751,85,0,0,5 +752,85,0,0,5 +753,85,0,0,5 +754,85,0,0,5 +755,85,0,0,5 +756,85,0,0,5 +757,85,0,0,5 +758,85,0,0,5 +759,85,0,0,5 +760,85,0,0,5 +761,85,0,0,5 +762,85,0,0,5 +763,85,0,0,5 +764,85,0,0,5 +765,85,0,0,5 +766,85,0,0,5 +767,85,0,0,5 +768,85,0,0,5 +769,85,0,0,5 +770,85,0,0,5 +771,85,0,0,5 +772,85,0,0,5 +773,85,0,0,5 +774,85,0,0,5 +775,85,0,0,5 +776,85,0,0,5 +777,85,0,0,5 +778,85,0,0,5 +779,85,0,0,5 +780,85,0,0,5 +781,85,0,0,5 +782,85,0,0,5 +783,85,0,0,5 +784,85,0,0,5 +785,85,0,0,5 +786,85,0,0,5 +787,85,0,0,5 +788,85,0,0,5 +789,85,0,0,5 +790,85,0,0,5 +791,85,0,0,5 +792,85,0,0,5 +793,85,0,0,5 +794,85,0,0,5 +795,85,0,0,5 +796,85,0,0,5 +797,85,0,0,5 +798,85,0,0,5 +799,85,0,0,5 +800,85,0,0,5 +801,85,0,0,5 +802,85,0,0,5 +803,85,0,0,5 +804,85,0,0,5 +805,85,0,0,5 +806,85,0,0,5 +807,85,0,0,5 +808,85,0,0,5 +809,85,0,0,5 +810,85,0,0,5 +811,85,0,0,5 +812,85,0,0,5 +813,85,0,0,5 +814,85,0,0,5 +815,85,0,0,5 +816,85,0,0,5 +817,85,0,0,5 +818,85,0,0,5 +819,85,0,0,5 +820,85,0,0,5 +821,85,0,0,5 +822,85,0,0,5 +823,85,0,0,5 +824,85,0,0,5 +825,85,0,0,5 +826,85,0,0,5 +827,85,0,0,5 +828,85,0,0,5 +829,85,0,0,5 +830,85,0,0,5 +831,85,0,0,5 +832,85,0,0,5 +833,85,0,0,5 +834,85,0,0,5 +835,85,0,0,5 +836,85,0,0,5 +837,85,0,0,5 +838,85,0,0,5 +839,85,0,0,5 +840,85,0,0,5 +841,85,0,0,5 +842,85,0,0,5 +843,85,0,0,5 +844,85,0,0,5 +845,85,0,0,5 +846,85,0,0,5 +847,85,0,0,5 +848,85,0,0,5 +849,85,0,0,5 +850,85,0,0,5 +851,85,0,0,5 +852,85,0,0,5 +853,85,0,0,5 +854,85,0,0,5 +855,85,0,0,5 +856,85,0,0,5 +857,85,0,0,5 +858,85,0,0,5 +859,85,0,0,5 +860,85,0,0,5 +861,85,0,0,5 +862,85,0,0,5 +863,85,0,0,5 +864,85,0,0,5 +865,85,0,0,5 +866,85,0,0,5 +867,85,0,0,5 +868,85,0,0,5 +869,85,0,0,5 +870,85,0,0,5 +871,85,0,0,5 +872,85,0,0,5 +873,85,0,0,5 +874,85,0,0,5 +875,85,0,0,5 +876,85,0,0,5 +877,85,0,0,5 +878,85,0,0,5 +879,85,0,0,5 +880,85,0,0,5 +881,85,0,0,5 +882,85,0,0,5 +883,85,0,0,5 +884,85,0,0,5 +885,85,0,0,5 +886,85,0,0,5 +887,85,0,0,5 +888,85,0,0,5 +889,85,0,0,5 +890,85,0,0,5 +891,85,0,0,5 +892,85,0,0,5 +893,85,0,0,5 +894,85,0,0,5 +895,85,0,0,5 +896,85,0,0,5 +897,85,0,0,5 +898,85,0,0,5 +899,85,0,0,5 +900,85,0,0,5 +901,85,0,0,5 +902,85,0,0,5 +903,85,0,0,5 +904,85,0,0,5 +905,85,0,0,5 +906,85,0,0,5 +907,85,0,0,5 +908,85,0,0,5 +909,85,0,0,5 +910,85,0,0,5 +911,85,0,0,5 +912,85,0,0,5 +913,85,0,0,5 +914,85,0,0,5 +915,85,0,0,5 +916,85,0,0,5 +917,85,0,0,5 +918,85,0,0,5 +919,85,0,0,5 +920,85,0,0,5 +921,85,0,0,5 +922,85,0,0,5 +923,85,0,0,5 +924,85,0,0,5 +925,85,0,0,5 +926,85,0,0,5 +927,85,0,0,5 +928,85,0,0,5 +929,85,0,0,5 +930,85,0,0,5 +931,85,0,0,5 +932,85,0,0,5 +933,85,0,0,5 +934,85,0,0,5 +935,85,0,0,5 +936,85,0,0,5 +937,85,0,0,5 +938,85,0,0,5 +939,85,0,0,5 +940,85,0,0,5 +941,85,0,0,5 +942,85,0,0,5 +943,85,0,0,5 +944,85,0,0,5 +945,85,0,0,5 +946,85,0,0,5 +947,85,0,0,5 +948,85,0,0,5 +949,85,0,0,5 +950,85,0,0,5 +951,85,0,0,5 +952,85,0,0,5 +953,85,0,0,5 +954,85,0,0,5 +955,85,0,0,5 +956,85,0,0,5 +957,85,0,0,5 +958,85,0,0,5 +959,85,0,0,5 +960,85,0,0,5 +961,85,0,0,5 +962,85,0,0,5 +963,85,0,0,5 +964,85,0,0,5 +965,85,0,0,5 +966,85,0,0,5 +967,85,0,0,5 +968,85,0,0,5 +969,85,0,0,5 +970,85,0,0,5 +971,85,0,0,5 +972,85,0,0,5 +973,85,0,0,5 +974,85,0,0,5 +975,85,0,0,5 +976,85,0,0,5 +977,85,0,0,5 +978,85,0,0,5 +979,85,0,0,5 +980,85,0,0,5 +981,85,0,0,5 +982,85,0,0,5 +983,85,0,0,5 +984,85,0,0,5 +985,85,0,0,5 +986,85,0,0,5 +987,85,0,0,5 +988,85,0,0,5 +989,85,0,0,5 +990,85,0,0,5 +991,85,0,0,5 +992,85,0,0,5 +993,85,0,0,5 +994,85,0,0,5 +995,85,0,0,5 +996,85,0,0,5 +997,85,0,0,5 +998,85,0,0,5 +999,85,0,0,5 +1000,85,0,0,5 \ No newline at end of file diff --git a/VectoCoreTest/TestData/Integration/DriverStrategy/Vecto2.2/40t Truck/40t_Long_Haul_Truck_EngineIdle.vecto b/VectoCoreTest/TestData/Integration/DriverStrategy/Vecto2.2/40t Truck/40t_Long_Haul_Truck_EngineIdle.vecto new file mode 100644 index 0000000000000000000000000000000000000000..c1376af912493899c877af0a651ff064b7ec555c --- /dev/null +++ b/VectoCoreTest/TestData/Integration/DriverStrategy/Vecto2.2/40t Truck/40t_Long_Haul_Truck_EngineIdle.vecto @@ -0,0 +1,36 @@ +{ + "Header": { + "CreatedBy": " ()", + "Date": "9/28/2015 8:54:35 AM", + "AppVersion": "2.2", + "FileVersion": 2 + }, + "Body": { + "SavedInDeclMode": false, + "VehicleFile": "40t_Long_Haul_Truck.vveh", + "EngineFile": "40t_Long_Haul_Truck.veng", + "GearboxFile": "40t_Long_Haul_Truck_EngineIdle.vgbx", + "Cycles": [ + "C:\\Workspaces\\VisualStudio\\VECTO_quam\\VectoCoreTest\\TestData\\Integration\\DriverStrategy\\Cycles\\Cycle_Accelerate_0_85_level_5kWAux.vdri" + ], + "VACC": "Truck.vacc", + "EngineOnlyMode": false, + "StartStop": { + "Enabled": false, + "MaxSpeed": 5.0, + "MinTime": 5.0, + "Delay": 5 + }, + "LAC": { + "Enabled": true, + "Dec": -0.5, + "MinSpeed": 50.0 + }, + "OverSpeedEcoRoll": { + "Mode": "Off", + "MinSpeed": 50.0, + "OverSpeed": 5.0, + "UnderSpeed": 5.0 + } + } +} \ No newline at end of file diff --git a/VectoCoreTest/TestData/Integration/DriverStrategy/Vecto2.2/40t Truck/40t_Long_Haul_Truck_EngineIdle.vgbx b/VectoCoreTest/TestData/Integration/DriverStrategy/Vecto2.2/40t Truck/40t_Long_Haul_Truck_EngineIdle.vgbx new file mode 100644 index 0000000000000000000000000000000000000000..78293971c050e253b2590e474e80f6772ee55e12 --- /dev/null +++ b/VectoCoreTest/TestData/Integration/DriverStrategy/Vecto2.2/40t Truck/40t_Long_Haul_Truck_EngineIdle.vgbx @@ -0,0 +1,118 @@ +{ + "Header": { + "CreatedBy": " ()", + "Date": "9/28/2015 8:54:32 AM", + "AppVersion": "2.2", + "FileVersion": 5 + }, + "Body": { + "SavedInDeclMode": false, + "ModelName": "Generic 40t Long Haul Truck", + "Inertia": 0.0, + "TracInt": 10.0, + "Gears": [ + { + "Ratio": 2.59, + "LossMap": "Axle 40t Truck.vtlm" + }, + { + "Ratio": 14.93, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 11.64, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 9.02, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 7.04, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 5.64, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 4.4, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 3.39, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 2.65, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 2.05, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 1.6, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 1.28, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + }, + { + "Ratio": 1.0, + "LossMap": "Indirect Gear.vtlm", + "TCactive": false, + "ShiftPolygon": "ShiftPolygons.vgbs", + "FullLoadCurve": "<NOFILE>" + } + ], + "TqReserve": 20.0, + "SkipGears": true, + "ShiftTime": 2, + "EaryShiftUp": true, + "StartTqReserve": 20.0, + "StartSpeed": 2.0, + "StartAcc": 0.6, + "GearboxType": "AMT", + "TorqueConverter": { + "Enabled": false, + "File": "<NOFILE>", + "RefRPM": 0.0, + "Inertia": 0.0 + } + } +} \ No newline at end of file diff --git a/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_10Hz.csv b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_10Hz.csv index 2eb86eed43fe5ad030edca01e6bbc625db345cec..29bc85efe197f6833a1bb5dfbcd6f02b859a8bfb 100644 --- a/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_10Hz.csv +++ b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_10Hz.csv @@ -1,232 +1,231 @@ t,Pe_FullDyn -2.00,37018.0353 -2.10,68310.8016 -2.20,94799.5563 -2.30,117221.8032 -2.40,136201.8254 -2.50,152268.0673 -2.60,165867.8474 -2.70,177379.8128 -2.80,187124.4811 -2.90,195373.1647 -3.00,202355.5247 -3.10,208265.9648 -3.20,213269.0443 -3.30,217504.0597 -3.40,221088.9228 -3.50,224123.444 -3.60,226692.1106 -3.70,228866.44 -3.80,230706.9701 -3.90,232264.9452 -4.00,233583.7427 -4.10,234700.0806 -4.20,235645.0403 -4.30,236444.9314 -4.40,237122.0245 -4.50,237695.1715 -4.60,238180.33 -4.70,238591.0078 -4.80,238938.639 -4.90,239232.9025 -5.00,239481.9912 -5.10,239692.8402 -5.20,239871.32 -5.30,240022.3999 -5.40,240150.2863 -5.50,240258.5398 -5.60,240350.1744 -5.70,240427.7414 -5.80,240493.4004 -5.90,240548.9796 -6.00,240596.0264 -6.10,240635.8506 -6.20,240669.5611 -6.30,240698.0964 -6.40,240722.2511 -6.50,240742.6975 -6.60,240760.005 -6.70,240774.6556 -6.80,240787.0569 -6.90,240797.5545 -7.00,240806.4405 -7.10,240813.9623 -7.20,240820.3294 -7.30,240825.719 -7.40,240830.2812 -7.50,240834.1431 -7.60,240837.412 -7.70,240840.1792 -7.80,240842.5215 -7.90,240844.5042 -8.00,240846.1826 -8.10,240847.6033 -8.20,240848.8058 -8.30,240849.8238 -8.40,240850.6855 -8.50,240851.4149 -8.60,240852.0323 -8.70,240852.555 -8.80,240852.9974 -8.90,240853.3719 -9.00,240853.6889 -9.10,240853.9572 -9.20,240854.1844 -9.30,240854.3766 -9.40,240854.5394 -9.50,240854.6771 -9.60,240854.7938 -9.70,240854.8925 -9.80,240854.976 -9.90,240855.0468 -10.00,240855.1066 -10.10,37018.0353 -10.20,37018.0353 -10.30,37018.0353 -10.40,37018.0353 -10.50,37018.0353 -10.60,37018.0353 -10.70,37018.0353 -10.80,37018.0353 -10.90,37018.0353 -11.00,37018.0353 -11.10,37018.0353 -11.20,37018.0353 -11.30,37018.0353 -11.40,37018.0353 -11.50,37018.0353 -11.60,37018.0353 -11.70,37018.0353 -11.80,37018.0353 -11.90,37018.0353 -12.00,37018.0353 -12.10,37018.0353 -12.20,37018.0353 -12.30,37018.0353 -12.40,37018.0353 -12.50,37018.0353 -12.60,37018.0353 -12.70,37018.0353 -12.80,37018.0353 -12.90,37018.0353 -13.00,37018.0353 -13.10,37018.0353 -13.20,37018.0353 -13.30,37018.0353 -13.40,37018.0353 -13.50,37018.0353 -13.60,37018.0353 -13.70,37018.0353 -13.80,37018.0353 -13.90,37018.0353 -14.00,37018.0353 -14.10,37018.0353 -14.20,37018.0353 -14.30,37018.0353 -14.40,37018.0353 -14.50,37018.0353 -14.60,37018.0353 -14.70,37018.0353 -14.80,37018.0353 -14.90,37018.0353 -15.00,37018.0353 -15.10,37018.0353 -15.20,37018.0353 -15.30,37018.0353 -15.40,37018.0353 -15.50,37018.0353 -15.60,37018.0353 -15.70,37018.0353 -15.80,37018.0353 -15.90,37018.0353 -16.00,37018.0353 -16.10,37018.0353 -16.20,37018.0353 -16.30,37018.0353 -16.40,37018.0353 -16.50,37018.0353 -16.60,37018.0353 -16.70,37018.0353 -16.80,37018.0353 -16.90,37018.0353 -17.00,37018.0353 -17.10,37018.0353 -17.20,37018.0353 -17.30,37018.0353 -17.40,37018.0353 -17.50,37018.0353 -17.60,37018.0353 -17.70,37018.0353 -17.80,37018.0353 -17.90,37018.0353 -18.00,37018.0353 -18.10,37018.0353 -18.20,37018.0353 -18.30,37018.0353 -18.40,37018.0353 -18.50,37018.0353 -18.60,37018.0353 -18.70,37018.0353 -18.80,37018.0353 -18.90,37018.0353 -19.00,37018.0353 -19.10,37018.0353 -19.20,37018.0353 -19.30,37018.0353 -19.40,37018.0353 -19.50,37018.0353 -19.60,37018.0353 -19.70,37018.0353 -19.80,37018.0353 -19.90,37018.0353 -20.00,37018.0353 -20.10,37018.0353 -20.20,37018.0353 -20.30,37018.0353 -20.40,37018.0353 -20.50,37018.0353 -20.60,37018.0353 -20.70,37018.0353 -20.80,37018.0353 -20.90,37018.0353 -21.00,37018.0353 -21.10,37018.0353 -21.20,37018.0353 -21.30,37018.0353 -21.40,37018.0353 -21.50,37018.0353 -21.60,37018.0353 -21.70,37018.0353 -21.80,37018.0353 -21.90,37018.0353 -22.00,37018.0353 -22.10,37018.0353 -22.20,37018.0353 -22.30,37018.0353 -22.40,37018.0353 -22.50,37018.0353 -22.60,37018.0353 -22.70,37018.0353 -22.80,37018.0353 -22.90,37018.0353 -23.00,37018.0353 -23.10,37018.0353 -23.20,37018.0353 -23.30,37018.0353 -23.40,37018.0353 -23.50,37018.0353 -23.60,37018.0353 -23.70,37018.0353 -23.80,37018.0353 -23.90,37018.0353 -24.00,37018.0353 -24.10,37018.0353 -24.20,37018.0353 -24.30,37018.0353 -24.40,37018.0353 -24.50,37018.0353 -24.60,37018.0353 -24.70,37018.0353 -24.80,37018.0353 -24.90,37018.0353 -25.00,37018.0353 +2.00,69198.81418 +2.10,95551.24279 +2.20,117858.09202 +2.30,136740.43223 +2.40,152723.98814 +2.50,166253.77612 +2.60,177706.49438 +2.70,187401.01109 +2.80,195607.24232 +2.90,202553.66709 +3.00,208433.68870 +3.10,213411.01954 +3.20,217624.23914 +3.30,221190.65253 +3.40,224209.55629 +3.50,226765.00315 +3.60,228928.14221 +3.70,230759.19990 +3.80,232309.15677 +3.90,233621.16694 +4.00,234731.75956 +4.10,235671.85593 +4.20,236467.63032 +4.30,237141.23880 +4.40,237711.43606 +4.50,238194.09763 +4.60,238602.66182 +4.70,238948.50395 +4.80,239241.25299 +4.90,239489.05970 +5.00,239698.82355 +5.10,239876.38482 +5.20,240026.68719 +5.30,240153.91539 +5.40,240261.61175 +5.50,240352.77474 +5.60,240429.94255 +5.70,240495.26369 +5.80,240550.55684 +5.90,240597.36148 +6.00,240636.98076 +6.10,240670.51775 +6.20,240698.90620 +6.30,240722.93650 +6.40,240743.27771 +6.50,240760.49618 +6.60,240775.07130 +6.70,240787.40887 +6.80,240797.85239 +6.90,240806.69265 +7.00,240814.17576 +7.10,240820.51008 +7.20,240825.87197 +7.30,240830.41071 +7.40,240834.25267 +7.50,240837.50481 +7.60,240840.25770 +7.70,240842.58796 +7.80,240844.56049 +7.90,240846.23020 +8.00,240847.64358 +8.10,240848.83998 +8.20,240849.85270 +8.30,240850.70996 +8.40,240851.43561 +8.50,240852.04987 +8.60,240852.56982 +8.70,240853.00995 +8.80,240853.38251 +8.90,240853.69788 +9.00,240853.96483 +9.10,240854.19080 +9.20,240854.38208 +9.30,240854.54400 +9.40,240854.68105 +9.50,240854.79707 +9.60,240854.89528 +9.70,240854.97841 +9.80,240855.04877 +9.90,240855.10834 +10.10,240855.20144 +10.20,69198.81418 +10.30,69198.81418 +10.40,69198.81418 +10.50,69198.81418 +10.60,69198.81418 +10.70,69198.81418 +10.80,69198.81418 +10.90,69198.81418 +11.00,69198.81418 +11.10,69198.81418 +11.20,69198.81418 +11.30,69198.81418 +11.40,69198.81418 +11.50,69198.81418 +11.60,69198.81418 +11.70,69198.81418 +11.80,69198.81418 +11.90,69198.81418 +12.00,69198.81418 +12.10,69198.81418 +12.20,69198.81418 +12.30,69198.81418 +12.40,69198.81418 +12.50,69198.81418 +12.60,69198.81418 +12.70,69198.81418 +12.80,69198.81418 +12.90,69198.81418 +13.00,69198.81418 +13.10,69198.81418 +13.20,69198.81418 +13.30,69198.81418 +13.40,69198.81418 +13.50,69198.81418 +13.60,69198.81418 +13.70,69198.81418 +13.80,69198.81418 +13.90,69198.81418 +14.00,69198.81418 +14.10,69198.81418 +14.20,69198.81418 +14.30,69198.81418 +14.40,69198.81418 +14.50,69198.81418 +14.60,69198.81418 +14.70,69198.81418 +14.80,69198.81418 +14.90,69198.81418 +15.00,69198.81418 +15.10,69198.81418 +15.20,69198.81418 +15.30,69198.81418 +15.40,69198.81418 +15.50,69198.81418 +15.60,69198.81418 +15.70,69198.81418 +15.80,69198.81418 +15.90,69198.81418 +16.00,69198.81418 +16.10,69198.81418 +16.20,69198.81418 +16.30,69198.81418 +16.40,69198.81418 +16.50,69198.81418 +16.60,69198.81418 +16.70,69198.81418 +16.80,69198.81418 +16.90,69198.81418 +17.00,69198.81418 +17.10,69198.81418 +17.20,69198.81418 +17.30,69198.81418 +17.40,69198.81418 +17.50,69198.81418 +17.60,69198.81418 +17.70,69198.81418 +17.80,69198.81418 +17.90,69198.81418 +18.00,69198.81418 +18.10,69198.81418 +18.20,69198.81418 +18.30,69198.81418 +18.40,69198.81418 +18.50,69198.81418 +18.60,69198.81418 +18.70,69198.81418 +18.80,69198.81418 +18.90,69198.81418 +19.00,69198.81418 +19.10,69198.81418 +19.20,69198.81418 +19.30,69198.81418 +19.40,69198.81418 +19.50,69198.81418 +19.60,69198.81418 +19.70,69198.81418 +19.80,69198.81418 +19.90,69198.81418 +20.00,69198.81418 +20.10,69198.81418 +20.20,69198.81418 +20.30,69198.81418 +20.40,69198.81418 +20.50,69198.81418 +20.60,69198.81418 +20.70,69198.81418 +20.80,69198.81418 +20.90,69198.81418 +21.00,69198.81418 +21.10,69198.81418 +21.20,69198.81418 +21.30,69198.81418 +21.40,69198.81418 +21.50,69198.81418 +21.60,69198.81418 +21.70,69198.81418 +21.80,69198.81418 +21.90,69198.81418 +22.00,69198.81418 +22.10,69198.81418 +22.20,69198.81418 +22.30,69198.81418 +22.40,69198.81418 +22.50,69198.81418 +22.60,69198.81418 +22.70,69198.81418 +22.80,69198.81418 +22.90,69198.81418 +23.00,69198.81418 +23.10,69198.81418 +23.20,69198.81418 +23.30,69198.81418 +23.40,69198.81418 +23.50,69198.81418 +23.60,69198.81418 +23.70,69198.81418 +23.80,69198.81418 +23.90,69198.81418 +24.00,69198.81418 +24.10,69198.81418 +24.20,69198.81418 +24.30,69198.81418 +24.40,69198.81418 +24.50,69198.81418 +24.60,69198.81418 +24.70,69198.81418 +24.80,69198.81418 +24.90,69198.81418 +25.00,69198.81418 diff --git a/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_1Hz.csv b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_1Hz.csv index 14e5fec6cb64aa887e1123e5e9497f5dec614fec..e734f6a97181399801d1ee5c034abfdec72b00c3 100644 --- a/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_1Hz.csv +++ b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_1Hz.csv @@ -1,12 +1,12 @@ t,Pe_FullDyn -2.0,37018.0353 -3.0,202355.5247 -4.0,233583.7427 -5.0,239481.9912 -6.0,240596.0264 -7.0,240806.4405 -8.0,240846.1826 -9.0,240853.6889 +2.0,69198.81418 +3.0,208433.68870 +4.0,234731.75956 +5.0,239698.82355 +6.0,240637.0 +7.0,240814.175 +8.0,240847.6436 +9.0,240853.9648 10.0,240855.1066 11.0,195373.1647 12.0,195373.1647 diff --git a/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_varHz.csv b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_varHz.csv index bfe0fd1501b8ca81832c61b4346c88988286889b..9da027faa9b83b9314d638b22ca75440ab9f019f 100644 --- a/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_varHz.csv +++ b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/EngineFLJ_1000rpm_varHz.csv @@ -1,46 +1,46 @@ t,Pe_FullDyn -2.00,37018.0353 -3.25,215474.7305 -3.65,227824.5477 -3.85,231518.3967 -4.55,237947.8524 -5.45,240206.667 -6.15,240653.4078 -6.25,240684.4229 -6.45,240732.9 -7.25,240823.1364 -7.95,240845.3783 -8.35,240850.2726 -8.65,240852.3045 -8.85,240853.1924 -9.65,240854.8452 -9.95,240855.078 -10.00,240855.1066 +2.00,69198.8142 +3.25,219481.7031 +3.65,229881.7960 +3.85,232992.4796 +4.55,238406.8866 +5.45,240309.0914 +6.15,240685.3031 +6.25,240711.4217 +6.45,240752.2455 +7.25,240828.2358 +7.95,240846.9663 +8.35,240851.0879 +8.65,240852.7990 +8.85,240853.5468 +9.65,240854.9386 +9.95,240855.1346 +10.00,240855.1588 10.40,117221.8032 11.20,177379.8128 12.00,177379.8128 -12.20,68310.8016 +12.20,69198.8142 13.20,195373.1647 -13.40,68310.8016 +13.40,69198.8142 14.10,165867.8474 -14.20,37018.0353 +14.20,69198.8142 14.90,165867.8474 -15.00,37018.0353 +15.00,69198.8142 15.90,187124.4811 -16.10,68310.8016 +16.10,69198.8142 16.50,117221.8032 -16.70,68310.8016 +16.70,69198.8142 17.30,152268.0673 18.20,187124.4811 18.60,117221.8032 19.00,117221.8032 19.50,136201.8254 -19.60,37018.0353 +19.60,69198.8142 20.00,117221.8032 20.90,187124.4811 21.70,177379.8128 -21.80,37018.0353 -21.90,37018.0353 +21.80,69198.8142 +21.90,69198.8142 22.60,165867.8474 23.50,187124.4811 24.20,165867.8474 diff --git a/VectoCoreTest/TestData/Results/EngineFullLoadJumps/FLD variable time steps martin.xlsx b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/FLD variable time steps martin.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..74b9ce01c404b42c1e5f9c1c3cc8b9e9cb7cf232 Binary files /dev/null and b/VectoCoreTest/TestData/Results/EngineFullLoadJumps/FLD variable time steps martin.xlsx differ diff --git a/VectoCoreTest/Utils/GraphWriter.cs b/VectoCoreTest/Utils/GraphWriter.cs new file mode 100644 index 0000000000000000000000000000000000000000..a8d8c4ad0113512e3cf1590b2093277cf8e177ea --- /dev/null +++ b/VectoCoreTest/Utils/GraphWriter.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Specialized; +using System.Data; +using System.IO; +using System.Linq; +using System.Net; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public static class GraphWriter + { + public static void Write(string fileNameV3, string fileNameV22) + { + var modDataV3 = VectoCSVFile.Read(fileNameV3); + var modDataV22 = VectoCSVFile.Read(fileNameV22); + + var xfields = new[] { ModalResultField.time, ModalResultField.dist }; + + var yfields = new[] { + ModalResultField.v_act, ModalResultField.n, ModalResultField.Gear, ModalResultField.Pe_eng, ModalResultField.Tq_eng, + ModalResultField.FCMap + }; + + foreach (var xfield in xfields) { + for (var i = 1; i <= yfields.Length; i++) { + var yfield = yfields[i - 1]; + var x = modDataV3.Rows.Cast<DataRow>().Select(v => v.Field<string>(ModalResultField.time.GetName())).ToArray(); + var y = modDataV3.Rows.Cast<DataRow>().Select(v => v.Field<string>(yfield.GetName())).ToArray(); + + var x2 = modDataV22.Rows.Cast<DataRow>().Select(v => v.Field<string>(ModalResultField.time.GetName())).ToArray(); + var y2 = modDataV22.Rows.Cast<DataRow>().Select(v => v.Field<string>(yfield.GetName())).ToArray(); + + + var fileName = string.Format("{0}_{1}_{2}.png", Path.GetFileNameWithoutExtension(fileNameV3), xfield, i); + var values = string.Format("{0}|{1}|{2}|{3}", string.Join(",", x), string.Join(",", y), string.Join(",", x2), + string.Join(",", y2)); + + var maxX = (int)Math.Ceiling(Math.Max(x.ToDouble().Max(), x2.ToDouble().Max())); + CreateGraphFile(fileName, xfield.GetCaption(), yfield.GetCaption(), maxX, values); + } + } + } + + private static void CreateGraphFile(string filename, string xLabel, string yLabel, int xAxisRange, string values) + { + using (var client = new WebClient()) { + byte[] response = client.UploadValues("https://chart.googleapis.com/chart", new NameValueCollection { + { "cht", "lxy" }, + { "chd", "t:" + values }, + { "chs", "1000x300" }, + { "chxt", "x,x,y,y" }, + { "chds", "a" }, + { "chxr", string.Format("0,0,{0},10", xAxisRange) }, + { "chco", "0000FF,FF0000" }, + { "chg", "5,10" }, + { "chxl", string.Format("1:|{0}|3:|{1}", xLabel, yLabel) }, + { "chxp", "1,0|3,0" }, + { "chdl", "V3|V2.2" }, + }); + + File.WriteAllBytes(filename, response); + } + } + } +} \ No newline at end of file diff --git a/VectoCoreTest/VectoCoreTest.csproj b/VectoCoreTest/VectoCoreTest.csproj index 977814744122561716a2fce2937a933983a58f95..b70a6a6c16baaf6bcf2746b54891b8f20d454163 100644 --- a/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCoreTest/VectoCoreTest.csproj @@ -64,6 +64,7 @@ <Compile Include="Integration\CoachPowerTrain.cs" /> <Compile Include="Integration\DriverStrategy\DriverStrategyTestCoach.cs" /> <Compile Include="Integration\DriverStrategy\DriverStrategyTestTruck.cs" /> + <Compile Include="Utils\GraphWriter.cs" /> <Compile Include="Integration\EngineOnlyCycle\EngineOnlyCycleTest.cs" /> <Compile Include="Integration\SimpleDrivingCycles.cs" /> <Compile Include="Integration\SimulationRuns\FullPowertrain.cs" />