/* Outputs for root system: '<Root>' */ static void mdlOutputs(SimStruct *S, int_T tid) { ((BlockIO *) _ssGetBlockIO(S))->B_0_1_0 = ((real_T)((D_Work *) ssGetRootDWork (S))->clockTickCounter < ((Parameters *) ssGetDefaultParam(S))->P_6) && (((D_Work *) ssGetRootDWork(S))->clockTickCounter >= 0) ? ((Parameters *) ssGetDefaultParam(S))->P_4 : 0.0; if ((real_T)((D_Work *) ssGetRootDWork(S))->clockTickCounter >= ((Parameters *) ssGetDefaultParam(S))->P_5 - 1.0) { ((D_Work *) ssGetRootDWork(S))->clockTickCounter = 0; } else { ((D_Work *) ssGetRootDWork(S))->clockTickCounter = ((D_Work *) ssGetRootDWork(S))->clockTickCounter + 1; } ((BlockIO *) _ssGetBlockIO(S))->B_0_2_0 = (muDoubleScalarSin(((Parameters *) ssGetDefaultParam(S))->P_2 * ssGetTaskTime(S,0) + ((Parameters *) ssGetDefaultParam(S))->P_3) * ((Parameters *) ssGetDefaultParam(S))->P_0 + ((Parameters *) ssGetDefaultParam(S))->P_1) * ((BlockIO *) _ssGetBlockIO(S) )->B_0_1_0; /* Scope: '<Root>/Scope' */ /* Call into Simulink for Scope */ ssCallAccelRunBlock(S, 0, 3, SS_CALL_MDL_OUTPUTS); /* Scope: '<Root>/Scope2' */ /* Call into Simulink for Scope */ ssCallAccelRunBlock(S, 0, 4, SS_CALL_MDL_OUTPUTS); /* tid is required for a uniform function interface. * Argument tid is not used in the function. */ UNUSED_PARAMETER(tid); }
static void mdlDerivatives ( SimStruct * S ) { BlockIO_main * _rtB ; Parameters_main * _rtP ; _rtP = ( ( Parameters_main * ) ssGetDefaultParam ( S ) ) ; _rtB = ( ( BlockIO_main * ) _ssGetBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 0 , 0 , SS_CALL_MDL_DERIVATIVES ) ; { ( ( StateDerivatives_main * ) ssGetdX ( S ) ) -> TransferFcn_CSTATE = ( _rtP -> P_5 ) * ( ( ContinuousStates_main * ) ssGetContStates ( S ) ) -> TransferFcn_CSTATE ; ( ( StateDerivatives_main * ) ssGetdX ( S ) ) -> TransferFcn_CSTATE += _rtP -> P_6 * ( ( BlockIO_main * ) _ssGetBlockIO ( S ) ) -> B_0_16_0 ; } } static
static void mdlUpdate ( SimStruct * S , int_T tid ) { nmsgyp54ig * _rtB ; bbqvqz25ov * _rtP ; pklu3vjy1t * _rtDW ; _rtDW = ( ( pklu3vjy1t * ) ssGetRootDWork ( S ) ) ; _rtP = ( ( bbqvqz25ov * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( nmsgyp54ig * ) _ssGetModelBlockIO ( S ) ) ; if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtDW -> idaicj53o4 = _rtB -> pvzuuxenvc ; } if ( ssIsSampleHit ( S , 2 , 0 ) ) { ssCallAccelRunBlock ( S , 9 , 15 , SS_CALL_MDL_UPDATE ) ; } hdynn0hvxj ( S , & _rtB -> cqabclhqip4 , & _rtDW -> cqabclhqip4 , ( nneyi35s1a * ) & _rtP -> cqabclhqip4 ) ; hdynn0hvxj ( S , & _rtB -> nfugx5ih43 , & _rtDW -> nfugx5ih43 , ( nneyi35s1a * ) & _rtP -> nfugx5ih43 ) ; UNUSED_PARAMETER ( tid ) ; }
static void mdlOutputs ( SimStruct * S , int_T tid ) { real_T B_0_15_0 ; real_T currentTime ; BlockIO_main * _rtB ; Parameters_main * _rtP ; D_Work_main * _rtDW ; _rtDW = ( ( D_Work_main * ) ssGetRootDWork ( S ) ) ; _rtP = ( ( Parameters_main * ) ssGetDefaultParam ( S ) ) ; _rtB = ( ( BlockIO_main * ) _ssGetBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 0 , 0 , SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ssCallAccelRunBlock ( S , 0 , 1 , SS_CALL_MDL_OUTPUTS ) ; } _rtB -> B_0_2_0 = _rtB -> B_0_0_0 [ 2 ] * _rtB -> B_0_0_0 [ 1 ] ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ssCallAccelRunBlock ( S , 0 , 3 , SS_CALL_MDL_OUTPUTS ) ; } ( ( BlockIO_main * ) _ssGetBlockIO ( S ) ) -> B_0_4_0 = ssGetT ( S ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ssCallAccelRunBlock ( S , 0 , 5 , SS_CALL_MDL_OUTPUTS ) ; _rtB -> B_0_6_0 = _rtP -> P_0 ; } _rtB -> B_0_7_0 = _rtB -> B_0_6_0 - _rtB -> B_0_0_0 [ 1 ] ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ssCallAccelRunBlock ( S , 0 , 8 , SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 0 , 9 , SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 0 , 10 , SS_CALL_MDL_OUTPUTS ) ; } currentTime = ssGetTaskTime ( S , 0 ) ; if ( currentTime < _rtP -> P_1 ) { _rtB -> B_0_11_0 = _rtP -> P_2 ; } else { _rtB -> B_0_11_0 = _rtP -> P_3 ; } ssCallAccelRunBlock ( S , 0 , 12 , SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ssCallAccelRunBlock ( S , 0 , 13 , SS_CALL_MDL_OUTPUTS ) ; _rtB -> B_0_14_0 = _rtDW -> Delay_DSTATE ; } B_0_15_0 = _rtP -> P_7 * ( ( ContinuousStates_main * ) ssGetContStates ( S ) ) -> TransferFcn_CSTATE ; ssCallAccelRunBlock ( S , 0 , 16 , SS_CALL_MDL_OUTPUTS ) ; _rtB -> B_0_17_0 = _rtB -> B_0_16_0 - B_0_15_0 ; _rtB -> B_0_18_0 [ 0 ] = _rtB -> B_0_12_0 ; _rtB -> B_0_18_0 [ 1 ] = B_0_15_0 ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ssCallAccelRunBlock ( S , 0 , 19 , SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 0 , 20 , SS_CALL_MDL_OUTPUTS ) ; } UNUSED_PARAMETER ( tid ) ; }
static void mdlUpdate ( SimStruct * S , int_T tid ) { BlockIO_main * _rtB ; Parameters_main * _rtP ; _rtP = ( ( Parameters_main * ) ssGetDefaultParam ( S ) ) ; _rtB = ( ( BlockIO_main * ) _ssGetBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 0 , 0 , SS_CALL_MDL_UPDATE ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ( ( D_Work_main * ) ssGetRootDWork ( S ) ) -> Delay_DSTATE = _rtB -> B_0_17_0 ; } UNUSED_PARAMETER ( tid ) ; }
void ) { } static void mdlOutputs ( SimStruct * S , int_T tid ) { real_T jzxguy1xyo ; ZCEventType zcEvent ; boolean_T is1galx1wr ; real_T iden3vpls2 ; real_T kewj0jjgdw ; real_T c3hti1p3uf ; int8_T rtPrevAction ; int8_T rtAction ; nmsgyp54ig * _rtB ; bbqvqz25ov * _rtP ; n2g2llwf21 * _rtX ; aa2ep02qn5 * _rtZCE ; pklu3vjy1t * _rtDW ; _rtDW = ( ( pklu3vjy1t * ) ssGetRootDWork ( S ) ) ; _rtZCE = ( ( aa2ep02qn5 * ) _ssGetPrevZCSigState ( S ) ) ; _rtX = ( ( n2g2llwf21 * ) ssGetContStates ( S ) ) ; _rtP = ( ( bbqvqz25ov * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( nmsgyp54ig * ) _ssGetModelBlockIO ( S ) ) ; if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtB -> jbbkv4upvi = _rtDW -> idaicj53o4 ; } if ( ssIsSampleHit ( S , 1 , 0 ) ) { is1galx1wr = ( _rtB -> jbbkv4upvi != c22ngqieus ( S ) -> pactsh03am ) ; } jzxguy1xyo = ssGetT ( S ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { _rtB -> oojsaunz11 = _rtP -> P_5 ; _rtB -> fmra2cutsa = _rtP -> P_6 ; } _rtB -> fs1ofsmvy2 = muDoubleScalarRem ( jzxguy1xyo + _rtB -> oojsaunz11 , _rtB -> fmra2cutsa ) * _rtP -> P_7 ; _rtB -> kdd430tca4 = ( ( 2.0 * _rtB -> fs1ofsmvy2 - 1.0 ) + 1.0 ) * 0.5 ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { if ( ssIsMajorTimeStep ( S ) ) { _rtDW -> fiaf5yjt4n = ( _rtB -> jbbkv4upvi >= _rtB -> kdd430tca4 ) ; } _rtB -> bonoh3t2uf = ( is1galx1wr && _rtDW -> fiaf5yjt4n ) ; } _rtB -> puvw0myvhu [ 0 ] = _rtB -> bonoh3t2uf ; _rtB -> puvw0myvhu [ 1 ] = 0.0 ; _rtB -> puvw0myvhu [ 2 ] = 0.0 ; _rtDW -> lhiprm3wjz [ 0 ] = ! ( _rtB -> puvw0myvhu [ 0 ] == _rtDW -> lhiprm3wjz [ 1 ] ) ; _rtDW -> lhiprm3wjz [ 1 ] = _rtB -> puvw0myvhu [ 0 ] ; _rtB -> puvw0myvhu [ 3 ] = _rtDW -> lhiprm3wjz [ 0 ] ; if ( ssIsSampleHit ( S , 2 , 0 ) ) { ssCallAccelRunBlock ( S , 9 , 15 , SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 9 , 16 , SS_CALL_MDL_OUTPUTS ) ; } if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtB -> ni0skqgprw = _rtB -> mgrpxotnda [ 2 ] ; } if ( ssIsSampleHit ( S , 2 , 0 ) ) { ssCallAccelRunBlock ( S , 9 , 20 , SS_CALL_MDL_OUTPUTS ) ; } if ( ssIsSampleHit ( S , 1 , 0 ) ) { zcEvent = rt_ZCFcn ( ANY_ZERO_CROSSING , & _rtZCE -> mpe2yble25 , ( _rtB -> fs1ofsmvy2 - _rtP -> P_11 ) ) ; if ( _rtDW -> oosqu0tl1h == 0 ) { if ( zcEvent != NO_ZCEVENT ) { _rtB -> dgvfzxjzqp = ! ( _rtB -> dgvfzxjzqp != 0.0 ) ; _rtDW -> oosqu0tl1h = 1 ; } else if ( _rtB -> dgvfzxjzqp == 1.0 ) { if ( _rtB -> fs1ofsmvy2 != _rtP -> P_11 ) { _rtB -> dgvfzxjzqp = 0.0 ; } } else { if ( _rtB -> fs1ofsmvy2 == _rtP -> P_11 ) { _rtB -> dgvfzxjzqp = 1.0 ; } } } else { if ( _rtB -> fs1ofsmvy2 != _rtP -> P_11 ) { _rtB -> dgvfzxjzqp = 0.0 ; } _rtDW -> oosqu0tl1h = 0 ; } } if ( ssIsSampleHit ( S , 2 , 0 ) ) { ssCallAccelRunBlock ( S , 9 , 23 , SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 9 , 33 , SS_CALL_MDL_OUTPUTS ) ; iden3vpls2 = _rtP -> P_13 * _rtB -> mgrpxotnda [ 8 ] ; } if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtB -> gp5orjzg5t = _rtB -> mgrpxotnda [ 2 ] ; } if ( ssIsSampleHit ( S , 2 , 0 ) ) { kewj0jjgdw = ( iden3vpls2 - _rtB -> gp5orjzg5t ) * _rtB -> nzunlww04y ; } if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtB -> jw2hkpsksy = _rtB -> gp5orjzg5t * _rtB -> dvca5kgoqr ; _rtB -> elobzetbdp = _rtB -> mgrpxotnda [ 8 ] ; } if ( ssIsSampleHit ( S , 2 , 0 ) ) { c3hti1p3uf = ( kewj0jjgdw + _rtB -> jw2hkpsksy ) - _rtB -> elobzetbdp ; if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtB -> bc5lqmbcwx = _rtB -> mgrpxotnda [ 9 ] ; } } if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtB -> bpiny53cki = _rtB -> elobzetbdp + _rtB -> bc5lqmbcwx ; } if ( ssIsSampleHit ( S , 2 , 0 ) ) { iden3vpls2 = c3hti1p3uf / _rtB -> bpiny53cki + _rtB -> idha0n310x ; if ( iden3vpls2 > _rtP -> P_16 ) { _rtB -> ccrq35nhp3 = _rtP -> P_16 ; } else if ( iden3vpls2 < _rtP -> P_17 ) { _rtB -> ccrq35nhp3 = _rtP -> P_17 ; } else { _rtB -> ccrq35nhp3 = iden3vpls2 ; } } if ( ssIsSampleHit ( S , 4 , 0 ) ) { _rtB -> pvzuuxenvc = _rtB -> ccrq35nhp3 ; } if ( ssIsSampleHit ( S , 2 , 0 ) ) { _rtB -> ii04l1a0ic = ( _rtB -> mgrpxotnda [ 9 ] + _rtB -> mgrpxotnda [ 8 ] ) - _rtB -> mgrpxotnda [ 6 ] ; ssCallAccelRunBlock ( S , 9 , 51 , SS_CALL_MDL_OUTPUTS ) ; rtPrevAction = _rtDW -> dcumqbbyun ; if ( ssIsMajorTimeStep ( S ) ) { if ( _rtB -> mgrpxotnda [ 9 ] < 90.199999999999989 ) { rtAction = 0 ; } else { rtAction = 1 ; } _rtDW -> dcumqbbyun = rtAction ; } else { rtAction = _rtDW -> dcumqbbyun ; } if ( rtPrevAction != rtAction ) { switch ( rtPrevAction ) { case 0 : ssSetSolverNeedsReset ( S ) ; break ; case 1 : ssSetSolverNeedsReset ( S ) ; break ; case 2 : ssSetSolverNeedsReset ( S ) ; break ; } } switch ( rtAction ) { case 0 : if ( rtAction != rtPrevAction ) { if ( ssGetTaskTime ( S , 2 ) != ssGetTStart ( S ) ) { ssSetSolverNeedsReset ( S ) ; } } _rtB -> kx5rgsvmx3 = _rtP -> P_0 * _rtB -> mgrpxotnda [ 8 ] ; if ( ssIsMajorTimeStep ( S ) ) { srUpdateBC ( _rtDW -> o5k0zwtbn4 ) ; } break ; case 1 : if ( rtAction != rtPrevAction ) { if ( ssGetTaskTime ( S , 2 ) != ssGetTStart ( S ) ) { ssSetSolverNeedsReset ( S ) ; } } _rtB -> kx5rgsvmx3 = _rtP -> P_1 ; if ( ssIsMajorTimeStep ( S ) ) { srUpdateBC ( _rtDW -> ihoovge3z4 ) ; } break ; case 2 : if ( rtAction != rtPrevAction ) { if ( ssGetTaskTime ( S , 2 ) != ssGetTStart ( S ) ) { ssSetSolverNeedsReset ( S ) ; } } _rtB -> pvzuuxenvc = _rtP -> P_2 ; if ( ssIsMajorTimeStep ( S ) ) { srUpdateBC ( _rtDW -> gunoszsdaf ) ; } break ; } } bemu4fk2sq ( S , _rtB -> kwjevd5eqt , 0.0 , & _rtB -> bemu4fk2sq4 , & _rtDW -> bemu4fk2sq4 , ( mvw1gbh0c1 * ) & _rtP -> bemu4fk2sq4 , & ( ( npjij2cecc * ) ssGetContStateDisabled ( S ) ) -> bemu4fk2sq4 ) ; cqabclhqip ( S , _rtB -> donhz1jhkq , 0.0 , & _rtB -> cqabclhqip4 , & _rtDW -> cqabclhqip4 , ( nneyi35s1a * ) & _rtP -> cqabclhqip4 , & _rtX -> cqabclhqip4 , & ( ( npjij2cecc * ) ssGetContStateDisabled ( S ) ) -> cqabclhqip4 ) ; bemu4fk2sq ( S , _rtB -> jwapqatga5 , 0.0 , & _rtB -> n1qdzssqu3 , & _rtDW -> n1qdzssqu3 , ( mvw1gbh0c1 * ) & _rtP -> n1qdzssqu3 , & ( ( npjij2cecc * ) ssGetContStateDisabled ( S ) ) -> n1qdzssqu3 ) ; cqabclhqip ( S , _rtB -> p5ierutvgv , 0.0 , & _rtB -> nfugx5ih43 , & _rtDW -> nfugx5ih43 , ( nneyi35s1a * ) & _rtP -> nfugx5ih43 , & _rtX -> nfugx5ih43 , & ( ( npjij2cecc * ) ssGetContStateDisabled ( S ) ) -> nfugx5ih43 ) ; UNUSED_PARAMETER ( tid ) ; } static void mdlOutputsTID5 ( SimStruct * S ,