~ubuntu-branches/ubuntu/precise/flightgear/precise

« back to all changes in this revision

Viewing changes to src/FDM/JSBSim/models/flight_control/FGSensor.h

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2011-01-30 15:46:35 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110130154635-rlynmg9n5hzxq5xe
Tags: 2.0.0-3
* Recommend fgfs-aircraft-base and fgfs-models-base.
  Closes. #610276.
* Added note about scenery SharedModels.tgz to README.Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
39
 
40
40
#include "FGFCSComponent.h"
41
 
#include <input_output/FGXMLElement.h>
 
41
#include <string>
42
42
 
43
43
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44
44
DEFINITIONS
53
53
namespace JSBSim {
54
54
 
55
55
class FGFCS;
 
56
class Element;
56
57
 
57
58
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58
59
CLASS DOCUMENTATION
74
75
  </quantization>
75
76
  <drift_rate> number </drift_rate>
76
77
  <bias> number </bias>
 
78
  <delay> number < /delay>
77
79
</sensor>
78
80
@endcode
79
81
 
101
103
understood to be +/-0.05 percent maximum variance. So, the actual value for the sensor
102
104
will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
103
105
even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
104
 
time.
 
106
time. The delay element can specify a frame delay. The integer number provided is
 
107
the number of frames to delay the output signal.
105
108
 
106
109
@author Jon S. Berndt
107
110
@version $Revision$
115
118
{
116
119
public:
117
120
  FGSensor(FGFCS* fcs, Element* element);
118
 
  ~FGSensor();
119
 
 
120
 
  inline void SetFailLow(double val) {if (val > 0.0) fail_low = true; else fail_low = false;}
121
 
  inline void SetFailHigh(double val) {if (val > 0.0) fail_high = true; else fail_high = false;}
122
 
  inline void SetFailStuck(double val) {if (val > 0.0) fail_stuck = true; else fail_stuck = false;}
123
 
 
124
 
  inline double GetFailLow(void) const {if (fail_low) return 1.0; else return 0.0;}
125
 
  inline double GetFailHigh(void) const {if (fail_high) return 1.0; else return 0.0;}
126
 
  inline double GetFailStuck(void) const {if (fail_stuck) return 1.0; else return 0.0;}
127
 
  inline int    GetQuantized(void) const {return quantized;}
128
 
 
129
 
  bool Run (void);
130
 
 
131
 
private:
 
121
  virtual ~FGSensor();
 
122
 
 
123
  void SetFailLow(double val) {if (val > 0.0) fail_low = true; else fail_low = false;}
 
124
  void SetFailHigh(double val) {if (val > 0.0) fail_high = true; else fail_high = false;}
 
125
  void SetFailStuck(double val) {if (val > 0.0) fail_stuck = true; else fail_stuck = false;}
 
126
 
 
127
  double GetFailLow(void) const {if (fail_low) return 1.0; else return 0.0;}
 
128
  double GetFailHigh(void) const {if (fail_high) return 1.0; else return 0.0;}
 
129
  double GetFailStuck(void) const {if (fail_stuck) return 1.0; else return 0.0;}
 
130
  int    GetQuantized(void) const {return quantized;}
 
131
 
 
132
  virtual bool Run (void);
 
133
 
 
134
protected:
132
135
  enum eNoiseType {ePercent=0, eAbsolute} NoiseType;
133
 
  double dt;
 
136
  enum eDistributionType {eUniform=0, eGaussian} DistributionType;
134
137
  double min, max;
135
138
  double span;
136
139
  double bias;
 
140
  double gain;
137
141
  double drift_rate;
138
142
  double drift;
139
143
  double noise_variance;
150
154
  bool fail_low;
151
155
  bool fail_high;
152
156
  bool fail_stuck;
153
 
  string quant_property;
 
157
  std::string quant_property;
154
158
 
 
159
  void ProcessSensorSignal(void);
155
160
  void Noise(void);
156
161
  void Bias(void);
157
162
  void Drift(void);
158
163
  void Quantize(void);
159
164
  void Lag(void);
 
165
  void Gain(void);
160
166
 
161
167
  void bind(void);
162
168
 
 
169
private:
163
170
  void Debug(int from);
164
171
};
165
172
}