MATLAB REAL-TIME WORKSHOP EMBEDDED CODER - S Manuel d'utilisateur Page 30

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 76
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 29
22
In another file, which is not generated from the model above, the following code
can be used to specify the parameter sets:
Calibratable parameter can be chosen by GetSet function that can be chosen for
any parameter or signal in the model. The tool for calibration can get access to the
parameter/signals in that way. ASAP2 files can be generated too.
Param_test.c
22 void param_test_step(void)
23 {
24 /* Sum: '<Root>/Sum
' incorporates:
25 * Gain: '<Root>/Gain
'
26 * Gain: '<Root>/Gain1
'
27 * Inport: '<Root>/In1
'
28 * Inport: '<Root>/In2
'
29 */
30 out1
= P[(int32_T)a - 1] * in1 + K[(int32_T)a - 1] * in2;
31 }
Param_test_private.h
30 /* Imported (extern) block parameters */
31 extern real_T
a; /* Expression: P(a)
32 * Referenced by blocks:
33 * '<Root>/Gain
'
34 * '<Root>/Gain1
'
35 */
36
37 /* Imported (extern) pointer block parameters */
38 extern real_T
*K; /* Expression: K(a)
39 * '<Root>/Gain1
'
40 */
41 extern real_T
*P; /* Expression: P(a)
42 * '<Root>/Gain
'
43 */
Int a = 1; /* Specify parameter set */
/* Parameter sets */
Real_T *P = {0.3, 0.5, 0.2…}; /* P – constant */
Real_T *K = {0.3, 0.5, 0.2…}; /* K – constant */
Vue de la page 29
1 2 ... 25 26 27 28 29 30 31 32 33 34 35 ... 75 76

Commentaires sur ces manuels

Pas de commentaire