diff --git a/Control/FOC Control/FOC.slx b/Control/FOC Control/FOC.slx new file mode 100644 index 0000000..e1f8c56 Binary files /dev/null and b/Control/FOC Control/FOC.slx differ diff --git a/Control/PWMGenerator.slx b/Control/PWMGenerator.slx new file mode 100644 index 0000000..3e9b795 Binary files /dev/null and b/Control/PWMGenerator.slx differ diff --git a/Control/PWMGenerator.slxc b/Control/PWMGenerator.slxc new file mode 100644 index 0000000..9510fd7 Binary files /dev/null and b/Control/PWMGenerator.slxc differ diff --git a/Control/VF Control/PWMGenerator.slxc b/Control/VF Control/PWMGenerator.slxc new file mode 100644 index 0000000..3c114d6 Binary files /dev/null and b/Control/VF Control/PWMGenerator.slxc differ diff --git a/Control/VF Control/VFControl.mldatx b/Control/VF Control/VFControl.mldatx new file mode 100644 index 0000000..7239f5d Binary files /dev/null and b/Control/VF Control/VFControl.mldatx differ diff --git a/Control/VF Control/VFControl.slx b/Control/VF Control/VFControl.slx new file mode 100644 index 0000000..d771047 Binary files /dev/null and b/Control/VF Control/VFControl.slx differ diff --git a/Control/VF Control/VFControl.slxc b/Control/VF Control/VFControl.slxc new file mode 100644 index 0000000..08299db Binary files /dev/null and b/Control/VF Control/VFControl.slxc differ diff --git a/Control/VF Control/VFControl_sg_rtw/Options.hpp b/Control/VF Control/VFControl_sg_rtw/Options.hpp new file mode 100644 index 0000000..9dde3cc --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/Options.hpp @@ -0,0 +1,13 @@ +#ifndef __OPTIONS_H___ +#define __OPTIONS_H___ + +#include "simstruc_types.h" +#ifndef MT +#define MT 0 /* MT may be undefined by simstruc_types.h */ +#endif + +#include "VFControl.h" + +#define FULLMULTITHREAD 1 + +#endif // __OPTIONS_H___ diff --git a/Control/VF Control/VFControl_sg_rtw/VFControl b/Control/VF Control/VFControl_sg_rtw/VFControl new file mode 100644 index 0000000..69aa619 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/VFControl differ diff --git a/Control/VF Control/VFControl_sg_rtw/VFControl.cpp b/Control/VF Control/VFControl_sg_rtw/VFControl.cpp new file mode 100644 index 0000000..499b406 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/VFControl.cpp @@ -0,0 +1,3943 @@ +/* + * VFControl.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:33:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#include "VFControl.h" +#include "VFControl_cal.h" +#include "rtwtypes.h" +#include +#include +#include "rt_hypotd_snf.h" +#include "rt_invd4x4_snf.h" +#include "rt_look.h" +#include "rt_look1d.h" +#include "rt_remd_snf.h" +#include "rt_modd_snf.h" +#include "VFControl_private.h" +#include "rt_TDelayInterpolate.h" +#include "look1_pbinlxpw.h" +#include "PWMGenerator.h" + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +/* Block signals (default storage) */ +B_VFControl_T VFControl_B; + +/* Block states (default storage) */ +DW_VFControl_T VFControl_DW; + +/* Real-time model */ +RT_MODEL_VFControl_T VFControl_M_ = RT_MODEL_VFControl_T(); +RT_MODEL_VFControl_T *const VFControl_M = &VFControl_M_; + +/* Model step function for TID0 */ +void VFControl_step0(void) /* Sample time: [0.0s, 0.0s] */ +{ + real_T tmp[16]; + real_T tmp_0[16]; + real_T Bias; + real_T RLinv_m; + real_T tmp_1; + real_T tmp_2; + real_T xk1; + int32_T i; + int32_T i_0; + int32_T tmp_3; + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.Saturation_SubsysRanBC); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.Rotorreferenceframe_SubsysRan_i); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.Stationaryreferenceframe_Subs_n); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.Synchronousreferenceframe_Sub_k); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.Rotorreferenceframe_SubsysRanBC); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.Stationaryreferenceframe_Subsys); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.Synchronousreferenceframe_Subsy); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.sinbetacosbetasinthcosth_Subsys); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.sinthrcosthr_SubsysRanBC); + + /* Reset subsysRan breadcrumbs */ + srClearBC(VFControl_DW.sinthrcosthr1_SubsysRanBC); + + /* UnitDelay: '/fluxes' */ + xk1 = VFControl_DW.fluxes_DSTATE[0]; + VFControl_B.xk1[0] = xk1; + + /* Gain: '/Gain' */ + xk1 *= VFControl_cal->Gain_Gain; + VFControl_B.Gain[0] = xk1; + + /* UnitDelay: '/fluxes' */ + Bias = VFControl_DW.fluxes_DSTATE_l[0]; + VFControl_B.fluxes[0] = Bias; + + /* Sum: '/Sum2' */ + VFControl_B.Sum2[0] = xk1 - Bias; + + /* UnitDelay: '/fluxes' */ + xk1 = VFControl_DW.fluxes_DSTATE[1]; + VFControl_B.xk1[1] = xk1; + + /* Gain: '/Gain' */ + xk1 *= VFControl_cal->Gain_Gain; + VFControl_B.Gain[1] = xk1; + + /* UnitDelay: '/fluxes' */ + Bias = VFControl_DW.fluxes_DSTATE_l[1]; + VFControl_B.fluxes[1] = Bias; + + /* Sum: '/Sum2' */ + VFControl_B.Sum2[1] = xk1 - Bias; + + /* UnitDelay: '/fluxes' */ + xk1 = VFControl_DW.fluxes_DSTATE[2]; + VFControl_B.xk1[2] = xk1; + + /* Gain: '/Gain' */ + xk1 *= VFControl_cal->Gain_Gain; + VFControl_B.Gain[2] = xk1; + + /* UnitDelay: '/fluxes' */ + Bias = VFControl_DW.fluxes_DSTATE_l[2]; + VFControl_B.fluxes[2] = Bias; + + /* Sum: '/Sum2' */ + VFControl_B.Sum2[2] = xk1 - Bias; + + /* UnitDelay: '/fluxes' */ + xk1 = VFControl_DW.fluxes_DSTATE[3]; + VFControl_B.xk1[3] = xk1; + + /* Gain: '/Gain' */ + xk1 *= VFControl_cal->Gain_Gain; + VFControl_B.Gain[3] = xk1; + + /* UnitDelay: '/fluxes' */ + Bias = VFControl_DW.fluxes_DSTATE_l[3]; + VFControl_B.fluxes[3] = Bias; + + /* Sum: '/Sum2' */ + VFControl_B.Sum2[3] = xk1 - Bias; + + /* Outputs for Enabled SubSystem: '/Saturation' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant' */ + if (VFControl_cal->Constant_Value_e > 0.0) { + /* UnitDelay: '/Delay' */ + VFControl_B.Delay = VFControl_DW.Delay_DSTATE; + + /* SignalConversion generated from: '/Math Function' incorporates: + * Constant: '/u2' + * + * About SignalConversion generated from '/Math Function': + * Operator: reciprocal + */ + VFControl_B.TmpSignalConversionAtMathFuncti[0] = VFControl_cal->u2_Value[0]; + VFControl_B.TmpSignalConversionAtMathFuncti[1] = VFControl_cal->u2_Value[1]; + VFControl_B.TmpSignalConversionAtMathFuncti[2] = VFControl_B.Delay; + + /* Math: '/Math Function' + * + * About '/Math Function': + * Operator: reciprocal + */ + xk1 = VFControl_B.TmpSignalConversionAtMathFuncti[0]; + xk1 = 1.0 / xk1; + + /* Math: '/Math Function' + * + * About '/Math Function': + * Operator: reciprocal + */ + VFControl_B.MathFunction_p[0] = xk1; + + /* Math: '/Math Function' + * + * About '/Math Function': + * Operator: reciprocal + */ + xk1 = VFControl_B.TmpSignalConversionAtMathFuncti[1]; + xk1 = 1.0 / xk1; + + /* Math: '/Math Function' + * + * About '/Math Function': + * Operator: reciprocal + */ + VFControl_B.MathFunction_p[1] = xk1; + + /* Math: '/Math Function' + * + * About '/Math Function': + * Operator: reciprocal + */ + xk1 = VFControl_B.TmpSignalConversionAtMathFuncti[2]; + xk1 = 1.0 / xk1; + + /* Math: '/Math Function' + * + * About '/Math Function': + * Operator: reciprocal + */ + VFControl_B.MathFunction_p[2] = xk1; + + /* Sum: '/Sum2' */ + xk1 = VFControl_B.MathFunction_p[0]; + xk1 += VFControl_B.MathFunction_p[1]; + xk1 += VFControl_B.MathFunction_p[2]; + + /* Sum: '/Sum2' */ + VFControl_B.Sum2_i = xk1; + + /* Math: '/Math Function1' + * + * About '/Math Function1': + * Operator: reciprocal + */ + xk1 = VFControl_B.Sum2_i; + + /* Math: '/Math Function1' + * + * About '/Math Function1': + * Operator: reciprocal + */ + VFControl_B.MathFunction1 = 1.0 / xk1; + + /* Product: '/Product2' incorporates: + * Constant: '/u1' + */ + VFControl_B.Product2_m[0] = VFControl_cal->u1_Value[0] * + VFControl_B.MathFunction1; + VFControl_B.Product2_m[1] = VFControl_cal->u1_Value[1] * + VFControl_B.MathFunction1; + + /* Product: '/Product' */ + VFControl_B.Product_c[0] = VFControl_B.Sum2[0] * VFControl_B.Product2_m[0]; + VFControl_B.Product_c[1] = VFControl_B.Product2_m[1] * VFControl_B.Sum2[2]; + + /* Sum: '/Sum2' */ + xk1 = VFControl_B.Product_c[0]; + xk1 += VFControl_B.Product_c[1]; + + /* Sum: '/Sum2' */ + VFControl_B.phimq = xk1; + + /* Product: '/Product1' */ + VFControl_B.Product1_j[0] = VFControl_B.Product2_m[0] * VFControl_B.Sum2[1]; + VFControl_B.Product1_j[1] = VFControl_B.Product2_m[1] * VFControl_B.Sum2[3]; + + /* Sum: '/Sum1' */ + xk1 = VFControl_B.Product1_j[0]; + xk1 += VFControl_B.Product1_j[1]; + + /* Sum: '/Sum1' */ + VFControl_B.phimd = xk1; + + /* Math: '/Math Function' */ + VFControl_B.Phisat = rt_hypotd_snf(VFControl_B.phimq, VFControl_B.phimd); + + /* Lookup_n-D: '/1-D Lookup Table' incorporates: + * Math: '/Math Function' + */ + VFControl_B.Isat = look1_pbinlxpw(VFControl_B.Phisat, + VFControl_cal->uDLookupTable_bp01Data, + VFControl_cal->uDLookupTable_tableData, &VFControl_DW.m_bpIndex_b, 1U); + + /* Switch: '/Switch' */ + if (VFControl_B.Isat != 0.0) { + /* Product: '/Product' */ + VFControl_B.Lm = VFControl_B.Phisat / VFControl_B.Isat; + + /* Switch: '/Switch' */ + VFControl_B.Switch_g = VFControl_B.Lm; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/Constant1' + */ + VFControl_B.Switch_g = VFControl_cal->Constant1_Value; + } + + /* End of Switch: '/Switch' */ + + /* Assignment: '/Lm in rows[1,3] & col[1,3]' incorporates: + * Constant: '/u1' + */ + std::memcpy(&VFControl_B.Lminrows13col13[0], &VFControl_cal->u1_Value_d[0], + sizeof(real_T) << 4U); + + /* Assignment: '/Lm in rows[1,3] & col[1,3]' */ + VFControl_B.Lminrows13col13[0] = VFControl_B.Switch_g; + VFControl_B.Lminrows13col13[2] = VFControl_B.Switch_g; + VFControl_B.Lminrows13col13[8] = VFControl_B.Switch_g; + VFControl_B.Lminrows13col13[10] = VFControl_B.Switch_g; + + /* Assignment: '/Lm in rows[2,4] & col[2,4]' incorporates: + * Assignment: '/Lm in rows[1,3] & col[1,3]' + */ + std::memcpy(&VFControl_B.Lminrows24col24[0], &VFControl_B.Lminrows13col13[0], + sizeof(real_T) << 4U); + + /* Assignment: '/Lm in rows[2,4] & col[2,4]' */ + VFControl_B.Lminrows24col24[5] = VFControl_B.Switch_g; + VFControl_B.Lminrows24col24[7] = VFControl_B.Switch_g; + VFControl_B.Lminrows24col24[13] = VFControl_B.Switch_g; + VFControl_B.Lminrows24col24[15] = VFControl_B.Switch_g; + for (i = 0; i < 16; i++) { + /* Sum: '/Sum2' incorporates: + * Assignment: '/Lm in rows[2,4] & col[2,4]' + * Constant: '/u5' + */ + VFControl_B.Sum2_e[i] = VFControl_B.Lminrows24col24[i] + + VFControl_cal->u5_Value[i]; + } + + /* Product: '/inversion' incorporates: + * Sum: '/Sum2' + */ + rt_invd4x4_snf(VFControl_B.Sum2_e, VFControl_B.Linv_h); + + /* Product: '/Product1' incorporates: + * Constant: '/u1' + * Product: '/inversion' + */ + std::memcpy(&tmp[0], &VFControl_cal->u1_Value_e[0], sizeof(real_T) << 4U); + std::memcpy(&tmp_0[0], &VFControl_B.Linv_h[0], sizeof(real_T) << 4U); + for (i = 0; i < 4; i++) { + /* Product: '/Product1' */ + tmp_3 = i << 2; + xk1 = tmp_0[tmp_3]; + Bias = tmp_0[tmp_3 + 1]; + tmp_1 = tmp_0[tmp_3 + 2]; + tmp_2 = tmp_0[tmp_3 + 3]; + for (i_0 = 0; i_0 < 4; i_0++) { + /* Product: '/Product1' */ + RLinv_m = xk1 * tmp[i_0]; + RLinv_m += tmp[i_0 + 4] * Bias; + RLinv_m += tmp[i_0 + 8] * tmp_1; + RLinv_m += tmp[i_0 + 12] * tmp_2; + + /* Product: '/Product1' */ + VFControl_B.RLinv_m[i_0 + tmp_3] = RLinv_m; + } + } + + /* Update for UnitDelay: '/Delay' */ + VFControl_DW.Delay_DSTATE = VFControl_B.Switch_g; + srUpdateBC(VFControl_DW.Saturation_SubsysRanBC); + } + + /* End of Constant: '/Constant' */ + /* End of Outputs for SubSystem: '/Saturation' */ + for (i = 0; i < 16; i++) { + /* Switch: '/Switch' incorporates: + * Constant: '/Constant1' + */ + if (VFControl_cal->Constant1_Value_k >= VFControl_cal->Switch_Threshold) { + /* Switch: '/Switch' incorporates: + * Product: '/inversion' + */ + xk1 = VFControl_B.Linv_h[i]; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/Constant2' + */ + xk1 = VFControl_cal->Constant2_Value[i]; + } + + /* End of Switch: '/Switch' */ + + /* Switch: '/Switch' */ + VFControl_B.Linv[i] = xk1; + + /* Product: '/Product3' incorporates: + * Switch: '/Switch' + */ + tmp[i] = xk1; + } + + /* Product: '/Product3' */ + Bias = VFControl_B.xk1[0]; + tmp_1 = VFControl_B.xk1[1]; + tmp_2 = VFControl_B.xk1[2]; + RLinv_m = VFControl_B.xk1[3]; + for (i = 0; i < 4; i++) { + xk1 = tmp[i] * Bias; + xk1 += tmp[i + 4] * tmp_1; + xk1 += tmp[i + 8] * tmp_2; + xk1 += tmp[i + 12] * RLinv_m; + + /* Product: '/Product3' */ + VFControl_B.Product3[i] = xk1; + } + + /* DiscreteIntegrator: '/Rotor angle thetam' */ + VFControl_B.Rotoranglethetam = VFControl_DW.Rotoranglethetam_DSTATE; + + /* UnitDelay: '/wm_delay' */ + VFControl_B.wm_delay = VFControl_DW.wm_delay_DSTATE; + + /* Gain: '/F2' */ + VFControl_B.F2 = VFControl_cal->F2_Gain * VFControl_B.wm_delay; + + /* UnitDelay: '/wm_predict' */ + VFControl_B.wm_predict = VFControl_DW.wm_predict_DSTATE; + + /* Sum: '/Sum1' */ + VFControl_B.Sum1 = VFControl_B.F2 - VFControl_B.wm_predict; + + /* Outputs for Enabled SubSystem: '/sin(thr),cos(thr)' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant' */ + if (VFControl_cal->Constant_Value_b) { + VFControl_DW.sinthrcosthr_MODE = true; + + /* Constant: '/Constant' */ + VFControl_B.Constant_e[0] = VFControl_cal->Constant_Value[0]; + VFControl_B.Constant_e[1] = VFControl_cal->Constant_Value[1]; + + /* Gain: '/Gain1' */ + VFControl_B.Gain1_e = VFControl_cal->Gain1_Gain * VFControl_B.Sum1; + + /* Trigonometry: '/Trigonometric Function' */ + xk1 = VFControl_B.Rotoranglethetam; + Bias = std::sin(xk1); + xk1 = std::cos(xk1); + + /* Trigonometry: '/Trigonometric Function' */ + VFControl_B.TrigonometricFunction_o1_d = Bias; + + /* Trigonometry: '/Trigonometric Function' */ + VFControl_B.TrigonometricFunction_o2_j = xk1; + + /* Assignment: '/W(1,2)=wr' incorporates: + * Constant: '/u1' + */ + std::memcpy(&VFControl_B.W12wr[0], &VFControl_cal->u1_Value_j[0], sizeof + (real_T) << 4U); + + /* Assignment: '/W(1,2)=wr' */ + VFControl_B.W12wr[4] = VFControl_B.Sum1; + + /* Assignment: '/W(2,1)=-wr' incorporates: + * Assignment: '/W(1,2)=wr' + */ + std::memcpy(&VFControl_B.W21wr[0], &VFControl_B.W12wr[0], sizeof(real_T) << + 4U); + + /* Assignment: '/W(2,1)=-wr' */ + VFControl_B.W21wr[1] = VFControl_B.Gain1_e; + srUpdateBC(VFControl_DW.sinthrcosthr_SubsysRanBC); + } else if (VFControl_DW.sinthrcosthr_MODE) { + /* Disable for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o1_d = VFControl_cal->sinthrcosthr_Y0; + + /* Disable for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o2_j = VFControl_cal->sinthrcosthr_Y0; + + /* Disable for Outport: '/sin(thr),cos(thr)' incorporates: + * Constant: '/Constant' + */ + VFControl_B.Constant_e[0] = VFControl_cal->sinthrcosthr_Y0; + VFControl_B.Constant_e[1] = VFControl_cal->sinthrcosthr_Y0; + for (i = 0; i < 16; i++) { + /* Disable for Assignment: '/W(2,1)=-wr' incorporates: + * Outport: '/W' + */ + VFControl_B.W21wr[i] = VFControl_cal->W_Y0_m; + } + + VFControl_DW.sinthrcosthr_MODE = false; + } + + /* End of Constant: '/Constant' */ + /* End of Outputs for SubSystem: '/sin(thr),cos(thr)' */ + + /* Outputs for Enabled SubSystem: '/sin(thr),cos(thr)1' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant1' */ + if (VFControl_cal->Constant1_Value_kj) { + VFControl_DW.sinthrcosthr1_MODE = true; + + /* Constant: '/Constant' */ + VFControl_B.Constant[0] = VFControl_cal->Constant_Value_n[0]; + VFControl_B.Constant[1] = VFControl_cal->Constant_Value_n[1]; + + /* Gain: '/Gain3' */ + VFControl_B.Gain3_e = VFControl_cal->Gain3_Gain * VFControl_B.Sum1; + + /* Trigonometry: '/Trigonometric Function' */ + xk1 = VFControl_B.Rotoranglethetam; + Bias = std::sin(xk1); + xk1 = std::cos(xk1); + + /* Trigonometry: '/Trigonometric Function' */ + VFControl_B.TrigonometricFunction_o1 = Bias; + + /* Trigonometry: '/Trigonometric Function' */ + VFControl_B.TrigonometricFunction_o2 = xk1; + + /* Assignment: '/W(3,4)=-wr' incorporates: + * Constant: '/u4' + */ + std::memcpy(&VFControl_B.W34wr[0], &VFControl_cal->u4_Value[0], sizeof + (real_T) << 4U); + + /* Assignment: '/W(3,4)=-wr' */ + VFControl_B.W34wr[14] = VFControl_B.Gain3_e; + + /* Assignment: '/W(4,3)=wr' incorporates: + * Assignment: '/W(3,4)=-wr' + */ + std::memcpy(&VFControl_B.W43wr[0], &VFControl_B.W34wr[0], sizeof(real_T) << + 4U); + + /* Assignment: '/W(4,3)=wr' */ + VFControl_B.W43wr[11] = VFControl_B.Sum1; + srUpdateBC(VFControl_DW.sinthrcosthr1_SubsysRanBC); + } else if (VFControl_DW.sinthrcosthr1_MODE) { + /* Disable for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o1 = VFControl_cal->sinthrcosthr_Y0_h; + + /* Disable for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o2 = VFControl_cal->sinthrcosthr_Y0_h; + + /* Disable for Outport: '/sin(thr),cos(thr)' incorporates: + * Constant: '/Constant' + */ + VFControl_B.Constant[0] = VFControl_cal->sinthrcosthr_Y0_h; + VFControl_B.Constant[1] = VFControl_cal->sinthrcosthr_Y0_h; + VFControl_DW.sinthrcosthr1_MODE = false; + } + + /* End of Constant: '/Constant1' */ + /* End of Outputs for SubSystem: '/sin(thr),cos(thr)1' */ + + /* Outputs for Enabled SubSystem: '/sin(beta),cos(beta),sin(th),cos(th)' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant3' */ + if (VFControl_cal->Constant3_Value_h) { + /* DigitalClock: '/Digital Clock' */ + VFControl_B.DigitalClock_kx = VFControl_M->Timing.t[1]; + + /* Sum: '/Sum' incorporates: + * Constant: '/we' + */ + VFControl_B.wewr = VFControl_cal->we_Value - VFControl_B.Sum1; + + /* Gain: '/Gain2' */ + VFControl_B.Gain2_k = VFControl_cal->Gain2_Gain * VFControl_B.wewr; + + /* Gain: '/web_psb' */ + VFControl_B.th = VFControl_cal->web_psb_Gain * VFControl_B.DigitalClock_kx; + + /* Sum: '/Sum1' */ + VFControl_B.beta = VFControl_B.th - VFControl_B.Rotoranglethetam; + + /* Trigonometry: '/Trigonometric Function' */ + xk1 = VFControl_B.th; + Bias = std::sin(xk1); + xk1 = std::cos(xk1); + + /* Trigonometry: '/Trigonometric Function' */ + VFControl_B.TrigonometricFunction_o1_dn = Bias; + + /* Trigonometry: '/Trigonometric Function' */ + VFControl_B.TrigonometricFunction_o2_k = xk1; + + /* Trigonometry: '/Trigonometric Function1' */ + xk1 = VFControl_B.beta; + Bias = std::sin(xk1); + xk1 = std::cos(xk1); + + /* Trigonometry: '/Trigonometric Function1' */ + VFControl_B.TrigonometricFunction1_o1 = Bias; + + /* Trigonometry: '/Trigonometric Function1' */ + VFControl_B.TrigonometricFunction1_o2 = xk1; + + /* Assignment: '/W(3,4)=1-wr' incorporates: + * Constant: '/u3' + */ + std::memcpy(&VFControl_B.W341wr[0], &VFControl_cal->u3_Value[0], sizeof + (real_T) << 4U); + + /* Assignment: '/W(3,4)=1-wr' */ + VFControl_B.W341wr[14] = VFControl_B.wewr; + + /* Assignment: '/W(4,3)=wr-1' incorporates: + * Assignment: '/W(3,4)=1-wr' + */ + std::memcpy(&VFControl_B.W43wr1[0], &VFControl_B.W341wr[0], sizeof(real_T) << + 4U); + + /* Assignment: '/W(4,3)=wr-1' */ + VFControl_B.W43wr1[11] = VFControl_B.Gain2_k; + srUpdateBC(VFControl_DW.sinbetacosbetasinthcosth_Subsys); + } + + /* End of Constant: '/Constant3' */ + /* End of Outputs for SubSystem: '/sin(beta),cos(beta),sin(th),cos(th)' */ + + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Constant2' + */ + switch (static_cast(VFControl_cal->Constant2_Value_n)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch[0] = VFControl_B.TrigonometricFunction_o1_d; + VFControl_B.MultiportSwitch[1] = VFControl_B.TrigonometricFunction_o2_j; + VFControl_B.MultiportSwitch[2] = VFControl_B.Constant_e[0]; + VFControl_B.MultiportSwitch[3] = VFControl_B.Constant_e[1]; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch[0] = VFControl_B.TrigonometricFunction_o1; + VFControl_B.MultiportSwitch[1] = VFControl_B.TrigonometricFunction_o2; + VFControl_B.MultiportSwitch[2] = VFControl_B.Constant[0]; + VFControl_B.MultiportSwitch[3] = VFControl_B.Constant[1]; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch[0] = VFControl_B.TrigonometricFunction1_o1; + VFControl_B.MultiportSwitch[1] = VFControl_B.TrigonometricFunction1_o2; + VFControl_B.MultiportSwitch[2] = VFControl_B.TrigonometricFunction_o1_dn; + VFControl_B.MultiportSwitch[3] = VFControl_B.TrigonometricFunction_o2_k; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch' */ + + /* Outputs for Enabled SubSystem: '/Rotor reference frame' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant' */ + if (VFControl_cal->Constant_Value_px) { + VFControl_DW.Rotorreferenceframe_MODE = true; + + /* Fcn: '/ira' */ + VFControl_B.ira_p = VFControl_B.Product3[2]; + + /* Fcn: '/irb' */ + VFControl_B.irb_n = -(1.7320508075688772 * VFControl_B.Product3[3] + + VFControl_B.Product3[2]) / 2.0; + + /* Fcn: '/isa' */ + VFControl_B.isa_m = VFControl_B.Product3[0] * VFControl_B.MultiportSwitch[1] + + VFControl_B.MultiportSwitch[0] * VFControl_B.Product3[1]; + + /* Fcn: '/isb' */ + VFControl_B.isb_p = ((1.7320508075688772 * VFControl_B.MultiportSwitch[0] - + VFControl_B.MultiportSwitch[1]) * + VFControl_B.Product3[0] + (-1.7320508075688772 * + VFControl_B.MultiportSwitch[1] - VFControl_B.MultiportSwitch[0]) * + VFControl_B.Product3[1]) / 2.0; + srUpdateBC(VFControl_DW.Rotorreferenceframe_SubsysRanBC); + } else if (VFControl_DW.Rotorreferenceframe_MODE) { + /* Disable for Fcn: '/ira' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.ira_p = VFControl_cal->irairb_Y0; + + /* Disable for Fcn: '/irb' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.irb_n = VFControl_cal->irairb_Y0; + + /* Disable for Fcn: '/isa' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isa_m = VFControl_cal->isaisb_Y0; + + /* Disable for Fcn: '/isb' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isb_p = VFControl_cal->isaisb_Y0; + VFControl_DW.Rotorreferenceframe_MODE = false; + } + + /* End of Constant: '/Constant' */ + /* End of Outputs for SubSystem: '/Rotor reference frame' */ + + /* Outputs for Enabled SubSystem: '/Stationary reference frame' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant1' */ + if (VFControl_cal->Constant1_Value_b) { + VFControl_DW.Stationaryreferenceframe_MODE = true; + + /* Fcn: '/ira' */ + VFControl_B.ira_g = VFControl_B.MultiportSwitch[1] * VFControl_B.Product3[2] + - VFControl_B.MultiportSwitch[0] * VFControl_B.Product3[3]; + + /* Fcn: '/irb' */ + VFControl_B.irb_g = ((-VFControl_B.MultiportSwitch[1] - 1.7320508075688772 * + VFControl_B.MultiportSwitch[0]) * + VFControl_B.Product3[2] + (VFControl_B.MultiportSwitch + [0] - 1.7320508075688772 * VFControl_B.MultiportSwitch[1]) * + VFControl_B.Product3[3]) / 2.0; + + /* Fcn: '/isa' */ + VFControl_B.isa_a = VFControl_B.Product3[0]; + + /* Fcn: '/isb' */ + VFControl_B.isb_f = -(1.7320508075688772 * VFControl_B.Product3[1] + + VFControl_B.Product3[0]) / 2.0; + srUpdateBC(VFControl_DW.Stationaryreferenceframe_Subsys); + } else if (VFControl_DW.Stationaryreferenceframe_MODE) { + /* Disable for Fcn: '/ira' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.ira_g = VFControl_cal->irairb_Y0_d; + + /* Disable for Fcn: '/irb' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.irb_g = VFControl_cal->irairb_Y0_d; + + /* Disable for Fcn: '/isa' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isa_a = VFControl_cal->isaisb_Y0_k; + + /* Disable for Fcn: '/isb' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isb_f = VFControl_cal->isaisb_Y0_k; + VFControl_DW.Stationaryreferenceframe_MODE = false; + } + + /* End of Constant: '/Constant1' */ + /* End of Outputs for SubSystem: '/Stationary reference frame' */ + + /* Outputs for Enabled SubSystem: '/Synchronous reference frame' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant2' */ + if (VFControl_cal->Constant2_Value_d) { + VFControl_DW.Synchronousreferenceframe_MODE = true; + + /* Fcn: '/ira' */ + VFControl_B.ira = VFControl_B.MultiportSwitch[1] * VFControl_B.Product3[2] + + VFControl_B.MultiportSwitch[0] * VFControl_B.Product3[3]; + + /* Fcn: '/irb' */ + VFControl_B.irb = ((1.7320508075688772 * VFControl_B.MultiportSwitch[0] - + VFControl_B.MultiportSwitch[1]) * VFControl_B.Product3[2] + + (-1.7320508075688772 * VFControl_B.MultiportSwitch[1] - + VFControl_B.MultiportSwitch[0]) * + VFControl_B.Product3[3]) / 2.0; + + /* Fcn: '/isa' */ + VFControl_B.isa = VFControl_B.Product3[0] * VFControl_B.MultiportSwitch[3] + + VFControl_B.Product3[1] * VFControl_B.MultiportSwitch[2]; + + /* Fcn: '/isb' */ + VFControl_B.isb = ((1.7320508075688772 * VFControl_B.MultiportSwitch[2] - + VFControl_B.MultiportSwitch[3]) * VFControl_B.Product3[0] + + (-1.7320508075688772 * VFControl_B.MultiportSwitch[3] - + VFControl_B.MultiportSwitch[2]) * + VFControl_B.Product3[1]) / 2.0; + srUpdateBC(VFControl_DW.Synchronousreferenceframe_Subsy); + } else if (VFControl_DW.Synchronousreferenceframe_MODE) { + /* Disable for Fcn: '/ira' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.ira = VFControl_cal->irairb_Y0_h; + + /* Disable for Fcn: '/irb' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.irb = VFControl_cal->irairb_Y0_h; + + /* Disable for Fcn: '/isa' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isa = VFControl_cal->isaisb_Y0_m; + + /* Disable for Fcn: '/isb' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isb = VFControl_cal->isaisb_Y0_m; + VFControl_DW.Synchronousreferenceframe_MODE = false; + } + + /* End of Constant: '/Constant2' */ + /* End of Outputs for SubSystem: '/Synchronous reference frame' */ + + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Constant3' + */ + switch (static_cast(VFControl_cal->Constant3_Value_e)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch_p[0] = VFControl_B.ira_p; + VFControl_B.MultiportSwitch_p[1] = VFControl_B.irb_n; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch_p[0] = VFControl_B.ira_g; + VFControl_B.MultiportSwitch_p[1] = VFControl_B.irb_g; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch_p[0] = VFControl_B.ira; + VFControl_B.MultiportSwitch_p[1] = VFControl_B.irb; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch' */ + + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Constant: '/Constant4' + */ + switch (static_cast(VFControl_cal->Constant4_Value_c)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1[0] = VFControl_B.isa_m; + VFControl_B.MultiportSwitch1[1] = VFControl_B.isb_p; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1[0] = VFControl_B.isa_a; + VFControl_B.MultiportSwitch1[1] = VFControl_B.isb_f; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1[0] = VFControl_B.isa; + VFControl_B.MultiportSwitch1[1] = VFControl_B.isb; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch1' */ + + /* Gain: '/ib' */ + VFControl_B.ib[0] = VFControl_cal->ib_Gain * VFControl_B.MultiportSwitch_p[0]; + xk1 = VFControl_cal->ib_Gain * VFControl_B.MultiportSwitch1[0]; + VFControl_B.ib[2] = xk1; + + /* Gain: '/Gain Vr_Vs1' */ + VFControl_B.GainVr_Vs1[0] = VFControl_cal->GainVr_Vs1_Gain[0] * xk1; + + /* Gain: '/ib' */ + VFControl_B.ib[1] = VFControl_cal->ib_Gain * VFControl_B.MultiportSwitch_p[1]; + xk1 = VFControl_cal->ib_Gain * VFControl_B.MultiportSwitch1[1]; + VFControl_B.ib[3] = xk1; + + /* Gain: '/Gain Vr_Vs1' */ + VFControl_B.GainVr_Vs1[1] = VFControl_cal->GainVr_Vs1_Gain[1] * xk1; + + /* S-Function (sfun_spssw_discc): '/State-Space' incorporates: + * Constant: '/DC' + * Constant: '/SwitchCurrents' + */ + + /* S-Function block: /State-Space */ + { + real_T accum; + + /* Circuit has switches */ + int_T *switch_status = (int_T*) VFControl_DW.StateSpace_PWORK.SWITCH_STATUS; + int_T *switch_status_init = (int_T*) + VFControl_DW.StateSpace_PWORK.SWITCH_STATUS_INIT; + int_T *SwitchChange = (int_T*) VFControl_DW.StateSpace_PWORK.SW_CHG; + int_T *gState = (int_T*) VFControl_DW.StateSpace_PWORK.G_STATE; + real_T *yswitch = (real_T*)VFControl_DW.StateSpace_PWORK.Y_SWITCH; + int_T *switchTypes = (int_T*) VFControl_DW.StateSpace_PWORK.SWITCH_TYPES; + int_T *idxOutSw = (int_T*) VFControl_DW.StateSpace_PWORK.IDX_OUT_SW; + real_T *DxCol = (real_T*)VFControl_DW.StateSpace_PWORK.DX_COL; + real_T *tmp2 = (real_T*)VFControl_DW.StateSpace_PWORK.TMP2; + real_T *uswlast = (real_T*)VFControl_DW.StateSpace_PWORK.USWLAST; + int_T newState; + int_T swChanged = 0; + int loopsToDo = 20; + real_T temp; + + /* keep an initial copy of switch_status*/ + memcpy(switch_status_init, switch_status, 6 * sizeof(int_T)); + memcpy(uswlast, &VFControl_B.StateSpace_o1[0], 6*sizeof(real_T)); + do { + if (loopsToDo == 1) { /* Need to reset some variables: */ + swChanged = 0; + + /* return to the original switch status*/ + { + int_T i1; + for (i1=0; i1 < 6; i1++) { + swChanged = ((SwitchChange[i1] = switch_status_init[i1] - + switch_status[i1]) != 0) ? 1 : swChanged; + switch_status[i1] = switch_status_init[i1]; + } + } + } else { + /* + * Compute outputs: + * --------------- + */ + real_T *Ds = (real_T*)VFControl_DW.StateSpace_PWORK.DS; + + { + int_T i1; + real_T *y0 = &VFControl_B.StateSpace_o1[0]; + for (i1=0; i1 < 14; i1++) { + accum = 0.0; + + { + int_T i2; + const real_T *u0 = &VFControl_cal->SwitchCurrents_Value[0]; + for (i2=0; i2 < 6; i2++) { + accum += *(Ds++) * u0[i2]; + } + + accum += *(Ds++) * VFControl_B.GainVr_Vs1[0]; + accum += *(Ds++) * VFControl_B.GainVr_Vs1[1]; + accum += *(Ds++) * VFControl_cal->DCVoltageSource_Amplitude; + } + + y0[i1] = accum; + } + } + + swChanged = 0; + + { + int_T i1; + real_T *y0 = &VFControl_B.StateSpace_o1[0]; + for (i1=0; i1 < 6; i1++) { + newState = ((y0[i1] > 0.0) && (gState[i1] > 0)) || (y0[i1] < 0.0) ? + 1 : (((y0[i1] > 0.0) && gState[i1] == 0) ? 0 : switch_status[i1]); + swChanged = ((SwitchChange[i1] = newState - switch_status[i1]) != 0) + ? 1 : swChanged; + switch_status[i1] = newState;/* Keep new state */ + } + } + } + + /* + * Compute new As, Bs, Cs and Ds matrixes: + * -------------------------------------- + */ + if (swChanged) { + real_T *Ds = (real_T*)VFControl_DW.StateSpace_PWORK.DS; + real_T a1; + + { + int_T i1; + for (i1=0; i1 < 6; i1++) { + if (SwitchChange[i1] != 0) { + a1 = 1000.0*SwitchChange[i1]; + temp = 1/(1-Ds[i1*10]*a1); + + { + int_T i2; + for (i2=0; i2 < 14; i2++) { + DxCol[i2]= Ds[i2 * 9 + i1]*temp*a1; + } + } + + DxCol[i1] = temp; + + /* Copy row nSw of Ds into tmp2 and zero it out in Ds */ + memcpy(tmp2, &Ds[i1 * 9], 9 * sizeof(real_T)); + memset(&Ds[i1 * 9], '\0', 9 * sizeof(real_T)); + + /* Cs = Cs + DxCol * tmp1, Ds = Ds + DxCol * tmp2 *******************/ + { + int_T i2; + for (i2=0; i2 < 14; i2++) { + a1 = DxCol[i2]; + + { + int_T i3; + for (i3=0; i3 < 9; i3++) { + Ds[i2 * 9 + i3] += a1 * tmp2[i3]; + } + } + } + } + } + } + } + } /* if (swChanged) */ + } while (swChanged > 0 && --loopsToDo > 0); + + if (loopsToDo == 0) { + real_T *Ds = (real_T*)VFControl_DW.StateSpace_PWORK.DS; + + { + int_T i1; + real_T *y0 = &VFControl_B.StateSpace_o1[0]; + for (i1=0; i1 < 14; i1++) { + accum = 0.0; + + { + int_T i2; + const real_T *u0 = &VFControl_cal->SwitchCurrents_Value[0]; + for (i2=0; i2 < 6; i2++) { + accum += *(Ds++) * u0[i2]; + } + + accum += *(Ds++) * VFControl_B.GainVr_Vs1[0]; + accum += *(Ds++) * VFControl_B.GainVr_Vs1[1]; + accum += *(Ds++) * VFControl_cal->DCVoltageSource_Amplitude; + } + + y0[i1] = accum; + } + } + } + + /* Output new switches states */ + { + int_T i1; + real_T *y1 = &VFControl_B.StateSpace_o2[0]; + for (i1=0; i1 < 6; i1++) { + y1[i1] = (real_T)switch_status[i1]; + } + } + } + + /* Gain: '/1-1' */ + VFControl_B.iqsids[0] = VFControl_cal->u1_Gain[0] * VFControl_B.Product3[0]; + VFControl_B.iqsids[1] = VFControl_cal->u1_Gain[1] * VFControl_B.Product3[1]; + + /* Product: '/Mult1' */ + VFControl_B.Mult1[0] = VFControl_B.iqsids[0] * VFControl_B.xk1[1]; + VFControl_B.Mult1[1] = VFControl_B.xk1[0] * VFControl_B.iqsids[1]; + + /* Switch: '/Switch2' incorporates: + * Constant: '/Constant5' + */ + if (VFControl_cal->Constant5_Value >= VFControl_cal->Switch2_Threshold) { + /* Switch: '/Switch2' */ + VFControl_B.Switch2 = VFControl_B.Switch_g; + } else { + /* Switch: '/Switch2' incorporates: + * Constant: '/Lm_nosat' + */ + VFControl_B.Switch2 = VFControl_cal->Lm_nosat_Value; + } + + /* End of Switch: '/Switch2' */ + + /* Sum: '/Sum2' */ + xk1 = VFControl_B.Mult1[0]; + + /* Gain: '/Gain Vr_Vs' */ + Bias = VFControl_cal->GainVr_Vs_Gain[0] * VFControl_B.StateSpace_o1[6]; + VFControl_B.GainVr_Vs[0] = Bias; + + /* Gain: '/1_Vb' incorporates: + * Constant: '/Constant6' + */ + VFControl_B.u_Vb[0] = VFControl_cal->u_Vb_Gain * + VFControl_cal->Constant6_Value[0]; + VFControl_B.u_Vb[2] = VFControl_cal->u_Vb_Gain * Bias; + + /* Sum: '/Sum2' */ + xk1 += VFControl_B.Mult1[1]; + + /* Gain: '/Gain Vr_Vs' */ + Bias = VFControl_cal->GainVr_Vs_Gain[1] * VFControl_B.StateSpace_o1[7]; + VFControl_B.GainVr_Vs[1] = Bias; + + /* Gain: '/1_Vb' incorporates: + * Constant: '/Constant6' + */ + VFControl_B.u_Vb[1] = VFControl_cal->u_Vb_Gain * + VFControl_cal->Constant6_Value[1]; + VFControl_B.u_Vb[3] = VFControl_cal->u_Vb_Gain * Bias; + + /* Sum: '/Sum2' */ + VFControl_B.Sum2_k = xk1; + + /* Outputs for Enabled SubSystem: '/Rotor reference frame' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant' */ + if (VFControl_cal->Constant_Value_j) { + VFControl_DW.Rotorreferenceframe_MODE_m = true; + + /* Fcn: '/vdr' */ + VFControl_B.vdr_l = -0.57735026918962573 * VFControl_B.u_Vb[1]; + + /* Fcn: '/vds' */ + VFControl_B.vds_f = ((VFControl_B.MultiportSwitch[0] - 1.7320508075688772 * + VFControl_B.MultiportSwitch[1]) * VFControl_B.u_Vb[3] + + 2.0 * VFControl_B.MultiportSwitch[0] * + VFControl_B.u_Vb[2]) * 0.33333333333333331; + + /* Fcn: '/vqr' */ + VFControl_B.vqr_j = (2.0 * VFControl_B.u_Vb[0] + VFControl_B.u_Vb[1]) * + 0.33333333333333331; + + /* Fcn: '/vqs' */ + VFControl_B.vqs_l = ((1.7320508075688772 * VFControl_B.MultiportSwitch[0] + + VFControl_B.MultiportSwitch[1]) * VFControl_B.u_Vb[3] + + 2.0 * VFControl_B.MultiportSwitch[1] * + VFControl_B.u_Vb[2]) * 0.33333333333333331; + srUpdateBC(VFControl_DW.Rotorreferenceframe_SubsysRan_i); + } else if (VFControl_DW.Rotorreferenceframe_MODE_m) { + /* Disable for Fcn: '/vqr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vqr_j = VFControl_cal->vqrvdr_Y0; + + /* Disable for Fcn: '/vdr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vdr_l = VFControl_cal->vqrvdr_Y0; + + /* Disable for Fcn: '/vqs' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vqs_l = VFControl_cal->vqsvds_Y0; + + /* Disable for Fcn: '/vds' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vds_f = VFControl_cal->vqsvds_Y0; + VFControl_DW.Rotorreferenceframe_MODE_m = false; + } + + /* End of Constant: '/Constant' */ + /* End of Outputs for SubSystem: '/Rotor reference frame' */ + + /* Outputs for Enabled SubSystem: '/Stationary reference frame' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant1' */ + if (VFControl_cal->Constant1_Value_f) { + VFControl_DW.Stationaryreferenceframe_MODE_p = true; + + /* Fcn: '/vdr' */ + VFControl_B.vdr_p = ((-VFControl_B.MultiportSwitch[0] - 1.7320508075688772 * + VFControl_B.MultiportSwitch[1]) * VFControl_B.u_Vb[1] + + -2.0 * VFControl_B.MultiportSwitch[0] * + VFControl_B.u_Vb[0]) * 0.33333333333333331; + + /* Fcn: '/vds' */ + VFControl_B.vds_i = -0.57735026918962573 * VFControl_B.u_Vb[3]; + + /* Fcn: '/vqr' */ + VFControl_B.vqr_l = ((VFControl_B.MultiportSwitch[1] - 1.7320508075688772 * + VFControl_B.MultiportSwitch[0]) * VFControl_B.u_Vb[1] + + 2.0 * VFControl_B.MultiportSwitch[1] * + VFControl_B.u_Vb[0]) * 0.33333333333333331; + + /* Fcn: '/vqs' */ + VFControl_B.vqs_i = (2.0 * VFControl_B.u_Vb[2] + VFControl_B.u_Vb[3]) * + 0.33333333333333331; + srUpdateBC(VFControl_DW.Stationaryreferenceframe_Subs_n); + } else if (VFControl_DW.Stationaryreferenceframe_MODE_p) { + /* Disable for Fcn: '/vqr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vqr_l = VFControl_cal->vqrvdr_Y0_a; + + /* Disable for Fcn: '/vdr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vdr_p = VFControl_cal->vqrvdr_Y0_a; + + /* Disable for Fcn: '/vqs' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vqs_i = VFControl_cal->vqsvds_Y0_m; + + /* Disable for Fcn: '/vds' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vds_i = VFControl_cal->vqsvds_Y0_m; + VFControl_DW.Stationaryreferenceframe_MODE_p = false; + } + + /* End of Constant: '/Constant1' */ + /* End of Outputs for SubSystem: '/Stationary reference frame' */ + + /* Outputs for Enabled SubSystem: '/Synchronous reference frame' incorporates: + * EnablePort: '/Enable' + */ + /* Constant: '/Constant2' */ + if (VFControl_cal->Constant2_Value_kn) { + VFControl_DW.Synchronousreferenceframe_MOD_l = true; + + /* Fcn: '/vdr' */ + VFControl_B.vdr = ((VFControl_B.MultiportSwitch[0] - 1.7320508075688772 * + VFControl_B.MultiportSwitch[1]) * VFControl_B.u_Vb[1] + + 2.0 * VFControl_B.MultiportSwitch[0] * VFControl_B.u_Vb[0]) + / 3.0; + + /* Fcn: '/vds' */ + VFControl_B.vds = ((VFControl_B.MultiportSwitch[2] - 1.7320508075688772 * + VFControl_B.MultiportSwitch[3]) * VFControl_B.u_Vb[3] + + 2.0 * VFControl_B.MultiportSwitch[2] * VFControl_B.u_Vb[2]) + / 3.0; + + /* Fcn: '/vqr' */ + VFControl_B.vqr = ((1.7320508075688772 * VFControl_B.MultiportSwitch[0] + + VFControl_B.MultiportSwitch[1]) * VFControl_B.u_Vb[1] + + 2.0 * VFControl_B.MultiportSwitch[1] * VFControl_B.u_Vb[0]) + / 3.0; + + /* Fcn: '/vqs' */ + VFControl_B.vqs = ((1.7320508075688772 * VFControl_B.MultiportSwitch[2] + + VFControl_B.MultiportSwitch[3]) * VFControl_B.u_Vb[3] + + 2.0 * VFControl_B.MultiportSwitch[3] * VFControl_B.u_Vb[2]) + / 3.0; + srUpdateBC(VFControl_DW.Synchronousreferenceframe_Sub_k); + } else if (VFControl_DW.Synchronousreferenceframe_MOD_l) { + /* Disable for Fcn: '/vqr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vqr = VFControl_cal->vqrvdr_Y0_am; + + /* Disable for Fcn: '/vdr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vdr = VFControl_cal->vqrvdr_Y0_am; + + /* Disable for Fcn: '/vqs' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vqs = VFControl_cal->vqsvds_Y0_p; + + /* Disable for Fcn: '/vds' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vds = VFControl_cal->vqsvds_Y0_p; + VFControl_DW.Synchronousreferenceframe_MOD_l = false; + } + + /* End of Constant: '/Constant2' */ + /* End of Outputs for SubSystem: '/Synchronous reference frame' */ + + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Constant: '/Constant4' + */ + switch (static_cast(VFControl_cal->Constant4_Value_i)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1_f[0] = VFControl_B.vqs_l; + VFControl_B.MultiportSwitch1_f[1] = VFControl_B.vds_f; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1_f[0] = VFControl_B.vqs_i; + VFControl_B.MultiportSwitch1_f[1] = VFControl_B.vds_i; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1_f[0] = VFControl_B.vqs; + VFControl_B.MultiportSwitch1_f[1] = VFControl_B.vds; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch1' */ + + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Constant3' + */ + switch (static_cast(VFControl_cal->Constant3_Value_g)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch_p2[0] = VFControl_B.vqr_j; + VFControl_B.MultiportSwitch_p2[1] = VFControl_B.vdr_l; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch_p2[0] = VFControl_B.vqr_l; + VFControl_B.MultiportSwitch_p2[1] = VFControl_B.vdr_p; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch' */ + VFControl_B.MultiportSwitch_p2[0] = VFControl_B.vqr; + VFControl_B.MultiportSwitch_p2[1] = VFControl_B.vdr; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch' */ + + /* UnitDelay: '/voltages' */ + VFControl_B.voltages[0] = VFControl_DW.voltages_DSTATE[0]; + VFControl_B.voltages[1] = VFControl_DW.voltages_DSTATE[1]; + VFControl_B.voltages[2] = VFControl_DW.voltages_DSTATE[2]; + VFControl_B.voltages[3] = VFControl_DW.voltages_DSTATE[3]; + + /* DigitalClock: '/Digital Clock' */ + VFControl_B.DigitalClock = VFControl_M->Timing.t[1]; + + /* Switch: '/IC' incorporates: + * Constant: '/Constant3' + * Switch: '/Switch1' + */ + if (VFControl_B.DigitalClock >= VFControl_cal->IC_Threshold) { + /* Sum: '/sum' */ + VFControl_B.ukuk1[0] = VFControl_B.MultiportSwitch1_f[0] + + VFControl_B.voltages[0]; + VFControl_B.ukuk1[2] = VFControl_B.MultiportSwitch_p2[0] + + VFControl_B.voltages[2]; + VFControl_B.ukuk1[1] = VFControl_B.MultiportSwitch1_f[1] + + VFControl_B.voltages[1]; + VFControl_B.ukuk1[3] = VFControl_B.MultiportSwitch_p2[1] + + VFControl_B.voltages[3]; + if (VFControl_cal->Constant3_Value >= VFControl_cal->Switch1_Threshold) { + /* Switch: '/Switch1' incorporates: + * Product: '/Product1' + */ + std::memcpy(&VFControl_B.RLinv[0], &VFControl_B.RLinv_m[0], sizeof(real_T) + << 4U); + } else { + /* Switch: '/Switch1' incorporates: + * Constant: '/Constant4' + */ + std::memcpy(&VFControl_B.RLinv[0], &VFControl_cal->Constant4_Value[0], + sizeof(real_T) << 4U); + } + + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Constant: '/Constant3' + * Constant: '/Constant4' + * Switch: '/Switch1' + */ + switch (static_cast(VFControl_cal->Constant4_Value_e)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Assignment: '/W(2,1)=-wr' + */ + std::memcpy(&VFControl_B.MultiportSwitch1_l[0], &VFControl_B.W21wr[0], + sizeof(real_T) << 4U); + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Assignment: '/W(4,3)=wr' + */ + std::memcpy(&VFControl_B.MultiportSwitch1_l[0], &VFControl_B.W43wr[0], + sizeof(real_T) << 4U); + break; + + default: + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Assignment: '/W(4,3)=wr-1' + */ + std::memcpy(&VFControl_B.MultiportSwitch1_l[0], &VFControl_B.W43wr1[0], + sizeof(real_T) << 4U); + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch1' */ + for (i = 0; i < 16; i++) { + /* Sum: '/Sum1' incorporates: + * MultiPortSwitch: '/Multiport Switch1' + * Switch: '/Switch1' + */ + xk1 = (0.0 - VFControl_B.MultiportSwitch1_l[i]) - VFControl_B.RLinv[i]; + VFControl_B.A[i] = xk1; + + /* Gain: '/wbase*Ts//2' incorporates: + * Sum: '/Sum1' + */ + xk1 *= VFControl_cal->wbaseTs2_Gain; + VFControl_B.wbaseTs2[i] = xk1; + + /* Sum: '/Sum1' incorporates: + * Constant: '/u5' + * Gain: '/wbase*Ts//2' + */ + VFControl_B.Sum1_k[i] = VFControl_cal->u5_Value_l[i] - xk1; + } + + /* Product: '/inversion' incorporates: + * Sum: '/Sum1' + */ + rt_invd4x4_snf(VFControl_B.Sum1_k, VFControl_B.inversion); + for (i = 0; i < 16; i++) { + /* Gain: '/wbase*Ts//2 ' incorporates: + * Product: '/inversion' + */ + xk1 = VFControl_cal->wbaseTs2_Gain_c * VFControl_B.inversion[i]; + VFControl_B.wbaseTs2_c[i] = xk1; + + /* Product: '/Product1' incorporates: + * Gain: '/wbase*Ts//2 ' + */ + tmp[i] = xk1; + } + + /* Product: '/Product1' */ + Bias = VFControl_B.ukuk1[0]; + tmp_1 = VFControl_B.ukuk1[1]; + tmp_2 = VFControl_B.ukuk1[2]; + RLinv_m = VFControl_B.ukuk1[3]; + for (i = 0; i < 4; i++) { + xk1 = tmp[i] * Bias; + xk1 += tmp[i + 4] * tmp_1; + xk1 += tmp[i + 8] * tmp_2; + xk1 += tmp[i + 12] * RLinv_m; + + /* Product: '/Product1' */ + VFControl_B.Product1_d[i] = xk1; + } + + for (i = 0; i < 16; i++) { + /* Sum: '/Sum5' incorporates: + * Constant: '/u5' + * Gain: '/wbase*Ts//2' + */ + xk1 = VFControl_cal->u5_Value_l[i] + VFControl_B.wbaseTs2[i]; + VFControl_B.Sum5[i] = xk1; + + /* Product: '/Product4' incorporates: + * Product: '/inversion' + * Sum: '/Sum5' + */ + tmp[i] = VFControl_B.inversion[i]; + tmp_0[i] = xk1; + } + + for (i = 0; i < 4; i++) { + /* Product: '/Product4' */ + tmp_3 = i << 2; + xk1 = tmp_0[tmp_3]; + Bias = tmp_0[tmp_3 + 1]; + tmp_1 = tmp_0[tmp_3 + 2]; + tmp_2 = tmp_0[tmp_3 + 3]; + for (i_0 = 0; i_0 < 4; i_0++) { + /* Product: '/Product4' */ + RLinv_m = xk1 * tmp[i_0]; + RLinv_m += tmp[i_0 + 4] * Bias; + RLinv_m += tmp[i_0 + 8] * tmp_1; + RLinv_m += tmp[i_0 + 12] * tmp_2; + + /* Product: '/Product4' */ + VFControl_B.Product4_k[i_0 + tmp_3] = RLinv_m; + } + } + + /* Product: '/Product2' incorporates: + * Product: '/Product4' + */ + std::memcpy(&tmp[0], &VFControl_B.Product4_k[0], sizeof(real_T) << 4U); + Bias = VFControl_B.xk1[0]; + tmp_1 = VFControl_B.xk1[1]; + tmp_2 = VFControl_B.xk1[2]; + RLinv_m = VFControl_B.xk1[3]; + for (i = 0; i < 4; i++) { + xk1 = tmp[i] * Bias; + xk1 += tmp[i + 4] * tmp_1; + xk1 += tmp[i + 8] * tmp_2; + xk1 += tmp[i + 12] * RLinv_m; + + /* Product: '/Product2' */ + VFControl_B.Product2_o[i] = xk1; + + /* Sum: '/Ad*x(k-1) + Bd*( u(k-1) + u(k))' */ + xk1 += VFControl_B.Product1_d[i]; + VFControl_B.xk[i] = xk1; + + /* Switch: '/IC' */ + VFControl_B.IC[i] = xk1; + } + + /* End of Product: '/Product2' */ + } else { + /* Switch: '/IC' */ + VFControl_B.IC[0] = VFControl_B.xk1[0]; + VFControl_B.IC[1] = VFControl_B.xk1[1]; + VFControl_B.IC[2] = VFControl_B.xk1[2]; + VFControl_B.IC[3] = VFControl_B.xk1[3]; + } + + /* End of Switch: '/IC' */ + + /* Sum: '/Sum2' */ + xk1 = 0.0 - VFControl_B.MultiportSwitch_p[0]; + xk1 -= VFControl_B.MultiportSwitch_p[1]; + + /* Sum: '/Sum2' */ + VFControl_B.Sum2_l = xk1; + + /* Gain: '/unit conversion' */ + VFControl_B.unitconversion[2] = VFControl_cal->unitconversion_Gain[2] * + VFControl_B.Sum2_l; + + /* Sum: '/Sum3' */ + xk1 = 0.0 - VFControl_B.MultiportSwitch1[0]; + + /* Gain: '/unit conversion' */ + VFControl_B.unitconversion[0] = VFControl_cal->unitconversion_Gain[0] * + VFControl_B.MultiportSwitch_p[0]; + VFControl_B.unitconversion[3] = VFControl_B.Product3[2] * + VFControl_cal->unitconversion_Gain[3]; + VFControl_B.unitconversion[5] = VFControl_B.xk1[2] * + VFControl_cal->unitconversion_Gain[5]; + VFControl_B.unitconversion[7] = VFControl_B.MultiportSwitch_p2[0] * + VFControl_cal->unitconversion_Gain[7]; + VFControl_B.unitconversion[9] = VFControl_B.MultiportSwitch1[0] * + VFControl_cal->unitconversion_Gain[9]; + VFControl_B.unitconversion[12] = VFControl_B.Product3[0] * + VFControl_cal->unitconversion_Gain[12]; + VFControl_B.unitconversion[14] = VFControl_B.xk1[0] * + VFControl_cal->unitconversion_Gain[14]; + VFControl_B.unitconversion[16] = VFControl_B.MultiportSwitch1_f[0] * + VFControl_cal->unitconversion_Gain[16]; + + /* Sum: '/Sum3' */ + xk1 -= VFControl_B.MultiportSwitch1[1]; + + /* Gain: '/unit conversion' */ + VFControl_B.unitconversion[1] = VFControl_cal->unitconversion_Gain[1] * + VFControl_B.MultiportSwitch_p[1]; + VFControl_B.unitconversion[4] = VFControl_B.Product3[3] * + VFControl_cal->unitconversion_Gain[4]; + VFControl_B.unitconversion[6] = VFControl_B.xk1[3] * + VFControl_cal->unitconversion_Gain[6]; + VFControl_B.unitconversion[8] = VFControl_B.MultiportSwitch_p2[1] * + VFControl_cal->unitconversion_Gain[8]; + VFControl_B.unitconversion[10] = VFControl_B.MultiportSwitch1[1] * + VFControl_cal->unitconversion_Gain[10]; + VFControl_B.unitconversion[13] = VFControl_B.Product3[1] * + VFControl_cal->unitconversion_Gain[13]; + VFControl_B.unitconversion[15] = VFControl_B.xk1[1] * + VFControl_cal->unitconversion_Gain[15]; + VFControl_B.unitconversion[17] = VFControl_B.MultiportSwitch1_f[1] * + VFControl_cal->unitconversion_Gain[17]; + + /* Sum: '/Sum3' */ + VFControl_B.Sum3 = xk1; + + /* Gain: '/unit conversion' */ + VFControl_B.unitconversion[11] = VFControl_cal->unitconversion_Gain[11] * + VFControl_B.Sum3; + VFControl_B.unitconversion[18] = VFControl_cal->unitconversion_Gain[18] * + VFControl_B.Switch2; + + /* Gain: '/1\p' */ + VFControl_B.up = VFControl_cal->up_Gain * VFControl_B.Rotoranglethetam; + + /* Gain: '/1\p1' */ + VFControl_B.wTethr[0] = VFControl_cal->up1_Gain[0] * VFControl_B.Sum1; + VFControl_B.wTethr[1] = VFControl_cal->up1_Gain[1] * VFControl_B.Sum2_k; + VFControl_B.wTethr[2] = VFControl_cal->up1_Gain[2] * VFControl_B.up; + + /* Gain: '/Unit conversion' */ + VFControl_B.Unitconversion = VFControl_cal->Unitconversion_Gain * 0.0; + + /* Gain: '/F' */ + VFControl_B.F = VFControl_cal->F_Gain * VFControl_B.Sum1; + + /* Sum: '/Sum' */ + VFControl_B.Sum = (VFControl_B.Sum2_k - VFControl_B.Unitconversion) - + VFControl_B.F; + + /* Gain: '/1_2H' */ + VFControl_B.u_2H = VFControl_cal->u_2H_Gain * VFControl_B.Sum; + + /* DiscreteIntegrator: '/Rotor speed(wm)' */ + if (VFControl_DW.Rotorspeedwm_SYSTEM_ENABLE != 0) { + /* DiscreteIntegrator: '/Rotor speed(wm)' */ + VFControl_B.Rotorspeedwm = VFControl_DW.Rotorspeedwm_DSTATE; + } else { + /* DiscreteIntegrator: '/Rotor speed(wm)' */ + VFControl_B.Rotorspeedwm = VFControl_cal->Rotorspeedwm_gainval * + VFControl_B.u_2H + VFControl_DW.Rotorspeedwm_DSTATE; + } + + /* End of DiscreteIntegrator: '/Rotor speed(wm)' */ + + /* Gain: '/web_psb' */ + VFControl_B.web_psb = VFControl_cal->web_psb_Gain_n * VFControl_B.Sum1; + + /* DigitalClock: '/Digital Clock' */ + VFControl_B.DigitalClock_k = VFControl_M->Timing.t[1]; + + /* Lookup: '/Look-Up Table' */ + VFControl_B.LookUpTable = rt_Lookup(&VFControl_cal->LookUpTable_XData[0], 8, + VFControl_B.DigitalClock_k, &VFControl_cal->LookUpTable_YData[0]); + + /* RelationalOperator: '/Relational Operator3' incorporates: + * Constant: '/Constant6' + * Constant: '/valp_nom1' + */ + VFControl_B.RelationalOperator3 = (VFControl_cal->valp_nom1_Value == + VFControl_cal->Constant6_Value_k); + + /* RelationalOperator: '/Relational Operator' incorporates: + * Constant: '/Constant' + * Constant: '/valp_nom3' + */ + VFControl_B.Amplitude = (VFControl_cal->valp_nom3_Value == + VFControl_cal->Constant_Value_nw); + + /* Logic: '/Logical Operator1' */ + VFControl_B.LogicalOperator1 = (VFControl_B.RelationalOperator3 && + VFControl_B.Amplitude); + + /* Step: '/Step1' */ + Bias = VFControl_M->Timing.t[1]; + if (Bias < VFControl_cal->Variationvaluesteprampmod_Toff_) { + /* Step: '/Step1' */ + VFControl_B.Toff = VFControl_cal->Step1_Y0; + } else { + /* Step: '/Step1' */ + VFControl_B.Toff = VFControl_cal->Step1_YFinal; + } + + /* End of Step: '/Step1' */ + + /* DataTypeConversion: '/Data Type Conversion2' */ + VFControl_B.DataTypeConversion2 = (VFControl_B.Toff != 0.0); + + /* Logic: '/Logical Operator1' */ + VFControl_B.LogicalOperator1_l = !VFControl_B.DataTypeConversion2; + + /* RelationalOperator: '/Relational Operator1' incorporates: + * Constant: '/valp_nom5' + * Constant: '/Constant3' + */ + VFControl_B.RelationalOperator1 = (VFControl_cal->valp_nom5_Value == + VFControl_cal->Constant3_Value_ey); + + /* DataTypeConversion: '/Data Type Conversion1' */ + VFControl_B.DataTypeConversion1_f = VFControl_B.RelationalOperator1; + + /* Logic: '/Logical Operator' */ + VFControl_B.LogicalOperator = (VFControl_B.LogicalOperator1_l && + VFControl_B.DataTypeConversion1_f); + + /* Step: '/Step' */ + Bias = VFControl_M->Timing.t[1]; + if (Bias < VFControl_cal->Variationvaluesteprampmod_Ton_V) { + /* Step: '/Step' */ + VFControl_B.Ton = VFControl_cal->Step_Y0; + } else { + /* Step: '/Step' */ + VFControl_B.Ton = VFControl_cal->Step_YFinal; + } + + /* End of Step: '/Step' */ + + /* DiscreteIntegrator: '/Discrete-Time Integrator1' */ + VFControl_B.DiscreteTimeIntegrator1 = + VFControl_DW.DiscreteTimeIntegrator1_DSTATE; + + /* UnitDelay: '/Unit Delay1' */ + VFControl_B.UnitDelay1 = VFControl_DW.UnitDelay1_DSTATE; + + /* Switch: '/Switch2' */ + if (VFControl_B.Toff >= VFControl_cal->Switch2_Threshold_a) { + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Constant: '/valp_nom5' + */ + switch (static_cast(VFControl_cal->valp_nom5_Value)) { + case 1: + /* Product: '/Product2' incorporates: + * Constant: '/valp_nom6' + */ + VFControl_B.Step = VFControl_cal->Variationvaluesteprampmod_Var_n * + VFControl_B.Ton; + + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1_b = VFControl_B.Step; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1_b = VFControl_B.DiscreteTimeIntegrator1; + break; + + case 3: + /* Gain: '/Gain1' incorporates: + * Constant: '/valp_nom9' + */ + VFControl_B.Gain1_f = VFControl_cal->Gain1_Gain_n * + VFControl_cal->Variationvaluesteprampmod_Varia; + + /* Product: '/Product1' */ + VFControl_B.Product1_f = VFControl_B.DiscreteTimeIntegrator1 * + VFControl_B.Gain1_f; + + /* Trigonometry: '/Trigonometric Function1' */ + VFControl_B.TrigonometricFunction1_l = std::sin(VFControl_B.Product1_f); + + /* Product: '/Product' incorporates: + * Constant: '/valp_nom8' + */ + VFControl_B.Mod = VFControl_cal->Variationvaluesteprampmod_Var_l * + VFControl_B.TrigonometricFunction1_l; + + /* MultiPortSwitch: '/Multiport Switch1' */ + VFControl_B.MultiportSwitch1_b = VFControl_B.Mod; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch1' incorporates: + * Constant: '/Constant5' + */ + VFControl_B.MultiportSwitch1_b = VFControl_cal->Constant5_Value_c; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch1' */ + + /* Switch: '/Switch2' */ + VFControl_B.Switch2_d = VFControl_B.MultiportSwitch1_b; + } else { + /* Switch: '/Switch2' */ + VFControl_B.Switch2_d = VFControl_B.UnitDelay1; + } + + /* End of Switch: '/Switch2' */ + + /* Switch: '/Switch3' */ + if (VFControl_B.LogicalOperator) { + /* Switch: '/Switch3' incorporates: + * Constant: '/Constant1' + */ + VFControl_B.Switch3 = VFControl_cal->Constant1_Value_a; + } else { + /* Switch: '/Switch3' */ + VFControl_B.Switch3 = VFControl_B.Switch2_d; + } + + /* End of Switch: '/Switch3' */ + + /* Switch: '/Switch2' */ + if (VFControl_B.Amplitude) { + /* Switch: '/Switch2' */ + VFControl_B.Switch2_a = VFControl_B.Switch3; + } else { + /* Switch: '/Switch2' incorporates: + * Constant: '/Constant1' + */ + VFControl_B.Switch2_a = VFControl_cal->Constant1_Value_j; + } + + /* End of Switch: '/Switch2' */ + + /* Sum: '/Sum3' incorporates: + * Constant: '/valp_nom2' + */ + VFControl_B.Sum3_e = VFControl_B.Switch2_a + VFControl_cal->valp_nom2_Value; + + /* Switch: '/Switch1' */ + if (VFControl_B.LogicalOperator1) { + /* Switch: '/Switch1' */ + VFControl_B.Switch1 = VFControl_B.LookUpTable; + } else { + /* Switch: '/Switch1' */ + VFControl_B.Switch1 = VFControl_B.Sum3_e; + } + + /* End of Switch: '/Switch1' */ + + /* Switch: '/Switch5' */ + VFControl_B.Switch5[0] = VFControl_B.Switch1; + + /* Switch: '/Switch5' incorporates: + * Constant: '/SinglePhase' + */ + if (VFControl_cal->SinglePhase_Value >= VFControl_cal->Switch5_Threshold) { + /* Switch: '/Switch5' */ + VFControl_B.Switch5[1] = VFControl_B.Sum3_e; + VFControl_B.Switch5[2] = VFControl_B.Sum3_e; + } else { + /* Switch: '/Switch5' */ + VFControl_B.Switch5[1] = VFControl_B.Switch1; + VFControl_B.Switch5[2] = VFControl_B.Switch1; + } + + /* DigitalClock: '/t' */ + VFControl_B.t = VFControl_M->Timing.t[1]; + + /* Gain: '/Gain' incorporates: + * Constant: '/valp_nom1' + */ + VFControl_B.Gain_p = VFControl_cal->Gain_Gain_k * + VFControl_cal->valp_nom1_Value_g; + + /* Product: '/Product' */ + VFControl_B.Product = VFControl_B.t * VFControl_B.Gain_p; + + /* DiscreteIntegrator: '/Discrete-Time Integrator' */ + VFControl_B.DiscreteTimeIntegrator = + VFControl_DW.DiscreteTimeIntegrator_DSTATE; + + /* Sum: '/Sum' */ + VFControl_B.Sum_n = VFControl_B.Product + VFControl_B.DiscreteTimeIntegrator; + + /* RelationalOperator: '/Relational Operator3' incorporates: + * Constant: '/Constant6' + * Constant: '/valp_nom1' + */ + VFControl_B.RelationalOperator3_f = (VFControl_cal->valp_nom1_Value_c == + VFControl_cal->Constant6_Value_h); + + /* RelationalOperator: '/Relational Operator1' incorporates: + * Constant: '/Constant2' + * Constant: '/valp_nom3' + */ + VFControl_B.Phase = (VFControl_cal->valp_nom3_Value == + VFControl_cal->Constant2_Value_b); + + /* Logic: '/Logical Operator1' */ + VFControl_B.LogicalOperator1_b = (VFControl_B.RelationalOperator3_f && + VFControl_B.Phase); + + /* Gain: '/Gain3' incorporates: + * Constant: '/valp_nom' + */ + VFControl_B.Gain3 = VFControl_cal->Gain3_Gain_e * + VFControl_cal->valp_nom_Value; + + /* Switch: '/Switch3' */ + if (VFControl_B.Phase) { + /* Gain: '/Gain4' */ + VFControl_B.Gain4 = VFControl_cal->Gain4_Gain * VFControl_B.Switch3; + + /* Switch: '/Switch3' */ + VFControl_B.Switch3_o = VFControl_B.Gain4; + } else { + /* Switch: '/Switch3' incorporates: + * Constant: '/Constant4' + */ + VFControl_B.Switch3_o = VFControl_cal->Constant4_Value_l; + } + + /* End of Switch: '/Switch3' */ + + /* Sum: '/Sum2' incorporates: + * Constant: '/P1' + */ + VFControl_B.Sum2_j[0] = (VFControl_B.Gain3 + VFControl_cal->P1_Value_e[0]) + + VFControl_B.Switch3_o; + VFControl_B.Sum2_j[1] = (VFControl_B.Gain3 + VFControl_cal->P1_Value_e[1]) + + VFControl_B.Switch3_o; + VFControl_B.Sum2_j[2] = (VFControl_B.Gain3 + VFControl_cal->P1_Value_e[2]) + + VFControl_B.Switch3_o; + + /* Switch: '/Switch1' */ + if (VFControl_B.LogicalOperator1_b) { + /* Gain: '/Gain3' */ + VFControl_B.Gain3_n = VFControl_cal->Gain3_Gain_c * VFControl_B.LookUpTable; + + /* Sum: '/Sum2' incorporates: + * Constant: '/P1' + */ + xk1 = VFControl_B.Gain3_n + VFControl_cal->P1_Value[0]; + VFControl_B.Sum2_lw[0] = xk1; + + /* Switch: '/Switch1' */ + VFControl_B.Switch1_a[0] = xk1; + + /* Sum: '/Sum2' incorporates: + * Constant: '/P1' + */ + xk1 = VFControl_B.Gain3_n + VFControl_cal->P1_Value[1]; + VFControl_B.Sum2_lw[1] = xk1; + + /* Switch: '/Switch1' */ + VFControl_B.Switch1_a[1] = xk1; + + /* Sum: '/Sum2' incorporates: + * Constant: '/P1' + */ + xk1 = VFControl_B.Gain3_n + VFControl_cal->P1_Value[2]; + VFControl_B.Sum2_lw[2] = xk1; + + /* Switch: '/Switch1' */ + VFControl_B.Switch1_a[2] = xk1; + } else { + /* Switch: '/Switch1' */ + VFControl_B.Switch1_a[0] = VFControl_B.Sum2_j[0]; + VFControl_B.Switch1_a[1] = VFControl_B.Sum2_j[1]; + VFControl_B.Switch1_a[2] = VFControl_B.Sum2_j[2]; + } + + /* End of Switch: '/Switch1' */ + + /* Switch: '/Switch5' incorporates: + * Constant: '/SinglePhase' + */ + if (VFControl_cal->SinglePhase_Value_i >= VFControl_cal->Switch5_Threshold_m) + { + /* Switch: '/Switch5' */ + VFControl_B.Switch5_b[0] = VFControl_B.Switch1_a[0]; + VFControl_B.Switch5_b[1] = VFControl_B.Sum2_j[1]; + VFControl_B.Switch5_b[2] = VFControl_B.Sum2_j[2]; + } else { + /* Switch: '/Switch5' */ + VFControl_B.Switch5_b[0] = VFControl_B.Switch1_a[0]; + VFControl_B.Switch5_b[1] = VFControl_B.Switch1_a[1]; + VFControl_B.Switch5_b[2] = VFControl_B.Switch1_a[2]; + } + + /* End of Switch: '/Switch5' */ + + /* Sum: '/Sum7' */ + VFControl_B.Sum7[0] = VFControl_B.Sum_n + VFControl_B.Switch5_b[0]; + + /* Trigonometry: '/Trigonometric Function1' */ + xk1 = std::sin(VFControl_B.Sum7[0]); + VFControl_B.TrigonometricFunction1[0] = xk1; + + /* Product: '/Product2' */ + VFControl_B.Product2[0] = VFControl_B.Switch5[0] * xk1; + + /* Sum: '/Sum7' */ + VFControl_B.Sum7[1] = VFControl_B.Sum_n + VFControl_B.Switch5_b[1]; + + /* Trigonometry: '/Trigonometric Function1' */ + xk1 = std::sin(VFControl_B.Sum7[1]); + VFControl_B.TrigonometricFunction1[1] = xk1; + + /* Product: '/Product2' */ + VFControl_B.Product2[1] = VFControl_B.Switch5[1] * xk1; + + /* Sum: '/Sum7' */ + VFControl_B.Sum7[2] = VFControl_B.Sum_n + VFControl_B.Switch5_b[2]; + + /* Trigonometry: '/Trigonometric Function1' */ + xk1 = std::sin(VFControl_B.Sum7[2]); + VFControl_B.TrigonometricFunction1[2] = xk1; + + /* Product: '/Product2' */ + VFControl_B.Product2[2] = VFControl_B.Switch5[2] * xk1; + + /* Step: '/Step' */ + Bias = VFControl_M->Timing.t[1]; + if (Bias < VFControl_cal->Step_Time) { + /* Step: '/Step' */ + VFControl_B.Ton_e = VFControl_cal->Step_Y0_k; + } else { + /* Step: '/Step' */ + VFControl_B.Ton_e = VFControl_cal->Step_YFinal_d; + } + + /* End of Step: '/Step' */ + + /* Step: '/Step1' */ + Bias = VFControl_M->Timing.t[1]; + if (Bias < VFControl_cal->Step1_Time) { + /* Step: '/Step1' */ + VFControl_B.Toff_e = VFControl_cal->Step1_Y0_i; + } else { + /* Step: '/Step1' */ + VFControl_B.Toff_e = VFControl_cal->Step1_YFinal_k; + } + + /* End of Step: '/Step1' */ + + /* Sum: '/Sum4' */ + VFControl_B.Sum4 = VFControl_B.Ton_e + VFControl_B.Toff_e; + + /* DataTypeConversion: '/Data Type Conversion1' */ + VFControl_B.DataTypeConversion1_j = (VFControl_B.Sum4 != 0.0); + + /* DataTypeConversion: '/Data Type Conversion2' incorporates: + * Constant: '/valp_nom7' + */ + VFControl_B.DataTypeConversion2_m = (VFControl_cal->valp_nom7_Value != 0.0); + + /* Logic: '/Logical Operator' */ + VFControl_B.LogicalOperator_l = (VFControl_B.DataTypeConversion1_j && + VFControl_B.DataTypeConversion2_m); + + /* DataTypeConversion: '/Data Type Conversion' */ + VFControl_B.DataTypeConversion = VFControl_B.LogicalOperator_l; + + /* Gain: '/Gain1' */ + VFControl_B.Gain1 = VFControl_cal->HarmonicAgeneration_n_Harmo * + VFControl_B.Sum_n; + + /* Gain: '/Gain3' incorporates: + * Constant: '/Phase_Harmo' + */ + VFControl_B.Gain3_f = VFControl_cal->Gain3_Gain_l * + VFControl_cal->HarmonicAgeneration_Phase_Harmo; + + /* Sum: '/Sum1' incorporates: + * Constant: '/Phase_Harmo2' + * Constant: '/valp_nom2' + */ + VFControl_B.Sum1_m = VFControl_cal->HarmonicAgeneration_Seq_Harmo + + VFControl_cal->valp_nom2_Value_i; + + /* MultiPortSwitch: '/Multiport Switch' */ + switch (static_cast(VFControl_B.Sum1_m)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Zero-sequence' + */ + VFControl_B.MultiportSwitch_h[0] = VFControl_cal->Zerosequence_Value[0]; + VFControl_B.MultiportSwitch_h[1] = VFControl_cal->Zerosequence_Value[1]; + VFControl_B.MultiportSwitch_h[2] = VFControl_cal->Zerosequence_Value[2]; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Positive-sequence' + */ + VFControl_B.MultiportSwitch_h[0] = VFControl_cal->Positivesequence_Value[0]; + VFControl_B.MultiportSwitch_h[1] = VFControl_cal->Positivesequence_Value[1]; + VFControl_B.MultiportSwitch_h[2] = VFControl_cal->Positivesequence_Value[2]; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Negative-sequence' + */ + VFControl_B.MultiportSwitch_h[0] = VFControl_cal->Negativesequence_Value[0]; + VFControl_B.MultiportSwitch_h[1] = VFControl_cal->Negativesequence_Value[1]; + VFControl_B.MultiportSwitch_h[2] = VFControl_cal->Negativesequence_Value[2]; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch' */ + + /* Sum: '/Sum' */ + xk1 = VFControl_B.Gain1 + VFControl_B.Gain3_f; + + /* Sum: '/Sum' */ + VFControl_B.Sum_j[0] = xk1 + VFControl_B.MultiportSwitch_h[0]; + + /* Trigonometry: '/Trigonometric Function1' */ + Bias = std::sin(VFControl_B.Sum_j[0]); + VFControl_B.TrigonometricFunction1_d[0] = Bias; + + /* Product: '/Product1' incorporates: + * Constant: '/Phase_Harmo1' + */ + tmp_1 = VFControl_B.DataTypeConversion * + VFControl_cal->HarmonicAgeneration_Mag_Harmo; + + /* Product: '/Product1' */ + VFControl_B.Product1[0] = tmp_1 * Bias; + + /* Sum: '/Sum' */ + VFControl_B.Sum_j[1] = xk1 + VFControl_B.MultiportSwitch_h[1]; + + /* Trigonometry: '/Trigonometric Function1' */ + Bias = std::sin(VFControl_B.Sum_j[1]); + VFControl_B.TrigonometricFunction1_d[1] = Bias; + + /* Product: '/Product1' */ + VFControl_B.Product1[1] = tmp_1 * Bias; + + /* Sum: '/Sum' */ + VFControl_B.Sum_j[2] = xk1 + VFControl_B.MultiportSwitch_h[2]; + + /* Trigonometry: '/Trigonometric Function1' */ + Bias = std::sin(VFControl_B.Sum_j[2]); + VFControl_B.TrigonometricFunction1_d[2] = Bias; + + /* Product: '/Product1' */ + VFControl_B.Product1[2] = tmp_1 * Bias; + + /* Gain: '/Gain1' */ + VFControl_B.Gain1_m = VFControl_cal->HarmonicBgeneration_n_Harmo * + VFControl_B.Sum_n; + + /* Gain: '/Gain3' incorporates: + * Constant: '/Phase_Harmo' + */ + VFControl_B.Gain3_a = VFControl_cal->Gain3_Gain_j * + VFControl_cal->HarmonicBgeneration_Phase_Harmo; + + /* Sum: '/Sum1' incorporates: + * Constant: '/Phase_Harmo2' + * Constant: '/valp_nom2' + */ + VFControl_B.Sum1_m3 = VFControl_cal->HarmonicBgeneration_Seq_Harmo + + VFControl_cal->valp_nom2_Value_c; + + /* MultiPortSwitch: '/Multiport Switch' */ + switch (static_cast(VFControl_B.Sum1_m3)) { + case 1: + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Zero-sequence' + */ + VFControl_B.MultiportSwitch_n[0] = VFControl_cal->Zerosequence_Value_h[0]; + VFControl_B.MultiportSwitch_n[1] = VFControl_cal->Zerosequence_Value_h[1]; + VFControl_B.MultiportSwitch_n[2] = VFControl_cal->Zerosequence_Value_h[2]; + break; + + case 2: + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Positive-sequence' + */ + VFControl_B.MultiportSwitch_n[0] = VFControl_cal->Positivesequence_Value_o[0]; + VFControl_B.MultiportSwitch_n[1] = VFControl_cal->Positivesequence_Value_o[1]; + VFControl_B.MultiportSwitch_n[2] = VFControl_cal->Positivesequence_Value_o[2]; + break; + + default: + /* MultiPortSwitch: '/Multiport Switch' incorporates: + * Constant: '/Negative-sequence' + */ + VFControl_B.MultiportSwitch_n[0] = VFControl_cal->Negativesequence_Value_k[0]; + VFControl_B.MultiportSwitch_n[1] = VFControl_cal->Negativesequence_Value_k[1]; + VFControl_B.MultiportSwitch_n[2] = VFControl_cal->Negativesequence_Value_k[2]; + break; + } + + /* End of MultiPortSwitch: '/Multiport Switch' */ + + /* Sum: '/Sum' */ + xk1 = VFControl_B.Gain1_m + VFControl_B.Gain3_a; + + /* Sum: '/Sum' */ + VFControl_B.Sum_i[0] = xk1 + VFControl_B.MultiportSwitch_n[0]; + + /* Trigonometry: '/Trigonometric Function1' */ + tmp_1 = std::sin(VFControl_B.Sum_i[0]); + VFControl_B.TrigonometricFunction1_c[0] = tmp_1; + + /* Product: '/Product1' incorporates: + * Constant: '/Phase_Harmo1' + */ + Bias = VFControl_B.DataTypeConversion * + VFControl_cal->HarmonicBgeneration_Mag_Harmo; + + /* Product: '/Product1' */ + tmp_1 *= Bias; + VFControl_B.Product1_i[0] = tmp_1; + + /* Sum: '/Sum4' */ + tmp_1 += VFControl_B.Product1[0]; + VFControl_B.Sum4_o[0] = tmp_1; + + /* Sum: '/Sum8' */ + VFControl_B.Sum8[0] = VFControl_B.Product2[0] + tmp_1; + + /* Sum: '/Sum' */ + VFControl_B.Sum_i[1] = xk1 + VFControl_B.MultiportSwitch_n[1]; + + /* Trigonometry: '/Trigonometric Function1' */ + tmp_1 = std::sin(VFControl_B.Sum_i[1]); + VFControl_B.TrigonometricFunction1_c[1] = tmp_1; + + /* Product: '/Product1' */ + tmp_1 *= Bias; + VFControl_B.Product1_i[1] = tmp_1; + + /* Sum: '/Sum4' */ + tmp_1 += VFControl_B.Product1[1]; + VFControl_B.Sum4_o[1] = tmp_1; + + /* Sum: '/Sum8' */ + VFControl_B.Sum8[1] = VFControl_B.Product2[1] + tmp_1; + + /* Sum: '/Sum' */ + VFControl_B.Sum_i[2] = xk1 + VFControl_B.MultiportSwitch_n[2]; + + /* Trigonometry: '/Trigonometric Function1' */ + tmp_1 = std::sin(VFControl_B.Sum_i[2]); + VFControl_B.TrigonometricFunction1_c[2] = tmp_1; + + /* Product: '/Product1' */ + tmp_1 *= Bias; + VFControl_B.Product1_i[2] = tmp_1; + + /* Sum: '/Sum4' */ + tmp_1 += VFControl_B.Product1[2]; + VFControl_B.Sum4_o[2] = tmp_1; + + /* Sum: '/Sum8' */ + VFControl_B.Sum8[2] = VFControl_B.Product2[2] + tmp_1; + + /* Clock: '/Clock' */ + VFControl_B.Clock = VFControl_M->Timing.t[0]; + + /* Sum: '/Add1' incorporates: + * Constant: '/Constant3' + */ + VFControl_B.Add1 = VFControl_B.Clock + VFControl_cal->Constant3_Value_m; + + /* Math: '/Math Function' incorporates: + * Constant: '/Constant4' + */ + VFControl_B.MathFunction = rt_remd_snf(VFControl_B.Add1, + VFControl_cal->Constant4_Value_p); + + /* Gain: '/1\ib1' */ + VFControl_B.uib1 = VFControl_cal->uib1_Gain * VFControl_B.MathFunction; + + /* Lookup_n-D: '/1-D Lookup Table' incorporates: + * Gain: '/1\ib1' + */ + VFControl_B.uDLookupTable = look1_pbinlxpw(VFControl_B.uib1, + VFControl_cal->uDLookupTable_bp01Data_k, + VFControl_cal->uDLookupTable_tableData_d, &VFControl_DW.m_bpIndex, 2U); + + /* Sum: '/Add3' incorporates: + * Constant: '/Constant2' + */ + VFControl_B.Add3 = VFControl_B.uDLookupTable - + VFControl_cal->Constant2_Value_a; + + /* ModelReference: '/Model' incorporates: + * Constant: '/Constant' + */ + PWMGenerator(&VFControl_B.Sum8[0], &VFControl_B.Add3, + &VFControl_cal->Constant_Value_c, &VFControl_B.Model_o1, + &VFControl_B.Model_o2, &VFControl_B.Model_o3, + &(VFControl_DW.Model_InstanceData.rtb)); + + /* DigitalClock: '/Digital Clock' */ + VFControl_B.DigitalClock_m = VFControl_M->Timing.t[1]; + + /* Sum: '/Add1' incorporates: + * Constant: '/Constant3' + */ + VFControl_B.Add1_e = VFControl_B.DigitalClock_m + + VFControl_cal->Constant3_Value_ej; + + /* Math: '/Math Function' incorporates: + * Constant: '/Constant1' + */ + VFControl_B.MathFunction_l = rt_remd_snf(VFControl_B.Add1_e, + VFControl_cal->Constant1_Value_o); + + /* Gain: '/1\ib1' */ + VFControl_B.uib1_h = VFControl_cal->uib1_Gain_i * VFControl_B.MathFunction_l; + + /* Lookup_n-D: '/1-D Lookup Table' incorporates: + * Gain: '/1\ib1' + */ + VFControl_B.uDLookupTable_b = look1_pbinlxpw(VFControl_B.uib1_h, + VFControl_cal->uDLookupTable_bp01Data_i, + VFControl_cal->uDLookupTable_tableData_f, &VFControl_DW.m_bpIndex_e, 2U); + + /* Sum: '/Add3' incorporates: + * Constant: '/Constant2' + */ + VFControl_B.Add3_h = VFControl_B.uDLookupTable_b - + VFControl_cal->Constant2_Value_at; + + /* ModelReference: '/Model1' incorporates: + * Constant: '/Constant1' + */ + PWMGenerator(&VFControl_B.Sum8[1], &VFControl_B.Add3_h, + &VFControl_cal->Constant1_Value_ah, &VFControl_B.Model1_o1, + &VFControl_B.Model1_o2, &VFControl_B.Model1_o3, + &(VFControl_DW.Model1_InstanceData.rtb)); + + /* DigitalClock: '/Digital Clock' */ + VFControl_B.DigitalClock_ms = VFControl_M->Timing.t[1]; + + /* Sum: '/Add1' incorporates: + * Constant: '/Constant3' + */ + VFControl_B.Add1_l = VFControl_B.DigitalClock_ms + + VFControl_cal->Constant3_Value_mm; + + /* Math: '/Math Function' incorporates: + * Constant: '/Constant1' + */ + VFControl_B.MathFunction_o = rt_remd_snf(VFControl_B.Add1_l, + VFControl_cal->Constant1_Value_p); + + /* Gain: '/1\ib1' */ + VFControl_B.uib1_e = VFControl_cal->uib1_Gain_c * VFControl_B.MathFunction_o; + + /* Lookup_n-D: '/1-D Lookup Table' incorporates: + * Gain: '/1\ib1' + */ + VFControl_B.uDLookupTable_bk = look1_pbinlxpw(VFControl_B.uib1_e, + VFControl_cal->uDLookupTable_bp01Data_m, + VFControl_cal->uDLookupTable_tableData_h, &VFControl_DW.m_bpIndex_p, 2U); + + /* Sum: '/Add3' incorporates: + * Constant: '/Constant2' + */ + VFControl_B.Add3_n = VFControl_B.uDLookupTable_bk - + VFControl_cal->Constant2_Value_k; + + /* ModelReference: '/Model2' incorporates: + * Constant: '/Constant2' + */ + PWMGenerator(&VFControl_B.Sum8[2], &VFControl_B.Add3_n, + &VFControl_cal->Constant2_Value_a1, &VFControl_B.Model2_o1, + &VFControl_B.Model2_o2, &VFControl_B.Model2_o3, + &(VFControl_DW.Model2_InstanceData.rtb)); + + /* TransportDelay: '/Transport Delay' */ + { + real_T **uBuffer = (real_T**) + &VFControl_DW.TransportDelay_PWORK.TUbufferPtrs[0]; + real_T simTime = VFControl_M->Timing.t[0]; + real_T tMinusDelay = simTime - VFControl_cal->TransportDelay_Delay; + VFControl_B.TransportDelay = rt_TDelayInterpolate( + tMinusDelay, + 0.0, + *uBuffer, + VFControl_DW.TransportDelay_IWORK.CircularBufSize, + &VFControl_DW.TransportDelay_IWORK.Last, + VFControl_DW.TransportDelay_IWORK.Tail, + VFControl_DW.TransportDelay_IWORK.Head, + (VFControl_cal->TransportDelay_InitOutput), + 1, + 0); + } + + /* TransportDelay: '/Transport Delay' */ + { + real_T **uBuffer = (real_T**) + &VFControl_DW.TransportDelay_PWORK_m.TUbufferPtrs[0]; + real_T simTime = VFControl_M->Timing.t[0]; + real_T tMinusDelay = simTime - VFControl_cal->TransportDelay_Delay_l; + VFControl_B.TransportDelay_i = rt_TDelayInterpolate( + tMinusDelay, + 0.0, + *uBuffer, + VFControl_DW.TransportDelay_IWORK_g.CircularBufSize, + &VFControl_DW.TransportDelay_IWORK_g.Last, + VFControl_DW.TransportDelay_IWORK_g.Tail, + VFControl_DW.TransportDelay_IWORK_g.Head, + (VFControl_cal->TransportDelay_InitOutput_l), + 1, + 0); + } + + /* TransportDelay: '/Transport Delay' */ + { + real_T **uBuffer = (real_T**) + &VFControl_DW.TransportDelay_PWORK_f.TUbufferPtrs[0]; + real_T simTime = VFControl_M->Timing.t[0]; + real_T tMinusDelay = simTime - VFControl_cal->TransportDelay_Delay_c; + VFControl_B.TransportDelay_n = rt_TDelayInterpolate( + tMinusDelay, + 0.0, + *uBuffer, + VFControl_DW.TransportDelay_IWORK_m.CircularBufSize, + &VFControl_DW.TransportDelay_IWORK_m.Last, + VFControl_DW.TransportDelay_IWORK_m.Tail, + VFControl_DW.TransportDelay_IWORK_m.Head, + (VFControl_cal->TransportDelay_InitOutput_le), + 1, + 0); + } + + /* S-Function (sg_fpga_do_sf_a2): '/Digital output1' */ + + /* Level2 S-Function Block: '/Digital output1' (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[0]; + sfcnOutputs(rts,0); + } + + /* S-Function (sg_fpga_do_sf_a2): '/Digital output2' */ + + /* Level2 S-Function Block: '/Digital output2' (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[1]; + sfcnOutputs(rts,0); + } + + /* Switch: '/Switch' */ + if (VFControl_B.StateSpace_o2[0] >= VFControl_cal->Switch_Threshold_e) { + /* Gain: '/1//Rsw' */ + VFControl_B.uRsw_k = VFControl_cal->uRsw_Gain * VFControl_B.StateSpace_o1[0]; + + /* Switch: '/Switch' */ + VFControl_B.Switch = VFControl_B.uRsw_k; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/0 4' + */ + VFControl_B.Switch = VFControl_cal->u4_Value_l; + } + + /* End of Switch: '/Switch' */ + + /* Saturate: '/Saturation' */ + if (VFControl_B.Model_o1 > VFControl_cal->Saturation_UpperSat) { + xk1 = VFControl_cal->Saturation_UpperSat; + } else if (VFControl_B.Model_o1 < VFControl_cal->Saturation_LowerSat) { + xk1 = VFControl_cal->Saturation_LowerSat; + } else { + xk1 = VFControl_B.Model_o1; + } + + /* Saturate: '/Saturation' */ + VFControl_B.Saturation[0] = xk1; + + /* Saturate: '/Saturation' */ + if (VFControl_B.TransportDelay > VFControl_cal->Saturation_UpperSat) { + xk1 = VFControl_cal->Saturation_UpperSat; + } else if (VFControl_B.TransportDelay < VFControl_cal->Saturation_LowerSat) { + xk1 = VFControl_cal->Saturation_LowerSat; + } else { + xk1 = VFControl_B.TransportDelay; + } + + /* Saturate: '/Saturation' */ + VFControl_B.Saturation[1] = xk1; + + /* Saturate: '/Saturation' */ + if (VFControl_B.Model1_o1 > VFControl_cal->Saturation_UpperSat) { + xk1 = VFControl_cal->Saturation_UpperSat; + } else if (VFControl_B.Model1_o1 < VFControl_cal->Saturation_LowerSat) { + xk1 = VFControl_cal->Saturation_LowerSat; + } else { + xk1 = VFControl_B.Model1_o1; + } + + /* Saturate: '/Saturation' */ + VFControl_B.Saturation[2] = xk1; + + /* Saturate: '/Saturation' */ + if (VFControl_B.TransportDelay_i > VFControl_cal->Saturation_UpperSat) { + xk1 = VFControl_cal->Saturation_UpperSat; + } else if (VFControl_B.TransportDelay_i < VFControl_cal->Saturation_LowerSat) + { + xk1 = VFControl_cal->Saturation_LowerSat; + } else { + xk1 = VFControl_B.TransportDelay_i; + } + + /* Saturate: '/Saturation' */ + VFControl_B.Saturation[3] = xk1; + + /* Saturate: '/Saturation' */ + if (VFControl_B.Model2_o1 > VFControl_cal->Saturation_UpperSat) { + xk1 = VFControl_cal->Saturation_UpperSat; + } else if (VFControl_B.Model2_o1 < VFControl_cal->Saturation_LowerSat) { + xk1 = VFControl_cal->Saturation_LowerSat; + } else { + xk1 = VFControl_B.Model2_o1; + } + + /* Saturate: '/Saturation' */ + VFControl_B.Saturation[4] = xk1; + + /* Saturate: '/Saturation' */ + if (VFControl_B.TransportDelay_n > VFControl_cal->Saturation_UpperSat) { + xk1 = VFControl_cal->Saturation_UpperSat; + } else if (VFControl_B.TransportDelay_n < VFControl_cal->Saturation_LowerSat) + { + xk1 = VFControl_cal->Saturation_LowerSat; + } else { + xk1 = VFControl_B.TransportDelay_n; + } + + /* Saturate: '/Saturation' */ + VFControl_B.Saturation[5] = xk1; + + /* RelationalOperator: '/Compare' incorporates: + * Constant: '/Constant6' + * Constant: '/Constant' + */ + VFControl_B.Compare = (VFControl_cal->Constant6_Value_e <= + VFControl_cal->CompareToConstant_const); + + /* DataTypeConversion: '/Data Type Conversion1' */ + VFControl_B.DataTypeConversion1 = VFControl_B.Compare; + for (i = 0; i < 6; i++) { + /* DataTypeConversion: '/Data Type Conversion' */ + xk1 = VFControl_B.Saturation[i]; + VFControl_B.DataTypeConversion_p[i] = xk1; + + /* Product: '/Product4' */ + VFControl_B.Product4[i] = xk1 * VFControl_B.DataTypeConversion1; + } + + /* DataTypeConversion: '/Data Type Conversion' */ + VFControl_B.DataTypeConversion_f = VFControl_B.Product4[0]; + + /* Switch: '/Switch' */ + if (VFControl_B.StateSpace_o2[1] >= VFControl_cal->Switch_Threshold_p) { + /* Gain: '/1//Rsw' */ + VFControl_B.uRsw_c = VFControl_cal->uRsw_Gain_e * VFControl_B.StateSpace_o1 + [1]; + + /* Switch: '/Switch' */ + VFControl_B.Switch_e = VFControl_B.uRsw_c; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/0 4' + */ + VFControl_B.Switch_e = VFControl_cal->u4_Value_j; + } + + /* End of Switch: '/Switch' */ + + /* DataTypeConversion: '/Data Type Conversion' */ + VFControl_B.DataTypeConversion_l = VFControl_B.Product4[1]; + + /* Switch: '/Switch' */ + if (VFControl_B.StateSpace_o2[2] >= VFControl_cal->Switch_Threshold_i) { + /* Gain: '/1//Rsw' */ + VFControl_B.uRsw_g = VFControl_cal->uRsw_Gain_l * VFControl_B.StateSpace_o1 + [2]; + + /* Switch: '/Switch' */ + VFControl_B.Switch_k = VFControl_B.uRsw_g; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/0 4' + */ + VFControl_B.Switch_k = VFControl_cal->u4_Value_c; + } + + /* End of Switch: '/Switch' */ + + /* DataTypeConversion: '/Data Type Conversion' */ + VFControl_B.DataTypeConversion_h = VFControl_B.Product4[2]; + + /* Switch: '/Switch' */ + if (VFControl_B.StateSpace_o2[3] >= VFControl_cal->Switch_Threshold_o) { + /* Gain: '/1//Rsw' */ + VFControl_B.uRsw_i = VFControl_cal->uRsw_Gain_k * VFControl_B.StateSpace_o1 + [3]; + + /* Switch: '/Switch' */ + VFControl_B.Switch_i = VFControl_B.uRsw_i; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/0 4' + */ + VFControl_B.Switch_i = VFControl_cal->u4_Value_m; + } + + /* End of Switch: '/Switch' */ + + /* DataTypeConversion: '/Data Type Conversion' */ + VFControl_B.DataTypeConversion_k = VFControl_B.Product4[3]; + + /* Switch: '/Switch' */ + if (VFControl_B.StateSpace_o2[4] >= VFControl_cal->Switch_Threshold_a) { + /* Gain: '/1//Rsw' */ + VFControl_B.uRsw_n = VFControl_cal->uRsw_Gain_m * VFControl_B.StateSpace_o1 + [4]; + + /* Switch: '/Switch' */ + VFControl_B.Switch_a = VFControl_B.uRsw_n; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/0 4' + */ + VFControl_B.Switch_a = VFControl_cal->u4_Value_lk; + } + + /* End of Switch: '/Switch' */ + + /* DataTypeConversion: '/Data Type Conversion' */ + VFControl_B.DataTypeConversion_i = VFControl_B.Product4[4]; + + /* Switch: '/Switch' */ + if (VFControl_B.StateSpace_o2[5] >= VFControl_cal->Switch_Threshold_n) { + /* Gain: '/1//Rsw' */ + VFControl_B.uRsw = VFControl_cal->uRsw_Gain_k4 * VFControl_B.StateSpace_o1[5]; + + /* Switch: '/Switch' */ + VFControl_B.Switch_a4 = VFControl_B.uRsw; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/0 4' + */ + VFControl_B.Switch_a4 = VFControl_cal->u4_Value_o; + } + + /* End of Switch: '/Switch' */ + + /* DataTypeConversion: '/Data Type Conversion' */ + VFControl_B.DataTypeConversion_c = VFControl_B.Product4[5]; + + /* Product: '/Product' incorporates: + * Constant: '/Constant' + */ + VFControl_B.Product_n = VFControl_B.Model_o1 * VFControl_cal->Constant_Value_a; + + /* Product: '/Product' incorporates: + * Constant: '/Constant' + */ + VFControl_B.Product_b = VFControl_B.Model1_o1 * + VFControl_cal->Constant_Value_g; + + /* Product: '/Product' incorporates: + * Constant: '/Constant' + */ + VFControl_B.Product_l = VFControl_B.Model2_o1 * + VFControl_cal->Constant_Value_n5; + + /* RelationalOperator: '/Relational Operator2' incorporates: + * Constant: '/Constant3' + * Constant: '/valp_nom3' + */ + VFControl_B.Frequency = (VFControl_cal->valp_nom3_Value == + VFControl_cal->Constant3_Value_n); + + /* Switch: '/Switch4' */ + if (VFControl_B.Frequency) { + /* Switch: '/Switch4' */ + VFControl_B.Switch4 = VFControl_B.Switch3; + } else { + /* Switch: '/Switch4' incorporates: + * Constant: '/Constant5' + */ + VFControl_B.Switch4 = VFControl_cal->Constant5_Value_ct; + } + + /* End of Switch: '/Switch4' */ + + /* Gain: '/Gain2' */ + VFControl_B.Gain2 = VFControl_cal->Gain2_Gain_h * VFControl_B.Switch4; + + /* Sum: '/Sum1' incorporates: + * Constant: '/valp_nom1' + */ + VFControl_B.Sum1_o = VFControl_cal->valp_nom1_Value_g + VFControl_B.Switch4; + + /* Gain: '/Gain3' */ + VFControl_B.Gain3_m[0] = VFControl_cal->Gain3_Gain_i * VFControl_B.Switch5_b[0]; + VFControl_B.Gain3_m[1] = VFControl_cal->Gain3_Gain_i * VFControl_B.Switch5_b[1]; + VFControl_B.Gain3_m[2] = VFControl_cal->Gain3_Gain_i * VFControl_B.Switch5_b[2]; + + /* Math: '/Math Function' incorporates: + * Constant: '/Constant7' + */ + VFControl_B.wtrad = rt_modd_snf(VFControl_B.Sum7[0], + VFControl_cal->Constant7_Value); + + /* Switch: '/Switch' */ + if (VFControl_B.Ton >= VFControl_cal->Switch_Threshold_d) { + /* RelationalOperator: '/Relational Operator' incorporates: + * Constant: '/valp_nom5' + * Constant: '/Constant' + */ + VFControl_B.RelationalOperator = (VFControl_cal->valp_nom5_Value == + VFControl_cal->Constant_Value_p); + + /* Switch: '/Switch1' */ + if (VFControl_B.RelationalOperator) { + /* Switch: '/Switch1' incorporates: + * Constant: '/valp_nom7' + */ + VFControl_B.Switch1_j = VFControl_cal->Variationvaluesteprampmod_Var_p; + } else { + /* Switch: '/Switch1' incorporates: + * Constant: '/Constant2' + */ + VFControl_B.Switch1_j = VFControl_cal->Constant2_Value_i; + } + + /* End of Switch: '/Switch1' */ + + /* Switch: '/Switch' */ + VFControl_B.Switch_c = VFControl_B.Switch1_j; + } else { + /* Switch: '/Switch' incorporates: + * Constant: '/Constant4' + */ + VFControl_B.Switch_c = VFControl_cal->Constant4_Value_f; + } + + /* End of Switch: '/Switch' */ + + /* Gain: '/do not delete this gain' */ + VFControl_B.donotdeletethisgain = VFControl_cal->donotdeletethisgain_Gain * + VFControl_B.StateSpace_o1[8]; + + /* Gain: '/do not delete this gain' */ + VFControl_B.donotdeletethisgain_k = VFControl_cal->donotdeletethisgain_Gain_d * + VFControl_B.StateSpace_o1[9]; + + /* Gain: '/do not delete this gain' */ + VFControl_B.donotdeletethisgain_o = VFControl_cal->donotdeletethisgain_Gain_h * + VFControl_B.StateSpace_o1[10]; + + /* Gain: '/Kv1' */ + VFControl_B.Kv1[0] = VFControl_cal->Kv1_Gain * VFControl_B.donotdeletethisgain; + VFControl_B.Kv1[1] = VFControl_cal->Kv1_Gain * + VFControl_B.donotdeletethisgain_k; + VFControl_B.Kv1[2] = VFControl_cal->Kv1_Gain * + VFControl_B.donotdeletethisgain_o; + + /* Gain: '/do not delete this gain' */ + VFControl_B.donotdeletethisgain_kv = VFControl_cal->donotdeletethisgain_Gain_j + * VFControl_B.StateSpace_o1[11]; + + /* Gain: '/do not delete this gain' */ + VFControl_B.donotdeletethisgain_b = VFControl_cal->donotdeletethisgain_Gain_n * + VFControl_B.StateSpace_o1[12]; + + /* Gain: '/do not delete this gain' */ + VFControl_B.donotdeletethisgain_h = VFControl_cal->donotdeletethisgain_Gain_p * + VFControl_B.StateSpace_o1[13]; + + /* Gain: '/Kv' */ + VFControl_B.Kv[0] = VFControl_cal->Kv_Gain * + VFControl_B.donotdeletethisgain_kv; + VFControl_B.Kv[1] = VFControl_cal->Kv_Gain * VFControl_B.donotdeletethisgain_b; + VFControl_B.Kv[2] = VFControl_cal->Kv_Gain * VFControl_B.donotdeletethisgain_h; + + /* user code (Output function Trailer for TID0) */ + { + if (0) { + io3xx_sgdma_feedSequential(1); + } + } + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[0] = VFControl_B.IC[0]; + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[0] = VFControl_B.xk1[0]; + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[1] = VFControl_B.IC[1]; + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[1] = VFControl_B.xk1[1]; + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[2] = VFControl_B.IC[2]; + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[2] = VFControl_B.xk1[2]; + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[3] = VFControl_B.IC[3]; + + /* Update for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[3] = VFControl_B.xk1[3]; + + /* Update for DiscreteIntegrator: '/Rotor angle thetam' */ + VFControl_DW.Rotoranglethetam_DSTATE += + VFControl_cal->Rotoranglethetam_gainval * VFControl_B.web_psb; + + /* Update for UnitDelay: '/wm_delay' */ + VFControl_DW.wm_delay_DSTATE = VFControl_B.Rotorspeedwm; + + /* Update for UnitDelay: '/wm_predict' */ + VFControl_DW.wm_predict_DSTATE = VFControl_B.wm_delay; + + /* Update for S-Function (sfun_spssw_discc): '/State-Space' incorporates: + * Constant: '/DC' + * Constant: '/SwitchCurrents' + */ + { + int_T *gState = (int_T*)VFControl_DW.StateSpace_PWORK.G_STATE; + + /* Store switch gates values for next step */ + *(gState++) = (int_T) VFControl_B.DataTypeConversion_f; + *(gState++) = (int_T) VFControl_B.DataTypeConversion_l; + *(gState++) = (int_T) VFControl_B.DataTypeConversion_h; + *(gState++) = (int_T) VFControl_B.DataTypeConversion_k; + *(gState++) = (int_T) VFControl_B.DataTypeConversion_i; + *(gState++) = (int_T) VFControl_B.DataTypeConversion_c; + } + + /* Update for UnitDelay: '/voltages' */ + VFControl_DW.voltages_DSTATE[0] = VFControl_B.MultiportSwitch1_f[0]; + VFControl_DW.voltages_DSTATE[2] = VFControl_B.MultiportSwitch_p2[0]; + VFControl_DW.voltages_DSTATE[1] = VFControl_B.MultiportSwitch1_f[1]; + VFControl_DW.voltages_DSTATE[3] = VFControl_B.MultiportSwitch_p2[1]; + + /* Update for DiscreteIntegrator: '/Rotor speed(wm)' */ + VFControl_DW.Rotorspeedwm_SYSTEM_ENABLE = 0U; + VFControl_DW.Rotorspeedwm_DSTATE = VFControl_cal->Rotorspeedwm_gainval * + VFControl_B.u_2H + VFControl_B.Rotorspeedwm; + + /* Update for DiscreteIntegrator: '/Discrete-Time Integrator1' */ + VFControl_DW.DiscreteTimeIntegrator1_DSTATE += + VFControl_cal->DiscreteTimeIntegrator1_gainval * VFControl_B.Switch_c; + + /* Update for UnitDelay: '/Unit Delay1' */ + VFControl_DW.UnitDelay1_DSTATE = VFControl_B.Switch2_d; + + /* Update for DiscreteIntegrator: '/Discrete-Time Integrator' */ + VFControl_DW.DiscreteTimeIntegrator_DSTATE += + VFControl_cal->DiscreteTimeIntegrator_gainval * VFControl_B.Gain2; + + /* Update for TransportDelay: '/Transport Delay' */ + { + real_T **uBuffer = (real_T**) + &VFControl_DW.TransportDelay_PWORK.TUbufferPtrs[0]; + real_T simTime = VFControl_M->Timing.t[0]; + VFControl_DW.TransportDelay_IWORK.Head = + ((VFControl_DW.TransportDelay_IWORK.Head < + (VFControl_DW.TransportDelay_IWORK.CircularBufSize-1)) ? + (VFControl_DW.TransportDelay_IWORK.Head+1) : 0); + if (VFControl_DW.TransportDelay_IWORK.Head == + VFControl_DW.TransportDelay_IWORK.Tail) { + VFControl_DW.TransportDelay_IWORK.Tail = + ((VFControl_DW.TransportDelay_IWORK.Tail < + (VFControl_DW.TransportDelay_IWORK.CircularBufSize-1)) ? + (VFControl_DW.TransportDelay_IWORK.Tail+1) : 0); + } + + (*uBuffer + VFControl_DW.TransportDelay_IWORK.CircularBufSize) + [VFControl_DW.TransportDelay_IWORK.Head] = simTime; + (*uBuffer)[VFControl_DW.TransportDelay_IWORK.Head] = VFControl_B.Product_n; + } + + /* Update for TransportDelay: '/Transport Delay' */ + { + real_T **uBuffer = (real_T**) + &VFControl_DW.TransportDelay_PWORK_m.TUbufferPtrs[0]; + real_T simTime = VFControl_M->Timing.t[0]; + VFControl_DW.TransportDelay_IWORK_g.Head = + ((VFControl_DW.TransportDelay_IWORK_g.Head < + (VFControl_DW.TransportDelay_IWORK_g.CircularBufSize-1)) ? + (VFControl_DW.TransportDelay_IWORK_g.Head+1) : 0); + if (VFControl_DW.TransportDelay_IWORK_g.Head == + VFControl_DW.TransportDelay_IWORK_g.Tail) { + VFControl_DW.TransportDelay_IWORK_g.Tail = + ((VFControl_DW.TransportDelay_IWORK_g.Tail < + (VFControl_DW.TransportDelay_IWORK_g.CircularBufSize-1)) ? + (VFControl_DW.TransportDelay_IWORK_g.Tail+1) : 0); + } + + (*uBuffer + VFControl_DW.TransportDelay_IWORK_g.CircularBufSize) + [VFControl_DW.TransportDelay_IWORK_g.Head] = simTime; + (*uBuffer)[VFControl_DW.TransportDelay_IWORK_g.Head] = VFControl_B.Product_b; + } + + /* Update for TransportDelay: '/Transport Delay' */ + { + real_T **uBuffer = (real_T**) + &VFControl_DW.TransportDelay_PWORK_f.TUbufferPtrs[0]; + real_T simTime = VFControl_M->Timing.t[0]; + VFControl_DW.TransportDelay_IWORK_m.Head = + ((VFControl_DW.TransportDelay_IWORK_m.Head < + (VFControl_DW.TransportDelay_IWORK_m.CircularBufSize-1)) ? + (VFControl_DW.TransportDelay_IWORK_m.Head+1) : 0); + if (VFControl_DW.TransportDelay_IWORK_m.Head == + VFControl_DW.TransportDelay_IWORK_m.Tail) { + VFControl_DW.TransportDelay_IWORK_m.Tail = + ((VFControl_DW.TransportDelay_IWORK_m.Tail < + (VFControl_DW.TransportDelay_IWORK_m.CircularBufSize-1)) ? + (VFControl_DW.TransportDelay_IWORK_m.Tail+1) : 0); + } + + (*uBuffer + VFControl_DW.TransportDelay_IWORK_m.CircularBufSize) + [VFControl_DW.TransportDelay_IWORK_m.Head] = simTime; + (*uBuffer)[VFControl_DW.TransportDelay_IWORK_m.Head] = VFControl_B.Product_l; + } + + /* Update absolute time */ + /* 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 (!(++VFControl_M->Timing.clockTick0)) { + ++VFControl_M->Timing.clockTickH0; + } + + VFControl_M->Timing.t[0] = VFControl_M->Timing.clockTick0 * + VFControl_M->Timing.stepSize0 + VFControl_M->Timing.clockTickH0 * + VFControl_M->Timing.stepSize0 * 4294967296.0; + + /* Update absolute time */ + /* The "clockTick1" counts the number of times the code of this task has + * been executed. The absolute time is the multiplication of "clockTick1" + * and "Timing.stepSize1". Size of "clockTick1" 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.clockTick1 and the high bits + * Timing.clockTickH1. When the low bit overflows to 0, the high bits increment. + */ + if (!(++VFControl_M->Timing.clockTick1)) { + ++VFControl_M->Timing.clockTickH1; + } + + VFControl_M->Timing.t[1] = VFControl_M->Timing.clockTick1 * + VFControl_M->Timing.stepSize1 + VFControl_M->Timing.clockTickH1 * + VFControl_M->Timing.stepSize1 * 4294967296.0; +} + +/* Model step function for TID2 */ +void VFControl_step2(void) /* Sample time: [0.0005s, 0.0s] */ +{ + /* UnitDelay: '/Unit Delay' */ + VFControl_B.UnitDelay = VFControl_DW.UnitDelay_DSTATE; + + /* Update for UnitDelay: '/Unit Delay' */ + VFControl_DW.UnitDelay_DSTATE = VFControl_B.UnitDelay; + + /* Update absolute time */ + /* The "clockTick2" counts the number of times the code of this task has + * been executed. The resolution of this integer timer is 0.0005, which is the step size + * of the task. Size of "clockTick2" 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.clockTick2 and the high bits + * Timing.clockTickH2. When the low bit overflows to 0, the high bits increment. + */ + VFControl_M->Timing.clockTick2++; + if (!VFControl_M->Timing.clockTick2) { + VFControl_M->Timing.clockTickH2++; + } +} + +/* Model initialize function */ +void VFControl_initialize(void) +{ + /* Registration code */ + + /* initialize non-finites */ + rt_InitInfAndNaN(sizeof(real_T)); + + /* Set task counter limit used by the static main program */ + (VFControl_M)->Timing.TaskCounters.cLimit[0] = 1; + (VFControl_M)->Timing.TaskCounters.cLimit[1] = 1; + (VFControl_M)->Timing.TaskCounters.cLimit[2] = 5; + + { + /* Setup solver object */ + rtsiSetSimTimeStepPtr(&VFControl_M->solverInfo, + &VFControl_M->Timing.simTimeStep); + rtsiSetTPtr(&VFControl_M->solverInfo, &rtmGetTPtr(VFControl_M)); + rtsiSetStepSizePtr(&VFControl_M->solverInfo, &VFControl_M->Timing.stepSize0); + rtsiSetErrorStatusPtr(&VFControl_M->solverInfo, (&rtmGetErrorStatus + (VFControl_M))); + rtsiSetRTModelPtr(&VFControl_M->solverInfo, VFControl_M); + } + + rtsiSetSimTimeStep(&VFControl_M->solverInfo, MAJOR_TIME_STEP); + rtsiSetIsMinorTimeStepWithModeChange(&VFControl_M->solverInfo, false); + rtsiSetIsContModeFrozen(&VFControl_M->solverInfo, false); + rtsiSetSolverName(&VFControl_M->solverInfo,"FixedStepDiscrete"); + VFControl_M->solverInfoPtr = (&VFControl_M->solverInfo); + + /* Initialize timing info */ + { + int_T *mdlTsMap = VFControl_M->Timing.sampleTimeTaskIDArray; + mdlTsMap[0] = 0; + mdlTsMap[1] = 1; + mdlTsMap[2] = 2; + + /* polyspace +2 MISRA2012:D4.1 [Justified:Low] "VFControl_M points to + static memory which is guaranteed to be non-NULL" */ + VFControl_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]); + VFControl_M->Timing.sampleTimes = (&VFControl_M->Timing.sampleTimesArray[0]); + VFControl_M->Timing.offsetTimes = (&VFControl_M->Timing.offsetTimesArray[0]); + + /* task periods */ + VFControl_M->Timing.sampleTimes[0] = (0.0); + VFControl_M->Timing.sampleTimes[1] = (0.0001); + VFControl_M->Timing.sampleTimes[2] = (0.0005); + + /* task offsets */ + VFControl_M->Timing.offsetTimes[0] = (0.0); + VFControl_M->Timing.offsetTimes[1] = (0.0); + VFControl_M->Timing.offsetTimes[2] = (0.0); + } + + rtmSetTPtr(VFControl_M, &VFControl_M->Timing.tArray[0]); + + { + int_T *mdlSampleHits = VFControl_M->Timing.sampleHitArray; + int_T *mdlPerTaskSampleHits = VFControl_M->Timing.perTaskSampleHitsArray; + VFControl_M->Timing.perTaskSampleHits = (&mdlPerTaskSampleHits[0]); + mdlSampleHits[0] = 1; + VFControl_M->Timing.sampleHits = (&mdlSampleHits[0]); + } + + rtmSetTFinal(VFControl_M, -1); + VFControl_M->Timing.stepSize0 = 0.0001; + VFControl_M->Timing.stepSize1 = 0.0001; + VFControl_M->solverInfoPtr = (&VFControl_M->solverInfo); + VFControl_M->Timing.stepSize = (0.0001); + rtsiSetFixedStepSize(&VFControl_M->solverInfo, 0.0001); + rtsiSetSolverMode(&VFControl_M->solverInfo, SOLVER_MODE_MULTITASKING); + + /* block I/O */ + (void) std::memset((static_cast(&VFControl_B)), 0, + sizeof(B_VFControl_T)); + + /* states (dwork) */ + (void) std::memset(static_cast(&VFControl_DW), 0, + sizeof(DW_VFControl_T)); + + /* child S-Function registration */ + { + RTWSfcnInfo *sfcnInfo = &VFControl_M->NonInlinedSFcns.sfcnInfo; + VFControl_M->sfcnInfo = (sfcnInfo); + rtssSetErrorStatusPtr(sfcnInfo, (&rtmGetErrorStatus(VFControl_M))); + VFControl_M->Sizes.numSampTimes = (3); + rtssSetNumRootSampTimesPtr(sfcnInfo, &VFControl_M->Sizes.numSampTimes); + VFControl_M->NonInlinedSFcns.taskTimePtrs[0] = (&rtmGetTPtr(VFControl_M)[0]); + VFControl_M->NonInlinedSFcns.taskTimePtrs[1] = (&rtmGetTPtr(VFControl_M)[1]); + VFControl_M->NonInlinedSFcns.taskTimePtrs[2] = (&rtmGetTPtr(VFControl_M)[2]); + rtssSetTPtrPtr(sfcnInfo,VFControl_M->NonInlinedSFcns.taskTimePtrs); + rtssSetTStartPtr(sfcnInfo, &rtmGetTStart(VFControl_M)); + rtssSetTFinalPtr(sfcnInfo, &rtmGetTFinal(VFControl_M)); + rtssSetTimeOfLastOutputPtr(sfcnInfo, &rtmGetTimeOfLastOutput(VFControl_M)); + rtssSetStepSizePtr(sfcnInfo, &VFControl_M->Timing.stepSize); + rtssSetStopRequestedPtr(sfcnInfo, &rtmGetStopRequested(VFControl_M)); + rtssSetDerivCacheNeedsResetPtr(sfcnInfo, &VFControl_M->derivCacheNeedsReset); + rtssSetZCCacheNeedsResetPtr(sfcnInfo, &VFControl_M->zCCacheNeedsReset); + rtssSetContTimeOutputInconsistentWithStateAtMajorStepPtr(sfcnInfo, + &VFControl_M->CTOutputIncnstWithState); + rtssSetSampleHitsPtr(sfcnInfo, &VFControl_M->Timing.sampleHits); + rtssSetPerTaskSampleHitsPtr(sfcnInfo, &VFControl_M->Timing.perTaskSampleHits); + rtssSetSimModePtr(sfcnInfo, &VFControl_M->simMode); + rtssSetSolverInfoPtr(sfcnInfo, &VFControl_M->solverInfoPtr); + } + + VFControl_M->Sizes.numSFcns = (2); + + /* register each child */ + { + (void) std::memset(static_cast + (&VFControl_M->NonInlinedSFcns.childSFunctions[0]), 0, + 2*sizeof(SimStruct)); + VFControl_M->childSfunctions = + (&VFControl_M->NonInlinedSFcns.childSFunctionPtrs[0]); + VFControl_M->childSfunctions[0] = + (&VFControl_M->NonInlinedSFcns.childSFunctions[0]); + VFControl_M->childSfunctions[1] = + (&VFControl_M->NonInlinedSFcns.childSFunctions[1]); + + /* Level2 S-Function Block: VFControl//Digital output1 (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[0]; + + /* timing info */ + time_T *sfcnPeriod = VFControl_M->NonInlinedSFcns.Sfcn0.sfcnPeriod; + time_T *sfcnOffset = VFControl_M->NonInlinedSFcns.Sfcn0.sfcnOffset; + int_T *sfcnTsMap = VFControl_M->NonInlinedSFcns.Sfcn0.sfcnTsMap; + (void) std::memset(static_cast(sfcnPeriod), 0, + sizeof(time_T)*1); + (void) std::memset(static_cast(sfcnOffset), 0, + sizeof(time_T)*1); + ssSetSampleTimePtr(rts, &sfcnPeriod[0]); + ssSetOffsetTimePtr(rts, &sfcnOffset[0]); + ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap); + + { + ssSetBlkInfo2Ptr(rts, &VFControl_M->NonInlinedSFcns.blkInfo2[0]); + } + + _ssSetBlkInfo2PortInfo2Ptr(rts, + &VFControl_M->NonInlinedSFcns.inputOutputPortInfo2[0]); + + /* Set up the mdlInfo pointer */ + ssSetRTWSfcnInfo(rts, VFControl_M->sfcnInfo); + + /* Allocate memory of model methods 2 */ + { + ssSetModelMethods2(rts, &VFControl_M->NonInlinedSFcns.methods2[0]); + } + + /* Allocate memory of model methods 3 */ + { + ssSetModelMethods3(rts, &VFControl_M->NonInlinedSFcns.methods3[0]); + } + + /* Allocate memory of model methods 4 */ + { + ssSetModelMethods4(rts, &VFControl_M->NonInlinedSFcns.methods4[0]); + } + + /* Allocate memory for states auxilliary information */ + { + ssSetStatesInfo2(rts, &VFControl_M->NonInlinedSFcns.statesInfo2[0]); + ssSetPeriodicStatesInfo(rts, + &VFControl_M->NonInlinedSFcns.periodicStatesInfo[0]); + } + + /* inputs */ + { + _ssSetNumInputPorts(rts, 3); + ssSetPortInfoForInputs(rts, + &VFControl_M->NonInlinedSFcns.Sfcn0.inputPortInfo[0]); + ssSetPortInfoForInputs(rts, + &VFControl_M->NonInlinedSFcns.Sfcn0.inputPortInfo[0]); + _ssSetPortInfo2ForInputUnits(rts, + &VFControl_M->NonInlinedSFcns.Sfcn0.inputPortUnits[0]); + ssSetInputPortUnit(rts, 0, 0); + ssSetInputPortUnit(rts, 1, 0); + ssSetInputPortUnit(rts, 2, 0); + _ssSetPortInfo2ForInputCoSimAttribute(rts, + &VFControl_M->NonInlinedSFcns.Sfcn0.inputPortCoSimAttribute[0]); + ssSetInputPortIsContinuousQuantity(rts, 0, 0); + ssSetInputPortIsContinuousQuantity(rts, 1, 0); + ssSetInputPortIsContinuousQuantity(rts, 2, 0); + + /* port 0 */ + { + ssSetInputPortRequiredContiguous(rts, 0, 1); + ssSetInputPortSignal(rts, 0, &VFControl_B.TransportDelay); + _ssSetInputPortNumDimensions(rts, 0, 1); + ssSetInputPortWidthAsInt(rts, 0, 1); + } + + /* port 1 */ + { + ssSetInputPortRequiredContiguous(rts, 1, 1); + ssSetInputPortSignal(rts, 1, &VFControl_B.TransportDelay_i); + _ssSetInputPortNumDimensions(rts, 1, 1); + ssSetInputPortWidthAsInt(rts, 1, 1); + } + + /* port 2 */ + { + ssSetInputPortRequiredContiguous(rts, 2, 1); + ssSetInputPortSignal(rts, 2, &VFControl_B.TransportDelay_n); + _ssSetInputPortNumDimensions(rts, 2, 1); + ssSetInputPortWidthAsInt(rts, 2, 1); + } + } + + /* path info */ + ssSetModelName(rts, "Digital output1"); + ssSetPath(rts, "VFControl/Digital output1"); + ssSetRTModel(rts,VFControl_M); + ssSetParentSS(rts, (NULL)); + ssSetRootSS(rts, rts); + ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2); + + /* parameters */ + { + mxArray **sfcnParams = (mxArray **) + &VFControl_M->NonInlinedSFcns.Sfcn0.params; + ssSetSFcnParamsCount(rts, 6); + ssSetSFcnParamsPtr(rts, &sfcnParams[0]); + ssSetSFcnParam(rts, 0, (mxArray*)VFControl_cal->Digitaloutput1_P1_Size); + ssSetSFcnParam(rts, 1, (mxArray*)VFControl_cal->Digitaloutput1_P2_Size); + ssSetSFcnParam(rts, 2, (mxArray*)VFControl_cal->Digitaloutput1_P3_Size); + ssSetSFcnParam(rts, 3, (mxArray*)VFControl_cal->Digitaloutput1_P4_Size); + ssSetSFcnParam(rts, 4, (mxArray*)VFControl_cal->Digitaloutput1_P5_Size); + ssSetSFcnParam(rts, 5, (mxArray*)VFControl_cal->Digitaloutput1_P6_Size); + } + + /* work vectors */ + ssSetPWork(rts, (void **) &VFControl_DW.Digitaloutput1_PWORK[0]); + + { + struct _ssDWorkRecord *dWorkRecord = (struct _ssDWorkRecord *) + &VFControl_M->NonInlinedSFcns.Sfcn0.dWork; + struct _ssDWorkAuxRecord *dWorkAuxRecord = (struct _ssDWorkAuxRecord *) + &VFControl_M->NonInlinedSFcns.Sfcn0.dWorkAux; + ssSetSFcnDWork(rts, dWorkRecord); + ssSetSFcnDWorkAux(rts, dWorkAuxRecord); + ssSetNumDWorkAsInt(rts, 1); + + /* PWORK */ + ssSetDWorkWidthAsInt(rts, 0, 2); + ssSetDWorkDataType(rts, 0,SS_POINTER); + ssSetDWorkComplexSignal(rts, 0, 0); + ssSetDWork(rts, 0, &VFControl_DW.Digitaloutput1_PWORK[0]); + } + + /* registration */ + sg_fpga_do_sf_a2(rts); + sfcnInitializeSizes(rts); + sfcnInitializeSampleTimes(rts); + + /* adjust sample time */ + ssSetSampleTime(rts, 0, 0.0001); + ssSetOffsetTime(rts, 0, 0.0); + sfcnTsMap[0] = 1; + + /* set compiled values of dynamic vector attributes */ + ssSetNumNonsampledZCsAsInt(rts, 0); + + /* Update connectivity flags for each port */ + _ssSetInputPortConnected(rts, 0, 1); + _ssSetInputPortConnected(rts, 1, 1); + _ssSetInputPortConnected(rts, 2, 1); + + /* Update the BufferDstPort flags for each input port */ + ssSetInputPortBufferDstPort(rts, 0, -1); + ssSetInputPortBufferDstPort(rts, 1, -1); + ssSetInputPortBufferDstPort(rts, 2, -1); + } + + /* Level2 S-Function Block: VFControl//Digital output2 (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[1]; + + /* timing info */ + time_T *sfcnPeriod = VFControl_M->NonInlinedSFcns.Sfcn1.sfcnPeriod; + time_T *sfcnOffset = VFControl_M->NonInlinedSFcns.Sfcn1.sfcnOffset; + int_T *sfcnTsMap = VFControl_M->NonInlinedSFcns.Sfcn1.sfcnTsMap; + (void) std::memset(static_cast(sfcnPeriod), 0, + sizeof(time_T)*1); + (void) std::memset(static_cast(sfcnOffset), 0, + sizeof(time_T)*1); + ssSetSampleTimePtr(rts, &sfcnPeriod[0]); + ssSetOffsetTimePtr(rts, &sfcnOffset[0]); + ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap); + + { + ssSetBlkInfo2Ptr(rts, &VFControl_M->NonInlinedSFcns.blkInfo2[1]); + } + + _ssSetBlkInfo2PortInfo2Ptr(rts, + &VFControl_M->NonInlinedSFcns.inputOutputPortInfo2[1]); + + /* Set up the mdlInfo pointer */ + ssSetRTWSfcnInfo(rts, VFControl_M->sfcnInfo); + + /* Allocate memory of model methods 2 */ + { + ssSetModelMethods2(rts, &VFControl_M->NonInlinedSFcns.methods2[1]); + } + + /* Allocate memory of model methods 3 */ + { + ssSetModelMethods3(rts, &VFControl_M->NonInlinedSFcns.methods3[1]); + } + + /* Allocate memory of model methods 4 */ + { + ssSetModelMethods4(rts, &VFControl_M->NonInlinedSFcns.methods4[1]); + } + + /* Allocate memory for states auxilliary information */ + { + ssSetStatesInfo2(rts, &VFControl_M->NonInlinedSFcns.statesInfo2[1]); + ssSetPeriodicStatesInfo(rts, + &VFControl_M->NonInlinedSFcns.periodicStatesInfo[1]); + } + + /* inputs */ + { + _ssSetNumInputPorts(rts, 3); + ssSetPortInfoForInputs(rts, + &VFControl_M->NonInlinedSFcns.Sfcn1.inputPortInfo[0]); + ssSetPortInfoForInputs(rts, + &VFControl_M->NonInlinedSFcns.Sfcn1.inputPortInfo[0]); + _ssSetPortInfo2ForInputUnits(rts, + &VFControl_M->NonInlinedSFcns.Sfcn1.inputPortUnits[0]); + ssSetInputPortUnit(rts, 0, 0); + ssSetInputPortUnit(rts, 1, 0); + ssSetInputPortUnit(rts, 2, 0); + _ssSetPortInfo2ForInputCoSimAttribute(rts, + &VFControl_M->NonInlinedSFcns.Sfcn1.inputPortCoSimAttribute[0]); + ssSetInputPortIsContinuousQuantity(rts, 0, 0); + ssSetInputPortIsContinuousQuantity(rts, 1, 0); + ssSetInputPortIsContinuousQuantity(rts, 2, 0); + + /* port 0 */ + { + ssSetInputPortRequiredContiguous(rts, 0, 1); + ssSetInputPortSignal(rts, 0, &VFControl_B.Model_o1); + _ssSetInputPortNumDimensions(rts, 0, 1); + ssSetInputPortWidthAsInt(rts, 0, 1); + } + + /* port 1 */ + { + ssSetInputPortRequiredContiguous(rts, 1, 1); + ssSetInputPortSignal(rts, 1, &VFControl_B.Model1_o1); + _ssSetInputPortNumDimensions(rts, 1, 1); + ssSetInputPortWidthAsInt(rts, 1, 1); + } + + /* port 2 */ + { + ssSetInputPortRequiredContiguous(rts, 2, 1); + ssSetInputPortSignal(rts, 2, &VFControl_B.Model2_o1); + _ssSetInputPortNumDimensions(rts, 2, 1); + ssSetInputPortWidthAsInt(rts, 2, 1); + } + } + + /* path info */ + ssSetModelName(rts, "Digital output2"); + ssSetPath(rts, "VFControl/Digital output2"); + ssSetRTModel(rts,VFControl_M); + ssSetParentSS(rts, (NULL)); + ssSetRootSS(rts, rts); + ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2); + + /* parameters */ + { + mxArray **sfcnParams = (mxArray **) + &VFControl_M->NonInlinedSFcns.Sfcn1.params; + ssSetSFcnParamsCount(rts, 6); + ssSetSFcnParamsPtr(rts, &sfcnParams[0]); + ssSetSFcnParam(rts, 0, (mxArray*)VFControl_cal->Digitaloutput2_P1_Size); + ssSetSFcnParam(rts, 1, (mxArray*)VFControl_cal->Digitaloutput2_P2_Size); + ssSetSFcnParam(rts, 2, (mxArray*)VFControl_cal->Digitaloutput2_P3_Size); + ssSetSFcnParam(rts, 3, (mxArray*)VFControl_cal->Digitaloutput2_P4_Size); + ssSetSFcnParam(rts, 4, (mxArray*)VFControl_cal->Digitaloutput2_P5_Size); + ssSetSFcnParam(rts, 5, (mxArray*)VFControl_cal->Digitaloutput2_P6_Size); + } + + /* work vectors */ + ssSetPWork(rts, (void **) &VFControl_DW.Digitaloutput2_PWORK[0]); + + { + struct _ssDWorkRecord *dWorkRecord = (struct _ssDWorkRecord *) + &VFControl_M->NonInlinedSFcns.Sfcn1.dWork; + struct _ssDWorkAuxRecord *dWorkAuxRecord = (struct _ssDWorkAuxRecord *) + &VFControl_M->NonInlinedSFcns.Sfcn1.dWorkAux; + ssSetSFcnDWork(rts, dWorkRecord); + ssSetSFcnDWorkAux(rts, dWorkAuxRecord); + ssSetNumDWorkAsInt(rts, 1); + + /* PWORK */ + ssSetDWorkWidthAsInt(rts, 0, 2); + ssSetDWorkDataType(rts, 0,SS_POINTER); + ssSetDWorkComplexSignal(rts, 0, 0); + ssSetDWork(rts, 0, &VFControl_DW.Digitaloutput2_PWORK[0]); + } + + /* registration */ + sg_fpga_do_sf_a2(rts); + sfcnInitializeSizes(rts); + sfcnInitializeSampleTimes(rts); + + /* adjust sample time */ + ssSetSampleTime(rts, 0, 0.0001); + ssSetOffsetTime(rts, 0, 0.0); + sfcnTsMap[0] = 1; + + /* set compiled values of dynamic vector attributes */ + ssSetNumNonsampledZCsAsInt(rts, 0); + + /* Update connectivity flags for each port */ + _ssSetInputPortConnected(rts, 0, 1); + _ssSetInputPortConnected(rts, 1, 1); + _ssSetInputPortConnected(rts, 2, 1); + + /* Update the BufferDstPort flags for each input port */ + ssSetInputPortBufferDstPort(rts, 0, -1); + ssSetInputPortBufferDstPort(rts, 1, -1); + ssSetInputPortBufferDstPort(rts, 2, -1); + } + } + + /* Model Initialize function for ModelReference Block: '/Model' */ + PWMGenerator_initialize(rtmGetErrorStatusPointer(VFControl_M), + &(VFControl_DW.Model_InstanceData.rtm), + &(VFControl_DW.Model_InstanceData.rtb)); + + /* Model Initialize function for ModelReference Block: '/Model1' */ + PWMGenerator_initialize(rtmGetErrorStatusPointer(VFControl_M), + &(VFControl_DW.Model1_InstanceData.rtm), + &(VFControl_DW.Model1_InstanceData.rtb)); + + /* Model Initialize function for ModelReference Block: '/Model2' */ + PWMGenerator_initialize(rtmGetErrorStatusPointer(VFControl_M), + &(VFControl_DW.Model2_InstanceData.rtm), + &(VFControl_DW.Model2_InstanceData.rtb)); + + /* Start for S-Function (sfun_spssw_discc): '/State-Space' incorporates: + * Constant: '/DC' + * Constant: '/SwitchCurrents' + */ + + /* S-Function block: /State-Space */ + { + VFControl_DW.StateSpace_PWORK.DS = (real_T*)calloc(14 * 9, sizeof(real_T)); + VFControl_DW.StateSpace_PWORK.DX_COL = (real_T*)calloc(14, sizeof(real_T)); + VFControl_DW.StateSpace_PWORK.TMP2 = (real_T*)calloc(9, sizeof(real_T)); + VFControl_DW.StateSpace_PWORK.SWITCH_STATUS = (int_T*)calloc(6, sizeof(int_T)); + VFControl_DW.StateSpace_PWORK.SW_CHG = (int_T*)calloc(6, sizeof(int_T)); + VFControl_DW.StateSpace_PWORK.G_STATE = (int_T*)calloc(6, sizeof(int_T)); + VFControl_DW.StateSpace_PWORK.Y_SWITCH = (real_T*)calloc(6, sizeof(real_T)); + VFControl_DW.StateSpace_PWORK.SWITCH_TYPES = (int_T*)calloc(6, sizeof(int_T)); + VFControl_DW.StateSpace_PWORK.IDX_OUT_SW = (int_T*)calloc(6, sizeof(int_T)); + VFControl_DW.StateSpace_PWORK.SWITCH_STATUS_INIT = (int_T*)calloc(6, sizeof + (int_T)); + VFControl_DW.StateSpace_PWORK.USWLAST = (real_T*)calloc(6, sizeof(real_T)); + } + + /* Start for TransportDelay: '/Transport Delay' */ + { + real_T *pBuffer = &VFControl_DW.TransportDelay_RWORK.TUbufferArea[0]; + VFControl_DW.TransportDelay_IWORK.Tail = 0; + VFControl_DW.TransportDelay_IWORK.Head = 0; + VFControl_DW.TransportDelay_IWORK.Last = 0; + VFControl_DW.TransportDelay_IWORK.CircularBufSize = 1024; + pBuffer[0] = (VFControl_cal->TransportDelay_InitOutput); + pBuffer[1024] = VFControl_M->Timing.t[0]; + VFControl_DW.TransportDelay_PWORK.TUbufferPtrs[0] = (void *) &pBuffer[0]; + } + + /* Start for TransportDelay: '/Transport Delay' */ + { + real_T *pBuffer = &VFControl_DW.TransportDelay_RWORK_d.TUbufferArea[0]; + VFControl_DW.TransportDelay_IWORK_g.Tail = 0; + VFControl_DW.TransportDelay_IWORK_g.Head = 0; + VFControl_DW.TransportDelay_IWORK_g.Last = 0; + VFControl_DW.TransportDelay_IWORK_g.CircularBufSize = 1024; + pBuffer[0] = (VFControl_cal->TransportDelay_InitOutput_l); + pBuffer[1024] = VFControl_M->Timing.t[0]; + VFControl_DW.TransportDelay_PWORK_m.TUbufferPtrs[0] = (void *) &pBuffer[0]; + } + + /* Start for TransportDelay: '/Transport Delay' */ + { + real_T *pBuffer = &VFControl_DW.TransportDelay_RWORK_m.TUbufferArea[0]; + VFControl_DW.TransportDelay_IWORK_m.Tail = 0; + VFControl_DW.TransportDelay_IWORK_m.Head = 0; + VFControl_DW.TransportDelay_IWORK_m.Last = 0; + VFControl_DW.TransportDelay_IWORK_m.CircularBufSize = 1024; + pBuffer[0] = (VFControl_cal->TransportDelay_InitOutput_le); + pBuffer[1024] = VFControl_M->Timing.t[0]; + VFControl_DW.TransportDelay_PWORK_f.TUbufferPtrs[0] = (void *) &pBuffer[0]; + } + + /* Start for S-Function (sg_fpga_do_sf_a2): '/Digital output1' */ + /* Level2 S-Function Block: '/Digital output1' (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[0]; + sfcnStart(rts); + if (ssGetErrorStatus(rts) != (NULL)) + return; + } + + /* Start for S-Function (sg_fpga_do_sf_a2): '/Digital output2' */ + /* Level2 S-Function Block: '/Digital output2' (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[1]; + sfcnStart(rts); + if (ssGetErrorStatus(rts) != (NULL)) + return; + } + + { + int32_T i; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[0] = VFControl_cal->fluxes_InitialCondition[0]; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[0] = VFControl_cal->fluxes_InitialCondition_a[0]; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[1] = VFControl_cal->fluxes_InitialCondition[1]; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[1] = VFControl_cal->fluxes_InitialCondition_a[1]; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[2] = VFControl_cal->fluxes_InitialCondition[2]; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[2] = VFControl_cal->fluxes_InitialCondition_a[2]; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE[3] = VFControl_cal->fluxes_InitialCondition[3]; + + /* InitializeConditions for UnitDelay: '/fluxes' */ + VFControl_DW.fluxes_DSTATE_l[3] = VFControl_cal->fluxes_InitialCondition_a[3]; + + /* InitializeConditions for DiscreteIntegrator: '/Rotor angle thetam' */ + VFControl_DW.Rotoranglethetam_DSTATE = VFControl_cal->Rotoranglethetam_IC; + + /* InitializeConditions for UnitDelay: '/wm_delay' */ + VFControl_DW.wm_delay_DSTATE = VFControl_cal->wm_delay_InitialCondition; + + /* InitializeConditions for UnitDelay: '/wm_predict' */ + VFControl_DW.wm_predict_DSTATE = VFControl_cal->wm_predict_InitialCondition; + + /* InitializeConditions for S-Function (sfun_spssw_discc): '/State-Space' incorporates: + * Constant: '/DC' + * Constant: '/SwitchCurrents' + */ + { + int32_T i, j; + real_T *Ds = (real_T*)VFControl_DW.StateSpace_PWORK.DS; + + /* Copy and transpose D */ + for (i=0; i<14; i++) { + for (j=0; j<9; j++) + Ds[i*9 + j] = (VFControl_cal->StateSpace_DS_param[i + j*14]); + } + + { + /* Switches work vectors */ + int_T *switch_status = (int_T*) + VFControl_DW.StateSpace_PWORK.SWITCH_STATUS; + int_T *gState = (int_T*)VFControl_DW.StateSpace_PWORK.G_STATE; + real_T *yswitch = (real_T*)VFControl_DW.StateSpace_PWORK.Y_SWITCH; + int_T *switchTypes = (int_T*)VFControl_DW.StateSpace_PWORK.SWITCH_TYPES; + int_T *idxOutSw = (int_T*)VFControl_DW.StateSpace_PWORK.IDX_OUT_SW; + int_T *switch_status_init = (int_T*) + VFControl_DW.StateSpace_PWORK.SWITCH_STATUS_INIT; + + /* Initialize work vectors */ + switch_status[0] = 0; + switch_status_init[0] = 0; + gState[0] = (int_T) 0.0; + yswitch[0] = 1/0.001; + switchTypes[0] = (int_T)7.0; + idxOutSw[0] = ((int_T)0.0) - 1; + switch_status[1] = 0; + switch_status_init[1] = 0; + gState[1] = (int_T) 0.0; + yswitch[1] = 1/0.001; + switchTypes[1] = (int_T)7.0; + idxOutSw[1] = ((int_T)0.0) - 1; + switch_status[2] = 0; + switch_status_init[2] = 0; + gState[2] = (int_T) 0.0; + yswitch[2] = 1/0.001; + switchTypes[2] = (int_T)7.0; + idxOutSw[2] = ((int_T)0.0) - 1; + switch_status[3] = 0; + switch_status_init[3] = 0; + gState[3] = (int_T) 0.0; + yswitch[3] = 1/0.001; + switchTypes[3] = (int_T)7.0; + idxOutSw[3] = ((int_T)0.0) - 1; + switch_status[4] = 0; + switch_status_init[4] = 0; + gState[4] = (int_T) 0.0; + yswitch[4] = 1/0.001; + switchTypes[4] = (int_T)7.0; + idxOutSw[4] = ((int_T)0.0) - 1; + switch_status[5] = 0; + switch_status_init[5] = 0; + gState[5] = (int_T) 0.0; + yswitch[5] = 1/0.001; + switchTypes[5] = (int_T)7.0; + idxOutSw[5] = ((int_T)0.0) - 1; + } + } + + /* InitializeConditions for UnitDelay: '/voltages' */ + VFControl_DW.voltages_DSTATE[0] = VFControl_cal->voltages_InitialCondition; + VFControl_DW.voltages_DSTATE[1] = VFControl_cal->voltages_InitialCondition; + VFControl_DW.voltages_DSTATE[2] = VFControl_cal->voltages_InitialCondition; + VFControl_DW.voltages_DSTATE[3] = VFControl_cal->voltages_InitialCondition; + + /* InitializeConditions for DiscreteIntegrator: '/Rotor speed(wm)' */ + VFControl_DW.Rotorspeedwm_DSTATE = VFControl_cal->Rotorspeedwm_IC; + + /* InitializeConditions for DiscreteIntegrator: '/Discrete-Time Integrator1' */ + VFControl_DW.DiscreteTimeIntegrator1_DSTATE = + VFControl_cal->DiscreteTimeIntegrator1_IC; + + /* InitializeConditions for UnitDelay: '/Unit Delay1' */ + VFControl_DW.UnitDelay1_DSTATE = VFControl_cal->UnitDelay1_InitialCondition; + + /* InitializeConditions for DiscreteIntegrator: '/Discrete-Time Integrator' */ + VFControl_DW.DiscreteTimeIntegrator_DSTATE = + VFControl_cal->DiscreteTimeIntegrator_IC; + + /* InitializeConditions for UnitDelay: '/Unit Delay' */ + VFControl_DW.UnitDelay_DSTATE = VFControl_cal->UnitDelay_InitialCondition; + + /* SystemInitialize for Enabled SubSystem: '/Saturation' */ + /* InitializeConditions for UnitDelay: '/Delay' */ + VFControl_DW.Delay_DSTATE = VFControl_cal->Delay_InitialCondition; + + /* SystemInitialize for Switch: '/Switch' incorporates: + * Outport: '/Lm' + */ + VFControl_B.Switch_g = VFControl_cal->Lm_Y0; + + /* End of SystemInitialize for SubSystem: '/Saturation' */ + + /* SystemInitialize for Enabled SubSystem: '/Rotor reference frame' */ + /* SystemInitialize for Fcn: '/vqr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vqr_j = VFControl_cal->vqrvdr_Y0; + + /* SystemInitialize for Fcn: '/vdr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vdr_l = VFControl_cal->vqrvdr_Y0; + + /* SystemInitialize for Fcn: '/vqs' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vqs_l = VFControl_cal->vqsvds_Y0; + + /* SystemInitialize for Fcn: '/vds' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vds_f = VFControl_cal->vqsvds_Y0; + + /* End of SystemInitialize for SubSystem: '/Rotor reference frame' */ + + /* SystemInitialize for Enabled SubSystem: '/Stationary reference frame' */ + /* SystemInitialize for Fcn: '/vqr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vqr_l = VFControl_cal->vqrvdr_Y0_a; + + /* SystemInitialize for Fcn: '/vdr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vdr_p = VFControl_cal->vqrvdr_Y0_a; + + /* SystemInitialize for Fcn: '/vqs' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vqs_i = VFControl_cal->vqsvds_Y0_m; + + /* SystemInitialize for Fcn: '/vds' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vds_i = VFControl_cal->vqsvds_Y0_m; + + /* End of SystemInitialize for SubSystem: '/Stationary reference frame' */ + + /* SystemInitialize for Enabled SubSystem: '/Synchronous reference frame' */ + /* SystemInitialize for Fcn: '/vqr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vqr = VFControl_cal->vqrvdr_Y0_am; + + /* SystemInitialize for Fcn: '/vdr' incorporates: + * Outport: '/vqr,vdr' + */ + VFControl_B.vdr = VFControl_cal->vqrvdr_Y0_am; + + /* SystemInitialize for Fcn: '/vqs' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vqs = VFControl_cal->vqsvds_Y0_p; + + /* SystemInitialize for Fcn: '/vds' incorporates: + * Outport: '/vqs,vds' + */ + VFControl_B.vds = VFControl_cal->vqsvds_Y0_p; + + /* End of SystemInitialize for SubSystem: '/Synchronous reference frame' */ + + /* SystemInitialize for Enabled SubSystem: '/Rotor reference frame' */ + /* SystemInitialize for Fcn: '/ira' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.ira_p = VFControl_cal->irairb_Y0; + + /* SystemInitialize for Fcn: '/irb' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.irb_n = VFControl_cal->irairb_Y0; + + /* SystemInitialize for Fcn: '/isa' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isa_m = VFControl_cal->isaisb_Y0; + + /* SystemInitialize for Fcn: '/isb' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isb_p = VFControl_cal->isaisb_Y0; + + /* End of SystemInitialize for SubSystem: '/Rotor reference frame' */ + + /* SystemInitialize for Enabled SubSystem: '/Stationary reference frame' */ + /* SystemInitialize for Fcn: '/ira' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.ira_g = VFControl_cal->irairb_Y0_d; + + /* SystemInitialize for Fcn: '/irb' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.irb_g = VFControl_cal->irairb_Y0_d; + + /* SystemInitialize for Fcn: '/isa' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isa_a = VFControl_cal->isaisb_Y0_k; + + /* SystemInitialize for Fcn: '/isb' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isb_f = VFControl_cal->isaisb_Y0_k; + + /* End of SystemInitialize for SubSystem: '/Stationary reference frame' */ + + /* SystemInitialize for Enabled SubSystem: '/Synchronous reference frame' */ + /* SystemInitialize for Fcn: '/ira' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.ira = VFControl_cal->irairb_Y0_h; + + /* SystemInitialize for Fcn: '/irb' incorporates: + * Outport: '/ira,irb' + */ + VFControl_B.irb = VFControl_cal->irairb_Y0_h; + + /* SystemInitialize for Fcn: '/isa' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isa = VFControl_cal->isaisb_Y0_m; + + /* SystemInitialize for Fcn: '/isb' incorporates: + * Outport: '/isa,isb' + */ + VFControl_B.isb = VFControl_cal->isaisb_Y0_m; + + /* End of SystemInitialize for SubSystem: '/Synchronous reference frame' */ + + /* SystemInitialize for Enabled SubSystem: '/sin(beta),cos(beta),sin(th),cos(th)' */ + /* SystemInitialize for Trigonometry: '/Trigonometric Function1' incorporates: + * Outport: '/sin(beta),cos(beta), sin(th),cos(th)' + */ + VFControl_B.TrigonometricFunction1_o1 = + VFControl_cal->sinbetacosbetasinthcosth_Y0; + + /* SystemInitialize for Trigonometry: '/Trigonometric Function1' incorporates: + * Outport: '/sin(beta),cos(beta), sin(th),cos(th)' + */ + VFControl_B.TrigonometricFunction1_o2 = + VFControl_cal->sinbetacosbetasinthcosth_Y0; + + /* SystemInitialize for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(beta),cos(beta), sin(th),cos(th)' + */ + VFControl_B.TrigonometricFunction_o1_dn = + VFControl_cal->sinbetacosbetasinthcosth_Y0; + + /* SystemInitialize for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(beta),cos(beta), sin(th),cos(th)' + */ + VFControl_B.TrigonometricFunction_o2_k = + VFControl_cal->sinbetacosbetasinthcosth_Y0; + + /* End of SystemInitialize for SubSystem: '/sin(beta),cos(beta),sin(th),cos(th)' */ + + /* SystemInitialize for Enabled SubSystem: '/sin(thr),cos(thr)' */ + /* SystemInitialize for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o1_d = VFControl_cal->sinthrcosthr_Y0; + + /* SystemInitialize for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o2_j = VFControl_cal->sinthrcosthr_Y0; + + /* SystemInitialize for Outport: '/sin(thr),cos(thr)' incorporates: + * Constant: '/Constant' + */ + VFControl_B.Constant_e[0] = VFControl_cal->sinthrcosthr_Y0; + VFControl_B.Constant_e[1] = VFControl_cal->sinthrcosthr_Y0; + + /* End of SystemInitialize for SubSystem: '/sin(thr),cos(thr)' */ + + /* SystemInitialize for Enabled SubSystem: '/sin(thr),cos(thr)1' */ + /* SystemInitialize for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o1 = VFControl_cal->sinthrcosthr_Y0_h; + + /* SystemInitialize for Trigonometry: '/Trigonometric Function' incorporates: + * Outport: '/sin(thr),cos(thr)' + */ + VFControl_B.TrigonometricFunction_o2 = VFControl_cal->sinthrcosthr_Y0_h; + + /* SystemInitialize for Outport: '/sin(thr),cos(thr)' incorporates: + * Constant: '/Constant' + */ + VFControl_B.Constant[0] = VFControl_cal->sinthrcosthr_Y0_h; + VFControl_B.Constant[1] = VFControl_cal->sinthrcosthr_Y0_h; + + /* SystemInitialize for Enabled SubSystem: '/sin(thr),cos(thr)' */ + /* SystemInitialize for Enabled SubSystem: '/sin(beta),cos(beta),sin(th),cos(th)' */ + /* SystemInitialize for Enabled SubSystem: '/Saturation' */ + for (i = 0; i < 16; i++) { + /* SystemInitialize for Product: '/inversion' incorporates: + * Outport: '/Linv' + */ + VFControl_B.Linv_h[i] = VFControl_cal->Linv_Y0; + + /* SystemInitialize for Product: '/Product1' incorporates: + * Outport: '/R*Linv' + */ + VFControl_B.RLinv_m[i] = VFControl_cal->RLinv_Y0; + + /* SystemInitialize for Assignment: '/W(4,3)=wr-1' incorporates: + * Outport: '/W' + */ + VFControl_B.W43wr1[i] = VFControl_cal->W_Y0; + + /* SystemInitialize for Assignment: '/W(2,1)=-wr' incorporates: + * Outport: '/W' + */ + VFControl_B.W21wr[i] = VFControl_cal->W_Y0_m; + + /* SystemInitialize for Assignment: '/W(4,3)=wr' incorporates: + * Outport: '/W' + */ + VFControl_B.W43wr[i] = VFControl_cal->W_Y0_o; + } + + /* End of SystemInitialize for SubSystem: '/Saturation' */ + /* End of SystemInitialize for SubSystem: '/sin(beta),cos(beta),sin(th),cos(th)' */ + /* End of SystemInitialize for SubSystem: '/sin(thr),cos(thr)' */ + /* End of SystemInitialize for SubSystem: '/sin(thr),cos(thr)1' */ + } + + /* Enable for DiscreteIntegrator: '/Rotor speed(wm)' */ + VFControl_DW.Rotorspeedwm_SYSTEM_ENABLE = 1U; +} + +/* Model terminate function */ +void VFControl_terminate(void) +{ + /* Terminate for S-Function (sfun_spssw_discc): '/State-Space' incorporates: + * Constant: '/DC' + * Constant: '/SwitchCurrents' + */ + + /* S-Function block: /State-Space */ + { + /* Free memory */ + free(VFControl_DW.StateSpace_PWORK.DS); + free(VFControl_DW.StateSpace_PWORK.DX_COL); + free(VFControl_DW.StateSpace_PWORK.TMP2); + + /* + * Circuit has switches*/ + free(VFControl_DW.StateSpace_PWORK.G_STATE); + free(VFControl_DW.StateSpace_PWORK.SWITCH_STATUS); + free(VFControl_DW.StateSpace_PWORK.SW_CHG); + free(VFControl_DW.StateSpace_PWORK.SWITCH_STATUS_INIT); + } + + /* Terminate for S-Function (sg_fpga_do_sf_a2): '/Digital output1' */ + /* Level2 S-Function Block: '/Digital output1' (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[0]; + sfcnTerminate(rts); + } + + /* Terminate for S-Function (sg_fpga_do_sf_a2): '/Digital output2' */ + /* Level2 S-Function Block: '/Digital output2' (sg_fpga_do_sf_a2) */ + { + SimStruct *rts = VFControl_M->childSfunctions[1]; + sfcnTerminate(rts); + } + + /* user code (Terminate function Trailer) */ + { + uintptr_t bar2Addr; + volatile io3xx_pull *ptrIO31x_pull; + volatile io3xx_2x *ptrio3xx_2x; + uint16_t moduleArchitecture; + sg_fpga_io3xxModuleIdT moduleId; + static char msg[500]; + + // Get module IDs (PIC info) + sg_fpga_IO3xxGetModuleId(39750, &moduleId); + moduleArchitecture = moduleId.moduleArchitecture; + SG_PRINTF(DEBUG, "moduleArchitecture %d\n",moduleArchitecture); + if (moduleArchitecture == TEWS_TXMC) { + // Get pointer to io31x_pull + bar2Addr = (uintptr_t)io3xxGetAddressSgLib((int32_t)1, SG_FPGA_IO3XX_BAR2); + if (bar2Addr == 0) { + sprintf(msg, "%s", pSgErrorStr); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + } + + ptrIO31x_pull = (io3xx_pull *)((uintptr_t)bar2Addr + IO3xx_PULL_BASE); + + // Disable pull resistors + ptrIO31x_pull->enable = 0x0; // disable + } + + // Pull down and disable DIOs + if ((1 == 2) || (1 == 3)) { + bar2Addr = (uintptr_t)io3xxGetAddressSgLib((int32_t)1, SG_FPGA_IO3XX_BAR2); + if (bar2Addr == 0) { + sprintf(msg, "%s", pSgErrorStr); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + } + + ptrio3xx_2x = (io3xx_2x *)((uintptr_t)bar2Addr +IO3xx_2x_BASE); + ptrio3xx_2x->pull = 0xffffffff; // pull down + ptrio3xx_2x->dir = 0x0; // input + ptrio3xx_2x->update = 0x1; + sg_wait_s(SG_FPGA_WAIT_TIME_100us); + ptrio3xx_2x->update = 0x0; + sg_wait_s(SG_FPGA_WAIT_TIME_1ms); + +#if DEBUGGING + + // For debugging output port register of IO-Expander + sg_wait_s(SG_FPGA_WAIT_TIME_100ms); + SG_PRINTF(INFO, "last configuration from mdl start\n"); + SG_PRINTF(INFO, "rxData of Expander1: 0x%X\n", + ptrio3xx_2x->rxDataExpander1); + SG_PRINTF(INFO, "rxData of Expander2: 0x%X\n", + ptrio3xx_2x->rxDataExpander2); + SG_PRINTF(INFO, "rxData of Expander3: 0x%X\n", + ptrio3xx_2x->rxDataExpander3); + SG_PRINTF(INFO, "rxData of Expander4: 0x%X\n", + ptrio3xx_2x->rxDataExpander4); + +#endif + + } else if (1 == 4) { + IO3xx_24_terminate(1); + } + + freeFPGAModuleSgLib((uint32_t)1); + } +} diff --git a/Control/VF Control/VFControl_sg_rtw/VFControl.h b/Control/VF Control/VFControl_sg_rtw/VFControl.h new file mode 100644 index 0000000..7ed7f04 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/VFControl.h @@ -0,0 +1,862 @@ +/* + * VFControl.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:33:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#ifndef VFControl_h_ +#define VFControl_h_ +#include "rtwtypes.h" +#include "simstruc.h" +#include "fixedpoint.h" +#include "sg_fpga_io30x_setup_util.h" +#include "sg_fpga_io31x_io32x_setup_util.h" +#include "sg_fpga_io33x_setup_util.h" +#include "sg_fpga_io36x_setup_util.h" +#include "sg_fpga_io39x_setup_util.h" +#include "sg_fpga_io3xx_scatter_gather_dma.h" +#include "sg_common.h" +#include "sg_printf.h" +#include "VFControl_types.h" +#include "PWMGenerator.h" +#include +#include "rtGetNaN.h" +#include +#include "VFControl_cal.h" + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +/* Macros for accessing real-time model data structure */ +#ifndef rtmGetContTimeOutputInconsistentWithStateAtMajorStepFlag +#define rtmGetContTimeOutputInconsistentWithStateAtMajorStepFlag(rtm) ((rtm)->CTOutputIncnstWithState) +#endif + +#ifndef rtmSetContTimeOutputInconsistentWithStateAtMajorStepFlag +#define rtmSetContTimeOutputInconsistentWithStateAtMajorStepFlag(rtm, val) ((rtm)->CTOutputIncnstWithState = (val)) +#endif + +#ifndef rtmGetDerivCacheNeedsReset +#define rtmGetDerivCacheNeedsReset(rtm) ((rtm)->derivCacheNeedsReset) +#endif + +#ifndef rtmSetDerivCacheNeedsReset +#define rtmSetDerivCacheNeedsReset(rtm, val) ((rtm)->derivCacheNeedsReset = (val)) +#endif + +#ifndef rtmGetFinalTime +#define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal) +#endif + +#ifndef rtmGetSampleHitArray +#define rtmGetSampleHitArray(rtm) ((rtm)->Timing.sampleHitArray) +#endif + +#ifndef rtmGetStepSize +#define rtmGetStepSize(rtm) ((rtm)->Timing.stepSize) +#endif + +#ifndef rtmGetZCCacheNeedsReset +#define rtmGetZCCacheNeedsReset(rtm) ((rtm)->zCCacheNeedsReset) +#endif + +#ifndef rtmSetZCCacheNeedsReset +#define rtmSetZCCacheNeedsReset(rtm, val) ((rtm)->zCCacheNeedsReset = (val)) +#endif + +#ifndef rtmGet_TimeOfLastOutput +#define rtmGet_TimeOfLastOutput(rtm) ((rtm)->Timing.timeOfLastOutput) +#endif + +#ifndef rtmCounterLimit +#define rtmCounterLimit(rtm, idx) ((rtm)->Timing.TaskCounters.cLimit[(idx)]) +#endif + +#ifndef rtmGetErrorStatus +#define rtmGetErrorStatus(rtm) ((rtm)->errorStatus) +#endif + +#ifndef rtmSetErrorStatus +#define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val)) +#endif + +#ifndef rtmGetErrorStatusPointer +#define rtmGetErrorStatusPointer(rtm) ((const char_T **)(&((rtm)->errorStatus))) +#endif + +#ifndef rtmStepTask +#define rtmStepTask(rtm, idx) ((rtm)->Timing.TaskCounters.TID[(idx)] == 0) +#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 rtmGetTFinal +#define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal) +#endif + +#ifndef rtmGetTPtr +#define rtmGetTPtr(rtm) ((rtm)->Timing.t) +#endif + +#ifndef rtmGetTStart +#define rtmGetTStart(rtm) ((rtm)->Timing.tStart) +#endif + +#ifndef rtmTaskCounter +#define rtmTaskCounter(rtm, idx) ((rtm)->Timing.TaskCounters.TID[(idx)]) +#endif + +#ifndef rtmGetTimeOfLastOutput +#define rtmGetTimeOfLastOutput(rtm) ((rtm)->Timing.timeOfLastOutput) +#endif + +/* Block signals (default storage) */ +struct B_VFControl_T { + real_T xk1[4]; /* '/fluxes' */ + real_T Gain[4]; /* '/Gain' */ + real_T fluxes[4]; /* '/fluxes' */ + real_T Sum2[4]; /* '/Sum2' */ + real_T Linv[16]; /* '/Switch' */ + real_T Product3[4]; /* '/Product3' */ + real_T Rotoranglethetam; /* '/Rotor angle thetam' */ + real_T wm_delay; /* '/wm_delay' */ + real_T F2; /* '/F2' */ + real_T wm_predict; /* '/wm_predict' */ + real_T Sum1; /* '/Sum1' */ + real_T MultiportSwitch[4]; /* '/Multiport Switch' */ + real_T MultiportSwitch_p[2]; /* '/Multiport Switch' */ + real_T MultiportSwitch1[2]; /* '/Multiport Switch1' */ + real_T ib[4]; /* '/ib' */ + real_T GainVr_Vs1[2]; /* '/Gain Vr_Vs1' */ + real_T StateSpace_o1[14]; /* '/State-Space' */ + real_T StateSpace_o2[6]; /* '/State-Space' */ + real_T iqsids[2]; /* '/1-1' */ + real_T Mult1[2]; /* '/Mult1' */ + real_T Sum2_k; /* '/Sum2' */ + real_T Switch2; /* '/Switch2' */ + real_T GainVr_Vs[2]; /* '/Gain Vr_Vs' */ + real_T u_Vb[4]; /* '/1_Vb' */ + real_T MultiportSwitch1_f[2]; /* '/Multiport Switch1' */ + real_T MultiportSwitch_p2[2]; /* '/Multiport Switch' */ + real_T voltages[4]; /* '/voltages' */ + real_T DigitalClock; /* '/Digital Clock' */ + real_T IC[4]; /* '/IC' */ + real_T Sum2_l; /* '/Sum2' */ + real_T Sum3; /* '/Sum3' */ + real_T unitconversion[19]; /* '/unit conversion' */ + real_T up; /* '/1\p' */ + real_T wTethr[3]; /* '/1\p1' */ + real_T Unitconversion; /* '/Unit conversion' */ + real_T F; /* '/F' */ + real_T Sum; /* '/Sum' */ + real_T u_2H; /* '/1_2H' */ + real_T Rotorspeedwm; /* '/Rotor speed(wm)' */ + real_T web_psb; /* '/web_psb' */ + real_T DigitalClock_k; /* '/Digital Clock' */ + real_T LookUpTable; /* '/Look-Up Table' */ + real_T Toff; /* '/Step1' */ + real_T Ton; /* '/Step' */ + real_T DiscreteTimeIntegrator1; /* '/Discrete-Time Integrator1' */ + real_T UnitDelay1; /* '/Unit Delay1' */ + real_T Switch2_d; /* '/Switch2' */ + real_T Switch3; /* '/Switch3' */ + real_T Switch2_a; /* '/Switch2' */ + real_T Sum3_e; /* '/Sum3' */ + real_T Switch1; /* '/Switch1' */ + real_T Switch5[3]; /* '/Switch5' */ + real_T t; /* '/t' */ + real_T Gain_p; /* '/Gain' */ + real_T Product; /* '/Product' */ + real_T DiscreteTimeIntegrator; /* '/Discrete-Time Integrator' */ + real_T Sum_n; /* '/Sum' */ + real_T Gain3; /* '/Gain3' */ + real_T Switch3_o; /* '/Switch3' */ + real_T Sum2_j[3]; /* '/Sum2' */ + real_T Switch1_a[3]; /* '/Switch1' */ + real_T Switch5_b[3]; /* '/Switch5' */ + real_T Sum7[3]; /* '/Sum7' */ + real_T TrigonometricFunction1[3]; /* '/Trigonometric Function1' */ + real_T Product2[3]; /* '/Product2' */ + real_T Ton_e; /* '/Step' */ + real_T Toff_e; /* '/Step1' */ + real_T Sum4; /* '/Sum4' */ + real_T DataTypeConversion; /* '/Data Type Conversion' */ + real_T Gain1; /* '/Gain1' */ + real_T Gain3_f; /* '/Gain3' */ + real_T Sum1_m; /* '/Sum1' */ + real_T MultiportSwitch_h[3]; /* '/Multiport Switch' */ + real_T Sum_j[3]; /* '/Sum' */ + real_T TrigonometricFunction1_d[3]; /* '/Trigonometric Function1' */ + real_T Product1[3]; /* '/Product1' */ + real_T Gain1_m; /* '/Gain1' */ + real_T Gain3_a; /* '/Gain3' */ + real_T Sum1_m3; /* '/Sum1' */ + real_T MultiportSwitch_n[3]; /* '/Multiport Switch' */ + real_T Sum_i[3]; /* '/Sum' */ + real_T TrigonometricFunction1_c[3]; /* '/Trigonometric Function1' */ + real_T Product1_i[3]; /* '/Product1' */ + real_T Sum4_o[3]; /* '/Sum4' */ + real_T Sum8[3]; /* '/Sum8' */ + real_T Clock; /* '/Clock' */ + real_T Add1; /* '/Add1' */ + real_T MathFunction; /* '/Math Function' */ + real_T uib1; /* '/1\ib1' */ + real_T uDLookupTable; /* '/1-D Lookup Table' */ + real_T Add3; /* '/Add3' */ + real_T Model_o1; /* '/Model' */ + real_T Model_o2; /* '/Model' */ + real_T Model_o3; /* '/Model' */ + real_T DigitalClock_m; /* '/Digital Clock' */ + real_T Add1_e; /* '/Add1' */ + real_T MathFunction_l; /* '/Math Function' */ + real_T uib1_h; /* '/1\ib1' */ + real_T uDLookupTable_b; /* '/1-D Lookup Table' */ + real_T Add3_h; /* '/Add3' */ + real_T Model1_o1; /* '/Model1' */ + real_T Model1_o2; /* '/Model1' */ + real_T Model1_o3; /* '/Model1' */ + real_T DigitalClock_ms; /* '/Digital Clock' */ + real_T Add1_l; /* '/Add1' */ + real_T MathFunction_o; /* '/Math Function' */ + real_T uib1_e; /* '/1\ib1' */ + real_T uDLookupTable_bk; /* '/1-D Lookup Table' */ + real_T Add3_n; /* '/Add3' */ + real_T Model2_o1; /* '/Model2' */ + real_T Model2_o2; /* '/Model2' */ + real_T Model2_o3; /* '/Model2' */ + real_T TransportDelay; /* '/Transport Delay' */ + real_T TransportDelay_i; /* '/Transport Delay' */ + real_T TransportDelay_n; /* '/Transport Delay' */ + real_T Switch; /* '/Switch' */ + real_T Saturation[6]; /* '/Saturation' */ + real_T DataTypeConversion_p[6]; /* '/Data Type Conversion' */ + real_T DataTypeConversion1; /* '/Data Type Conversion1' */ + real_T Product4[6]; /* '/Product4' */ + real_T DataTypeConversion_f; /* '/Data Type Conversion' */ + real_T Switch_e; /* '/Switch' */ + real_T DataTypeConversion_l; /* '/Data Type Conversion' */ + real_T Switch_k; /* '/Switch' */ + real_T DataTypeConversion_h; /* '/Data Type Conversion' */ + real_T Switch_i; /* '/Switch' */ + real_T DataTypeConversion_k; /* '/Data Type Conversion' */ + real_T Switch_a; /* '/Switch' */ + real_T DataTypeConversion_i; /* '/Data Type Conversion' */ + real_T Switch_a4; /* '/Switch' */ + real_T DataTypeConversion_c; /* '/Data Type Conversion' */ + real_T Product_n; /* '/Product' */ + real_T Product_b; /* '/Product' */ + real_T Product_l; /* '/Product' */ + real_T Switch4; /* '/Switch4' */ + real_T Gain2; /* '/Gain2' */ + real_T Sum1_o; /* '/Sum1' */ + real_T Gain3_m[3]; /* '/Gain3' */ + real_T wtrad; /* '/Math Function' */ + real_T Switch_c; /* '/Switch' */ + real_T donotdeletethisgain; /* '/do not delete this gain' */ + real_T donotdeletethisgain_k; /* '/do not delete this gain' */ + real_T donotdeletethisgain_o; /* '/do not delete this gain' */ + real_T Kv1[3]; /* '/Kv1' */ + real_T donotdeletethisgain_kv; /* '/do not delete this gain' */ + real_T donotdeletethisgain_b; /* '/do not delete this gain' */ + real_T donotdeletethisgain_h; /* '/do not delete this gain' */ + real_T Kv[3]; /* '/Kv' */ + real_T UnitDelay; /* '/Unit Delay' */ + real_T uRsw; /* '/1//Rsw' */ + real_T uRsw_n; /* '/1//Rsw' */ + real_T uRsw_i; /* '/1//Rsw' */ + real_T uRsw_g; /* '/1//Rsw' */ + real_T uRsw_c; /* '/1//Rsw' */ + real_T uRsw_k; /* '/1//Rsw' */ + real_T Switch1_j; /* '/Switch1' */ + real_T MultiportSwitch1_b; /* '/Multiport Switch1' */ + real_T Gain1_f; /* '/Gain1' */ + real_T Product1_f; /* '/Product1' */ + real_T TrigonometricFunction1_l; /* '/Trigonometric Function1' */ + real_T Mod; /* '/Product' */ + real_T Step; /* '/Product2' */ + real_T Gain4; /* '/Gain4' */ + real_T Gain3_n; /* '/Gain3' */ + real_T Sum2_lw[3]; /* '/Sum2' */ + real_T Constant[2]; /* '/Constant' */ + real_T Gain3_e; /* '/Gain3' */ + real_T TrigonometricFunction_o1; /* '/Trigonometric Function' */ + real_T TrigonometricFunction_o2; /* '/Trigonometric Function' */ + real_T W34wr[16]; /* '/W(3,4)=-wr' */ + real_T W43wr[16]; /* '/W(4,3)=wr' */ + real_T Constant_e[2]; /* '/Constant' */ + real_T Gain1_e; /* '/Gain1' */ + real_T TrigonometricFunction_o1_d; /* '/Trigonometric Function' */ + real_T TrigonometricFunction_o2_j; /* '/Trigonometric Function' */ + real_T W12wr[16]; /* '/W(1,2)=wr' */ + real_T W21wr[16]; /* '/W(2,1)=-wr' */ + real_T DigitalClock_kx; /* '/Digital Clock' */ + real_T wewr; /* '/Sum' */ + real_T Gain2_k; /* '/Gain2' */ + real_T th; /* '/web_psb' */ + real_T beta; /* '/Sum1' */ + real_T TrigonometricFunction_o1_dn; /* '/Trigonometric Function' */ + real_T TrigonometricFunction_o2_k; /* '/Trigonometric Function' */ + real_T TrigonometricFunction1_o1; /* '/Trigonometric Function1' */ + real_T TrigonometricFunction1_o2; /* '/Trigonometric Function1' */ + real_T W341wr[16]; /* '/W(3,4)=1-wr' */ + real_T W43wr1[16]; /* '/W(4,3)=wr-1' */ + real_T ira; /* '/ira' */ + real_T irb; /* '/irb' */ + real_T isa; /* '/isa' */ + real_T isb; /* '/isb' */ + real_T ira_g; /* '/ira' */ + real_T irb_g; /* '/irb' */ + real_T isa_a; /* '/isa' */ + real_T isb_f; /* '/isb' */ + real_T ira_p; /* '/ira' */ + real_T irb_n; /* '/irb' */ + real_T isa_m; /* '/isa' */ + real_T isb_p; /* '/isb' */ + real_T vdr; /* '/vdr' */ + real_T vds; /* '/vds' */ + real_T vqr; /* '/vqr' */ + real_T vqs; /* '/vqs' */ + real_T vdr_p; /* '/vdr' */ + real_T vds_i; /* '/vds' */ + real_T vqr_l; /* '/vqr' */ + real_T vqs_i; /* '/vqs' */ + real_T vdr_l; /* '/vdr' */ + real_T vds_f; /* '/vds' */ + real_T vqr_j; /* '/vqr' */ + real_T vqs_l; /* '/vqs' */ + real_T ukuk1[4]; /* '/sum' */ + real_T RLinv[16]; /* '/Switch1' */ + real_T MultiportSwitch1_l[16]; /* '/Multiport Switch1' */ + real_T A[16]; /* '/Sum1' */ + real_T wbaseTs2[16]; /* '/wbase*Ts//2' */ + real_T Sum1_k[16]; /* '/Sum1' */ + real_T inversion[16]; /* '/inversion' */ + real_T wbaseTs2_c[16]; /* '/wbase*Ts//2 ' */ + real_T Product1_d[4]; /* '/Product1' */ + real_T Sum5[16]; /* '/Sum5' */ + real_T Product4_k[16]; /* '/Product4' */ + real_T Product2_o[4]; /* '/Product2' */ + real_T xk[4]; /* '/Ad*x(k-1) + Bd*( u(k-1) + u(k))' */ + real_T Delay; /* '/Delay' */ + real_T TmpSignalConversionAtMathFuncti[3]; + real_T MathFunction_p[3]; /* '/Math Function' */ + real_T Sum2_i; /* '/Sum2' */ + real_T MathFunction1; /* '/Math Function1' */ + real_T Product2_m[2]; /* '/Product2' */ + real_T Product_c[2]; /* '/Product' */ + real_T phimq; /* '/Sum2' */ + real_T Product1_j[2]; /* '/Product1' */ + real_T phimd; /* '/Sum1' */ + real_T Phisat; /* '/Math Function' */ + real_T Isat; /* '/1-D Lookup Table' */ + real_T Switch_g; /* '/Switch' */ + real_T Lminrows13col13[16]; /* '/Lm in rows[1,3] & col[1,3]' */ + real_T Lminrows24col24[16]; /* '/Lm in rows[2,4] & col[2,4]' */ + real_T Sum2_e[16]; /* '/Sum2' */ + real_T Linv_h[16]; /* '/inversion' */ + real_T RLinv_m[16]; /* '/Product1' */ + real_T Lm; /* '/Product' */ + boolean_T RelationalOperator3; /* '/Relational Operator3' */ + boolean_T Amplitude; /* '/Relational Operator' */ + boolean_T LogicalOperator1; /* '/Logical Operator1' */ + boolean_T DataTypeConversion2; /* '/Data Type Conversion2' */ + boolean_T LogicalOperator1_l; /* '/Logical Operator1' */ + boolean_T RelationalOperator1; /* '/Relational Operator1' */ + boolean_T DataTypeConversion1_f; /* '/Data Type Conversion1' */ + boolean_T LogicalOperator; /* '/Logical Operator' */ + boolean_T RelationalOperator3_f; /* '/Relational Operator3' */ + boolean_T Phase; /* '/Relational Operator1' */ + boolean_T LogicalOperator1_b; /* '/Logical Operator1' */ + boolean_T DataTypeConversion1_j; /* '/Data Type Conversion1' */ + boolean_T DataTypeConversion2_m; /* '/Data Type Conversion2' */ + boolean_T LogicalOperator_l; /* '/Logical Operator' */ + boolean_T Compare; /* '/Compare' */ + boolean_T Frequency; /* '/Relational Operator2' */ + boolean_T RelationalOperator; /* '/Relational Operator' */ +}; + +/* Block states (default storage) for system '' */ +struct DW_VFControl_T { + real_T fluxes_DSTATE[4]; /* '/fluxes' */ + real_T fluxes_DSTATE_l[4]; /* '/fluxes' */ + real_T Rotoranglethetam_DSTATE; /* '/Rotor angle thetam' */ + real_T wm_delay_DSTATE; /* '/wm_delay' */ + real_T wm_predict_DSTATE; /* '/wm_predict' */ + real_T voltages_DSTATE[4]; /* '/voltages' */ + real_T Rotorspeedwm_DSTATE; /* '/Rotor speed(wm)' */ + real_T DiscreteTimeIntegrator1_DSTATE;/* '/Discrete-Time Integrator1' */ + real_T UnitDelay1_DSTATE; /* '/Unit Delay1' */ + real_T DiscreteTimeIntegrator_DSTATE;/* '/Discrete-Time Integrator' */ + real_T UnitDelay_DSTATE; /* '/Unit Delay' */ + real_T Delay_DSTATE; /* '/Delay' */ + real_T inversion_DWORK1[16]; /* '/inversion' */ + real_T inversion_DWORK3[16]; /* '/inversion' */ + real_T inversion_DWORK4[16]; /* '/inversion' */ + real_T inversion_DWORK4_k[16]; /* '/inversion' */ + struct { + real_T modelTStart; + real_T TUbufferArea[2048]; + } TransportDelay_RWORK; /* '/Transport Delay' */ + + struct { + real_T modelTStart; + real_T TUbufferArea[2048]; + } TransportDelay_RWORK_d; /* '/Transport Delay' */ + + struct { + real_T modelTStart; + real_T TUbufferArea[2048]; + } TransportDelay_RWORK_m; /* '/Transport Delay' */ + + struct { + void *AS; + void *BS; + void *CS; + void *DS; + void *DX_COL; + void *BD_COL; + void *TMP1; + void *TMP2; + void *XTMP; + void *SWITCH_STATUS; + void *SWITCH_STATUS_INIT; + void *SW_CHG; + void *G_STATE; + void *USWLAST; + void *XKM12; + void *XKP12; + void *XLAST; + void *ULAST; + void *IDX_SW_CHG; + void *Y_SWITCH; + void *SWITCH_TYPES; + void *IDX_OUT_SW; + void *SWITCH_TOPO_SAVED_IDX; + void *SWITCH_MAP; + } StateSpace_PWORK; /* '/State-Space' */ + + struct { + void *LoggedData[3]; + } DebugPWM_PWORK; /* '/Debug PWM' */ + + struct { + void *LoggedData[4]; + } DebugfaseA_PWORK; /* '/Debug fase A' */ + + struct { + void *LoggedData[4]; + } DebugfaseB_PWORK; /* '/Debug fase B' */ + + struct { + void *LoggedData[4]; + } DebugfaseC_PWORK; /* '/Debug fase C' */ + + struct { + void *TUbufferPtrs[2]; + } TransportDelay_PWORK; /* '/Transport Delay' */ + + struct { + void *TUbufferPtrs[2]; + } TransportDelay_PWORK_m; /* '/Transport Delay' */ + + struct { + void *TUbufferPtrs[2]; + } TransportDelay_PWORK_f; /* '/Transport Delay' */ + + void *Digitaloutput1_PWORK[2]; /* '/Digital output1' */ + void *Digitaloutput2_PWORK[2]; /* '/Digital output2' */ + struct { + void *LoggedData[2]; + } Corrientetensinmotorideal_PWORK; + /* '/Corriente//tensión motor ideal' */ + + struct { + void *USERIO_P_IND; + void *PROG_SPACE_P_IND; + void *CONFIG_REGISTER_P_IND; + void *CONDITIONING_MODULE_IO3xx_2x_P_IND; + void *DEVICENAME_P_IND; + void *DMA_CONTROLLER_P_IND; + } Setup_PWORK; /* '/Setup' */ + + int32_T inversion_DWORK2[4]; /* '/inversion' */ + uint32_T m_bpIndex; /* '/1-D Lookup Table' */ + uint32_T m_bpIndex_e; /* '/1-D Lookup Table' */ + uint32_T m_bpIndex_p; /* '/1-D Lookup Table' */ + uint32_T m_bpIndex_b; /* '/1-D Lookup Table' */ + int_T StateSpace_IWORK[11]; /* '/State-Space' */ + struct { + int_T Tail; + int_T Head; + int_T Last; + int_T CircularBufSize; + } TransportDelay_IWORK; /* '/Transport Delay' */ + + struct { + int_T Tail; + int_T Head; + int_T Last; + int_T CircularBufSize; + } TransportDelay_IWORK_g; /* '/Transport Delay' */ + + struct { + int_T Tail; + int_T Head; + int_T Last; + int_T CircularBufSize; + } TransportDelay_IWORK_m; /* '/Transport Delay' */ + + struct { + int_T MODULEARCHITECTURE_I_IND; + } Setup_IWORK; /* '/Setup' */ + + int8_T sinthrcosthr1_SubsysRanBC; /* '/sin(thr),cos(thr)1' */ + int8_T sinthrcosthr_SubsysRanBC; /* '/sin(thr),cos(thr)' */ + int8_T sinbetacosbetasinthcosth_Subsys; + /* '/sin(beta),cos(beta),sin(th),cos(th)' */ + int8_T Synchronousreferenceframe_Subsy;/* '/Synchronous reference frame' */ + int8_T Stationaryreferenceframe_Subsys;/* '/Stationary reference frame' */ + int8_T Rotorreferenceframe_SubsysRanBC;/* '/Rotor reference frame' */ + int8_T Synchronousreferenceframe_Sub_k;/* '/Synchronous reference frame' */ + int8_T Stationaryreferenceframe_Subs_n;/* '/Stationary reference frame' */ + int8_T Rotorreferenceframe_SubsysRan_i;/* '/Rotor reference frame' */ + int8_T Saturation_SubsysRanBC; /* '/Saturation' */ + uint8_T Rotorspeedwm_SYSTEM_ENABLE; /* '/Rotor speed(wm)' */ + boolean_T sinthrcosthr1_MODE; /* '/sin(thr),cos(thr)1' */ + boolean_T sinthrcosthr_MODE; /* '/sin(thr),cos(thr)' */ + boolean_T Synchronousreferenceframe_MODE;/* '/Synchronous reference frame' */ + boolean_T Stationaryreferenceframe_MODE;/* '/Stationary reference frame' */ + boolean_T Rotorreferenceframe_MODE; /* '/Rotor reference frame' */ + boolean_T Synchronousreferenceframe_MOD_l;/* '/Synchronous reference frame' */ + boolean_T Stationaryreferenceframe_MODE_p;/* '/Stationary reference frame' */ + boolean_T Rotorreferenceframe_MODE_m;/* '/Rotor reference frame' */ + MdlrefDW_PWMGenerator_T Model_InstanceData;/* '/Model' */ + MdlrefDW_PWMGenerator_T Model1_InstanceData;/* '/Model1' */ + MdlrefDW_PWMGenerator_T Model2_InstanceData;/* '/Model2' */ +}; + +/* Real-time Model Data Structure */ +struct tag_RTM_VFControl_T { + struct SimStruct_tag * *childSfunctions; + const char_T *errorStatus; + SS_SimMode simMode; + 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[3]; + SimStruct childSFunctions[2]; + SimStruct *childSFunctionPtrs[2]; + struct _ssBlkInfo2 blkInfo2[2]; + struct _ssSFcnModelMethods2 methods2[2]; + struct _ssSFcnModelMethods3 methods3[2]; + struct _ssSFcnModelMethods4 methods4[2]; + struct _ssStatesInfo2 statesInfo2[2]; + ssPeriodicStatesInfo periodicStatesInfo[2]; + struct _ssPortInfo2 inputOutputPortInfo2[2]; + struct { + time_T sfcnPeriod[1]; + time_T sfcnOffset[1]; + int_T sfcnTsMap[1]; + struct _ssPortInputs inputPortInfo[3]; + struct _ssInPortUnit inputPortUnits[3]; + struct _ssInPortCoSimAttribute inputPortCoSimAttribute[3]; + uint_T attribs[6]; + mxArray *params[6]; + struct _ssDWorkRecord dWork[1]; + struct _ssDWorkAuxRecord dWorkAux[1]; + } Sfcn0; + + struct { + time_T sfcnPeriod[1]; + time_T sfcnOffset[1]; + int_T sfcnTsMap[1]; + struct _ssPortInputs inputPortInfo[3]; + struct _ssInPortUnit inputPortUnits[3]; + struct _ssInPortCoSimAttribute inputPortCoSimAttribute[3]; + uint_T attribs[6]; + mxArray *params[6]; + struct _ssDWorkRecord dWork[1]; + struct _ssDWorkAuxRecord dWorkAux[1]; + } Sfcn1; + } NonInlinedSFcns; + + boolean_T zCCacheNeedsReset; + boolean_T derivCacheNeedsReset; + boolean_T CTOutputIncnstWithState; + + /* + * Sizes: + * The following substructure contains sizes information + * for many of the model attributes such as inputs, outputs, + * dwork, sample times, etc. + */ + struct { + uint32_T options; + int_T numContStates; + 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; + + /* + * 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; + uint32_T clockTick1; + uint32_T clockTickH1; + time_T stepSize1; + uint32_T clockTick2; + uint32_T clockTickH2; + struct { + uint32_T TID[3]; + uint32_T cLimit[3]; + } TaskCounters; + + time_T tStart; + time_T tFinal; + time_T timeOfLastOutput; + 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[3]; + time_T offsetTimesArray[3]; + int_T sampleTimeTaskIDArray[3]; + int_T sampleHitArray[3]; + int_T perTaskSampleHitsArray[9]; + time_T tArray[3]; + } Timing; +}; + +/* Block signals (default storage) */ +#ifdef __cplusplus + +extern "C" +{ + +#endif + + extern struct B_VFControl_T VFControl_B; + +#ifdef __cplusplus + +} + +#endif + +/* Block states (default storage) */ +extern struct DW_VFControl_T VFControl_DW; + +#ifdef __cplusplus + +extern "C" +{ + +#endif + + /* Model entry point functions */ + extern void VFControl_initialize(void); + extern void VFControl_step0(void); + extern void VFControl_step2(void); + extern void VFControl_terminate(void); + +#ifdef __cplusplus + +} + +#endif + +/* Real-time Model object */ +#ifdef __cplusplus + +extern "C" +{ + +#endif + + extern RT_MODEL_VFControl_T *const VFControl_M; + +#ifdef __cplusplus + +} + +#endif + +/*- + * 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 + * + * '' : 'VFControl' + * '' : 'VFControl/Asynchronous Machine SI Units' + * '' : 'VFControl/DC Voltage Source' + * '' : 'VFControl/Inversión A' + * '' : 'VFControl/Inversión B' + * '' : 'VFControl/Inversión C' + * '' : 'VFControl/Three-Phase Programmable Generator' + * '' : 'VFControl/Three-Phase V-I Measurement' + * '' : 'VFControl/Triangle Generator' + * '' : 'VFControl/Triangle Generator1' + * '' : 'VFControl/Triangle Generator2' + * '' : 'VFControl/Two-Level Converter1' + * '' : 'VFControl/powergui' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model' + * '' : 'VFControl/Asynchronous Machine SI Units/Measurements' + * '' : 'VFControl/Asynchronous Machine SI Units/Mechanical model' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/abc to dq transformation' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/dq to abc transformation' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/sin,cos' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/Electromagnetic Torque' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/Flux Prediction' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/Saturation' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/phiqd_SR' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/Saturation/Laq=Lad' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/Saturation/Matrix L' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/Saturation/phimqd' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/phiqd_SR/Subsystem' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/abc to dq transformation/Rotor reference frame' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/abc to dq transformation/Stationary reference frame' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/abc to dq transformation/Synchronous reference frame' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/abc to dq transformation/transit' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/dq to abc transformation/Rotor reference frame' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/dq to abc transformation/Stationary reference frame' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/dq to abc transformation/Synchronous reference frame' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/sin,cos/sin(beta),cos(beta),sin(th),cos(th)' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/sin,cos/sin(thr),cos(thr)' + * '' : 'VFControl/Asynchronous Machine SI Units/Electrical model/sin,cos/sin(thr),cos(thr)1' + * '' : 'VFControl/Asynchronous Machine SI Units/Mechanical model/Delay Prediction' + * '' : 'VFControl/DC Voltage Source/Model' + * '' : 'VFControl/Three-Phase Programmable Generator/Model' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Amplitude' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Frequency' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Harmonic Generation' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Measurements' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Phase' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Type of Variation selector' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Variation value (step ramp mod)' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Variation value (time table)' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Amplitude/Time-Amplitude pairs' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Amplitude/Variation on phase A only' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Harmonic Generation/Enable Harmonics' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Harmonic Generation/Harmonic A generation' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Harmonic Generation/Harmonic B generation' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Phase/Time-Phase pairs' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Phase/Variation on phase A only' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Variation value (step ramp mod)/Subsystem1' + * '' : 'VFControl/Three-Phase Programmable Generator/Model/Variation value (time table)/Model' + * '' : 'VFControl/Three-Phase V-I Measurement/Mode I' + * '' : 'VFControl/Three-Phase V-I Measurement/Mode V' + * '' : 'VFControl/Three-Phase V-I Measurement/Model' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/I A:' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/I B:' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/I C:' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/U AB:' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/U BC:' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/U CA:' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/I A:/Model' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/I B:/Model' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/I C:/Model' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/U AB:/Model' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/U BC:/Model' + * '' : 'VFControl/Three-Phase V-I Measurement/Model/U CA:/Model' + * '' : 'VFControl/Triangle Generator/Model' + * '' : 'VFControl/Triangle Generator1/Model' + * '' : 'VFControl/Triangle Generator2/Model' + * '' : 'VFControl/Two-Level Converter1/Model' + * '' : 'VFControl/Two-Level Converter1/Model/Compare To Constant' + * '' : 'VFControl/Two-Level Converter1/Model/Sw1' + * '' : 'VFControl/Two-Level Converter1/Model/Sw2' + * '' : 'VFControl/Two-Level Converter1/Model/Sw3' + * '' : 'VFControl/Two-Level Converter1/Model/Sw4' + * '' : 'VFControl/Two-Level Converter1/Model/Sw5' + * '' : 'VFControl/Two-Level Converter1/Model/Sw6' + * '' : 'VFControl/Two-Level Converter1/Model/Sw1/Model' + * '' : 'VFControl/Two-Level Converter1/Model/Sw1/Model/Measurement list' + * '' : 'VFControl/Two-Level Converter1/Model/Sw2/Model' + * '' : 'VFControl/Two-Level Converter1/Model/Sw2/Model/Measurement list' + * '' : 'VFControl/Two-Level Converter1/Model/Sw3/Model' + * '' : 'VFControl/Two-Level Converter1/Model/Sw3/Model/Measurement list' + * '' : 'VFControl/Two-Level Converter1/Model/Sw4/Model' + * '' : 'VFControl/Two-Level Converter1/Model/Sw4/Model/Measurement list' + * '' : 'VFControl/Two-Level Converter1/Model/Sw5/Model' + * '' : 'VFControl/Two-Level Converter1/Model/Sw5/Model/Measurement list' + * '' : 'VFControl/Two-Level Converter1/Model/Sw6/Model' + * '' : 'VFControl/Two-Level Converter1/Model/Sw6/Model/Measurement list' + * '' : 'VFControl/powergui/EquivalentModel1' + * '' : 'VFControl/powergui/EquivalentModel1/Gates' + * '' : 'VFControl/powergui/EquivalentModel1/Sources' + * '' : 'VFControl/powergui/EquivalentModel1/Status' + * '' : 'VFControl/powergui/EquivalentModel1/Yout' + */ +#endif /* VFControl_h_ */ diff --git a/Control/VF Control/VFControl_sg_rtw/VFControl_cal.cpp b/Control/VF Control/VFControl_sg_rtw/VFControl_cal.cpp new file mode 100644 index 0000000..083a4ab --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/VFControl_cal.cpp @@ -0,0 +1,1336 @@ +#include "VFControl_cal.h" +#include "VFControl.h" + +/* Storage class 'PageSwitching' */ +VFControl_cal_type VFControl_cal_impl = { + /* Mask Parameter: DCVoltageSource_Amplitude + * Referenced by: '/DC' + */ + 230.0, + + /* Mask Parameter: HarmonicAgeneration_Mag_Harmo + * Referenced by: '/Phase_Harmo1' + */ + 5.0, + + /* Mask Parameter: HarmonicBgeneration_Mag_Harmo + * Referenced by: '/Phase_Harmo1' + */ + 10.0, + + /* Mask Parameter: HarmonicAgeneration_Phase_Harmo + * Referenced by: '/Phase_Harmo' + */ + -25.0, + + /* Mask Parameter: HarmonicBgeneration_Phase_Harmo + * Referenced by: '/Phase_Harmo' + */ + 35.0, + + /* Mask Parameter: HarmonicAgeneration_Seq_Harmo + * Referenced by: '/Phase_Harmo2' + */ + 0.0, + + /* Mask Parameter: HarmonicBgeneration_Seq_Harmo + * Referenced by: '/Phase_Harmo2' + */ + 2.0, + + /* Mask Parameter: Variationvaluesteprampmod_Toff_ + * Referenced by: '/Step1' + */ + 1.2, + + /* Mask Parameter: Variationvaluesteprampmod_Ton_V + * Referenced by: '/Step' + */ + 0.2, + + /* Mask Parameter: Variationvaluesteprampmod_Varia + * Referenced by: '/valp_nom9' + */ + 2.0, + + /* Mask Parameter: Variationvaluesteprampmod_Var_l + * Referenced by: '/valp_nom8' + */ + 0.3, + + /* Mask Parameter: Variationvaluesteprampmod_Var_p + * Referenced by: '/valp_nom7' + */ + 10.0, + + /* Mask Parameter: Variationvaluesteprampmod_Var_n + * Referenced by: '/valp_nom6' + */ + -0.5, + + /* Mask Parameter: CompareToConstant_const + * Referenced by: '/Constant' + */ + 0.5, + + /* Mask Parameter: HarmonicAgeneration_n_Harmo + * Referenced by: '/Gain1' + */ + 3.0, + + /* Mask Parameter: HarmonicBgeneration_n_Harmo + * Referenced by: '/Gain1' + */ + 5.0, + + /* Expression: SM.Lsat(1) + * Referenced by: '/Constant1' + */ + 0.0, + + /* Computed Parameter: Linv_Y0 + * Referenced by: '/Linv' + */ + 0.0, + + /* Computed Parameter: RLinv_Y0 + * Referenced by: '/R*Linv' + */ + 0.0, + + /* Computed Parameter: Lm_Y0 + * Referenced by: '/Lm' + */ + 0.0, + + /* Expression: [1/SM.Lls 1/SM.Llr] + * Referenced by: '/u1' + */ + { 78.981714938346315, 5.0436889038830692 }, + + /* Expression: [ SM.Lls SM.Llr ] + * Referenced by: '/u2' + */ + { 0.012661158355204203, 0.19826758133914907 }, + + /* Expression: SM.Lsat(1) + * Referenced by: '/Delay' + */ + 0.0, + + /* Expression: [ 0 SM.Phisat(2:end)./SM.Lsat(2:end) ] + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 1.0 }, + + /* Expression: SM.Phisat + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 1.0 }, + + /* Expression: zeros(4,4) + * Referenced by: '/u1' + */ + { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0 }, + + /* Expression: SM.Ll + * Referenced by: '/u5' + */ + { 0.012661158355204203, 0.0, 0.0, 0.0, 0.0, 0.012661158355204203, 0.0, 0.0, + 0.0, 0.0, 0.19826758133914907, 0.0, 0.0, 0.0, 0.0, 0.19826758133914907 }, + + /* Expression: SM.R + * Referenced by: '/u1' + */ + { 0.0688185, 0.0, 0.0, 0.0, 0.0, 0.0688185, 0.0, 0.0, 0.0, 0.0, + 0.072162562500000013, 0.0, 0.0, 0.0, 0.0, 0.072162562500000013 }, + + /* Expression: SM.Lm + * Referenced by: '/Lm_nosat' + */ + 1.2824177561494388, + + /* Expression: SM.Linv + * Referenced by: '/Constant2' + */ + { 5.4235758573462949, 0.0, -4.6973450774364212, -0.0, 0.0, 5.4235758573462949, + 0.0, -4.6973450774364212, -4.6973450774364212, 0.0, 4.7437214080738226, -0.0, + -0.0, -4.6973450774364212, -0.0, 4.7437214080738226 }, + + /* Expression: SM.RLinv + * Referenced by: '/Constant4' + */ + { 0.373242355138786, 0.0, -0.33897245773457313, 0.0, 0.0, 0.373242355138786, + 0.0, -0.33897245773457313, -0.32326424221155836, 0.0, 0.34231909259271531, + 0.0, 0.0, -0.32326424221155836, 0.0, 0.34231909259271531 }, + + /* Expression: SM.ensat + * Referenced by: '/Constant3' + */ + 0.0, + + /* Expression: 0.5 + * Referenced by: '/Switch1' + */ + 0.5, + + /* Expression: SM.ctrl + * Referenced by: '/Constant4' + */ + 1.0, + + /* Expression: SM.web*Ts/2 + * Referenced by: '/wbase*Ts//2' + */ + 0.015707963267948967, + + /* Expression: eye(4,4) + * Referenced by: '/u5' + */ + { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, + 1.0 }, + + /* Expression: SM.web*Ts/2 + * Referenced by: '/wbase*Ts//2 ' + */ + 0.015707963267948967, + + /* Expression: 0 + * Referenced by: '/vqr,vdr' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/vqs,vds' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/vqr,vdr' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/vqs,vds' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/vqr,vdr' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/vqs,vds' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/ira,irb' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/isa,isb' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/ira,irb' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/isa,isb' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/ira,irb' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/isa,isb' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/sin(beta),cos(beta), sin(th),cos(th)' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/W' + */ + 0.0, + + /* Expression: 1 + * Referenced by: '/we' + */ + 1.0, + + /* Expression: -1 + * Referenced by: '/Gain2' + */ + -1.0, + + /* Expression: SM.web + * Referenced by: '/web_psb' + */ + 314.15926535897933, + + /* Expression: [ 0 1 0 0; -1 0 0 0; 0 0 0 0; 0 0 0 0] + * Referenced by: '/u3' + */ + { 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0 }, + + /* Expression: 0 + * Referenced by: '/sin(thr),cos(thr)' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/W' + */ + 0.0, + + /* Expression: [0; 0] + * Referenced by: '/Constant' + */ + { 0.0, 0.0 }, + + /* Expression: -1 + * Referenced by: '/Gain1' + */ + -1.0, + + /* Expression: zeros(4,4) + * Referenced by: '/u1' + */ + { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0 }, + + /* Expression: 0 + * Referenced by: '/sin(thr),cos(thr)' + */ + 0.0, + + /* Computed Parameter: W_Y0_o + * Referenced by: '/W' + */ + 0.0, + + /* Expression: [0; 0] + * Referenced by: '/Constant' + */ + { 0.0, 0.0 }, + + /* Expression: -1 + * Referenced by: '/Gain3' + */ + -1.0, + + /* Expression: zeros(4,4) + * Referenced by: '/u4' + */ + { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0 }, + + /* Expression: [0 0 0] + * Referenced by: '/Zero-sequence' + */ + { 0.0, 0.0, 0.0 }, + + /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/Positive-sequence' + */ + { 0.0, -2.0943951023931953, 2.0943951023931953 }, + + /* Expression: [0 2*pi/3 -2*pi/3] + * Referenced by: '/Negative-sequence' + */ + { 0.0, 2.0943951023931953, -2.0943951023931953 }, + + /* Expression: [0 0 0] + * Referenced by: '/Zero-sequence' + */ + { 0.0, 0.0, 0.0 }, + + /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/Positive-sequence' + */ + { 0.0, -2.0943951023931953, 2.0943951023931953 }, + + /* Expression: [0 2*pi/3 -2*pi/3] + * Referenced by: '/Negative-sequence' + */ + { 0.0, 2.0943951023931953, -2.0943951023931953 }, + + /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + 0.017453292519943295, + + /* Expression: pi/180 + * Referenced by: '/Gain4' + */ + 0.017453292519943295, + + /* Expression: 2*pi + * Referenced by: '/Gain1' + */ + 6.2831853071795862, + + /* Expression: 0 + * Referenced by: '/Constant4' + */ + 0.0, + + /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + 1000.0, + + /* Expression: 0 + * Referenced by: '/0 4' + */ + 0.0, + + /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + 1000.0, + + /* Expression: 0 + * Referenced by: '/0 4' + */ + 0.0, + + /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + 1000.0, + + /* Expression: 0 + * Referenced by: '/0 4' + */ + 0.0, + + /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + 1000.0, + + /* Expression: 0 + * Referenced by: '/0 4' + */ + 0.0, + + /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + 1000.0, + + /* Expression: 0 + * Referenced by: '/0 4' + */ + 0.0, + + /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + 1000.0, + + /* Expression: 0 + * Referenced by: '/0 4' + */ + 0.0, + + /* Expression: zeros(6,1) + * Referenced by: '/SwitchCurrents' + */ + { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, + + /* Expression: SM.ctrl + * Referenced by: '/Constant3' + */ + 1.0, + + /* Expression: SM.phiqd0 + * Referenced by: '/fluxes' + */ + { 0.0, 0.0, 0.0, 0.0 }, + + /* Expression: 2 + * Referenced by: '/Gain' + */ + 2.0, + + /* Expression: SM.phiqd0 + * Referenced by: '/fluxes' + */ + { 0.0, 0.0, 0.0, 0.0 }, + + /* Expression: SM.ensat + * Referenced by: '/Constant' + */ + 0.0, + + /* Expression: SM.ensat + * Referenced by: '/Constant1' + */ + 0.0, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: SM.ctrl + * Referenced by: '/Constant2' + */ + 1.0, + + /* Computed Parameter: Rotoranglethetam_gainval + * Referenced by: '/Rotor angle thetam' + */ + 0.0001, + + /* Expression: SM.tho + * Referenced by: '/Rotor angle thetam' + */ + 0.0, + + /* Expression: SM.wmo + * Referenced by: '/wm_delay' + */ + 1.0, + + /* Expression: 2 + * Referenced by: '/F2' + */ + 2.0, + + /* Expression: SM.wmo + * Referenced by: '/wm_predict' + */ + 1.0, + + /* Expression: SM.ctrl + * Referenced by: '/Constant4' + */ + 1.0, + + /* Expression: SM.ib + * Referenced by: '/ib' + */ + 37.660904795291366, + + /* Expression: SM.Gain_Vr_Vs + * Referenced by: '/Gain Vr_Vs1' + */ + { 1.0, 1.0 }, + + /* Expression: S.D + * Referenced by: '/State-Space' + */ + { -500000.0, 500000.0, 0.0, 0.0, 0.0, 0.0, 500000.0, 0.0, 500000.0, 0.0, + -500000.0, 0.0, 0.0, 0.0, 500000.0, -500000.0, 0.0, 0.0, 0.0, 0.0, -500000.0, + 0.0, -500000.0, 0.0, 500000.0, 0.0, 0.0, 0.0, 0.0, 0.0, -500000.0, 500000.0, + 0.0, 0.0, -500000.0, 500000.0, -500000.0, 500000.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 500000.0, -500000.0, 0.0, 0.0, 500000.0, -500000.0, 500000.0, -500000.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -500000.0, 500000.0, 0.0, -500000.0, + 0.0, -500000.0, 500000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 500000.0, + -500000.0, 0.0, 500000.0, 0.0, 500000.0, -500000.0, 0.0, 0.0, 0.0, 500000.0, + -500000.0, 0.0, 0.0, -500000.0, 500000.0, -500000.0, -500000.0, -500000.0, + -500000.0, 1.0E+6, 1.0, 0.0, -1.0, 0.0, 0.0, 500000.0, -500000.0, -500000.0, + 500000.0, 500000.0, -1.0E+6, 500000.0, -1.0E+6, 500000.0, 0.0, 1.0, -1.0, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, + + /* Expression: SM.ensat + * Referenced by: '/Constant5' + */ + 0.0, + + /* Expression: [1 -1] + * Referenced by: '/1-1' + */ + { 1.0, -1.0 }, + + /* Expression: 0.5 + * Referenced by: '/Switch2' + */ + 0.5, + + /* Expression: SM.ctrl + * Referenced by: '/Constant4' + */ + 1.0, + + /* Expression: [0;0] + * Referenced by: '/Constant6' + */ + { 0.0, 0.0 }, + + /* Expression: SM.Gain_Vr_Vs + * Referenced by: '/Gain Vr_Vs' + */ + { 1.0, 1.0 }, + + /* Expression: 1/SM.Vb + * Referenced by: '/1_Vb' + */ + 0.0030618621784789728, + + /* Expression: SM.ctrl + * Referenced by: '/Constant3' + */ + 1.0, + + /* Expression: 0 + * Referenced by: '/voltages' + */ + 0.0, + + /* Expression: Ts + * Referenced by: '/IC' + */ + 0.0001, + + /* Expression: [SM.ib2*SM.kIr*ones(5,1); SM.phib2*SM.kVr; SM.phib2*SM.kVr; SM.Vb2*SM.kVr; SM.Vb2*SM.kVr ; SM.ib2*ones(5,1); SM.phib2; SM.phib2; SM.Vb2; SM.Vb2; SM.phib2/SM.ib2] + * Referenced by: '/unit conversion' + */ + { 37.660904795291366, 37.660904795291366, 37.660904795291366, + 37.660904795291366, 37.660904795291366, 1.0395957349782348, + 1.0395957349782348, 326.59863237109039, 326.59863237109039, + 37.660904795291366, 37.660904795291366, 37.660904795291366, + 37.660904795291366, 37.660904795291366, 1.0395957349782348, + 1.0395957349782348, 326.59863237109039, 326.59863237109039, + 0.027604109370952035 }, + + /* Expression: 1/SM.p + * Referenced by: '/1\p' + */ + 0.5, + + /* Expression: [SM.Nb2;SM.Tb2;1] + * Referenced by: '/1\p1' + */ + { 157.07963267948966, 117.45634800181875, 1.0 }, + + /* Expression: 1/SM.Tb2 + * Referenced by: '/Unit conversion' + */ + 0.0085138012292406331, + + /* Expression: SM.F + * Referenced by: '/F' + */ + 0.0078622499016266032, + + /* Expression: 1/(2*SM.H) + * Referenced by: '/1_2H' + */ + 14.955006705609055, + + /* Computed Parameter: Rotorspeedwm_gainval + * Referenced by: '/Rotor speed(wm)' + */ + 5.0E-5, + + /* Expression: SM.wmo + * Referenced by: '/Rotor speed(wm)' + */ + 1.0, + + /* Expression: SM.web + * Referenced by: '/web_psb' + */ + 314.15926535897933, + + /* Expression: sps.tv + * Referenced by: '/Look-Up Table' + */ + { 0.0, 0.099900000000000017, 0.099900000000000017, 0.14990000000000003, + 0.14990000000000003, 0.19990000000000005, 0.19990000000000005, 1.1999 }, + + /* Expression: sps.opv + * Referenced by: '/Look-Up Table' + */ + { 1.0, 1.0, 0.2, 0.2, 1.2, 1.2, 1.0, 1.0 }, + + /* Expression: sps.VariationType + * Referenced by: '/valp_nom1' + */ + 2.0, + + /* Expression: 4 + * Referenced by: '/Constant6' + */ + 4.0, + + /* Expression: sps.VariationEntity + * Referenced by: '/valp_nom3' + */ + 1.0, + + /* Expression: 2 + * Referenced by: '/Constant' + */ + 2.0, + + /* Expression: 0 + * Referenced by: '/Constant1' + */ + 0.0, + + /* Expression: 1 + * Referenced by: '/Step1' + */ + 1.0, + + /* Expression: 0 + * Referenced by: '/Step1' + */ + 0.0, + + /* Expression: sps.VariationType + * Referenced by: '/valp_nom5' + */ + 2.0, + + /* Expression: 1 + * Referenced by: '/Constant3' + */ + 1.0, + + /* Expression: 0 + * Referenced by: '/Step' + */ + 0.0, + + /* Expression: 1 + * Referenced by: '/Step' + */ + 1.0, + + /* Computed Parameter: DiscreteTimeIntegrator1_gainval + * Referenced by: '/Discrete-Time Integrator1' + */ + 0.0001, + + /* Expression: 0 + * Referenced by: '/Discrete-Time Integrator1' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/Constant5' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/Unit Delay1' + */ + 0.0, + + /* Expression: 0.5 + * Referenced by: '/Switch2' + */ + 0.5, + + /* Expression: 0 + * Referenced by: '/Constant1' + */ + 0.0, + + /* Expression: sps.Mag_Vps + * Referenced by: '/valp_nom2' + */ + 230.0, + + /* Expression: sps.SinglePhase + * Referenced by: '/SinglePhase' + */ + 1.0, + + /* Expression: 0.5 + * Referenced by: '/Switch5' + */ + 0.5, + + /* Expression: sps.Freq_Vps + * Referenced by: '/valp_nom1' + */ + 50.0, + + /* Expression: 2*pi + * Referenced by: '/Gain' + */ + 6.2831853071795862, + + /* Computed Parameter: DiscreteTimeIntegrator_gainval + * Referenced by: '/Discrete-Time Integrator' + */ + 0.0001, + + /* Expression: 0 + * Referenced by: '/Discrete-Time Integrator' + */ + 0.0, + + /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/P1' + */ + { 0.0, -2.0943951023931953, 2.0943951023931953 }, + + /* Expression: sps.VariationType + * Referenced by: '/valp_nom1' + */ + 2.0, + + /* Expression: 4 + * Referenced by: '/Constant6' + */ + 4.0, + + /* Expression: 3 + * Referenced by: '/Constant2' + */ + 3.0, + + /* Expression: sps.Phase_Vps + * Referenced by: '/valp_nom' + */ + 0.0, + + /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + 0.017453292519943295, + + /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/P1' + */ + { 0.0, -2.0943951023931953, 2.0943951023931953 }, + + /* Expression: 0 + * Referenced by: '/Constant4' + */ + 0.0, + + /* Expression: sps.SinglePhase + * Referenced by: '/SinglePhase' + */ + 1.0, + + /* Expression: 0.5 + * Referenced by: '/Switch5' + */ + 0.5, + + /* Expression: sps.Ton_Harmo + * Referenced by: '/Step' + */ + 0.05, + + /* Expression: 0 + * Referenced by: '/Step' + */ + 0.0, + + /* Expression: 1 + * Referenced by: '/Step' + */ + 1.0, + + /* Expression: sps.Toff_Harmo + * Referenced by: '/Step1' + */ + 99.0, + + /* Expression: 0 + * Referenced by: '/Step1' + */ + 0.0, + + /* Expression: -1 + * Referenced by: '/Step1' + */ + -1.0, + + /* Expression: sps.HarmonicGeneration + * Referenced by: '/valp_nom7' + */ + 0.0, + + /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + 0.017453292519943295, + + /* Expression: 1 + * Referenced by: '/valp_nom2' + */ + 1.0, + + /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + 0.017453292519943295, + + /* Expression: 1 + * Referenced by: '/valp_nom2' + */ + 1.0, + + /* Expression: sps.Delay + * Referenced by: '/Constant3' + */ + 0.0, + + /* Expression: sps.Period + * Referenced by: '/Constant4' + */ + 0.001, + + /* Expression: sps.Freq + * Referenced by: '/1\ib1' + */ + 1000.0, + + /* Expression: [0 2 0] + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 2.0, 0.0 }, + + /* Expression: [0 .5 1] + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 0.5, 1.0 }, + + /* Expression: 1 + * Referenced by: '/Constant2' + */ + 1.0, + + /* Expression: 230 + * Referenced by: '/Constant' + */ + 230.0, + + /* Expression: sps.Delay + * Referenced by: '/Constant3' + */ + 5.81775E-6, + + /* Expression: sps.Period + * Referenced by: '/Constant1' + */ + 0.001, + + /* Expression: sps.Freq + * Referenced by: '/1\ib1' + */ + 1000.0, + + /* Expression: [0 2 0] + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 2.0, 0.0 }, + + /* Expression: [0 .5 1] + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 0.5, 1.0 }, + + /* Expression: 1 + * Referenced by: '/Constant2' + */ + 1.0, + + /* Expression: 230 + * Referenced by: '/Constant1' + */ + 230.0, + + /* Expression: sps.Delay + * Referenced by: '/Constant3' + */ + 1.163552777777778E-5, + + /* Expression: sps.Period + * Referenced by: '/Constant1' + */ + 0.001, + + /* Expression: sps.Freq + * Referenced by: '/1\ib1' + */ + 1000.0, + + /* Expression: [0 2 0] + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 2.0, 0.0 }, + + /* Expression: [0 .5 1] + * Referenced by: '/1-D Lookup Table' + */ + { 0.0, 0.5, 1.0 }, + + /* Expression: 1 + * Referenced by: '/Constant2' + */ + 1.0, + + /* Expression: 230 + * Referenced by: '/Constant2' + */ + 230.0, + + /* Expression: 1e-6 + * Referenced by: '/Transport Delay' + */ + 1.0E-6, + + /* Expression: 0 + * Referenced by: '/Transport Delay' + */ + 0.0, + + /* Expression: 1e-6 + * Referenced by: '/Transport Delay' + */ + 1.0E-6, + + /* Expression: 0 + * Referenced by: '/Transport Delay' + */ + 0.0, + + /* Expression: 1e-6 + * Referenced by: '/Transport Delay' + */ + 1.0E-6, + + /* Expression: 0 + * Referenced by: '/Transport Delay' + */ + 0.0, + + /* Computed Parameter: Digitaloutput1_P1_Size + * Referenced by: '/Digital output1' + */ + { 1.0, 1.0 }, + + /* Expression: id + * Referenced by: '/Digital output1' + */ + 1.0, + + /* Computed Parameter: Digitaloutput1_P2_Size + * Referenced by: '/Digital output1' + */ + { 1.0, 3.0 }, + + /* Expression: chan + * Referenced by: '/Digital output1' + */ + { 2.0, 5.0, 7.0 }, + + /* Computed Parameter: Digitaloutput1_P3_Size + * Referenced by: '/Digital output1' + */ + { 1.0, 1.0 }, + + /* Expression: vectorizeInput + * Referenced by: '/Digital output1' + */ + 0.0, + + /* Computed Parameter: Digitaloutput1_P4_Size + * Referenced by: '/Digital output1' + */ + { 1.0, 3.0 }, + + /* Expression: reset + * Referenced by: '/Digital output1' + */ + { 1.0, 1.0, 1.0 }, + + /* Computed Parameter: Digitaloutput1_P5_Size + * Referenced by: '/Digital output1' + */ + { 1.0, 3.0 }, + + /* Expression: init + * Referenced by: '/Digital output1' + */ + { 0.0, 0.0, 0.0 }, + + /* Computed Parameter: Digitaloutput1_P6_Size + * Referenced by: '/Digital output1' + */ + { 1.0, 1.0 }, + + /* Expression: ts + * Referenced by: '/Digital output1' + */ + -1.0, + + /* Computed Parameter: Digitaloutput2_P1_Size + * Referenced by: '/Digital output2' + */ + { 1.0, 1.0 }, + + /* Expression: id + * Referenced by: '/Digital output2' + */ + 1.0, + + /* Computed Parameter: Digitaloutput2_P2_Size + * Referenced by: '/Digital output2' + */ + { 1.0, 3.0 }, + + /* Expression: chan + * Referenced by: '/Digital output2' + */ + { 1.0, 4.0, 6.0 }, + + /* Computed Parameter: Digitaloutput2_P3_Size + * Referenced by: '/Digital output2' + */ + { 1.0, 1.0 }, + + /* Expression: vectorizeInput + * Referenced by: '/Digital output2' + */ + 0.0, + + /* Computed Parameter: Digitaloutput2_P4_Size + * Referenced by: '/Digital output2' + */ + { 1.0, 3.0 }, + + /* Expression: reset + * Referenced by: '/Digital output2' + */ + { 1.0, 1.0, 1.0 }, + + /* Computed Parameter: Digitaloutput2_P5_Size + * Referenced by: '/Digital output2' + */ + { 1.0, 3.0 }, + + /* Expression: init + * Referenced by: '/Digital output2' + */ + { 0.0, 0.0, 0.0 }, + + /* Computed Parameter: Digitaloutput2_P6_Size + * Referenced by: '/Digital output2' + */ + { 1.0, 1.0 }, + + /* Expression: ts + * Referenced by: '/Digital output2' + */ + -1.0, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: 1 + * Referenced by: '/Saturation' + */ + 1.0, + + /* Expression: 0 + * Referenced by: '/Saturation' + */ + 0.0, + + /* Expression: 0 + * Referenced by: '/Constant6' + */ + 0.0, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: -1 + * Referenced by: '/Constant' + */ + -1.0, + + /* Expression: -1 + * Referenced by: '/Constant' + */ + -1.0, + + /* Expression: -1 + * Referenced by: '/Constant' + */ + -1.0, + + /* Expression: 0 + * Referenced by: '/Constant5' + */ + 0.0, + + /* Expression: 4 + * Referenced by: '/Constant3' + */ + 4.0, + + /* Expression: 2*pi + * Referenced by: '/Gain2' + */ + 6.2831853071795862, + + /* Expression: 180/pi + * Referenced by: '/Gain3' + */ + 57.295779513082323, + + /* Expression: 2*pi + * Referenced by: '/Constant7' + */ + 6.2831853071795862, + + /* Expression: 2 + * Referenced by: '/Constant' + */ + 2.0, + + /* Expression: 1 + * Referenced by: '/Constant2' + */ + 1.0, + + /* Expression: 0.5 + * Referenced by: '/Switch' + */ + 0.5, + + /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + 1.0, + + /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + 1.0, + + /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + 1.0, + + /* Expression: Kv + * Referenced by: '/Kv1' + */ + 1.0, + + /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + 1.0, + + /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + 1.0, + + /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + 1.0, + + /* Expression: Ki + * Referenced by: '/Kv' + */ + 1.0, + + /* Expression: 0 + * Referenced by: '/Unit Delay' + */ + 0.0, + + /* Expression: SM.ctrl==1 + * Referenced by: '/Constant' + */ + true, + + /* Expression: SM.ctrl==2 + * Referenced by: '/Constant1' + */ + false, + + /* Expression: SM.ctrl==3 + * Referenced by: '/Constant3' + */ + false, + + /* Expression: SM.ctrl==1 + * Referenced by: '/Constant' + */ + true, + + /* Expression: SM.ctrl==2 + * Referenced by: '/Constant1' + */ + false, + + /* Expression: SM.ctrl==3 + * Referenced by: '/Constant2' + */ + false, + + /* Expression: SM.ctrl==1 + * Referenced by: '/Constant' + */ + true, + + /* Expression: SM.ctrl==2 + * Referenced by: '/Constant1' + */ + false, + + /* Expression: SM.ctrl==3 + * Referenced by: '/Constant2' + */ + false +}; + +VFControl_cal_type *VFControl_cal = &VFControl_cal_impl; diff --git a/Control/VF Control/VFControl_sg_rtw/VFControl_cal.h b/Control/VF Control/VFControl_sg_rtw/VFControl_cal.h new file mode 100644 index 0000000..8d28e09 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/VFControl_cal.h @@ -0,0 +1,813 @@ +#ifndef VFControl_cal_h_ +#define VFControl_cal_h_ +#include "rtwtypes.h" + +/* Storage class 'PageSwitching', for system '' */ +struct VFControl_cal_type { + real_T DCVoltageSource_Amplitude; /* Mask Parameter: DCVoltageSource_Amplitude + * Referenced by: '/DC' + */ + real_T HarmonicAgeneration_Mag_Harmo; + /* Mask Parameter: HarmonicAgeneration_Mag_Harmo + * Referenced by: '/Phase_Harmo1' + */ + real_T HarmonicBgeneration_Mag_Harmo; + /* Mask Parameter: HarmonicBgeneration_Mag_Harmo + * Referenced by: '/Phase_Harmo1' + */ + real_T HarmonicAgeneration_Phase_Harmo; + /* Mask Parameter: HarmonicAgeneration_Phase_Harmo + * Referenced by: '/Phase_Harmo' + */ + real_T HarmonicBgeneration_Phase_Harmo; + /* Mask Parameter: HarmonicBgeneration_Phase_Harmo + * Referenced by: '/Phase_Harmo' + */ + real_T HarmonicAgeneration_Seq_Harmo; + /* Mask Parameter: HarmonicAgeneration_Seq_Harmo + * Referenced by: '/Phase_Harmo2' + */ + real_T HarmonicBgeneration_Seq_Harmo; + /* Mask Parameter: HarmonicBgeneration_Seq_Harmo + * Referenced by: '/Phase_Harmo2' + */ + real_T Variationvaluesteprampmod_Toff_; + /* Mask Parameter: Variationvaluesteprampmod_Toff_ + * Referenced by: '/Step1' + */ + real_T Variationvaluesteprampmod_Ton_V; + /* Mask Parameter: Variationvaluesteprampmod_Ton_V + * Referenced by: '/Step' + */ + real_T Variationvaluesteprampmod_Varia; + /* Mask Parameter: Variationvaluesteprampmod_Varia + * Referenced by: '/valp_nom9' + */ + real_T Variationvaluesteprampmod_Var_l; + /* Mask Parameter: Variationvaluesteprampmod_Var_l + * Referenced by: '/valp_nom8' + */ + real_T Variationvaluesteprampmod_Var_p; + /* Mask Parameter: Variationvaluesteprampmod_Var_p + * Referenced by: '/valp_nom7' + */ + real_T Variationvaluesteprampmod_Var_n; + /* Mask Parameter: Variationvaluesteprampmod_Var_n + * Referenced by: '/valp_nom6' + */ + real_T CompareToConstant_const; /* Mask Parameter: CompareToConstant_const + * Referenced by: '/Constant' + */ + real_T HarmonicAgeneration_n_Harmo; + /* Mask Parameter: HarmonicAgeneration_n_Harmo + * Referenced by: '/Gain1' + */ + real_T HarmonicBgeneration_n_Harmo; + /* Mask Parameter: HarmonicBgeneration_n_Harmo + * Referenced by: '/Gain1' + */ + real_T Constant1_Value; /* Expression: SM.Lsat(1) + * Referenced by: '/Constant1' + */ + real_T Linv_Y0; /* Computed Parameter: Linv_Y0 + * Referenced by: '/Linv' + */ + real_T RLinv_Y0; /* Computed Parameter: RLinv_Y0 + * Referenced by: '/R*Linv' + */ + real_T Lm_Y0; /* Computed Parameter: Lm_Y0 + * Referenced by: '/Lm' + */ + real_T u1_Value[2]; /* Expression: [1/SM.Lls 1/SM.Llr] + * Referenced by: '/u1' + */ + real_T u2_Value[2]; /* Expression: [ SM.Lls SM.Llr ] + * Referenced by: '/u2' + */ + real_T Delay_InitialCondition; /* Expression: SM.Lsat(1) + * Referenced by: '/Delay' + */ + real_T uDLookupTable_tableData[2]; + /* Expression: [ 0 SM.Phisat(2:end)./SM.Lsat(2:end) ] + * Referenced by: '/1-D Lookup Table' + */ + real_T uDLookupTable_bp01Data[2]; /* Expression: SM.Phisat + * Referenced by: '/1-D Lookup Table' + */ + real_T u1_Value_d[16]; /* Expression: zeros(4,4) + * Referenced by: '/u1' + */ + real_T u5_Value[16]; /* Expression: SM.Ll + * Referenced by: '/u5' + */ + real_T u1_Value_e[16]; /* Expression: SM.R + * Referenced by: '/u1' + */ + real_T Lm_nosat_Value; /* Expression: SM.Lm + * Referenced by: '/Lm_nosat' + */ + real_T Constant2_Value[16]; /* Expression: SM.Linv + * Referenced by: '/Constant2' + */ + real_T Constant4_Value[16]; /* Expression: SM.RLinv + * Referenced by: '/Constant4' + */ + real_T Constant3_Value; /* Expression: SM.ensat + * Referenced by: '/Constant3' + */ + real_T Switch1_Threshold; /* Expression: 0.5 + * Referenced by: '/Switch1' + */ + real_T Constant4_Value_e; /* Expression: SM.ctrl + * Referenced by: '/Constant4' + */ + real_T wbaseTs2_Gain; /* Expression: SM.web*Ts/2 + * Referenced by: '/wbase*Ts//2' + */ + real_T u5_Value_l[16]; /* Expression: eye(4,4) + * Referenced by: '/u5' + */ + real_T wbaseTs2_Gain_c; /* Expression: SM.web*Ts/2 + * Referenced by: '/wbase*Ts//2 ' + */ + real_T vqrvdr_Y0; /* Expression: 0 + * Referenced by: '/vqr,vdr' + */ + real_T vqsvds_Y0; /* Expression: 0 + * Referenced by: '/vqs,vds' + */ + real_T vqrvdr_Y0_a; /* Expression: 0 + * Referenced by: '/vqr,vdr' + */ + real_T vqsvds_Y0_m; /* Expression: 0 + * Referenced by: '/vqs,vds' + */ + real_T vqrvdr_Y0_am; /* Expression: 0 + * Referenced by: '/vqr,vdr' + */ + real_T vqsvds_Y0_p; /* Expression: 0 + * Referenced by: '/vqs,vds' + */ + real_T irairb_Y0; /* Expression: 0 + * Referenced by: '/ira,irb' + */ + real_T isaisb_Y0; /* Expression: 0 + * Referenced by: '/isa,isb' + */ + real_T irairb_Y0_d; /* Expression: 0 + * Referenced by: '/ira,irb' + */ + real_T isaisb_Y0_k; /* Expression: 0 + * Referenced by: '/isa,isb' + */ + real_T irairb_Y0_h; /* Expression: 0 + * Referenced by: '/ira,irb' + */ + real_T isaisb_Y0_m; /* Expression: 0 + * Referenced by: '/isa,isb' + */ + real_T sinbetacosbetasinthcosth_Y0; /* Expression: 0 + * Referenced by: '/sin(beta),cos(beta), sin(th),cos(th)' + */ + real_T W_Y0; /* Expression: 0 + * Referenced by: '/W' + */ + real_T we_Value; /* Expression: 1 + * Referenced by: '/we' + */ + real_T Gain2_Gain; /* Expression: -1 + * Referenced by: '/Gain2' + */ + real_T web_psb_Gain; /* Expression: SM.web + * Referenced by: '/web_psb' + */ + real_T u3_Value[16]; + /* Expression: [ 0 1 0 0; -1 0 0 0; 0 0 0 0; 0 0 0 0] + * Referenced by: '/u3' + */ + real_T sinthrcosthr_Y0; /* Expression: 0 + * Referenced by: '/sin(thr),cos(thr)' + */ + real_T W_Y0_m; /* Expression: 0 + * Referenced by: '/W' + */ + real_T Constant_Value[2]; /* Expression: [0; 0] + * Referenced by: '/Constant' + */ + real_T Gain1_Gain; /* Expression: -1 + * Referenced by: '/Gain1' + */ + real_T u1_Value_j[16]; /* Expression: zeros(4,4) + * Referenced by: '/u1' + */ + real_T sinthrcosthr_Y0_h; /* Expression: 0 + * Referenced by: '/sin(thr),cos(thr)' + */ + real_T W_Y0_o; /* Computed Parameter: W_Y0_o + * Referenced by: '/W' + */ + real_T Constant_Value_n[2]; /* Expression: [0; 0] + * Referenced by: '/Constant' + */ + real_T Gain3_Gain; /* Expression: -1 + * Referenced by: '/Gain3' + */ + real_T u4_Value[16]; /* Expression: zeros(4,4) + * Referenced by: '/u4' + */ + real_T Zerosequence_Value[3]; /* Expression: [0 0 0] + * Referenced by: '/Zero-sequence' + */ + real_T Positivesequence_Value[3]; /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/Positive-sequence' + */ + real_T Negativesequence_Value[3]; /* Expression: [0 2*pi/3 -2*pi/3] + * Referenced by: '/Negative-sequence' + */ + real_T Zerosequence_Value_h[3]; /* Expression: [0 0 0] + * Referenced by: '/Zero-sequence' + */ + real_T Positivesequence_Value_o[3]; /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/Positive-sequence' + */ + real_T Negativesequence_Value_k[3]; /* Expression: [0 2*pi/3 -2*pi/3] + * Referenced by: '/Negative-sequence' + */ + real_T Gain3_Gain_c; /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + real_T Gain4_Gain; /* Expression: pi/180 + * Referenced by: '/Gain4' + */ + real_T Gain1_Gain_n; /* Expression: 2*pi + * Referenced by: '/Gain1' + */ + real_T Constant4_Value_f; /* Expression: 0 + * Referenced by: '/Constant4' + */ + real_T uRsw_Gain; /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + real_T u4_Value_l; /* Expression: 0 + * Referenced by: '/0 4' + */ + real_T uRsw_Gain_e; /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + real_T u4_Value_j; /* Expression: 0 + * Referenced by: '/0 4' + */ + real_T uRsw_Gain_l; /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + real_T u4_Value_c; /* Expression: 0 + * Referenced by: '/0 4' + */ + real_T uRsw_Gain_k; /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + real_T u4_Value_m; /* Expression: 0 + * Referenced by: '/0 4' + */ + real_T uRsw_Gain_m; /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + real_T u4_Value_lk; /* Expression: 0 + * Referenced by: '/0 4' + */ + real_T uRsw_Gain_k4; /* Expression: 1./Ron + * Referenced by: '/1//Rsw' + */ + real_T u4_Value_o; /* Expression: 0 + * Referenced by: '/0 4' + */ + real_T SwitchCurrents_Value[6]; /* Expression: zeros(6,1) + * Referenced by: '/SwitchCurrents' + */ + real_T Constant3_Value_e; /* Expression: SM.ctrl + * Referenced by: '/Constant3' + */ + real_T fluxes_InitialCondition[4]; /* Expression: SM.phiqd0 + * Referenced by: '/fluxes' + */ + real_T Gain_Gain; /* Expression: 2 + * Referenced by: '/Gain' + */ + real_T fluxes_InitialCondition_a[4]; /* Expression: SM.phiqd0 + * Referenced by: '/fluxes' + */ + real_T Constant_Value_e; /* Expression: SM.ensat + * Referenced by: '/Constant' + */ + real_T Constant1_Value_k; /* Expression: SM.ensat + * Referenced by: '/Constant1' + */ + real_T Switch_Threshold; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T Constant2_Value_n; /* Expression: SM.ctrl + * Referenced by: '/Constant2' + */ + real_T Rotoranglethetam_gainval; + /* Computed Parameter: Rotoranglethetam_gainval + * Referenced by: '/Rotor angle thetam' + */ + real_T Rotoranglethetam_IC; /* Expression: SM.tho + * Referenced by: '/Rotor angle thetam' + */ + real_T wm_delay_InitialCondition; /* Expression: SM.wmo + * Referenced by: '/wm_delay' + */ + real_T F2_Gain; /* Expression: 2 + * Referenced by: '/F2' + */ + real_T wm_predict_InitialCondition; /* Expression: SM.wmo + * Referenced by: '/wm_predict' + */ + real_T Constant4_Value_c; /* Expression: SM.ctrl + * Referenced by: '/Constant4' + */ + real_T ib_Gain; /* Expression: SM.ib + * Referenced by: '/ib' + */ + real_T GainVr_Vs1_Gain[2]; /* Expression: SM.Gain_Vr_Vs + * Referenced by: '/Gain Vr_Vs1' + */ + real_T StateSpace_DS_param[126]; /* Expression: S.D + * Referenced by: '/State-Space' + */ + real_T Constant5_Value; /* Expression: SM.ensat + * Referenced by: '/Constant5' + */ + real_T u1_Gain[2]; /* Expression: [1 -1] + * Referenced by: '/1-1' + */ + real_T Switch2_Threshold; /* Expression: 0.5 + * Referenced by: '/Switch2' + */ + real_T Constant4_Value_i; /* Expression: SM.ctrl + * Referenced by: '/Constant4' + */ + real_T Constant6_Value[2]; /* Expression: [0;0] + * Referenced by: '/Constant6' + */ + real_T GainVr_Vs_Gain[2]; /* Expression: SM.Gain_Vr_Vs + * Referenced by: '/Gain Vr_Vs' + */ + real_T u_Vb_Gain; /* Expression: 1/SM.Vb + * Referenced by: '/1_Vb' + */ + real_T Constant3_Value_g; /* Expression: SM.ctrl + * Referenced by: '/Constant3' + */ + real_T voltages_InitialCondition; /* Expression: 0 + * Referenced by: '/voltages' + */ + real_T IC_Threshold; /* Expression: Ts + * Referenced by: '/IC' + */ + real_T unitconversion_Gain[19]; + /* Expression: [SM.ib2*SM.kIr*ones(5,1); SM.phib2*SM.kVr; SM.phib2*SM.kVr; SM.Vb2*SM.kVr; SM.Vb2*SM.kVr ; SM.ib2*ones(5,1); SM.phib2; SM.phib2; SM.Vb2; SM.Vb2; SM.phib2/SM.ib2] + * Referenced by: '/unit conversion' + */ + real_T up_Gain; /* Expression: 1/SM.p + * Referenced by: '/1\p' + */ + real_T up1_Gain[3]; /* Expression: [SM.Nb2;SM.Tb2;1] + * Referenced by: '/1\p1' + */ + real_T Unitconversion_Gain; /* Expression: 1/SM.Tb2 + * Referenced by: '/Unit conversion' + */ + real_T F_Gain; /* Expression: SM.F + * Referenced by: '/F' + */ + real_T u_2H_Gain; /* Expression: 1/(2*SM.H) + * Referenced by: '/1_2H' + */ + real_T Rotorspeedwm_gainval; /* Computed Parameter: Rotorspeedwm_gainval + * Referenced by: '/Rotor speed(wm)' + */ + real_T Rotorspeedwm_IC; /* Expression: SM.wmo + * Referenced by: '/Rotor speed(wm)' + */ + real_T web_psb_Gain_n; /* Expression: SM.web + * Referenced by: '/web_psb' + */ + real_T LookUpTable_XData[8]; /* Expression: sps.tv + * Referenced by: '/Look-Up Table' + */ + real_T LookUpTable_YData[8]; /* Expression: sps.opv + * Referenced by: '/Look-Up Table' + */ + real_T valp_nom1_Value; /* Expression: sps.VariationType + * Referenced by: '/valp_nom1' + */ + real_T Constant6_Value_k; /* Expression: 4 + * Referenced by: '/Constant6' + */ + real_T valp_nom3_Value; /* Expression: sps.VariationEntity + * Referenced by: '/valp_nom3' + */ + real_T Constant_Value_nw; /* Expression: 2 + * Referenced by: '/Constant' + */ + real_T Constant1_Value_a; /* Expression: 0 + * Referenced by: '/Constant1' + */ + real_T Step1_Y0; /* Expression: 1 + * Referenced by: '/Step1' + */ + real_T Step1_YFinal; /* Expression: 0 + * Referenced by: '/Step1' + */ + real_T valp_nom5_Value; /* Expression: sps.VariationType + * Referenced by: '/valp_nom5' + */ + real_T Constant3_Value_ey; /* Expression: 1 + * Referenced by: '/Constant3' + */ + real_T Step_Y0; /* Expression: 0 + * Referenced by: '/Step' + */ + real_T Step_YFinal; /* Expression: 1 + * Referenced by: '/Step' + */ + real_T DiscreteTimeIntegrator1_gainval; + /* Computed Parameter: DiscreteTimeIntegrator1_gainval + * Referenced by: '/Discrete-Time Integrator1' + */ + real_T DiscreteTimeIntegrator1_IC; /* Expression: 0 + * Referenced by: '/Discrete-Time Integrator1' + */ + real_T Constant5_Value_c; /* Expression: 0 + * Referenced by: '/Constant5' + */ + real_T UnitDelay1_InitialCondition; /* Expression: 0 + * Referenced by: '/Unit Delay1' + */ + real_T Switch2_Threshold_a; /* Expression: 0.5 + * Referenced by: '/Switch2' + */ + real_T Constant1_Value_j; /* Expression: 0 + * Referenced by: '/Constant1' + */ + real_T valp_nom2_Value; /* Expression: sps.Mag_Vps + * Referenced by: '/valp_nom2' + */ + real_T SinglePhase_Value; /* Expression: sps.SinglePhase + * Referenced by: '/SinglePhase' + */ + real_T Switch5_Threshold; /* Expression: 0.5 + * Referenced by: '/Switch5' + */ + real_T valp_nom1_Value_g; /* Expression: sps.Freq_Vps + * Referenced by: '/valp_nom1' + */ + real_T Gain_Gain_k; /* Expression: 2*pi + * Referenced by: '/Gain' + */ + real_T DiscreteTimeIntegrator_gainval; + /* Computed Parameter: DiscreteTimeIntegrator_gainval + * Referenced by: '/Discrete-Time Integrator' + */ + real_T DiscreteTimeIntegrator_IC; /* Expression: 0 + * Referenced by: '/Discrete-Time Integrator' + */ + real_T P1_Value[3]; /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/P1' + */ + real_T valp_nom1_Value_c; /* Expression: sps.VariationType + * Referenced by: '/valp_nom1' + */ + real_T Constant6_Value_h; /* Expression: 4 + * Referenced by: '/Constant6' + */ + real_T Constant2_Value_b; /* Expression: 3 + * Referenced by: '/Constant2' + */ + real_T valp_nom_Value; /* Expression: sps.Phase_Vps + * Referenced by: '/valp_nom' + */ + real_T Gain3_Gain_e; /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + real_T P1_Value_e[3]; /* Expression: [0 -2*pi/3 2*pi/3] + * Referenced by: '/P1' + */ + real_T Constant4_Value_l; /* Expression: 0 + * Referenced by: '/Constant4' + */ + real_T SinglePhase_Value_i; /* Expression: sps.SinglePhase + * Referenced by: '/SinglePhase' + */ + real_T Switch5_Threshold_m; /* Expression: 0.5 + * Referenced by: '/Switch5' + */ + real_T Step_Time; /* Expression: sps.Ton_Harmo + * Referenced by: '/Step' + */ + real_T Step_Y0_k; /* Expression: 0 + * Referenced by: '/Step' + */ + real_T Step_YFinal_d; /* Expression: 1 + * Referenced by: '/Step' + */ + real_T Step1_Time; /* Expression: sps.Toff_Harmo + * Referenced by: '/Step1' + */ + real_T Step1_Y0_i; /* Expression: 0 + * Referenced by: '/Step1' + */ + real_T Step1_YFinal_k; /* Expression: -1 + * Referenced by: '/Step1' + */ + real_T valp_nom7_Value; /* Expression: sps.HarmonicGeneration + * Referenced by: '/valp_nom7' + */ + real_T Gain3_Gain_l; /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + real_T valp_nom2_Value_i; /* Expression: 1 + * Referenced by: '/valp_nom2' + */ + real_T Gain3_Gain_j; /* Expression: pi/180 + * Referenced by: '/Gain3' + */ + real_T valp_nom2_Value_c; /* Expression: 1 + * Referenced by: '/valp_nom2' + */ + real_T Constant3_Value_m; /* Expression: sps.Delay + * Referenced by: '/Constant3' + */ + real_T Constant4_Value_p; /* Expression: sps.Period + * Referenced by: '/Constant4' + */ + real_T uib1_Gain; /* Expression: sps.Freq + * Referenced by: '/1\ib1' + */ + real_T uDLookupTable_tableData_d[3]; /* Expression: [0 2 0] + * Referenced by: '/1-D Lookup Table' + */ + real_T uDLookupTable_bp01Data_k[3]; /* Expression: [0 .5 1] + * Referenced by: '/1-D Lookup Table' + */ + real_T Constant2_Value_a; /* Expression: 1 + * Referenced by: '/Constant2' + */ + real_T Constant_Value_c; /* Expression: 230 + * Referenced by: '/Constant' + */ + real_T Constant3_Value_ej; /* Expression: sps.Delay + * Referenced by: '/Constant3' + */ + real_T Constant1_Value_o; /* Expression: sps.Period + * Referenced by: '/Constant1' + */ + real_T uib1_Gain_i; /* Expression: sps.Freq + * Referenced by: '/1\ib1' + */ + real_T uDLookupTable_tableData_f[3]; /* Expression: [0 2 0] + * Referenced by: '/1-D Lookup Table' + */ + real_T uDLookupTable_bp01Data_i[3]; /* Expression: [0 .5 1] + * Referenced by: '/1-D Lookup Table' + */ + real_T Constant2_Value_at; /* Expression: 1 + * Referenced by: '/Constant2' + */ + real_T Constant1_Value_ah; /* Expression: 230 + * Referenced by: '/Constant1' + */ + real_T Constant3_Value_mm; /* Expression: sps.Delay + * Referenced by: '/Constant3' + */ + real_T Constant1_Value_p; /* Expression: sps.Period + * Referenced by: '/Constant1' + */ + real_T uib1_Gain_c; /* Expression: sps.Freq + * Referenced by: '/1\ib1' + */ + real_T uDLookupTable_tableData_h[3]; /* Expression: [0 2 0] + * Referenced by: '/1-D Lookup Table' + */ + real_T uDLookupTable_bp01Data_m[3]; /* Expression: [0 .5 1] + * Referenced by: '/1-D Lookup Table' + */ + real_T Constant2_Value_k; /* Expression: 1 + * Referenced by: '/Constant2' + */ + real_T Constant2_Value_a1; /* Expression: 230 + * Referenced by: '/Constant2' + */ + real_T TransportDelay_Delay; /* Expression: 1e-6 + * Referenced by: '/Transport Delay' + */ + real_T TransportDelay_InitOutput; /* Expression: 0 + * Referenced by: '/Transport Delay' + */ + real_T TransportDelay_Delay_l; /* Expression: 1e-6 + * Referenced by: '/Transport Delay' + */ + real_T TransportDelay_InitOutput_l; /* Expression: 0 + * Referenced by: '/Transport Delay' + */ + real_T TransportDelay_Delay_c; /* Expression: 1e-6 + * Referenced by: '/Transport Delay' + */ + real_T TransportDelay_InitOutput_le; /* Expression: 0 + * Referenced by: '/Transport Delay' + */ + real_T Digitaloutput1_P1_Size[2];/* Computed Parameter: Digitaloutput1_P1_Size + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P1; /* Expression: id + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P2_Size[2];/* Computed Parameter: Digitaloutput1_P2_Size + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P2[3]; /* Expression: chan + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P3_Size[2];/* Computed Parameter: Digitaloutput1_P3_Size + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P3; /* Expression: vectorizeInput + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P4_Size[2];/* Computed Parameter: Digitaloutput1_P4_Size + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P4[3]; /* Expression: reset + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P5_Size[2];/* Computed Parameter: Digitaloutput1_P5_Size + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P5[3]; /* Expression: init + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P6_Size[2];/* Computed Parameter: Digitaloutput1_P6_Size + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput1_P6; /* Expression: ts + * Referenced by: '/Digital output1' + */ + real_T Digitaloutput2_P1_Size[2];/* Computed Parameter: Digitaloutput2_P1_Size + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P1; /* Expression: id + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P2_Size[2];/* Computed Parameter: Digitaloutput2_P2_Size + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P2[3]; /* Expression: chan + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P3_Size[2];/* Computed Parameter: Digitaloutput2_P3_Size + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P3; /* Expression: vectorizeInput + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P4_Size[2];/* Computed Parameter: Digitaloutput2_P4_Size + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P4[3]; /* Expression: reset + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P5_Size[2];/* Computed Parameter: Digitaloutput2_P5_Size + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P5[3]; /* Expression: init + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P6_Size[2];/* Computed Parameter: Digitaloutput2_P6_Size + * Referenced by: '/Digital output2' + */ + real_T Digitaloutput2_P6; /* Expression: ts + * Referenced by: '/Digital output2' + */ + real_T Switch_Threshold_e; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T Saturation_UpperSat; /* Expression: 1 + * Referenced by: '/Saturation' + */ + real_T Saturation_LowerSat; /* Expression: 0 + * Referenced by: '/Saturation' + */ + real_T Constant6_Value_e; /* Expression: 0 + * Referenced by: '/Constant6' + */ + real_T Switch_Threshold_p; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T Switch_Threshold_i; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T Switch_Threshold_o; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T Switch_Threshold_a; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T Switch_Threshold_n; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T Constant_Value_a; /* Expression: -1 + * Referenced by: '/Constant' + */ + real_T Constant_Value_g; /* Expression: -1 + * Referenced by: '/Constant' + */ + real_T Constant_Value_n5; /* Expression: -1 + * Referenced by: '/Constant' + */ + real_T Constant5_Value_ct; /* Expression: 0 + * Referenced by: '/Constant5' + */ + real_T Constant3_Value_n; /* Expression: 4 + * Referenced by: '/Constant3' + */ + real_T Gain2_Gain_h; /* Expression: 2*pi + * Referenced by: '/Gain2' + */ + real_T Gain3_Gain_i; /* Expression: 180/pi + * Referenced by: '/Gain3' + */ + real_T Constant7_Value; /* Expression: 2*pi + * Referenced by: '/Constant7' + */ + real_T Constant_Value_p; /* Expression: 2 + * Referenced by: '/Constant' + */ + real_T Constant2_Value_i; /* Expression: 1 + * Referenced by: '/Constant2' + */ + real_T Switch_Threshold_d; /* Expression: 0.5 + * Referenced by: '/Switch' + */ + real_T donotdeletethisgain_Gain; /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + real_T donotdeletethisgain_Gain_d; /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + real_T donotdeletethisgain_Gain_h; /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + real_T Kv1_Gain; /* Expression: Kv + * Referenced by: '/Kv1' + */ + real_T donotdeletethisgain_Gain_j; /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + real_T donotdeletethisgain_Gain_n; /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + real_T donotdeletethisgain_Gain_p; /* Expression: 1 + * Referenced by: '/do not delete this gain' + */ + real_T Kv_Gain; /* Expression: Ki + * Referenced by: '/Kv' + */ + real_T UnitDelay_InitialCondition; /* Expression: 0 + * Referenced by: '/Unit Delay' + */ + boolean_T Constant_Value_b; /* Expression: SM.ctrl==1 + * Referenced by: '/Constant' + */ + boolean_T Constant1_Value_kj; /* Expression: SM.ctrl==2 + * Referenced by: '/Constant1' + */ + boolean_T Constant3_Value_h; /* Expression: SM.ctrl==3 + * Referenced by: '/Constant3' + */ + boolean_T Constant_Value_px; /* Expression: SM.ctrl==1 + * Referenced by: '/Constant' + */ + boolean_T Constant1_Value_b; /* Expression: SM.ctrl==2 + * Referenced by: '/Constant1' + */ + boolean_T Constant2_Value_d; /* Expression: SM.ctrl==3 + * Referenced by: '/Constant2' + */ + boolean_T Constant_Value_j; /* Expression: SM.ctrl==1 + * Referenced by: '/Constant' + */ + boolean_T Constant1_Value_f; /* Expression: SM.ctrl==2 + * Referenced by: '/Constant1' + */ + boolean_T Constant2_Value_kn; /* Expression: SM.ctrl==3 + * Referenced by: '/Constant2' + */ +}; + +/* Storage class 'PageSwitching' */ +extern VFControl_cal_type VFControl_cal_impl; +extern VFControl_cal_type *VFControl_cal; + +#endif /* VFControl_cal_h_ */ diff --git a/Control/VF Control/VFControl_sg_rtw/VFControl_private.h b/Control/VF Control/VFControl_sg_rtw/VFControl_private.h new file mode 100644 index 0000000..d52bfff --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/VFControl_private.h @@ -0,0 +1,89 @@ +/* + * VFControl_private.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:33:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#ifndef VFControl_private_h_ +#define VFControl_private_h_ +#include "rtwtypes.h" +#include "multiword_types.h" +#include "VFControl_types.h" +#include "VFControl.h" +#include +#include + +/* Private macros used by the generated code to access rtModel */ +#ifndef rtmIsMajorTimeStep +#define rtmIsMajorTimeStep(rtm) (((rtm)->Timing.simTimeStep) == MAJOR_TIME_STEP) +#endif + +#ifndef rtmIsMinorTimeStep +#define rtmIsMinorTimeStep(rtm) (((rtm)->Timing.simTimeStep) == MINOR_TIME_STEP) +#endif + +#ifndef rtmSetTFinal +#define rtmSetTFinal(rtm, val) ((rtm)->Timing.tFinal = (val)) +#endif + +#ifndef rtmSetTPtr +#define rtmSetTPtr(rtm, val) ((rtm)->Timing.t = (val)) +#endif + +#ifndef CodeFormat +#define CodeFormat S-Function +#else +#undef CodeFormat +#define CodeFormat S-Function +#endif + +#ifndef S_FUNCTION_NAME +#define S_FUNCTION_NAME simulink_only_sfcn +#else +#undef S_FUNCTION_NAME +#define S_FUNCTION_NAME simulink_only_sfcn +#endif + +#ifndef S_FUNCTION_LEVEL +#define S_FUNCTION_LEVEL 2 +#else +#undef S_FUNCTION_LEVEL +#define S_FUNCTION_LEVEL 2 +#endif + +#ifndef RTW_GENERATED_S_FUNCTION +#define RTW_GENERATED_S_FUNCTION +#endif + +#ifndef rtmGetDataMapInfo +# define rtmGetDataMapInfo(rtm) NULL +#endif + +#ifndef rtmSetDataMapInfo +# define rtmSetDataMapInfo(rtm, val) +#endif + +#if !defined(RTW_SFUNCTION_DEFINES) +#define RTW_SFUNCTION_DEFINES +#ifndef _RTW_COMMON_DEFINES_ +#define _RTW_COMMON_DEFINES_ +#endif +#endif + +extern "C" void sg_fpga_do_sf_a2(SimStruct *rts); + +#endif /* VFControl_private_h_ */ diff --git a/Control/VF Control/VFControl_sg_rtw/VFControl_types.h b/Control/VF Control/VFControl_sg_rtw/VFControl_types.h new file mode 100644 index 0000000..791c0a5 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/VFControl_types.h @@ -0,0 +1,27 @@ +/* + * VFControl_types.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:33:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#ifndef VFControl_types_h_ +#define VFControl_types_h_ + +/* Forward declaration for rtModel */ +typedef struct tag_RTM_VFControl_T RT_MODEL_VFControl_T; + +#endif /* VFControl_types_h_ */ diff --git a/Control/VF Control/VFControl_sg_rtw/VFControlcal.mat b/Control/VF Control/VFControl_sg_rtw/VFControlcal.mat new file mode 100644 index 0000000..b2b3494 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/VFControlcal.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/buildInfo.mat b/Control/VF Control/VFControl_sg_rtw/buildInfo.mat new file mode 100644 index 0000000..ddac9ec Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/buildInfo.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/codeInfo.mat b/Control/VF Control/VFControl_sg_rtw/codeInfo.mat new file mode 100644 index 0000000..69afe95 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/codeInfo.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/codedescriptor.dmr b/Control/VF Control/VFControl_sg_rtw/codedescriptor.dmr new file mode 100644 index 0000000..59a03bf Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/codedescriptor.dmr differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.bat b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.bat new file mode 100644 index 0000000..b6930c0 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.bat @@ -0,0 +1,15 @@ + +call "%SLREALTIME_QNX_SP_ROOT%\%SLREALTIME_QNX_VERSION%\qnxsdp-env.bat" + +cd . + +chcp 1252 + +if "%1"=="" (make -f VFControl.mk all) else (make -f VFControl.mk %1) +@if errorlevel 1 goto error_exit + +exit /B 0 + +:error_exit +echo The make command returned an error of %errorlevel% +exit /B 1 \ No newline at end of file diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.mk b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.mk new file mode 100644 index 0000000..1db4e15 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.mk @@ -0,0 +1,505 @@ +########################################################################### +## Makefile generated for component 'VFControl'. +## +## Makefile : VFControl.mk +## Generated on : Wed Oct 16 11:33:28 2024 +## Final product: $(START_DIR)/VFControl_sg_rtw/VFControl +## Product type : executable +## +########################################################################### + +########################################################################### +## MACROS +########################################################################### + +# Macro Descriptions: +# PRODUCT_NAME Name of the system to build +# MAKEFILE Name of this makefile + +PRODUCT_NAME = VFControl +MAKEFILE = VFControl.mk +MATLAB_ROOT = C:/PROGRA~1/MATLAB/R2024a +MATLAB_BIN = C:/PROGRA~1/MATLAB/R2024a/bin +MATLAB_ARCH_BIN = $(MATLAB_BIN)/win64 +START_DIR = C:/Users/PROMER~1/Desktop/SPARK-~1/Spark/UNAV/BANCOD~1/Simulink/VFCONT~1 +SOLVER = +SOLVER_OBJ = +CLASSIC_INTERFACE = 0 +TGT_FCN_LIB = ISO_C++ +MODEL_HAS_DYNAMICALLY_LOADED_SFCNS = 0 +RELATIVE_PATH_TO_ANCHOR = ../.. +C_STANDARD_OPTS = +CPP_STANDARD_OPTS = + +########################################################################### +## TOOLCHAIN SPECIFICATIONS +########################################################################### + +# Toolchain Name: Simulink Real-Time Toolchain +# Supported Version(s): +# ToolchainInfo Version: 2024a +# Specification Revision: 1.0 +# +#------------------------------------------- +# Macros assumed to be defined elsewhere +#------------------------------------------- + +# SLREALTIME_QNX_SP_ROOT +# SLREALTIME_QNX_VERSION + +#----------- +# MACROS +#----------- + +QCC_TARGET = gcc_ntox86_64 + +TOOLCHAIN_SRCS = +TOOLCHAIN_INCS = +TOOLCHAIN_LIBS = -L$(MATLAB_ROOT)/toolbox/slrealtime/target/win64/target/lib -ltraceparser -lpps -lslrealtime_kernel -lslrealtime_platform -lslrealtime_rtps -lsocket -lboost_system -lboost_log -lpci -lopenblas -lpcap + +#------------------------ +# BUILD TOOL COMMANDS +#------------------------ + +# C Compiler: QNX C Compiler +CC = qcc + +# Linker: QCC Linker +LD = q++ + +# C++ Compiler: QNX C++ Compiler +CPP = q++ + +# C++ Linker: QCC C++ Linker +CPP_LD = q++ + +# Archiver: QNX Archiver +AR = ntox86_64-gcc-ar + +# Builder: GMAKE Utility +MAKE = make + + +#------------------------- +# Directives/Utilities +#------------------------- + +CDEBUG = -g -O0 -finstrument-functions +C_OUTPUT_FLAG = -o +LDDEBUG = -g +OUTPUT_FLAG = -o +CPPDEBUG = -g -O0 -finstrument-functions +CPP_OUTPUT_FLAG = -o +CPPLDDEBUG = -g +OUTPUT_FLAG = -o +ARDEBUG = +STATICLIB_OUTPUT_FLAG = +RM = @del /F +ECHO = @echo +MV = @move +RUN = + +#-------------------------------------- +# "Faster Runs" Build Configuration +#-------------------------------------- + +ARFLAGS = ruvs +CFLAGS = -c -V$(QCC_TARGET) -g \ + -O2 -fwrapv +CPPFLAGS = -c -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ \ + -O2 -fwrapv +CPP_LDFLAGS = -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ +CPP_SHAREDLIB_LDFLAGS = -V$(QCC_TARGET) -shared -Wl,--no-undefined -g +LDFLAGS = -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ +MAKE_FLAGS = -f $(MAKEFILE) +SHAREDLIB_LDFLAGS = -V$(QCC_TARGET) -shared -Wl,--no-undefined -g + + + +########################################################################### +## OUTPUT INFO +########################################################################### + +PRODUCT = $(START_DIR)/VFControl_sg_rtw/VFControl +PRODUCT_TYPE = "executable" +BUILD_TYPE = "Top-Level Standalone Executable" + +########################################################################### +## INCLUDE PATHS +########################################################################### + +INCLUDES_BUILDINFO = -I$(START_DIR)/slprj/speedgoat/PWMGenerator -I$(START_DIR) -I$(START_DIR)/VFControl_sg_rtw -I$(MATLAB_ROOT)/toolbox/slrealtime/simulink/blocks/dist/include -I$(MATLAB_ROOT)/toolbox/slrealtime/target/kernel/dist/include -I$(MATLAB_ROOT)/extern/include -I$(MATLAB_ROOT)/simulink/include -I$(MATLAB_ROOT)/rtw/c/src -I$(MATLAB_ROOT)/rtw/c/src/ext_mode/common -IC:/PROGRA~3/SPEEDG~1/SPEEDG~1/R2024a/990DE8~1.0/SG_BLO~1/common/libsg -I$(MATLAB_ROOT)/toolbox/physmod/powersys/facts/facts -I$(MATLAB_ROOT)/toolbox/physmod/powersys/DR/DR -IC:/PROGRA~3/SPEEDG~1/SPEEDG~1/R2024a/990DE8~1.0 -IC:/PROGRA~3/SPEEDG~1/SPEEDG~1/R2024a/990DE8~1.0/SG_BLO~1/fpga/setup/include -I$(START_DIR)/slprj/speedgoat/_sharedutils -I$(START_DIR)/VFControl_sg_rtw/instrumented + +INCLUDES = $(INCLUDES_BUILDINFO) + +########################################################################### +## DEFINES +########################################################################### + +DEFINES_ = -DSIMULINK_REAL_TIME -D_QNX_SOURCE +DEFINES_BUILD_ARGS = -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DMAT_FILE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=1 +DEFINES_CUSTOM = +DEFINES_OPTS = -DTID01EQ=1 +DEFINES_STANDARD = -DMODEL=VFControl -DNUMST=3 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL + +DEFINES = $(DEFINES_) $(DEFINES_BUILD_ARGS) $(DEFINES_CUSTOM) $(DEFINES_OPTS) $(DEFINES_STANDARD) + +########################################################################### +## SOURCE FILES +########################################################################### + +SRCS = $(MATLAB_ROOT)/rtw/c/src/rt_matrx.c $(MATLAB_ROOT)/rtw/c/src/rt_printf.c $(START_DIR)/VFControl_sg_rtw/VFControl.cpp $(START_DIR)/VFControl_sg_rtw/VFControl_cal.cpp $(START_DIR)/VFControl_sg_rtw/rtmodel.cpp $(START_DIR)/VFControl_sg_rtw/slrealtime_datatype_ground.cpp $(START_DIR)/VFControl_sg_rtw/rte_VFControl_parameters.cpp $(START_DIR)/VFControl_sg_rtw/main.cpp C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/dio/sg_fpga_do_sf_a2.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io30x_setup_util.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io3xx_scatter_gather_dma.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io39x_setup_util.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io31x_io32x_setup_util.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io33x_setup_util.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_setup_util.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io36x_setup_util.c C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io3xx_util.c $(START_DIR)/VFControl_sg_rtw/sg_early_init.cpp host_timer_x86.c slrealtime_code_profiling_utility_functions.cpp + +ALL_SRCS = $(SRCS) + +########################################################################### +## OBJECTS +########################################################################### + +OBJS = rt_matrx.o rt_printf.o VFControl.o VFControl_cal.o rtmodel.o slrealtime_datatype_ground.o rte_VFControl_parameters.o main.o sg_fpga_do_sf_a2.o sg_fpga_io30x_setup_util.o sg_fpga_io3xx_scatter_gather_dma.o sg_fpga_io39x_setup_util.o sg_fpga_io31x_io32x_setup_util.o sg_fpga_io33x_setup_util.o sg_fpga_setup_util.o sg_fpga_io36x_setup_util.o sg_fpga_io3xx_util.o sg_early_init.o host_timer_x86.o slrealtime_code_profiling_utility_functions.o + +ALL_OBJS = $(OBJS) + +########################################################################### +## PREBUILT OBJECT FILES +########################################################################### + +PREBUILT_OBJS = + +########################################################################### +## LIBRARIES +########################################################################### + +MODELREF_LIBS = ../../slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_rtwlib.a + +LIBS = $(START_DIR)/slprj/speedgoat/_sharedutils/rtwshared.a + +########################################################################### +## SYSTEM LIBRARIES +########################################################################### + +SYSTEM_LIBS = + +########################################################################### +## ADDITIONAL TOOLCHAIN FLAGS +########################################################################### + +#--------------- +# C Compiler +#--------------- + +CFLAGS_BASIC = $(DEFINES) $(INCLUDES) + +CFLAGS += $(CFLAGS_BASIC) + +#----------------- +# C++ Compiler +#----------------- + +CPPFLAGS_BASIC = $(DEFINES) $(INCLUDES) + +CPPFLAGS += $(CPPFLAGS_BASIC) + +#--------------- +# C++ Linker +#--------------- + +CPP_LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +CPP_LDFLAGS += $(CPP_LDFLAGS_) + +#------------------------------ +# C++ Shared Library Linker +#------------------------------ + +CPP_SHAREDLIB_LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +CPP_SHAREDLIB_LDFLAGS += $(CPP_SHAREDLIB_LDFLAGS_) + +#----------- +# Linker +#----------- + +LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +LDFLAGS += $(LDFLAGS_) + +#-------------------------- +# Shared Library Linker +#-------------------------- + +SHAREDLIB_LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +SHAREDLIB_LDFLAGS += $(SHAREDLIB_LDFLAGS_) + +########################################################################### +## INLINED COMMANDS +########################################################################### + +########################################################################### +## PHONY TARGETS +########################################################################### + +.PHONY : all build buildobj clean info prebuild + + +all : build + @echo "### Successfully generated all binary outputs." + + +build : prebuild $(PRODUCT) + + +buildobj : prebuild $(OBJS) $(PREBUILT_OBJS) $(LIBS) + @echo "### Successfully generated all binary outputs." + + +prebuild : + + +########################################################################### +## FINAL TARGET +########################################################################### + +#------------------------------------------- +# Create a standalone executable +#------------------------------------------- + +$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) $(MODELREF_LIBS) $(LIBS) + @echo "### Creating standalone executable "$(PRODUCT)" ..." + $(CPP_LD) $(CPP_LDFLAGS) -o $(PRODUCT) $(OBJS) -Wl,--start-group ../../slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_rtwlib.a $(LIBS) -Wl,--end-group $(SYSTEM_LIBS) $(TOOLCHAIN_LIBS) + @echo "### Created: $(PRODUCT)" + + +########################################################################### +## INTERMEDIATE TARGETS +########################################################################### + +#--------------------- +# SOURCE-TO-OBJECT +#--------------------- + +%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/physmod/powersys/powersys/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/physmod/powersys/powersys/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/dio/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/dio/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(START_DIR)/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(START_DIR)/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(START_DIR)/VFControl_sg_rtw/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(START_DIR)/VFControl_sg_rtw/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/rtw/c/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/rtw/c/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/simulink/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/simulink/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/simulink/blocks/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/simulink/blocks/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : ../%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : ../%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/coder/profile/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/coder/profile/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(START_DIR)/VFControl_sg_rtw/instrumented/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(START_DIR)/VFControl_sg_rtw/instrumented/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_matrx.o : $(MATLAB_ROOT)/rtw/c/src/rt_matrx.c + $(CC) $(CFLAGS) -o $@ $< + + +rt_printf.o : $(MATLAB_ROOT)/rtw/c/src/rt_printf.c + $(CC) $(CFLAGS) -o $@ $< + + +VFControl.o : $(START_DIR)/VFControl_sg_rtw/VFControl.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +VFControl_cal.o : $(START_DIR)/VFControl_sg_rtw/VFControl_cal.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rtmodel.o : $(START_DIR)/VFControl_sg_rtw/rtmodel.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +slrealtime_datatype_ground.o : $(START_DIR)/VFControl_sg_rtw/slrealtime_datatype_ground.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rte_VFControl_parameters.o : $(START_DIR)/VFControl_sg_rtw/rte_VFControl_parameters.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +main.o : $(START_DIR)/VFControl_sg_rtw/main.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +sg_fpga_do_sf_a2.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/dio/sg_fpga_do_sf_a2.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_io30x_setup_util.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io30x_setup_util.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_io3xx_scatter_gather_dma.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io3xx_scatter_gather_dma.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_io39x_setup_util.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io39x_setup_util.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_io31x_io32x_setup_util.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io31x_io32x_setup_util.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_io33x_setup_util.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io33x_setup_util.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_setup_util.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_setup_util.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_io36x_setup_util.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io36x_setup_util.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_fpga_io3xx_util.o : C:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/fpga/setup/src/sg_fpga_io3xx_util.c + $(CC) $(CFLAGS) -o $@ $< + + +sg_early_init.o : $(START_DIR)/VFControl_sg_rtw/sg_early_init.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +########################################################################### +## DEPENDENCIES +########################################################################### + +$(ALL_OBJS) : rtw_proj.tmw $(MAKEFILE) + + +########################################################################### +## MISCELLANEOUS TARGETS +########################################################################### + +info : + @echo "### PRODUCT = $(PRODUCT)" + @echo "### PRODUCT_TYPE = $(PRODUCT_TYPE)" + @echo "### BUILD_TYPE = $(BUILD_TYPE)" + @echo "### INCLUDES = $(INCLUDES)" + @echo "### DEFINES = $(DEFINES)" + @echo "### ALL_SRCS = $(ALL_SRCS)" + @echo "### ALL_OBJS = $(ALL_OBJS)" + @echo "### LIBS = $(LIBS)" + @echo "### MODELREF_LIBS = $(MODELREF_LIBS)" + @echo "### SYSTEM_LIBS = $(SYSTEM_LIBS)" + @echo "### TOOLCHAIN_LIBS = $(TOOLCHAIN_LIBS)" + @echo "### CFLAGS = $(CFLAGS)" + @echo "### LDFLAGS = $(LDFLAGS)" + @echo "### SHAREDLIB_LDFLAGS = $(SHAREDLIB_LDFLAGS)" + @echo "### CPPFLAGS = $(CPPFLAGS)" + @echo "### CPP_LDFLAGS = $(CPP_LDFLAGS)" + @echo "### CPP_SHAREDLIB_LDFLAGS = $(CPP_SHAREDLIB_LDFLAGS)" + @echo "### ARFLAGS = $(ARFLAGS)" + @echo "### MAKE_FLAGS = $(MAKE_FLAGS)" + + +clean : + $(ECHO) "### Deleting all derived files ..." + $(RM) $(subst /,\,$(PRODUCT)) + $(RM) $(subst /,\,$(ALL_OBJS)) + $(ECHO) "### Deleted all derived files." + + diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.o b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.o new file mode 100644 index 0000000..f44f82b Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl_cal.o b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl_cal.o new file mode 100644 index 0000000..0485d30 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/VFControl_cal.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/buildInfo.mat b/Control/VF Control/VFControl_sg_rtw/instrumented/buildInfo.mat new file mode 100644 index 0000000..2ccc328 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/buildInfo.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/compileInfo.mat b/Control/VF Control/VFControl_sg_rtw/instrumented/compileInfo.mat new file mode 100644 index 0000000..867cb8d Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/compileInfo.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/host_timer_x86.o b/Control/VF Control/VFControl_sg_rtw/instrumented/host_timer_x86.o new file mode 100644 index 0000000..ccab23a Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/host_timer_x86.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/instrumentationInfo.mat b/Control/VF Control/VFControl_sg_rtw/instrumented/instrumentationInfo.mat new file mode 100644 index 0000000..e207065 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/instrumentationInfo.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/main.o b/Control/VF Control/VFControl_sg_rtw/instrumented/main.o new file mode 100644 index 0000000..9a6edd8 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/main.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/profiling_info.mat b/Control/VF Control/VFControl_sg_rtw/instrumented/profiling_info.mat new file mode 100644 index 0000000..c335e97 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/profiling_info.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/rt_matrx.o b/Control/VF Control/VFControl_sg_rtw/instrumented/rt_matrx.o new file mode 100644 index 0000000..495c81b Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/rt_matrx.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/rt_printf.o b/Control/VF Control/VFControl_sg_rtw/instrumented/rt_printf.o new file mode 100644 index 0000000..7be6e5c Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/rt_printf.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/rte_VFControl_parameters.o b/Control/VF Control/VFControl_sg_rtw/instrumented/rte_VFControl_parameters.o new file mode 100644 index 0000000..173d878 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/rte_VFControl_parameters.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/rtmodel.o b/Control/VF Control/VFControl_sg_rtw/instrumented/rtmodel.o new file mode 100644 index 0000000..44fe136 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/rtmodel.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/rtw_proj.tmw b/Control/VF Control/VFControl_sg_rtw/instrumented/rtw_proj.tmw new file mode 100644 index 0000000..787ebd0 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/instrumented/rtw_proj.tmw @@ -0,0 +1,4 @@ +Simulink Coder project for VFControl using . MATLAB root = C:\Program Files\MATLAB\R2024a. SimStruct date: 12-ene.-2024 11:16:21 +This file is generated by Simulink Coder for use by the make utility +to determine when to rebuild objects when the name of the current Simulink Coder project changes. +The rtwinfomat located at: diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_early_init.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_early_init.o new file mode 100644 index 0000000..321b596 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_early_init.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_do_sf_a2.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_do_sf_a2.o new file mode 100644 index 0000000..01f9198 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_do_sf_a2.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io30x_setup_util.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io30x_setup_util.o new file mode 100644 index 0000000..44ab755 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io30x_setup_util.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io31x_io32x_setup_util.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io31x_io32x_setup_util.o new file mode 100644 index 0000000..15afebb Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io31x_io32x_setup_util.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io33x_setup_util.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io33x_setup_util.o new file mode 100644 index 0000000..281f61b Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io33x_setup_util.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io36x_setup_util.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io36x_setup_util.o new file mode 100644 index 0000000..d4e4420 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io36x_setup_util.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io39x_setup_util.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io39x_setup_util.o new file mode 100644 index 0000000..c420135 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io39x_setup_util.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io3xx_scatter_gather_dma.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io3xx_scatter_gather_dma.o new file mode 100644 index 0000000..684e3e6 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io3xx_scatter_gather_dma.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io3xx_util.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io3xx_util.o new file mode 100644 index 0000000..a4a9e25 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_io3xx_util.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_setup_util.o b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_setup_util.o new file mode 100644 index 0000000..c1c4350 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/sg_fpga_setup_util.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.cpp b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.cpp new file mode 100644 index 0000000..0d5e87e --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.cpp @@ -0,0 +1,62 @@ +/* + * File: slrealtime_code_profiling_utility_functions.cpp + * + * Code generated for instrumentation. + * + */ + +#include "slrealtime_code_profiling_utility_functions.h" + +/* Code instrumentation offset(s) for model */ +#define taskTimeStart__offset 0 +#define taskTimeEnd__offset 0 + +/* A function parameter may be intentionally unused */ +#ifndef UNUSED_PARAMETER +# if defined(__LCC__) +# define UNUSED_PARAMETER(x) +# else +# define UNUSED_PARAMETER(x) (void) (x) +# endif +#endif + +void xilUploadProfilingData(uint32_T sectionId) +{ + slrealtimeAddEvent(sectionId); +} + +/* For real-time, multitasking case this function is stubbed out. */ +#define xilProfilingTimerFreezeInternal() {} + +void xilProfilingTimerFreeze(void) +{ +} + +#define xilProfilingTimerUnFreezeInternal() {} + +void xilProfilingTimerUnFreeze(void) +{ +} + +/* Tic/Toc methods for task profiling */ +#define taskTimeStart(id) { \ + xilUploadProfilingData(id); \ + xilProfilingTimerUnFreezeInternal(); \ +} +#define taskTimeEnd(id) { \ + uint32_T sectionIdNeg = id; \ + sectionIdNeg = ~sectionIdNeg; \ + xilProfilingTimerFreezeInternal(); \ + xilUploadProfilingData(sectionIdNeg); \ +} + +/* Code instrumentation method(s) for model */ +void taskTimeStart_(uint32_T sectionId) +{ + taskTimeStart(taskTimeStart__offset + sectionId); +} + +void taskTimeEnd_(uint32_T sectionId) +{ + taskTimeEnd(taskTimeEnd__offset + sectionId); +} diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.h b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.h new file mode 100644 index 0000000..dc75bac --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.h @@ -0,0 +1,38 @@ +/* + * File: slrealtime_code_profiling_utility_functions.h + * + * Code generated for instrumentation. + * + */ + +/* Functions with a C call interface */ +#ifdef __cplusplus + +extern "C" +{ + +#endif + +#include "tracing.h" +#ifdef __cplusplus + +} + +#endif + +#include "rtwtypes.h" + +/* Upload code instrumentation data point */ +void slrealtimeUploadEvent( + void* pData, uint32_T numMemUnits, uint32_T sectionId); + +/* Uploads data */ +void xilUploadProfilingData(uint32_T sectionId); + +/* Pause/restart the timer while running code associated with storing and uploading the data. */ +void xilProfilingTimerFreeze(void); +void xilProfilingTimerUnFreeze(void); + +/* Code instrumentation method(s) for model */ +void taskTimeStart_(uint32_T sectionId); +void taskTimeEnd_(uint32_T sectionId); diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.o b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.o new file mode 100644 index 0000000..bc55ca0 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_code_profiling_utility_functions.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_datatype_ground.o b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_datatype_ground.o new file mode 100644 index 0000000..05a4a72 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/instrumented/slrealtime_datatype_ground.o differ diff --git a/Control/VF Control/VFControl_sg_rtw/loggingdb.json b/Control/VF Control/VFControl_sg_rtw/loggingdb.json new file mode 100644 index 0000000..ca087f3 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/loggingdb.json @@ -0,0 +1 @@ +{"model_checksum":[0,0,0,0],"num_entries":0,"channels":[]} \ No newline at end of file diff --git a/Control/VF Control/VFControl_sg_rtw/main.cpp b/Control/VF Control/VFControl_sg_rtw/main.cpp new file mode 100644 index 0000000..90665ff --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/main.cpp @@ -0,0 +1,44 @@ +/* Main generated for Simulink Real-Time model VFControl */ +#include +#include +#include "VFControl.h" +#include "rte_VFControl_parameters.h" + +/* Task wrapper function definitions */ +void VFControl_Task1(void) +{ + VFControl_step0(); +} +void VFControl_Task2(void) +{ + VFControl_step2(); +} +/* Task descriptors */ +slrealtime::TaskInfo task_1( 0u, std::bind(VFControl_Task1), slrealtime::TaskInfo::PERIODIC, 0.0001, 0, 40); +slrealtime::TaskInfo task_2( 1u, std::bind(VFControl_Task2), slrealtime::TaskInfo::PERIODIC, 0.0005, 0, 39); + +/* Executable base address for XCP */ +#ifdef __linux__ +extern char __executable_start; +static uintptr_t const base_address = reinterpret_cast(&__executable_start); +#else +/* Set 0 as placeholder, to be parsed later from /proc filesystem */ +static uintptr_t const base_address = 0; +#endif + +/* Model descriptor */ +slrealtime::ModelInfo VFControl_Info = +{ + "VFControl", + VFControl_initialize, + VFControl_terminate, + []()->char const*& { return VFControl_M->errorStatus; }, + []()->unsigned char& { return VFControl_M->Timing.stopRequestedFlag; }, + { task_1, task_2 }, + slrealtime::getSegmentVector() +}; + +int main(int argc, char *argv[]) { + slrealtime::BaseAddress::set(base_address); + return slrealtime::runModel(argc, argv, VFControl_Info); +} diff --git a/Control/VF Control/VFControl_sg_rtw/rte_VFControl_parameters.cpp b/Control/VF Control/VFControl_sg_rtw/rte_VFControl_parameters.cpp new file mode 100644 index 0000000..fd5eae5 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/rte_VFControl_parameters.cpp @@ -0,0 +1,24 @@ +#include "rte_VFControl_parameters.h" +#include "PWMGenerator.h" +#include "VFControl.h" +#include "PWMGenerator_cal.h" +#include "VFControl_cal.h" + +extern PWMGenerator_cal_type PWMGenerator_cal_impl; +extern VFControl_cal_type VFControl_cal_impl; +namespace slrealtime +{ + /* Description of SEGMENTS */ + SegmentVector segmentInfo { + { (void*)&VFControl_cal_impl, (void**)&VFControl_cal, sizeof + (VFControl_cal_type), 2 }, + + { (void*)&PWMGenerator_cal_impl, (void**)&PWMGenerator_cal, sizeof + (PWMGenerator_cal_type), 2 } + }; + + SegmentVector &getSegmentVector(void) + { + return segmentInfo; + } +} // slrealtime diff --git a/Control/VF Control/VFControl_sg_rtw/rte_VFControl_parameters.h b/Control/VF Control/VFControl_sg_rtw/rte_VFControl_parameters.h new file mode 100644 index 0000000..6c5b872 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/rte_VFControl_parameters.h @@ -0,0 +1,11 @@ +#ifndef _RTE_VFCONTROL_PARAMETERS_H +#define _RTE_VFCONTROL_PARAMETERS_H +#include "rtwtypes.h" +#include "SegmentInfo.hpp" + +namespace slrealtime +{ + SegmentVector &getSegmentVector(void); +} // slrealtime + +#endif diff --git a/Control/VF Control/VFControl_sg_rtw/rtmodel.cpp b/Control/VF Control/VFControl_sg_rtw/rtmodel.cpp new file mode 100644 index 0000000..90a30c6 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/rtmodel.cpp @@ -0,0 +1,39 @@ +/* + * rtmodel.cpp: + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:33:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#include "rtmodel.h" + +/* Use this function only if you need to maintain compatibility with an existing static main program. */ +void VFControl_step(int_T tid) +{ + switch (tid) { + case 0 : + VFControl_step0(); + break; + + case 1 : + VFControl_step2(); + break; + + default : + /* do nothing */ + break; + } +} diff --git a/Control/VF Control/VFControl_sg_rtw/rtmodel.h b/Control/VF Control/VFControl_sg_rtw/rtmodel.h new file mode 100644 index 0000000..c0815c0 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/rtmodel.h @@ -0,0 +1,30 @@ +/* + * rtmodel.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:33:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#ifndef rtmodel_h_ +#define rtmodel_h_ +#include "VFControl.h" +#define GRTINTERFACE 0 + +/* Model wrapper function */ +/* Use this function only if you need to maintain compatibility with an existing static main program. */ +extern void VFControl_step(int_T tid); + +#endif /* rtmodel_h_ */ diff --git a/Control/VF Control/VFControl_sg_rtw/rtw_proj.tmw b/Control/VF Control/VFControl_sg_rtw/rtw_proj.tmw new file mode 100644 index 0000000..7bd3ad9 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/rtw_proj.tmw @@ -0,0 +1,4 @@ +Simulink Coder project for VFControl using . MATLAB root = C:\Program Files\MATLAB\R2024a. SimStruct date: 12-ene.-2024 11:16:21 +This file is generated by Simulink Coder for use by the make utility +to determine when to rebuild objects when the name of the current Simulink Coder project changes. +The rtwinfomat located at: ..\slprj\speedgoat\VFControl\tmwinternal\binfo.mat diff --git a/Control/VF Control/VFControl_sg_rtw/sg_early_init.cpp b/Control/VF Control/VFControl_sg_rtw/sg_early_init.cpp new file mode 100644 index 0000000..7b16ce6 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/sg_early_init.cpp @@ -0,0 +1,264 @@ +#include "VFControl.h" +#include "VFControl_private.h" +#include "sg_printf.h" +#include "sg_early_init.h" +#include "simstruc.h" // This is required if there are no S-function blocks in the model + +static RTWSfcnInfo sgEarlyInitSfcnInfo; +struct _ssBlkInfo2 sgEarlyInitBlkInfo2 = {.rtwSfcnInfo = &sgEarlyInitSfcnInfo}; + +void sg_init_sfcns(void) +{ + sg_printf(sg_debug, "Initializing [EARLY INIT] S-functions\n"); + + rtssSetErrorStatusPtr(&sgEarlyInitSfcnInfo, (&rtmGetErrorStatus(VFControl_M))); + sg_early_init_set_blkInfo2((void*)&sgEarlyInitBlkInfo2); + + { + uint16_t moduleArchitecture; + int32_t ErrCode; + uint32_t i; + uint32_t *bitstream = NULL; + uint8_t *fpgacode = NULL; + char *devname; + sg_fpga_io3xxModuleIdT moduleId; + FILE *mcs; + static char mcsBinFile[200]; + static char msg[500]; + + sg_initModelRun(); + + // Determine path to bitstream file + if (sg_getModelBaseDir(mcsBinFile, sizeof(mcsBinFile))) { + sprintf(msg, "Could not determine location of the model on the target machine."); + rtmSetErrorStatus(VFControl_M, msg); + return; + } + if ((strlen(mcsBinFile) + strlen("/fpga/speedgoat_IO397_RCP.mcs") + 1) > sizeof(mcsBinFile)) { + sprintf(msg, "Path to the bitstream (model name + bitstream name) is too long."); + rtmSetErrorStatus(VFControl_M, msg); + return; + } + strcat(mcsBinFile, "/fpga/speedgoat_IO397_RCP.mcs"); + SG_PRINTF(DEBUG, "Bitstream: %s\n", mcsBinFile); + + // Read bitstream file + if ((mcs = fopen(mcsBinFile, "r")) == NULL){ + sprintf(msg, "Bitstream file not found at %s\n", mcsBinFile); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + } + bitstream = (uint32_t *) malloc(2192012*sizeof(uint32_t)); + fpgacode = (uint8_t *) malloc(2192012*sizeof(uint8_t)); + for(i = 0; i<2192012; i++){ + fscanf(mcs, "%d\n", &bitstream[i]); + fpgacode[i] = bitstream[i]; + } + fclose(mcs); + + // Get module IDs (PIC info) + SG_PRINTF(INFO,"Getting module information.\n"); + ErrCode = (int32_t)sg_fpga_IO3xxGetModuleId(39750, &moduleId); + + if (ErrCode >= 0) + { + devname = moduleId.devname; + moduleArchitecture = moduleId.moduleArchitecture; + + SG_PRINTF(DEBUG, "boardType: %d\n", 39750); + SG_PRINTF(DEBUG, "ErrCode: %d\n", ErrCode); + SG_PRINTF(DEBUG, "******************************************\n"); + SG_PRINTF(DEBUG, "moduleId->devname: %s\n", moduleId.devname); + SG_PRINTF(DEBUG, "moduleId->vendorid: 0x%x\n", moduleId.vendorid); + SG_PRINTF(DEBUG, "moduleId->subvendorid: 0x%x\n", moduleId.subvendorid); + SG_PRINTF(DEBUG, "moduleId->deviceid: 0x%x\n", moduleId.deviceid); + SG_PRINTF(DEBUG, "moduleId->subdeviceid: 0x%x\n", moduleId.subdeviceid); + SG_PRINTF(DEBUG, "moduleId.moduleArchitecture: %d\n", moduleId.moduleArchitecture); + } + else + { + sprintf(msg, "Setup block: board type unknown."); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + } + // Support for different architectures + SG_PRINTF(INFO,"Running board specific programming file.\n"); + switch (moduleArchitecture) + { + case TEWS_TPMC: + ErrCode = IO30x_programFPGA(devname, (int16_t)-1, (int16_t)-1, + (int32_t)1, (int32_t)1, + (int32_t)0, (uint32_t)2192012, bitstream, + &moduleId,(uint32_t)1102114075); + break; + + case TEWS_TXMC: + if (39750 == 324200 || 39750 == 334325 ||39750 == 336325 || 39750 == 325160) + { + ErrCode = IO324_programmFPGA(devname, (int16_t)-1, + (int16_t)-1, (int32_t)1, (int32_t)1, + (int32_t)0, (uint32_t)2192012, fpgacode, + (uint32_t)1102114075, &moduleId, (uint32_t)85, + (uint32_t)0); + } + else // IO31x, IO32x + { + ErrCode = IO31x_IO32x_programmFPGA(devname, (int16_t)-1, + (int16_t)-1, (int32_t)1, (int32_t)1, + (int32_t)0, (uint32_t)2192012, fpgacode, + &moduleId, (uint32_t)85,(uint32_t)1102114075); + } + break; + + case ACROMAG_PMC: + ErrCode = IO331_programmFPGA(devname, (int16_t)-1, (int16_t)-1, + (int32_t)1, (int32_t)1, + (uint32_t)2192012, bitstream, &moduleId); + break; + + case ACROMAG_XMC: + if (39750 == 332) + { + ErrCode = IO332_programmFPGA(devname, (int16_t)-1, + (int16_t)-1, (int32_t)1, (int32_t)1, + (uint32_t)2192012, bitstream, (uint32_t)1102114075, + &moduleId); + } + else // IO333 + { + ErrCode = IO333_programmFPGA(devname, (int16_t)-1, + (int16_t)-1, (int32_t)1, (int32_t)1, + (uint32_t)2192012, bitstream, (uint32_t)1102114075, + &moduleId); + } + break; + + case TEWS_MPCIE: + ErrCode = IO39x_programmFPGA(devname, (int16_t)-1, (int16_t)-1, + (int32_t)1, (int32_t)1, + (uint32_t)2192012, fpgacode, (uint32_t)85, &moduleId); + break; + + case ENCLUSTRA_SOM: + + ErrCode = IO36x_programmFPGA(devname, (int16_t)-1, (int16_t)-1, + (int32_t)1, (int32_t)1, + (uint32_t)2192012, fpgacode, + (uint32_t)85, (uint32_t)0, &moduleId); + break; + + case XILINX_MPSOC: + break; + + default: + sprintf(msg, "Setup block: module architecture incorrect."); + rtmSetErrorStatus(VFControl_M, msg); + // Free the bitstream allocation + SG_PRINTF(ERROR,msg); + free(bitstream); + free(fpgacode); + return; + } + + // Set board type (by now the board is registered) + io3xxSetBoardTypeSgLib(1, 39750); + + // Free the bitstream allocation + free(bitstream); + free(fpgacode); + + // Handle any error states + switch (ErrCode) + { + case NO_ERR: + // Nothing to do. + break; + + case BOARD_NOT_FOUND: + // reason for this error can be found in the pSgErrorStr (error message from sg-lib (sg_findPciDevice)) + sprintf(msg, "%s", pSgErrorStr); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + + case EEPROM_ERROR: + sprintf(msg, "Setup block %s: Error updating board EEPROM.\n", devname); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + + case REPROG_ERROR: + sprintf(msg, "Setup block %s: Error writing new bitstream to FPGA.\n", devname); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + + case FLASH_ERROR: + sprintf(msg, "Setup block %s: Bitstream flash storage error.\n", devname); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + + case BIST_ERROR: + sprintf(msg, "Setup block %s: Built in self test error.\n", devname); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + + case ICAP_RECONF_FAILED: + sprintf(msg, "Setup block %s: ICAP Reconfiguration was not successful.\n",devname); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + + case BOARD_TYPE_UNKNOWN: + sprintf(msg, "Setup block %s: The board type selected is unknown.\n",devname); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + + default: + sprintf(msg, "Setup block %s: An unknown error occurred.\n",devname); + rtmSetErrorStatus(VFControl_M, msg); + SG_PRINTF(ERROR,msg); + return; + } + + // initialize Rear-IO's + if (1 == 2){ + IO3xx_21_update(devname, 1, 0, 0, 0); + } + else if (1 == 3){ + IO3xx_22_update(devname, 1, 0, 0, 0); + } + else if (1 == 4){ + IO3xx_24_update(devname, 1, 0, 0, 0, 0); + } + + // initial settings on module registry + + // Set all DIO's to registry inital values (all input, all output states = 0, all sources = codemodule) + sg_fpga_io3xx_initDioLines(1, SG_FPGA_IO3XX_BAR2); + + // Set if FPGA DMA Controller is used + ScatterGatherDmaState *sgDmaSharedState; + sg_fpga_io3xx_getSharedSgDmaState(1, &sgDmaSharedState); + sgDmaSharedState->useFpgaDmaController = 0; + } + + { + // run any code here at end of model-load +// SG_PRINTF(INFO, "Setup Block: Entering TLC Trailer\n"); +// if(0){ +// io3xx_sgdma_finalizeDmaController(1); +// io3xx_sgdma_startDmaController(1); +// } + } +} + +__attribute__((constructor)) void early_init_setup(void) +{ + sg_register_early_init_function(sg_init_sfcns); +} diff --git a/Control/VF Control/VFControl_sg_rtw/slrealtime_datatype_ground.cpp b/Control/VF Control/VFControl_sg_rtw/slrealtime_datatype_ground.cpp new file mode 100644 index 0000000..47c9eb3 --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/slrealtime_datatype_ground.cpp @@ -0,0 +1,9 @@ +#include "slrtdatatypes.h" + +const serialfifoptr serialfifoground = { 0, 0, 0 }; + +const bcmsglist1553 bcmsg1553ground = { 0, 0, 0, 0 }; + +const bcstatus1553 bcstatground = { 0, 0, 0, 0, 0, 0 }; + +const bmmsglist1553 bmmsg1553ground = { 0, 0, 0, 0 }; diff --git a/Control/VF Control/VFControl_sg_rtw/slrealtime_task_info.m b/Control/VF Control/VFControl_sg_rtw/slrealtime_task_info.m new file mode 100644 index 0000000..2227b6c --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/slrealtime_task_info.m @@ -0,0 +1,22 @@ +function [taskInfo, numtask, isDeploymentDiagram]=slrealtime_task_info() + taskInfo(1).samplePeriod = 0.0001; + taskInfo(1).sampleOffset = 0.0; + taskInfo(1).taskPrio = 10; + taskInfo(1).taskName = 'BaseRate'; + taskInfo(1).entryPoints = {}; + taskInfo(2).samplePeriod = 0.0005; + taskInfo(2).sampleOffset = 0.0; + taskInfo(2).taskPrio = 9; + taskInfo(2).taskName = ['SubRate' '1']; + taskInfo(2).entryPoints = {}; + numtask = 2; + for i = 1:numtask + if ( 0 == isnumeric(taskInfo(i).samplePeriod) ) + taskInfo(i).samplePeriod = evalin('base', taskInfo(i).samplePeriod); + end + if ( isempty(taskInfo(i).taskName) ) + taskInfo(i).taskName = ['AutoGen' i ]; + end + end + isDeploymentDiagram = 0; +end diff --git a/Control/VF Control/VFControl_sg_rtw/taskinfo.mat b/Control/VF Control/VFControl_sg_rtw/taskinfo.mat new file mode 100644 index 0000000..b66bdb1 Binary files /dev/null and b/Control/VF Control/VFControl_sg_rtw/taskinfo.mat differ diff --git a/Control/VF Control/VFControl_sg_rtw/tmwinternal/simulink_cache.xml b/Control/VF Control/VFControl_sg_rtw/tmwinternal/simulink_cache.xml new file mode 100644 index 0000000..739239a --- /dev/null +++ b/Control/VF Control/VFControl_sg_rtw/tmwinternal/simulink_cache.xml @@ -0,0 +1,6 @@ + + + + ntUZJK8o6iafn2MKKYVmc22+ZH1+rdpCe8z/i0Ujm/pOqnZOJsBTVGtf6xVXCNzbHrUYAopXdTzjQfYYfQ3UTA== + + \ No newline at end of file diff --git a/Control/VF Control/slprj/sl_proj.tmw b/Control/VF Control/slprj/sl_proj.tmw new file mode 100644 index 0000000..89fdaeb --- /dev/null +++ b/Control/VF Control/slprj/sl_proj.tmw @@ -0,0 +1,2 @@ +Simulink Coder project marker file. Please don't change it. +slprjVersion: 24.1_093 \ No newline at end of file diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/Options.hpp b/Control/VF Control/slprj/speedgoat/PWMGenerator/Options.hpp new file mode 100644 index 0000000..719b853 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/Options.hpp @@ -0,0 +1,13 @@ +#ifndef __OPTIONS_H___ +#define __OPTIONS_H___ + +#include "simstruc_types.h" +#ifndef MT +#define MT 0 /* MT may be undefined by simstruc_types.h */ +#endif + +#include "PWMGenerator.h" + +#define FULLMULTITHREAD 1 + +#endif // __OPTIONS_H___ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator.cpp b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator.cpp new file mode 100644 index 0000000..3e3ab86 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator.cpp @@ -0,0 +1,59 @@ +/* + * Code generation for system model 'PWMGenerator' + * + * Model : PWMGenerator + * Model version : 1.7 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:22 2024 + * + * Note that the functions contained in this file are part of a Simulink + * model, and are not self-contained algorithms. + */ + +#include "PWMGenerator.h" +#include "rtwtypes.h" +#include "PWMGenerator_cal.h" +#include "PWMGenerator_private.h" + +/* Output and update for referenced model: 'PWMGenerator' */ +void PWMGenerator(const real_T *rtu_Ondaobjetivo, const real_T + *rtu_Ondaportadora, const real_T *rtu_Amplitud, real_T + *rty_SealPWM, real_T *rty_MonitoreoPortadoraAmp, real_T + *rty_MonitoreoPWMAmp1, B_PWMGenerator_c_T *localB) +{ + /* Product: '/Amplificación portadora' */ + *rty_MonitoreoPortadoraAmp = *rtu_Ondaportadora * *rtu_Amplitud; + + /* DataTypeConversion: '/Fijación Double' */ + localB->FijacinDouble = *rtu_Ondaobjetivo; + + /* RelationalOperator: '/PWM' */ + localB->PWM = (localB->FijacinDouble >= *rty_MonitoreoPortadoraAmp); + + /* DataTypeConversion: '/Fijación Double PWM' */ + *rty_MonitoreoPWMAmp1 = localB->PWM; + + /* Sum: '/Sum1' incorporates: + * Constant: '/Constant3' + */ + localB->Sum1 = *rty_MonitoreoPWMAmp1 - PWMGenerator_cal->Constant3_Value; + + /* Product: '/Simetrización PWM' incorporates: + * Constant: '/Constant4' + */ + *rty_SealPWM = localB->Sum1 * PWMGenerator_cal->Constant4_Value; +} + +/* Model initialize function */ +void PWMGenerator_initialize(const char_T **rt_errorStatus, + RT_MODEL_PWMGenerator_T *const PWMGenerator_M, B_PWMGenerator_c_T *localB) +{ + /* Registration code */ + + /* initialize error status */ + rtmSetErrorStatusPointer(PWMGenerator_M, rt_errorStatus); + + /* block I/O */ + (void) std::memset((static_cast(localB)), 0, + sizeof(B_PWMGenerator_c_T)); +} diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator.h b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator.h new file mode 100644 index 0000000..7da3ad2 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator.h @@ -0,0 +1,68 @@ +/* + * Code generation for system model 'PWMGenerator' + * For more details, see corresponding source file PWMGenerator.c + * + */ + +#ifndef PWMGenerator_h_ +#define PWMGenerator_h_ +#include "rtwtypes.h" +#include "rtw_extmode.h" +#include "sysran_types.h" +#include "rtw_continuous.h" +#include "rtw_solver.h" +#include "PWMGenerator_types.h" +#include "PWMGenerator_cal.h" +#include + +/* Block signals for model 'PWMGenerator' */ +struct B_PWMGenerator_c_T { + real_T FijacinDouble; /* '/Fijación Double' */ + real_T Sum1; /* '/Sum1' */ + boolean_T PWM; /* '/PWM' */ +}; + +/* Real-time Model Data Structure */ +struct tag_RTM_PWMGenerator_T { + const char_T **errorStatus; + + /* + * Timing: + * The following substructure contains information regarding + * the timing information for the model. + */ + struct { + boolean_T *stopRequestedFlag; + } Timing; +}; + +struct MdlrefDW_PWMGenerator_T { + B_PWMGenerator_c_T rtb; + RT_MODEL_PWMGenerator_T rtm; +}; + +/* Model reference registration function */ +extern void PWMGenerator_initialize(const char_T **rt_errorStatus, + RT_MODEL_PWMGenerator_T *const PWMGenerator_M, B_PWMGenerator_c_T *localB); +extern void PWMGenerator(const real_T *rtu_Ondaobjetivo, const real_T + *rtu_Ondaportadora, const real_T *rtu_Amplitud, real_T *rty_SealPWM, real_T + *rty_MonitoreoPortadoraAmp, real_T *rty_MonitoreoPWMAmp1, B_PWMGenerator_c_T + *localB); + +/*- + * 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 + * + * '' : 'PWMGenerator' + */ +#endif /* PWMGenerator_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.cpp b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.cpp new file mode 100644 index 0000000..7a29759 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.cpp @@ -0,0 +1,17 @@ +#include "PWMGenerator_cal.h" +#include "PWMGenerator.h" + +/* Storage class 'PageSwitching' */ +PWMGenerator_cal_type PWMGenerator_cal_impl = { + /* Expression: 0.5 + * Referenced by: '/Constant3' + */ + 0.5, + + /* Expression: 2 + * Referenced by: '/Constant4' + */ + 2.0 +}; + +PWMGenerator_cal_type *PWMGenerator_cal = &PWMGenerator_cal_impl; diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.h b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.h new file mode 100644 index 0000000..1ede13c --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.h @@ -0,0 +1,19 @@ +#ifndef PWMGenerator_cal_h_ +#define PWMGenerator_cal_h_ +#include "rtwtypes.h" + +/* Storage class 'PageSwitching', for model 'PWMGenerator' */ +struct PWMGenerator_cal_type { + real_T Constant3_Value; /* Expression: 0.5 + * Referenced by: '/Constant3' + */ + real_T Constant4_Value; /* Expression: 2 + * Referenced by: '/Constant4' + */ +}; + +/* Storage class 'PageSwitching' */ +extern PWMGenerator_cal_type PWMGenerator_cal_impl; +extern PWMGenerator_cal_type *PWMGenerator_cal; + +#endif /* PWMGenerator_cal_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_mr_codeInfo.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_mr_codeInfo.mat new file mode 100644 index 0000000..67ee777 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_mr_codeInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_private.h b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_private.h new file mode 100644 index 0000000..53c990c --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_private.h @@ -0,0 +1,61 @@ +/* + * PWMGenerator_private.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 "PWMGenerator". + * + * Model version : 1.7 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#ifndef PWMGenerator_private_h_ +#define PWMGenerator_private_h_ +#include "rtwtypes.h" +#include "multiword_types.h" +#include "PWMGenerator_types.h" +#include "rtw_continuous.h" +#include "rtw_solver.h" + +/* Macros for accessing real-time model data structure */ +#ifndef rtmGetErrorStatus +#define rtmGetErrorStatus(rtm) (*((rtm)->errorStatus)) +#endif + +#ifndef rtmSetErrorStatus +#define rtmSetErrorStatus(rtm, val) (*((rtm)->errorStatus) = (val)) +#endif + +#ifndef rtmGetErrorStatusPointer +#define rtmGetErrorStatusPointer(rtm) (rtm)->errorStatus +#endif + +#ifndef rtmSetErrorStatusPointer +#define rtmSetErrorStatusPointer(rtm, val) ((rtm)->errorStatus = (val)) +#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 rtmSetStopRequestedPtr +#define rtmSetStopRequestedPtr(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val)) +#endif +#endif /* PWMGenerator_private_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_types.h b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_types.h new file mode 100644 index 0000000..5f9019c --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGenerator_types.h @@ -0,0 +1,27 @@ +/* + * PWMGenerator_types.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 "PWMGenerator". + * + * Model version : 1.7 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:22 2024 + * + * Target selection: speedgoat.tlc + * Note: GRT includes extra infrastructure and instrumentation for prototyping + * Embedded hardware selection: Intel->x86-64 (Linux 64) + * Code generation objectives: Unspecified + * Validation result: Not run + */ + +#ifndef PWMGenerator_types_h_ +#define PWMGenerator_types_h_ + +/* Forward declaration for rtModel */ +typedef struct tag_RTM_PWMGenerator_T RT_MODEL_PWMGenerator_T; + +#endif /* PWMGenerator_types_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGeneratorxcp.m b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGeneratorxcp.m new file mode 100644 index 0000000..4cc01a5 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/PWMGeneratorxcp.m @@ -0,0 +1,28 @@ +function xcp = PWMGeneratorxcp + +xcp.events = repmat(struct('id',{}, 'sampletime', {}, 'offset', {}), getNumEvents, 1 ); +xcp.parameters = repmat(struct('symbol',{}, 'size', {}, 'dtname', {}, 'baseaddr', {}), getNumParameters, 1 ); +xcp.signals = repmat(struct('symbol',{}), getNumSignals, 1 ); +xcp.models = cell(1,getNumModels); + + + + + + +xcp.events(1).id = 0; +xcp.events(1).sampletime = 0.0001; +xcp.events(1).offset = 0.0; + +function n = getNumParameters +n = 0; + +function n = getNumSignals +n = 0; + +function n = getNumEvents +n = 1; + +function n = getNumModels +n = 1; + diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/buildInfo.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/buildInfo.mat new file mode 100644 index 0000000..df37319 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/buildInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/codedescriptor.dmr b/Control/VF Control/slprj/speedgoat/PWMGenerator/codedescriptor.dmr new file mode 100644 index 0000000..a7ea4bc Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/codedescriptor.dmr differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.bat b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.bat new file mode 100644 index 0000000..46bf18c --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.bat @@ -0,0 +1,15 @@ + +call "%SLREALTIME_QNX_SP_ROOT%\%SLREALTIME_QNX_VERSION%\qnxsdp-env.bat" + +cd . + +chcp 1252 + +if "%1"=="" (make -f PWMGenerator.mk all) else (make -f PWMGenerator.mk %1) +@if errorlevel 1 goto error_exit + +exit /B 0 + +:error_exit +echo The make command returned an error of %errorlevel% +exit /B 1 \ No newline at end of file diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.mk b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.mk new file mode 100644 index 0000000..0ec9728 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.mk @@ -0,0 +1,353 @@ +########################################################################### +## Makefile generated for component 'PWMGenerator'. +## +## Makefile : PWMGenerator.mk +## Generated on : Wed Oct 16 10:45:31 2024 +## Final product: ./PWMGenerator_rtwlib.a +## Product type : static library +## +########################################################################### + +########################################################################### +## MACROS +########################################################################### + +# Macro Descriptions: +# PRODUCT_NAME Name of the system to build +# MAKEFILE Name of this makefile +# MODELLIB Static library target + +PRODUCT_NAME = PWMGenerator +MAKEFILE = PWMGenerator.mk +MATLAB_ROOT = C:/PROGRA~1/MATLAB/R2024a +MATLAB_BIN = C:/PROGRA~1/MATLAB/R2024a/bin +MATLAB_ARCH_BIN = $(MATLAB_BIN)/win64 +START_DIR = C:/Users/PROMER~1/Desktop/SPARK-~1/Spark/UNAV/BANCOD~1/Simulink/VFCONT~1 +SOLVER = +SOLVER_OBJ = +CLASSIC_INTERFACE = 0 +TGT_FCN_LIB = ISO_C++ +MODEL_HAS_DYNAMICALLY_LOADED_SFCNS = 0 +RELATIVE_PATH_TO_ANCHOR = ../../../.. +C_STANDARD_OPTS = +CPP_STANDARD_OPTS = +MODELLIB = PWMGenerator_rtwlib.a + +########################################################################### +## TOOLCHAIN SPECIFICATIONS +########################################################################### + +# Toolchain Name: Simulink Real-Time Toolchain +# Supported Version(s): +# ToolchainInfo Version: 2024a +# Specification Revision: 1.0 +# +#------------------------------------------- +# Macros assumed to be defined elsewhere +#------------------------------------------- + +# SLREALTIME_QNX_SP_ROOT +# SLREALTIME_QNX_VERSION + +#----------- +# MACROS +#----------- + +QCC_TARGET = gcc_ntox86_64 + +TOOLCHAIN_SRCS = +TOOLCHAIN_INCS = +TOOLCHAIN_LIBS = -L$(MATLAB_ROOT)/toolbox/slrealtime/target/win64/target/lib -ltraceparser -lpps -lslrealtime_kernel -lslrealtime_platform -lslrealtime_rtps -lsocket -lboost_system -lboost_log -lpci -lopenblas -lpcap + +#------------------------ +# BUILD TOOL COMMANDS +#------------------------ + +# C Compiler: QNX C Compiler +CC = qcc + +# Linker: QCC Linker +LD = q++ + +# C++ Compiler: QNX C++ Compiler +CPP = q++ + +# C++ Linker: QCC C++ Linker +CPP_LD = q++ + +# Archiver: QNX Archiver +AR = ntox86_64-gcc-ar + +# Builder: GMAKE Utility +MAKE = make + + +#------------------------- +# Directives/Utilities +#------------------------- + +CDEBUG = -g -O0 -finstrument-functions +C_OUTPUT_FLAG = -o +LDDEBUG = -g +OUTPUT_FLAG = -o +CPPDEBUG = -g -O0 -finstrument-functions +CPP_OUTPUT_FLAG = -o +CPPLDDEBUG = -g +OUTPUT_FLAG = -o +ARDEBUG = +STATICLIB_OUTPUT_FLAG = +RM = @del /F +ECHO = @echo +MV = @move +RUN = + +#-------------------------------------- +# "Faster Runs" Build Configuration +#-------------------------------------- + +ARFLAGS = ruvs +CFLAGS = -c -V$(QCC_TARGET) -g \ + -O2 -fwrapv +CPPFLAGS = -c -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ \ + -O2 -fwrapv +CPP_LDFLAGS = -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ +CPP_SHAREDLIB_LDFLAGS = -V$(QCC_TARGET) -shared -Wl,--no-undefined -g +LDFLAGS = -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ +MAKE_FLAGS = -f $(MAKEFILE) +SHAREDLIB_LDFLAGS = -V$(QCC_TARGET) -shared -Wl,--no-undefined -g + + + +########################################################################### +## OUTPUT INFO +########################################################################### + +PRODUCT = ./PWMGenerator_rtwlib.a +PRODUCT_TYPE = "static library" +BUILD_TYPE = "Model Reference Library" + +########################################################################### +## INCLUDE PATHS +########################################################################### + +INCLUDES_BUILDINFO = -I$(START_DIR) -I$(START_DIR)/slprj/speedgoat/PWMGenerator -I$(MATLAB_ROOT)/toolbox/slrealtime/simulink/blocks/dist/include -I$(MATLAB_ROOT)/toolbox/slrealtime/target/kernel/dist/include -I$(MATLAB_ROOT)/extern/include -I$(MATLAB_ROOT)/simulink/include -I$(MATLAB_ROOT)/rtw/c/src -I$(MATLAB_ROOT)/rtw/c/src/ext_mode/common -I$(START_DIR)/slprj/speedgoat/_sharedutils + +INCLUDES = $(INCLUDES_BUILDINFO) + +########################################################################### +## DEFINES +########################################################################### + +DEFINES_ = -DSIMULINK_REAL_TIME -D_QNX_SOURCE +DEFINES_BUILD_ARGS = -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMAT_FILE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 +DEFINES_CUSTOM = +DEFINES_OPTS = -DTID01EQ=0 +DEFINES_STANDARD = -DMODEL=PWMGenerator -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL + +DEFINES = $(DEFINES_) $(DEFINES_BUILD_ARGS) $(DEFINES_CUSTOM) $(DEFINES_OPTS) $(DEFINES_STANDARD) + +########################################################################### +## SOURCE FILES +########################################################################### + +SRCS = $(START_DIR)/slprj/speedgoat/PWMGenerator/PWMGenerator.cpp $(START_DIR)/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.cpp $(START_DIR)/slprj/speedgoat/PWMGenerator/slrealtime_datatype_ground.cpp + +ALL_SRCS = $(SRCS) + +########################################################################### +## OBJECTS +########################################################################### + +OBJS = PWMGenerator.o PWMGenerator_cal.o slrealtime_datatype_ground.o + +ALL_OBJS = $(OBJS) + +########################################################################### +## PREBUILT OBJECT FILES +########################################################################### + +PREBUILT_OBJS = + +########################################################################### +## LIBRARIES +########################################################################### + +LIBS = + +########################################################################### +## SYSTEM LIBRARIES +########################################################################### + +SYSTEM_LIBS = + +########################################################################### +## ADDITIONAL TOOLCHAIN FLAGS +########################################################################### + +#--------------- +# C Compiler +#--------------- + +CFLAGS_BASIC = $(DEFINES) $(INCLUDES) + +CFLAGS += $(CFLAGS_BASIC) + +#----------------- +# C++ Compiler +#----------------- + +CPPFLAGS_BASIC = $(DEFINES) $(INCLUDES) + +CPPFLAGS += $(CPPFLAGS_BASIC) + +########################################################################### +## INLINED COMMANDS +########################################################################### + +########################################################################### +## PHONY TARGETS +########################################################################### + +.PHONY : all build clean info prebuild + + +all : build + @echo "### Successfully generated all binary outputs." + + +build : prebuild $(PRODUCT) + + +prebuild : + + +########################################################################### +## FINAL TARGET +########################################################################### + +#--------------------------------- +# Create a static library +#--------------------------------- + +$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) + @echo "### Creating static library "$(PRODUCT)" ..." + $(AR) $(ARFLAGS) $(PRODUCT) $(OBJS) + @echo "### Created: $(PRODUCT)" + + +########################################################################### +## INTERMEDIATE TARGETS +########################################################################### + +#--------------------- +# SOURCE-TO-OBJECT +#--------------------- + +%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(START_DIR)/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(START_DIR)/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(START_DIR)/slprj/speedgoat/PWMGenerator/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(START_DIR)/slprj/speedgoat/PWMGenerator/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/rtw/c/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/rtw/c/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/simulink/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/simulink/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/simulink/blocks/src/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(MATLAB_ROOT)/toolbox/simulink/blocks/src/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : ../%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : ../%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +PWMGenerator.o : $(START_DIR)/slprj/speedgoat/PWMGenerator/PWMGenerator.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +PWMGenerator_cal.o : $(START_DIR)/slprj/speedgoat/PWMGenerator/PWMGenerator_cal.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +slrealtime_datatype_ground.o : $(START_DIR)/slprj/speedgoat/PWMGenerator/slrealtime_datatype_ground.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +########################################################################### +## DEPENDENCIES +########################################################################### + +$(ALL_OBJS) : rtw_proj.tmw $(MAKEFILE) + + +########################################################################### +## MISCELLANEOUS TARGETS +########################################################################### + +info : + @echo "### PRODUCT = $(PRODUCT)" + @echo "### PRODUCT_TYPE = $(PRODUCT_TYPE)" + @echo "### BUILD_TYPE = $(BUILD_TYPE)" + @echo "### INCLUDES = $(INCLUDES)" + @echo "### DEFINES = $(DEFINES)" + @echo "### ALL_SRCS = $(ALL_SRCS)" + @echo "### ALL_OBJS = $(ALL_OBJS)" + @echo "### LIBS = $(LIBS)" + @echo "### MODELREF_LIBS = $(MODELREF_LIBS)" + @echo "### SYSTEM_LIBS = $(SYSTEM_LIBS)" + @echo "### TOOLCHAIN_LIBS = $(TOOLCHAIN_LIBS)" + @echo "### CFLAGS = $(CFLAGS)" + @echo "### LDFLAGS = $(LDFLAGS)" + @echo "### SHAREDLIB_LDFLAGS = $(SHAREDLIB_LDFLAGS)" + @echo "### CPPFLAGS = $(CPPFLAGS)" + @echo "### CPP_LDFLAGS = $(CPP_LDFLAGS)" + @echo "### CPP_SHAREDLIB_LDFLAGS = $(CPP_SHAREDLIB_LDFLAGS)" + @echo "### ARFLAGS = $(ARFLAGS)" + @echo "### MAKE_FLAGS = $(MAKE_FLAGS)" + + +clean : + $(ECHO) "### Deleting all derived files ..." + $(RM) $(subst /,\,$(PRODUCT)) + $(RM) $(subst /,\,$(ALL_OBJS)) + $(ECHO) "### Deleted all derived files." + + diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.o b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.o new file mode 100644 index 0000000..3a49894 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator.o differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_cal.o b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_cal.o new file mode 100644 index 0000000..0ec29cb Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_cal.o differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_rtwlib.a b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_rtwlib.a new file mode 100644 index 0000000..b0592b4 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/PWMGenerator_rtwlib.a differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/buildInfo.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/buildInfo.mat new file mode 100644 index 0000000..a2e5b82 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/buildInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/compileInfo.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/compileInfo.mat new file mode 100644 index 0000000..54e4ff1 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/compileInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/instrumentationInfo.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/instrumentationInfo.mat new file mode 100644 index 0000000..46abdb2 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/instrumentationInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/profiling_info.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/profiling_info.mat new file mode 100644 index 0000000..2e08c37 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/profiling_info.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/rtw_proj.tmw b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/rtw_proj.tmw new file mode 100644 index 0000000..99982db --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/rtw_proj.tmw @@ -0,0 +1,4 @@ +Simulink Coder project for PWMGenerator using . MATLAB root = C:\Program Files\MATLAB\R2024a. SimStruct date: 12-ene.-2024 11:16:21 +This file is generated by Simulink Coder for use by the make utility +to determine when to rebuild objects when the name of the current Simulink Coder project changes. +The rtwinfomat located at: diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/slrealtime_datatype_ground.o b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/slrealtime_datatype_ground.o new file mode 100644 index 0000000..e504a15 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/instrumented/slrealtime_datatype_ground.o differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/rtw_proj.tmw b/Control/VF Control/slprj/speedgoat/PWMGenerator/rtw_proj.tmw new file mode 100644 index 0000000..b7f0f6c --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/rtw_proj.tmw @@ -0,0 +1,4 @@ +Simulink Coder project for PWMGenerator using . MATLAB root = C:\Program Files\MATLAB\R2024a. SimStruct date: 12-ene.-2024 11:16:21 +This file is generated by Simulink Coder for use by the make utility +to determine when to rebuild objects when the name of the current Simulink Coder project changes. +The rtwinfomat located at: ..\..\..\slprj\speedgoat\PWMGenerator\tmwinternal\binfo_mdlref.mat diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/slrealtime_datatype_ground.cpp b/Control/VF Control/slprj/speedgoat/PWMGenerator/slrealtime_datatype_ground.cpp new file mode 100644 index 0000000..47c9eb3 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/slrealtime_datatype_ground.cpp @@ -0,0 +1,9 @@ +#include "slrtdatatypes.h" + +const serialfifoptr serialfifoground = { 0, 0, 0 }; + +const bcmsglist1553 bcmsg1553ground = { 0, 0, 0, 0 }; + +const bcstatus1553 bcstatground = { 0, 0, 0, 0, 0, 0 }; + +const bmmsglist1553 bmmsg1553ground = { 0, 0, 0, 0 }; diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/slrealtime_task_info.m b/Control/VF Control/slprj/speedgoat/PWMGenerator/slrealtime_task_info.m new file mode 100644 index 0000000..3d2d16f --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/slrealtime_task_info.m @@ -0,0 +1,17 @@ +function [taskInfo, numtask, isDeploymentDiagram]=slrealtime_task_info() + taskInfo(1).samplePeriod = 0.0001; + taskInfo(1).sampleOffset = 0.0; + taskInfo(1).taskPrio = 9; + taskInfo(1).taskName = 'BaseRate'; + taskInfo(1).entryPoints = {}; + numtask = 1; + for i = 1:numtask + if ( 0 == isnumeric(taskInfo(i).samplePeriod) ) + taskInfo(i).samplePeriod = evalin('base', taskInfo(i).samplePeriod); + end + if ( isempty(taskInfo(i).taskName) ) + taskInfo(i).taskName = ['AutoGen' i ]; + end + end + isDeploymentDiagram = 0; +end diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/BlockTraceInfo.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/BlockTraceInfo.mat new file mode 100644 index 0000000..1fdb3b0 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/BlockTraceInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/ModelRefCompileInfo.xml b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/ModelRefCompileInfo.xml new file mode 100644 index 0000000..151c7fd --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/ModelRefCompileInfo.xml @@ -0,0 +1,478 @@ + + + + + PWMGenerator + [{"Name":"Onda objetivo","Profile":""},{"Name":"Onda portadora","Profile":""},{"Name":"Amplitud","Profile":""},{"Name":"Señal PWM","Profile":""},{"Name":"Monitoreo\nPortadora Amp","Profile":""},{"Name":"Monitoreo\nPWMAmp1","Profile":""}] + + + PWMGenerator + PWMGenerator + + false + false + 10.0 + + + true + base workspace + BaseWorkspace + + PWMGenerator + + AAFJTQAAAAAOAAAAOAAAAAYAAAAIAAAAAgAAAAAAAAAFAAAACAAAAAAAAAABAAAAAQAAAAAAAAAFAAQAAQAAAAEAAAAAAAAA + {"Inports":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","Outports":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","ParameterArguments":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","LocalParameters":"{\"Name\":\"PageSwitching\",\"Checksum\":\"1969678929\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","GlobalParameters":"{\"Name\":\"slrealtime_PageSwitching\",\"Checksum\":\"673606011\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","InternalData":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","SharedLocalDataStores":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","GlobalDataStores":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","Constants":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","DataTransfers":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","ModelData":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","InitializeTerminate":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","Execution":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","SharedUtility":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}"} + -1.0 + .0001 + 0,0,0;1,1,1;2,2,2 + 0,0,0;1,1,1;2,2,2 + true + true + false + false + + true + false + inf + -inf + 2 + + true + D1 + .0001 + 40 + 0 + + + + + + + true + false + inf + -inf + 2 + 1 + + true + D1 + .0001 + 40 + 0 + + + + + + + true + false + inf + -inf + 2 + 2 + + true + D1 + .0001 + 40 + 0 + + + + + + false + false + false + false + false + false + false + false + false + false + true + 2 + -1.0 + 3 + 0 + 0 + 0 + 1 + 1 + + + + false + false + false + + + + + 3 + inf + -inf + 2 + + true + D1 + .0001 + 40 + 0 + + + + + + + 2 + true + inf + -inf + 2 + 1 + + true + D1 + .0001 + 40 + 0 + + + + + + + 2 + true + inf + -inf + 2 + 2 + + true + D1 + .0001 + 40 + 0 + + + + + + false + false + + true + D1 + .0001 + 40 + 0 + + 2 + 327 + <?xml version="1.0"?> +<slexec_sto version="1.1" packageUris="http://schema.mathworks.com/mf0/slexec_mm_sto/R2024a_202305081229"> + <sto.Registry type="sto.Registry" uuid="33e23d7b-4068-4edb-957a-fc51f3004f78"> + <executionSpec>Undetermined</executionSpec> + <identifier>PWMGenerator</identifier> + <clockRegistry type="sto.ClockRegistry" uuid="2c6ea28b-ee11-4845-ad05-e02711cb3e39"> + <clocks type="sto.Timer" uuid="deccdced-d29d-4d64-80fd-54459d218157"> + <computedFundamentalDiscretePeriod>.0001</computedFundamentalDiscretePeriod> + <fastestDiscreteRate type="sto.ClassicPeriodicDiscreteRate" uuid="51866984-9829-4e34-a33b-395bd0bef96f"/> + <isDefaultTimer>true</isDefaultTimer> + <resolution>.0001</resolution> + <timeAdvanceMode>FixedStep</timeAdvanceMode> + <identifier>PWMGenerator::defaultTimer</identifier> + <rates type="sto.ClassicPeriodicDiscreteRate" uuid="51866984-9829-4e34-a33b-395bd0bef96f"> + <annotation>D1</annotation> + <clockId>PWMGenerator::defaultTimer</clockId> + <description>Discrete 1</description> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="99399e65-2f4a-4826-997f-e67f1b5da932"> + <period>.0001</period> + <rateType>ClassicPeriodicDiscrete</rateType> + </rateSpec> + </rates> + <baseRate type="sto.ClassicPeriodicDiscreteRate" uuid="1f349dbe-d07e-4060-98f0-9fad01948c0c"> + <annotation>D1</annotation> + <clockId>PWMGenerator::defaultTimer</clockId> + <description>Discrete 1</description> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="2385aba8-1bb2-416d-8e28-337914281c0e"> + <period>.0001</period> + <rateType>ClassicPeriodicDiscrete</rateType> + </rateSpec> + </baseRate> + </clocks> + <clocks type="sto.Event" uuid="37316760-dac6-4620-bb37-688d241bca95"> + <eventType>PARAMETER_CHANGE_EVENT</eventType> + <cNum>1</cNum> + <clockType>Event</clockType> + <identifier>ParameterChangeEvent</identifier> + <rates type="sto.ModelWideEventRate" uuid="474dd4e4-f1d0-49bd-a42f-c6fc776b8dc1"> + <annotation>Inf</annotation> + <clockId>ParameterChangeEvent</clockId> + <colorIndex>-1</colorIndex> + <description>Constant</description> + <rateIdx>-1</rateIdx> + <taskId>ModelWideParameterChangeEvent</taskId> + <useForExecution>NotForExecution</useForExecution> + <rateSpec type="sto.RateSpec" uuid="b25f28bf-508a-4d9a-a15e-e7d188cdfea2"> + <period>inf</period> + <rateType>ModelWideParameterChangeEvent</rateType> + </rateSpec> + </rates> + </clocks> + <timeAdvanceMode>FixedStep</timeAdvanceMode> + </clockRegistry> + <taskRegistry type="sto.TaskRegistry" uuid="bf816430-fc98-4330-8151-015c9d5be15d"> + <rootTaskHierarchyElements type="sto.Task" uuid="af84832b-afbc-4cf8-93e7-a441d8f9fbfc"> + <isExplicit>true</isExplicit> + <rates type="sto.ModelWideEventRate" uuid="47cdf65d-d443-42d1-a462-d7c1993eff78"> + <annotation>Inf</annotation> + <clockId>ParameterChangeEvent</clockId> + <colorIndex>-1</colorIndex> + <description>Constant</description> + <rateIdx>-1</rateIdx> + <taskId>ModelWideParameterChangeEvent</taskId> + <useForExecution>NotForExecution</useForExecution> + <rateSpec type="sto.RateSpec" uuid="69c5d6ae-3011-4598-ac8e-2644cf1c3b45"> + <period>inf</period> + <rateType>ModelWideParameterChangeEvent</rateType> + </rateSpec> + </rates> + <schedulingClockId>ParameterChangeEvent</schedulingClockId> + <timeKeeperClockId>PWMGenerator::defaultTimer</timeKeeperClockId> + <elementType>Task</elementType> + <identifier>ModelWideParameterChangeEvent</identifier> + <priority>-1</priority> + </rootTaskHierarchyElements> + <rootTaskHierarchyElements type="sto.Task" uuid="7e6f62b1-fa7b-4f97-b418-a4dbf47680e3"> + <isExecutable>true</isExecutable> + <orderIndex>1</orderIndex> + <rates type="sto.ClassicPeriodicDiscreteRate" uuid="96471fbf-7e84-4c3f-841d-da8464c10675"> + <annotation>D1</annotation> + <clockId>PWMGenerator::defaultTimer</clockId> + <description>Discrete 1</description> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="751695d3-3911-4c55-9d5f-beb910645823"> + <period>.0001</period> + <rateType>ClassicPeriodicDiscrete</rateType> + </rateSpec> + </rates> + <schedulingClockId>PWMGenerator::defaultTimer</schedulingClockId> + <timeKeeperClockId>PWMGenerator::defaultTimer</timeKeeperClockId> + <elementType>Task</elementType> + <identifier>_task0</identifier> + <priority>40</priority> + </rootTaskHierarchyElements> + <taskDependencyGraph type="sto.SerializedTaskConnectionList" uuid="852020b7-09bf-4968-a9e2-cc6c033ce554"> + <clockIdentifier>PWMGenerator::defaultTimer</clockIdentifier> + <taskIdentifier>_task0</taskIdentifier> + </taskDependencyGraph> + <taskDependencyGraph type="sto.SerializedTaskConnectionList" uuid="51f9cb88-22fc-44cf-9cb8-7b00a9f27f78"> + <clockIdentifier>ParameterChangeEvent</clockIdentifier> + <taskIdentifier>ModelWideParameterChangeEvent</taskIdentifier> + </taskDependencyGraph> + <taskingMode>ClassicMultiTasking</taskingMode> + </taskRegistry> + </sto.Registry> +</slexec_sto> + true + .0001 + + + MdlrefDW_PWMGenerator_T + + + + true + true + .0001 + 2 + true + 2 + 1 + FixedStepDiscrete + SOLVER_TYPE_FIXEDSTEP + + 8 + 64 + 32 + 32 + 64 + 64 + 64 + 64 + 16 + 64 + 1 + true + true + 64 + + + + + + 0 + 1 + 2 + 0 + 1 + 2 + 0 + 1 + 2 + 0 + 1 + 2 + + + + + + + + + + + + + + + + + 1.0 + .0001 + 0.0 + Onda objetivo + + + 1.0 + .0001 + 0.0 + Onda portadora + + + 1.0 + .0001 + 0.0 + Amplitud + + PWMGenerator + + 1.0 + .0001 + 0.0 + Señal PWM + + + 1.0 + .0001 + 0.0 + Monitoreo +Portadora Amp + + + 1.0 + .0001 + 0.0 + Monitoreo +PWMAmp1 + + ROOT + + + + + + + + portAmplitud + RootInport + + + portMonitoreo +PWMAmp1 + RootOutport + + + portMonitoreo +Portadora Amp + RootOutport + + + portOnda objetivo + RootInport + + + portOnda portadora + RootInport + + + portSeñal PWM + RootOutport + + 1 + + + true + + + + + false + Default + -2147483648 + + + + false + 2 + true + D1 + 40 + + D1 + -12240129 + true + ClassicPeriodicDiscrete0.00010 + 0 + + .0001 + + 0 + + + + + + + + + sltpEvents + + + sltpTaskGroups + + + + + D1 + + + PWMGenerator::defaultTimer + _task0 + + + sltpTasks + + + + + \ No newline at end of file diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/binfo_mdlref.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/binfo_mdlref.mat new file mode 100644 index 0000000..bbd0682 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/binfo_mdlref.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/minfo_mdlref.mat b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/minfo_mdlref.mat new file mode 100644 index 0000000..59f2236 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/minfo_mdlref.mat differ diff --git a/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/simulink_cache.xml b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/simulink_cache.xml new file mode 100644 index 0000000..96caacf --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/PWMGenerator/tmwinternal/simulink_cache.xml @@ -0,0 +1,6 @@ + + + + ihj/publnQM5vZ7sK1lGtklEz2c4oba7NTHaoZ21uGJcTd7Lwp3hA8eFVigLXlHL4CBc7auFcxQdjiAwB/rhPA== + + \ No newline at end of file diff --git a/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/BlockTraceInfo.mat b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/BlockTraceInfo.mat new file mode 100644 index 0000000..475328e Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/BlockTraceInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/CompileInfo.xml b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/CompileInfo.xml new file mode 100644 index 0000000..e9ffc10 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/CompileInfo.xml @@ -0,0 +1,412 @@ + + + + + VFControl + + + PWMGenerator + [{"Name":"Onda objetivo","Profile":""},{"Name":"Onda portadora","Profile":""},{"Name":"Amplitud","Profile":""},{"Name":"Señal PWM","Profile":""},{"Name":"Monitoreo\nPortadora Amp","Profile":""},{"Name":"Monitoreo\nPWMAmp1","Profile":""}] + + + true + PWMGenerator + VFControl:PWMGenerator + + + VFControl + VFControl + + + 1 + .0001 + DeducedFromSampleTime + + inf + + + true + base workspace + BaseWorkspace + + PWMGenerator + + + + true + base workspace + BaseWorkspace + + VFControl + + AAFJTQAAAAAOAAAAOAAAAAYAAAAIAAAAAgAAAAAAAAAFAAAACAAAAAAAAAABAAAAAQAAAAAAAAAFAAQAAQAAAAEAAAAAAAAA + {"Inports":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","Outports":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","ParameterArguments":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","LocalParameters":"{\"Name\":\"PageSwitching\",\"Checksum\":\"1969678929\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","GlobalParameters":"{\"Name\":\"slrealtime_PageSwitching\",\"Checksum\":\"673606011\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","InternalData":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","SharedLocalDataStores":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","GlobalDataStores":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","Constants":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","DataTransfers":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","ModelData":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","InitializeTerminate":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","Execution":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}","SharedUtility":"{\"Name\":\"Default\",\"Checksum\":\"Default\",\"PerInstancePropertiesChecksum\":\"\",\"MemorySectionName\":\"None\",\"MemorySectionChecksum\":\"None\"}"} + -1.0 + true + true + true + false + 2 + -1.0 + true + true + VFControl/Asynchronous Machine SI Units/Electrical model/Asynchronous Machine State-space model/Saturation/Matrix L/Lm in rows[1,3] & col[1,3] + 12 + 0 + 12 + 21 + + true + true + 0.0 + 40 + 0 + + + true + true + Cont + .0001 + 40 + 1 + + + true + D2 + .0005 + 39 + 2 + + 2 + 335 + <?xml version="1.0"?> +<slexec_sto version="1.1" packageUris="http://schema.mathworks.com/mf0/slexec_mm_sto/R2024a_202305081229"> + <sto.Registry type="sto.Registry" uuid="a51532d1-771f-425d-8f6a-f67f3f9389c4"> + <executionSpec>Undetermined</executionSpec> + <identifier>VFControl</identifier> + <clockRegistry type="sto.ClockRegistry" uuid="096fa08f-12cf-4d3b-bb1c-92d47f36d788"> + <clocks type="sto.Timer" uuid="291c8499-cf6d-4efd-93f5-ffa5144b794d"> + <computedFundamentalDiscretePeriod>.0001</computedFundamentalDiscretePeriod> + <fastestDiscreteRate type="sto.ClassicPeriodicDiscreteRate" uuid="70a632cd-0b31-4d92-b7d4-b17e9aec25d1"/> + <isDefaultTimer>true</isDefaultTimer> + <resolution>.0001</resolution> + <timeAdvanceMode>FixedStep</timeAdvanceMode> + <identifier>VFControl::defaultTimer</identifier> + <rates type="sto.ContinuousRate" uuid="3bda0e9b-8bab-474d-88fc-6022ded61fb3"> + <annotation>Cont</annotation> + <clockId>VFControl::defaultTimer</clockId> + <colorIndex>-1</colorIndex> + <description>Continuous</description> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="8e5d3c59-3257-4f6f-b99e-e7272255f03d"/> + </rates> + <rates type="sto.ClassicPeriodicDiscreteRate" uuid="70a632cd-0b31-4d92-b7d4-b17e9aec25d1"> + <annotation>D1</annotation> + <clockId>VFControl::defaultTimer</clockId> + <description>Discrete 1</description> + <rateIdx>1</rateIdx> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="296bb704-5300-4489-a43d-8fd6c944c0a9"> + <period>.0001</period> + <rateType>ClassicPeriodicDiscrete</rateType> + </rateSpec> + </rates> + <rates type="sto.ClassicPeriodicDiscreteRate" uuid="cf439926-8acb-486c-84a5-7bceaf3f31b4"> + <annotation>D2</annotation> + <clockId>VFControl::defaultTimer</clockId> + <colorIndex>1</colorIndex> + <description>Discrete 2</description> + <rateIdx>2</rateIdx> + <taskId>_task1</taskId> + <rateSpec type="sto.RateSpec" uuid="32db3ce7-aa4d-48fc-9305-213e0e4b8ed7"> + <period>.0005</period> + <rateType>ClassicPeriodicDiscrete</rateType> + </rateSpec> + </rates> + <baseRate type="sto.ContinuousRate" uuid="b8865775-ebdc-47e1-afbc-ed4132777155"> + <annotation>Cont</annotation> + <clockId>VFControl::defaultTimer</clockId> + <colorIndex>-1</colorIndex> + <description>Continuous</description> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="a9d39401-0685-4a4e-94fa-71496a9a5401"/> + </baseRate> + </clocks> + <clocks type="sto.Event" uuid="edeef952-6822-4190-bed9-73c7f425b699"> + <eventType>PARAMETER_CHANGE_EVENT</eventType> + <cNum>1</cNum> + <clockType>Event</clockType> + <identifier>ParameterChangeEvent</identifier> + <rates type="sto.ModelWideEventRate" uuid="0ff82ce2-7d8f-4728-ae67-979d2d04828c"> + <annotation>Inf</annotation> + <clockId>ParameterChangeEvent</clockId> + <colorIndex>-1</colorIndex> + <description>Constant</description> + <rateIdx>-1</rateIdx> + <taskId>ModelWideParameterChangeEvent</taskId> + <useForExecution>NotForExecution</useForExecution> + <rateSpec type="sto.RateSpec" uuid="dff61f35-76e0-4436-8958-741bd0b7160a"> + <period>inf</period> + <rateType>ModelWideParameterChangeEvent</rateType> + </rateSpec> + </rates> + </clocks> + <timeAdvanceMode>FixedStep</timeAdvanceMode> + </clockRegistry> + <taskRegistry type="sto.TaskRegistry" uuid="0f7fe815-003a-43f8-a4a9-1dada4d21f8b"> + <rootTaskHierarchyElements type="sto.Task" uuid="0eae1af7-3ac6-4fb1-972e-81e4281cb382"> + <isExplicit>true</isExplicit> + <rates type="sto.ModelWideEventRate" uuid="dd2637b8-4051-430c-955e-ecb9f3fd15f2"> + <annotation>Inf</annotation> + <clockId>ParameterChangeEvent</clockId> + <colorIndex>-1</colorIndex> + <description>Constant</description> + <rateIdx>-1</rateIdx> + <taskId>ModelWideParameterChangeEvent</taskId> + <useForExecution>NotForExecution</useForExecution> + <rateSpec type="sto.RateSpec" uuid="150387e7-4e18-4ea0-ba4e-15e11fce55d3"> + <period>inf</period> + <rateType>ModelWideParameterChangeEvent</rateType> + </rateSpec> + </rates> + <schedulingClockId>ParameterChangeEvent</schedulingClockId> + <timeKeeperClockId>VFControl::defaultTimer</timeKeeperClockId> + <elementType>Task</elementType> + <identifier>ModelWideParameterChangeEvent</identifier> + <priority>-1</priority> + </rootTaskHierarchyElements> + <rootTaskHierarchyElements type="sto.Task" uuid="50e89d34-7249-4db9-942f-aad349e3cc15"> + <isExecutable>true</isExecutable> + <orderIndex>1</orderIndex> + <rates type="sto.ContinuousRate" uuid="3a01bb04-d15c-4c16-a0b1-cd441d2b1356"> + <annotation>Cont</annotation> + <clockId>VFControl::defaultTimer</clockId> + <colorIndex>-1</colorIndex> + <description>Continuous</description> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="ede8e03b-8be0-49c2-9bab-bea555d0e08d"/> + </rates> + <rates type="sto.ClassicPeriodicDiscreteRate" uuid="139e8595-ec68-484e-b662-75cd0c6462f9"> + <annotation>D1</annotation> + <clockId>VFControl::defaultTimer</clockId> + <description>Discrete 1</description> + <rateIdx>1</rateIdx> + <taskId>_task0</taskId> + <rateSpec type="sto.RateSpec" uuid="af74c318-4482-4bfb-9037-7c8fce214416"> + <period>.0001</period> + <rateType>ClassicPeriodicDiscrete</rateType> + </rateSpec> + </rates> + <schedulingClockId>VFControl::defaultTimer</schedulingClockId> + <timeKeeperClockId>VFControl::defaultTimer</timeKeeperClockId> + <elementType>Task</elementType> + <identifier>_task0</identifier> + <priority>40</priority> + </rootTaskHierarchyElements> + <rootTaskHierarchyElements type="sto.Task" uuid="7c389f59-8f39-4a90-9ca3-e8fc71052347"> + <isExecutable>true</isExecutable> + <orderIndex>2</orderIndex> + <rates type="sto.ClassicPeriodicDiscreteRate" uuid="bec2b738-839c-4d4a-9a81-e3c55d53d210"> + <annotation>D2</annotation> + <clockId>VFControl::defaultTimer</clockId> + <colorIndex>1</colorIndex> + <description>Discrete 2</description> + <rateIdx>2</rateIdx> + <taskId>_task1</taskId> + <rateSpec type="sto.RateSpec" uuid="c84c6a44-df09-44e7-a4f5-e89311717097"> + <period>.0005</period> + <rateType>ClassicPeriodicDiscrete</rateType> + </rateSpec> + </rates> + <schedulingClockId>VFControl::defaultTimer</schedulingClockId> + <tNum>1</tNum> + <timeKeeperClockId>VFControl::defaultTimer</timeKeeperClockId> + <elementType>Task</elementType> + <identifier>_task1</identifier> + <priority>39</priority> + </rootTaskHierarchyElements> + <taskDependencyGraph type="sto.SerializedTaskConnectionList" uuid="3725f998-b0f9-48a3-a187-847dd3d93686"> + <clockIdentifier>VFControl::defaultTimer</clockIdentifier> + <taskIdentifier>_task1</taskIdentifier> + </taskDependencyGraph> + <taskDependencyGraph type="sto.SerializedTaskConnectionList" uuid="57f90573-5dd1-4404-bb2b-006634a6fefe"> + <clockIdentifier>VFControl::defaultTimer</clockIdentifier> + <taskIdentifier>_task0</taskIdentifier> + </taskDependencyGraph> + <taskDependencyGraph type="sto.SerializedTaskConnectionList" uuid="07c418f9-2104-4cb0-a185-9aa2a20fba35"> + <clockIdentifier>ParameterChangeEvent</clockIdentifier> + <taskIdentifier>ModelWideParameterChangeEvent</taskIdentifier> + </taskDependencyGraph> + <taskingMode>ClassicMultiTasking</taskingMode> + </taskRegistry> + </sto.Registry> +</slexec_sto> + + + + + true + true + VFControl/Model + + + true + true + VFControl/Model1 + + + true + true + VFControl/Model2 + + + + true + true + .0001 + 2 + true + true + 2 + 1 + SOLVER_MODE_MULTITASKING + FixedStepDiscrete + SOLVER_TYPE_FIXEDSTEP + + 8 + 64 + 32 + 32 + 64 + 64 + 64 + 64 + 16 + 64 + 1 + true + true + 64 + + + + + + + + + + + + + + + + + + + + VFControl + ROOT + + + + + + + + + true + + + + + false + Default + -2147483648 + + + true + + false + 1 + true + Cont + 40 + + Cont + 255 + true + Continuous00 + 0 + + 0.0 + + 0 + + + D1 + -12240129 + true + 1 + + .0001 + + 1 + + + + + false + 2 + true + D2 + 39 + + D2 + 986198527 + true + ClassicPeriodicDiscrete0.00050 + 2 + + .0005 + + 2 + + + + + + + + + sltpEvents + + + sltpTaskGroups + + + + + + Cont + + + VFControl::defaultTimer + _task0 + + + + D2 + + + VFControl::defaultTimer + _task1 + + + sltpTasks + + + + + \ No newline at end of file diff --git a/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/binfo.mat b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/binfo.mat new file mode 100644 index 0000000..ce64b50 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/binfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/minfo.mat b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/minfo.mat new file mode 100644 index 0000000..670aee3 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/VFControl/tmwinternal/minfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/buildInfo.mat b/Control/VF Control/slprj/speedgoat/_sharedutils/buildInfo.mat new file mode 100644 index 0000000..b93f6a7 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/buildInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/checksummap.mat b/Control/VF Control/slprj/speedgoat/_sharedutils/checksummap.mat new file mode 100644 index 0000000..a9d052e Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/checksummap.mat differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/compileInfo.mat b/Control/VF Control/slprj/speedgoat/_sharedutils/compileInfo.mat new file mode 100644 index 0000000..03f7d86 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/compileInfo.mat differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.cpp new file mode 100644 index 0000000..0ad4a38 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.cpp @@ -0,0 +1,81 @@ +/* + * look1_pbinlxpw.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#include "look1_pbinlxpw.h" +#include "rtwtypes.h" + +real_T look1_pbinlxpw(real_T u0, const real_T bp0[], const real_T table[], + uint32_T prevIndex[], uint32_T maxIndex) +{ + real_T frac; + real_T yL_0d0; + uint32_T bpIdx; + + /* Column-major Lookup 1-D + Search method: 'binary' + Use previous index: 'on' + Interpolation method: 'Linear point-slope' + Extrapolation method: 'Linear' + Use last breakpoint for index at or above upper limit: 'off' + Remove protection against out-of-range input in generated code: 'off' + */ + /* Prelookup - Index and Fraction + Index Search method: 'binary' + Extrapolation method: 'Linear' + Use previous index: 'on' + Use last breakpoint for index at or above upper limit: 'off' + Remove protection against out-of-range input in generated code: 'off' + */ + if (u0 <= bp0[0U]) { + bpIdx = 0U; + frac = (u0 - bp0[0U]) / (bp0[1U] - bp0[0U]); + } else if (u0 < bp0[maxIndex]) { + uint32_T found; + uint32_T iLeft; + uint32_T iRght; + + /* Binary Search using Previous Index */ + bpIdx = prevIndex[0U]; + iLeft = 0U; + iRght = maxIndex; + found = 0U; + while (found == 0U) { + if (u0 < bp0[bpIdx]) { + iRght = bpIdx - 1U; + bpIdx = ((bpIdx + iLeft) - 1U) >> 1U; + } else if (u0 < bp0[bpIdx + 1U]) { + found = 1U; + } else { + iLeft = bpIdx + 1U; + bpIdx = ((bpIdx + iRght) + 1U) >> 1U; + } + } + + frac = (u0 - bp0[bpIdx]) / (bp0[bpIdx + 1U] - bp0[bpIdx]); + } else { + bpIdx = maxIndex - 1U; + frac = (u0 - bp0[maxIndex - 1U]) / (bp0[maxIndex] - bp0[maxIndex - 1U]); + } + + prevIndex[0U] = bpIdx; + + /* Column-major Interpolation 1-D + Interpolation method: 'Linear point-slope' + Use last breakpoint for index at or above upper limit: 'off' + Overflow mode: 'portable wrapping' + */ + yL_0d0 = table[bpIdx]; + return (table[bpIdx + 1U] - yL_0d0) * frac + yL_0d0; +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.h b/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.h new file mode 100644 index 0000000..da36d75 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.h @@ -0,0 +1,23 @@ +/* + * look1_pbinlxpw.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#ifndef look1_pbinlxpw_h_ +#define look1_pbinlxpw_h_ +#include "rtwtypes.h" + +extern real_T look1_pbinlxpw(real_T u0, const real_T bp0[], const real_T table[], + uint32_T prevIndex[], uint32_T maxIndex); + +#endif /* look1_pbinlxpw_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.o b/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.o new file mode 100644 index 0000000..9e9aeca Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/look1_pbinlxpw.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/multiword_types.h b/Control/VF Control/slprj/speedgoat/_sharedutils/multiword_types.h new file mode 100644 index 0000000..6392819 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/multiword_types.h @@ -0,0 +1,591 @@ +/* + * multiword_types.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#ifndef MULTIWORD_TYPES_H +#define MULTIWORD_TYPES_H +#include "rtwtypes.h" + +/* + * Definitions supporting external data access + */ +typedef int64_T chunk_T; +typedef uint64_T uchunk_T; + +/* + * MultiWord supporting definitions + */ +typedef long long longlong_T; + +/* + * MultiWord types + */ +typedef struct { + uint64_T chunks[2]; +} int128m_T; + +typedef struct { + int128m_T re; + int128m_T im; +} cint128m_T; + +typedef struct { + uint64_T chunks[2]; +} uint128m_T; + +typedef struct { + uint128m_T re; + uint128m_T im; +} cuint128m_T; + +typedef struct { + uint64_T chunks[3]; +} int192m_T; + +typedef struct { + int192m_T re; + int192m_T im; +} cint192m_T; + +typedef struct { + uint64_T chunks[3]; +} uint192m_T; + +typedef struct { + uint192m_T re; + uint192m_T im; +} cuint192m_T; + +typedef struct { + uint64_T chunks[4]; +} int256m_T; + +typedef struct { + int256m_T re; + int256m_T im; +} cint256m_T; + +typedef struct { + uint64_T chunks[4]; +} uint256m_T; + +typedef struct { + uint256m_T re; + uint256m_T im; +} cuint256m_T; + +typedef struct { + uint64_T chunks[5]; +} int320m_T; + +typedef struct { + int320m_T re; + int320m_T im; +} cint320m_T; + +typedef struct { + uint64_T chunks[5]; +} uint320m_T; + +typedef struct { + uint320m_T re; + uint320m_T im; +} cuint320m_T; + +typedef struct { + uint64_T chunks[6]; +} int384m_T; + +typedef struct { + int384m_T re; + int384m_T im; +} cint384m_T; + +typedef struct { + uint64_T chunks[6]; +} uint384m_T; + +typedef struct { + uint384m_T re; + uint384m_T im; +} cuint384m_T; + +typedef struct { + uint64_T chunks[7]; +} int448m_T; + +typedef struct { + int448m_T re; + int448m_T im; +} cint448m_T; + +typedef struct { + uint64_T chunks[7]; +} uint448m_T; + +typedef struct { + uint448m_T re; + uint448m_T im; +} cuint448m_T; + +typedef struct { + uint64_T chunks[8]; +} int512m_T; + +typedef struct { + int512m_T re; + int512m_T im; +} cint512m_T; + +typedef struct { + uint64_T chunks[8]; +} uint512m_T; + +typedef struct { + uint512m_T re; + uint512m_T im; +} cuint512m_T; + +typedef struct { + uint64_T chunks[9]; +} int576m_T; + +typedef struct { + int576m_T re; + int576m_T im; +} cint576m_T; + +typedef struct { + uint64_T chunks[9]; +} uint576m_T; + +typedef struct { + uint576m_T re; + uint576m_T im; +} cuint576m_T; + +typedef struct { + uint64_T chunks[10]; +} int640m_T; + +typedef struct { + int640m_T re; + int640m_T im; +} cint640m_T; + +typedef struct { + uint64_T chunks[10]; +} uint640m_T; + +typedef struct { + uint640m_T re; + uint640m_T im; +} cuint640m_T; + +typedef struct { + uint64_T chunks[11]; +} int704m_T; + +typedef struct { + int704m_T re; + int704m_T im; +} cint704m_T; + +typedef struct { + uint64_T chunks[11]; +} uint704m_T; + +typedef struct { + uint704m_T re; + uint704m_T im; +} cuint704m_T; + +typedef struct { + uint64_T chunks[12]; +} int768m_T; + +typedef struct { + int768m_T re; + int768m_T im; +} cint768m_T; + +typedef struct { + uint64_T chunks[12]; +} uint768m_T; + +typedef struct { + uint768m_T re; + uint768m_T im; +} cuint768m_T; + +typedef struct { + uint64_T chunks[13]; +} int832m_T; + +typedef struct { + int832m_T re; + int832m_T im; +} cint832m_T; + +typedef struct { + uint64_T chunks[13]; +} uint832m_T; + +typedef struct { + uint832m_T re; + uint832m_T im; +} cuint832m_T; + +typedef struct { + uint64_T chunks[14]; +} int896m_T; + +typedef struct { + int896m_T re; + int896m_T im; +} cint896m_T; + +typedef struct { + uint64_T chunks[14]; +} uint896m_T; + +typedef struct { + uint896m_T re; + uint896m_T im; +} cuint896m_T; + +typedef struct { + uint64_T chunks[15]; +} int960m_T; + +typedef struct { + int960m_T re; + int960m_T im; +} cint960m_T; + +typedef struct { + uint64_T chunks[15]; +} uint960m_T; + +typedef struct { + uint960m_T re; + uint960m_T im; +} cuint960m_T; + +typedef struct { + uint64_T chunks[16]; +} int1024m_T; + +typedef struct { + int1024m_T re; + int1024m_T im; +} cint1024m_T; + +typedef struct { + uint64_T chunks[16]; +} uint1024m_T; + +typedef struct { + uint1024m_T re; + uint1024m_T im; +} cuint1024m_T; + +typedef struct { + uint64_T chunks[17]; +} int1088m_T; + +typedef struct { + int1088m_T re; + int1088m_T im; +} cint1088m_T; + +typedef struct { + uint64_T chunks[17]; +} uint1088m_T; + +typedef struct { + uint1088m_T re; + uint1088m_T im; +} cuint1088m_T; + +typedef struct { + uint64_T chunks[18]; +} int1152m_T; + +typedef struct { + int1152m_T re; + int1152m_T im; +} cint1152m_T; + +typedef struct { + uint64_T chunks[18]; +} uint1152m_T; + +typedef struct { + uint1152m_T re; + uint1152m_T im; +} cuint1152m_T; + +typedef struct { + uint64_T chunks[19]; +} int1216m_T; + +typedef struct { + int1216m_T re; + int1216m_T im; +} cint1216m_T; + +typedef struct { + uint64_T chunks[19]; +} uint1216m_T; + +typedef struct { + uint1216m_T re; + uint1216m_T im; +} cuint1216m_T; + +typedef struct { + uint64_T chunks[20]; +} int1280m_T; + +typedef struct { + int1280m_T re; + int1280m_T im; +} cint1280m_T; + +typedef struct { + uint64_T chunks[20]; +} uint1280m_T; + +typedef struct { + uint1280m_T re; + uint1280m_T im; +} cuint1280m_T; + +typedef struct { + uint64_T chunks[21]; +} int1344m_T; + +typedef struct { + int1344m_T re; + int1344m_T im; +} cint1344m_T; + +typedef struct { + uint64_T chunks[21]; +} uint1344m_T; + +typedef struct { + uint1344m_T re; + uint1344m_T im; +} cuint1344m_T; + +typedef struct { + uint64_T chunks[22]; +} int1408m_T; + +typedef struct { + int1408m_T re; + int1408m_T im; +} cint1408m_T; + +typedef struct { + uint64_T chunks[22]; +} uint1408m_T; + +typedef struct { + uint1408m_T re; + uint1408m_T im; +} cuint1408m_T; + +typedef struct { + uint64_T chunks[23]; +} int1472m_T; + +typedef struct { + int1472m_T re; + int1472m_T im; +} cint1472m_T; + +typedef struct { + uint64_T chunks[23]; +} uint1472m_T; + +typedef struct { + uint1472m_T re; + uint1472m_T im; +} cuint1472m_T; + +typedef struct { + uint64_T chunks[24]; +} int1536m_T; + +typedef struct { + int1536m_T re; + int1536m_T im; +} cint1536m_T; + +typedef struct { + uint64_T chunks[24]; +} uint1536m_T; + +typedef struct { + uint1536m_T re; + uint1536m_T im; +} cuint1536m_T; + +typedef struct { + uint64_T chunks[25]; +} int1600m_T; + +typedef struct { + int1600m_T re; + int1600m_T im; +} cint1600m_T; + +typedef struct { + uint64_T chunks[25]; +} uint1600m_T; + +typedef struct { + uint1600m_T re; + uint1600m_T im; +} cuint1600m_T; + +typedef struct { + uint64_T chunks[26]; +} int1664m_T; + +typedef struct { + int1664m_T re; + int1664m_T im; +} cint1664m_T; + +typedef struct { + uint64_T chunks[26]; +} uint1664m_T; + +typedef struct { + uint1664m_T re; + uint1664m_T im; +} cuint1664m_T; + +typedef struct { + uint64_T chunks[27]; +} int1728m_T; + +typedef struct { + int1728m_T re; + int1728m_T im; +} cint1728m_T; + +typedef struct { + uint64_T chunks[27]; +} uint1728m_T; + +typedef struct { + uint1728m_T re; + uint1728m_T im; +} cuint1728m_T; + +typedef struct { + uint64_T chunks[28]; +} int1792m_T; + +typedef struct { + int1792m_T re; + int1792m_T im; +} cint1792m_T; + +typedef struct { + uint64_T chunks[28]; +} uint1792m_T; + +typedef struct { + uint1792m_T re; + uint1792m_T im; +} cuint1792m_T; + +typedef struct { + uint64_T chunks[29]; +} int1856m_T; + +typedef struct { + int1856m_T re; + int1856m_T im; +} cint1856m_T; + +typedef struct { + uint64_T chunks[29]; +} uint1856m_T; + +typedef struct { + uint1856m_T re; + uint1856m_T im; +} cuint1856m_T; + +typedef struct { + uint64_T chunks[30]; +} int1920m_T; + +typedef struct { + int1920m_T re; + int1920m_T im; +} cint1920m_T; + +typedef struct { + uint64_T chunks[30]; +} uint1920m_T; + +typedef struct { + uint1920m_T re; + uint1920m_T im; +} cuint1920m_T; + +typedef struct { + uint64_T chunks[31]; +} int1984m_T; + +typedef struct { + int1984m_T re; + int1984m_T im; +} cint1984m_T; + +typedef struct { + uint64_T chunks[31]; +} uint1984m_T; + +typedef struct { + uint1984m_T re; + uint1984m_T im; +} cuint1984m_T; + +typedef struct { + uint64_T chunks[32]; +} int2048m_T; + +typedef struct { + int2048m_T re; + int2048m_T im; +} cint2048m_T; + +typedef struct { + uint64_T chunks[32]; +} uint2048m_T; + +typedef struct { + uint2048m_T re; + uint2048m_T im; +} cuint2048m_T; + +#endif /* MULTIWORD_TYPES_H */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.cpp new file mode 100644 index 0000000..abc2afa --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.cpp @@ -0,0 +1,154 @@ +/* + * rtGetInf.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#include "rtwtypes.h" + +extern "C" +{ + +#include "rtGetInf.h" + +} + +#include + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +#define NumBitsPerChar 8U + +extern "C" +{ + /* + * Initialize rtInf needed by the generated code. + * Inf is initialized as non-signaling. Assumes IEEE. + */ + real_T rtGetInf(void) + { + size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar); + real_T inf = 0.0; + if (bitsPerReal == 32U) { + inf = rtGetInfF(); + } else { + uint16_T one = 1U; + enum { + LittleEndian, + BigEndian + } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian; + switch (machByteOrder) { + case LittleEndian: + { + union { + LittleEndianIEEEDouble bitVal; + real_T fltVal; + } tmpVal; + + tmpVal.bitVal.words.wordH = 0x7FF00000U; + tmpVal.bitVal.words.wordL = 0x00000000U; + inf = tmpVal.fltVal; + break; + } + + case BigEndian: + { + union { + BigEndianIEEEDouble bitVal; + real_T fltVal; + } tmpVal; + + tmpVal.bitVal.words.wordH = 0x7FF00000U; + tmpVal.bitVal.words.wordL = 0x00000000U; + inf = tmpVal.fltVal; + break; + } + } + } + + return inf; + } + + /* + * Initialize rtInfF needed by the generated code. + * Inf is initialized as non-signaling. Assumes IEEE. + */ + real32_T rtGetInfF(void) + { + IEEESingle infF; + infF.wordL.wordLuint = 0x7F800000U; + return infF.wordL.wordLreal; + } + + /* + * Initialize rtMinusInf needed by the generated code. + * Inf is initialized as non-signaling. Assumes IEEE. + */ + real_T rtGetMinusInf(void) + { + size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar); + real_T minf = 0.0; + if (bitsPerReal == 32U) { + minf = rtGetMinusInfF(); + } else { + uint16_T one = 1U; + enum { + LittleEndian, + BigEndian + } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian; + switch (machByteOrder) { + case LittleEndian: + { + union { + LittleEndianIEEEDouble bitVal; + real_T fltVal; + } tmpVal; + + tmpVal.bitVal.words.wordH = 0xFFF00000U; + tmpVal.bitVal.words.wordL = 0x00000000U; + minf = tmpVal.fltVal; + break; + } + + case BigEndian: + { + union { + BigEndianIEEEDouble bitVal; + real_T fltVal; + } tmpVal; + + tmpVal.bitVal.words.wordH = 0xFFF00000U; + tmpVal.bitVal.words.wordL = 0x00000000U; + minf = tmpVal.fltVal; + break; + } + } + } + + return minf; + } + + /* + * Initialize rtMinusInfF needed by the generated code. + * Inf is initialized as non-signaling. Assumes IEEE. + */ + real32_T rtGetMinusInfF(void) + { + IEEESingle minfF; + minfF.wordL.wordLuint = 0xFF800000U; + return minfF.wordL.wordLreal; + } +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.h new file mode 100644 index 0000000..777a91a --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.h @@ -0,0 +1,43 @@ +/* + * rtGetInf.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#ifndef rtGetInf_h_ +#define rtGetInf_h_ + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +#include "rtwtypes.h" +#ifdef __cplusplus + +extern "C" +{ + +#endif + + extern real_T rtGetInf(void); + extern real32_T rtGetInfF(void); + extern real_T rtGetMinusInf(void); + extern real32_T rtGetMinusInfF(void); + +#ifdef __cplusplus + +} /* extern "C" */ + +#endif +#endif /* rtGetInf_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.o new file mode 100644 index 0000000..b4fa1e2 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetInf.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.cpp new file mode 100644 index 0000000..4a16a36 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.cpp @@ -0,0 +1,114 @@ +/* + * rtGetNaN.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#include "rtwtypes.h" + +extern "C" +{ + +#include "rtGetNaN.h" + +} + +#include + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +#define NumBitsPerChar 8U + +extern "C" +{ + /* + * Initialize rtNaN needed by the generated code. + * NaN is initialized as non-signaling. Assumes IEEE. + */ + real_T rtGetNaN(void) + { + size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar); + real_T nan = 0.0; + if (bitsPerReal == 32U) { + nan = rtGetNaNF(); + } else { + uint16_T one = 1U; + enum { + LittleEndian, + BigEndian + } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian; + switch (machByteOrder) { + case LittleEndian: + { + union { + LittleEndianIEEEDouble bitVal; + real_T fltVal; + } tmpVal; + + tmpVal.bitVal.words.wordH = 0xFFF80000U; + tmpVal.bitVal.words.wordL = 0x00000000U; + nan = tmpVal.fltVal; + break; + } + + case BigEndian: + { + union { + BigEndianIEEEDouble bitVal; + real_T fltVal; + } tmpVal; + + tmpVal.bitVal.words.wordH = 0x7FFFFFFFU; + tmpVal.bitVal.words.wordL = 0xFFFFFFFFU; + nan = tmpVal.fltVal; + break; + } + } + } + + return nan; + } + + /* + * Initialize rtNaNF needed by the generated code. + * NaN is initialized as non-signaling. Assumes IEEE. + */ + real32_T rtGetNaNF(void) + { + IEEESingle nanF = { { 0.0F } }; + + uint16_T one = 1U; + enum { + LittleEndian, + BigEndian + } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian; + switch (machByteOrder) { + case LittleEndian: + { + nanF.wordL.wordLuint = 0xFFC00000U; + break; + } + + case BigEndian: + { + nanF.wordL.wordLuint = 0x7FFFFFFFU; + break; + } + } + + return nanF.wordL.wordLreal; + } +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.h new file mode 100644 index 0000000..b41cdef --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.h @@ -0,0 +1,41 @@ +/* + * rtGetNaN.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#ifndef rtGetNaN_h_ +#define rtGetNaN_h_ + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +#include "rtwtypes.h" +#ifdef __cplusplus + +extern "C" +{ + +#endif + + extern real_T rtGetNaN(void); + extern real32_T rtGetNaNF(void); + +#ifdef __cplusplus + +} /* extern "C" */ + +#endif +#endif /* rtGetNaN_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.o new file mode 100644 index 0000000..b6d79c2 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rtGetNaN.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.cpp new file mode 100644 index 0000000..9965d63 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.cpp @@ -0,0 +1,202 @@ +/* + * rt_TDelayInterpolate.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:32:21 2024 + * Created for block: /Transport Delay + */ + +#include "rt_TDelayInterpolate.h" +#include +#include +#include "rtwtypes.h" + +/* + * Time delay interpolation routine + * + * The linear interpolation is performed using the formula: + * + * (t2 - tMinusDelay) (tMinusDelay - t1) + * u(t) = ----------------- * u1 + ------------------- * u2 + * (t2 - t1) (t2 - t1) + */ +real_T rt_TDelayInterpolate( + real_T tMinusDelay, /* tMinusDelay = currentSimTime - delay */ + real_T tStart, + real_T *uBuf, + int_T bufSz, + int_T *lastIdx, + int_T oldestIdx, + int_T newIdx, + real_T initOutput, + boolean_T discrete, + boolean_T minorStepAndTAtLastMajorOutput) +{ + int_T i; + real_T yout, t1, t2, u1, u2; + real_T* tBuf = uBuf + bufSz; + + /* + * If there is only one data point in the buffer, this data point must be + * the t= 0 and tMinusDelay > t0, it ask for something unknown. The best + * guess if initial output as well + */ + if ((newIdx == 0) && (oldestIdx ==0 ) && (tMinusDelay > tStart)) + return initOutput; + + /* + * If tMinusDelay is less than zero, should output initial value + */ + if (tMinusDelay <= tStart) + return initOutput; + + /* For fixed buffer extrapolation: + * if tMinusDelay is small than the time at oldestIdx, if discrete, output + * tailptr value, else use tailptr and tailptr+1 value to extrapolate + * It is also for fixed buffer. Note: The same condition can happen for transport delay block where + * use tStart and and t[tail] other than using t[tail] and t[tail+1]. + * See below + */ + if ((tMinusDelay <= tBuf[oldestIdx] ) ) { + if (discrete) { + return(uBuf[oldestIdx]); + } else { + int_T tempIdx= oldestIdx + 1; + if (oldestIdx == bufSz-1) + tempIdx = 0; + t1= tBuf[oldestIdx]; + t2= tBuf[tempIdx]; + u1= uBuf[oldestIdx]; + u2= uBuf[tempIdx]; + if (t2 == t1) { + if (tMinusDelay >= t2) { + yout = u2; + } else { + yout = u1; + } + } else { + real_T f1 = (t2-tMinusDelay) / (t2-t1); + real_T f2 = 1.0 - f1; + + /* + * Use Lagrange's interpolation formula. Exact outputs at t1, t2. + */ + yout = f1*u1 + f2*u2; + } + + return yout; + } + } + + /* + * When block does not have direct feedthrough, we use the table of + * values to extrapolate off the end of the table for delays that are less + * than 0 (less then step size). This is not completely accurate. The + * chain of events is as follows for a given time t. Major output - look + * in table. Update - add entry to table. Now, if we call the output at + * time t again, there is a new entry in the table. For very small delays, + * this means that we will have a different answer from the previous call + * to the output fcn at the same time t. The following code prevents this + * from happening. + */ + if (minorStepAndTAtLastMajorOutput) { + /* pretend that the new entry has not been added to table */ + if (newIdx != 0) { + if (*lastIdx == newIdx) { + (*lastIdx)--; + } + + newIdx--; + } else { + if (*lastIdx == newIdx) { + *lastIdx = bufSz-1; + } + + newIdx = bufSz - 1; + } + } + + i = *lastIdx; + if (tBuf[i] < tMinusDelay) { + /* Look forward starting at last index */ + while (tBuf[i] < tMinusDelay) { + /* May occur if the delay is less than step-size - extrapolate */ + if (i == newIdx) + break; + i = ( i < (bufSz-1) ) ? (i+1) : 0;/* move through buffer */ + } + } else { + /* + * Look backwards starting at last index which can happen when the + * delay time increases. + */ + while (tBuf[i] >= tMinusDelay) { + /* + * Due to the entry condition at top of function, we + * should never hit the end. + */ + i = (i > 0) ? i-1 : (bufSz-1); /* move through buffer */ + } + + i = ( i < (bufSz-1) ) ? (i+1) : 0; + } + + *lastIdx = i; + if (discrete) { + /* + * tempEps = 128 * eps; + * localEps = max(tempEps, tempEps*fabs(tBuf[i]))/2; + */ + double tempEps = (DBL_EPSILON) * 128.0; + double localEps = tempEps * std::abs(tBuf[i]); + if (tempEps > localEps) { + localEps = tempEps; + } + + localEps = localEps / 2.0; + if (tMinusDelay >= (tBuf[i] - localEps)) { + yout = uBuf[i]; + } else { + if (i == 0) { + yout = uBuf[bufSz-1]; + } else { + yout = uBuf[i-1]; + } + } + } else { + if (i == 0) { + t1 = tBuf[bufSz-1]; + u1 = uBuf[bufSz-1]; + } else { + t1 = tBuf[i-1]; + u1 = uBuf[i-1]; + } + + t2 = tBuf[i]; + u2 = uBuf[i]; + if (t2 == t1) { + if (tMinusDelay >= t2) { + yout = u2; + } else { + yout = u1; + } + } else { + real_T f1 = (t2-tMinusDelay) / (t2-t1); + real_T f2 = 1.0 - f1; + + /* + * Use Lagrange's interpolation formula. Exact outputs at t1, t2. + */ + yout = f1*u1 + f2*u2; + } + } + + return(yout); +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.h new file mode 100644 index 0000000..56e6a4d --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.h @@ -0,0 +1,33 @@ +/* + * rt_TDelayInterpolate.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 11:32:21 2024 + * Created for block: /Transport Delay + */ + +#ifndef rt_TDelayInterpolate_h_ +#define rt_TDelayInterpolate_h_ +#include "rtwtypes.h" + +real_T rt_TDelayInterpolate( + real_T tMinusDelay, /* tMinusDelay = currentSimTime - delay */ + real_T tStart, + real_T *uBuf, + int_T bufSz, + int_T *lastIdx, + int_T oldestIdx, + int_T newIdx, + real_T initOutput, + boolean_T discrete, + boolean_T minorStepAndTAtLastMajorOutput) + ; + +#endif /* rt_TDelayInterpolate_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.o new file mode 100644 index 0000000..88a065e Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.cpp new file mode 100644 index 0000000..edf472a --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.cpp @@ -0,0 +1,47 @@ +/* + * rt_hypotd_snf.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#include "rtwtypes.h" +#include "rt_hypotd_snf.h" +#include + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +real_T rt_hypotd_snf(real_T u0, real_T u1) +{ + real_T a; + real_T b; + real_T y; + a = std::abs(u0); + b = std::abs(u1); + if (a < b) { + a /= b; + y = std::sqrt(a * a + 1.0) * b; + } else if (a > b) { + b /= a; + y = std::sqrt(b * b + 1.0) * a; + } else if (rtIsNaN(b)) { + y = (rtNaN); + } else { + y = a * 1.4142135623730951; + } + + return y; +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.h new file mode 100644 index 0000000..691976a --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.h @@ -0,0 +1,22 @@ +/* + * rt_hypotd_snf.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#ifndef rt_hypotd_snf_h_ +#define rt_hypotd_snf_h_ +#include "rtwtypes.h" + +extern real_T rt_hypotd_snf(real_T u0, real_T u1); + +#endif /* rt_hypotd_snf_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.o new file mode 100644 index 0000000..57b1753 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_hypotd_snf.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.cpp new file mode 100644 index 0000000..1dfc24c --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.cpp @@ -0,0 +1,187 @@ +/* + * rt_invd4x4_snf.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#include "rtwtypes.h" +#include "rt_invd4x4_snf.h" +#include + +void rt_invd4x4_snf(const real_T u[16], real_T y[16]) +{ + real_T A[16]; + real_T x; + int32_T Aoffset; + int32_T ipk; + int32_T ix; + int32_T jm1; + int32_T jpiv_offset; + int32_T mmj; + int32_T pipk; + int8_T ipiv[4]; + int8_T p[4]; + for (Aoffset = 0; Aoffset < 16; Aoffset++) { + A[Aoffset] = u[Aoffset]; + y[Aoffset] = 0.0; + } + + ipiv[0] = 1; + ipiv[1] = 2; + ipiv[2] = 3; + for (ipk = 0; ipk < 3; ipk++) { + real_T s; + real_T smax; + int32_T ONE; + int32_T jj; + int32_T jp1j; + pipk = ipk + 1; + jm1 = pipk - 1; + mmj = 4 - pipk; + Aoffset = jm1 * 5; + ONE = 1; + jj = Aoffset + 1; + jp1j = jj + 1; + Aoffset = mmj + 1; + ix = jj - 1; + x = A[jj - 1]; + s = std::abs(x); + smax = s; + for (jpiv_offset = 2; jpiv_offset <= Aoffset; jpiv_offset++) { + ix++; + x = A[ix]; + s = std::abs(x); + if (s > smax) { + ONE = jpiv_offset; + smax = s; + } + } + + jpiv_offset = ONE - 1; + ONE = (jj + jpiv_offset) - 1; + if (A[ONE] != 0.0) { + if (jpiv_offset != 0) { + Aoffset = pipk + jpiv_offset; + ipiv[pipk - 1] = static_cast(Aoffset); + ONE = jm1 + jpiv_offset; + s = A[jm1]; + A[jm1] = A[ONE]; + A[ONE] = s; + jm1 += 4; + ONE += 4; + s = A[jm1]; + A[jm1] = A[ONE]; + A[ONE] = s; + jm1 += 4; + ONE += 4; + s = A[jm1]; + A[jm1] = A[ONE]; + A[ONE] = s; + jm1 += 4; + ONE += 4; + s = A[jm1]; + A[jm1] = A[ONE]; + A[ONE] = s; + } + + Aoffset = mmj - 1; + jm1 = jp1j + Aoffset; + for (int32_T b = jp1j; b <= jm1; b++) { + x = A[b - 1]; + s = A[jj - 1]; + smax = x / s; + A[b - 1] = smax; + } + } + + Aoffset = 3 - pipk; + jpiv_offset = jj + 3; + pipk = jj + 5; + ONE = pipk - 1; + for (pipk = 0; pipk <= Aoffset; pipk++) { + s = A[jpiv_offset]; + if (s != 0.0) { + s = -s; + ix = jp1j - 1; + jm1 = ONE + 1; + jj = mmj + ONE; + for (int32_T b = jm1; b <= jj; b++) { + A[b - 1] += A[ix] * s; + ix++; + } + } + + jpiv_offset += 4; + ONE += 4; + } + } + + p[0] = 1; + p[1] = 2; + p[2] = 3; + p[3] = 4; + ipk = ipiv[0] - 1; + if (ipk + 1 > 1) { + pipk = p[ipk]; + p[ipk] = 1; + p[0] = static_cast(pipk); + } + + ipk = ipiv[1] - 1; + if (ipk + 1 > 2) { + pipk = p[ipk]; + p[ipk] = p[1]; + p[1] = static_cast(pipk); + } + + ipk = ipiv[2] - 1; + if (ipk + 1 > 3) { + pipk = p[ipk]; + p[ipk] = p[2]; + p[2] = static_cast(pipk); + } + + for (jpiv_offset = 0; jpiv_offset < 4; jpiv_offset++) { + pipk = jpiv_offset; + Aoffset = p[pipk] - 1; + mmj = Aoffset << 2; + y[pipk + mmj] = 1.0; + for (ipk = pipk + 1; ipk < 5; ipk++) { + Aoffset = (mmj + ipk) - 1; + if (y[Aoffset] != 0.0) { + jm1 = ipk + 1; + for (int32_T b = jm1; b < 5; b++) { + ix = (mmj + b) - 1; + y[ix] -= A[(((ipk - 1) << 2) + b) - 1] * y[Aoffset]; + } + } + } + } + + for (ipk = 0; ipk < 4; ipk++) { + pipk = ipk; + pipk <<= 2; + for (jpiv_offset = 3; jpiv_offset >= 0; jpiv_offset--) { + ix = jpiv_offset << 2; + Aoffset = jpiv_offset + pipk; + x = y[Aoffset]; + if (x != 0.0) { + y[Aoffset] = x / A[jpiv_offset + ix]; + jm1 = jpiv_offset - 1; + for (int32_T b = 0; b <= jm1; b++) { + mmj = b + pipk; + y[mmj] -= A[b + ix] * y[Aoffset]; + } + } + } + } +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.h new file mode 100644 index 0000000..7da712f --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.h @@ -0,0 +1,22 @@ +/* + * rt_invd4x4_snf.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#ifndef rt_invd4x4_snf_h_ +#define rt_invd4x4_snf_h_ +#include "rtwtypes.h" + +extern void rt_invd4x4_snf(const real_T u[16], real_T y[16]); + +#endif /* rt_invd4x4_snf_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.o new file mode 100644 index 0000000..aae2758 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.cpp new file mode 100644 index 0000000..889a460 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.cpp @@ -0,0 +1,142 @@ +/* + * rt_look.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#include "rtwtypes.h" +#include "rt_look.h" +#ifdef __cplusplus + +extern "C" +{ + +#endif + + /* + * Routine to get the index of the input from a table using binary or + * interpolation search. + * + * Inputs: + * *x : Pointer to table, x[0] ....x[xlen-1] + * xlen : Number of values in xtable + * u : input value to look up + * + * Output: + * idx : the index into the table such that: + * if u is negative + * x[idx] <= u < x[idx+1] + * else + * x[idx] < u <= x[idx+1] + * + * Interpolation Search: If the table contains a large number of nearly + * uniformly spaced entries, i.e., x[n] vs n is linear then the index + * corresponding to the input can be found in one shot using the linear + * interpolation formula. Therefore if you have a look-up table block with + * many data points, using interpolation search might speed up the code. + * Compile the generated code with the following flag: + * + * make_rtw OPTS=-DDOINTERPSEARCH + * + * to enable interpolation search. + */ + int_T rt_GetLookupIndex(const real_T *x, int_T xlen, real_T u) + { + int_T idx = 0; + int_T bottom = 0; + int_T top = xlen-1; + int_T retValue = 0; + boolean_T returnStatus = 0U; + +#ifdef DOINTERPSEARCH + + real_T offset = 0; + +#endif + + /* + * Deal with the extreme cases first: + * if u <= x[bottom] then return idx = bottom + * if u >= x[top] then return idx = top-1 + */ + if (u <= x[bottom]) { + retValue = bottom; + returnStatus = 1U; + } else if (u >= x[top]) { + retValue = top-1; + returnStatus = 1U; + } else { + /* else required to ensure safe programming, even * + * if it's expected that it will never be reached */ + } + + if (returnStatus == 0U) { + if (u < 0) { + /* For negative input find index such that: x[idx] <= u < x[idx+1] */ + for (;;) { + +#ifdef DOINTERPSEARCH + + offset = (u-x[bottom])/(x[top]-x[bottom]); + idx = bottom + (int_T)((top-bottom)*(offset-DBL_EPSILON)); + +#else + + idx = (bottom + top)/2; + +#endif + + if (u < x[idx]) { + top = idx - 1; + } else if (u >= x[idx+1]) { + bottom = idx + 1; + } else { + /* we have x[idx] <= u < x[idx+1], return idx */ + retValue = idx; + break; + } + } + } else { + /* For non-negative input find index such that: x[idx] < u <= x[idx+1] */ + for (;;) { + +#ifdef DOINTERPSEARCH + + offset = (u-x[bottom])/(x[top]-x[bottom]); + idx = bottom + (int_T)((top-bottom)*(offset-DBL_EPSILON)); + +#else + + idx = (bottom + top)/2; + +#endif + + if (u <= x[idx]) { + top = idx - 1; + } else if (u > x[idx+1]) { + bottom = idx + 1; + } else { + /* we have x[idx] < u <= x[idx+1], return idx */ + retValue = idx; + break; + } + } + } + } + + return retValue; + } + +#ifdef __cplusplus + +} /* extern "C" */ + +#endif diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.h new file mode 100644 index 0000000..8a4b564 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.h @@ -0,0 +1,51 @@ +/* + * rt_look.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#ifndef rt_look_h_ +#define rt_look_h_ +#include "rtwtypes.h" +#ifdef DOINTERPSEARCH +#include +#endif + +#ifdef __cplusplus + +extern "C" +{ + +#endif + +#ifndef INTERP +#define INTERP(x,x1,x2,y1,y2) ( (y1)+(((y2) - (y1))/((x2) - (x1)))*((x)-(x1)) ) +#endif + +#ifndef ZEROTECHNIQUE +#define ZEROTECHNIQUE + + typedef enum { + NORMAL_INTERP, + AVERAGE_VALUE, + MIDDLE_VALUE + } ZeroTechnique; + +#endif + + extern int_T rt_GetLookupIndex(const real_T *x, int_T xlen, real_T u) ; + +#ifdef __cplusplus + +} /* extern "C" */ + +#endif +#endif /* rt_look_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.o new file mode 100644 index 0000000..08c9ca1 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.cpp new file mode 100644 index 0000000..0cd85ac --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.cpp @@ -0,0 +1,43 @@ +/* + * rt_look1d.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#include "rt_look.h" +#include "rtwtypes.h" +#include "rt_look1d.h" +#ifdef __cplusplus + +extern "C" +{ + +#endif + + /* 1D lookup routine for data type of real_T. */ + real_T rt_Lookup(const real_T *x, int_T xlen, real_T u, const real_T *y) + { + int_T idx = rt_GetLookupIndex(x, xlen, u); + real_T num = y[idx+1] - y[idx]; + real_T den = x[idx+1] - x[idx]; + + /* Due to the way the binary search is implemented + in rt_look.c (rt_GetLookupIndex), den cannot be + 0. Equivalently, m cannot be inf or nan. */ + real_T m = num/den; + return (y[idx] + (m * (u - x[idx]))); + } + +#ifdef __cplusplus + +} /* extern "C" */ + +#endif diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.h new file mode 100644 index 0000000..7998b3e --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.h @@ -0,0 +1,32 @@ +/* + * rt_look1d.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#ifndef rt_look1d_h_ +#define rt_look1d_h_ +#include "rtwtypes.h" +#ifdef __cplusplus + +extern "C" +{ + +#endif + + extern real_T rt_Lookup(const real_T *x, int_T xlen, real_T u, const real_T *y); + +#ifdef __cplusplus + +} /* extern "C" */ + +#endif +#endif /* rt_look1d_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.o new file mode 100644 index 0000000..c0456e5 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_look1d.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.cpp new file mode 100644 index 0000000..8707446 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.cpp @@ -0,0 +1,63 @@ +/* + * rt_modd_snf.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#include "rtwtypes.h" +#include "rt_modd_snf.h" + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +#include +#include + +real_T rt_modd_snf(real_T u0, real_T u1) +{ + real_T y; + y = u0; + if (u1 == 0.0) { + if (u0 == 0.0) { + y = u1; + } + } else if (rtIsNaN(u0) || rtIsNaN(u1) || rtIsInf(u0)) { + y = (rtNaN); + } else if (u0 == 0.0) { + y = 0.0 / u1; + } else if (rtIsInf(u1)) { + if ((u1 < 0.0) != (u0 < 0.0)) { + y = u1; + } + } else { + boolean_T yEq; + y = std::fmod(u0, u1); + yEq = (y == 0.0); + if ((!yEq) && (u1 > std::floor(u1))) { + real_T q; + q = std::abs(u0 / u1); + yEq = !(std::abs(q - std::floor(q + 0.5)) > DBL_EPSILON * q); + } + + if (yEq) { + y = u1 * 0.0; + } else if ((u0 < 0.0) != (u1 < 0.0)) { + y += u1; + } + } + + return y; +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.h new file mode 100644 index 0000000..f810ff7 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.h @@ -0,0 +1,22 @@ +/* + * rt_modd_snf.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#ifndef rt_modd_snf_h_ +#define rt_modd_snf_h_ +#include "rtwtypes.h" + +extern real_T rt_modd_snf(real_T u0, real_T u1); + +#endif /* rt_modd_snf_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.o new file mode 100644 index 0000000..ca214e7 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_modd_snf.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.cpp new file mode 100644 index 0000000..dece823 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.cpp @@ -0,0 +1,111 @@ +/* + * rt_nonfinite.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +extern "C" +{ + +#include "rtGetNaN.h" + +} + +extern "C" +{ + +#include "rtGetInf.h" + +} + +#include +#include "rtwtypes.h" + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +#define NumBitsPerChar 8U + +extern "C" +{ + real_T rtInf; + real_T rtMinusInf; + real_T rtNaN; + real32_T rtInfF; + real32_T rtMinusInfF; + real32_T rtNaNF; +} + +extern "C" +{ + /* + * Initialize the rtInf, rtMinusInf, and rtNaN needed by the + * generated code. NaN is initialized as non-signaling. Assumes IEEE. + */ + void rt_InitInfAndNaN(size_t realSize) + { + (void) (realSize); + rtNaN = rtGetNaN(); + rtNaNF = rtGetNaNF(); + rtInf = rtGetInf(); + rtInfF = rtGetInfF(); + rtMinusInf = rtGetMinusInf(); + rtMinusInfF = rtGetMinusInfF(); + } + + /* Test if value is infinite */ + boolean_T rtIsInf(real_T value) + { + return (boolean_T)((value==rtInf || value==rtMinusInf) ? 1U : 0U); + } + + /* Test if single-precision value is infinite */ + boolean_T rtIsInfF(real32_T value) + { + return (boolean_T)(((value)==rtInfF || (value)==rtMinusInfF) ? 1U : 0U); + } + + /* Test if value is not a number */ + boolean_T rtIsNaN(real_T value) + { + boolean_T result = (boolean_T) 0; + size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar); + if (bitsPerReal == 32U) { + result = rtIsNaNF((real32_T)value); + } else { + union { + LittleEndianIEEEDouble bitVal; + real_T fltVal; + } tmpVal; + + tmpVal.fltVal = value; + result = (boolean_T)((tmpVal.bitVal.words.wordH & 0x7FF00000) == + 0x7FF00000 && + ( (tmpVal.bitVal.words.wordH & 0x000FFFFF) != 0 || + (tmpVal.bitVal.words.wordL != 0) )); + } + + return result; + } + + /* Test if single-precision value is not a number */ + boolean_T rtIsNaNF(real32_T value) + { + IEEESingle tmp; + tmp.wordL.wordLreal = value; + return (boolean_T)( (tmp.wordL.wordLuint & 0x7F800000) == 0x7F800000 && + (tmp.wordL.wordLuint & 0x007FFFFF) != 0 ); + } +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.h new file mode 100644 index 0000000..62ac309 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.h @@ -0,0 +1,64 @@ +/* + * rt_nonfinite.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + */ + +#ifndef rt_nonfinite_h_ +#define rt_nonfinite_h_ +#include +#include "rtwtypes.h" +#define NOT_USING_NONFINITE_LITERALS 1 +#ifdef __cplusplus + +extern "C" +{ + +#endif + + extern real_T rtInf; + extern real_T rtMinusInf; + extern real_T rtNaN; + extern real32_T rtInfF; + extern real32_T rtMinusInfF; + extern real32_T rtNaNF; + extern void rt_InitInfAndNaN(size_t realSize); + extern boolean_T rtIsInf(real_T value); + extern boolean_T rtIsInfF(real32_T value); + extern boolean_T rtIsNaN(real_T value); + extern boolean_T rtIsNaNF(real32_T value); + struct BigEndianIEEEDouble { + struct { + uint32_T wordH; + uint32_T wordL; + } words; + }; + + struct LittleEndianIEEEDouble { + struct { + uint32_T wordL; + uint32_T wordH; + } words; + }; + + struct IEEESingle { + union { + real32_T wordLreal; + uint32_T wordLuint; + } wordL; + }; + +#ifdef __cplusplus + +} /* extern "C" */ + +#endif +#endif /* rt_nonfinite_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.o new file mode 100644 index 0000000..e85d526 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_nonfinite.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.cpp b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.cpp new file mode 100644 index 0000000..06b44bf --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.cpp @@ -0,0 +1,57 @@ +/* + * rt_remd_snf.cpp + * + * 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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#include "rtwtypes.h" +#include "rt_remd_snf.h" + +extern "C" +{ + +#include "rt_nonfinite.h" + +} + +#include +#include + +real_T rt_remd_snf(real_T u0, real_T u1) +{ + real_T y; + if (rtIsNaN(u0) || rtIsNaN(u1) || rtIsInf(u0)) { + y = (rtNaN); + } else if (rtIsInf(u1)) { + y = u0; + } else { + if (u1 < 0.0) { + y = std::ceil(u1); + } else { + y = std::floor(u1); + } + + if ((u1 != 0.0) && (u1 != y)) { + real_T q; + q = std::abs(u0 / u1); + if (!(std::abs(q - std::floor(q + 0.5)) > DBL_EPSILON * q)) { + y = 0.0 * u0; + } else { + y = std::fmod(u0, u1); + } + } else { + y = std::fmod(u0, u1); + } + } + + return y; +} diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.h new file mode 100644 index 0000000..9361df2 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.h @@ -0,0 +1,22 @@ +/* + * rt_remd_snf.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 "VFControl". + * + * Model version : 1.1 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:53 2024 + * Created for block: VFControl + */ + +#ifndef rt_remd_snf_h_ +#define rt_remd_snf_h_ +#include "rtwtypes.h" + +extern real_T rt_remd_snf(real_T u0, real_T u1); + +#endif /* rt_remd_snf_h_ */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.o b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.o new file mode 100644 index 0000000..544b5d3 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rt_remd_snf.o differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtw_proj.tmw b/Control/VF Control/slprj/speedgoat/_sharedutils/rtw_proj.tmw new file mode 100644 index 0000000..a249725 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtw_proj.tmw @@ -0,0 +1,4 @@ +Simulink Coder project for rtwshared using . MATLAB root = C:\Program Files\MATLAB\R2024a. SimStruct date: 12-ene.-2024 11:16:21 +This file is generated by Simulink Coder for use by the make utility +to determine when to rebuild objects when the name of the current Simulink Coder project changes. +The rtwinfomat located at: diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.a b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.a new file mode 100644 index 0000000..cc74672 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.a differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.bat b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.bat new file mode 100644 index 0000000..7048ee5 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.bat @@ -0,0 +1,15 @@ + +call "%SLREALTIME_QNX_SP_ROOT%\%SLREALTIME_QNX_VERSION%\qnxsdp-env.bat" + +cd . + +chcp 1252 + +if "%1"=="" (make -f rtwshared.mk all) else (make -f rtwshared.mk %1) +@if errorlevel 1 goto error_exit + +exit /B 0 + +:error_exit +echo The make command returned an error of %errorlevel% +exit /B 1 \ No newline at end of file diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.mk b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.mk new file mode 100644 index 0000000..8a3915f --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwshared.mk @@ -0,0 +1,384 @@ +########################################################################### +## Makefile generated for component 'rtwshared'. +## +## Makefile : rtwshared.mk +## Generated on : Wed Oct 16 11:32:28 2024 +## Final product: ./rtwshared.a +## Product type : static library +## +########################################################################### + +########################################################################### +## MACROS +########################################################################### + +# Macro Descriptions: +# PRODUCT_NAME Name of the system to build +# MAKEFILE Name of this makefile +# MODELLIB Static library target + +PRODUCT_NAME = rtwshared +MAKEFILE = rtwshared.mk +MATLAB_ROOT = C:/PROGRA~1/MATLAB/R2024a +MATLAB_BIN = C:/PROGRA~1/MATLAB/R2024a/bin +MATLAB_ARCH_BIN = $(MATLAB_BIN)/win64 +START_DIR = C:/Users/PROMER~1/Desktop/SPARK-~1/Spark/UNAV/BANCOD~1/Simulink/VFCONT~1 +SOLVER = +SOLVER_OBJ = +CLASSIC_INTERFACE = 0 +TGT_FCN_LIB = ISO_C++ +MODEL_HAS_DYNAMICALLY_LOADED_SFCNS = +RELATIVE_PATH_TO_ANCHOR = ../../.. +C_STANDARD_OPTS = +CPP_STANDARD_OPTS = +MODELLIB = rtwshared.a + +########################################################################### +## TOOLCHAIN SPECIFICATIONS +########################################################################### + +# Toolchain Name: Simulink Real-Time Toolchain +# Supported Version(s): +# ToolchainInfo Version: 2024a +# Specification Revision: 1.0 +# +#------------------------------------------- +# Macros assumed to be defined elsewhere +#------------------------------------------- + +# SLREALTIME_QNX_SP_ROOT +# SLREALTIME_QNX_VERSION + +#----------- +# MACROS +#----------- + +QCC_TARGET = gcc_ntox86_64 + +TOOLCHAIN_SRCS = +TOOLCHAIN_INCS = +TOOLCHAIN_LIBS = -L$(MATLAB_ROOT)/toolbox/slrealtime/target/win64/target/lib -ltraceparser -lpps -lslrealtime_kernel -lslrealtime_platform -lslrealtime_rtps -lsocket -lboost_system -lboost_log -lpci -lopenblas -lpcap + +#------------------------ +# BUILD TOOL COMMANDS +#------------------------ + +# C Compiler: QNX C Compiler +CC = qcc + +# Linker: QCC Linker +LD = q++ + +# C++ Compiler: QNX C++ Compiler +CPP = q++ + +# C++ Linker: QCC C++ Linker +CPP_LD = q++ + +# Archiver: QNX Archiver +AR = ntox86_64-gcc-ar + +# Builder: GMAKE Utility +MAKE = make + + +#------------------------- +# Directives/Utilities +#------------------------- + +CDEBUG = -g -O0 -finstrument-functions +C_OUTPUT_FLAG = -o +LDDEBUG = -g +OUTPUT_FLAG = -o +CPPDEBUG = -g -O0 -finstrument-functions +CPP_OUTPUT_FLAG = -o +CPPLDDEBUG = -g +OUTPUT_FLAG = -o +ARDEBUG = +STATICLIB_OUTPUT_FLAG = +RM = @del /F +ECHO = @echo +MV = @move +RUN = + +#-------------------------------------- +# "Faster Runs" Build Configuration +#-------------------------------------- + +ARFLAGS = ruvs +CFLAGS = -c -V$(QCC_TARGET) -g \ + -O2 -fwrapv +CPPFLAGS = -c -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ \ + -O2 -fwrapv +CPP_LDFLAGS = -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ +CPP_SHAREDLIB_LDFLAGS = -V$(QCC_TARGET) -shared -Wl,--no-undefined -g +LDFLAGS = -V$(QCC_TARGET) -g -std=gnu++14 -stdlib=libstdc++ +MAKE_FLAGS = -f $(MAKEFILE) +SHAREDLIB_LDFLAGS = -V$(QCC_TARGET) -shared -Wl,--no-undefined -g + + + +########################################################################### +## OUTPUT INFO +########################################################################### + +PRODUCT = ./rtwshared.a +PRODUCT_TYPE = "static library" +BUILD_TYPE = "Model Reference Library" + +########################################################################### +## INCLUDE PATHS +########################################################################### + +INCLUDES_BUILDINFO = -I$(START_DIR) -I$(START_DIR)/slprj/speedgoat/_sharedutils -I$(MATLAB_ROOT)/toolbox/slrealtime/simulink/blocks/dist/include -I$(MATLAB_ROOT)/toolbox/slrealtime/target/kernel/dist/include -I$(MATLAB_ROOT)/extern/include -I$(MATLAB_ROOT)/simulink/include -I$(MATLAB_ROOT)/rtw/c/src -I$(MATLAB_ROOT)/rtw/c/src/ext_mode/common -IC:/PROGRA~3/SPEEDG~1/SPEEDG~1/R2024a/990DE8~1.0/SG_BLO~1/common/libsg -I$(MATLAB_ROOT)/toolbox/physmod/powersys/facts/facts -I$(MATLAB_ROOT)/toolbox/physmod/powersys/DR/DR -IC:/PROGRA~3/SPEEDG~1/SPEEDG~1/R2024a/990DE8~1.0 -IC:/PROGRA~3/SPEEDG~1/SPEEDG~1/R2024a/990DE8~1.0/SG_BLO~1/fpga/setup/include + +INCLUDES = $(INCLUDES_BUILDINFO) + +########################################################################### +## DEFINES +########################################################################### + +DEFINES_ = -DSIMULINK_REAL_TIME -D_QNX_SOURCE +DEFINES_BUILD_ARGS = -DEXT_MODE=1 -DINTEGER_CODE=0 +DEFINES_CUSTOM = +DEFINES_STANDARD = -DNRT -DUSE_RTMODEL + +DEFINES = $(DEFINES_) $(DEFINES_BUILD_ARGS) $(DEFINES_CUSTOM) $(DEFINES_STANDARD) + +########################################################################### +## SOURCE FILES +########################################################################### + +SRCS = $(START_DIR)/slprj/speedgoat/_sharedutils/look1_pbinlxpw.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rtGetInf.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rtGetNaN.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_hypotd_snf.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_look.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_look1d.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_modd_snf.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_nonfinite.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_remd_snf.cpp $(START_DIR)/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.cpp + +ALL_SRCS = $(SRCS) + +########################################################################### +## OBJECTS +########################################################################### + +OBJS = look1_pbinlxpw.o rtGetInf.o rtGetNaN.o rt_hypotd_snf.o rt_invd4x4_snf.o rt_look.o rt_look1d.o rt_modd_snf.o rt_nonfinite.o rt_remd_snf.o rt_TDelayInterpolate.o + +ALL_OBJS = $(OBJS) + +########################################################################### +## PREBUILT OBJECT FILES +########################################################################### + +PREBUILT_OBJS = + +########################################################################### +## LIBRARIES +########################################################################### + +LIBS = + +########################################################################### +## SYSTEM LIBRARIES +########################################################################### + +SYSTEM_LIBS = + +########################################################################### +## ADDITIONAL TOOLCHAIN FLAGS +########################################################################### + +#--------------- +# C Compiler +#--------------- + +CFLAGS_BASIC = $(DEFINES) $(INCLUDES) + +CFLAGS += $(CFLAGS_BASIC) + +#----------------- +# C++ Compiler +#----------------- + +CPPFLAGS_BASIC = $(DEFINES) $(INCLUDES) + +CPPFLAGS += $(CPPFLAGS_BASIC) + +#--------------- +# C++ Linker +#--------------- + +CPP_LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +CPP_LDFLAGS += $(CPP_LDFLAGS_) + +#------------------------------ +# C++ Shared Library Linker +#------------------------------ + +CPP_SHAREDLIB_LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +CPP_SHAREDLIB_LDFLAGS += $(CPP_SHAREDLIB_LDFLAGS_) + +#----------- +# Linker +#----------- + +LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +LDFLAGS += $(LDFLAGS_) + +#-------------------------- +# Shared Library Linker +#-------------------------- + +SHAREDLIB_LDFLAGS_ = -lsg_qnx710_x86_64 -LC:/ProgramData/Speedgoat/speedgoatlib/R2024a/9.9.0/sg_blocks/common/libsg + +SHAREDLIB_LDFLAGS += $(SHAREDLIB_LDFLAGS_) + +########################################################################### +## INLINED COMMANDS +########################################################################### + +########################################################################### +## PHONY TARGETS +########################################################################### + +.PHONY : all build clean info prebuild + + +all : build + @echo "### Successfully generated all binary outputs." + + +build : prebuild $(PRODUCT) + + +prebuild : + + +########################################################################### +## FINAL TARGET +########################################################################### + +#--------------------------------- +# Create a static library +#--------------------------------- + +$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) + @echo "### Creating static library "$(PRODUCT)" ..." + $(AR) $(ARFLAGS) $(PRODUCT) $(OBJS) + @echo "### Created: $(PRODUCT)" + + +########################################################################### +## INTERMEDIATE TARGETS +########################################################################### + +#--------------------- +# SOURCE-TO-OBJECT +#--------------------- + +%.o : %.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : %.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +%.o : $(START_DIR)/%.c + $(CC) $(CFLAGS) -o $@ $< + + +%.o : $(START_DIR)/%.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +look1_pbinlxpw.o : $(START_DIR)/slprj/speedgoat/_sharedutils/look1_pbinlxpw.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rtGetInf.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rtGetInf.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rtGetNaN.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rtGetNaN.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_hypotd_snf.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_hypotd_snf.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_invd4x4_snf.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_invd4x4_snf.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_look.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_look.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_look1d.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_look1d.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_modd_snf.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_modd_snf.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_nonfinite.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_nonfinite.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_remd_snf.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_remd_snf.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +rt_TDelayInterpolate.o : $(START_DIR)/slprj/speedgoat/_sharedutils/rt_TDelayInterpolate.cpp + $(CPP) $(CPPFLAGS) -o $@ $< + + +########################################################################### +## DEPENDENCIES +########################################################################### + +$(ALL_OBJS) : rtw_proj.tmw + + +########################################################################### +## MISCELLANEOUS TARGETS +########################################################################### + +info : + @echo "### PRODUCT = $(PRODUCT)" + @echo "### PRODUCT_TYPE = $(PRODUCT_TYPE)" + @echo "### BUILD_TYPE = $(BUILD_TYPE)" + @echo "### INCLUDES = $(INCLUDES)" + @echo "### DEFINES = $(DEFINES)" + @echo "### ALL_SRCS = $(ALL_SRCS)" + @echo "### ALL_OBJS = $(ALL_OBJS)" + @echo "### LIBS = $(LIBS)" + @echo "### MODELREF_LIBS = $(MODELREF_LIBS)" + @echo "### SYSTEM_LIBS = $(SYSTEM_LIBS)" + @echo "### TOOLCHAIN_LIBS = $(TOOLCHAIN_LIBS)" + @echo "### CFLAGS = $(CFLAGS)" + @echo "### LDFLAGS = $(LDFLAGS)" + @echo "### SHAREDLIB_LDFLAGS = $(SHAREDLIB_LDFLAGS)" + @echo "### CPPFLAGS = $(CPPFLAGS)" + @echo "### CPP_LDFLAGS = $(CPP_LDFLAGS)" + @echo "### CPP_SHAREDLIB_LDFLAGS = $(CPP_SHAREDLIB_LDFLAGS)" + @echo "### ARFLAGS = $(ARFLAGS)" + @echo "### MAKE_FLAGS = $(MAKE_FLAGS)" + + +clean : + $(ECHO) "### Deleting all derived files ..." + $(RM) $(subst /,\,$(PRODUCT)) + $(RM) $(subst /,\,$(ALL_OBJS)) + $(ECHO) "### Deleted all derived files." + + diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtwtypes.h b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwtypes.h new file mode 100644 index 0000000..0853d86 --- /dev/null +++ b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwtypes.h @@ -0,0 +1,75 @@ +/* + * rtwtypes.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 "PWMGenerator". + * + * Model version : 1.7 + * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 + * C++ source code generated on : Wed Oct 16 10:45:22 2024 + */ + +#ifndef RTWTYPES_H +#define RTWTYPES_H +#include "tmwtypes.h" +#ifndef POINTER_T +#define POINTER_T + +typedef void * pointer_T; + +#endif + +/* Logical type definitions */ +#if (!defined(__cplusplus)) +#ifndef false +#define false (0U) +#endif + +#ifndef true +#define true (1U) +#endif +#endif + +#ifndef INT64_T +#define INT64_T + +typedef long int64_T; + +#define MAX_int64_T ((int64_T)(9223372036854775807L)) +#define MIN_int64_T ((int64_T)(-9223372036854775807L-1L)) +#endif + +#ifndef UINT64_T +#define UINT64_T + +typedef unsigned long uint64_T; + +#define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFUL)) +#endif + +/*===========================================================================* + * Additional complex number type definitions * + *===========================================================================*/ +#ifndef CINT64_T +#define CINT64_T + +typedef struct { + int64_T re; + int64_T im; +} cint64_T; + +#endif + +#ifndef CUINT64_T +#define CUINT64_T + +typedef struct { + uint64_T re; + uint64_T im; +} cuint64_T; + +#endif +#endif /* RTWTYPES_H */ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/rtwtypeschksum.mat b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwtypeschksum.mat new file mode 100644 index 0000000..348da9f Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/rtwtypeschksum.mat differ diff --git a/Control/VF Control/slprj/speedgoat/_sharedutils/shared_file.dmr b/Control/VF Control/slprj/speedgoat/_sharedutils/shared_file.dmr new file mode 100644 index 0000000..db6ddd3 Binary files /dev/null and b/Control/VF Control/slprj/speedgoat/_sharedutils/shared_file.dmr differ diff --git a/Datasheets/IO397.pdf b/Datasheets/IO397.pdf new file mode 100644 index 0000000..efd01b8 Binary files /dev/null and b/Datasheets/IO397.pdf differ diff --git a/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure-backups/AmplifOptoacopladorEnclosure-2024-10-26_121110.zip b/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure-backups/AmplifOptoacopladorEnclosure-2024-10-26_121110.zip new file mode 100644 index 0000000..874942e Binary files /dev/null and b/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure-backups/AmplifOptoacopladorEnclosure-2024-10-26_121110.zip differ diff --git a/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure-backups/AmplifOptoacopladorEnclosure-2024-10-28_101326.zip b/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure-backups/AmplifOptoacopladorEnclosure-2024-10-28_101326.zip new file mode 100644 index 0000000..491ccdc Binary files /dev/null and b/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure-backups/AmplifOptoacopladorEnclosure-2024-10-28_101326.zip differ diff --git a/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure.pdf b/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure.pdf new file mode 100644 index 0000000..45a0844 Binary files /dev/null and b/Esquemáticos/Sistema de amplificación PWM/AmplifOptoacopladorEnclosure.pdf differ