OpenIndy-Core  0.2.0.43
simulationmodel.h
Go to the documentation of this file.
1 #ifndef SIMULATIONMODEL_H
2 #define SIMULATIONMODEL_H
3 
4 #include <QObject>
5 #include <QPointer>
6 #include <QMap>
7 #include <QMultiMap>
8 #include <QString>
9 
10 #include "pluginmetadata.h"
11 #include "reading.h"
12 #include "position.h"
13 #include "direction.h"
14 #include "radius.h"
15 
16 namespace oi{
17 
18 //##############
19 //helper classes
20 //##############
21 
27 {
28 public:
29  QString name;
30 
31  double value; //magnitude of the error
32  double uncertainty; //uncertainty of the error
33  QString distribution; //the distribution of the uncertainty component
34 
35  QString errorUnit; //unit of the uncertainty value (mm, m ,...)
36 
37  QString description;
38 
39  QStringList distributions; //distributions in which the error could be determined at random
40 };
41 
46 public:
47  QMap<QString, UncertaintyComponent> sensorUncertainties;
48  QMap<QString, UncertaintyComponent> objectUncertainties;
49  QMap<QString, UncertaintyComponent> enviromentUncertainties;
50  QMap<QString, UncertaintyComponent> humanUncertainties;
51 };
52 
58 public:
59  QList<double> values; //randomly shuffled values produced distortion of readings and recalculation
60 
61  //maximum and minimum of the data series
62  double maxValue;
63  double minValue;
64 
65  double expectation;
66  double uncertainty; //uncertainty of the data series
67 
68  QString distribution; //name of the distribution of the data series
69 
70  //function pointers that calculate density and distribution values
71  double (*densityFunction)(const double &x, const double &expectation, const double &uncertainty,
72  const double &lowerLimit, const double &upperLimit);
73  double (*distributionFunction)(const double &x, const double &expectation, const double &uncertainty,
74  const double &lowerLimit, const double &upperLimit);
75 
76  QMap<QString, QString> info; //custom information
77 
78 };
79 
85 {
86 public:
87 
88  //####################################################
89  //uncertainty data for each unknown geometry parameter
90  //####################################################
91 
95 
99 
103 
106 
108 
113 
115 
116  //###############################
117  //correlations between parameters
118  //###############################
119 
120  QMap<QString, double> correlations;
121 
122 };
123 
124 //TODO set simulation config as separate class like sensor config an add xml save/load
125 
130 public:
132 
133  QMap<QString, int> integerParameters;
134  QMap<QString, double> doubleParameters;
135  QMap<QString, QString> stringParameters;
136 };
137 
138 //#######################
139 //simulation class itself
140 //#######################
141 
147 class OI_CORE_EXPORT SimulationModel : public QObject
148 {
149  Q_OBJECT
150 
151 public:
152  explicit SimulationModel(QObject *parent = 0);
153 
154  virtual ~SimulationModel();
155 
156  //################################
157  //simulation initialization method
158  //################################
159 
160  virtual void init();
161 
162  //#########################################
163  //methods to get or set further information
164  //#########################################
165 
166  const PluginMetaData &getMetaData() const;
167 
168  const SimulationConfiguration &getSimulationConfiguration() const;
169  void setSimulationConfiguration(const SimulationConfiguration &sConfig);
170 
171  const QMap<QString, int> &getIntegerParameter() const;
172  const QMap<QString, double> &getDoubleParameter() const;
173  const QMultiMap<QString, QString> &getStringParameter() const;
174 
175  //##################
176  //simulation methods
177  //##################
178 
179  const QMap<QString, UncertaintyComponent> &getSensorUncertainties() const;
180  const QMap<QString, UncertaintyComponent> &getObjectUncertainties() const;
181  const QMap<QString, UncertaintyComponent> &getEnviromentUncertainties() const;
182  const QMap<QString, UncertaintyComponent> &getHumanInfluence() const;
183 
184  virtual bool distort(const QPointer<Reading> &r, const OiMat &objectRelation, const bool &newIterationStart);
185  virtual bool analyseSimulationData(UncertaintyData &d);
186  virtual double getCorrelationCoefficient(const QList<double> &x, const QList<double> &y);
187 
188 signals:
189 
190  //##################################################
191  //signals to inform OpenIndy about simulation issues
192  //##################################################
193 
194  void sendMessage(const QString &msg, const MessageTypes &msgType, const MessageDestinations &msgDest = eConsoleMessage);
195 
196 protected:
197 
198  //###########################
199  //input and output parameters
200  //###########################
201 
203 
205 
206  //the needed scalar input parameters including default values
207  QMap<QString, int> integerParameters;
208  QMap<QString, double> doubleParameters;
209  QMultiMap<QString, QString> stringParameters;
210 
211  //uncertainties provided by plugin writer
212  QMap<QString, UncertaintyComponent> sensorUncertainties;
213  QMap<QString, UncertaintyComponent> objectUncertainties;
214  QMap<QString, UncertaintyComponent> environmentUncertainties;
215  QMap<QString, UncertaintyComponent> humanInfluence;
216 
217 };
218 
219 }
220 
221 #ifndef STR
222 #define STR(x) #x
223 #endif
224 #ifndef STR2
225 #define STR2(x) STR(x)
226 #endif
227 
228 #ifndef CONCAT
229 #define CONCAT(a, b) a ## b
230 #endif
231 #ifndef CONCAT2
232 #define CONCAT2(a, b) CONCAT(a, b)
233 #endif
234 
235 #define SIMULATION_PREFIX de.openIndy.plugin.simulation.v
236 #define Simulation_iidd STR2(CONCAT2(SIMULATION_PREFIX, PLUGIN_INTERFACE_VERSION))
237 
238 #endif // SIMULATIONMODEL_H
Definition: pluginmetadata.h:10
QString description
Definition: simulationmodel.h:37
UncertaintyData uncertaintySecondaryI
Definition: simulationmodel.h:100
UncertaintyData uncertaintyZ
Definition: simulationmodel.h:94
QString errorUnit
Definition: simulationmodel.h:35
UncertaintyData uncertaintyPrimaryI
Definition: simulationmodel.h:96
QMap< QString, double > correlations
Definition: simulationmodel.h:120
double maxValue
Definition: simulationmodel.h:62
QStringList distributions
Definition: simulationmodel.h:39
UncertaintyData uncertaintyAperture
Definition: simulationmodel.h:107
QMap< QString, UncertaintyComponent > enviromentUncertainties
Definition: simulationmodel.h:49
void init()
Definition: util.cpp:53
QMap< QString, UncertaintyComponent > objectUncertainties
Definition: simulationmodel.h:213
UncertaintyData uncertaintyY
Definition: simulationmodel.h:93
QMap< QString, int > integerParameters
Definition: simulationmodel.h:133
double uncertainty
Definition: simulationmodel.h:32
UncertaintyData uncertaintySecondaryK
Definition: simulationmodel.h:102
QString distribution
Definition: simulationmodel.h:68
UncertaintyData uncertaintyTemperature
Definition: simulationmodel.h:112
Definition: coordinatesystem.h:15
Uncertainties uncertainties
Definition: simulationmodel.h:131
Definition: types.h:38
UncertaintyData uncertaintyPrimaryJ
Definition: simulationmodel.h:97
SimulationConfiguration sConfig
Definition: simulationmodel.h:202
The UncertaintyComponent class Describe an uncertainty component of a simulation model.
Definition: simulationmodel.h:26
QMap< QString, UncertaintyComponent > objectUncertainties
Definition: simulationmodel.h:48
MessageDestinations
used to specify where to print a message
Definition: types.h:37
The Uncertainties class.
Definition: simulationmodel.h:45
UncertaintyData uncertaintyRadiusB
Definition: simulationmodel.h:105
double uncertainty
Definition: simulationmodel.h:66
double value
Definition: simulationmodel.h:31
UncertaintyData uncertaintyPrimaryK
Definition: simulationmodel.h:98
The SimulationModel class Interface for creating an uncertainty model for a simulation in OpenIndy...
Definition: simulationmodel.h:147
UncertaintyData uncertaintyRadiusA
Definition: simulationmodel.h:104
QMap< QString, UncertaintyComponent > sensorUncertainties
Definition: simulationmodel.h:47
The OiMat class.
Definition: oimat.h:58
QMap< QString, double > doubleParameters
Definition: simulationmodel.h:134
QString name
Definition: simulationmodel.h:29
MessageTypes
all types of messages
Definition: types.h:29
UncertaintyData uncertaintyLength
Definition: simulationmodel.h:114
QMap< QString, QString > info
Definition: simulationmodel.h:76
double minValue
Definition: simulationmodel.h:63
UncertaintyData uncertaintyAngle
Definition: simulationmodel.h:109
QString distribution
Definition: simulationmodel.h:33
QMap< QString, UncertaintyComponent > environmentUncertainties
Definition: simulationmodel.h:214
The SimulationConfiguration class.
Definition: simulationmodel.h:129
UncertaintyData uncertaintySecondaryJ
Definition: simulationmodel.h:101
PluginMetaData metaData
Definition: simulationmodel.h:204
QMap< QString, UncertaintyComponent > humanUncertainties
Definition: simulationmodel.h:50
The UncertaintyData class Save information about simulation results for one geometry parameter...
Definition: simulationmodel.h:57
double expectation
Definition: simulationmodel.h:65
UncertaintyData uncertaintyX
Definition: simulationmodel.h:92
QList< double > values
Definition: simulationmodel.h:59
UncertaintyData uncertaintyDistance
Definition: simulationmodel.h:110
The SimulationData class Save simulation results for a geometry.
Definition: simulationmodel.h:84
QMap< QString, double > doubleParameters
Definition: simulationmodel.h:208
QMap< QString, UncertaintyComponent > humanInfluence
Definition: simulationmodel.h:215
QMap< QString, UncertaintyComponent > sensorUncertainties
Definition: simulationmodel.h:212
#define OI_CORE_EXPORT
Definition: types.h:11
QMap< QString, QString > stringParameters
Definition: simulationmodel.h:135
QMap< QString, int > integerParameters
Definition: simulationmodel.h:207
UncertaintyData uncertaintyMeasurementSeries
Definition: simulationmodel.h:111
QMultiMap< QString, QString > stringParameters
Definition: simulationmodel.h:209