diff --git a/ADM_Cruise_Control/Analysis.m b/ADM_Cruise_Control/Analysis.m
new file mode 100644
index 00000000..aeefc5d2
--- /dev/null
+++ b/ADM_Cruise_Control/Analysis.m
@@ -0,0 +1,5 @@
+t=data{8}.Values.Time;
+RPM=data{8}.Values.Data;
+TarRPM=data{16}.Values.Data;
+
+figure(1); plot(t, TarRPM, t, RPM); grid on;
\ No newline at end of file
diff --git a/ADM_Cruise_Control/CANTest.mldatx b/ADM_Cruise_Control/CANTest.mldatx
new file mode 100644
index 00000000..030aae9b
Binary files /dev/null and b/ADM_Cruise_Control/CANTest.mldatx differ
diff --git a/ADM_Cruise_Control/CANTest.slx b/ADM_Cruise_Control/CANTest.slx
new file mode 100644
index 00000000..217806e2
Binary files /dev/null and b/ADM_Cruise_Control/CANTest.slx differ
diff --git a/ADM_Cruise_Control/CANTest.slxc b/ADM_Cruise_Control/CANTest.slxc
new file mode 100644
index 00000000..99b96def
Binary files /dev/null and b/ADM_Cruise_Control/CANTest.slxc differ
diff --git a/ADM_Cruise_Control/CANTest.xml b/ADM_Cruise_Control/CANTest.xml
new file mode 100644
index 00000000..ad076230
--- /dev/null
+++ b/ADM_Cruise_Control/CANTest.xml
@@ -0,0 +1,653 @@
+
+
+ DAQ_In
+ CANTest/DAQ_In
+
+
+
+ CAN Read1
+ DAQ_In/CAN Read1
+ CANTest/DAQ_In/CAN Read1
+ [1 0 2]
+
+ P1
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P2
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P3
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P4
+ [1, 5]
+ CANTest/DAQ_In
+
+
+ P5
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P6
+ [1, 1]
+ CANTest/DAQ_In
+
+
+
+ CAN Setup
+ DAQ_In/CAN Setup
+ CANTest/DAQ_In/CAN Setup
+ [0 0 0]
+
+ P1
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P2
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P3
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P4
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P5
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P6
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P7
+ [1, 4]
+ CANTest/DAQ_In
+
+
+ P8
+ [1, 6]
+ CANTest/DAQ_In
+
+
+ P9
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P10
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P11
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P12
+ [1, 4]
+ CANTest/DAQ_In
+
+
+ P13
+ [1, 6]
+ CANTest/DAQ_In
+
+
+ P14
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P15
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P16
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P17
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P18
+ [1, 5]
+ CANTest/DAQ_In
+
+
+ P19
+ [1, 1]
+ CANTest/DAQ_In
+
+
+ P20
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P21
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P22
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P23
+ [1, 2]
+ CANTest/DAQ_In
+
+
+ P24
+ [1, 1]
+ CANTest/DAQ_In
+
+
+
+
+
+ CAN Read1/p1
+ DAQ_In/CAN Read1/p1
+ 1
+ [1, 1]
+ CANTest/DAQ_In
+ false
+
+
+
+
+ CAN Read1/p2
+ DAQ_In/CAN Read1/p2
+ 1
+ [1, 1]
+ CANTest/DAQ_In
+ false
+
+
+
+
+ CAN Unpack2/p1
+ DAQ_In/CAN Unpack2/p1
+ 1
+ [1, 1]
+ CANTest/DAQ_In
+ RPM
+ false
+
+
+
+
+ CAN Unpack2/p2
+ DAQ_In/CAN Unpack2/p2
+ 1
+ [1, 1]
+ CANTest/DAQ_In
+ TQ
+ false
+
+
+
+
+ DAQ_Out
+ CANTest/DAQ_Out
+
+ CANBoard
+ CANTest/DAQ_Out/CANBoard
+
+
+
+ Constant
+ DAQ_Out/CANBoard/Constant
+ CANTest/DAQ_Out/CANBoard/Constant
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+
+ Constant1
+ DAQ_Out/CANBoard/Constant1
+ CANTest/DAQ_Out/CANBoard/Constant1
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+
+ Constant2
+ DAQ_Out/CANBoard/Constant2
+ CANTest/DAQ_Out/CANBoard/Constant2
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+
+ Constant3
+ DAQ_Out/CANBoard/Constant3
+ CANTest/DAQ_Out/CANBoard/Constant3
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+
+ Constant4
+ DAQ_Out/CANBoard/Constant4
+ CANTest/DAQ_Out/CANBoard/Constant4
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+
+ CAN Write1
+ DAQ_Out/CANBoard/CAN Write1
+ CANTest/DAQ_Out/CANBoard/CAN Write1
+ [0 1 0]
+
+ P1
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+ P2
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+ P3
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+ P4
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+ P5
+ [1, 5]
+ CANTest/DAQ_Out/CANBoard
+
+
+ P6
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+ P7
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+
+
+
+
+
+ Constant
+ DAQ_Out/CANBoard/Constant
+ 1
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+ Ready
+ false
+
+
+
+
+ Constant1
+ DAQ_Out/CANBoard/Constant1
+ 1
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+ Gear
+ false
+
+
+
+
+ Constant2
+ DAQ_Out/CANBoard/Constant2
+ 1
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+ BMS
+ false
+
+
+
+
+ Constant3
+ DAQ_Out/CANBoard/Constant3
+ 1
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+ PosTQLim
+ false
+
+
+
+
+ Constant4
+ DAQ_Out/CANBoard/Constant4
+ 1
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+ NegTQLim
+ false
+
+
+
+
+ CAN Pack
+ DAQ_Out/CANBoard/CAN Pack
+ 1
+ [1, 1]
+ CANTest/DAQ_Out/CANBoard
+ false
+
+
+
+
+
+
+
+
+ Input Signal Conditioning
+ CANTest/Input Signal Conditioning
+
+
+
+
+
+ Mon_Cont
+ CANTest/Mon_Cont
+
+ LPFM
+ CANTest/Mon_Cont/LPFM
+
+
+
+ Constant1
+ Mon_Cont/LPFM/Constant1
+ CANTest/Mon_Cont/LPFM/Constant1
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+
+
+
+ gain1
+ Mon_Cont/LPFM/gain1
+ CANTest/Mon_Cont/LPFM/gain1
+ [0 1 1]
+
+ Gain
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+
+
+
+ gain2
+ Mon_Cont/LPFM/gain2
+ CANTest/Mon_Cont/LPFM/gain2
+ [0 1 1]
+
+ Gain
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+
+
+
+ d
+ Mon_Cont/LPFM/d
+ CANTest/Mon_Cont/LPFM/d
+ [0 1 1]
+
+ InitialCondition
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+
+
+
+ d1
+ Mon_Cont/LPFM/d1
+ CANTest/Mon_Cont/LPFM/d1
+ [0 1 1]
+
+ InitialCondition
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+
+
+
+
+
+ gain
+ Mon_Cont/LPFM/gain
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ gain1
+ Mon_Cont/LPFM/gain1
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ gain2
+ Mon_Cont/LPFM/gain2
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ Product1
+ Mon_Cont/LPFM/Product1
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ Product11
+ Mon_Cont/LPFM/Product11
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ Product2
+ Mon_Cont/LPFM/Product2
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ Sum1
+ Mon_Cont/LPFM/Sum1
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ Sum2
+ Mon_Cont/LPFM/Sum2
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ Sum3
+ Mon_Cont/LPFM/Sum3
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ Sum4
+ Mon_Cont/LPFM/Sum4
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ d
+ Mon_Cont/LPFM/d
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+ d1
+ Mon_Cont/LPFM/d1
+ 1
+ [1, 1]
+ CANTest/Mon_Cont/LPFM
+ false
+
+
+
+
+
+
+ Constant1
+ Mon_Cont/Constant1
+ CANTest/Mon_Cont/Constant1
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/Mon_Cont
+
+
+
+ ContMode
+ Mon_Cont/ContMode
+ CANTest/Mon_Cont/ContMode
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/Mon_Cont
+
+
+
+ TQCom
+ Mon_Cont/TQCom
+ CANTest/Mon_Cont/TQCom
+ [1 0 1]
+
+ Value
+ [1, 1]
+ CANTest/Mon_Cont
+
+
+
+ ContM
+ Mon_Cont/ContM
+ CANTest/Mon_Cont/ContM
+ [0 1 1]
+
+ Gain
+ [1, 1]
+ CANTest/Mon_Cont
+
+
+
+
+
+ ContM
+ Mon_Cont/ContM
+ 1
+ [1, 1]
+ CANTest/Mon_Cont
+ ContMode
+ false
+
+
+
+
+
+
+
+ Model Parameters
+ Model Parameters
+ .
+ [0 1 1]
+
+ Ts
+ [1,1]
+ CANTest
+
+
+
\ No newline at end of file
diff --git a/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest.c b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest.c
new file mode 100644
index 00000000..8d7b030a
--- /dev/null
+++ b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest.c
@@ -0,0 +1,2042 @@
+/*
+ * CANTest.c
+ *
+ * Academic License - for use in teaching, academic research, and meeting
+ * course requirements at degree granting institutions only. Not for
+ * government, commercial, or other organizational use.
+ *
+ * Code generation for model "CANTest".
+ *
+ * Model version : 1.360
+ * Simulink Coder version : 8.14 (R2018a) 06-Feb-2018
+ * C source code generated on : Tue Jul 11 11:56:08 2023
+ *
+ * Target selection: slrt.tlc
+ * Note: GRT includes extra infrastructure and instrumentation for prototyping
+ * Embedded hardware selection: Generic->32-bit x86 compatible
+ * Code generation objectives: Unspecified
+ * Validation result: Not run
+ */
+
+#include "rt_logging_mmi.h"
+#include "CANTest_capi.h"
+#include "CANTest.h"
+#include "CANTest_private.h"
+
+/* Block signals (default storage) */
+B_CANTest_T CANTest_B;
+
+/* Block states (default storage) */
+DW_CANTest_T CANTest_DW;
+
+/* Real-time model */
+RT_MODEL_CANTest_T CANTest_M_;
+RT_MODEL_CANTest_T *const CANTest_M = &CANTest_M_;
+
+/* Model output function */
+static void CANTest_output(void)
+{
+ int32_T s1_iter;
+
+ /* Gain: '/ContM' incorporates:
+ * Constant: '/ContMode'
+ */
+ CANTest_B.ContMode = CANTest_P.ContM_Gain * CANTest_P.ContMode_Value;
+
+ /* Constant: '/Constant' */
+ CANTest_B.Ready = CANTest_P.Constant_Value;
+
+ /* Constant: '/Constant1' */
+ CANTest_B.Gear = CANTest_P.Constant1_Value;
+
+ /* Constant: '/Constant2' */
+ CANTest_B.BMS = CANTest_P.Constant2_Value;
+
+ /* Constant: '/Constant3' */
+ CANTest_B.PosTQLim = CANTest_P.Constant3_Value;
+
+ /* Constant: '/Constant4' */
+ CANTest_B.NegTQLim = CANTest_P.Constant4_Value;
+
+ /* UnitDelay: '/d1' */
+ CANTest_B.d1 = CANTest_DW.d1_DSTATE;
+
+ /* Sum: '/Sum3' incorporates:
+ * Constant: '/TQCom'
+ */
+ CANTest_B.Sum3 = CANTest_P.TQCom_Value + CANTest_B.d1;
+
+ /* Gain: '/gain' */
+ CANTest_B.gain = CANTest_P.Ts * CANTest_B.Sum3;
+
+ /* Gain: '/gain2' incorporates:
+ * Constant: '/Constant1'
+ */
+ CANTest_B.gain2 = CANTest_P.gain2_Gain * CANTest_P.Constant1_Value_j;
+
+ /* Product: '/Product2' incorporates:
+ * Constant: '/Constant1'
+ */
+ CANTest_B.Product2 = CANTest_P.Constant1_Value_a / CANTest_B.gain2;
+
+ /* Gain: '/gain1' */
+ CANTest_B.gain1 = CANTest_P.gain1_Gain * CANTest_B.Product2;
+
+ /* Sum: '/Sum1' incorporates:
+ * Constant: '/Constant'
+ */
+ CANTest_B.Sum1 = CANTest_B.gain1 - CANTest_P.Ts;
+
+ /* UnitDelay: '/d' */
+ CANTest_B.d = CANTest_DW.d_DSTATE;
+
+ /* Product: '/Product11' */
+ CANTest_B.Product11 = CANTest_B.Sum1 * CANTest_B.d;
+
+ /* Sum: '/Sum2' */
+ CANTest_B.Sum2 = CANTest_B.gain + CANTest_B.Product11;
+
+ /* Sum: '/Sum4' incorporates:
+ * Constant: '/Constant'
+ */
+ CANTest_B.Sum4 = CANTest_B.gain1 + CANTest_P.Ts;
+
+ /* Product: '/Product1' */
+ CANTest_B.Product1 = CANTest_B.Sum2 / CANTest_B.Sum4;
+
+ /* S-Function (scanpack): '/CAN Pack' */
+ /* S-Function (scanpack): '/CAN Pack' */
+ CANTest_B.CANPack.ID = 592U;
+ CANTest_B.CANPack.Length = 8U;
+ CANTest_B.CANPack.Extended = 0U;
+ CANTest_B.CANPack.Remote = 0;
+ CANTest_B.CANPack.Data[0] = 0;
+ CANTest_B.CANPack.Data[1] = 0;
+ CANTest_B.CANPack.Data[2] = 0;
+ CANTest_B.CANPack.Data[3] = 0;
+ CANTest_B.CANPack.Data[4] = 0;
+ CANTest_B.CANPack.Data[5] = 0;
+ CANTest_B.CANPack.Data[6] = 0;
+ CANTest_B.CANPack.Data[7] = 0;
+
+ {
+ /* --------------- START Packing signal 0 ------------------
+ * startBit = 0
+ * length = 1
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.ContMode;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(1)) {
+ packedValue = (uint8_T) 1;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 1 ------------------
+ * startBit = 1
+ * length = 1
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.Ready;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(1)) {
+ packedValue = (uint8_T) 1;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 2 ------------------
+ * startBit = 2
+ * length = 1
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.Ready;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(1)) {
+ packedValue = (uint8_T) 1;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<2);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 3 ------------------
+ * startBit = 3
+ * length = 1
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.Ready;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(1)) {
+ packedValue = (uint8_T) 1;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<3);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 4 ------------------
+ * startBit = 4
+ * length = 4
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.Gear;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(15)) {
+ packedValue = (uint8_T) 15;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<4);
+ }
+
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 1)) >> 1)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 2)) >> 2)<<6);
+ }
+
+ {
+ CANTest_B.CANPack.Data[0] = CANTest_B.CANPack.Data[0] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 3)) >> 3)<<7);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 5 ------------------
+ * startBit = 8
+ * length = 2
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.Ready;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(3)) {
+ packedValue = (uint8_T) 3;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[1] = CANTest_B.CANPack.Data[1] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<0);
+ }
+
+ {
+ CANTest_B.CANPack.Data[1] = CANTest_B.CANPack.Data[1] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 1)) >> 1)<<1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 6 ------------------
+ * startBit = 10
+ * length = 3
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.BMS;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(7)) {
+ packedValue = (uint8_T) 7;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[1] = CANTest_B.CANPack.Data[1] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<2);
+ }
+
+ {
+ CANTest_B.CANPack.Data[1] = CANTest_B.CANPack.Data[1] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 1)) >> 1)<<3);
+ }
+
+ {
+ CANTest_B.CANPack.Data[1] = CANTest_B.CANPack.Data[1] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 2)) >> 2)<<4);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 7 ------------------
+ * startBit = 13
+ * length = 2
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = 0.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.Ready;
+
+ /* no scaling required */
+ outValue = result;
+ }
+
+ {
+ {
+ uint8_T packedValue;
+ if (outValue > (real64_T)(3)) {
+ packedValue = (uint8_T) 3;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint8_T) 0;
+ } else {
+ packedValue = (uint8_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[1] = CANTest_B.CANPack.Data[1] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 0)) >> 0)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[1] = CANTest_B.CANPack.Data[1] | (uint8_T)
+ ((uint8_T)((uint8_T)(packedValue & (uint8_T)(((uint8_T)(1)) <<
+ 1)) >> 1)<<6);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 8 ------------------
+ * startBit = 16
+ * length = 16
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 0.1
+ * offset = -200.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.PosTQLim;
+
+ /* full scaling operation */
+ result = (result - -200.0) * (1 / 0.1);
+ outValue = result;
+ }
+
+ {
+ {
+ uint16_T packedValue;
+ if (outValue > (real64_T)(65535)) {
+ packedValue = (uint16_T) 65535;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint16_T) 0;
+ } else {
+ packedValue = (uint16_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 0)) >> 0)<<0);
+ }
+
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 1)) >> 1)<<1);
+ }
+
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 2)) >> 2)<<2);
+ }
+
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 3)) >> 3)<<3);
+ }
+
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 4)) >> 4)<<4);
+ }
+
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 5)) >> 5)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 6)) >> 6)<<6);
+ }
+
+ {
+ CANTest_B.CANPack.Data[2] = CANTest_B.CANPack.Data[2] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 7)) >> 7)<<7);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 8)) >> 8)<<0);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 9)) >> 9)<<1);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 10)) >> 10)<<2);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 11)) >> 11)<<3);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 12)) >> 12)<<4);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 13)) >> 13)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 14)) >> 14)<<6);
+ }
+
+ {
+ CANTest_B.CANPack.Data[3] = CANTest_B.CANPack.Data[3] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 15)) >> 15)<<7);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 9 ------------------
+ * startBit = 32
+ * length = 16
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 0.1
+ * offset = -200.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.NegTQLim;
+
+ /* full scaling operation */
+ result = (result - -200.0) * (1 / 0.1);
+ outValue = result;
+ }
+
+ {
+ {
+ uint16_T packedValue;
+ if (outValue > (real64_T)(65535)) {
+ packedValue = (uint16_T) 65535;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint16_T) 0;
+ } else {
+ packedValue = (uint16_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 0)) >> 0)<<0);
+ }
+
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 1)) >> 1)<<1);
+ }
+
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 2)) >> 2)<<2);
+ }
+
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 3)) >> 3)<<3);
+ }
+
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 4)) >> 4)<<4);
+ }
+
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 5)) >> 5)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 6)) >> 6)<<6);
+ }
+
+ {
+ CANTest_B.CANPack.Data[4] = CANTest_B.CANPack.Data[4] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 7)) >> 7)<<7);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 8)) >> 8)<<0);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 9)) >> 9)<<1);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 10)) >> 10)<<2);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 11)) >> 11)<<3);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 12)) >> 12)<<4);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 13)) >> 13)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 14)) >> 14)<<6);
+ }
+
+ {
+ CANTest_B.CANPack.Data[5] = CANTest_B.CANPack.Data[5] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 15)) >> 15)<<7);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* --------------- START Packing signal 10 ------------------
+ * startBit = 48
+ * length = 16
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 0.1
+ * offset = -200.0
+ * minimum = 0.0
+ * maximum = 0.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ real64_T result = CANTest_B.Product1;
+
+ /* full scaling operation */
+ result = (result - -200.0) * (1 / 0.1);
+ outValue = result;
+ }
+
+ {
+ {
+ uint16_T packedValue;
+ if (outValue > (real64_T)(65535)) {
+ packedValue = (uint16_T) 65535;
+ } else if (outValue < (real64_T)(0)) {
+ packedValue = (uint16_T) 0;
+ } else {
+ packedValue = (uint16_T) (outValue);
+ }
+
+ {
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 0)) >> 0)<<0);
+ }
+
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 1)) >> 1)<<1);
+ }
+
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 2)) >> 2)<<2);
+ }
+
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 3)) >> 3)<<3);
+ }
+
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 4)) >> 4)<<4);
+ }
+
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 5)) >> 5)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 6)) >> 6)<<6);
+ }
+
+ {
+ CANTest_B.CANPack.Data[6] = CANTest_B.CANPack.Data[6] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 7)) >> 7)<<7);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 8)) >> 8)<<0);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 9)) >> 9)<<1);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 10)) >> 10)<<2);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 11)) >> 11)<<3);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 12)) >> 12)<<4);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 13)) >> 13)<<5);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 14)) >> 14)<<6);
+ }
+
+ {
+ CANTest_B.CANPack.Data[7] = CANTest_B.CANPack.Data[7] | (uint8_T)
+ ((uint8_T)((uint16_T)(packedValue & (uint16_T)(((uint16_T)(1))
+ << 15)) >> 15)<<7);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* S-Function (sg_IO61X_write_s): '/CAN Write1' */
+
+ /* Level2 S-Function Block: '/CAN Write1' (sg_IO61X_write_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[2];
+ sfcnOutputs(rts,0);
+ }
+
+ /* Outputs for Iterator SubSystem: '/DAQ_In' incorporates:
+ * WhileIterator: '/While Iterator'
+ */
+ s1_iter = 1;
+ do {
+ /* Level2 S-Function Block: '/CAN Setup' (sg_IO613_setup_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[0];
+ sfcnOutputs(rts,0);
+ }
+
+ /* Level2 S-Function Block: '/CAN Read1' (sg_IO61X_read_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[1];
+ sfcnOutputs(rts,0);
+ }
+
+ {
+ /* S-Function (scanunpack): '/CAN Unpack2' */
+ if ((8 == CANTest_B.CANRead1_o2.Length) && (CANTest_B.CANRead1_o2.ID !=
+ INVALID_CAN_ID) ) {
+ if ((768U == CANTest_B.CANRead1_o2.ID) && (0U ==
+ CANTest_B.CANRead1_o2.Extended) ) {
+ {
+ /* --------------- START Unpacking signal 0 ------------------
+ * startBit = 32
+ * length = 16
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 1.0
+ * offset = -32768.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ {
+ uint16_T unpackedValue = 0;
+
+ {
+ uint16_T tempValue = (uint16_T) (0);
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 0)) >> 0)<<0);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 1)) >> 1)<<1);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 2)) >> 2)<<2);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 3)) >> 3)<<3);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 4)) >> 4)<<4);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 5)) >> 5)<<5);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 6)) >> 6)<<6);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[4]) & (uint16_T)
+ ( (uint16_T) (1)<< 7)) >> 7)<<7);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 0)) >> 0)<<8);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 1)) >> 1)<<9);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 2)) >> 2)<<10);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 3)) >> 3)<<11);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 4)) >> 4)<<12);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 5)) >> 5)<<13);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 6)) >> 6)<<14);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[5]) & (uint16_T)
+ ( (uint16_T) (1)<< 7)) >> 7)<<15);
+ }
+
+ unpackedValue = tempValue;
+ }
+
+ outValue = (real64_T) (unpackedValue);
+ }
+ }
+
+ {
+ real64_T result = (real64_T) outValue;
+ result = result + -32768.0;
+ CANTest_B.RPM = result;
+ }
+ }
+ }
+
+ /* --------------- START Unpacking signal 1 ------------------
+ * startBit = 48
+ * length = 16
+ * desiredSignalByteLayout = LITTLEENDIAN
+ * dataType = UNSIGNED
+ * factor = 0.1
+ * offset = -200.0
+ * -----------------------------------------------------------------------*/
+ {
+ {
+ real64_T outValue = 0;
+
+ {
+ {
+ uint16_T unpackedValue = 0;
+
+ {
+ uint16_T tempValue = (uint16_T) (0);
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 0)) >> 0)<<0);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 1)) >> 1)<<1);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 2)) >> 2)<<2);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 3)) >> 3)<<3);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 4)) >> 4)<<4);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 5)) >> 5)<<5);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 6)) >> 6)<<6);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[6]) & (uint16_T)
+ ( (uint16_T) (1)<< 7)) >> 7)<<7);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 0)) >> 0)<<8);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 1)) >> 1)<<9);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 2)) >> 2)<<10);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 3)) >> 3)<<11);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 4)) >> 4)<<12);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 5)) >> 5)<<13);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 6)) >> 6)<<14);
+ }
+
+ {
+ tempValue = tempValue | (uint16_T)((uint16_T)((uint16_T)
+ ((CANTest_B.CANRead1_o2.Data[7]) & (uint16_T)
+ ( (uint16_T) (1)<< 7)) >> 7)<<15);
+ }
+
+ unpackedValue = tempValue;
+ }
+
+ outValue = (real64_T) (unpackedValue);
+ }
+ }
+
+ {
+ real64_T result = (real64_T) outValue;
+ result = (result * 0.1) + -200.0;
+ CANTest_B.TQ = result;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ s1_iter++;
+ } while (CANTest_B.CANRead1_o1 && (s1_iter <= 501));
+
+ /* End of Outputs for SubSystem: '/DAQ_In' */
+}
+
+/* Model update function */
+static void CANTest_update(void)
+{
+ /* Update for UnitDelay: '/d1' incorporates:
+ * Constant: '/TQCom'
+ */
+ CANTest_DW.d1_DSTATE = CANTest_P.TQCom_Value;
+
+ /* Update for UnitDelay: '/d' */
+ CANTest_DW.d_DSTATE = CANTest_B.Product1;
+
+ /* Update absolute time for base rate */
+ /* The "clockTick0" counts the number of times the code of this task has
+ * been executed. The absolute time is the multiplication of "clockTick0"
+ * and "Timing.stepSize0". Size of "clockTick0" ensures timer will not
+ * overflow during the application lifespan selected.
+ * Timer of this task consists of two 32 bit unsigned integers.
+ * The two integers represent the low bits Timing.clockTick0 and the high bits
+ * Timing.clockTickH0. When the low bit overflows to 0, the high bits increment.
+ */
+ if (!(++CANTest_M->Timing.clockTick0)) {
+ ++CANTest_M->Timing.clockTickH0;
+ }
+
+ CANTest_M->Timing.t[0] = CANTest_M->Timing.clockTick0 *
+ CANTest_M->Timing.stepSize0 + CANTest_M->Timing.clockTickH0 *
+ CANTest_M->Timing.stepSize0 * 4294967296.0;
+}
+
+/* Model initialize function */
+static void CANTest_initialize(void)
+{
+ /* Start for Constant: '/Constant' */
+ CANTest_B.Ready = CANTest_P.Constant_Value;
+
+ /* Start for Constant: '/Constant1' */
+ CANTest_B.Gear = CANTest_P.Constant1_Value;
+
+ /* Start for Constant: '/Constant2' */
+ CANTest_B.BMS = CANTest_P.Constant2_Value;
+
+ /* Start for Constant: '/Constant3' */
+ CANTest_B.PosTQLim = CANTest_P.Constant3_Value;
+
+ /* Start for Constant: '/Constant4' */
+ CANTest_B.NegTQLim = CANTest_P.Constant4_Value;
+
+ /* Start for S-Function (sg_IO61X_write_s): '/CAN Write1' */
+ /* Level2 S-Function Block: '/CAN Write1' (sg_IO61X_write_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[2];
+ sfcnStart(rts);
+ if (ssGetErrorStatus(rts) != (NULL))
+ return;
+ }
+
+ /* Start for Iterator SubSystem: '/DAQ_In' */
+
+ /* Start for S-Function (sg_IO613_setup_s): '/CAN Setup' */
+ /* Level2 S-Function Block: '/CAN Setup' (sg_IO613_setup_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[0];
+ sfcnStart(rts);
+ if (ssGetErrorStatus(rts) != (NULL))
+ return;
+ }
+
+ /* Start for S-Function (sg_IO61X_read_s): '/CAN Read1' */
+ /* Level2 S-Function Block: '/CAN Read1' (sg_IO61X_read_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[1];
+ sfcnStart(rts);
+ if (ssGetErrorStatus(rts) != (NULL))
+ return;
+ }
+
+ /* Start for S-Function (scanunpack): '/CAN Unpack2' */
+
+ /*-----------S-Function Block: /CAN Unpack2 -----------------*/
+
+ /* End of Start for SubSystem: '/DAQ_In' */
+
+ /* InitializeConditions for UnitDelay: '/d1' */
+ CANTest_DW.d1_DSTATE = CANTest_P.d1_InitialCondition;
+
+ /* InitializeConditions for UnitDelay: '/d' */
+ CANTest_DW.d_DSTATE = CANTest_P.d_InitialCondition;
+}
+
+/* Model terminate function */
+static void CANTest_terminate(void)
+{
+ /* Terminate for S-Function (sg_IO61X_write_s): '/CAN Write1' */
+ /* Level2 S-Function Block: '/CAN Write1' (sg_IO61X_write_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[2];
+ sfcnTerminate(rts);
+ }
+
+ /* Terminate for Iterator SubSystem: '/DAQ_In' */
+
+ /* Terminate for S-Function (sg_IO613_setup_s): '/CAN Setup' */
+ /* Level2 S-Function Block: '/CAN Setup' (sg_IO613_setup_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[0];
+ sfcnTerminate(rts);
+ }
+
+ /* Terminate for S-Function (sg_IO61X_read_s): '/CAN Read1' */
+ /* Level2 S-Function Block: '/CAN Read1' (sg_IO61X_read_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[1];
+ sfcnTerminate(rts);
+ }
+
+ /* End of Terminate for SubSystem: '/DAQ_In' */
+}
+
+/*========================================================================*
+ * Start of Classic call interface *
+ *========================================================================*/
+void MdlOutputs(int_T tid)
+{
+ CANTest_output();
+ UNUSED_PARAMETER(tid);
+}
+
+void MdlUpdate(int_T tid)
+{
+ CANTest_update();
+ UNUSED_PARAMETER(tid);
+}
+
+void MdlInitializeSizes(void)
+{
+}
+
+void MdlInitializeSampleTimes(void)
+{
+}
+
+void MdlInitialize(void)
+{
+}
+
+void MdlStart(void)
+{
+ CANTest_initialize();
+}
+
+void MdlTerminate(void)
+{
+ CANTest_terminate();
+}
+
+/* Registration function */
+RT_MODEL_CANTest_T *CANTest(void)
+{
+ /* Registration code */
+
+ /* initialize non-finites */
+ rt_InitInfAndNaN(sizeof(real_T));
+
+ /* initialize real-time model */
+ (void) memset((void *)CANTest_M, 0,
+ sizeof(RT_MODEL_CANTest_T));
+ rtsiSetSolverName(&CANTest_M->solverInfo,"FixedStepDiscrete");
+ CANTest_M->solverInfoPtr = (&CANTest_M->solverInfo);
+
+ /* Initialize timing info */
+ {
+ int_T *mdlTsMap = CANTest_M->Timing.sampleTimeTaskIDArray;
+ mdlTsMap[0] = 0;
+ CANTest_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
+ CANTest_M->Timing.sampleTimes = (&CANTest_M->Timing.sampleTimesArray[0]);
+ CANTest_M->Timing.offsetTimes = (&CANTest_M->Timing.offsetTimesArray[0]);
+
+ /* task periods */
+ CANTest_M->Timing.sampleTimes[0] = (0.002);
+
+ /* task offsets */
+ CANTest_M->Timing.offsetTimes[0] = (0.0);
+ }
+
+ rtmSetTPtr(CANTest_M, &CANTest_M->Timing.tArray[0]);
+
+ {
+ int_T *mdlSampleHits = CANTest_M->Timing.sampleHitArray;
+ mdlSampleHits[0] = 1;
+ CANTest_M->Timing.sampleHits = (&mdlSampleHits[0]);
+ }
+
+ rtmSetTFinal(CANTest_M, -1);
+ CANTest_M->Timing.stepSize0 = 0.002;
+
+ /* Setup for data logging */
+ {
+ static RTWLogInfo rt_DataLoggingInfo;
+ rt_DataLoggingInfo.loggingInterval = NULL;
+ CANTest_M->rtwLogInfo = &rt_DataLoggingInfo;
+ }
+
+ /* Setup for data logging */
+ {
+ /*
+ * Set pointers to the data and signal info each state
+ */
+ {
+ static int_T rt_LoggedStateWidths[] = {
+ 1,
+ 1
+ };
+
+ static int_T rt_LoggedStateNumDimensions[] = {
+ 1,
+ 1
+ };
+
+ static int_T rt_LoggedStateDimensions[] = {
+ 1,
+ 1
+ };
+
+ static boolean_T rt_LoggedStateIsVarDims[] = {
+ 0,
+ 0
+ };
+
+ static BuiltInDTypeId rt_LoggedStateDataTypeIds[] = {
+ SS_DOUBLE,
+ SS_DOUBLE
+ };
+
+ static int_T rt_LoggedStateComplexSignals[] = {
+ 0,
+ 0
+ };
+
+ static RTWPreprocessingFcnPtr rt_LoggingStatePreprocessingFcnPtrs[] = {
+ (NULL),
+ (NULL)
+ };
+
+ static const char_T *rt_LoggedStateLabels[] = {
+ "DSTATE",
+ "DSTATE"
+ };
+
+ static const char_T *rt_LoggedStateBlockNames[] = {
+ "CANTest/Mon_Cont/LPFM/d1",
+ "CANTest/Mon_Cont/LPFM/d"
+ };
+
+ static const char_T *rt_LoggedStateNames[] = {
+ "",
+ ""
+ };
+
+ static boolean_T rt_LoggedStateCrossMdlRef[] = {
+ 0,
+ 0
+ };
+
+ static RTWLogDataTypeConvert rt_RTWLogDataTypeConvert[] = {
+ { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 },
+
+ { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 }
+ };
+
+ static RTWLogSignalInfo rt_LoggedStateSignalInfo = {
+ 2,
+ rt_LoggedStateWidths,
+ rt_LoggedStateNumDimensions,
+ rt_LoggedStateDimensions,
+ rt_LoggedStateIsVarDims,
+ (NULL),
+ (NULL),
+ rt_LoggedStateDataTypeIds,
+ rt_LoggedStateComplexSignals,
+ (NULL),
+ rt_LoggingStatePreprocessingFcnPtrs,
+
+ { rt_LoggedStateLabels },
+ (NULL),
+ (NULL),
+ (NULL),
+
+ { rt_LoggedStateBlockNames },
+
+ { rt_LoggedStateNames },
+ rt_LoggedStateCrossMdlRef,
+ rt_RTWLogDataTypeConvert
+ };
+
+ static void * rt_LoggedStateSignalPtrs[2];
+ rtliSetLogXSignalPtrs(CANTest_M->rtwLogInfo, (LogSignalPtrsType)
+ rt_LoggedStateSignalPtrs);
+ rtliSetLogXSignalInfo(CANTest_M->rtwLogInfo, &rt_LoggedStateSignalInfo);
+ rt_LoggedStateSignalPtrs[0] = (void*)&CANTest_DW.d1_DSTATE;
+ rt_LoggedStateSignalPtrs[1] = (void*)&CANTest_DW.d_DSTATE;
+ }
+
+ rtliSetLogT(CANTest_M->rtwLogInfo, "tout");
+ rtliSetLogX(CANTest_M->rtwLogInfo, "xout");
+ rtliSetLogXFinal(CANTest_M->rtwLogInfo, "");
+ rtliSetLogVarNameModifier(CANTest_M->rtwLogInfo, "rt_");
+ rtliSetLogFormat(CANTest_M->rtwLogInfo, 2);
+ rtliSetLogMaxRows(CANTest_M->rtwLogInfo, 0);
+ rtliSetLogDecimation(CANTest_M->rtwLogInfo, 1);
+ rtliSetLogY(CANTest_M->rtwLogInfo, "");
+ rtliSetLogYSignalInfo(CANTest_M->rtwLogInfo, (NULL));
+ rtliSetLogYSignalPtrs(CANTest_M->rtwLogInfo, (NULL));
+ }
+
+ CANTest_M->solverInfoPtr = (&CANTest_M->solverInfo);
+ CANTest_M->Timing.stepSize = (0.002);
+ rtsiSetFixedStepSize(&CANTest_M->solverInfo, 0.002);
+ rtsiSetSolverMode(&CANTest_M->solverInfo, SOLVER_MODE_SINGLETASKING);
+
+ /* block I/O */
+ CANTest_M->blockIO = ((void *) &CANTest_B);
+ (void) memset(((void *) &CANTest_B), 0,
+ sizeof(B_CANTest_T));
+
+ {
+ CANTest_B.CANPack = CAN_DATATYPE_GROUND;
+ CANTest_B.CANRead1_o2 = CAN_DATATYPE_GROUND;
+ CANTest_B.ContMode = 0.0;
+ CANTest_B.Ready = 0.0;
+ CANTest_B.Gear = 0.0;
+ CANTest_B.BMS = 0.0;
+ CANTest_B.PosTQLim = 0.0;
+ CANTest_B.NegTQLim = 0.0;
+ CANTest_B.d1 = 0.0;
+ CANTest_B.Sum3 = 0.0;
+ CANTest_B.gain = 0.0;
+ CANTest_B.gain2 = 0.0;
+ CANTest_B.Product2 = 0.0;
+ CANTest_B.gain1 = 0.0;
+ CANTest_B.Sum1 = 0.0;
+ CANTest_B.d = 0.0;
+ CANTest_B.Product11 = 0.0;
+ CANTest_B.Sum2 = 0.0;
+ CANTest_B.Sum4 = 0.0;
+ CANTest_B.Product1 = 0.0;
+ CANTest_B.RPM = 0.0;
+ CANTest_B.TQ = 0.0;
+ }
+
+ /* parameters */
+ CANTest_M->defaultParam = ((real_T *)&CANTest_P);
+
+ /* states (dwork) */
+ CANTest_M->dwork = ((void *) &CANTest_DW);
+ (void) memset((void *)&CANTest_DW, 0,
+ sizeof(DW_CANTest_T));
+ CANTest_DW.d1_DSTATE = 0.0;
+ CANTest_DW.d_DSTATE = 0.0;
+
+ /* Initialize DataMapInfo substructure containing ModelMap for C API */
+ CANTest_InitializeDataMapInfo();
+
+ /* child S-Function registration */
+ {
+ RTWSfcnInfo *sfcnInfo = &CANTest_M->NonInlinedSFcns.sfcnInfo;
+ CANTest_M->sfcnInfo = (sfcnInfo);
+ rtssSetErrorStatusPtr(sfcnInfo, (&rtmGetErrorStatus(CANTest_M)));
+ rtssSetNumRootSampTimesPtr(sfcnInfo, &CANTest_M->Sizes.numSampTimes);
+ CANTest_M->NonInlinedSFcns.taskTimePtrs[0] = &(rtmGetTPtr(CANTest_M)[0]);
+ rtssSetTPtrPtr(sfcnInfo,CANTest_M->NonInlinedSFcns.taskTimePtrs);
+ rtssSetTStartPtr(sfcnInfo, &rtmGetTStart(CANTest_M));
+ rtssSetTFinalPtr(sfcnInfo, &rtmGetTFinal(CANTest_M));
+ rtssSetTimeOfLastOutputPtr(sfcnInfo, &rtmGetTimeOfLastOutput(CANTest_M));
+ rtssSetStepSizePtr(sfcnInfo, &CANTest_M->Timing.stepSize);
+ rtssSetStopRequestedPtr(sfcnInfo, &rtmGetStopRequested(CANTest_M));
+ rtssSetDerivCacheNeedsResetPtr(sfcnInfo, &CANTest_M->derivCacheNeedsReset);
+ rtssSetZCCacheNeedsResetPtr(sfcnInfo, &CANTest_M->zCCacheNeedsReset);
+ rtssSetContTimeOutputInconsistentWithStateAtMajorStepPtr(sfcnInfo,
+ &CANTest_M->CTOutputIncnstWithState);
+ rtssSetSampleHitsPtr(sfcnInfo, &CANTest_M->Timing.sampleHits);
+ rtssSetPerTaskSampleHitsPtr(sfcnInfo, &CANTest_M->Timing.perTaskSampleHits);
+ rtssSetSimModePtr(sfcnInfo, &CANTest_M->simMode);
+ rtssSetSolverInfoPtr(sfcnInfo, &CANTest_M->solverInfoPtr);
+ }
+
+ CANTest_M->Sizes.numSFcns = (3);
+
+ /* register each child */
+ {
+ (void) memset((void *)&CANTest_M->NonInlinedSFcns.childSFunctions[0], 0,
+ 3*sizeof(SimStruct));
+ CANTest_M->childSfunctions = (&CANTest_M->
+ NonInlinedSFcns.childSFunctionPtrs[0]);
+ CANTest_M->childSfunctions[0] = (&CANTest_M->
+ NonInlinedSFcns.childSFunctions[0]);
+ CANTest_M->childSfunctions[1] = (&CANTest_M->
+ NonInlinedSFcns.childSFunctions[1]);
+ CANTest_M->childSfunctions[2] = (&CANTest_M->
+ NonInlinedSFcns.childSFunctions[2]);
+
+ /* Level2 S-Function Block: CANTest//CAN Setup (sg_IO613_setup_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[0];
+
+ /* timing info */
+ time_T *sfcnPeriod = CANTest_M->NonInlinedSFcns.Sfcn0.sfcnPeriod;
+ time_T *sfcnOffset = CANTest_M->NonInlinedSFcns.Sfcn0.sfcnOffset;
+ int_T *sfcnTsMap = CANTest_M->NonInlinedSFcns.Sfcn0.sfcnTsMap;
+ (void) memset((void*)sfcnPeriod, 0,
+ sizeof(time_T)*1);
+ (void) memset((void*)sfcnOffset, 0,
+ sizeof(time_T)*1);
+ ssSetSampleTimePtr(rts, &sfcnPeriod[0]);
+ ssSetOffsetTimePtr(rts, &sfcnOffset[0]);
+ ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap);
+
+ {
+ ssSetBlkInfo2Ptr(rts, &CANTest_M->NonInlinedSFcns.blkInfo2[0]);
+ }
+
+ _ssSetBlkInfo2PortInfo2Ptr(rts,
+ &CANTest_M->NonInlinedSFcns.inputOutputPortInfo2[0]);
+
+ /* Set up the mdlInfo pointer */
+ ssSetRTWSfcnInfo(rts, CANTest_M->sfcnInfo);
+
+ /* Allocate memory of model methods 2 */
+ {
+ ssSetModelMethods2(rts, &CANTest_M->NonInlinedSFcns.methods2[0]);
+ }
+
+ /* Allocate memory of model methods 3 */
+ {
+ ssSetModelMethods3(rts, &CANTest_M->NonInlinedSFcns.methods3[0]);
+ }
+
+ /* Allocate memory of model methods 4 */
+ {
+ ssSetModelMethods4(rts, &CANTest_M->NonInlinedSFcns.methods4[0]);
+ }
+
+ /* Allocate memory for states auxilliary information */
+ {
+ ssSetStatesInfo2(rts, &CANTest_M->NonInlinedSFcns.statesInfo2[0]);
+ ssSetPeriodicStatesInfo(rts,
+ &CANTest_M->NonInlinedSFcns.periodicStatesInfo[0]);
+ }
+
+ /* path info */
+ ssSetModelName(rts, "CAN Setup");
+ ssSetPath(rts, "CANTest/DAQ_In/CAN Setup");
+ ssSetRTModel(rts,CANTest_M);
+ ssSetParentSS(rts, (NULL));
+ ssSetRootSS(rts, rts);
+ ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2);
+
+ /* parameters */
+ {
+ mxArray **sfcnParams = (mxArray **)
+ &CANTest_M->NonInlinedSFcns.Sfcn0.params;
+ ssSetSFcnParamsCount(rts, 24);
+ ssSetSFcnParamsPtr(rts, &sfcnParams[0]);
+ ssSetSFcnParam(rts, 0, (mxArray*)CANTest_P.CANSetup_P1_Size);
+ ssSetSFcnParam(rts, 1, (mxArray*)CANTest_P.CANSetup_P2_Size);
+ ssSetSFcnParam(rts, 2, (mxArray*)CANTest_P.CANSetup_P3_Size);
+ ssSetSFcnParam(rts, 3, (mxArray*)CANTest_P.CANSetup_P4_Size);
+ ssSetSFcnParam(rts, 4, (mxArray*)CANTest_P.CANSetup_P5_Size);
+ ssSetSFcnParam(rts, 5, (mxArray*)CANTest_P.CANSetup_P6_Size);
+ ssSetSFcnParam(rts, 6, (mxArray*)CANTest_P.CANSetup_P7_Size);
+ ssSetSFcnParam(rts, 7, (mxArray*)CANTest_P.CANSetup_P8_Size);
+ ssSetSFcnParam(rts, 8, (mxArray*)CANTest_P.CANSetup_P9_Size);
+ ssSetSFcnParam(rts, 9, (mxArray*)CANTest_P.CANSetup_P10_Size);
+ ssSetSFcnParam(rts, 10, (mxArray*)CANTest_P.CANSetup_P11_Size);
+ ssSetSFcnParam(rts, 11, (mxArray*)CANTest_P.CANSetup_P12_Size);
+ ssSetSFcnParam(rts, 12, (mxArray*)CANTest_P.CANSetup_P13_Size);
+ ssSetSFcnParam(rts, 13, (mxArray*)CANTest_P.CANSetup_P14_Size);
+ ssSetSFcnParam(rts, 14, (mxArray*)CANTest_P.CANSetup_P15_Size);
+ ssSetSFcnParam(rts, 15, (mxArray*)CANTest_P.CANSetup_P16_Size);
+ ssSetSFcnParam(rts, 16, (mxArray*)CANTest_P.CANSetup_P17_Size);
+ ssSetSFcnParam(rts, 17, (mxArray*)CANTest_P.CANSetup_P18_Size);
+ ssSetSFcnParam(rts, 18, (mxArray*)CANTest_P.CANSetup_P19_Size);
+ ssSetSFcnParam(rts, 19, (mxArray*)CANTest_P.CANSetup_P20_Size);
+ ssSetSFcnParam(rts, 20, (mxArray*)CANTest_P.CANSetup_P21_Size);
+ ssSetSFcnParam(rts, 21, (mxArray*)CANTest_P.CANSetup_P22_Size);
+ ssSetSFcnParam(rts, 22, (mxArray*)CANTest_P.CANSetup_P23_Size);
+ ssSetSFcnParam(rts, 23, (mxArray*)CANTest_P.CANSetup_P24_Size);
+ }
+
+ /* work vectors */
+ ssSetIWork(rts, (int_T *) &CANTest_DW.CANSetup_IWORK);
+
+ {
+ struct _ssDWorkRecord *dWorkRecord = (struct _ssDWorkRecord *)
+ &CANTest_M->NonInlinedSFcns.Sfcn0.dWork;
+ struct _ssDWorkAuxRecord *dWorkAuxRecord = (struct _ssDWorkAuxRecord *)
+ &CANTest_M->NonInlinedSFcns.Sfcn0.dWorkAux;
+ ssSetSFcnDWork(rts, dWorkRecord);
+ ssSetSFcnDWorkAux(rts, dWorkAuxRecord);
+ _ssSetNumDWork(rts, 1);
+
+ /* IWORK */
+ ssSetDWorkWidth(rts, 0, 1);
+ ssSetDWorkDataType(rts, 0,SS_INTEGER);
+ ssSetDWorkComplexSignal(rts, 0, 0);
+ ssSetDWork(rts, 0, &CANTest_DW.CANSetup_IWORK);
+ }
+
+ /* registration */
+ sg_IO613_setup_s(rts);
+ sfcnInitializeSizes(rts);
+ sfcnInitializeSampleTimes(rts);
+
+ /* adjust sample time */
+ ssSetSampleTime(rts, 0, 0.002);
+ ssSetOffsetTime(rts, 0, 0.0);
+ sfcnTsMap[0] = 0;
+
+ /* set compiled values of dynamic vector attributes */
+ ssSetNumNonsampledZCs(rts, 0);
+
+ /* Update connectivity flags for each port */
+ /* Update the BufferDstPort flags for each input port */
+ }
+
+ /* Level2 S-Function Block: CANTest//CAN Read1 (sg_IO61X_read_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[1];
+
+ /* timing info */
+ time_T *sfcnPeriod = CANTest_M->NonInlinedSFcns.Sfcn1.sfcnPeriod;
+ time_T *sfcnOffset = CANTest_M->NonInlinedSFcns.Sfcn1.sfcnOffset;
+ int_T *sfcnTsMap = CANTest_M->NonInlinedSFcns.Sfcn1.sfcnTsMap;
+ (void) memset((void*)sfcnPeriod, 0,
+ sizeof(time_T)*1);
+ (void) memset((void*)sfcnOffset, 0,
+ sizeof(time_T)*1);
+ ssSetSampleTimePtr(rts, &sfcnPeriod[0]);
+ ssSetOffsetTimePtr(rts, &sfcnOffset[0]);
+ ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap);
+
+ {
+ ssSetBlkInfo2Ptr(rts, &CANTest_M->NonInlinedSFcns.blkInfo2[1]);
+ }
+
+ _ssSetBlkInfo2PortInfo2Ptr(rts,
+ &CANTest_M->NonInlinedSFcns.inputOutputPortInfo2[1]);
+
+ /* Set up the mdlInfo pointer */
+ ssSetRTWSfcnInfo(rts, CANTest_M->sfcnInfo);
+
+ /* Allocate memory of model methods 2 */
+ {
+ ssSetModelMethods2(rts, &CANTest_M->NonInlinedSFcns.methods2[1]);
+ }
+
+ /* Allocate memory of model methods 3 */
+ {
+ ssSetModelMethods3(rts, &CANTest_M->NonInlinedSFcns.methods3[1]);
+ }
+
+ /* Allocate memory of model methods 4 */
+ {
+ ssSetModelMethods4(rts, &CANTest_M->NonInlinedSFcns.methods4[1]);
+ }
+
+ /* Allocate memory for states auxilliary information */
+ {
+ ssSetStatesInfo2(rts, &CANTest_M->NonInlinedSFcns.statesInfo2[1]);
+ ssSetPeriodicStatesInfo(rts,
+ &CANTest_M->NonInlinedSFcns.periodicStatesInfo[1]);
+ }
+
+ /* outputs */
+ {
+ ssSetPortInfoForOutputs(rts,
+ &CANTest_M->NonInlinedSFcns.Sfcn1.outputPortInfo[0]);
+ _ssSetNumOutputPorts(rts, 2);
+ _ssSetPortInfo2ForOutputUnits(rts,
+ &CANTest_M->NonInlinedSFcns.Sfcn1.outputPortUnits[0]);
+ ssSetOutputPortUnit(rts, 0, 0);
+ ssSetOutputPortUnit(rts, 1, 0);
+ _ssSetPortInfo2ForOutputCoSimAttribute(rts,
+ &CANTest_M->NonInlinedSFcns.Sfcn1.outputPortCoSimAttribute[0]);
+ ssSetOutputPortIsContinuousQuantity(rts, 0, 0);
+ ssSetOutputPortIsContinuousQuantity(rts, 1, 0);
+
+ /* port 0 */
+ {
+ _ssSetOutputPortNumDimensions(rts, 0, 1);
+ ssSetOutputPortWidth(rts, 0, 1);
+ ssSetOutputPortSignal(rts, 0, ((boolean_T *) &CANTest_B.CANRead1_o1));
+ }
+
+ /* port 1 */
+ {
+ _ssSetOutputPortNumDimensions(rts, 1, 1);
+ ssSetOutputPortWidth(rts, 1, 1);
+ ssSetOutputPortSignal(rts, 1, ((CAN_DATATYPE *) &CANTest_B.CANRead1_o2));
+ }
+ }
+
+ /* path info */
+ ssSetModelName(rts, "CAN Read1");
+ ssSetPath(rts, "CANTest/DAQ_In/CAN Read1");
+ ssSetRTModel(rts,CANTest_M);
+ ssSetParentSS(rts, (NULL));
+ ssSetRootSS(rts, rts);
+ ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2);
+
+ /* parameters */
+ {
+ mxArray **sfcnParams = (mxArray **)
+ &CANTest_M->NonInlinedSFcns.Sfcn1.params;
+ ssSetSFcnParamsCount(rts, 6);
+ ssSetSFcnParamsPtr(rts, &sfcnParams[0]);
+ ssSetSFcnParam(rts, 0, (mxArray*)CANTest_P.CANRead1_P1_Size);
+ ssSetSFcnParam(rts, 1, (mxArray*)CANTest_P.CANRead1_P2_Size);
+ ssSetSFcnParam(rts, 2, (mxArray*)CANTest_P.CANRead1_P3_Size);
+ ssSetSFcnParam(rts, 3, (mxArray*)CANTest_P.CANRead1_P4_Size);
+ ssSetSFcnParam(rts, 4, (mxArray*)CANTest_P.CANRead1_P5_Size);
+ ssSetSFcnParam(rts, 5, (mxArray*)CANTest_P.CANRead1_P6_Size);
+ }
+
+ /* work vectors */
+ ssSetIWork(rts, (int_T *) &CANTest_DW.CANRead1_IWORK);
+
+ {
+ struct _ssDWorkRecord *dWorkRecord = (struct _ssDWorkRecord *)
+ &CANTest_M->NonInlinedSFcns.Sfcn1.dWork;
+ struct _ssDWorkAuxRecord *dWorkAuxRecord = (struct _ssDWorkAuxRecord *)
+ &CANTest_M->NonInlinedSFcns.Sfcn1.dWorkAux;
+ ssSetSFcnDWork(rts, dWorkRecord);
+ ssSetSFcnDWorkAux(rts, dWorkAuxRecord);
+ _ssSetNumDWork(rts, 1);
+
+ /* IWORK */
+ ssSetDWorkWidth(rts, 0, 1);
+ ssSetDWorkDataType(rts, 0,SS_INTEGER);
+ ssSetDWorkComplexSignal(rts, 0, 0);
+ ssSetDWork(rts, 0, &CANTest_DW.CANRead1_IWORK);
+ }
+
+ /* registration */
+ sg_IO61X_read_s(rts);
+ sfcnInitializeSizes(rts);
+ sfcnInitializeSampleTimes(rts);
+
+ /* adjust sample time */
+ ssSetSampleTime(rts, 0, 0.002);
+ ssSetOffsetTime(rts, 0, 0.0);
+ sfcnTsMap[0] = 0;
+
+ /* set compiled values of dynamic vector attributes */
+ ssSetNumNonsampledZCs(rts, 0);
+
+ /* Update connectivity flags for each port */
+ _ssSetOutputPortConnected(rts, 0, 1);
+ _ssSetOutputPortConnected(rts, 1, 1);
+ _ssSetOutputPortBeingMerged(rts, 0, 0);
+ _ssSetOutputPortBeingMerged(rts, 1, 0);
+
+ /* Update the BufferDstPort flags for each input port */
+ }
+
+ /* Level2 S-Function Block: CANTest//CAN Write1 (sg_IO61X_write_s) */
+ {
+ SimStruct *rts = CANTest_M->childSfunctions[2];
+
+ /* timing info */
+ time_T *sfcnPeriod = CANTest_M->NonInlinedSFcns.Sfcn2.sfcnPeriod;
+ time_T *sfcnOffset = CANTest_M->NonInlinedSFcns.Sfcn2.sfcnOffset;
+ int_T *sfcnTsMap = CANTest_M->NonInlinedSFcns.Sfcn2.sfcnTsMap;
+ (void) memset((void*)sfcnPeriod, 0,
+ sizeof(time_T)*1);
+ (void) memset((void*)sfcnOffset, 0,
+ sizeof(time_T)*1);
+ ssSetSampleTimePtr(rts, &sfcnPeriod[0]);
+ ssSetOffsetTimePtr(rts, &sfcnOffset[0]);
+ ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap);
+
+ {
+ ssSetBlkInfo2Ptr(rts, &CANTest_M->NonInlinedSFcns.blkInfo2[2]);
+ }
+
+ _ssSetBlkInfo2PortInfo2Ptr(rts,
+ &CANTest_M->NonInlinedSFcns.inputOutputPortInfo2[2]);
+
+ /* Set up the mdlInfo pointer */
+ ssSetRTWSfcnInfo(rts, CANTest_M->sfcnInfo);
+
+ /* Allocate memory of model methods 2 */
+ {
+ ssSetModelMethods2(rts, &CANTest_M->NonInlinedSFcns.methods2[2]);
+ }
+
+ /* Allocate memory of model methods 3 */
+ {
+ ssSetModelMethods3(rts, &CANTest_M->NonInlinedSFcns.methods3[2]);
+ }
+
+ /* Allocate memory of model methods 4 */
+ {
+ ssSetModelMethods4(rts, &CANTest_M->NonInlinedSFcns.methods4[2]);
+ }
+
+ /* Allocate memory for states auxilliary information */
+ {
+ ssSetStatesInfo2(rts, &CANTest_M->NonInlinedSFcns.statesInfo2[2]);
+ ssSetPeriodicStatesInfo(rts,
+ &CANTest_M->NonInlinedSFcns.periodicStatesInfo[2]);
+ }
+
+ /* inputs */
+ {
+ _ssSetNumInputPorts(rts, 1);
+ ssSetPortInfoForInputs(rts,
+ &CANTest_M->NonInlinedSFcns.Sfcn2.inputPortInfo[0]);
+ _ssSetPortInfo2ForInputUnits(rts,
+ &CANTest_M->NonInlinedSFcns.Sfcn2.inputPortUnits[0]);
+ ssSetInputPortUnit(rts, 0, 0);
+ _ssSetPortInfo2ForInputCoSimAttribute(rts,
+ &CANTest_M->NonInlinedSFcns.Sfcn2.inputPortCoSimAttribute[0]);
+ ssSetInputPortIsContinuousQuantity(rts, 0, 0);
+
+ /* port 0 */
+ {
+ ssSetInputPortRequiredContiguous(rts, 0, 1);
+ ssSetInputPortSignal(rts, 0, &CANTest_B.CANPack);
+ _ssSetInputPortNumDimensions(rts, 0, 1);
+ ssSetInputPortWidth(rts, 0, 1);
+ }
+ }
+
+ /* path info */
+ ssSetModelName(rts, "CAN Write1");
+ ssSetPath(rts, "CANTest/DAQ_Out/CANBoard/CAN Write1");
+ ssSetRTModel(rts,CANTest_M);
+ ssSetParentSS(rts, (NULL));
+ ssSetRootSS(rts, rts);
+ ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2);
+
+ /* parameters */
+ {
+ mxArray **sfcnParams = (mxArray **)
+ &CANTest_M->NonInlinedSFcns.Sfcn2.params;
+ ssSetSFcnParamsCount(rts, 7);
+ ssSetSFcnParamsPtr(rts, &sfcnParams[0]);
+ ssSetSFcnParam(rts, 0, (mxArray*)CANTest_P.CANWrite1_P1_Size);
+ ssSetSFcnParam(rts, 1, (mxArray*)CANTest_P.CANWrite1_P2_Size);
+ ssSetSFcnParam(rts, 2, (mxArray*)CANTest_P.CANWrite1_P3_Size);
+ ssSetSFcnParam(rts, 3, (mxArray*)CANTest_P.CANWrite1_P4_Size);
+ ssSetSFcnParam(rts, 4, (mxArray*)CANTest_P.CANWrite1_P5_Size);
+ ssSetSFcnParam(rts, 5, (mxArray*)CANTest_P.CANWrite1_P6_Size);
+ ssSetSFcnParam(rts, 6, (mxArray*)CANTest_P.CANWrite1_P7_Size);
+ }
+
+ /* work vectors */
+ ssSetIWork(rts, (int_T *) &CANTest_DW.CANWrite1_IWORK);
+ ssSetPWork(rts, (void **) &CANTest_DW.CANWrite1_PWORK);
+
+ {
+ struct _ssDWorkRecord *dWorkRecord = (struct _ssDWorkRecord *)
+ &CANTest_M->NonInlinedSFcns.Sfcn2.dWork;
+ struct _ssDWorkAuxRecord *dWorkAuxRecord = (struct _ssDWorkAuxRecord *)
+ &CANTest_M->NonInlinedSFcns.Sfcn2.dWorkAux;
+ ssSetSFcnDWork(rts, dWorkRecord);
+ ssSetSFcnDWorkAux(rts, dWorkAuxRecord);
+ _ssSetNumDWork(rts, 2);
+
+ /* IWORK */
+ ssSetDWorkWidth(rts, 0, 1);
+ ssSetDWorkDataType(rts, 0,SS_INTEGER);
+ ssSetDWorkComplexSignal(rts, 0, 0);
+ ssSetDWork(rts, 0, &CANTest_DW.CANWrite1_IWORK);
+
+ /* PWORK */
+ ssSetDWorkWidth(rts, 1, 1);
+ ssSetDWorkDataType(rts, 1,SS_POINTER);
+ ssSetDWorkComplexSignal(rts, 1, 0);
+ ssSetDWork(rts, 1, &CANTest_DW.CANWrite1_PWORK);
+ }
+
+ /* registration */
+ sg_IO61X_write_s(rts);
+ sfcnInitializeSizes(rts);
+ sfcnInitializeSampleTimes(rts);
+
+ /* adjust sample time */
+ ssSetSampleTime(rts, 0, 0.002);
+ ssSetOffsetTime(rts, 0, 0.0);
+ sfcnTsMap[0] = 0;
+
+ /* set compiled values of dynamic vector attributes */
+ ssSetNumNonsampledZCs(rts, 0);
+
+ /* Update connectivity flags for each port */
+ _ssSetInputPortConnected(rts, 0, 1);
+
+ /* Update the BufferDstPort flags for each input port */
+ ssSetInputPortBufferDstPort(rts, 0, -1);
+ }
+ }
+
+ /* Initialize Sizes */
+ CANTest_M->Sizes.numContStates = (0);/* Number of continuous states */
+ CANTest_M->Sizes.numY = (0); /* Number of model outputs */
+ CANTest_M->Sizes.numU = (0); /* Number of model inputs */
+ CANTest_M->Sizes.sysDirFeedThru = (0);/* The model is not direct feedthrough */
+ CANTest_M->Sizes.numSampTimes = (1); /* Number of sample times */
+ CANTest_M->Sizes.numBlocks = (39); /* Number of blocks */
+ CANTest_M->Sizes.numBlockIO = (23); /* Number of block outputs */
+ CANTest_M->Sizes.numBlockPrms = (163);/* Sum of parameter "widths" */
+ return CANTest_M;
+}
+
+/*========================================================================*
+ * End of Classic call interface *
+ *========================================================================*/
diff --git a/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest.h b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest.h
new file mode 100644
index 00000000..abd384d1
--- /dev/null
+++ b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest.h
@@ -0,0 +1,1431 @@
+/*
+ * CANTest.h
+ *
+ * Academic License - for use in teaching, academic research, and meeting
+ * course requirements at degree granting institutions only. Not for
+ * government, commercial, or other organizational use.
+ *
+ * Code generation for model "CANTest".
+ *
+ * Model version : 1.360
+ * Simulink Coder version : 8.14 (R2018a) 06-Feb-2018
+ * C source code generated on : Tue Jul 11 11:56:08 2023
+ *
+ * Target selection: slrt.tlc
+ * Note: GRT includes extra infrastructure and instrumentation for prototyping
+ * Embedded hardware selection: Generic->32-bit x86 compatible
+ * Code generation objectives: Unspecified
+ * Validation result: Not run
+ */
+
+#ifndef RTW_HEADER_CANTest_h_
+#define RTW_HEADER_CANTest_h_
+#include
+#include
+#include "rtw_modelmap.h"
+#ifndef CANTest_COMMON_INCLUDES_
+# define CANTest_COMMON_INCLUDES_
+#include
+#include
+#include
+#include "rtwtypes.h"
+#include "zero_crossing_types.h"
+#include "simstruc.h"
+#include "fixedpoint.h"
+#include "rt_logging.h"
+#include "can_message.h"
+#endif /* CANTest_COMMON_INCLUDES_ */
+
+#include "CANTest_types.h"
+
+/* Shared type includes */
+#include "multiword_types.h"
+#include "rt_defines.h"
+#include "rt_nonfinite.h"
+
+/* Macros for accessing real-time model data structure */
+#ifndef rtmGetBlockIO
+# define rtmGetBlockIO(rtm) ((rtm)->blockIO)
+#endif
+
+#ifndef rtmSetBlockIO
+# define rtmSetBlockIO(rtm, val) ((rtm)->blockIO = (val))
+#endif
+
+#ifndef rtmGetChecksums
+# define rtmGetChecksums(rtm) ((rtm)->Sizes.checksums)
+#endif
+
+#ifndef rtmSetChecksums
+# define rtmSetChecksums(rtm, val) ((rtm)->Sizes.checksums = (val))
+#endif
+
+#ifndef rtmGetConstBlockIO
+# define rtmGetConstBlockIO(rtm) ((rtm)->constBlockIO)
+#endif
+
+#ifndef rtmSetConstBlockIO
+# define rtmSetConstBlockIO(rtm, val) ((rtm)->constBlockIO = (val))
+#endif
+
+#ifndef rtmGetContStateDisabled
+# define rtmGetContStateDisabled(rtm) ((rtm)->contStateDisabled)
+#endif
+
+#ifndef rtmSetContStateDisabled
+# define rtmSetContStateDisabled(rtm, val) ((rtm)->contStateDisabled = (val))
+#endif
+
+#ifndef rtmGetContStates
+# define rtmGetContStates(rtm) ((rtm)->contStates)
+#endif
+
+#ifndef rtmSetContStates
+# define rtmSetContStates(rtm, val) ((rtm)->contStates = (val))
+#endif
+
+#ifndef rtmGetContTimeOutputInconsistentWithStateAtMajorStepFlag
+# define rtmGetContTimeOutputInconsistentWithStateAtMajorStepFlag(rtm) ((rtm)->CTOutputIncnstWithState)
+#endif
+
+#ifndef rtmSetContTimeOutputInconsistentWithStateAtMajorStepFlag
+# define rtmSetContTimeOutputInconsistentWithStateAtMajorStepFlag(rtm, val) ((rtm)->CTOutputIncnstWithState = (val))
+#endif
+
+#ifndef rtmGetCtrlRateMdlRefTiming
+# define rtmGetCtrlRateMdlRefTiming(rtm) ()
+#endif
+
+#ifndef rtmSetCtrlRateMdlRefTiming
+# define rtmSetCtrlRateMdlRefTiming(rtm, val) ()
+#endif
+
+#ifndef rtmGetCtrlRateMdlRefTimingPtr
+# define rtmGetCtrlRateMdlRefTimingPtr(rtm) ()
+#endif
+
+#ifndef rtmSetCtrlRateMdlRefTimingPtr
+# define rtmSetCtrlRateMdlRefTimingPtr(rtm, val) ()
+#endif
+
+#ifndef rtmGetCtrlRateNumTicksToNextHit
+# define rtmGetCtrlRateNumTicksToNextHit(rtm) ()
+#endif
+
+#ifndef rtmSetCtrlRateNumTicksToNextHit
+# define rtmSetCtrlRateNumTicksToNextHit(rtm, val) ()
+#endif
+
+#ifndef rtmGetDataMapInfo
+# define rtmGetDataMapInfo(rtm) ((rtm)->DataMapInfo)
+#endif
+
+#ifndef rtmSetDataMapInfo
+# define rtmSetDataMapInfo(rtm, val) ((rtm)->DataMapInfo = (val))
+#endif
+
+#ifndef rtmGetDefaultParam
+# define rtmGetDefaultParam(rtm) ((rtm)->defaultParam)
+#endif
+
+#ifndef rtmSetDefaultParam
+# define rtmSetDefaultParam(rtm, val) ((rtm)->defaultParam = (val))
+#endif
+
+#ifndef rtmGetDerivCacheNeedsReset
+# define rtmGetDerivCacheNeedsReset(rtm) ((rtm)->derivCacheNeedsReset)
+#endif
+
+#ifndef rtmSetDerivCacheNeedsReset
+# define rtmSetDerivCacheNeedsReset(rtm, val) ((rtm)->derivCacheNeedsReset = (val))
+#endif
+
+#ifndef rtmGetDirectFeedThrough
+# define rtmGetDirectFeedThrough(rtm) ((rtm)->Sizes.sysDirFeedThru)
+#endif
+
+#ifndef rtmSetDirectFeedThrough
+# define rtmSetDirectFeedThrough(rtm, val) ((rtm)->Sizes.sysDirFeedThru = (val))
+#endif
+
+#ifndef rtmGetErrorStatusFlag
+# define rtmGetErrorStatusFlag(rtm) ((rtm)->errorStatus)
+#endif
+
+#ifndef rtmSetErrorStatusFlag
+# define rtmSetErrorStatusFlag(rtm, val) ((rtm)->errorStatus = (val))
+#endif
+
+#ifndef rtmGetFinalTime
+# define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal)
+#endif
+
+#ifndef rtmSetFinalTime
+# define rtmSetFinalTime(rtm, val) ((rtm)->Timing.tFinal = (val))
+#endif
+
+#ifndef rtmGetFirstInitCondFlag
+# define rtmGetFirstInitCondFlag(rtm) ()
+#endif
+
+#ifndef rtmSetFirstInitCondFlag
+# define rtmSetFirstInitCondFlag(rtm, val) ()
+#endif
+
+#ifndef rtmGetIntgData
+# define rtmGetIntgData(rtm) ()
+#endif
+
+#ifndef rtmSetIntgData
+# define rtmSetIntgData(rtm, val) ()
+#endif
+
+#ifndef rtmGetMdlRefGlobalTID
+# define rtmGetMdlRefGlobalTID(rtm) ()
+#endif
+
+#ifndef rtmSetMdlRefGlobalTID
+# define rtmSetMdlRefGlobalTID(rtm, val) ()
+#endif
+
+#ifndef rtmGetMdlRefTriggerTID
+# define rtmGetMdlRefTriggerTID(rtm) ()
+#endif
+
+#ifndef rtmSetMdlRefTriggerTID
+# define rtmSetMdlRefTriggerTID(rtm, val) ()
+#endif
+
+#ifndef rtmGetModelMappingInfo
+# define rtmGetModelMappingInfo(rtm) ((rtm)->SpecialInfo.mappingInfo)
+#endif
+
+#ifndef rtmSetModelMappingInfo
+# define rtmSetModelMappingInfo(rtm, val) ((rtm)->SpecialInfo.mappingInfo = (val))
+#endif
+
+#ifndef rtmGetModelName
+# define rtmGetModelName(rtm) ((rtm)->modelName)
+#endif
+
+#ifndef rtmSetModelName
+# define rtmSetModelName(rtm, val) ((rtm)->modelName = (val))
+#endif
+
+#ifndef rtmGetNonInlinedSFcns
+# define rtmGetNonInlinedSFcns(rtm) ((rtm)->NonInlinedSFcns)
+#endif
+
+#ifndef rtmSetNonInlinedSFcns
+# define rtmSetNonInlinedSFcns(rtm, val) ((rtm)->NonInlinedSFcns = (val))
+#endif
+
+#ifndef rtmGetNumBlockIO
+# define rtmGetNumBlockIO(rtm) ((rtm)->Sizes.numBlockIO)
+#endif
+
+#ifndef rtmSetNumBlockIO
+# define rtmSetNumBlockIO(rtm, val) ((rtm)->Sizes.numBlockIO = (val))
+#endif
+
+#ifndef rtmGetNumBlockParams
+# define rtmGetNumBlockParams(rtm) ((rtm)->Sizes.numBlockPrms)
+#endif
+
+#ifndef rtmSetNumBlockParams
+# define rtmSetNumBlockParams(rtm, val) ((rtm)->Sizes.numBlockPrms = (val))
+#endif
+
+#ifndef rtmGetNumBlocks
+# define rtmGetNumBlocks(rtm) ((rtm)->Sizes.numBlocks)
+#endif
+
+#ifndef rtmSetNumBlocks
+# define rtmSetNumBlocks(rtm, val) ((rtm)->Sizes.numBlocks = (val))
+#endif
+
+#ifndef rtmGetNumContStates
+# define rtmGetNumContStates(rtm) ((rtm)->Sizes.numContStates)
+#endif
+
+#ifndef rtmSetNumContStates
+# define rtmSetNumContStates(rtm, val) ((rtm)->Sizes.numContStates = (val))
+#endif
+
+#ifndef rtmGetNumDWork
+# define rtmGetNumDWork(rtm) ((rtm)->Sizes.numDwork)
+#endif
+
+#ifndef rtmSetNumDWork
+# define rtmSetNumDWork(rtm, val) ((rtm)->Sizes.numDwork = (val))
+#endif
+
+#ifndef rtmGetNumInputPorts
+# define rtmGetNumInputPorts(rtm) ((rtm)->Sizes.numIports)
+#endif
+
+#ifndef rtmSetNumInputPorts
+# define rtmSetNumInputPorts(rtm, val) ((rtm)->Sizes.numIports = (val))
+#endif
+
+#ifndef rtmGetNumNonSampledZCs
+# define rtmGetNumNonSampledZCs(rtm) ((rtm)->Sizes.numNonSampZCs)
+#endif
+
+#ifndef rtmSetNumNonSampledZCs
+# define rtmSetNumNonSampledZCs(rtm, val) ((rtm)->Sizes.numNonSampZCs = (val))
+#endif
+
+#ifndef rtmGetNumOutputPorts
+# define rtmGetNumOutputPorts(rtm) ((rtm)->Sizes.numOports)
+#endif
+
+#ifndef rtmSetNumOutputPorts
+# define rtmSetNumOutputPorts(rtm, val) ((rtm)->Sizes.numOports = (val))
+#endif
+
+#ifndef rtmGetNumPeriodicContStates
+# define rtmGetNumPeriodicContStates(rtm) ((rtm)->Sizes.numPeriodicContStates)
+#endif
+
+#ifndef rtmSetNumPeriodicContStates
+# define rtmSetNumPeriodicContStates(rtm, val) ((rtm)->Sizes.numPeriodicContStates = (val))
+#endif
+
+#ifndef rtmGetNumSFcnParams
+# define rtmGetNumSFcnParams(rtm) ((rtm)->Sizes.numSFcnPrms)
+#endif
+
+#ifndef rtmSetNumSFcnParams
+# define rtmSetNumSFcnParams(rtm, val) ((rtm)->Sizes.numSFcnPrms = (val))
+#endif
+
+#ifndef rtmGetNumSFunctions
+# define rtmGetNumSFunctions(rtm) ((rtm)->Sizes.numSFcns)
+#endif
+
+#ifndef rtmSetNumSFunctions
+# define rtmSetNumSFunctions(rtm, val) ((rtm)->Sizes.numSFcns = (val))
+#endif
+
+#ifndef rtmGetNumSampleTimes
+# define rtmGetNumSampleTimes(rtm) ((rtm)->Sizes.numSampTimes)
+#endif
+
+#ifndef rtmSetNumSampleTimes
+# define rtmSetNumSampleTimes(rtm, val) ((rtm)->Sizes.numSampTimes = (val))
+#endif
+
+#ifndef rtmGetNumU
+# define rtmGetNumU(rtm) ((rtm)->Sizes.numU)
+#endif
+
+#ifndef rtmSetNumU
+# define rtmSetNumU(rtm, val) ((rtm)->Sizes.numU = (val))
+#endif
+
+#ifndef rtmGetNumY
+# define rtmGetNumY(rtm) ((rtm)->Sizes.numY)
+#endif
+
+#ifndef rtmSetNumY
+# define rtmSetNumY(rtm, val) ((rtm)->Sizes.numY = (val))
+#endif
+
+#ifndef rtmGetOdeF
+# define rtmGetOdeF(rtm) ()
+#endif
+
+#ifndef rtmSetOdeF
+# define rtmSetOdeF(rtm, val) ()
+#endif
+
+#ifndef rtmGetOdeY
+# define rtmGetOdeY(rtm) ()
+#endif
+
+#ifndef rtmSetOdeY
+# define rtmSetOdeY(rtm, val) ()
+#endif
+
+#ifndef rtmGetOffsetTimeArray
+# define rtmGetOffsetTimeArray(rtm) ((rtm)->Timing.offsetTimesArray)
+#endif
+
+#ifndef rtmSetOffsetTimeArray
+# define rtmSetOffsetTimeArray(rtm, val) ((rtm)->Timing.offsetTimesArray = (val))
+#endif
+
+#ifndef rtmGetOffsetTimePtr
+# define rtmGetOffsetTimePtr(rtm) ((rtm)->Timing.offsetTimes)
+#endif
+
+#ifndef rtmSetOffsetTimePtr
+# define rtmSetOffsetTimePtr(rtm, val) ((rtm)->Timing.offsetTimes = (val))
+#endif
+
+#ifndef rtmGetOptions
+# define rtmGetOptions(rtm) ((rtm)->Sizes.options)
+#endif
+
+#ifndef rtmSetOptions
+# define rtmSetOptions(rtm, val) ((rtm)->Sizes.options = (val))
+#endif
+
+#ifndef rtmGetParamIsMalloced
+# define rtmGetParamIsMalloced(rtm) ()
+#endif
+
+#ifndef rtmSetParamIsMalloced
+# define rtmSetParamIsMalloced(rtm, val) ()
+#endif
+
+#ifndef rtmGetPath
+# define rtmGetPath(rtm) ((rtm)->path)
+#endif
+
+#ifndef rtmSetPath
+# define rtmSetPath(rtm, val) ((rtm)->path = (val))
+#endif
+
+#ifndef rtmGetPerTaskSampleHits
+# define rtmGetPerTaskSampleHits(rtm) ()
+#endif
+
+#ifndef rtmSetPerTaskSampleHits
+# define rtmSetPerTaskSampleHits(rtm, val) ()
+#endif
+
+#ifndef rtmGetPerTaskSampleHitsArray
+# define rtmGetPerTaskSampleHitsArray(rtm) ((rtm)->Timing.perTaskSampleHitsArray)
+#endif
+
+#ifndef rtmSetPerTaskSampleHitsArray
+# define rtmSetPerTaskSampleHitsArray(rtm, val) ((rtm)->Timing.perTaskSampleHitsArray = (val))
+#endif
+
+#ifndef rtmGetPerTaskSampleHitsPtr
+# define rtmGetPerTaskSampleHitsPtr(rtm) ((rtm)->Timing.perTaskSampleHits)
+#endif
+
+#ifndef rtmSetPerTaskSampleHitsPtr
+# define rtmSetPerTaskSampleHitsPtr(rtm, val) ((rtm)->Timing.perTaskSampleHits = (val))
+#endif
+
+#ifndef rtmGetPeriodicContStateIndices
+# define rtmGetPeriodicContStateIndices(rtm) ((rtm)->periodicContStateIndices)
+#endif
+
+#ifndef rtmSetPeriodicContStateIndices
+# define rtmSetPeriodicContStateIndices(rtm, val) ((rtm)->periodicContStateIndices = (val))
+#endif
+
+#ifndef rtmGetPeriodicContStateRanges
+# define rtmGetPeriodicContStateRanges(rtm) ((rtm)->periodicContStateRanges)
+#endif
+
+#ifndef rtmSetPeriodicContStateRanges
+# define rtmSetPeriodicContStateRanges(rtm, val) ((rtm)->periodicContStateRanges = (val))
+#endif
+
+#ifndef rtmGetPrevZCSigState
+# define rtmGetPrevZCSigState(rtm) ((rtm)->prevZCSigState)
+#endif
+
+#ifndef rtmSetPrevZCSigState
+# define rtmSetPrevZCSigState(rtm, val) ((rtm)->prevZCSigState = (val))
+#endif
+
+#ifndef rtmGetRTWExtModeInfo
+# define rtmGetRTWExtModeInfo(rtm) ((rtm)->extModeInfo)
+#endif
+
+#ifndef rtmSetRTWExtModeInfo
+# define rtmSetRTWExtModeInfo(rtm, val) ((rtm)->extModeInfo = (val))
+#endif
+
+#ifndef rtmGetRTWGeneratedSFcn
+# define rtmGetRTWGeneratedSFcn(rtm) ((rtm)->Sizes.rtwGenSfcn)
+#endif
+
+#ifndef rtmSetRTWGeneratedSFcn
+# define rtmSetRTWGeneratedSFcn(rtm, val) ((rtm)->Sizes.rtwGenSfcn = (val))
+#endif
+
+#ifndef rtmGetRTWLogInfo
+# define rtmGetRTWLogInfo(rtm) ((rtm)->rtwLogInfo)
+#endif
+
+#ifndef rtmSetRTWLogInfo
+# define rtmSetRTWLogInfo(rtm, val) ((rtm)->rtwLogInfo = (val))
+#endif
+
+#ifndef rtmGetRTWRTModelMethodsInfo
+# define rtmGetRTWRTModelMethodsInfo(rtm) ()
+#endif
+
+#ifndef rtmSetRTWRTModelMethodsInfo
+# define rtmSetRTWRTModelMethodsInfo(rtm, val) ()
+#endif
+
+#ifndef rtmGetRTWSfcnInfo
+# define rtmGetRTWSfcnInfo(rtm) ((rtm)->sfcnInfo)
+#endif
+
+#ifndef rtmSetRTWSfcnInfo
+# define rtmSetRTWSfcnInfo(rtm, val) ((rtm)->sfcnInfo = (val))
+#endif
+
+#ifndef rtmGetRTWSolverInfo
+# define rtmGetRTWSolverInfo(rtm) ((rtm)->solverInfo)
+#endif
+
+#ifndef rtmSetRTWSolverInfo
+# define rtmSetRTWSolverInfo(rtm, val) ((rtm)->solverInfo = (val))
+#endif
+
+#ifndef rtmGetRTWSolverInfoPtr
+# define rtmGetRTWSolverInfoPtr(rtm) ((rtm)->solverInfoPtr)
+#endif
+
+#ifndef rtmSetRTWSolverInfoPtr
+# define rtmSetRTWSolverInfoPtr(rtm, val) ((rtm)->solverInfoPtr = (val))
+#endif
+
+#ifndef rtmGetReservedForXPC
+# define rtmGetReservedForXPC(rtm) ((rtm)->SpecialInfo.xpcData)
+#endif
+
+#ifndef rtmSetReservedForXPC
+# define rtmSetReservedForXPC(rtm, val) ((rtm)->SpecialInfo.xpcData = (val))
+#endif
+
+#ifndef rtmGetRootDWork
+# define rtmGetRootDWork(rtm) ((rtm)->dwork)
+#endif
+
+#ifndef rtmSetRootDWork
+# define rtmSetRootDWork(rtm, val) ((rtm)->dwork = (val))
+#endif
+
+#ifndef rtmGetSFunctions
+# define rtmGetSFunctions(rtm) ((rtm)->childSfunctions)
+#endif
+
+#ifndef rtmSetSFunctions
+# define rtmSetSFunctions(rtm, val) ((rtm)->childSfunctions = (val))
+#endif
+
+#ifndef rtmGetSampleHitArray
+# define rtmGetSampleHitArray(rtm) ((rtm)->Timing.sampleHitArray)
+#endif
+
+#ifndef rtmSetSampleHitArray
+# define rtmSetSampleHitArray(rtm, val) ((rtm)->Timing.sampleHitArray = (val))
+#endif
+
+#ifndef rtmGetSampleHitPtr
+# define rtmGetSampleHitPtr(rtm) ((rtm)->Timing.sampleHits)
+#endif
+
+#ifndef rtmSetSampleHitPtr
+# define rtmSetSampleHitPtr(rtm, val) ((rtm)->Timing.sampleHits = (val))
+#endif
+
+#ifndef rtmGetSampleTimeArray
+# define rtmGetSampleTimeArray(rtm) ((rtm)->Timing.sampleTimesArray)
+#endif
+
+#ifndef rtmSetSampleTimeArray
+# define rtmSetSampleTimeArray(rtm, val) ((rtm)->Timing.sampleTimesArray = (val))
+#endif
+
+#ifndef rtmGetSampleTimePtr
+# define rtmGetSampleTimePtr(rtm) ((rtm)->Timing.sampleTimes)
+#endif
+
+#ifndef rtmSetSampleTimePtr
+# define rtmSetSampleTimePtr(rtm, val) ((rtm)->Timing.sampleTimes = (val))
+#endif
+
+#ifndef rtmGetSampleTimeTaskIDArray
+# define rtmGetSampleTimeTaskIDArray(rtm) ((rtm)->Timing.sampleTimeTaskIDArray)
+#endif
+
+#ifndef rtmSetSampleTimeTaskIDArray
+# define rtmSetSampleTimeTaskIDArray(rtm, val) ((rtm)->Timing.sampleTimeTaskIDArray = (val))
+#endif
+
+#ifndef rtmGetSampleTimeTaskIDPtr
+# define rtmGetSampleTimeTaskIDPtr(rtm) ((rtm)->Timing.sampleTimeTaskIDPtr)
+#endif
+
+#ifndef rtmSetSampleTimeTaskIDPtr
+# define rtmSetSampleTimeTaskIDPtr(rtm, val) ((rtm)->Timing.sampleTimeTaskIDPtr = (val))
+#endif
+
+#ifndef rtmGetSelf
+# define rtmGetSelf(rtm) ()
+#endif
+
+#ifndef rtmSetSelf
+# define rtmSetSelf(rtm, val) ()
+#endif
+
+#ifndef rtmGetSimMode
+# define rtmGetSimMode(rtm) ((rtm)->simMode)
+#endif
+
+#ifndef rtmSetSimMode
+# define rtmSetSimMode(rtm, val) ((rtm)->simMode = (val))
+#endif
+
+#ifndef rtmGetSimTimeStep
+# define rtmGetSimTimeStep(rtm) ((rtm)->Timing.simTimeStep)
+#endif
+
+#ifndef rtmSetSimTimeStep
+# define rtmSetSimTimeStep(rtm, val) ((rtm)->Timing.simTimeStep = (val))
+#endif
+
+#ifndef rtmGetStartTime
+# define rtmGetStartTime(rtm) ((rtm)->Timing.tStart)
+#endif
+
+#ifndef rtmSetStartTime
+# define rtmSetStartTime(rtm, val) ((rtm)->Timing.tStart = (val))
+#endif
+
+#ifndef rtmGetStepSize
+# define rtmGetStepSize(rtm) ((rtm)->Timing.stepSize)
+#endif
+
+#ifndef rtmSetStepSize
+# define rtmSetStepSize(rtm, val) ((rtm)->Timing.stepSize = (val))
+#endif
+
+#ifndef rtmGetStopRequestedFlag
+# define rtmGetStopRequestedFlag(rtm) ((rtm)->Timing.stopRequestedFlag)
+#endif
+
+#ifndef rtmSetStopRequestedFlag
+# define rtmSetStopRequestedFlag(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
+#endif
+
+#ifndef rtmGetTaskCounters
+# define rtmGetTaskCounters(rtm) ()
+#endif
+
+#ifndef rtmSetTaskCounters
+# define rtmSetTaskCounters(rtm, val) ()
+#endif
+
+#ifndef rtmGetTaskTimeArray
+# define rtmGetTaskTimeArray(rtm) ((rtm)->Timing.tArray)
+#endif
+
+#ifndef rtmSetTaskTimeArray
+# define rtmSetTaskTimeArray(rtm, val) ((rtm)->Timing.tArray = (val))
+#endif
+
+#ifndef rtmGetTimePtr
+# define rtmGetTimePtr(rtm) ((rtm)->Timing.t)
+#endif
+
+#ifndef rtmSetTimePtr
+# define rtmSetTimePtr(rtm, val) ((rtm)->Timing.t = (val))
+#endif
+
+#ifndef rtmGetTimingData
+# define rtmGetTimingData(rtm) ((rtm)->Timing.timingData)
+#endif
+
+#ifndef rtmSetTimingData
+# define rtmSetTimingData(rtm, val) ((rtm)->Timing.timingData = (val))
+#endif
+
+#ifndef rtmGetU
+# define rtmGetU(rtm) ((rtm)->inputs)
+#endif
+
+#ifndef rtmSetU
+# define rtmSetU(rtm, val) ((rtm)->inputs = (val))
+#endif
+
+#ifndef rtmGetVarNextHitTimesListPtr
+# define rtmGetVarNextHitTimesListPtr(rtm) ((rtm)->Timing.varNextHitTimesList)
+#endif
+
+#ifndef rtmSetVarNextHitTimesListPtr
+# define rtmSetVarNextHitTimesListPtr(rtm, val) ((rtm)->Timing.varNextHitTimesList = (val))
+#endif
+
+#ifndef rtmGetY
+# define rtmGetY(rtm) ((rtm)->outputs)
+#endif
+
+#ifndef rtmSetY
+# define rtmSetY(rtm, val) ((rtm)->outputs = (val))
+#endif
+
+#ifndef rtmGetZCCacheNeedsReset
+# define rtmGetZCCacheNeedsReset(rtm) ((rtm)->zCCacheNeedsReset)
+#endif
+
+#ifndef rtmSetZCCacheNeedsReset
+# define rtmSetZCCacheNeedsReset(rtm, val) ((rtm)->zCCacheNeedsReset = (val))
+#endif
+
+#ifndef rtmGetZCSignalValues
+# define rtmGetZCSignalValues(rtm) ((rtm)->zcSignalValues)
+#endif
+
+#ifndef rtmSetZCSignalValues
+# define rtmSetZCSignalValues(rtm, val) ((rtm)->zcSignalValues = (val))
+#endif
+
+#ifndef rtmGet_TimeOfLastOutput
+# define rtmGet_TimeOfLastOutput(rtm) ((rtm)->Timing.timeOfLastOutput)
+#endif
+
+#ifndef rtmSet_TimeOfLastOutput
+# define rtmSet_TimeOfLastOutput(rtm, val) ((rtm)->Timing.timeOfLastOutput = (val))
+#endif
+
+#ifndef rtmGetdX
+# define rtmGetdX(rtm) ((rtm)->derivs)
+#endif
+
+#ifndef rtmSetdX
+# define rtmSetdX(rtm, val) ((rtm)->derivs = (val))
+#endif
+
+#ifndef rtmGettimingBridge
+# define rtmGettimingBridge(rtm) ()
+#endif
+
+#ifndef rtmSettimingBridge
+# define rtmSettimingBridge(rtm, val) ()
+#endif
+
+#ifndef rtmGetChecksumVal
+# define rtmGetChecksumVal(rtm, idx) ((rtm)->Sizes.checksums[idx])
+#endif
+
+#ifndef rtmSetChecksumVal
+# define rtmSetChecksumVal(rtm, idx, val) ((rtm)->Sizes.checksums[idx] = (val))
+#endif
+
+#ifndef rtmGetDWork
+# define rtmGetDWork(rtm, idx) ((rtm)->dwork[idx])
+#endif
+
+#ifndef rtmSetDWork
+# define rtmSetDWork(rtm, idx, val) ((rtm)->dwork[idx] = (val))
+#endif
+
+#ifndef rtmGetOffsetTime
+# define rtmGetOffsetTime(rtm, idx) ((rtm)->Timing.offsetTimes[idx])
+#endif
+
+#ifndef rtmSetOffsetTime
+# define rtmSetOffsetTime(rtm, idx, val) ((rtm)->Timing.offsetTimes[idx] = (val))
+#endif
+
+#ifndef rtmGetSFunction
+# define rtmGetSFunction(rtm, idx) ((rtm)->childSfunctions[idx])
+#endif
+
+#ifndef rtmSetSFunction
+# define rtmSetSFunction(rtm, idx, val) ((rtm)->childSfunctions[idx] = (val))
+#endif
+
+#ifndef rtmGetSampleTime
+# define rtmGetSampleTime(rtm, idx) ((rtm)->Timing.sampleTimes[idx])
+#endif
+
+#ifndef rtmSetSampleTime
+# define rtmSetSampleTime(rtm, idx, val) ((rtm)->Timing.sampleTimes[idx] = (val))
+#endif
+
+#ifndef rtmGetSampleTimeTaskID
+# define rtmGetSampleTimeTaskID(rtm, idx) ((rtm)->Timing.sampleTimeTaskIDPtr[idx])
+#endif
+
+#ifndef rtmSetSampleTimeTaskID
+# define rtmSetSampleTimeTaskID(rtm, idx, val) ((rtm)->Timing.sampleTimeTaskIDPtr[idx] = (val))
+#endif
+
+#ifndef rtmGetVarNextHitTimeList
+# define rtmGetVarNextHitTimeList(rtm, idx) ((rtm)->Timing.varNextHitTimesList[idx])
+#endif
+
+#ifndef rtmSetVarNextHitTimeList
+# define rtmSetVarNextHitTimeList(rtm, idx, val) ((rtm)->Timing.varNextHitTimesList[idx] = (val))
+#endif
+
+#ifndef rtmIsContinuousTask
+# define rtmIsContinuousTask(rtm, tid) 0
+#endif
+
+#ifndef rtmGetErrorStatus
+# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
+#endif
+
+#ifndef rtmSetErrorStatus
+# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
+#endif
+
+#ifndef rtmIsSampleHit
+# define rtmIsSampleHit(rtm, sti, tid) ((rtm)->Timing.sampleHits[(rtm)->Timing.sampleTimeTaskIDPtr[sti]])
+#endif
+
+#ifndef rtmGetStopRequested
+# define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag)
+#endif
+
+#ifndef rtmSetStopRequested
+# define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
+#endif
+
+#ifndef rtmGetStopRequestedPtr
+# define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag))
+#endif
+
+#ifndef rtmGetT
+# define rtmGetT(rtm) (rtmGetTPtr((rtm))[0])
+#endif
+
+#ifndef rtmSetT
+# define rtmSetT(rtm, val) /* Do Nothing */
+#endif
+
+#ifndef rtmGetTFinal
+# define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal)
+#endif
+
+#ifndef rtmSetTFinal
+# define rtmSetTFinal(rtm, val) ((rtm)->Timing.tFinal = (val))
+#endif
+
+#ifndef rtmGetTPtr
+# define rtmGetTPtr(rtm) ((rtm)->Timing.t)
+#endif
+
+#ifndef rtmSetTPtr
+# define rtmSetTPtr(rtm, val) ((rtm)->Timing.t = (val))
+#endif
+
+#ifndef rtmGetTStart
+# define rtmGetTStart(rtm) ((rtm)->Timing.tStart)
+#endif
+
+#ifndef rtmSetTStart
+# define rtmSetTStart(rtm, val) ((rtm)->Timing.tStart = (val))
+#endif
+
+#ifndef rtmGetTaskTime
+# define rtmGetTaskTime(rtm, sti) (rtmGetTPtr((rtm))[(rtm)->Timing.sampleTimeTaskIDPtr[sti]])
+#endif
+
+#ifndef rtmSetTaskTime
+# define rtmSetTaskTime(rtm, sti, val) (rtmGetTPtr((rtm))[sti] = (val))
+#endif
+
+#ifndef rtmGetTimeOfLastOutput
+# define rtmGetTimeOfLastOutput(rtm) ((rtm)->Timing.timeOfLastOutput)
+#endif
+
+#ifdef rtmGetRTWSolverInfo
+#undef rtmGetRTWSolverInfo
+#endif
+
+#define rtmGetRTWSolverInfo(rtm) &((rtm)->solverInfo)
+#define rtModel_CANTest RT_MODEL_CANTest_T
+
+/* Definition for use in the target main file */
+#define CANTest_rtModel RT_MODEL_CANTest_T
+
+/* user code (top of export header file) */
+#include "can_message.h"
+#include "xpcdatatypes.h"
+
+/* Block signals (default storage) */
+typedef struct {
+ CAN_DATATYPE CANPack; /* '/CAN Pack' */
+ CAN_DATATYPE CANRead1_o2; /* '/CAN Read1' */
+ real_T ContMode; /* '/ContM' */
+ real_T Ready; /* '/Constant' */
+ real_T Gear; /* '/Constant1' */
+ real_T BMS; /* '/Constant2' */
+ real_T PosTQLim; /* '/Constant3' */
+ real_T NegTQLim; /* '/Constant4' */
+ real_T d1; /* '/d1' */
+ real_T Sum3; /* '/Sum3' */
+ real_T gain; /* '/gain' */
+ real_T gain2; /* '/gain2' */
+ real_T Product2; /* '/Product2' */
+ real_T gain1; /* '/gain1' */
+ real_T Sum1; /* '/Sum1' */
+ real_T d; /* '/d' */
+ real_T Product11; /* '/Product11' */
+ real_T Sum2; /* '/Sum2' */
+ real_T Sum4; /* '/Sum4' */
+ real_T Product1; /* '/Product1' */
+ real_T RPM; /* '/CAN Unpack2' */
+ real_T TQ; /* '/CAN Unpack2' */
+ boolean_T CANRead1_o1; /* '/CAN Read1' */
+} B_CANTest_T;
+
+/* Block states (default storage) for system '' */
+typedef struct {
+ real_T d1_DSTATE; /* '/d1' */
+ real_T d_DSTATE; /* '/d' */
+ void *CANWrite1_PWORK; /* '/CAN Write1' */
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFor_; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFo_c; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedF_cg; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFo_k; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFo_g; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFo_d; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFo_j; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFo_b; /* synthesized block */
+
+ struct {
+ void *AQHandles;
+ void *SlioLTF;
+ } HiddenToAsyncQueue_InsertedFo_i; /* synthesized block */
+
+ int_T CANPack_ModeSignalID; /* '/CAN Pack' */
+ int_T CANWrite1_IWORK; /* '/CAN Write1' */
+ int_T CANSetup_IWORK; /* '/CAN Setup' */
+ int_T CANRead1_IWORK; /* '/CAN Read1' */
+ int_T CANUnpack2_ModeSignalID; /* '/CAN Unpack2' */
+ int_T CANUnpack2_StatusPortID; /* '/CAN Unpack2' */
+} DW_CANTest_T;
+
+/* Backward compatible GRT Identifiers */
+#define rtB CANTest_B
+#define BlockIO B_CANTest_T
+#define rtP CANTest_P
+#define Parameters P_CANTest_T
+#define rtDWork CANTest_DW
+#define D_Work DW_CANTest_T
+
+/* Parameters (default storage) */
+struct P_CANTest_T_ {
+ real_T Ts; /* Variable: Ts
+ * Referenced by:
+ * '/Constant'
+ * '/gain'
+ */
+ real_T CANSetup_P1_Size[2]; /* Computed Parameter: CANSetup_P1_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P1; /* Expression: id
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P2_Size[2]; /* Computed Parameter: CANSetup_P2_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P2[2]; /* Computed Parameter: CANSetup_P2
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P3_Size[2]; /* Computed Parameter: CANSetup_P3_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P3; /* Expression: PCISlot
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P4_Size[2]; /* Computed Parameter: CANSetup_P4_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P4; /* Expression: port1
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P5_Size[2]; /* Computed Parameter: CANSetup_P5_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P5; /* Expression: port2
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P6_Size[2]; /* Computed Parameter: CANSetup_P6_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P6; /* Expression: opModeCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P7_Size[2]; /* Computed Parameter: CANSetup_P7_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P7[4]; /* Expression: usrBdrCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P8_Size[2]; /* Computed Parameter: CANSetup_P8_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P8[6]; /* Expression: usrBdrFD1
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P9_Size[2]; /* Computed Parameter: CANSetup_P9_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P9[2]; /* Expression: stdAccMaskCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P10_Size[2]; /* Computed Parameter: CANSetup_P10_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P10[2]; /* Expression: extAccMaskCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P11_Size[2]; /* Computed Parameter: CANSetup_P11_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P11; /* Expression: opModeCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P12_Size[2]; /* Computed Parameter: CANSetup_P12_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P12[4]; /* Expression: usrBdrCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P13_Size[2]; /* Computed Parameter: CANSetup_P13_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P13[6]; /* Expression: usrBdrFD2
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P14_Size[2]; /* Computed Parameter: CANSetup_P14_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P14[2]; /* Expression: stdAccMaskCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P15_Size[2]; /* Computed Parameter: CANSetup_P15_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P15[2]; /* Expression: extAccMaskCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P16_Size[2]; /* Computed Parameter: CANSetup_P16_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P16; /* Expression: initStruct
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P17_Size[2]; /* Computed Parameter: CANSetup_P17_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P17; /* Expression: termStruct
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P18_Size[2]; /* Computed Parameter: CANSetup_P18_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P18[5]; /* Computed Parameter: CANSetup_P18
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P19_Size[2]; /* Computed Parameter: CANSetup_P19_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P19; /* Expression: qtyMod
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P20_Size[2]; /* Computed Parameter: CANSetup_P20_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P20[2]; /* Expression: chNo
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P21_Size[2]; /* Computed Parameter: CANSetup_P21_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P21[2]; /* Expression: ptTypes
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P22_Size[2]; /* Computed Parameter: CANSetup_P22_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P22[2]; /* Expression: isProtlFD
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P23_Size[2]; /* Computed Parameter: CANSetup_P23_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P23[2]; /* Expression: protlHelpIdx
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P24_Size[2]; /* Computed Parameter: CANSetup_P24_Size
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANSetup_P24; /* Expression: isFDMod
+ * Referenced by: '/CAN Setup'
+ */
+ real_T CANRead1_P1_Size[2]; /* Computed Parameter: CANRead1_P1_Size
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P1; /* Expression: id
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P2_Size[2]; /* Computed Parameter: CANRead1_P2_Size
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P2; /* Expression: sampleTime
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P3_Size[2]; /* Computed Parameter: CANRead1_P3_Size
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P3; /* Expression: messageType
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P4_Size[2]; /* Computed Parameter: CANRead1_P4_Size
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P4[5]; /* Computed Parameter: CANRead1_P4
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P5_Size[2]; /* Computed Parameter: CANRead1_P5_Size
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P5; /* Expression: ptIdx
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P6_Size[2]; /* Computed Parameter: CANRead1_P6_Size
+ * Referenced by: '/CAN Read1'
+ */
+ real_T CANRead1_P6; /* Expression: isFDMod
+ * Referenced by: '/CAN Read1'
+ */
+ real_T ContMode_Value; /* Expression: 1
+ * Referenced by: '/ContMode'
+ */
+ real_T ContM_Gain; /* Expression: 0
+ * Referenced by: '/ContM'
+ */
+ real_T Constant_Value; /* Expression: 1
+ * Referenced by: '/Constant'
+ */
+ real_T Constant1_Value; /* Expression: 4
+ * Referenced by: '/Constant1'
+ */
+ real_T Constant2_Value; /* Expression: 0
+ * Referenced by: '/Constant2'
+ */
+ real_T Constant3_Value; /* Expression: 10
+ * Referenced by: '/Constant3'
+ */
+ real_T Constant4_Value; /* Expression: -2
+ * Referenced by: '/Constant4'
+ */
+ real_T TQCom_Value; /* Expression: 0
+ * Referenced by: '/TQCom'
+ */
+ real_T d1_InitialCondition; /* Expression: 0
+ * Referenced by: '/d1'
+ */
+ real_T Constant1_Value_a; /* Expression: 1
+ * Referenced by: '/Constant1'
+ */
+ real_T Constant1_Value_j; /* Expression: 5
+ * Referenced by: '/Constant1'
+ */
+ real_T gain2_Gain; /* Expression: 2*pi
+ * Referenced by: '/gain2'
+ */
+ real_T gain1_Gain; /* Expression: 2
+ * Referenced by: '/gain1'
+ */
+ real_T d_InitialCondition; /* Expression: 0
+ * Referenced by: '/d'
+ */
+ real_T CANWrite1_P1_Size[2]; /* Computed Parameter: CANWrite1_P1_Size
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P1; /* Expression: id
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P2_Size[2]; /* Computed Parameter: CANWrite1_P2_Size
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P2; /* Expression: sampleTime
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P3_Size[2]; /* Computed Parameter: CANWrite1_P3_Size
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P3; /* Expression: messageType
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P4_Size[2]; /* Computed Parameter: CANWrite1_P4_Size
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P4; /* Expression: enaStatusPort
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P5_Size[2]; /* Computed Parameter: CANWrite1_P5_Size
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P5[5]; /* Computed Parameter: CANWrite1_P5
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P6_Size[2]; /* Computed Parameter: CANWrite1_P6_Size
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P6; /* Expression: ptIdx
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P7_Size[2]; /* Computed Parameter: CANWrite1_P7_Size
+ * Referenced by: '/CAN Write1'
+ */
+ real_T CANWrite1_P7; /* Expression: isFDMod
+ * Referenced by: '/CAN Write1'
+ */
+};
+
+/* Real-time Model Data Structure */
+struct tag_RTM_CANTest_T {
+ const char_T *path;
+ const char_T *modelName;
+ struct SimStruct_tag * *childSfunctions;
+ const char_T *errorStatus;
+ SS_SimMode simMode;
+ RTWLogInfo *rtwLogInfo;
+ RTWExtModeInfo *extModeInfo;
+ RTWSolverInfo solverInfo;
+ RTWSolverInfo *solverInfoPtr;
+ void *sfcnInfo;
+
+ /*
+ * NonInlinedSFcns:
+ * The following substructure contains information regarding
+ * non-inlined s-functions used in the model.
+ */
+ struct {
+ RTWSfcnInfo sfcnInfo;
+ time_T *taskTimePtrs[1];
+ SimStruct childSFunctions[3];
+ SimStruct *childSFunctionPtrs[3];
+ struct _ssBlkInfo2 blkInfo2[3];
+ struct _ssSFcnModelMethods2 methods2[3];
+ struct _ssSFcnModelMethods3 methods3[3];
+ struct _ssSFcnModelMethods4 methods4[3];
+ struct _ssStatesInfo2 statesInfo2[3];
+ ssPeriodicStatesInfo periodicStatesInfo[3];
+ struct _ssPortInfo2 inputOutputPortInfo2[3];
+ struct {
+ time_T sfcnPeriod[1];
+ time_T sfcnOffset[1];
+ int_T sfcnTsMap[1];
+ uint_T attribs[24];
+ mxArray *params[24];
+ struct _ssDWorkRecord dWork[1];
+ struct _ssDWorkAuxRecord dWorkAux[1];
+ } Sfcn0;
+
+ struct {
+ time_T sfcnPeriod[1];
+ time_T sfcnOffset[1];
+ int_T sfcnTsMap[1];
+ struct _ssPortOutputs outputPortInfo[2];
+ struct _ssOutPortUnit outputPortUnits[2];
+ struct _ssOutPortCoSimAttribute outputPortCoSimAttribute[2];
+ uint_T attribs[6];
+ mxArray *params[6];
+ struct _ssDWorkRecord dWork[1];
+ struct _ssDWorkAuxRecord dWorkAux[1];
+ } Sfcn1;
+
+ struct {
+ time_T sfcnPeriod[1];
+ time_T sfcnOffset[1];
+ int_T sfcnTsMap[1];
+ struct _ssPortInputs inputPortInfo[1];
+ struct _ssInPortUnit inputPortUnits[1];
+ struct _ssInPortCoSimAttribute inputPortCoSimAttribute[1];
+ uint_T attribs[7];
+ mxArray *params[7];
+ struct _ssDWorkRecord dWork[2];
+ struct _ssDWorkAuxRecord dWorkAux[2];
+ } Sfcn2;
+ } NonInlinedSFcns;
+
+ void *blockIO;
+ const void *constBlockIO;
+ void *defaultParam;
+ ZCSigState *prevZCSigState;
+ real_T *contStates;
+ int_T *periodicContStateIndices;
+ real_T *periodicContStateRanges;
+ real_T *derivs;
+ void *zcSignalValues;
+ void *inputs;
+ void *outputs;
+ boolean_T *contStateDisabled;
+ boolean_T zCCacheNeedsReset;
+ boolean_T derivCacheNeedsReset;
+ boolean_T CTOutputIncnstWithState;
+ void *dwork;
+
+ /*
+ * DataMapInfo:
+ * The following substructure contains information regarding
+ * structures generated in the model's C API.
+ */
+ struct {
+ rtwCAPI_ModelMappingInfo mmi;
+ } DataMapInfo;
+
+ /*
+ * Sizes:
+ * The following substructure contains sizes information
+ * for many of the model attributes such as inputs, outputs,
+ * dwork, sample times, etc.
+ */
+ struct {
+ uint32_T checksums[4];
+ uint32_T options;
+ int_T numContStates;
+ int_T numPeriodicContStates;
+ int_T numU;
+ int_T numY;
+ int_T numSampTimes;
+ int_T numBlocks;
+ int_T numBlockIO;
+ int_T numBlockPrms;
+ int_T numDwork;
+ int_T numSFcnPrms;
+ int_T numSFcns;
+ int_T numIports;
+ int_T numOports;
+ int_T numNonSampZCs;
+ int_T sysDirFeedThru;
+ int_T rtwGenSfcn;
+ } Sizes;
+
+ /*
+ * SpecialInfo:
+ * The following substructure contains special information
+ * related to other components that are dependent on RTW.
+ */
+ struct {
+ const void *mappingInfo;
+ void *xpcData;
+ } SpecialInfo;
+
+ /*
+ * Timing:
+ * The following substructure contains information regarding
+ * the timing information for the model.
+ */
+ struct {
+ time_T stepSize;
+ uint32_T clockTick0;
+ uint32_T clockTickH0;
+ time_T stepSize0;
+ time_T tStart;
+ time_T tFinal;
+ time_T timeOfLastOutput;
+ void *timingData;
+ real_T *varNextHitTimesList;
+ SimTimeStep simTimeStep;
+ boolean_T stopRequestedFlag;
+ time_T *sampleTimes;
+ time_T *offsetTimes;
+ int_T *sampleTimeTaskIDPtr;
+ int_T *sampleHits;
+ int_T *perTaskSampleHits;
+ time_T *t;
+ time_T sampleTimesArray[1];
+ time_T offsetTimesArray[1];
+ int_T sampleTimeTaskIDArray[1];
+ int_T sampleHitArray[1];
+ int_T perTaskSampleHitsArray[1];
+ time_T tArray[1];
+ } Timing;
+};
+
+/* Block parameters (default storage) */
+extern P_CANTest_T CANTest_P;
+
+/* Block signals (default storage) */
+extern B_CANTest_T CANTest_B;
+
+/* Block states (default storage) */
+extern DW_CANTest_T CANTest_DW;
+
+/*====================*
+ * External functions *
+ *====================*/
+extern CANTest_rtModel *CANTest(void);
+extern void MdlInitializeSizes(void);
+extern void MdlInitializeSampleTimes(void);
+extern void MdlInitialize(void);
+extern void MdlStart(void);
+extern void MdlOutputs(int_T tid);
+extern void MdlUpdate(int_T tid);
+extern void MdlTerminate(void);
+
+/* Function to get C API Model Mapping Static Info */
+extern const rtwCAPI_ModelMappingStaticInfo*
+ CANTest_GetCAPIStaticMap(void);
+
+/* Real-time Model object */
+extern RT_MODEL_CANTest_T *const CANTest_M;
+
+/*-
+ * The generated code includes comments that allow you to trace directly
+ * back to the appropriate location in the model. The basic format
+ * is /block_name, where system is the system number (uniquely
+ * assigned by Simulink) and block_name is the name of the block.
+ *
+ * Use the MATLAB hilite_system command to trace the generated code back
+ * to the model. For example,
+ *
+ * hilite_system('') - opens system 3
+ * hilite_system('/Kp') - opens and selects block Kp which resides in S3
+ *
+ * Here is the system hierarchy for this model
+ *
+ * '' : 'CANTest'
+ * '' : 'CANTest/DAQ_In'
+ * '' : 'CANTest/DAQ_Out'
+ * '' : 'CANTest/Input Signal Conditioning'
+ * '' : 'CANTest/Mon_Cont'
+ * '' : 'CANTest/DAQ_Out/CANBoard'
+ * '' : 'CANTest/Mon_Cont/LPFM'
+ */
+#endif /* RTW_HEADER_CANTest_h_ */
diff --git a/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi.c b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi.c
new file mode 100644
index 00000000..ee42bcdf
--- /dev/null
+++ b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi.c
@@ -0,0 +1,564 @@
+/*
+ * CANTest_capi.c
+ *
+ * Academic License - for use in teaching, academic research, and meeting
+ * course requirements at degree granting institutions only. Not for
+ * government, commercial, or other organizational use.
+ *
+ * Code generation for model "CANTest".
+ *
+ * Model version : 1.360
+ * Simulink Coder version : 8.14 (R2018a) 06-Feb-2018
+ * C source code generated on : Tue Jul 11 11:56:08 2023
+ *
+ * Target selection: slrt.tlc
+ * Note: GRT includes extra infrastructure and instrumentation for prototyping
+ * Embedded hardware selection: Generic->32-bit x86 compatible
+ * Code generation objectives: Unspecified
+ * Validation result: Not run
+ */
+
+#include "rtw_capi.h"
+#ifdef HOST_CAPI_BUILD
+#include "CANTest_capi_host.h"
+#define sizeof(s) ((size_t)(0xFFFF))
+#undef rt_offsetof
+#define rt_offsetof(s,el) ((uint16_T)(0xFFFF))
+#define TARGET_CONST
+#define TARGET_STRING(s) (s)
+#else /* HOST_CAPI_BUILD */
+#include "builtin_typeid_types.h"
+#include "CANTest.h"
+#include "CANTest_capi.h"
+#include "CANTest_private.h"
+#ifdef LIGHT_WEIGHT_CAPI
+#define TARGET_CONST
+#define TARGET_STRING(s) (NULL)
+#else
+#define TARGET_CONST const
+#define TARGET_STRING(s) (s)
+#endif
+#endif /* HOST_CAPI_BUILD */
+
+/* Block output signal information */
+static const rtwCAPI_Signals rtBlockSignals[] = {
+ /* addrMapIndex, sysNum, blockPath,
+ * signalName, portNumber, dataTypeIndex, dimIndex, fxpIndex, sTimeIndex
+ */
+ { 0, 1, TARGET_STRING("DAQ_In/CAN Read1/p1"),
+ TARGET_STRING(""), 0, 0, 0, 0, 0 },
+
+ { 1, 1, TARGET_STRING("DAQ_In/CAN Read1/p2"),
+ TARGET_STRING(""), 1, 1, 0, 0, 0 },
+
+ { 2, 1, TARGET_STRING("DAQ_In/CAN Unpack2/p1"),
+ TARGET_STRING("RPM"), 0, 2, 0, 0, 0 },
+
+ { 3, 1, TARGET_STRING("DAQ_In/CAN Unpack2/p2"),
+ TARGET_STRING("TQ"), 1, 2, 0, 0, 0 },
+
+ { 4, 0, TARGET_STRING("Mon_Cont/ContM"),
+ TARGET_STRING("ContMode"), 0, 2, 0, 0, 1 },
+
+ { 5, 0, TARGET_STRING("DAQ_Out/CANBoard/Constant"),
+ TARGET_STRING("Ready"), 0, 2, 0, 0, 1 },
+
+ { 6, 0, TARGET_STRING("DAQ_Out/CANBoard/Constant1"),
+ TARGET_STRING("Gear"), 0, 2, 0, 0, 1 },
+
+ { 7, 0, TARGET_STRING("DAQ_Out/CANBoard/Constant2"),
+ TARGET_STRING("BMS"), 0, 2, 0, 0, 1 },
+
+ { 8, 0, TARGET_STRING("DAQ_Out/CANBoard/Constant3"),
+ TARGET_STRING("PosTQLim"), 0, 2, 0, 0, 1 },
+
+ { 9, 0, TARGET_STRING("DAQ_Out/CANBoard/Constant4"),
+ TARGET_STRING("NegTQLim"), 0, 2, 0, 0, 1 },
+
+ { 10, 0, TARGET_STRING("DAQ_Out/CANBoard/CAN Pack"),
+ TARGET_STRING(""), 0, 1, 0, 0, 1 },
+
+ { 11, 0, TARGET_STRING("Mon_Cont/LPFM/gain"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 12, 0, TARGET_STRING("Mon_Cont/LPFM/gain1"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 13, 0, TARGET_STRING("Mon_Cont/LPFM/gain2"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 14, 0, TARGET_STRING("Mon_Cont/LPFM/Product1"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 15, 0, TARGET_STRING("Mon_Cont/LPFM/Product11"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 16, 0, TARGET_STRING("Mon_Cont/LPFM/Product2"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 17, 0, TARGET_STRING("Mon_Cont/LPFM/Sum1"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 18, 0, TARGET_STRING("Mon_Cont/LPFM/Sum2"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 19, 0, TARGET_STRING("Mon_Cont/LPFM/Sum3"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 20, 0, TARGET_STRING("Mon_Cont/LPFM/Sum4"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 21, 0, TARGET_STRING("Mon_Cont/LPFM/d"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ { 22, 0, TARGET_STRING("Mon_Cont/LPFM/d1"),
+ TARGET_STRING(""), 0, 2, 0, 0, 1 },
+
+ {
+ 0, 0, (NULL), (NULL), 0, 0, 0, 0, 0
+ }
+};
+
+static const rtwCAPI_BlockParameters rtBlockParameters[] = {
+ /* addrMapIndex, blockPath,
+ * paramName, dataTypeIndex, dimIndex, fixPtIdx
+ */
+ { 23, TARGET_STRING("DAQ_In/CAN Read1"),
+ TARGET_STRING("P1"), 2, 0, 0 },
+
+ { 24, TARGET_STRING("DAQ_In/CAN Read1"),
+ TARGET_STRING("P2"), 2, 0, 0 },
+
+ { 25, TARGET_STRING("DAQ_In/CAN Read1"),
+ TARGET_STRING("P3"), 2, 0, 0 },
+
+ { 26, TARGET_STRING("DAQ_In/CAN Read1"),
+ TARGET_STRING("P4"), 2, 1, 0 },
+
+ { 27, TARGET_STRING("DAQ_In/CAN Read1"),
+ TARGET_STRING("P5"), 2, 0, 0 },
+
+ { 28, TARGET_STRING("DAQ_In/CAN Read1"),
+ TARGET_STRING("P6"), 2, 0, 0 },
+
+ { 29, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P1"), 2, 0, 0 },
+
+ { 30, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P2"), 2, 2, 0 },
+
+ { 31, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P3"), 2, 0, 0 },
+
+ { 32, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P4"), 2, 0, 0 },
+
+ { 33, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P5"), 2, 0, 0 },
+
+ { 34, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P6"), 2, 0, 0 },
+
+ { 35, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P7"), 2, 3, 0 },
+
+ { 36, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P8"), 2, 4, 0 },
+
+ { 37, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P9"), 2, 2, 0 },
+
+ { 38, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P10"), 2, 2, 0 },
+
+ { 39, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P11"), 2, 0, 0 },
+
+ { 40, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P12"), 2, 3, 0 },
+
+ { 41, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P13"), 2, 4, 0 },
+
+ { 42, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P14"), 2, 2, 0 },
+
+ { 43, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P15"), 2, 2, 0 },
+
+ { 44, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P16"), 2, 0, 0 },
+
+ { 45, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P17"), 2, 0, 0 },
+
+ { 46, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P18"), 2, 1, 0 },
+
+ { 47, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P19"), 2, 0, 0 },
+
+ { 48, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P20"), 2, 2, 0 },
+
+ { 49, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P21"), 2, 2, 0 },
+
+ { 50, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P22"), 2, 2, 0 },
+
+ { 51, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P23"), 2, 2, 0 },
+
+ { 52, TARGET_STRING("DAQ_In/CAN Setup"),
+ TARGET_STRING("P24"), 2, 0, 0 },
+
+ { 53, TARGET_STRING("Mon_Cont/Constant1"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 54, TARGET_STRING("Mon_Cont/ContMode"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 55, TARGET_STRING("Mon_Cont/TQCom"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 56, TARGET_STRING("Mon_Cont/ContM"),
+ TARGET_STRING("Gain"), 2, 0, 0 },
+
+ { 57, TARGET_STRING("DAQ_Out/CANBoard/Constant"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 58, TARGET_STRING("DAQ_Out/CANBoard/Constant1"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 59, TARGET_STRING("DAQ_Out/CANBoard/Constant2"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 60, TARGET_STRING("DAQ_Out/CANBoard/Constant3"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 61, TARGET_STRING("DAQ_Out/CANBoard/Constant4"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 62, TARGET_STRING("DAQ_Out/CANBoard/CAN Write1"),
+ TARGET_STRING("P1"), 2, 0, 0 },
+
+ { 63, TARGET_STRING("DAQ_Out/CANBoard/CAN Write1"),
+ TARGET_STRING("P2"), 2, 0, 0 },
+
+ { 64, TARGET_STRING("DAQ_Out/CANBoard/CAN Write1"),
+ TARGET_STRING("P3"), 2, 0, 0 },
+
+ { 65, TARGET_STRING("DAQ_Out/CANBoard/CAN Write1"),
+ TARGET_STRING("P4"), 2, 0, 0 },
+
+ { 66, TARGET_STRING("DAQ_Out/CANBoard/CAN Write1"),
+ TARGET_STRING("P5"), 2, 1, 0 },
+
+ { 67, TARGET_STRING("DAQ_Out/CANBoard/CAN Write1"),
+ TARGET_STRING("P6"), 2, 0, 0 },
+
+ { 68, TARGET_STRING("DAQ_Out/CANBoard/CAN Write1"),
+ TARGET_STRING("P7"), 2, 0, 0 },
+
+ { 69, TARGET_STRING("Mon_Cont/LPFM/Constant1"),
+ TARGET_STRING("Value"), 2, 0, 0 },
+
+ { 70, TARGET_STRING("Mon_Cont/LPFM/gain1"),
+ TARGET_STRING("Gain"), 2, 0, 0 },
+
+ { 71, TARGET_STRING("Mon_Cont/LPFM/gain2"),
+ TARGET_STRING("Gain"), 2, 0, 0 },
+
+ { 72, TARGET_STRING("Mon_Cont/LPFM/d"),
+ TARGET_STRING("InitialCondition"), 2, 0, 0 },
+
+ { 73, TARGET_STRING("Mon_Cont/LPFM/d1"),
+ TARGET_STRING("InitialCondition"), 2, 0, 0 },
+
+ {
+ 0, (NULL), (NULL), 0, 0, 0
+ }
+};
+
+/* Tunable variable parameters */
+static const rtwCAPI_ModelParameters rtModelParameters[] = {
+ /* addrMapIndex, varName, dataTypeIndex, dimIndex, fixPtIndex */
+ { 74, TARGET_STRING("Ts"), 2, 0, 0 },
+
+ { 0, (NULL), 0, 0, 0 }
+};
+
+#ifndef HOST_CAPI_BUILD
+
+/* Declare Data Addresses statically */
+static void* rtDataAddrMap[] = {
+ &CANTest_B.CANRead1_o1, /* 0: Signal */
+ &CANTest_B.CANRead1_o2, /* 1: Signal */
+ &CANTest_B.RPM, /* 2: Signal */
+ &CANTest_B.TQ, /* 3: Signal */
+ &CANTest_B.ContMode, /* 4: Signal */
+ &CANTest_B.Ready, /* 5: Signal */
+ &CANTest_B.Gear, /* 6: Signal */
+ &CANTest_B.BMS, /* 7: Signal */
+ &CANTest_B.PosTQLim, /* 8: Signal */
+ &CANTest_B.NegTQLim, /* 9: Signal */
+ &CANTest_B.CANPack, /* 10: Signal */
+ &CANTest_B.gain, /* 11: Signal */
+ &CANTest_B.gain1, /* 12: Signal */
+ &CANTest_B.gain2, /* 13: Signal */
+ &CANTest_B.Product1, /* 14: Signal */
+ &CANTest_B.Product11, /* 15: Signal */
+ &CANTest_B.Product2, /* 16: Signal */
+ &CANTest_B.Sum1, /* 17: Signal */
+ &CANTest_B.Sum2, /* 18: Signal */
+ &CANTest_B.Sum3, /* 19: Signal */
+ &CANTest_B.Sum4, /* 20: Signal */
+ &CANTest_B.d, /* 21: Signal */
+ &CANTest_B.d1, /* 22: Signal */
+ &CANTest_P.CANRead1_P1, /* 23: Block Parameter */
+ &CANTest_P.CANRead1_P2, /* 24: Block Parameter */
+ &CANTest_P.CANRead1_P3, /* 25: Block Parameter */
+ &CANTest_P.CANRead1_P4[0], /* 26: Block Parameter */
+ &CANTest_P.CANRead1_P5, /* 27: Block Parameter */
+ &CANTest_P.CANRead1_P6, /* 28: Block Parameter */
+ &CANTest_P.CANSetup_P1, /* 29: Block Parameter */
+ &CANTest_P.CANSetup_P2[0], /* 30: Block Parameter */
+ &CANTest_P.CANSetup_P3, /* 31: Block Parameter */
+ &CANTest_P.CANSetup_P4, /* 32: Block Parameter */
+ &CANTest_P.CANSetup_P5, /* 33: Block Parameter */
+ &CANTest_P.CANSetup_P6, /* 34: Block Parameter */
+ &CANTest_P.CANSetup_P7[0], /* 35: Block Parameter */
+ &CANTest_P.CANSetup_P8[0], /* 36: Block Parameter */
+ &CANTest_P.CANSetup_P9[0], /* 37: Block Parameter */
+ &CANTest_P.CANSetup_P10[0], /* 38: Block Parameter */
+ &CANTest_P.CANSetup_P11, /* 39: Block Parameter */
+ &CANTest_P.CANSetup_P12[0], /* 40: Block Parameter */
+ &CANTest_P.CANSetup_P13[0], /* 41: Block Parameter */
+ &CANTest_P.CANSetup_P14[0], /* 42: Block Parameter */
+ &CANTest_P.CANSetup_P15[0], /* 43: Block Parameter */
+ &CANTest_P.CANSetup_P16, /* 44: Block Parameter */
+ &CANTest_P.CANSetup_P17, /* 45: Block Parameter */
+ &CANTest_P.CANSetup_P18[0], /* 46: Block Parameter */
+ &CANTest_P.CANSetup_P19, /* 47: Block Parameter */
+ &CANTest_P.CANSetup_P20[0], /* 48: Block Parameter */
+ &CANTest_P.CANSetup_P21[0], /* 49: Block Parameter */
+ &CANTest_P.CANSetup_P22[0], /* 50: Block Parameter */
+ &CANTest_P.CANSetup_P23[0], /* 51: Block Parameter */
+ &CANTest_P.CANSetup_P24, /* 52: Block Parameter */
+ &CANTest_P.Constant1_Value_j, /* 53: Block Parameter */
+ &CANTest_P.ContMode_Value, /* 54: Block Parameter */
+ &CANTest_P.TQCom_Value, /* 55: Block Parameter */
+ &CANTest_P.ContM_Gain, /* 56: Block Parameter */
+ &CANTest_P.Constant_Value, /* 57: Block Parameter */
+ &CANTest_P.Constant1_Value, /* 58: Block Parameter */
+ &CANTest_P.Constant2_Value, /* 59: Block Parameter */
+ &CANTest_P.Constant3_Value, /* 60: Block Parameter */
+ &CANTest_P.Constant4_Value, /* 61: Block Parameter */
+ &CANTest_P.CANWrite1_P1, /* 62: Block Parameter */
+ &CANTest_P.CANWrite1_P2, /* 63: Block Parameter */
+ &CANTest_P.CANWrite1_P3, /* 64: Block Parameter */
+ &CANTest_P.CANWrite1_P4, /* 65: Block Parameter */
+ &CANTest_P.CANWrite1_P5[0], /* 66: Block Parameter */
+ &CANTest_P.CANWrite1_P6, /* 67: Block Parameter */
+ &CANTest_P.CANWrite1_P7, /* 68: Block Parameter */
+ &CANTest_P.Constant1_Value_a, /* 69: Block Parameter */
+ &CANTest_P.gain1_Gain, /* 70: Block Parameter */
+ &CANTest_P.gain2_Gain, /* 71: Block Parameter */
+ &CANTest_P.d_InitialCondition, /* 72: Block Parameter */
+ &CANTest_P.d1_InitialCondition, /* 73: Block Parameter */
+ &CANTest_P.Ts, /* 74: Model Parameter */
+};
+
+/* Declare Data Run-Time Dimension Buffer Addresses statically */
+static int32_T* rtVarDimsAddrMap[] = {
+ (NULL)
+};
+
+#endif
+
+/* Data Type Map - use dataTypeMapIndex to access this structure */
+static TARGET_CONST rtwCAPI_DataTypeMap rtDataTypeMap[] = {
+ /* cName, mwName, numElements, elemMapIndex, dataSize, slDataId, *
+ * isComplex, isPointer */
+ { "unsigned char", "boolean_T", 0, 0, sizeof(boolean_T), SS_BOOLEAN, 0, 0 },
+
+ { "numeric", "CAN_DATATYPE", 0, 0, sizeof(CAN_DATATYPE), SS_STRUCT, 0, 0 },
+
+ { "double", "real_T", 0, 0, sizeof(real_T), SS_DOUBLE, 0, 0 }
+};
+
+#ifdef HOST_CAPI_BUILD
+#undef sizeof
+#endif
+
+/* Structure Element Map - use elemMapIndex to access this structure */
+static TARGET_CONST rtwCAPI_ElementMap rtElementMap[] = {
+ /* elementName, elementOffset, dataTypeIndex, dimIndex, fxpIndex */
+ { (NULL), 0, 0, 0, 0 },
+};
+
+/* Dimension Map - use dimensionMapIndex to access elements of ths structure*/
+static const rtwCAPI_DimensionMap rtDimensionMap[] = {
+ /* dataOrientation, dimArrayIndex, numDims, vardimsIndex */
+ { rtwCAPI_SCALAR, 0, 2, 0 },
+
+ { rtwCAPI_VECTOR, 2, 2, 0 },
+
+ { rtwCAPI_VECTOR, 4, 2, 0 },
+
+ { rtwCAPI_VECTOR, 6, 2, 0 },
+
+ { rtwCAPI_VECTOR, 8, 2, 0 }
+};
+
+/* Dimension Array- use dimArrayIndex to access elements of this array */
+static const uint_T rtDimensionArray[] = {
+ 1, /* 0 */
+ 1, /* 1 */
+ 1, /* 2 */
+ 5, /* 3 */
+ 1, /* 4 */
+ 2, /* 5 */
+ 1, /* 6 */
+ 4, /* 7 */
+ 1, /* 8 */
+ 6 /* 9 */
+};
+
+/* C-API stores floating point values in an array. The elements of this *
+ * are unique. This ensures that values which are shared across the model*
+ * are stored in the most efficient way. These values are referenced by *
+ * - rtwCAPI_FixPtMap.fracSlopePtr, *
+ * - rtwCAPI_FixPtMap.biasPtr, *
+ * - rtwCAPI_SampleTimeMap.samplePeriodPtr, *
+ * - rtwCAPI_SampleTimeMap.sampleOffsetPtr */
+static const real_T rtcapiStoredFloats[] = {
+ 0.002, 0.0
+};
+
+/* Fixed Point Map */
+static const rtwCAPI_FixPtMap rtFixPtMap[] = {
+ /* fracSlopePtr, biasPtr, scaleType, wordLength, exponent, isSigned */
+ { (NULL), (NULL), rtwCAPI_FIX_RESERVED, 0, 0, 0 },
+};
+
+/* Sample Time Map - use sTimeIndex to access elements of ths structure */
+static const rtwCAPI_SampleTimeMap rtSampleTimeMap[] = {
+ /* samplePeriodPtr, sampleOffsetPtr, tid, samplingMode */
+ { (NULL), (NULL), -1, 0 },
+
+ { (const void *) &rtcapiStoredFloats[0], (const void *) &rtcapiStoredFloats[1],
+ 0, 0 }
+};
+
+static rtwCAPI_ModelMappingStaticInfo mmiStatic = {
+ /* Signals:{signals, numSignals,
+ * rootInputs, numRootInputs,
+ * rootOutputs, numRootOutputs},
+ * Params: {blockParameters, numBlockParameters,
+ * modelParameters, numModelParameters},
+ * States: {states, numStates},
+ * Maps: {dataTypeMap, dimensionMap, fixPtMap,
+ * elementMap, sampleTimeMap, dimensionArray},
+ * TargetType: targetType
+ */
+ { rtBlockSignals, 23,
+ (NULL), 0,
+ (NULL), 0 },
+
+ { rtBlockParameters, 51,
+ rtModelParameters, 1 },
+
+ { (NULL), 0 },
+
+ { rtDataTypeMap, rtDimensionMap, rtFixPtMap,
+ rtElementMap, rtSampleTimeMap, rtDimensionArray },
+ "float",
+
+ { 1549657953U,
+ 1200499624U,
+ 3365832572U,
+ 428343849U },
+ (NULL), 0,
+ 0
+};
+
+/* Function to get C API Model Mapping Static Info */
+const rtwCAPI_ModelMappingStaticInfo*
+ CANTest_GetCAPIStaticMap(void)
+{
+ return &mmiStatic;
+}
+
+/* Cache pointers into DataMapInfo substructure of RTModel */
+#ifndef HOST_CAPI_BUILD
+
+void CANTest_InitializeDataMapInfo(void)
+{
+ /* Set C-API version */
+ rtwCAPI_SetVersion(CANTest_M->DataMapInfo.mmi, 1);
+
+ /* Cache static C-API data into the Real-time Model Data structure */
+ rtwCAPI_SetStaticMap(CANTest_M->DataMapInfo.mmi, &mmiStatic);
+
+ /* Cache static C-API logging data into the Real-time Model Data structure */
+ rtwCAPI_SetLoggingStaticMap(CANTest_M->DataMapInfo.mmi, (NULL));
+
+ /* Cache C-API Data Addresses into the Real-Time Model Data structure */
+ rtwCAPI_SetDataAddressMap(CANTest_M->DataMapInfo.mmi, rtDataAddrMap);
+
+ /* Cache C-API Data Run-Time Dimension Buffer Addresses into the Real-Time Model Data structure */
+ rtwCAPI_SetVarDimsAddressMap(CANTest_M->DataMapInfo.mmi, rtVarDimsAddrMap);
+
+ /* Cache C-API rtp Address and size into the Real-Time Model Data structure */
+ CANTest_M->DataMapInfo.mmi.InstanceMap.rtpAddress = rtmGetDefaultParam
+ (CANTest_M);
+ CANTest_M->DataMapInfo.mmi.staticMap->rtpSize = sizeof(P_CANTest_T);
+
+ /* Cache the instance C-API logging pointer */
+ rtwCAPI_SetInstanceLoggingInfo(CANTest_M->DataMapInfo.mmi, (NULL));
+
+ /* Set reference to submodels */
+ rtwCAPI_SetChildMMIArray(CANTest_M->DataMapInfo.mmi, (NULL));
+ rtwCAPI_SetChildMMIArrayLen(CANTest_M->DataMapInfo.mmi, 0);
+}
+
+#else /* HOST_CAPI_BUILD */
+#ifdef __cplusplus
+
+extern "C" {
+
+#endif
+
+ void CANTest_host_InitializeDataMapInfo(CANTest_host_DataMapInfo_T *dataMap,
+ const char *path)
+ {
+ /* Set C-API version */
+ rtwCAPI_SetVersion(dataMap->mmi, 1);
+
+ /* Cache static C-API data into the Real-time Model Data structure */
+ rtwCAPI_SetStaticMap(dataMap->mmi, &mmiStatic);
+
+ /* host data address map is NULL */
+ rtwCAPI_SetDataAddressMap(dataMap->mmi, NULL);
+
+ /* host vardims address map is NULL */
+ rtwCAPI_SetVarDimsAddressMap(dataMap->mmi, NULL);
+
+ /* Set Instance specific path */
+ rtwCAPI_SetPath(dataMap->mmi, path);
+ rtwCAPI_SetFullPath(dataMap->mmi, NULL);
+
+ /* Set reference to submodels */
+ rtwCAPI_SetChildMMIArray(dataMap->mmi, (NULL));
+ rtwCAPI_SetChildMMIArrayLen(dataMap->mmi, 0);
+ }
+
+#ifdef __cplusplus
+
+}
+#endif
+#endif /* HOST_CAPI_BUILD */
+
+/* EOF: CANTest_capi.c */
diff --git a/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi.h b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi.h
new file mode 100644
index 00000000..98880ff0
--- /dev/null
+++ b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi.h
@@ -0,0 +1,29 @@
+/*
+ * CANTest_capi.h
+ *
+ * Academic License - for use in teaching, academic research, and meeting
+ * course requirements at degree granting institutions only. Not for
+ * government, commercial, or other organizational use.
+ *
+ * Code generation for model "CANTest".
+ *
+ * Model version : 1.360
+ * Simulink Coder version : 8.14 (R2018a) 06-Feb-2018
+ * C source code generated on : Tue Jul 11 11:56:08 2023
+ *
+ * Target selection: slrt.tlc
+ * Note: GRT includes extra infrastructure and instrumentation for prototyping
+ * Embedded hardware selection: Generic->32-bit x86 compatible
+ * Code generation objectives: Unspecified
+ * Validation result: Not run
+ */
+
+#ifndef RTW_HEADER_CANTest_capi_h
+#define RTW_HEADER_CANTest_capi_h
+#include "CANTest.h"
+
+extern void CANTest_InitializeDataMapInfo(void);
+
+#endif /* RTW_HEADER_CANTest_capi_h */
+
+/* EOF: CANTest_capi.h */
diff --git a/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi_host.h b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi_host.h
new file mode 100644
index 00000000..13c4337f
--- /dev/null
+++ b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_capi_host.h
@@ -0,0 +1,27 @@
+#ifndef RTW_HEADER_CANTest_cap_host_h_
+#define RTW_HEADER_CANTest_cap_host_h_
+#ifdef HOST_CAPI_BUILD
+#include "rtw_capi.h"
+#include "rtw_modelmap.h"
+
+typedef struct {
+ rtwCAPI_ModelMappingInfo mmi;
+} CANTest_host_DataMapInfo_T;
+
+#ifdef __cplusplus
+
+extern "C" {
+
+#endif
+
+ void CANTest_host_InitializeDataMapInfo(CANTest_host_DataMapInfo_T *dataMap,
+ const char *path);
+
+#ifdef __cplusplus
+
+}
+#endif
+#endif /* HOST_CAPI_BUILD */
+#endif /* RTW_HEADER_CANTest_cap_host_h_ */
+
+/* EOF: CANTest_capi_host.h */
diff --git a/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_data.c b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_data.c
new file mode 100644
index 00000000..b38d8da5
--- /dev/null
+++ b/ADM_Cruise_Control/CANTest_slrt_rtw/CANTest_data.c
@@ -0,0 +1,472 @@
+/*
+ * CANTest_data.c
+ *
+ * Academic License - for use in teaching, academic research, and meeting
+ * course requirements at degree granting institutions only. Not for
+ * government, commercial, or other organizational use.
+ *
+ * Code generation for model "CANTest".
+ *
+ * Model version : 1.360
+ * Simulink Coder version : 8.14 (R2018a) 06-Feb-2018
+ * C source code generated on : Tue Jul 11 11:56:08 2023
+ *
+ * Target selection: slrt.tlc
+ * Note: GRT includes extra infrastructure and instrumentation for prototyping
+ * Embedded hardware selection: Generic->32-bit x86 compatible
+ * Code generation objectives: Unspecified
+ * Validation result: Not run
+ */
+
+#include "CANTest.h"
+#include "CANTest_private.h"
+
+/* Block parameters (default storage) */
+P_CANTest_T CANTest_P = {
+ /* Variable: Ts
+ * Referenced by:
+ * '/Constant'
+ * '/gain'
+ */
+ 0.002,
+
+ /* Computed Parameter: CANSetup_P1_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: id
+ * Referenced by: '/CAN Setup'
+ */
+ 1.0,
+
+ /* Computed Parameter: CANSetup_P2_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Computed Parameter: CANSetup_P2
+ * Referenced by: '/CAN Setup'
+ */
+ { 67.0, 58.0 },
+
+ /* Computed Parameter: CANSetup_P3_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: PCISlot
+ * Referenced by: '/CAN Setup'
+ */
+ -1.0,
+
+ /* Computed Parameter: CANSetup_P4_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: port1
+ * Referenced by: '/CAN Setup'
+ */
+ 2.0,
+
+ /* Computed Parameter: CANSetup_P5_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: port2
+ * Referenced by: '/CAN Setup'
+ */
+ 2.0,
+
+ /* Computed Parameter: CANSetup_P6_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: opModeCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ 1.0,
+
+ /* Computed Parameter: CANSetup_P7_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 4.0 },
+
+ /* Expression: usrBdrCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ { 10.0, 1.0, 13.0, 2.0 },
+
+ /* Computed Parameter: CANSetup_P8_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 6.0 },
+
+ /* Expression: usrBdrFD1
+ * Referenced by: '/CAN Setup'
+ */
+ { 2.0, 1.0, 5.0, 2.0, 75.0, 5000.0 },
+
+ /* Computed Parameter: CANSetup_P9_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: stdAccMaskCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ { 0.0, 0.0 },
+
+ /* Computed Parameter: CANSetup_P10_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: extAccMaskCAN1
+ * Referenced by: '/CAN Setup'
+ */
+ { 0.0, 0.0 },
+
+ /* Computed Parameter: CANSetup_P11_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: opModeCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ 1.0,
+
+ /* Computed Parameter: CANSetup_P12_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 4.0 },
+
+ /* Expression: usrBdrCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ { 10.0, 1.0, 13.0, 2.0 },
+
+ /* Computed Parameter: CANSetup_P13_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 6.0 },
+
+ /* Expression: usrBdrFD2
+ * Referenced by: '/CAN Setup'
+ */
+ { 2.0, 1.0, 5.0, 2.0, 75.0, 5000.0 },
+
+ /* Computed Parameter: CANSetup_P14_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: stdAccMaskCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ { 0.0, 0.0 },
+
+ /* Computed Parameter: CANSetup_P15_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: extAccMaskCAN2
+ * Referenced by: '/CAN Setup'
+ */
+ { 0.0, 0.0 },
+
+ /* Computed Parameter: CANSetup_P16_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: initStruct
+ * Referenced by: '/CAN Setup'
+ */
+ 0.0,
+
+ /* Computed Parameter: CANSetup_P17_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: termStruct
+ * Referenced by: '/CAN Setup'
+ */
+ 0.0,
+
+ /* Computed Parameter: CANSetup_P18_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 5.0 },
+
+ /* Computed Parameter: CANSetup_P18
+ * Referenced by: '/CAN Setup'
+ */
+ { 73.0, 79.0, 54.0, 49.0, 51.0 },
+
+ /* Computed Parameter: CANSetup_P19_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: qtyMod
+ * Referenced by: '/CAN Setup'
+ */
+ 1.0,
+
+ /* Computed Parameter: CANSetup_P20_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: chNo
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Computed Parameter: CANSetup_P21_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: ptTypes
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Computed Parameter: CANSetup_P22_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: isProtlFD
+ * Referenced by: '/CAN Setup'
+ */
+ { 0.0, 0.0 },
+
+ /* Computed Parameter: CANSetup_P23_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 2.0 },
+
+ /* Expression: protlHelpIdx
+ * Referenced by: '/CAN Setup'
+ */
+ { 0.0, 1.0 },
+
+ /* Computed Parameter: CANSetup_P24_Size
+ * Referenced by: '/CAN Setup'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: isFDMod
+ * Referenced by: '/CAN Setup'
+ */
+ 1.0,
+
+ /* Computed Parameter: CANRead1_P1_Size
+ * Referenced by: '/CAN Read1'
+ */
+ { 1.0, 1.0 },
+
+ /* Expression: id
+ * Referenced by: '