NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
simulationworker.h
Go to the documentation of this file.
1
16#ifndef SIMULATIONWORKER_H
17#define SIMULATIONWORKER_H
18
19#include <QObject>
20#include "../NeTrainSim/simulator.h"
21
27class SimulationWorker : public QObject {
28 Q_OBJECT
29
30public:
49 SimulationWorker(Vector<std::tuple<int, double, double, std::string,
50 double, double>> nodeRecords,
51 Vector<tuple<int, int, int, double, int, double,
52 double, int, double, bool, string,
53 string, double> > linkRecords,
54 Vector<std::tuple<std::string, Vector<int>, double,
55 double,
56 Vector<std::tuple<
57 int, double, double,
58 int, double, double,
59 double, double, int>>,
60 Vector<std::tuple<int, int, double,
61 double,
62 double, double,
63 double, int>>,
64 bool>> trainRecords,
65 std::string networkName,
66 double endTime, double timeStep, double plotFrequency,
67 std::string exportDir,
68 std::string summaryFilename, bool exportInsta,
69 std::string instaFilename, bool exportAllTrainsSummary);
70
75
76signals:
83 const Vector<std::pair<std::string, std::string>>& summaryData,
84 const std::string& trajectoryFile);
85
92 Vector<std::pair<std::string,
93 Vector<std::pair<double,
94 double>>>> trainsStartEndPoints);
95
100 void simulaionProgressUpdated(int progressPercentage);
101
106 void errorOccurred(std::string error);
107
108 void trainSuddenAcceleration(std::string msg);
109
110 void trainSlowSpeed(std::string msg);
111
112public slots:
117 void onProgressUpdated(int progressPercentage);
118
125 Vector<std::pair<std::string,
126 Vector<std::pair<double,
127 double>>>> trainsStartEndPoints);
128
135 const Vector<std::pair<std::string,
136 std::string>> &summaryData,
137 const string &trajectoryFile);
138
142 void doWork();
143
144public:
146 Simulator* sim;
149};
150
151#endif // SIMULATIONWORKER_H
This class defined a network for trains.
Definition network.h:27
The SimulationWorker class performs simulation work in a separate thread.
Definition simulationworker.h:27
void doWork()
Slot called to start the simulation work.
Definition simulationworker.cpp:93
Network * net
Definition simulationworker.h:148
void simulaionProgressUpdated(int progressPercentage)
Signal emitted when the simulation progress is updated.
~SimulationWorker()
Destroys the SimulationWorker object.
Definition simulationworker.cpp:102
void trainSlowSpeed(std::string msg)
void simulationFinished(const Vector< std::pair< std::string, std::string > > &summaryData, const std::string &trajectoryFile)
Signal emitted when the simulation is finished.
void errorOccurred(std::string error)
Signal emitted when an error occurs during the simulation.
void trainsCoordinatesUpdated(Vector< std::pair< std::string, Vector< std::pair< double, double > > > > trainsStartEndPoints)
Signal emitted when the coordinates of trains are updated.
void onTrainsCoordinatesUpdated(Vector< std::pair< std::string, Vector< std::pair< double, double > > > > trainsStartEndPoints)
Slot called when the coordinates of trains are updated.
Definition simulationworker.cpp:80
void trainSuddenAcceleration(std::string msg)
void onSimulationFinished(const Vector< std::pair< std::string, std::string > > &summaryData, const string &trajectoryFile)
Slot called when the simulation is finished.
Definition simulationworker.cpp:86
Simulator * sim
< Pointer to the Simulator object for performing the simulation.
Definition simulationworker.h:146
void onProgressUpdated(int progressPercentage)
Slot called when the progress is updated.
Definition simulationworker.cpp:76
A vector.
Definition vector.h:24