About calibration of IO modules : examples and guidelines
Introduction
This document deals with calibration of Analog input / output modules. In particularly this document shows how to calibrate the IO data from the Simulink model.
Principle
In an ideal world, a “0” value that has to be outputted in a model must give exactly 0 V on the channel. It is supposed to be the case for given working environment (set of parameters : power supply, ambient temperature,…). For some reason it might not be the case. One has to make an “internal” calibration to make sure that the right value are outputted. We will take an example to show how to do this.
Example
This is only for explicative purpose, values and range are not real here. Let’s suppose that you make a measurement with a multi-meter directly on the output channel. Of course it is assumed that your multi-meter is well calibrated. For RT-LAB analog modules, the range is [-16 V 16V]. Therefore the relation between model value (Vsim) and outputted value measured on the multi-meter (Vreal) should be as follows (see Figure 1) :
Vreal=Vsim
Figure 1 : ideal case
Suppose now that when you measure the output voltage corresponding to Vsim = 0V, you read 2 V on your multi-meter. It means that you have an offset of 2 V. Each value will be offsetted of 2 V (see Figure 2).
Figure 2 : output value with offset
To solve this problem, you have to make a calibration inside your Simulink model. Just retrieve the offset before sending the desired value to the analog output.
Now you have to check that the offset is constant on all the output range. For this make some measurement at different simulation values, and trace the graph Vreal=f(Vsim). You may obtain something different as a simple Vreal=Vsim+offset (see Figure 3), there may be a slope. In that case, you have to compute the slope of the graph, and adjust the real value so that you send to the channel the “real” value. You will use the following equation :
Vsend=Vdesired / slope – offset
Figure 3 : output value with offset and linear coefficient
This logic (offset and slope) is a calibration of your output signal.
Tolerances
The OP5330 analog outputs have a tolerance that has to be taken into account. The precision is 1 mV for the offset calibration and 1 mV for the range calibration.
Calibration using the OpParameterManager block
In RT-Lab you can also make some data changes and keep these data in a mat file. The advantage is that once the desired values are set, they are automatically loaded from a mat file next time the model is loaded on a target.
The “Data Ready” input is used to trig the writing in a mat file (this can be controlled from the console, when you have a correct set of parameters), the “Save Reload” is set for writing or reading a mat file, and the “Data” input is where the data to be set are entered (see the help of the block for more details).
In the model rtdemo1_calib.mdl, each channel of the OP5130 analog IO card can be set independently, offset and gain. You can set the offset and the gain for each channel, then choose to drive the feedback gain or to re-write values depending on the tolerances that you want to reach. In the example rtdemo1_calib.mdl, the gains and offsets are set using the feedback values (the analog inputs).