Program listing for file control/src/Simulation/ControlSimulation.hpp#
Return to documentation for this file
1#ifndef CONTROLDYNAMICALSYSTEM_H
2#define CONTROLDYNAMICALSYSTEM_H
3
4#include "SiconosPointers.hpp"
5#include "SiconosAlgebraTypeDef.hpp"
6#include "ControlTypeDef.hpp"
7#include "SiconosControlFwd.hpp"
8#include "SiconosFwd.hpp"
9
10#include <string>
11
12class ControlSimulation
13{
14private:
15
16 ACCEPT_SERIALIZATION(ControlSimulation);
17
18protected:
19
20 ControlSimulation() {};
21
22
23 ControlSimulation(double t0, double T, double h);
24
25
26 double _t0;
27
28
29 double _T;
30
31
32 double _h;
33
34
35 double _theta;
36
37
38 double _elapsedTime;
39
40
41 unsigned _N;
42
43
44 unsigned _nDim;
45
46
47 bool _saveOnlyMainSimulation;
48
49
50 bool _silent;
51
52
53 SP::SimpleMatrix _dataM;
54
55
56 std::string _dataLegend;
57
58
59 SP::NonSmoothDynamicalSystem _nsds;
60
61
62 SP::TimeDiscretisation _processTD;
63
64
65 SP::Simulation _processSimulation;
66
67
68 SP::OneStepIntegrator _processIntegrator;
69
70
71 SP::ControlManager _CM;
72
73
74 SP::DynamicalSystemsGraph _DSG0;
75
76
77 SP::InteractionsGraph _IG0;
78
79public:
80
81
82 virtual ~ControlSimulation() {};
83
84
85 void setTheta(unsigned int newTheta);
86
87
88 void initialize();
89
90
91 void addDynamicalSystem(SP::DynamicalSystem ds, const std::string& name = "");
92
93
94 void addSensor(SP::Sensor sensor, const double h);
95
96
97 void addActuator(SP::Actuator actuator, const double h);
98
99
100 void addObserver(SP::Observer observer, const double h);
101
102
103 void storeData(unsigned indx);
104
105
106 inline SP::Simulation simulation() const
107 {
108 return _processSimulation;
109 };
110
111
112 inline SP::OneStepIntegrator integrator() const
113 {
114 return _processIntegrator;
115 };
116
117
118 inline SP::NonSmoothDynamicalSystem model() const
119 {
120 return _nsds;
121 }
122
123
124 inline SP::SimpleMatrix data() const
125 {
126 return _dataM;
127 }
128
129
130 inline std::string dataLegend() const
131 {
132 return _dataLegend;
133 }
134
135
136 inline double elapsedTime() const
137 {
138 return _elapsedTime;
139 }
140
141
142 inline SP::ControlManager CM() const
143 {
144 return _CM;
145 };
146
147
148 inline void setSaveOnlyMainSimulation(bool v)
149 {
150 _saveOnlyMainSimulation = v;
151 };
152
153
154 void silent(bool s = true) { _silent = s; };
155
156
157 virtual void run() = 0;
158};
159
160#endif