1/*
2 * Academic License - for use in teaching, academic research, and meeting
3 * course requirements at degree granting institutions only. Not for
4 * government, commercial, or other organizational use.
5 *
6 * File: FCC_New.c
7 *
8 * Code generated for Simulink model 'FCC_New'.
9 *
10 * Model version : 1.94
11 * Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
12 * C/C++ source code generated on : Fri Jul 10 14:45:25 2020
13 *
14 * Target selection: ert.tlc
15 * Embedded hardware selection: Intel->x86-32 (Windows32)
16 * Code generation objectives:
17 * 1. Execution efficiency
18 * 2. RAM efficiency
19 * Validation result: Not run
20 */
21
22#include "FCC_New.h"
23
24/* Private macros used by the generated code to access rtModel */
25#ifndef rtmIsSampleHit
26# define rtmIsSampleHit(sti, tid) (FCC_New_TimingBrdg->taskCounter[FCC_New_GlobalTID[sti]] == 0)
27#endif
28
29#ifndef rtmIsSpecialSampleHit
30# define rtmIsSpecialSampleHit(sti, prom_sti, tid) ( *((FCC_New_TimingBrdg->rateTransition)[FCC_New_GlobalTID[sti] + FCC_New_TimingBrdg->nTasks*FCC_New_GlobalTID[prom_sti]]) )
31#endif
32
33/* Macros for accessing real-time model data structure */
34#ifndef rtmGetClockTick0
35# define rtmGetClockTick0() ( *((FCC_New_TimingBrdg->clockTick[FCC_New_GlobalTID[0]])) )
36#endif
37
38#ifndef rtmGetClockTick1
39# define rtmGetClockTick1() ( *((FCC_New_TimingBrdg->clockTick[FCC_New_GlobalTID[1]])) )
40#endif
41
42#ifndef rtmGetClockTickH0
43# define rtmGetClockTickH0() ( *(FCC_New_TimingBrdg->clockTickH[FCC_New_GlobalTID[0]]) )
44#endif
45
46#ifndef rtmGetClockTickH1
47# define rtmGetClockTickH1() ( *(FCC_New_TimingBrdg->clockTickH[FCC_New_GlobalTID[1]]) )
48#endif
49
50#ifndef rtmGetT
51# define rtmGetT() (*(FCC_New_TimingBrdg->taskTime[0]))
52#endif
53
54int_T FCC_New_GlobalTID[2];
55const rtTimingBridge *FCC_New_TimingBrdg;
56MdlrefDW_FCC_New_T FCC_New_MdlrefDW;
57
58/* Block states (default storage) */
59DW_FCC_New_f_T FCC_New_DW;
60
61/* Disable for referenced model: 'FCC_New' */
62void FCC_New_Disable(void)
63{
64 /* Disable for ModelReference: '<Root>/AHRSControl' */
65 AHRSControl_Disable();
66
67 /* Disable for ModelReference: '<Root>/ActuatorControl' */
68 ActuatorControl_Disable();
69}
70
71/* Output and update for referenced model: 'FCC_New' */
72void FCC_NewTID0(const int16_T *rtu_Act_Pos1, const int16_T *rtu_Act_Pos2, const
73 int16_T *rtu_Act_Pos3, int16_T *rty_Actuator1, int16_T
74 *rty_Actuator2, int16_T *rty_Actuator3)
75{
76 int_T tid = 0;
77
78 /* RateTransition: '<Root>/RateTransition1' */
79 if (rtmIsSpecialSampleHit(1, 0, tid)) {
80 FCC_New_DW.RateTransition1 = FCC_New_DW.RateTransition1_Buffer0;
81
82 /* RateTransition: '<Root>/RateTransition2' */
83 FCC_New_DW.RateTransition2 = FCC_New_DW.RateTransition2_Buffer0;
84
85 /* RateTransition: '<Root>/RateTransition3' */
86 FCC_New_DW.RateTransition3 = FCC_New_DW.RateTransition3_Buffer0;
87 }
88
89 /* End of RateTransition: '<Root>/RateTransition1' */
90
91 /* FunctionCaller: '<Root>/ActuatorControl_caller' */
92 Actuator_Control(*rtu_Act_Pos1, FCC_New_DW.RateTransition1, *rtu_Act_Pos2,
93 FCC_New_DW.RateTransition2, *rtu_Act_Pos3,
94 FCC_New_DW.RateTransition3, rty_Actuator1, rty_Actuator2,
95 rty_Actuator3);
96
97 /* If subsystem generates rate grouping Output functions,
98 * when tid is used in Output function for one rate,
99 * all Output functions include tid as a local variable.
100 * As result, some Output functions may have unused tid.
101 */
102 (void) (tid);
103}
104
105/* Output and update for referenced model: 'FCC_New' */
106void FCC_NewTID1(const int16_T *rtu_Pilot_theta_cmd, const int16_T
107 *rtu_Pilot_phi_cmd, const int16_T *rtu_Pilot_r_cmd, const
108 AHRS_Bus *rtu_AHRS1, const AHRS_Bus *rtu_AHRS2, const AHRS_Bus *
109 rtu_AHRS3)
110{
111 int_T tid = 1;
112 real_T rtb_AHRSControl_caller[3];
113
114 /* FunctionCaller: '<Root>/AHRSControl_caller' */
115 AHRSControl_AHRS_Control(*rtu_Pilot_theta_cmd, *rtu_Pilot_phi_cmd,
116 *rtu_Pilot_r_cmd, rtu_AHRS1, rtu_AHRS2, rtu_AHRS3, rtb_AHRSControl_caller);
117
118 /* RateTransition: '<Root>/RateTransition1' */
119 FCC_New_DW.RateTransition1_Buffer0 = rtb_AHRSControl_caller[0];
120
121 /* RateTransition: '<Root>/RateTransition2' */
122 FCC_New_DW.RateTransition2_Buffer0 = rtb_AHRSControl_caller[1];
123
124 /* RateTransition: '<Root>/RateTransition3' */
125 FCC_New_DW.RateTransition3_Buffer0 = rtb_AHRSControl_caller[2];
126
127 /* If subsystem generates rate grouping Output functions,
128 * when tid is used in Output function for one rate,
129 * all Output functions include tid as a local variable.
130 * As result, some Output functions may have unused tid.
131 */
132 (void) (tid);
133}
134
135/* Model initialize function */
136void FCC_New_initialize(const rtTimingBridge *timingBridge, int_T mdlref_TID0,
137 int_T mdlref_TID1)
138{
139 /* Registration code */
140
141 /* setup the global timing engine */
142 FCC_New_GlobalTID[0] = mdlref_TID0;
143 FCC_New_GlobalTID[1] = mdlref_TID1;
144 FCC_New_TimingBrdg = timingBridge;
145}
146
147/*
148 * File trailer for generated code.
149 *
150 * [EOF]
151 */
152