From ControlTheoryPro.com

Contents
1 Introduction to the Silicon Sensing CRG20 Sensor Model
The CRG20 sensor model example will follow the basic sensor model detailed below. I've picked Silicon Sensing's CRG29 primarily because they provided enough data to cover everything a basic sensor model should include.
The CRG20 is a MEMS sensor which means it is most likely small and low power. MEMS gyro operate on the principle of a vibrating proof mass whose average position is inertially static (mostly). The rate is sensed by measuring the current/voltage generated when the magnetic field of the housing (generated on the housing) moves relative to the intertially static proof mass. From here most vendors will condition the signal (clean up and filter) to provide the best possible performance. Sometimes the best performance means an extended bandwidth; sometimes it means less noise over the stated bandwidth; sometimes it means a more stable/linear output.
1.1 Sensor Modeling Basics
The following are the components of a basic sensor model.
 Basic Linear Model
 Transfer Function
 Noise
 Basic NonLinearities
 Saturation
 Quantization
 Additional Linear Elements
 Volts to Engineering Unit conversion
 Crossaxis Sensitivity
 Scale Factor changes (over temperature, frequency, etc.)
 Basic Linear Model
2 Silicon Sensing's advertised data for the CRG20
The data provided in Table 1 is current as of Dec. 1st, 2008.
Parameter  Value  Units  

Bandwidth 
55 
Hz 

Angular Random Walk 
0.3 
° / rt hr 

Quiescent Noise 

0 to 10 Hz 
0.06 
° / s rms 

In band (55 Hz) 
0.6 
° / s rms 

Crossaxis Sensitivity 
< 2 
% 

Temperature (Operating) 
40 to +105 
° C 

Scale Factor 
0.03125 
°/s / bit 

Scale Factor Variation over Temperature 
< +/ 1.2 
% 

Rate Range 
+/ 300 
° / s 
3 Basic Linear Model for the CRG20
3.1 Transfer Function
For a sensor with a linear output  the ouptut voltage is proportional to measured rate  the typical sensor model begins with a transfer function. Vendors intentionally condition the sensor output with the goal of achieving a nice, clean, transfer function well represneted by a 1st or 2nd order system transfer function. Remember that
1st Order 
2nd Order 
where
 is the bandwidth,
 is the damping, and
 is the Laplace variable.
The result of 2nd Order transfer function for a 55 Hz Bandwidth is presented in Figure 1.
3.1.1 MATLAB code
The MATLAB code necessary for creating a 2nd order tranfer function with a 55 Hz bandwidth and a damping of 1 is
>> w = 55 * (2*pi); % 55 Hz converted to rad/sec >> z = 1; >> tf2 = tf([w^2], [1, 2*z*w, w^2]);
The code for creating the plot can be found on the MATLAB Bode Plot article.
3.2 Noise
Often during the early design phases the noise PSD is not available. Many vendors will provide a quiescent noise RMS. Typically this is modeled as a flat PSD. The RMS of the flat PSD between 0 and the vendor stated bandwidth equals the vendor specified quiescent noise RMS.
3.2.1 Quiescent Noise
For this sensor the vendor specifies an RMS noise for 0 to 10 Hz and an inband RMS (0 to the 55 Hz bandwidth). For simplicity I will be modeling the flat PSD with a single simple magnitude.
where
 is the flat PSD magnitude in units^2 / Hz,
 is the vendor specified inband RMS, and
 is the vendor specified bandwidth in Hz.
In our particular example the RMS is provided in °/s so the PSD would be in (°/s)^2 / Hz.
In Simulink the flat PSD noise is produced using a BandLimited White Noise block.
Noise Power 


Sample Time 


Seed 
Whatever you want 
3.2.2 Angle Random Walk
Coming soon...
4 Basic NonLinearities for the CRG20
There are a couple basic nonlinearities. Among them are saturation and quatization.
4.1 Saturation
Saturation is typically defined by vendor specification. For our example the values are found in Table 3.
Upper Limit 
+300 °/s 

Lower Limit 
300 °/s 

Sample Time 
1 
4.2 Quantization
Quantization effects become important when required performance begins pushing the envelope of the sensor. It is also important when the number of bits provide only a coarse output measurement. Coarse is a subjective matter of performance vs. output.
Gain (Scale Factor) 
0.03125 °/s / bit 

Sample Time 
1 
5 Additional Linear Elements for the CRG20
5.1 Engineering Units to Volts
The Silicon Sensing CRG20 has a digital output. The Least Significant Bit (LSB) has a value of 0.03125 °/s. So in this case, the downstream model would pass the output around in bits rather than volts.
5.2 Crossaxis Sensitivity
Most sensors have some crosscoupling from one axis to another. Think of it as bleed over. For the CRG20 the vendor specification is that corssaxis sensitivity is less than 2%. So consider the scenario where the motion is exclusively in the xaxis, worst case is that 2% of the xaxis motion will bleed over into the y or z axes.
For crossaxis sensitivity I typically use a gain block with using the Multiplication setting of Matrix(K*u). The matrix in this case is a 2x2 where the diagonal elements are 0.98 and the offdiagonal elements are 0.02. The code is
>> K = [0.98, 0.02 ; 0.02, 0.98];
5.3 Scale Factor changes (over temperature, frequency, etc.)
The stated scale factor change over temperature is less than 1.2%. This is as simple as a change in sensor gain. The sensor response can be defined using a statespace or transfer function object. You can change the gain of the response with a gain change to either object. I find it easier to put a gain block downstream of these objects just upstream of the Quanitzation block. The gain for these blocks is simple and can be any value between 0.988 and 1.012. What value between 0.988 and 1.012 constitutes the worstcase scenario depends on the system being modeled.
6 Full Simulink Model for the CRG20
The above image is a picture of a simple sensor model. For the CRG20 the gain block which converts the Measured Noisy Analog Rate to Measured Analog Rate in Volts would be replaced a scale factor variation. The crossaxis sensitivity gain block would need ot be added . It could added to either the input or output of the StateSpace block with the same effect. The resulting model is below.