?? ipa_control_acc.c
字號:
/* MinMax Block: <S20>/impMethod */
{
real_T min;
{
int_T i1;
const real_T *u1 = &IPa_control_B->s33_NS[0];
real_T *y0 = &rtb_s20_impMethod[0];
for (i1=0; i1 < 101; i1++) {
min = rtb_temp147;
if (u1[i1] < min) {
min = u1[i1];
}
y0[i1] = min;
}
}
}
}
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* Constant Block: <S21>/Weight */
IPa_control_B->s21_Weight = (IPa_control_P->s21_Weight_Value);
}
if (ssIsContinuousTask(S, tid)) { /* Sample time: [0.0, 0.0] */
/* MinMax Block: <S21>/andorMethod */
{
real_T min = rtb_temp145;
if (rtb_temp141 < min) {
min = rtb_temp141;
}
rtb_temp140 = min;
}
/* Product Block: <S21>/Weighting */
rtb_temp140 = IPa_control_B->s21_Weight *
rtb_temp140;
/* MinMax Block: <S21>/impMethod */
{
real_T min;
{
int_T i1;
const real_T *u1 = &IPa_control_B->s33_NL[0];
real_T *y0 = &rtb_s21_impMethod[0];
for (i1=0; i1 < 101; i1++) {
min = rtb_temp140;
if (u1[i1] < min) {
min = u1[i1];
}
y0[i1] = min;
}
}
}
}
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* Constant Block: <S22>/Weight */
IPa_control_B->s22_Weight = (IPa_control_P->s22_Weight_Value);
}
if (ssIsContinuousTask(S, tid)) { /* Sample time: [0.0, 0.0] */
/* MinMax Block: <S22>/andorMethod */
{
real_T min = rtb_temp145;
if (rtb_temp142 < min) {
min = rtb_temp142;
}
rtb_temp141 = min;
}
/* Product Block: <S22>/Weighting */
rtb_temp141 = IPa_control_B->s22_Weight *
rtb_temp141;
/* MinMax Block: <S22>/impMethod */
{
real_T min;
{
int_T i1;
const real_T *u1 = &IPa_control_B->s33_NL[0];
real_T *y0 = &rtb_s22_impMethod[0];
for (i1=0; i1 < 101; i1++) {
min = rtb_temp141;
if (u1[i1] < min) {
min = u1[i1];
}
y0[i1] = min;
}
}
}
}
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* Constant Block: <S23>/Weight */
IPa_control_B->s23_Weight = (IPa_control_P->s23_Weight_Value);
}
if (ssIsContinuousTask(S, tid)) { /* Sample time: [0.0, 0.0] */
/* MinMax Block: <S23>/andorMethod */
{
real_T min = rtb_temp145;
if (rtb_temp146 < min) {
min = rtb_temp146;
}
rtb_temp145 = min;
}
/* Product Block: <S23>/Weighting */
rtb_temp145 = IPa_control_B->s23_Weight *
rtb_temp145;
/* MinMax Block: <S23>/impMethod */
{
real_T min;
{
int_T i1;
const real_T *u1 = &IPa_control_B->s33_NL[0];
real_T *y0 = &rtb_temp129[0];
for (i1=0; i1 < 101; i1++) {
min = rtb_temp145;
if (u1[i1] < min) {
min = u1[i1];
}
y0[i1] = min;
}
}
}
/* MinMax Block: <S4>/aggMethod1 */
{
real_T max;
{
int_T i1;
const real_T *u0 = &rtb_temp119[0];
const real_T *u1 = &rtb_s17_impMethod[0];
const real_T *u2 = &rtb_s24_impMethod[0];
const real_T *u3 = &rtb_s25_impMethod[0];
const real_T *u4 = &rtb_s26_impMethod[0];
const real_T *u5 = &rtb_s27_impMethod[0];
const real_T *u6 = &rtb_s28_impMethod[0];
const real_T *u7 = &rtb_s29_impMethod[0];
const real_T *u8 = &rtb_s30_impMethod[0];
const real_T *u9 = &rtb_s7_impMethod[0];
const real_T *u10 = &rtb_s8_impMethod[0];
const real_T *u11 = &rtb_s9_impMethod[0];
const real_T *u12 = &rtb_s10_impMethod[0];
const real_T *u13 = &rtb_s11_impMethod[0];
const real_T *u14 = &rtb_s12_impMethod[0];
const real_T *u15 = &rtb_s13_impMethod[0];
const real_T *u16 = &rtb_s14_impMethod[0];
const real_T *u17 = &rtb_s15_impMethod[0];
const real_T *u18 = &rtb_s16_impMethod[0];
const real_T *u19 = &rtb_s18_impMethod[0];
const real_T *u20 = &rtb_s19_impMethod[0];
const real_T *u21 = &rtb_s20_impMethod[0];
const real_T *u22 = &rtb_s21_impMethod[0];
const real_T *u23 = &rtb_s22_impMethod[0];
const real_T *u24 = &rtb_temp129[0];
real_T *y0 = &rtb_temp119[0];
for (i1=0; i1 < 101; i1++) {
max = u0[i1];
if (u1[i1] > max) {
max = u1[i1];
}
if (u2[i1] > max) {
max = u2[i1];
}
if (u3[i1] > max) {
max = u3[i1];
}
if (u4[i1] > max) {
max = u4[i1];
}
if (u5[i1] > max) {
max = u5[i1];
}
if (u6[i1] > max) {
max = u6[i1];
}
if (u7[i1] > max) {
max = u7[i1];
}
if (u8[i1] > max) {
max = u8[i1];
}
if (u9[i1] > max) {
max = u9[i1];
}
if (u10[i1] > max) {
max = u10[i1];
}
if (u11[i1] > max) {
max = u11[i1];
}
if (u12[i1] > max) {
max = u12[i1];
}
if (u13[i1] > max) {
max = u13[i1];
}
if (u14[i1] > max) {
max = u14[i1];
}
if (u15[i1] > max) {
max = u15[i1];
}
if (u16[i1] > max) {
max = u16[i1];
}
if (u17[i1] > max) {
max = u17[i1];
}
if (u18[i1] > max) {
max = u18[i1];
}
if (u19[i1] > max) {
max = u19[i1];
}
if (u20[i1] > max) {
max = u20[i1];
}
if (u21[i1] > max) {
max = u21[i1];
}
if (u22[i1] > max) {
max = u22[i1];
}
if (u23[i1] > max) {
max = u23[i1];
}
if (u24[i1] > max) {
max = u24[i1];
}
y0[i1] = max;
}
}
}
/* Product Block: <S5>/Product (COA) */
{
int_T i1;
const real_T *u0 = &IPa_control_B->s5_x_data[0];
const real_T *u1 = &rtb_temp119[0];
real_T *y0 = &rtb_temp129[0];
for (i1=0; i1 < 101; i1++) {
y0[i1] = u0[i1] *
u1[i1];
}
}
/* Sum Block: <S5>/Sum */
rtb_temp146 = rtb_temp129[0];
{
int_T i1;
const real_T *u0 = &rtb_temp129[1];
for (i1=0; i1 < 100; i1++) {
rtb_temp146 += u0[i1];
}
}
/* Sum Block: <S5>/Sum1 */
rtb_temp142 = rtb_temp119[0];
{
int_T i1;
const real_T *u0 = &rtb_temp119[1];
for (i1=0; i1 < 100; i1++) {
rtb_temp142 += u0[i1];
}
}
}
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* Constant Block: <S5>/Prevent Div//1 */
IPa_control_B->s5_Prevent_Div_1 = (IPa_control_P->s5_Prevent_Div_1_Value);
}
if (ssIsContinuousTask(S, tid)) { /* Sample time: [0.0, 0.0] */
/* RelationalOperator Block: <S5>/Zero Strength (COA) */
rtb_temp130 = (rtb_temp142 <= IPa_control_B->s5_Prevent_Div_1);
/* MinMax Block: <S5>/Max (COA) */
rtb_temp142 = (rtb_temp142 > rtb_temp130) ? rtb_temp142 : rtb_temp130;
/* Product Block: <S5>/Averaging (COA) */
rtb_temp146 = rtb_temp146 /
rtb_temp142;
}
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* Constant Block: <S4>/MidRange */
IPa_control_B->s4_MidRange = (IPa_control_P->s4_MidRange_Value);
}
if (ssIsContinuousTask(S, tid)) { /* Sample time: [0.0, 0.0] */
/* Sum Block: <S4>/Total Firing Strength */
rtb_temp139 = rtb_temp139 + rtb_temp131 + rtb_temp132 + rtb_temp133
+ rtb_temp138 + rtb_temp134 + rtb_temp120 + rtb_temp121 + rtb_temp122
+ rtb_temp148 + rtb_temp135 + rtb_temp123 + rtb_temp124 + rtb_temp125
+ rtb_temp143 + rtb_temp136 + rtb_temp126 + rtb_temp127 + rtb_temp128
+ rtb_temp144 + rtb_temp137 + rtb_temp147 + rtb_temp140 + rtb_temp141
+ rtb_temp145;
}
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* Constant Block: <S4>/Zero */
IPa_control_B->s4_Zero = (IPa_control_P->s4_Zero_Value);
}
if (ssIsContinuousTask(S, tid)) { /* Sample time: [0.0, 0.0] */
/* RelationalOperator Block: <S4>/Zero Firing Strength? */
rtb_temp139 = (rtb_temp139 > IPa_control_B->s4_Zero);
/* Switch Block: <S4>/Switch */
if (rtb_temp139 >= (IPa_control_P->s4_Switch_Threshold)) {
rtb_temp146 = rtb_temp146;
} else {
rtb_temp146 = IPa_control_B->s4_MidRange;
}
/* Gain Block: <S1>/Gain3 */
IPa_control_B->s1_Gain3 = rtb_temp146 * (IPa_control_P->s1_Gain3_Gain);
/* TransferFcn Block: <S2>/Motor Transfer Fcn */
rtb_temp130 = (IPa_control_P->s2_Motor_Transfer_Fcn_C)*IPa_control_X->s2_Motor_Transfer_Fcn;
/* Fcn Block: <S2>/Fcn */
/* Expression: 6*(9.8*sin(u(1))+0.6667*cos(u(1))*(-u(3)-0.25*u(2)*u(2)*sin(u(1))))/(4-cos(u(1))*cos(u(1))) */
IPa_control_B->s2_Fcn = 6.0 * ( 9.8 * sin( rtb_temp118 ) + 0.6667 *
cos( rtb_temp118 ) * ( ( -rtb_temp130 ) - 0.25 *
IPa_control_B->s2_Integrator * IPa_control_B->s2_Integrator * sin(
rtb_temp118 ) ) ) / ( 4.0 - cos( rtb_temp118 ) * cos( rtb_temp118 ) );
/* Clock Block: <Root>/Clock */
IPa_control_B->root_Clock = ssGetT(S);
}
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* ToWorkspace Block: <Root>/To Workspace2 */
/* Call into Simulink for To Workspace */
ssCallAccelRunBlock(S, 0, 270, SS_CALL_MDL_OUTPUTS);
}
}
/* Perform model update */
#define MDL_UPDATE
static void mdlUpdate(SimStruct *S, int_T tid)
{
/* simstruct variables */
IPa_control_BlockIO *IPa_control_B = (IPa_control_BlockIO *) _ssGetBlockIO(S);
IPa_control_D_Work *IPa_control_DWork = (IPa_control_D_Work *) ssGetRootDWork(S);
IPa_control_Parameters *IPa_control_P = (IPa_control_Parameters *) ssGetDefaultParam(S);
if (ssIsSampleHit(S, 1, tid)) { /* Sample time: [0.01, 0.0] */
/* RandomNumber Block: <Root>/Random Number */
IPa_control_DWork->root_Random_Number_RWORK.NextOutput = rt_NormalRand((uint_T *)&IPa_control_DWork->root_Random_Number_IWORK.RandSeed)*(IPa_control_P->root_Random_Number_StdDev)+(IPa_control_P->root_Random_Number_Mean);
}
if (ssIsContinuousTask(S, tid)) { /* Sample time: [0.0, 0.0] */
/* Derivative Block: <Root>/Derivative */
{
real_T timeStampA = IPa_control_DWork->root_Derivative_RWORK.TimeStampA;
real_T timeStampB = IPa_control_DWork->root_Derivative_RWORK.TimeStampB;
real_T *lastBank = &IPa_control_DWork->root_Derivative_RWORK.TimeStampA;
if (timeStampA != rtInf) {
if (timeStampB == rtInf) {
lastBank += 2;
} else if (timeStampA >= timeStampB) {
lastBank += 2;
}
}
*lastBank++ = ssGetTaskTime(S,tid);
*lastBank++ = IPa_control_B->root_Sum;
}
}
}
/* Compute model derivatives */
#define MDL_DERIVATIVES
static void mdlDerivatives(SimStruct *S)
{
/* simstruct variables */
IPa_control_BlockIO *IPa_control_B = (IPa_control_BlockIO *) _ssGetBlockIO(S);
IPa_control_ContinuousStates *IPa_control_X = (IPa_control_ContinuousStates*) ssGetContStates(S);
IPa_control_Parameters *IPa_control_P = (IPa_control_Parameters *) ssGetDefaultParam(S);
/* Integrator Block: <S2>/Integrator1 */
{
real_T *dx = ssGetdX(S);
dx[0] = IPa_control_B->s2_Integrator;
}
/* Integrator Block: <S2>/Integrator */
{
real_T *dx = ssGetdX(S);
dx[1] = IPa_control_B->s2_Fcn;
}
/* TransferFcn Block: <S2>/Motor Transfer Fcn */
{
real_T *dx = ssGetdX(S)+2;
dx[0] = (IPa_control_P->s2_Motor_Transfer_Fcn_B)*IPa_control_B->s1_Gain3;
dx[0] += (IPa_control_P->s2_Motor_Transfer_Fcn_A)*IPa_control_X->s2_Motor_Transfer_Fcn;
}
}
/* End of Functions in model "IPa_control_acc" */
#include "IPa_control_acc_reg.h"
/* [EOF] IPa_control_acc.c */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -