From 4f2cf46adf17777b51aaef479b6ac216c2b7bf35 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Wed, 28 Sep 2016 16:17:33 +0200 Subject: [PATCH] output of P_PTO_transm, P_PTO_consum in modfile --- VECTO/GUI/VehicleForm.Designer.vb | 6 +++--- .../Models/Declaration/DeclarationData.cs | 12 +---------- .../Models/Simulation/Data/ModalResult.cs | 3 +++ .../Models/Simulation/DataBus/IClutchInfo.cs | 1 - .../Models/Simulation/IVehicleContainer.cs | 2 ++ .../Models/Simulation/Impl/VectoRun.cs | 6 ++---- .../Simulation/Impl/VehicleContainer.cs | 6 ++++-- .../Impl/DistanceBasedDrivingCycle.cs | 7 ++++--- .../Impl/EngineAuxiliary.cs | 12 +++++++---- .../SimulationComponent/Impl/Gearbox.cs | 20 ++++++++++--------- .../Impl/GearboxAuxiliary.cs | 16 ++++++++++++++- .../Impl/IdleControllerSwitcher.cs | 6 ++++-- .../Impl/PTOCycleController.cs | 8 ++++++++ .../Impl/PowertrainDrivingCycle.cs | 8 +++++--- .../OutputData/ModalDataContainer.cs | 2 ++ .../VectoCore/Utils/ProviderExtensions.cs | 7 +++++-- 16 files changed, 77 insertions(+), 45 deletions(-) diff --git a/VECTO/GUI/VehicleForm.Designer.vb b/VECTO/GUI/VehicleForm.Designer.vb index a748a6adcb..2c100608ab 100644 --- a/VECTO/GUI/VehicleForm.Designer.vb +++ b/VECTO/GUI/VehicleForm.Designer.vb @@ -834,7 +834,7 @@ Partial Class VehicleForm Me.gbPTO.Size = New System.Drawing.Size(564, 86) Me.gbPTO.TabIndex = 4 Me.gbPTO.TabStop = False - Me.gbPTO.Text = "PTO Consumer" + Me.gbPTO.Text = "PTO Transmission" ' 'pnPTO ' @@ -1034,7 +1034,7 @@ Partial Class VehicleForm Me.Label8.TabIndex = 10 Me.Label8.Text = "HDV Class" ' - 'F_VEH + 'VehicleForm ' Me.AcceptButton = Me.ButOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1058,7 +1058,7 @@ Partial Class VehicleForm Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False - Me.Name = "F_VEH" + Me.Name = "VehicleForm" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "F05_VEH" Me.GroupBox6.ResumeLayout(False) diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 1fd9e7bbf9..826e67036e 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -197,7 +197,6 @@ namespace TUGraz.VectoCore.Models.Declaration public const double DecisionFactorCoastingScaling = 1.5; public const double LookAheadDistanceFactor = 10; public static readonly MeterPerSecond MinimumSpeed = 50.KMPHtoMeterPerSecond(); - } public static class OverSpeedEcoRoll @@ -371,7 +370,7 @@ namespace TUGraz.VectoCore.Models.Declaration fullLoadCurve.TakeWhile(fldEntry => fldEntry.EngineSpeed < rpmLimit) .Select( fldEntry => - new Point(fldEntry.EngineSpeed.Value(), fldEntry.TorqueFullLoad.Value() * ShiftPolygonEngineFldMargin)) + new Point(fldEntry.EngineSpeed.Value(), fldEntry.TorqueFullLoad.Value() * ShiftPolygonEngineFldMargin)) .ToList(); } @@ -449,14 +448,5 @@ namespace TUGraz.VectoCore.Models.Declaration return pointSet; } } - - //public static IEnumerable<string> AuxiliaryIDs() - //{ - // return new[] { - // Constants.Auxiliaries.IDs.Fan, Constants.Auxiliaries.IDs.SteeringPump, - // Constants.Auxiliaries.IDs.HeatingVentilationAirCondition, Constants.Auxiliaries.IDs.ElectricSystem, - // Constants.Auxiliaries.IDs.PneumaticSystem - // }; - //} } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs b/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs index 543fdc2429..def6603b86 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs @@ -285,6 +285,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// </summary> [ModalResultField(typeof(SI), caption: "P_wheel_in [kW]", outputFactor: 1e-3)] P_wheel_in, + [ModalResultField(typeof(SI), caption: "P_PTO_transm [kW]", outputFactor: 1e-3)] P_PTO_transm, + [ModalResultField(typeof(SI), caption: "P_PTO_consum [kW]", outputFactor: 1e-3)] P_PTO_consum, + /// <summary> /// [kW] Brake power. Drag power is included in Pe. /// </summary> diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs index 7154df191a..a9855472c7 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs @@ -33,7 +33,6 @@ using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Models.Simulation.DataBus { - public interface IClutchInfo { /// <summary> diff --git a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs index 4534be8a1e..7e6718f20c 100644 --- a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs @@ -55,6 +55,8 @@ namespace TUGraz.VectoCore.Models.Simulation VectoRun.Status RunStatus { get; set; } + Second AbsTime { get; set; } + /// <summary> /// Adds a component to the vehicle container. /// </summary> diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs index 99d438f5ba..ea0886c114 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs @@ -37,7 +37,6 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Simulation.Impl @@ -53,8 +52,6 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl // ReSharper disable once InconsistentNaming protected Second dt = 1.SI<Second>(); private bool _cancelled; - protected SummaryDataContainer SumWriter { get; set; } - protected string JobName { get; set; } protected ISimulationOutPort CyclePort { get; set; } [Required, ValidateObject] @@ -103,7 +100,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl Log.Info("VectoJob started running."); - //var lastProgress = -1.0; + Container.AbsTime = AbsTime; Initialize(); try { @@ -120,6 +117,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl Container.FinishSimulation(); return; } + Container.AbsTime = AbsTime; } } while (response is ResponseSuccess); } catch (VectoSimulationException vse) { diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index e7f0816225..1ed63f2fe0 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -46,7 +46,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Simulation.Impl { - public class VehicleContainer : LoggingObject, IVehicleContainer + public sealed class VehicleContainer : LoggingObject, IVehicleContainer { private List<Tuple<int, VectoSimulationComponent>> _components = new List<Tuple<int, VectoSimulationComponent>>(); @@ -240,7 +240,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl return Cycle; } - public virtual void AddComponent(VectoSimulationComponent component) + public Second AbsTime { get; set; } + + public void AddComponent(VectoSimulationComponent component) { var commitPriority = 0; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index 9eec72dc38..58c429fe8d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -260,6 +260,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl container[ModalResultField.v_targ] = CurrentState.VehicleTargetSpeed; container[ModalResultField.grad] = (Math.Tan(CurrentState.Gradient.Value()) * 100).SI<Scalar>(); container[ModalResultField.altitude] = CurrentState.Altitude; + + if (IdleController != null) { + IdleController.CommitSimulationStep(container); + } } protected override void DoCommitSimulationStep() @@ -272,9 +276,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState = CurrentState.Clone(); _intervalProlonged = false; - if (IdleController != null) { - IdleController.CommitSimulationStep(); - } var stopTime = Left.PTOActive && IdleController != null ? Left.StoppingTime + IdleController.Duration : Left.StoppingTime; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs index 346199cc47..84e8327138 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs @@ -47,7 +47,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { private const string DirectAuxiliaryId = ""; - private readonly Dictionary<string, Func<PerSecond, Watt>> _auxiliaries = + protected readonly Dictionary<string, Func<PerSecond, Watt>> _auxiliaries = new Dictionary<string, Func<PerSecond, Watt>>(); public EngineAuxiliary(IVehicleContainer container) : base(container) {} @@ -100,11 +100,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl PerSecond angularSpeed, bool dryRun = false) { CurrentState.AngularSpeed = angularSpeed; - var avgAngularSpeed = (CurrentState.AngularSpeed + PreviousState.AngularSpeed) / 2.0; - return ComputePowerDemand(avgAngularSpeed) / avgAngularSpeed; + var avgAngularSpeed = (PreviousState.AngularSpeed != null) + ? (CurrentState.AngularSpeed + PreviousState.AngularSpeed) / 2.0 + : CurrentState.AngularSpeed; + if (avgAngularSpeed.IsGreater(0)) + return ComputePowerDemand(avgAngularSpeed) / avgAngularSpeed; + return 0.SI<NewtonMeter>(); } - private Watt ComputePowerDemand(PerSecond engineSpeed) + protected virtual Watt ComputePowerDemand(PerSecond engineSpeed) { CurrentState.PowerDemands = new Dictionary<string, Watt>(_auxiliaries.Count); CurrentState.TotalPowerDemand = 0.SI<Watt>(); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index b989ba75ea..e5a3709fed 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -95,8 +95,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var gearboxTorqueLoss = ModelData.Gears[Gear].LossMap.GetTorqueLoss(outAngularVelocity, outTorque); CurrentState.TorqueLossResult = gearboxTorqueLoss; - //todo mk-2016-08-17: aux loss from out-direction or in-direction of the gearbox? - var auxTorqueLoss = Auxiliary == null ? 0.SI<NewtonMeter>() : Auxiliary.Initialize(outTorque, outAngularVelocity); + var auxTorqueLoss = Auxiliary == null ? 0.SI<NewtonMeter>() : Auxiliary.Initialize(null, inAngularVelocity); var inTorque = outTorque / ModelData.Gears[Gear].Ratio + gearboxTorqueLoss.Value @@ -130,7 +129,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //todo mk-2016-08-17: aux loss from out-direction or in-direction of the gearbox? if (Auxiliary != null) - inTorque += Auxiliary.Initialize(outTorque, outAngularVelocity); + inTorque += Auxiliary.Initialize(null, inAngularVelocity); } var response = NextComponent.Initialize(inTorque, inAngularVelocity); @@ -255,12 +254,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl }; } - CurrentState.SetState(0.SI<NewtonMeter>(), outAngularVelocity * ModelData.Gears[PreviousState.Gear].Ratio, outTorque, + var inTorque = 0.SI<NewtonMeter>(); + + CurrentState.SetState(inTorque, outAngularVelocity * ModelData.Gears[PreviousState.Gear].Ratio, outTorque, outAngularVelocity); CurrentState.Gear = PreviousState.Gear; - var response = NextComponent.Request(absTime, dt, 0.SI<NewtonMeter>(), null); + var response = NextComponent.Request(absTime, dt, inTorque, null); + response.GearboxPowerRequest = outTorque * avgAngularVelocity; + return response; } @@ -300,13 +303,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var inTorqueLossResult = ModelData.Gears[Gear].LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque); var inTorque = outTorque / ModelData.Gears[Gear].Ratio + inTorqueLossResult.Value; + var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear].Ratio; + if (Auxiliary != null) { - //todo mk-2016-08-17: aux loss from out-direction or in-direction of the gearbox? - inTorque += Auxiliary.TorqueDemand(absTime, dt, outTorque, inTorque, outAngularVelocity, dryRun); + inTorque += Auxiliary.TorqueDemand(absTime, dt, outTorque, inTorque, inAngularVelocity, dryRun); } - var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear].Ratio; - if (dryRun) { CurrentState.InertiaTorqueLossOut = !inAngularVelocity.IsEqual(0) ? Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) / diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearboxAuxiliary.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearboxAuxiliary.cs index 412a855890..e52fd27dbc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearboxAuxiliary.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearboxAuxiliary.cs @@ -1,4 +1,7 @@ +using System; +using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl @@ -9,7 +12,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected override void DoWriteModalResults(IModalDataContainer container) { - //todo mk-2016-08-17: write gearbox auxiliaries to mod file? + if (CurrentState.PowerDemands != null) { + if (CurrentState.PowerDemands.ContainsKey("PTO_TRANSM")) + container[ModalResultField.P_PTO_transm] = CurrentState.PowerDemands["PTO_TRANSM"]; + + if (CurrentState.PowerDemands.ContainsKey("PTO_CONSUMER")) + container[ModalResultField.P_PTO_consum] = CurrentState.PowerDemands["PTO_CONSUMER"]; + } else { + container[ModalResultField.P_PTO_transm] = 0.SI<Watt>(); + + if (container[ModalResultField.P_PTO_consum] == null || container[ModalResultField.P_PTO_consum] == DBNull.Value) + container[ModalResultField.P_PTO_consum] = 0.SI<Watt>(); + } } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs index 65c640bc2d..e96fd7ec97 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs @@ -2,6 +2,8 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { @@ -62,9 +64,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return _ptoController.GetNextCycleTime(); } - public void CommitSimulationStep() + public void CommitSimulationStep(IModalDataContainer container) { - _ptoController.CommitSimulationStep(null); + _ptoController.CommitSimulationStep(container); } public Second Duration diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs index c6799f61d9..bc6d5f50c1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs @@ -4,7 +4,9 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { @@ -63,5 +65,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return RightSample.Current.Time - LeftSample.Current.Time; } + + protected override void DoWriteModalResults(IModalDataContainer container) + { + base.DoWriteModalResults(container); + container[ModalResultField.P_PTO_consum] = CurrentState.InTorque * CurrentState.InAngularVelocity; + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index f399f17c7e..3f15fe4b7d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -48,11 +48,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// Represents a driving cycle which directly is connected to the powertrain (e.g. engine, or axle gear). /// </summary> public class PowertrainDrivingCycle : - StatefulProviderComponent<PowertrainDrivingCycle.DummyState, ISimulationOutPort, ITnInPort, ITnOutPort>, + StatefulProviderComponent<SimpleComponentState, ISimulationOutPort, ITnInPort, ITnOutPort>, IDrivingCycleInfo, ISimulationOutPort, ITnInProvider, ITnInPort { - public class DummyState {} - protected readonly DrivingCycleData Data; protected IEnumerator<DrivingCycleData.DrivingCycleEntry> RightSample { get; set; } protected IEnumerator<DrivingCycleData.DrivingCycleEntry> LeftSample { get; set; } @@ -111,6 +109,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var responseCount = 0; do { response = NextComponent.Request(absTime, dt, LeftSample.Current.Torque, angularVelocity); + CurrentState.InAngularVelocity = angularVelocity; + CurrentState.InTorque = LeftSample.Current.Torque; debug.Add(response); response.Switch() .Case<ResponseGearShift>( @@ -122,6 +122,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl evaluateFunction: t => NextComponent.Request(absTime, dt, t, angularVelocity, true), criterion: y => ((ResponseDryRun)y).DeltaDragLoad.Value()); response = NextComponent.Request(absTime, dt, torque, angularVelocity); + CurrentState.InTorque = torque; }) .Case<ResponseOverload>(r => { angularVelocity = SearchAlgorithm.Search(angularVelocity, r.Delta, 50.RPMtoRad(), @@ -129,6 +130,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl evaluateFunction: n => NextComponent.Request(absTime, dt, LeftSample.Current.Torque, n, true), criterion: y => ((ResponseDryRun)y).DeltaFullLoad.Value()); response = NextComponent.Request(absTime, dt, LeftSample.Current.Torque, angularVelocity); + CurrentState.InAngularVelocity = angularVelocity; }) .Case<ResponseFailTimeInterval>(r => { dt = r.DeltaT; }) .Case<ResponseSuccess>(() => { }) diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index dd02c872da..8e04f1b2d6 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -162,6 +162,8 @@ namespace TUGraz.VectoCore.OutputData ModalResultField.P_brake_loss, ModalResultField.P_wheel_in, ModalResultField.P_wheel_inertia, + ModalResultField.P_PTO_transm, + ModalResultField.P_PTO_consum, ModalResultField.P_trac, ModalResultField.P_slope, ModalResultField.P_air, diff --git a/VectoCore/VectoCore/Utils/ProviderExtensions.cs b/VectoCore/VectoCore/Utils/ProviderExtensions.cs index 39d01e3b20..28785d61c1 100644 --- a/VectoCore/VectoCore/Utils/ProviderExtensions.cs +++ b/VectoCore/VectoCore/Utils/ProviderExtensions.cs @@ -31,6 +31,7 @@ using System; using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Declaration; @@ -118,8 +119,10 @@ namespace TUGraz.VectoCore.Utils { if (pto != null) { var aux = new GearboxAuxiliary(container); - aux.AddConstant("PTO_TRANSM", DeclarationData.PTOTransmission.Lookup(pto.TransmissionType)); - aux.Add("PTO_IDLE", n => pto.LossMap.GetTorqueLoss(n) * n); + var power = DeclarationData.PTOTransmission.Lookup(pto.TransmissionType); + aux.Add("PTO_TRANSM", _ => power); + aux.Add("PTO_CONSUMER", n => pto.LossMap.GetTorqueLoss(n) * n); + gearbox.Connect(aux); } switch (data.Type) { -- GitLab