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

Skip to content
Snippets Groups Projects
Commit 7b1479d1 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

use more explicit condition to decide if PTO is active

parent e484a078
No related branches found
No related tags found
No related merge requests found
Showing with 32 additions and 7 deletions
......@@ -269,7 +269,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
Constants.Auxiliaries.PowerPrefix + Constants.Auxiliaries.IDs.PTOTransmission);
aux.Add(Constants.Auxiliaries.IDs.PTOConsumer,
n => container.CycleData.LeftSample.PTOActive ? null : data.PTO.LossMap.GetTorqueLoss(n) * n);
n => container.PTOActive ? null : data.PTO.LossMap.GetTorqueLoss(n) * n);
container.ModalData.AddAuxiliary(Constants.Auxiliaries.IDs.PTOConsumer,
Constants.Auxiliaries.PowerPrefix + Constants.Auxiliaries.IDs.PTOConsumer);
}
......
......@@ -406,6 +406,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
get { return DrivingCycle.CycleData; }
}
public bool PTOActive
{
get { return DrivingCycle.PTOActive; }
}
public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance)
{
return DrivingCycle.CycleLookAhead(distance);
......
......@@ -46,6 +46,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
/// </summary>
CycleData CycleData { get; }
bool PTOActive { get; }
/// <summary>
/// get a single driving-cycle entry at a certain distance ahead
/// altitude is interpolated between sampling points, slope is averaged
......
......@@ -208,8 +208,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
case 3:
CurrentState.WaitPhase++;
IdleController.ActivateIdle();
PTOActive = false;
return Left.StoppingTime / 2;
case 2:
PTOActive = true;
IdleController.ActivatePTO();
return IdleController.GetNextCycleTime();
}
......@@ -223,6 +225,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
case 5:
CurrentState.WaitPhase++;
IdleController.ActivateIdle();
PTOActive = false;
return Constants.SimulationSettings.TargetTimeInterval;
case 3:
case 7:
......@@ -233,6 +236,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
CurrentState.WaitPhase++;
return Left.StoppingTime / 2 - 2 * Constants.SimulationSettings.TargetTimeInterval;
case 4:
PTOActive = true;
IdleController.ActivatePTO();
return IdleController.GetNextCycleTime();
}
......@@ -455,6 +459,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
}
public bool PTOActive { get; private set; }
public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance)
{
var absDistance = CurrentState.Distance + distance;
......
......@@ -32,6 +32,7 @@
using System;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Models.Connector.Ports;
using TUGraz.VectoCore.OutputData;
......@@ -65,8 +66,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public ITnOutPort RequestPort
{
set
{
set {
_idleController.RequestPort = value;
_ptoController.RequestPort = value;
}
......@@ -103,8 +103,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public Second Duration
{
get
{
get {
if (_ptoController != null) {
return _ptoController.Duration;
}
......
......@@ -307,6 +307,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
}
public bool PTOActive
{
get { return false; }
}
public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance)
{
return new DrivingCycleData.DrivingCycleEntry(CycleIterator.RightSample);
......
......@@ -183,6 +183,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
}
public bool PTOActive
{
get { return true; }
}
public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance)
{
return new DrivingCycleData.DrivingCycleEntry() {
......
......@@ -63,8 +63,7 @@ namespace TUGraz.VectoCore.Tests.Utils
public CycleData CycleData
{
get
{
get {
return new CycleData {
AbsTime = 0.SI<Second>(),
AbsDistance = 0.SI<Meter>(),
......@@ -74,6 +73,8 @@ namespace TUGraz.VectoCore.Tests.Utils
}
}
public bool PTOActive { get; set; }
public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance)
{
return new DrivingCycleData.DrivingCycleEntry() {
......
......@@ -190,6 +190,8 @@ namespace TUGraz.VectoCore.Tests.Utils
public VectoRun.Status RunStatus { get; set; }
public bool PTOActive { get; private set; }
public void AddComponent(VectoSimulationComponent component)
{
Components.Add(component);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment