
16
TargetLink:
C__I16FITI32_SAT is a function called in more than one place in the code.
Real-Time Workshop Embedded Coder:
In the process one thread usually runs for the pressure controller. This thread is
called CtrlTorqueUpdate and the execution time for that thread is saved in the
vector RedThreadMaxTimes. Execution time is shown in the table below. The test
was carried out for different inputs of the actual pressure and the results are
summarised in Table 3 below.
Actual Pressure TargetLink
(μs)
Real-Time Workshop
Embedded Coder (μs)
Hand-written
Code (μs)
6 Bar
596 692 648
12 Bar
597 694 638
40 Bar
568 694 602
Fluctuating
between
10-20 Bar
592 694 640
Table 3: Execution times
The table shows that TargetLink has the smallest execution time in all ranges of
input.
/* Sum: PressureController/PID controller/I-part/TrackingError */
Aux_I32 = (LONG) (((ULONG) (LONG) (I32UIn >> 1)) - ((ULONG) (LONG)
(X_Sa2_VOld >> 14)));
I16TrackingError = C__I16FITI32_SAT(Aux_I32, 32767
/*0.0004882663488 */);
/* Sum: '<S4>/TrackingError' incorporates:
* UnitDelay: '<S1>/VOld'
*/
tmp_1 = (localDW->VOld_DSTATE >> 14);
if (tmp_1 > 32767L) {
tmp_0 = MAX_int16_T;
} else if (tmp_1 <= -32768L) {
tmp_0 = MIN_int16_T;
} else {
tmp_0 = (INT)tmp_1;
}
tmp_1 = (LONG)(rtu_U >> 1) - (LONG)tmp_0;
if (tmp_1 > 32767L) {
tmp_0 = MAX_int16_T;
} else if (tmp_1 <= -32768L) {
tmp_0 = MIN_int16_T;
} else {
tmp_0 = (INT)tmp_1;
Commenti su questo manuale