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

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

applied ReSharper code formatting to VectoCore

parent 1b582ea9
No related branches found
No related tags found
No related merge requests found
Showing
with 124 additions and 151 deletions
......@@ -2,41 +2,41 @@
namespace TUGraz.VectoCore.Exceptions
{
public class VectoException : Exception
{
public VectoException(string message) : base(message) { }
public VectoException(string message, Exception innerException) : base(message, innerException) { }
}
public class VectoException : Exception
{
public VectoException(string message) : base(message) {}
public VectoException(string message, Exception innerException) : base(message, innerException) {}
}
public abstract class FileIOException : VectoException
{
protected FileIOException(string message) : base(message) { }
protected FileIOException(string message, Exception inner) : base(message, inner) { }
}
public abstract class FileIOException : VectoException
{
protected FileIOException(string message) : base(message) {}
protected FileIOException(string message, Exception inner) : base(message, inner) {}
}
public class InvalidFileFormatException : FileIOException
public class InvalidFileFormatException : FileIOException
{
public InvalidFileFormatException(string message) : base(message) { }
public InvalidFileFormatException(string message, Exception inner) : base(message) { }
public InvalidFileFormatException(string message) : base(message) {}
public InvalidFileFormatException(string message, Exception inner) : base(message) {}
}
/// <summary>
/// Exception which gets thrown when the version of a file is not supported.
/// Exception which gets thrown when the version of a file is not supported.
/// </summary>
public class UnsupportedFileVersionException : FileIOException
{
public UnsupportedFileVersionException(string message) : base(message) { }
public UnsupportedFileVersionException(string message, Exception inner) : base(message, inner) { }
public UnsupportedFileVersionException(string message) : base(message) {}
public UnsupportedFileVersionException(string message, Exception inner) : base(message, inner) {}
}
/// <summary>
/// Exception which gets thrown when an error occurred during read of a vecto csv-file.
/// </summary>
/// Exception which gets thrown when an error occurred during read of a vecto csv-file.
/// </summary>
public class CSVReadException : FileIOException
{
public CSVReadException(string message) : base(message) { }
public CSVReadException(string message, Exception inner) : base(message, inner) { }
}
}
{
public CSVReadException(string message) : base(message) {}
public CSVReadException(string message, Exception inner) : base(message, inner) {}
}
}
\ No newline at end of file
......@@ -4,9 +4,7 @@ namespace TUGraz.VectoCore.Exceptions
{
public class VectoSimulationException : VectoException
{
public VectoSimulationException(string msg) : base(msg) { }
public VectoSimulationException(string msg, Exception inner) : base(msg, inner) { }
public VectoSimulationException(string msg) : base(msg) {}
public VectoSimulationException(string msg, Exception inner) : base(msg, inner) {}
}
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
namespace TUGraz.VectoCore.Models.Connector
{
class Connector<TI, TO, TP>
internal class Connector<TI, TO, TP>
where TI : InPort, TP
where TO : OutPort, TP
{
......@@ -17,5 +17,4 @@ namespace TUGraz.VectoCore.Models.Connector
InPort.Connect(OutPort);
}
}
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IDriverDemandInPort
{
void Connect(IDriverDemandOutPort other);
}
}
public interface IDriverDemandInPort
{
void Connect(IDriverDemandOutPort other);
}
}
\ No newline at end of file
using System;
using TUGraz.VectoCore.Models.Connector.Ports.Impl;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IDriverDemandOutPort
{
IResponse Request(TimeSpan absTime, TimeSpan dt, MeterPerSecond velocity, double gradient);
}
}
public interface IDriverDemandOutPort
{
IResponse Request(TimeSpan absTime, TimeSpan dt, MeterPerSecond velocity, double gradient);
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IDriverDemandOutProvider
{
IDriverDemandOutPort OutPort();
}
}
public interface IDriverDemandOutProvider
{
IDriverDemandOutPort OutPort();
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IInPort
{
}
public interface IInPort {}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IOutPort
{
}
public interface IOutPort {}
}
\ No newline at end of file
......@@ -4,4 +4,4 @@
{
ITnOutPort OutShaft();
}
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports
{
public interface IResponse
{
}
public interface IResponse {}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
{
public abstract class InPort: IInPort
public abstract class InPort : IInPort
{
public abstract void Connect(IOutPort other);
}
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
{
public abstract class OutPort: IOutPort
{
}
}
public abstract class OutPort : IOutPort {}
}
\ No newline at end of file
......@@ -2,21 +2,14 @@ using System;
namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
{
public class ResponseCycleFinished : IResponse
{
public class ResponseCycleFinished : IResponse {}
}
public class ResponseSuccess : IResponse {}
public class ResponseSuccess : IResponse
{
}
public class ResponseFailOverload : IResponse {}
public class ResponseFailOverload : IResponse
{
}
public class ResponseFailTimeInterval : IResponse
{
public TimeSpan DeltaT { get; set; }
}
public class ResponseFailTimeInterval : IResponse
{
public TimeSpan DeltaT { get; set; }
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Simulation.Cockpit
{
public interface ICockpit : IGearboxCockpit, IEngineCockpit, IVehicleCockpit
{
}
public interface ICockpit : IGearboxCockpit, IEngineCockpit, IVehicleCockpit {}
}
\ No newline at end of file
......@@ -4,9 +4,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Cockpit
{
public interface IEngineCockpit
{
/// <summary>
/// [rad/s]
/// </summary>
/// <summary>
/// [rad/s]
/// </summary>
RadianPerSecond EngineSpeed();
}
}
\ No newline at end of file
namespace TUGraz.VectoCore.Models.Simulation.Data
{
public interface IModalDataWriter
{
/// <summary>
/// Indexer for fields of the DataWriter. Accesses the data of the current step.
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
object this[ModalResultField key] { get; set; }
public interface IModalDataWriter
{
/// <summary>
/// Indexer for fields of the DataWriter. Accesses the data of the current step.
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
object this[ModalResultField key] { get; set; }
/// <summary>
/// Commits the data of the current simulation step.
/// </summary>
void CommitSimulationStep();
/// <summary>
/// Commits the data of the current simulation step.
/// </summary>
void CommitSimulationStep();
void Finish();
}
}
void Finish();
}
}
\ No newline at end of file
using TUGraz.VectoCore.Models.Simulation.Impl;
namespace TUGraz.VectoCore.Models.Simulation
{
public interface IVectoSimulator
{
void Run();
IVehicleContainer GetContainer();
}
public interface IVectoSimulator
{
void Run();
IVehicleContainer GetContainer();
}
}
\ No newline at end of file
......@@ -4,10 +4,10 @@ using TUGraz.VectoCore.Models.SimulationComponent;
namespace TUGraz.VectoCore.Models.Simulation
{
public interface IVehicleContainer : ICockpit
{
void AddComponent(VectoSimulationComponent component);
void CommitSimulationStep(IModalDataWriter dataWriter);
void FinishSimulation(IModalDataWriter dataWriter);
}
public interface IVehicleContainer : ICockpit
{
void AddComponent(VectoSimulationComponent component);
void CommitSimulationStep(IModalDataWriter dataWriter);
void FinishSimulation(IModalDataWriter dataWriter);
}
}
\ No newline at end of file
......@@ -5,21 +5,21 @@ using Common.Logging;
namespace TUGraz.VectoCore.Models.Simulation.Impl
{
//todo: add job tracking (state of jobs, iteration, ...)
//todo: add job control (pause, stop)
public class JobContainer
{
private List<IVectoSimulator> _simulators = new List<IVectoSimulator>();
//todo: add job tracking (state of jobs, iteration, ...)
//todo: add job control (pause, stop)
public class JobContainer
{
private readonly List<IVectoSimulator> _simulators = new List<IVectoSimulator>();
public void AddJob(IVectoSimulator sim)
{
_simulators.Add(sim);
}
public void AddJob(IVectoSimulator sim)
{
_simulators.Add(sim);
}
public void RunSimulation()
{
LogManager.GetLogger(GetType()).Info("VectoSimulator started running. Starting Jobs.");
Task.WaitAll(_simulators.Select(job => Task.Factory.StartNew(job.Run)).ToArray());
}
}
public void RunSimulation()
{
LogManager.GetLogger(GetType()).Info("VectoSimulator started running. Starting Jobs.");
Task.WaitAll(_simulators.Select(job => Task.Factory.StartNew(job.Run)).ToArray());
}
}
}
\ No newline at end of file
......@@ -6,28 +6,28 @@ using TUGraz.VectoCore.Models.SimulationComponent.Impl;
namespace TUGraz.VectoCore.Models.Simulation.Impl
{
public class SimulatorFactory
{
public static IVectoSimulator CreateTimeBasedEngineOnlyJob(string engineFile, string cycleFile, string resultFile)
{
Action<string> debug = LogManager.GetLogger<SimulatorFactory>().Debug;
public class SimulatorFactory
{
public static IVectoSimulator CreateTimeBasedEngineOnlyJob(string engineFile, string cycleFile, string resultFile)
{
Action<string> debug = LogManager.GetLogger<SimulatorFactory>().Debug;
debug("Creating VehicleContainer.");
var container = new VehicleContainer();
debug("Creating VehicleContainer.");
var container = new VehicleContainer();
debug("SimulationFactory creating cycle.");
var cycleData = DrivingCycleData.ReadFromFileEngineOnly(cycleFile);
var cycle = new EngineOnlyDrivingCycle(container, cycleData);
debug("SimulationFactory creating engine.");
var engineData = CombustionEngineData.ReadFromFile(engineFile);
var engine = new CombustionEngine(container, engineData);
var engineData = CombustionEngineData.ReadFromFile(engineFile);
var engine = new CombustionEngine(container, engineData);
debug("Creating gearbox.");
var gearBox = new EngineOnlyGearbox(container);
debug("Creating gearbox.");
var gearBox = new EngineOnlyGearbox(container);
debug("SimulationFactory creating auxiliary");
var aux = new EngineOnlyAuxiliary(container, new AuxiliariesDemandAdapter(cycleData));
var aux = new EngineOnlyAuxiliary(container, new AuxiliariesDemandAdapter(cycleData));
debug("SimulationFactory connecting auxiliary with engine.");
aux.Connect(engine.OutShaft());
......@@ -35,15 +35,15 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
debug("SimulationFactory connecting gearbox with auxiliary.");
gearBox.InShaft().Connect(aux.OutShaft());
debug("SimulationFactory connecting cycle with gearbox.");
cycle.InShaft().Connect(gearBox.OutShaft());
debug("SimulationFactory connecting cycle with gearbox.");
cycle.InShaft().Connect(gearBox.OutShaft());
var dataWriter = new ModalDataWriter(resultFile);
var dataWriter = new ModalDataWriter(resultFile);
debug("Creating Simulator.");
var simulator = new VectoSimulator(container, cycle, dataWriter);
debug("Creating Simulator.");
var simulator = new VectoSimulator(container, cycle, dataWriter);
return simulator;
}
}
return simulator;
}
}
}
\ No newline at end of file
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