
../../index.html: emC overview page
1. Controlling FBlocks
Controlling is a core application for embedded control. Hence some sources of controlling algorithm are part of the emC sources. It is the experience for many years. Some experience in Simulink are also present.
The controlling FBlocks are the core algorithm in C which run in Simulink blocks too.
It is part of emC/Ctrl/*
2. T1_Ctrl
The header emC/Ctrl/T1_Ctrl_emC
contains some basic smoothing blocks in float and integer.
Because this header may always included, in controlling algorithm T1 Blocks are often used, here is a definition of
#define NOM_i16_Ctrl_emC 27720
which is the nominal value for 1.0
in integer 16bit resolution. This value allow an overdrive with 118% which is sufficient for proper algorithm for limitation. It is a number which can be divided by 1 … 12, 14, 15, 16, 18, 20, 21, 22, 24, 27, 28, 30, 33, 35, 36, ,40, 42, 44, 45, 50, 60, etc. It may be a point of interest for some algorithm.
3. Angle_Ctrl_emC
The basic idea for the angle is: 180° … 0 … +179.999° are mapped to 32768 … 0 … 32767 in integer range.
With this approach the angle is defined in this range. A swinging around 179 ... 179° is not a problem if differences are used (without overflow handling as usual in C/+, also in Java etc.).
Conversion routines between rad and int16
, int32
angle representation are a simple conversion to/from float and multiplication, fast if the processor supports float.
Especially a smoothing block for angle values prevent the problem of swinging around the 180° value, the smoothing works well.
4. PIDi_Ctrl_emC, PIDf_Ctrl_emC
A PID control needs a longer integrator value.
The floating variant would be need double arithmetic if float should be used anytime.
A better solution is using int32
for the integrator (may be sufficient enough), or uint64
.
Using of int32
enhances the integral part by 8 binary digits, about 2..3 decimal digits,
or for high resolution int64
has the same resolution as double.
Only the numeric range is limited to a given one. But this is usual anyway proper.
Often an integer variant of the controller is sufficient. The inputs and outputs may be 16 bit width. The integrator has 32 bit, recommended also for poor 16 bit processors.
See PIDctrl.html
5. Orthogonal band pass
This is a filter adequate a LC oscillation circuit. It can be used to filter harmonics and disturbing signals. See OrthBandpass.html
6. Wave Manager
This blocks can smooth signals by a smoothing mean value and access to values in the past. Especially the problem of drifting in time of the mean value by small inaccuracy of the last bits of floating values is solved.
7. Calculate Expression
It is an interpreter for any mathematic calculation. It runs fast enough for free applications.
The formula can be given by String expressions, which are parsed.