1/*
2 * PMSM_Motor_TL3_sf.h
3 *
4 * Code generation for model "PMSM_Motor_TL3_sf".
5 *
6 * Model version : 1.825
7 * Simulink Coder version : 9.4 (R2020b) 29-Jul-2020
8 * C source code generated on : Fri Apr 14 12:51:02 2023
9 *
10 * Target selection: rtwsfcn.tlc
11 * Note: GRT includes extra infrastructure and instrumentation for prototyping
12 * Embedded hardware selection: ARM Compatible->ARM Cortex-M
13 * Emulation hardware selection:
14 * Differs from embedded hardware (MATLAB Host)
15 * Code generation objectives:
16 * 1. Execution efficiency
17 * 2. RAM efficiency
18 * Validation result: Not run
19 */
20
21#ifndef RTW_HEADER_PMSM_Motor_TL3_sf_h_
22#define RTW_HEADER_PMSM_Motor_TL3_sf_h_
23#include <math.h>
24#include <string.h>
25#include <stddef.h>
26#ifndef PMSM_Motor_TL3_sf_COMMON_INCLUDES_
27#define PMSM_Motor_TL3_sf_COMMON_INCLUDES_
28#include <stdlib.h>
29#define S_FUNCTION_NAME PMSM_Motor_TL3_sf
30#define S_FUNCTION_LEVEL 2
31#define RTW_GENERATED_S_FUNCTION
32#include "rtwtypes.h"
33#include "simstruc.h"
34#include "fixedpoint.h"
35#if !defined(MATLAB_MEX_FILE)
36#include "rt_matrx.h"
37#endif
38
39#if !defined(RTW_SFUNCTION_DEFINES)
40#define RTW_SFUNCTION_DEFINES
41
42typedef struct {
43 void *blockIO;
44 void *defaultParam;
45 void *nonContDerivSig;
46} LocalS;
47
48#define ssSetLocalBlockIO(S, io) ((LocalS *)ssGetUserData(S))->blockIO = ((void *)(io))
49#define ssGetLocalBlockIO(S) ((LocalS *)ssGetUserData(S))->blockIO
50#define ssSetLocalDefaultParam(S, paramVector) ((LocalS *)ssGetUserData(S))->defaultParam = (paramVector)
51#define ssGetLocalDefaultParam(S) ((LocalS *)ssGetUserData(S))->defaultParam
52#define ssSetLocalNonContDerivSig(S, pSig) ((LocalS *)ssGetUserData(S))->nonContDerivSig = (pSig)
53#define ssGetLocalNonContDerivSig(S) ((LocalS *)ssGetUserData(S))->nonContDerivSig
54#endif
55#endif /* PMSM_Motor_TL3_sf_COMMON_INCLUDES_ */
56
57#include "PMSM_Motor_TL3_sf_types.h"
58
59/* Shared type includes */
60#include "multiword_types.h"
61#include "rtGetNaN.h"
62#include "rt_nonfinite.h"
63#include "rt_defines.h"
64#include "rtGetInf.h"
65
66/* Block signals (default storage) */
67typedef struct {
68 real_T Fcn; /* '<S15>/Fcn' */
69 real_T Fcn1; /* '<S15>/Fcn1' */
70 real_T StateSpace_o1[9]; /* '<S20>/State-Space' */
71 real_T StateSpace_o2[6]; /* '<S20>/State-Space' */
72 real_T Gain; /* '<S11>/Gain' */
73 real_T Sum1; /* '<S18>/Sum1' */
74 real_T Sum; /* '<S17>/Sum' */
75 real_T Add1; /* '<S4>/Add1' */
76} B_PMSM_Motor_TL3_T;
77
78/* Constant parameters (default storage) */
79typedef struct {
80 /* Expression: zeros(1,Switches)
81 * Referenced by: '<S19>/Constant'
82 */
83 real_T Constant_Value[6];
84
85 /* Expression: S.D
86 * Referenced by: '<S20>/State-Space'
87 */
88 real_T StateSpace_DS_param[81];
89} ConstP_PMSM_Motor_TL3_T;
90
91/* External inputs (root inport signals with default storage) */
92typedef struct {
93 real_T *PWM[6]; /* '<Root>/PWM' */
94 real_T *TL; /* '<Root>/TL' */
95 real_T *DC; /* '<Root>/DC' */
96} ExternalUPtrs_PMSM_Motor_TL3_T;
97
98/* External outputs (root outports fed by signals with default storage) */
99typedef struct {
100 real_T *Statorcurrentis_aA; /* '<Root>/Stator current is_a (A)' */
101 real_T *Statorcurrentis_bA; /* '<Root>/Stator current is_b (A)' */
102 real_T *Statorcurrentis_cA; /* '<Root>/Stator current is_c (A)' */
103 real_T *Statorcurrentis_qA; /* '<Root>/Stator current is_q (A)' */
104 real_T *Statorcurrentis_dA; /* '<Root>/Stator current is_d (A)' */
105 real_T *StatorvoltageVs_qV; /* '<Root>/Stator voltage Vs_q (V)' */
106 real_T *StatorvoltageVs_dV; /* '<Root>/Stator voltage Vs_d (V)' */
107 real_T *Halleffectsignalh_a; /* '<Root>/Hall effect signal h_a' */
108 real_T *Halleffectsignalh_b; /* '<Root>/Hall effect signal h_b' */
109 real_T *Halleffectsignalh_c; /* '<Root>/Hall effect signal h_c' */
110 real_T *Rotorspeedwmrads; /* '<Root>/Rotor speed wm (rad//s)' */
111 real_T *Rotoranglethetamrad; /* '<Root>/Rotor angle thetam (rad)' */
112 real_T *ElectromagnetictorqueTeNm;
113 /* '<Root>/Electromagnetic torque Te (N*m)' */
114} ExtY_PMSM_Motor_TL3_T;
115
116/* Constant parameters (default storage) */
117extern const ConstP_PMSM_Motor_TL3_T PMSM_Motor_TL3_ConstP;
118
119/*-
120 * These blocks were eliminated from the model due to optimizations:
121 *
122 * Block '<S4>/Data Type Duplicate' : Unused code path elimination
123 * Block '<S3>/do not delete this gain' : Eliminated nontunable gain of 1
124 * Block '<S1>/Data Type Conversion' : Eliminate redundant data type conversion
125 * Block '<S17>/Lq//Ld' : Eliminated nontunable gain of 1
126 * Block '<S18>/Ld//Lq' : Eliminated nontunable gain of 1
127 * Block '<S19>/Data Type Conversion' : Eliminate redundant data type conversion
128 */
129
130/*-
131 * The generated code includes comments that allow you to trace directly
132 * back to the appropriate location in the model. The basic format
133 * is <system>/block_name, where system is the system number (uniquely
134 * assigned by Simulink) and block_name is the name of the block.
135 *
136 * Note that this particular code originates from a subsystem build,
137 * and has its own system numbers different from the parent model.
138 * Refer to the system hierarchy for this subsystem below, and use the
139 * MATLAB hilite_system command to trace the generated code back
140 * to the parent model. For example,
141 *
142 * hilite_system('FOC_ADRC/PMSM_Motor_TL3') - opens subsystem FOC_ADRC/PMSM_Motor_TL3
143 * hilite_system('FOC_ADRC/PMSM_Motor_TL3/Kp') - opens and selects block Kp
144 *
145 * Here is the system hierarchy for this model
146 *
147 * '<Root>' : 'FOC_ADRC'
148 * '<S1>' : 'FOC_ADRC/PMSM_Motor_TL3'
149 * '<S2>' : 'FOC_ADRC/PMSM_Motor_TL3/Controlled Voltage Source1'
150 * '<S3>' : 'FOC_ADRC/PMSM_Motor_TL3/Current Measurement'
151 * '<S4>' : 'FOC_ADRC/PMSM_Motor_TL3/IIR Filter1'
152 * '<S5>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1'
153 * '<S6>' : 'FOC_ADRC/PMSM_Motor_TL3/Universal Bridge1'
154 * '<S7>' : 'FOC_ADRC/PMSM_Motor_TL3/powergui'
155 * '<S8>' : 'FOC_ADRC/PMSM_Motor_TL3/Current Measurement/Model'
156 * '<S9>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model'
157 * '<S10>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Measurements'
158 * '<S11>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Mechanical model'
159 * '<S12>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model/Hall effect sensor'
160 * '<S13>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model/abc2qd'
161 * '<S14>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model/iq,id'
162 * '<S15>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model/qd2abc'
163 * '<S16>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model/Hall effect sensor/Angle converter'
164 * '<S17>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model/iq,id/id'
165 * '<S18>' : 'FOC_ADRC/PMSM_Motor_TL3/Permanent Magnet Synchronous Machine1/Electrical model/iq,id/iq'
166 * '<S19>' : 'FOC_ADRC/PMSM_Motor_TL3/Universal Bridge1/Model'
167 * '<S20>' : 'FOC_ADRC/PMSM_Motor_TL3/powergui/EquivalentModel1'
168 * '<S21>' : 'FOC_ADRC/PMSM_Motor_TL3/powergui/EquivalentModel1/Gates'
169 * '<S22>' : 'FOC_ADRC/PMSM_Motor_TL3/powergui/EquivalentModel1/Sources'
170 * '<S23>' : 'FOC_ADRC/PMSM_Motor_TL3/powergui/EquivalentModel1/Status'
171 * '<S24>' : 'FOC_ADRC/PMSM_Motor_TL3/powergui/EquivalentModel1/Yout'
172 */
173#endif /* RTW_HEADER_PMSM_Motor_TL3_sf_h_ */
174