Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

refactoring design

parent c76eb92b
No related branches found
No related tags found
No related merge requests found
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IInShaft
{
ITnInPort InShaft();
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IOutShaft
{
ITnOutPort OutShaft();
}
}
using System; namespace TUGraz.VectoCore.Models.SimulationComponent
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TUGraz.VectoCore.Models.SimulationComponent
{ {
interface ICombustionEngine public interface ICombustionEngine : IOutShaft
{ {
} }
......
using TUGraz.VectoCore.Models.Connector.Ports;
namespace TUGraz.VectoCore.Models.SimulationComponent
{
public interface IGearbox : IInShaft, IOutShaft
{
}
}
\ No newline at end of file
...@@ -11,17 +11,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -11,17 +11,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
} }
public override IInPort InPort()
{
throw new NotSupportedException("The Engine does not support InPorts.");
}
public override IOutPort OutPort() public ITnOutPort OutShaft()
{ {
return this; return this;
} }
public override void CommitSimulationStep(IDataWriter writer) public override void CommitSimulationStep(IModalDataWriter writer)
{ {
writer[ModalResult.FC] = 1; writer[ModalResult.FC] = 1;
writer[ModalResult.FC_AUXc] = 2; writer[ModalResult.FC_AUXc] = 2;
......
...@@ -5,11 +5,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent ...@@ -5,11 +5,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
{ {
public abstract class VectoSimulationComponent public abstract class VectoSimulationComponent
{ {
abstract public IInPort InPort(); //abstract public IInPort InPort();
abstract public IOutPort OutPort(); //abstract public IOutPort OutPort();
abstract public void CommitSimulationStep(IDataWriter writer); abstract public void CommitSimulationStep(IModalDataWriter writer);
} }
} }
...@@ -53,7 +53,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent ...@@ -53,7 +53,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
port.Request(absTime, dt, torque, engineSpeed); port.Request(absTime, dt, torque, engineSpeed);
var dataWriter = new TestDataWriter(new ModalResults()); var dataWriter = new TestModalDataWriter(new ModalResults());
engine.CommitSimulationStep(dataWriter); engine.CommitSimulationStep(dataWriter);
//todo: test with correct output values, add other fields to test //todo: test with correct output values, add other fields to test
...@@ -67,14 +67,14 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent ...@@ -67,14 +67,14 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
{ {
var engineData = CombustionEngineData.ReadFromFile("24t Coach.veng"); var engineData = CombustionEngineData.ReadFromFile("24t Coach.veng");
var engine = new CombustionEngine(engineData); var engine = new CombustionEngine(engineData);
var port = (ITnOutPort)engine.OutPort(); var port = engine.OutShaft();
var data = EngineOnlyDrivingCycle.Read("Coach Engine Only.vdri"); var data = EngineOnlyDrivingCycle.Read("Coach Engine Only.vdri");
var absTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0); var absTime = new TimeSpan(seconds: 0, minutes: 0, hours: 0);
var dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0); var dt = new TimeSpan(seconds: 1, minutes: 0, hours: 0);
var dataWriter = new TestDataWriter(new ModalResults()); var dataWriter = new TestModalDataWriter(new ModalResults());
foreach (var cycle in data) foreach (var cycle in data)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment