Return to Tutorial

Observers

An observer can be considered as a virtual sensor. In input, it takes data from sensors or other observers and outputs one or more rating(s) variable.

To create an observer, a tool has been developed for your convenience and only the algorithmic part requires knowledge of Scilab (free software similar to Matlab numerical calculation).

There is 7 steps to create an observer. Some are optionals, depending on the complexity of your observer.
You can navigate between the different stages as you want by clicking on the tabs or by using the following buttons Previous step and Next step.

From the overview page, you can go directly to a step by clicking on the yellow label associated.

When a field is required, the symbol “**” associated with it.

Step 1 : General information

  • Name of observer (UID) ** : An observer is considered as a virtual sensor. As with the other device, it is necessary to define it a unique UID
  • Description : Description of this observer.
  • Continous/Discret ** : 2 modes are availables for the resolution of Ordinary Differential Equation (O.D.E.)
  • Resolution mode : Many solvers are available to approach the solution of the O.D.E with scilab.
    ode is the basic method used to approach the solution of an first order O.D.E. explicit defined by : dy/dt=f(t,y) , y(t0)=y0.
    It is an interface to various libraries, particularly ODEPACK.
    The type of problem and the method to solve it depend of the value of the first (optional) argument which could be :
    adams” : unstiff  problems. The solver lsode of package ODEPACK is used (schema d’Adams).
    stiff” : for stiff systems. The solver lsode of package ODEPACK is used with the schema BDF.
    rk” : Schema of Runge-Kutta adaptatif of order 4 (RK4).
    rkf” : Shampine and Watts formulas based on the corresponding Runge-Kutta Fehlberg of order 4 and 5 (RKF45). Good for non-stiff or mildly stiff when calculating the second member is not too costly. This method should be avoided if one is looking for a very high accuracy.
    fix“: Identical to “rkf”, but the interface is simplified, ie only rtol and atol are communicated to the solver.
    root“: ODE solver with root finding. The solver lsodar of package ODEPACK is used. This is an alternative of lsoda which give the possibility to look for a root of an given vectorial. See ode_root for more details.
    discrete“: Simulation in discrete time. See ode_discrete for more détails.
  • Auteur : Name of the personn who create this observer (useful if you need to contact this person for some problem or to understand the algorithm)

Step 2 : Selection of sensors

Select the sensor needed for create this observers

Step 3 : Estimated variable

Estimated variables or virtual sensors are observers . You must complete, the information here as for a real sensor.

  •  Give a unique name (UID) ** : Name of the sensor, it must be unique for all sensors and actuators. ODIN does not know the difference between two sensors / actuators with the same name (registration is faulty)
  • Unit : if an unit exist give the unit associated to this virtual sensor
  • Value ranges, minimum/maximum : used in the experiment to see if the value is in the expected area. It will be displayed in red in the graph otherwise. Also used in the export of data to indicate whether the value is reliable or not
  • Initial value ** : value used to launch the sensor, then the calculated value is used.
  • Description : description of the virtual sensor
  • Label : The label is only used for to export data in XML format.
  • Name of the group : The group name is only used to export data in XML format

Step 4 : State variable (optional if your model is simple – ie without ODE)

This is the state variable of your O.D.E.

  • Give an unique name (UID) **: This name should be unique for each state variable
  • Unit : if exists give the unit of this state variable
  • Initial value ** : value used for the first loop. Then the computated value will be used.
  • Description : description of this state value

Step 5 : Internal parameters

Parameters are constants that you want to identify with their properties for a better reading of the algorithm (simply call its variables k1, k2, k3 is not really clear for someone who does not know the algorithm).

  • Give an unique name (UID) ** :  Each constant must have an unique name
  • Unit : if exists set the unit of this constant
  • Value ** : value of this parameter.
  • Description : description ofthis parameter

Step 6 : Dynamic function (optional if your model is simple – without ODE and that you don’t need to define additional functions)

In this page, you can define Scilab functions you want to use later.
If you have an ODE, you must complete the lower text box that contains your system to be solved.

You can add, with lists / buttons on the left, the different es variables / parameters you defined earlier.

Step 7 : Computation of the observer

Here you must write the computation of your virtual sensors (estimated variables). You have at your disposal all variables / parameters defined in the previous steps and the “conventional calculation functions” from Step 6.
The value of the state variables is the one after the resolution of the EDO

You can now generate your controller by going to the last tab and clicking generate. You can then display the file contents (display only, not writing) to verify that there was no problem generation (only for user knowing Scilab).

Back to previous page