#include "__cf_CMFB.h"
#include <math.h>
#include "CMFB_acc.h"
#include "CMFB_acc_private.h"
#include <stdio.h>
#include "slexec_vm_simstruct_bridge.h"
#include "slexec_vm_zc_functions.h"
#include "slexec_vm_lookup_functions.h"
#include "simstruc.h"
#include "fixedpoint.h"
#define CodeFormat S-Function
#define AccDefine1 Accelerator_S-Function
#include "simtarget/slAccSfcnBridge.h"
#ifndef __RTW_UTFREE__  
extern void * utMalloc ( size_t ) ; extern void utFree ( void * ) ;
#endif
boolean_T CMFB_acc_rt_TDelayUpdateTailOrGrowBuf ( int_T * bufSzPtr , int_T *
tailPtr , int_T * headPtr , int_T * lastPtr , real_T tMinusDelay , real_T * *
tBufPtr , real_T * * uBufPtr , real_T * * xBufPtr , boolean_T isfixedbuf ,
boolean_T istransportdelay , int_T * maxNewBufSzPtr ) { int_T testIdx ; int_T
tail = * tailPtr ; int_T bufSz = * bufSzPtr ; real_T * tBuf = * tBufPtr ;
real_T * xBuf = ( NULL ) ; int_T numBuffer = 2 ; if ( istransportdelay ) {
numBuffer = 3 ; xBuf = * xBufPtr ; } testIdx = ( tail < ( bufSz - 1 ) ) ? (
tail + 1 ) : 0 ; if ( ( tMinusDelay <= tBuf [ testIdx ] ) && ! isfixedbuf ) {
int_T j ; real_T * tempT ; real_T * tempU ; real_T * tempX = ( NULL ) ;
real_T * uBuf = * uBufPtr ; int_T newBufSz = bufSz + 1024 ; if ( newBufSz > *
maxNewBufSzPtr ) { * maxNewBufSzPtr = newBufSz ; } tempU = ( real_T * )
utMalloc ( numBuffer * newBufSz * sizeof ( real_T ) ) ; if ( tempU == ( NULL
) ) { return ( false ) ; } tempT = tempU + newBufSz ; if ( istransportdelay )
tempX = tempT + newBufSz ; for ( j = tail ; j < bufSz ; j ++ ) { tempT [ j -
tail ] = tBuf [ j ] ; tempU [ j - tail ] = uBuf [ j ] ; if ( istransportdelay
) tempX [ j - tail ] = xBuf [ j ] ; } for ( j = 0 ; j < tail ; j ++ ) { tempT
[ j + bufSz - tail ] = tBuf [ j ] ; tempU [ j + bufSz - tail ] = uBuf [ j ] ;
if ( istransportdelay ) tempX [ j + bufSz - tail ] = xBuf [ j ] ; } if ( *
lastPtr > tail ) { * lastPtr -= tail ; } else { * lastPtr += ( bufSz - tail )
; } * tailPtr = 0 ; * headPtr = bufSz ; utFree ( uBuf ) ; * bufSzPtr =
newBufSz ; * tBufPtr = tempT ; * uBufPtr = tempU ; if ( istransportdelay ) *
xBufPtr = tempX ; } else { * tailPtr = testIdx ; } return ( true ) ; } real_T
CMFB_acc_rt_TDelayInterpolate ( real_T tMinusDelay , real_T tStart , real_T *
tBuf , 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
; if ( ( newIdx == 0 ) && ( oldestIdx == 0 ) && ( tMinusDelay > tStart ) )
return initOutput ; if ( tMinusDelay <= tStart ) return initOutput ; 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 ; yout = f1 * u1 +
f2 * u2 ; } return yout ; } } if ( minorStepAndTAtLastMajorOutput ) { if (
newIdx != 0 ) { if ( * lastIdx == newIdx ) { ( * lastIdx ) -- ; } newIdx -- ;
} else { if ( * lastIdx == newIdx ) { * lastIdx = bufSz - 1 ; } newIdx =
bufSz - 1 ; } } i = * lastIdx ; if ( tBuf [ i ] < tMinusDelay ) { while (
tBuf [ i ] < tMinusDelay ) { if ( i == newIdx ) break ; i = ( i < ( bufSz - 1
) ) ? ( i + 1 ) : 0 ; } } else { while ( tBuf [ i ] >= tMinusDelay ) { i = (
i > 0 ) ? i - 1 : ( bufSz - 1 ) ; } i = ( i < ( bufSz - 1 ) ) ? ( i + 1 ) : 0
; } * lastIdx = i ; if ( discrete ) { double tempEps = ( DBL_EPSILON ) *
128.0 ; double localEps = tempEps * muDoubleScalarAbs ( 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 ; yout = f1 * u1 + f2 * u2 ; } } return ( yout ) ; }
real_T rt_urand_Upu32_Yd_f_pw_snf ( uint32_T * u ) { uint32_T lo ; uint32_T
hi ; lo = * u % 127773U * 16807U ; hi = * u / 127773U * 2836U ; if ( lo < hi
) { * u = 2147483647U - ( hi - lo ) ; } else { * u = lo - hi ; } return (
real_T ) * u * 4.6566128752457969E-10 ; } real_T rt_nrand_Upu32_Yd_f_pw_snf (
uint32_T * u ) { real_T y ; real_T sr ; real_T si ; do { sr = 2.0 *
rt_urand_Upu32_Yd_f_pw_snf ( u ) - 1.0 ; si = 2.0 *
rt_urand_Upu32_Yd_f_pw_snf ( u ) - 1.0 ; si = sr * sr + si * si ; } while (
si > 1.0 ) ; y = muDoubleScalarSqrt ( - 2.0 * muDoubleScalarLog ( si ) / si )
* sr ; return y ; } static void mdlOutputs ( SimStruct * S , int_T tid ) {
ZCEventType zcEvent ; int8_T rtPrevAction ; int8_T rtAction ; real_T
taskTimeV ; uint32_T numCycles ; real_T ratio ; int32_T i ; real_T * tmp ;
B_CMFB_T * _rtB ; P_CMFB_T * _rtP ; PrevZCX_CMFB_T * _rtZCE ; DW_CMFB_T *
_rtDW ; _rtDW = ( ( DW_CMFB_T * ) ssGetRootDWork ( S ) ) ; _rtZCE = ( (
PrevZCX_CMFB_T * ) _ssGetPrevZCSigState ( S ) ) ; _rtP = ( ( P_CMFB_T * )
ssGetModelRtp ( S ) ) ; _rtB = ( ( B_CMFB_T * ) _ssGetModelBlockIO ( S ) ) ;
ssCallAccelRunBlock ( S , 2 , 1 , SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock
( S , 2 , 2 , SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 2 , 0 ) ) { if
( _rtDW -> NextOutput > _rtP -> P_27 ) { _rtB -> B_2_5_0 = _rtDW ->
NextOutput ; } else { _rtB -> B_2_5_0 = _rtB -> B_2_4_0 ; } } { real_T * *
uBuffer = ( real_T * * ) & _rtDW -> VariableTimeDelay_PWORK . TUbufferPtrs [
0 ] ; real_T * * tBuffer = ( real_T * * ) & _rtDW -> VariableTimeDelay_PWORK
. TUbufferPtrs [ 1 ] ; real_T simTime = ssGetT ( S ) ; real_T appliedDelay ;
appliedDelay = _rtB -> B_2_5_0 ; if ( appliedDelay > _rtP -> P_28 ) {
appliedDelay = _rtP -> P_28 ; } if ( appliedDelay < 0.0 ) { appliedDelay =
0.0 ; } if ( appliedDelay == 0.0 ) { _rtB -> B_2_6_0 = _rtB -> B_2_2_0 ; }
else { _rtB -> B_2_6_0 = CMFB_acc_rt_TDelayInterpolate ( simTime -
appliedDelay , 0.0 , * tBuffer , * uBuffer , _rtDW -> VariableTimeDelay_IWORK
. CircularBufSize , & _rtDW -> VariableTimeDelay_IWORK . Last , _rtDW ->
VariableTimeDelay_IWORK . Tail , _rtDW -> VariableTimeDelay_IWORK . Head ,
_rtP -> P_29 , 0 , ( boolean_T ) ( ssIsMinorTimeStep ( S ) && (
ssGetTimeOfLastOutput ( S ) == ssGetT ( S ) ) ) ) ; } } if ( ssIsSampleHit (
S , 1 , 0 ) ) { zcEvent = rt_ZCFcn ( FALLING_ZERO_CROSSING , & _rtZCE ->
DetectEventwiththreshold_Input_ZCE , ( _rtB -> B_2_6_0 - _rtP -> P_30 ) ) ;
if ( _rtDW -> DetectEventwiththreshold_MODE == 0 ) { if ( zcEvent !=
NO_ZCEVENT ) { _rtB -> B_2_7_0 = ! _rtB -> B_2_7_0 ; _rtDW ->
DetectEventwiththreshold_MODE = 1 ; } else { if ( _rtB -> B_2_7_0 && ( _rtB
-> B_2_6_0 != _rtP -> P_30 ) ) { _rtB -> B_2_7_0 = false ; } } } else { if (
_rtB -> B_2_6_0 != _rtP -> P_30 ) { _rtB -> B_2_7_0 = false ; } _rtDW ->
DetectEventwiththreshold_MODE = 0 ; } _rtB -> B_2_8_0 = _rtDW ->
Memory_PreviousInput ; } if ( _rtB -> B_2_7_0 ) { _rtB -> B_2_9_0 = ssGetT (
S ) ; } else { _rtB -> B_2_9_0 = _rtB -> B_2_8_0 ; } ssCallAccelRunBlock ( S
, 2 , 10 , SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 2 , 0 ) ) { if (
_rtDW -> NextOutput_b > _rtP -> P_35 ) { _rtB -> B_2_13_0 = _rtDW ->
NextOutput_b ; } else { _rtB -> B_2_13_0 = _rtB -> B_2_4_0 ; } } { real_T * *
uBuffer = ( real_T * * ) & _rtDW -> VariableTimeDelay1_PWORK . TUbufferPtrs [
0 ] ; real_T * * tBuffer = ( real_T * * ) & _rtDW -> VariableTimeDelay1_PWORK
. TUbufferPtrs [ 1 ] ; real_T simTime = ssGetT ( S ) ; real_T appliedDelay ;
appliedDelay = _rtB -> B_2_13_0 ; if ( appliedDelay > _rtP -> P_36 ) {
appliedDelay = _rtP -> P_36 ; } if ( appliedDelay < 0.0 ) { appliedDelay =
0.0 ; } if ( appliedDelay == 0.0 ) { _rtB -> B_2_14_0 = _rtB -> B_2_2_0 ; }
else { _rtB -> B_2_14_0 = CMFB_acc_rt_TDelayInterpolate ( simTime -
appliedDelay , 0.0 , * tBuffer , * uBuffer , _rtDW ->
VariableTimeDelay1_IWORK . CircularBufSize , & _rtDW ->
VariableTimeDelay1_IWORK . Last , _rtDW -> VariableTimeDelay1_IWORK . Tail ,
_rtDW -> VariableTimeDelay1_IWORK . Head , _rtP -> P_37 , 0 , ( boolean_T ) (
ssIsMinorTimeStep ( S ) && ( ssGetTimeOfLastOutput ( S ) == ssGetT ( S ) ) )
) ; } } if ( ssIsSampleHit ( S , 1 , 0 ) ) { zcEvent = rt_ZCFcn (
FALLING_ZERO_CROSSING , & _rtZCE -> DetectEventwiththreshold1_Input_ZCE , (
_rtB -> B_2_14_0 - _rtP -> P_38 ) ) ; if ( _rtDW ->
DetectEventwiththreshold1_MODE == 0 ) { if ( zcEvent != NO_ZCEVENT ) { _rtB
-> B_2_15_0 = ! _rtB -> B_2_15_0 ; _rtDW -> DetectEventwiththreshold1_MODE =
1 ; } else { if ( _rtB -> B_2_15_0 && ( _rtB -> B_2_14_0 != _rtP -> P_38 ) )
{ _rtB -> B_2_15_0 = false ; } } } else { if ( _rtB -> B_2_14_0 != _rtP ->
P_38 ) { _rtB -> B_2_15_0 = false ; } _rtDW -> DetectEventwiththreshold1_MODE
= 0 ; } _rtB -> B_2_16_0 = _rtDW -> Memory1_PreviousInput ; } if ( _rtB ->
B_2_15_0 ) { _rtB -> B_2_17_0 = ssGetT ( S ) ; } else { _rtB -> B_2_17_0 =
_rtB -> B_2_16_0 ; } ssCallAccelRunBlock ( S , 2 , 18 , SS_CALL_MDL_OUTPUTS )
; if ( ssIsSampleHit ( S , 2 , 0 ) ) { if ( _rtDW -> NextOutput_j > _rtP ->
P_43 ) { _rtB -> B_2_21_0 = _rtDW -> NextOutput_j ; } else { _rtB -> B_2_21_0
= _rtB -> B_2_4_0 ; } } { real_T * * uBuffer = ( real_T * * ) & _rtDW ->
VariableTimeDelay2_PWORK . TUbufferPtrs [ 0 ] ; real_T * * tBuffer = ( real_T
* * ) & _rtDW -> VariableTimeDelay2_PWORK . TUbufferPtrs [ 1 ] ; real_T
simTime = ssGetT ( S ) ; real_T appliedDelay ; appliedDelay = _rtB ->
B_2_21_0 ; if ( appliedDelay > _rtP -> P_44 ) { appliedDelay = _rtP -> P_44 ;
} if ( appliedDelay < 0.0 ) { appliedDelay = 0.0 ; } if ( appliedDelay == 0.0
) { _rtB -> B_2_22_0 = _rtB -> B_2_2_0 ; } else { _rtB -> B_2_22_0 =
CMFB_acc_rt_TDelayInterpolate ( simTime - appliedDelay , 0.0 , * tBuffer , *
uBuffer , _rtDW -> VariableTimeDelay2_IWORK . CircularBufSize , & _rtDW ->
VariableTimeDelay2_IWORK . Last , _rtDW -> VariableTimeDelay2_IWORK . Tail ,
_rtDW -> VariableTimeDelay2_IWORK . Head , _rtP -> P_45 , 0 , ( boolean_T ) (
ssIsMinorTimeStep ( S ) && ( ssGetTimeOfLastOutput ( S ) == ssGetT ( S ) ) )
) ; } } if ( ssIsSampleHit ( S , 1 , 0 ) ) { zcEvent = rt_ZCFcn (
FALLING_ZERO_CROSSING , & _rtZCE -> DetectEventwiththreshold2_Input_ZCE , (
_rtB -> B_2_22_0 - _rtP -> P_46 ) ) ; if ( _rtDW ->
DetectEventwiththreshold2_MODE == 0 ) { if ( zcEvent != NO_ZCEVENT ) { _rtB
-> B_2_23_0 = ! _rtB -> B_2_23_0 ; _rtDW -> DetectEventwiththreshold2_MODE =
1 ; } else { if ( _rtB -> B_2_23_0 && ( _rtB -> B_2_22_0 != _rtP -> P_46 ) )
{ _rtB -> B_2_23_0 = false ; } } } else { if ( _rtB -> B_2_22_0 != _rtP ->
P_46 ) { _rtB -> B_2_23_0 = false ; } _rtDW -> DetectEventwiththreshold2_MODE
= 0 ; } _rtB -> B_2_24_0 = _rtDW -> Memory2_PreviousInput ; } if ( _rtB ->
B_2_23_0 ) { _rtB -> B_2_25_0 = ssGetT ( S ) ; } else { _rtB -> B_2_25_0 =
_rtB -> B_2_24_0 ; } ssCallAccelRunBlock ( S , 2 , 26 , SS_CALL_MDL_OUTPUTS )
; ssCallAccelRunBlock ( S , 2 , 27 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 28 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 29 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 30 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 31 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 32 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 33 , SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit
( S , 1 , 0 ) ) { zcEvent = rt_ZCFcn ( FALLING_ZERO_CROSSING , & _rtZCE ->
DetectEventwiththreshold_Input_ZCE_h , ( _rtB -> B_2_2_0 - _rtP -> P_49 ) ) ;
if ( _rtDW -> DetectEventwiththreshold_MODE_g == 0 ) { if ( zcEvent !=
NO_ZCEVENT ) { _rtB -> B_2_36_0 = ! _rtB -> B_2_36_0 ; _rtDW ->
DetectEventwiththreshold_MODE_g = 1 ; } else { if ( _rtB -> B_2_36_0 && (
_rtB -> B_2_2_0 != _rtP -> P_49 ) ) { _rtB -> B_2_36_0 = false ; } } } else {
if ( _rtB -> B_2_2_0 != _rtP -> P_49 ) { _rtB -> B_2_36_0 = false ; } _rtDW
-> DetectEventwiththreshold_MODE_g = 0 ; } _rtB -> B_2_37_0 = _rtDW ->
Memory_PreviousInput_m ; } if ( _rtB -> B_2_36_0 ) { _rtB -> B_2_38_0 =
ssGetT ( S ) ; } else { _rtB -> B_2_38_0 = _rtB -> B_2_37_0 ; } if (
ssIsSampleHit ( S , 3 , 0 ) ) { taskTimeV = ssGetTaskTime ( S , 3 ) ; if (
ssGetTNextWasAdjusted ( S , 3 ) ) { _rtDW -> nextTime = _ssGetVarNextHitTime
( S , 0 ) ; } if ( _rtDW -> justEnabled != 0 ) { _rtDW -> justEnabled = 0 ;
if ( taskTimeV >= _rtP -> P_54 ) { ratio = ( taskTimeV - _rtP -> P_54 ) /
_rtP -> P_52 ; numCycles = ( uint32_T ) muDoubleScalarFloor ( ratio ) ; if (
muDoubleScalarAbs ( ( real_T ) ( numCycles + 1U ) - ratio ) < DBL_EPSILON *
ratio ) { numCycles ++ ; } _rtDW -> numCompleteCycles = numCycles ; ratio = (
( real_T ) numCycles * _rtP -> P_52 + _rtP -> P_54 ) + _rtP -> P_53 * _rtP ->
P_52 / 100.0 ; if ( taskTimeV < ratio ) { _rtDW -> currentValue = 1 ; _rtDW
-> nextTime = ratio ; } else { _rtDW -> currentValue = 0 ; _rtDW -> nextTime
= ( real_T ) ( numCycles + 1U ) * _rtP -> P_52 + _rtP -> P_54 ; } } else {
_rtDW -> numCompleteCycles = _rtP -> P_54 != 0.0 ? - 1 : 0 ; _rtDW ->
currentValue = 0 ; _rtDW -> nextTime = _rtP -> P_54 ; } } else { if ( _rtDW
-> nextTime <= taskTimeV ) { if ( _rtDW -> currentValue == 1 ) { _rtDW ->
currentValue = 0 ; _rtDW -> nextTime = ( real_T ) ( _rtDW ->
numCompleteCycles + 1L ) * _rtP -> P_52 + _rtP -> P_54 ; } else { _rtDW ->
numCompleteCycles ++ ; _rtDW -> currentValue = 1 ; _rtDW -> nextTime = ( _rtP
-> P_53 * _rtP -> P_52 * 0.01 + ( real_T ) _rtDW -> numCompleteCycles * _rtP
-> P_52 ) + _rtP -> P_54 ; } } } _ssSetVarNextHitTime ( S , 0 , _rtDW ->
nextTime ) ; if ( _rtDW -> currentValue == 1 ) { _rtB -> B_2_39_0 = _rtP ->
P_51 ; } else { _rtB -> B_2_39_0 = 0.0 ; } } ssCallAccelRunBlock ( S , 2 , 40
, SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) {
ssCallAccelRunBlock ( S , 2 , 41 , SS_CALL_MDL_OUTPUTS ) ; } if (
ssIsMajorTimeStep ( S ) ) { _rtDW -> Switch_Mode = ( _rtB -> B_2_38_0 > _rtP
-> P_56 ) ; } if ( _rtDW -> Switch_Mode ) { taskTimeV = _rtB -> B_2_38_0 ; }
else { taskTimeV = _rtB -> B_2_42_0 ; } _rtB -> B_2_44_0 = _rtB -> B_2_34_0 -
taskTimeV ; if ( ssIsMajorTimeStep ( S ) ) { _rtDW -> Abs_MODE = ( _rtB ->
B_2_44_0 >= 0.0 ) ; } _rtB -> B_2_45_0 = _rtDW -> Abs_MODE > 0 ? _rtB ->
B_2_44_0 : - _rtB -> B_2_44_0 ; ssCallAccelRunBlock ( S , 2 , 46 ,
SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 4 , 0 ) ) { taskTimeV =
ssGetTaskTime ( S , 4 ) ; if ( ssGetTNextWasAdjusted ( S , 4 ) ) { _rtDW ->
nextTime_b = _ssGetVarNextHitTime ( S , 1 ) ; } if ( _rtDW -> justEnabled_h
!= 0 ) { _rtDW -> justEnabled_h = 0 ; if ( taskTimeV >= _rtP -> P_60 ) {
ratio = ( taskTimeV - _rtP -> P_60 ) / _rtP -> P_58 ; numCycles = ( uint32_T
) muDoubleScalarFloor ( ratio ) ; if ( muDoubleScalarAbs ( ( real_T ) (
numCycles + 1U ) - ratio ) < DBL_EPSILON * ratio ) { numCycles ++ ; } _rtDW
-> numCompleteCycles_j = numCycles ; ratio = ( ( real_T ) numCycles * _rtP ->
P_58 + _rtP -> P_60 ) + _rtP -> P_59 * _rtP -> P_58 / 100.0 ; if ( taskTimeV
< ratio ) { _rtDW -> currentValue_h = 1 ; _rtDW -> nextTime_b = ratio ; }
else { _rtDW -> currentValue_h = 0 ; _rtDW -> nextTime_b = ( real_T ) (
numCycles + 1U ) * _rtP -> P_58 + _rtP -> P_60 ; } } else { _rtDW ->
numCompleteCycles_j = _rtP -> P_60 != 0.0 ? - 1 : 0 ; _rtDW -> currentValue_h
= 0 ; _rtDW -> nextTime_b = _rtP -> P_60 ; } } else { if ( _rtDW ->
nextTime_b <= taskTimeV ) { if ( _rtDW -> currentValue_h == 1 ) { _rtDW ->
currentValue_h = 0 ; _rtDW -> nextTime_b = ( real_T ) ( _rtDW ->
numCompleteCycles_j + 1L ) * _rtP -> P_58 + _rtP -> P_60 ; } else { _rtDW ->
numCompleteCycles_j ++ ; _rtDW -> currentValue_h = 1 ; _rtDW -> nextTime_b =
( _rtP -> P_59 * _rtP -> P_58 * 0.01 + ( real_T ) _rtDW ->
numCompleteCycles_j * _rtP -> P_58 ) + _rtP -> P_60 ; } } }
_ssSetVarNextHitTime ( S , 1 , _rtDW -> nextTime_b ) ; if ( _rtDW ->
currentValue_h == 1 ) { _rtB -> B_2_47_0 = _rtP -> P_57 ; } else { _rtB ->
B_2_47_0 = 0.0 ; } } ssCallAccelRunBlock ( S , 2 , 48 , SS_CALL_MDL_OUTPUTS )
; if ( ssIsSampleHit ( S , 1 , 0 ) ) { ssCallAccelRunBlock ( S , 2 , 49 ,
SS_CALL_MDL_OUTPUTS ) ; } ssCallAccelRunBlock ( S , 2 , 50 ,
SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) {
ssCallAccelRunBlock ( S , 2 , 51 , SS_CALL_MDL_OUTPUTS ) ; }
ssCallAccelRunBlock ( S , 2 , 52 , SS_CALL_MDL_OUTPUTS ) ; _rtB -> B_2_60_0 =
_rtB -> B_2_28_0 [ 18 ] * _rtB -> B_2_59_0 ; if ( ssIsMajorTimeStep ( S ) ) {
taskTimeV = _rtB -> B_2_60_0 ; _rtDW -> MinMax1_MODE = 0 ; if ( _rtB ->
B_2_61_0 < _rtB -> B_2_60_0 ) { taskTimeV = _rtB -> B_2_61_0 ; _rtDW ->
MinMax1_MODE = 1 ; } _rtB -> B_2_62_0 = taskTimeV ; } else { taskTimeV = _rtB
-> B_2_60_0 ; if ( _rtDW -> MinMax1_MODE == 1 ) { taskTimeV = _rtB ->
B_2_61_0 ; } _rtB -> B_2_62_0 = taskTimeV ; } _rtB -> B_2_63_0 = _rtB ->
B_2_62_0 / 0.56 + 1.0 ; if ( ssIsMajorTimeStep ( S ) ) { taskTimeV = _rtB ->
B_2_63_0 ; _rtDW -> MinMax3_MODE = 0 ; if ( _rtB -> B_2_61_0 > _rtB ->
B_2_63_0 ) { taskTimeV = _rtB -> B_2_61_0 ; _rtDW -> MinMax3_MODE = 1 ; }
_rtB -> B_2_64_0 = taskTimeV ; } else { taskTimeV = _rtB -> B_2_63_0 ; if (
_rtDW -> MinMax3_MODE == 1 ) { taskTimeV = _rtB -> B_2_61_0 ; } _rtB ->
B_2_64_0 = taskTimeV ; } _rtB -> B_2_65_0 = _rtB -> B_2_47_0 * _rtB ->
B_2_58_0 * _rtB -> B_2_64_0 ; _rtB -> B_2_67_0 = _rtB -> B_2_66_0 - _rtB ->
B_2_28_0 [ 17 ] ; if ( ssIsMajorTimeStep ( S ) ) { _rtDW -> Saturation1_MODE
= _rtB -> B_2_67_0 >= _rtP -> P_65 ? 1 : _rtB -> B_2_67_0 > _rtP -> P_66 ? 0
: - 1 ; } _rtB -> B_2_68_0 = _rtDW -> Saturation1_MODE == 1 ? _rtP -> P_65 :
_rtDW -> Saturation1_MODE == - 1 ? _rtP -> P_66 : _rtB -> B_2_67_0 ; _rtB ->
B_2_69_0 = ( muDoubleScalarExp ( 6.0 * _rtB -> B_2_68_0 / 0.07 ) - 1.0 ) *
0.0056000000000000008 + 0.0044800000000000005 * _rtB -> B_2_60_0 / 0.07 ; if
( ssIsMajorTimeStep ( S ) ) { taskTimeV = _rtB -> B_2_69_0 ; _rtDW ->
MinMax2_MODE = 0 ; if ( _rtB -> B_2_61_0 > _rtB -> B_2_69_0 ) { taskTimeV =
_rtB -> B_2_61_0 ; _rtDW -> MinMax2_MODE = 1 ; } _rtB -> B_2_70_0 = taskTimeV
; taskTimeV = _rtB -> B_2_28_0 [ 18 ] ; _rtDW -> MinMax1_MODE_b = 0 ; if (
_rtB -> B_2_74_0 < _rtB -> B_2_28_0 [ 18 ] ) { taskTimeV = _rtB -> B_2_74_0 ;
_rtDW -> MinMax1_MODE_b = 1 ; } _rtB -> B_2_75_0 = taskTimeV ; } else {
taskTimeV = _rtB -> B_2_69_0 ; if ( _rtDW -> MinMax2_MODE == 1 ) { taskTimeV
= _rtB -> B_2_61_0 ; } _rtB -> B_2_70_0 = taskTimeV ; taskTimeV = _rtB ->
B_2_28_0 [ 18 ] ; if ( _rtDW -> MinMax1_MODE_b == 1 ) { taskTimeV = _rtB ->
B_2_74_0 ; } _rtB -> B_2_75_0 = taskTimeV ; } _rtB -> B_2_71_0 = _rtB ->
B_2_65_0 + _rtB -> B_2_70_0 ; _rtB -> B_2_72_0 [ 0 ] = _rtB -> B_2_71_0 ;
_rtB -> B_2_72_0 [ 1 ] = 0.0 ; _rtB -> B_2_72_0 [ 2 ] = 0.0 ; _rtB ->
B_2_72_0 [ 3 ] = 0.0 ; _rtB -> B_2_76_0 = _rtB -> B_2_75_0 / 0.56 + 1.0 ; if
( ssIsMajorTimeStep ( S ) ) { taskTimeV = _rtB -> B_2_76_0 ; _rtDW ->
MinMax3_MODE_m = 0 ; if ( _rtB -> B_2_74_0 > _rtB -> B_2_76_0 ) { taskTimeV =
_rtB -> B_2_74_0 ; _rtDW -> MinMax3_MODE_m = 1 ; } _rtB -> B_2_77_0 =
taskTimeV ; } else { taskTimeV = _rtB -> B_2_76_0 ; if ( _rtDW ->
MinMax3_MODE_m == 1 ) { taskTimeV = _rtB -> B_2_74_0 ; } _rtB -> B_2_77_0 =
taskTimeV ; } _rtB -> B_2_78_0 = _rtB -> B_2_39_0 * _rtB -> B_2_73_0 * _rtB
-> B_2_77_0 ; _rtB -> B_2_80_0 = _rtB -> B_2_67_0 * _rtB -> B_2_79_0 ; if (
ssIsMajorTimeStep ( S ) ) { _rtDW -> Saturation_MODE = _rtB -> B_2_80_0 >=
_rtP -> P_70 ? 1 : _rtB -> B_2_80_0 > _rtP -> P_71 ? 0 : - 1 ; } _rtB ->
B_2_81_0 = _rtDW -> Saturation_MODE == 1 ? _rtP -> P_70 : _rtDW ->
Saturation_MODE == - 1 ? _rtP -> P_71 : _rtB -> B_2_80_0 ; _rtB -> B_2_82_0 =
( muDoubleScalarExp ( 6.0 * _rtB -> B_2_81_0 / 0.07 ) - 1.0 ) *
0.0056000000000000008 + 0.0044800000000000005 * _rtB -> B_2_28_0 [ 18 ] /
0.07 ; if ( ssIsMajorTimeStep ( S ) ) { taskTimeV = _rtB -> B_2_82_0 ; _rtDW
-> MinMax2_MODE_i = 0 ; if ( _rtB -> B_2_74_0 > _rtB -> B_2_82_0 ) {
taskTimeV = _rtB -> B_2_74_0 ; _rtDW -> MinMax2_MODE_i = 1 ; } _rtB ->
B_2_83_0 = taskTimeV ; } else { taskTimeV = _rtB -> B_2_82_0 ; if ( _rtDW ->
MinMax2_MODE_i == 1 ) { taskTimeV = _rtB -> B_2_74_0 ; } _rtB -> B_2_83_0 =
taskTimeV ; } _rtB -> B_2_84_0 = ( 0.0 - _rtB -> B_2_78_0 ) - _rtB ->
B_2_83_0 ; _rtB -> B_2_85_0 [ 0 ] = _rtB -> B_2_84_0 ; _rtB -> B_2_85_0 [ 1 ]
= 0.0 ; _rtB -> B_2_85_0 [ 2 ] = 0.0 ; _rtB -> B_2_85_0 [ 3 ] = 0.0 ; _rtB ->
B_2_86_0 = 0.0 ; _rtB -> B_2_86_0 += _rtB -> B_2_72_0 [ 0 ] ; _rtB ->
B_2_86_0 += _rtB -> B_2_85_0 [ 0 ] ; _rtB -> B_2_87_0 [ 0 ] = _rtB ->
B_2_86_0 ; _rtB -> B_2_87_0 [ 1 ] = 0.0 ; _rtB -> B_2_87_0 [ 2 ] = 0.0 ; _rtB
-> B_2_87_0 [ 3 ] = 0.0 ; _rtB -> B_2_90_0 = _rtB -> B_2_88_0 -
muDoubleScalarAbs ( _rtB -> B_2_28_0 [ 2 ] ) ; _rtB -> B_2_92_0 =
muDoubleScalarAbs ( _rtB -> B_2_28_0 [ 1 ] ) ; _rtB -> B_2_93_0 = _rtB ->
B_2_91_0 - _rtB -> B_2_92_0 ; if ( ssIsMajorTimeStep ( S ) ) { if ( _rtB ->
B_2_93_0 > _rtP -> P_75 ) { _rtDW -> DeadZone_MODE = 1 ; } else if ( _rtB ->
B_2_93_0 >= _rtP -> P_74 ) { _rtDW -> DeadZone_MODE = 0 ; } else { _rtDW ->
DeadZone_MODE = - 1 ; } } if ( _rtDW -> DeadZone_MODE == 1 ) { _rtB ->
B_2_94_0 = _rtB -> B_2_93_0 - _rtP -> P_75 ; } else if ( _rtDW ->
DeadZone_MODE == - 1 ) { _rtB -> B_2_94_0 = _rtB -> B_2_93_0 - _rtP -> P_74 ;
} else { _rtB -> B_2_94_0 = 0.0 ; } _rtB -> B_2_95_0 = muDoubleScalarSign (
_rtB -> B_2_28_0 [ 1 ] ) ; _rtB -> B_2_96_0 = _rtB -> B_2_95_0 * _rtB ->
B_2_28_0 [ 3 ] ; _rtB -> B_2_97_0 = _rtP -> P_76 * _rtB -> B_2_96_0 ; _rtB ->
B_2_98_0 = muDoubleScalarSign ( _rtB -> B_2_28_0 [ 3 ] ) ; tmp = & _rtB ->
B_2_28_0 [ 5 ] ; _rtB -> B_2_99_0 [ 0 ] = tmp [ 0 ] ; _rtB -> B_2_99_0 [ 1 ]
= tmp [ 3 ] ; rtPrevAction = _rtDW -> If_ActiveSubsystem ; if (
ssIsMajorTimeStep ( S ) ) { rtAction = ( int8_T ) ! ( ( _rtB -> B_2_90_0 >
0.0 ) && ( _rtB -> B_2_94_0 > 0.0 ) ) ; _rtDW -> If_ActiveSubsystem =
rtAction ; } else { rtAction = _rtDW -> If_ActiveSubsystem ; } if (
rtPrevAction != rtAction ) { switch ( rtPrevAction ) { case 0 :
ssSetSolverNeedsReset ( S ) ; break ; case 1 : ssSetSolverNeedsReset ( S ) ;
break ; } } switch ( rtAction ) { case 0 : if ( rtAction != rtPrevAction ) {
if ( ssGetTaskTime ( S , 0 ) != ssGetTStart ( S ) ) { ssSetSolverNeedsReset (
S ) ; } } if ( ( _rtB -> B_2_94_0 < 0.0 ) && ( _rtB -> B_0_0_0 >
muDoubleScalarFloor ( _rtB -> B_0_0_0 ) ) ) { taskTimeV = -
muDoubleScalarPower ( - _rtB -> B_2_94_0 , _rtB -> B_0_0_0 ) ; } else {
taskTimeV = muDoubleScalarPower ( _rtB -> B_2_94_0 , _rtB -> B_0_0_0 ) ; }
_rtB -> B_0_2_0 = _rtP -> P_1 * taskTimeV ; if ( _rtB -> B_2_97_0 > _rtP ->
P_2 ) { _rtB -> B_0_3_0 = _rtP -> P_2 ; } else if ( _rtB -> B_2_97_0 < _rtP
-> P_3 ) { _rtB -> B_0_3_0 = _rtP -> P_3 ; } else { _rtB -> B_0_3_0 = _rtB ->
B_2_97_0 ; } _rtB -> B_0_4_0 = _rtP -> P_4 * _rtB -> B_0_3_0 ; if (
ssIsMajorTimeStep ( S ) ) { _rtDW -> Clamp_MODE = _rtB -> B_2_94_0 >= _rtP ->
P_6 ? 1 : _rtB -> B_2_94_0 > _rtP -> P_7 ? 0 : - 1 ; } _rtB -> B_0_6_0 =
_rtDW -> Clamp_MODE == 1 ? _rtP -> P_6 : _rtDW -> Clamp_MODE == - 1 ? _rtP ->
P_7 : _rtB -> B_2_94_0 ; _rtB -> B_0_8_0 = _rtB -> B_0_6_0 - _rtB -> B_0_7_0
; _rtB -> B_0_11_0 = _rtB -> B_0_8_0 / _rtB -> B_0_10_0 ; _rtB -> B_0_12_0 =
_rtP -> P_10 * _rtB -> B_0_11_0 ; _rtB -> B_0_13_0 = _rtB -> B_0_5_0 - _rtB
-> B_0_12_0 ; _rtB -> B_0_17_0 = _rtB -> B_0_13_0 * _rtB -> B_0_11_0 * _rtB
-> B_0_11_0 * _rtB -> B_0_16_0 ; _rtB -> B_0_18_0 = _rtB -> B_0_17_0 + _rtB
-> B_0_15_0 ; _rtB -> B_0_19_0 = _rtB -> B_0_18_0 * _rtB -> B_0_4_0 ; _rtB ->
B_0_20_0 = _rtB -> B_2_95_0 * _rtB -> B_0_2_0 ; _rtB -> B_0_21_0 = _rtB ->
B_2_98_0 * _rtB -> B_0_19_0 ; _rtB -> B_0_22_0 = _rtB -> B_0_20_0 + _rtB ->
B_0_21_0 ; _rtB -> B_0_23_0 = _rtB -> B_0_22_0 * _rtB -> B_2_28_0 [ 2 ] ;
_rtB -> B_2_103_0 [ 3 ] = _rtB -> B_0_25_0 + _rtB -> B_0_22_0 ; _rtB ->
B_0_24_0 [ 0 ] = _rtB -> B_0_22_0 * _rtB -> B_2_99_0 [ 0 ] ; _rtB -> B_0_28_0
[ 0 ] = _rtP -> P_15 [ 0 ] * _rtB -> B_2_99_0 [ 0 ] ; _rtB -> B_0_24_0 [ 1 ]
= _rtB -> B_0_22_0 * _rtB -> B_2_99_0 [ 1 ] ; _rtB -> B_0_28_0 [ 1 ] = _rtP
-> P_15 [ 1 ] * _rtB -> B_2_99_0 [ 1 ] ; if ( ssIsSampleHit ( S , 1 , 0 ) ) {
if ( _rtB -> B_2_28_0 [ 1 ] > 0.0 ) { _rtDW -> Sign_MODE = 1 ; } else if (
_rtB -> B_2_28_0 [ 1 ] < 0.0 ) { _rtDW -> Sign_MODE = - 1 ; } else { _rtDW ->
Sign_MODE = 0 ; } _rtB -> B_0_31_0 = _rtDW -> Sign_MODE ; } _rtB -> B_0_32_0
= _rtB -> B_0_29_0 * _rtB -> B_0_31_0 ; _rtB -> B_0_33_0 [ 0 ] = _rtB ->
B_0_28_0 [ 0 ] * _rtB -> B_0_31_0 ; _rtB -> B_0_34_0 [ 0 ] = _rtB -> B_0_33_0
[ 0 ] * _rtB -> B_0_29_0 ; _rtB -> B_0_33_0 [ 1 ] = _rtB -> B_0_28_0 [ 1 ] *
_rtB -> B_0_31_0 ; _rtB -> B_0_34_0 [ 1 ] = _rtB -> B_0_33_0 [ 1 ] * _rtB ->
B_0_29_0 ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { _rtB -> B_2_103_0 [ 2 ] =
_rtP -> P_18 * _rtB -> B_0_29_0 ; if ( _rtB -> B_2_28_0 [ 1 ] > 0.0 ) { _rtDW
-> Sign1_MODE = 1 ; } else if ( _rtB -> B_2_28_0 [ 1 ] < 0.0 ) { _rtDW ->
Sign1_MODE = - 1 ; } else { _rtDW -> Sign1_MODE = 0 ; } } _rtB -> B_0_37_0 =
_rtP -> P_19 * _rtB -> B_0_23_0 ; _rtB -> B_2_103_0 [ 5 ] = _rtB -> B_0_30_0
+ _rtB -> B_0_37_0 ; _rtB -> B_2_103_0 [ 0 ] = _rtB -> B_0_24_0 [ 0 ] + _rtB
-> B_0_34_0 [ 1 ] ; _rtB -> B_2_103_0 [ 1 ] = _rtB -> B_0_24_0 [ 1 ] + _rtB
-> B_0_34_0 [ 0 ] ; _rtB -> B_2_103_0 [ 4 ] = _rtB -> B_0_32_0 + _rtB ->
B_0_27_0 ; _rtB -> B_0_42_0 = muDoubleScalarAbs ( _rtB -> B_0_22_0 ) ; _rtB
-> B_2_136_0 [ 0 ] = _rtB -> B_0_42_0 + _rtB -> B_0_43_0 ; _rtB -> B_2_136_0
[ 1 ] = _rtB -> B_0_29_0 + _rtB -> B_0_43_0 ; if ( ssIsMajorTimeStep ( S ) )
{ srUpdateBC ( _rtDW -> Forces_SubsysRanBC ) ; } break ; case 1 : if (
rtAction != rtPrevAction ) { if ( ssGetTaskTime ( S , 0 ) != ssGetTStart ( S
) ) { ssSetSolverNeedsReset ( S ) ; } } if ( ssIsSampleHit ( S , 1 , 0 ) ) {
_rtB -> B_2_136_0 [ 0 ] = _rtP -> P_21 [ 0 ] ; _rtB -> B_2_136_0 [ 1 ] = _rtP
-> P_21 [ 1 ] ; for ( i = 0 ; i < 6 ; i ++ ) { _rtB -> B_2_103_0 [ i ] = _rtP
-> P_22 [ i ] ; } } if ( ssIsMajorTimeStep ( S ) ) { srUpdateBC ( _rtDW ->
NoForce_SubsysRanBC ) ; } break ; } _rtB -> B_2_104_0 [ 0 ] = _rtP -> P_78 *
_rtB -> B_2_103_0 [ 0 ] ; _rtB -> B_2_104_0 [ 1 ] = _rtP -> P_78 * _rtB ->
B_2_103_0 [ 1 ] ; _rtB -> B_2_104_0 [ 2 ] = _rtP -> P_78 * _rtB -> B_2_103_0
[ 2 ] ; _rtB -> B_2_105_0 [ 0 ] = _rtB -> B_2_104_0 [ 0 ] ; _rtB -> B_2_105_0
[ 1 ] = 0.0 ; _rtB -> B_2_105_0 [ 2 ] = 0.0 ; _rtB -> B_2_105_0 [ 3 ] = 0.0 ;
_rtB -> B_2_106_0 [ 0 ] = _rtB -> B_2_104_0 [ 1 ] ; _rtB -> B_2_106_0 [ 1 ] =
0.0 ; _rtB -> B_2_106_0 [ 2 ] = 0.0 ; _rtB -> B_2_106_0 [ 3 ] = 0.0 ; _rtB ->
B_2_108_0 [ 0 ] = _rtB -> B_2_107_0 ; _rtB -> B_2_108_0 [ 1 ] = 0.0 ; _rtB ->
B_2_108_0 [ 2 ] = 0.0 ; if ( ssIsMajorTimeStep ( S ) ) { _rtDW ->
INPUT_5_1_1_discrete [ 0 ] = ! ( _rtB -> B_2_108_0 [ 0 ] == _rtDW ->
INPUT_5_1_1_discrete [ 1 ] ) ; _rtDW -> INPUT_5_1_1_discrete [ 1 ] = _rtB ->
B_2_108_0 [ 0 ] ; } _rtB -> B_2_108_0 [ 0 ] = _rtDW -> INPUT_5_1_1_discrete [
1 ] ; _rtB -> B_2_108_0 [ 3 ] = _rtDW -> INPUT_5_1_1_discrete [ 0 ] ; _rtB ->
B_2_109_0 [ 0 ] = _rtB -> B_2_104_0 [ 2 ] ; _rtB -> B_2_109_0 [ 1 ] = 0.0 ;
_rtB -> B_2_109_0 [ 2 ] = 0.0 ; _rtB -> B_2_109_0 [ 3 ] = 0.0 ; _rtB ->
B_2_110_0 [ 0 ] = _rtP -> P_80 * _rtB -> B_2_103_0 [ 3 ] ; _rtB -> B_2_110_0
[ 1 ] = _rtP -> P_80 * _rtB -> B_2_103_0 [ 4 ] ; _rtB -> B_2_110_0 [ 2 ] =
_rtP -> P_80 * _rtB -> B_2_103_0 [ 5 ] ; _rtB -> B_2_111_0 [ 0 ] = _rtB ->
B_2_110_0 [ 0 ] ; _rtB -> B_2_111_0 [ 1 ] = 0.0 ; _rtB -> B_2_111_0 [ 2 ] =
0.0 ; _rtB -> B_2_111_0 [ 3 ] = 0.0 ; _rtB -> B_2_112_0 [ 0 ] = _rtB ->
B_2_110_0 [ 1 ] ; _rtB -> B_2_112_0 [ 1 ] = 0.0 ; _rtB -> B_2_112_0 [ 2 ] =
0.0 ; _rtB -> B_2_112_0 [ 3 ] = 0.0 ; _rtB -> B_2_113_0 [ 0 ] = _rtB ->
B_2_107_0 ; _rtB -> B_2_113_0 [ 1 ] = 0.0 ; _rtB -> B_2_113_0 [ 2 ] = 0.0 ;
if ( ssIsMajorTimeStep ( S ) ) { _rtDW -> INPUT_8_1_1_discrete [ 0 ] = ! (
_rtB -> B_2_113_0 [ 0 ] == _rtDW -> INPUT_8_1_1_discrete [ 1 ] ) ; _rtDW ->
INPUT_8_1_1_discrete [ 1 ] = _rtB -> B_2_113_0 [ 0 ] ; } _rtB -> B_2_113_0 [
0 ] = _rtDW -> INPUT_8_1_1_discrete [ 1 ] ; _rtB -> B_2_113_0 [ 3 ] = _rtDW
-> INPUT_8_1_1_discrete [ 0 ] ; _rtB -> B_2_114_0 [ 0 ] = _rtB -> B_2_110_0 [
2 ] ; _rtB -> B_2_114_0 [ 1 ] = 0.0 ; _rtB -> B_2_114_0 [ 2 ] = 0.0 ; _rtB ->
B_2_114_0 [ 3 ] = 0.0 ; ssCallAccelRunBlock ( S , 2 , 115 ,
SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 116 ,
SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 117 ,
SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 118 ,
SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 119 ,
SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 120 ,
SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 121 ,
SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 122 ,
SS_CALL_MDL_OUTPUTS ) ; if ( ssIsSampleHit ( S , 1 , 0 ) ) { { if (
ssGetLogOutput ( S ) ) { sdiSlioSdiWriteSignal ( _rtDW ->
HiddenToAsyncQueue_InsertedFor_Mux_at_outport_0_PWORK . AQHandles , _rtDW ->
HiddenToAsyncQueue_InsertedFor_Mux_at_outport_0_PWORK . SlioLTF , 0 ,
ssGetTaskTime ( S , 1 ) , ( void * ) & _rtB -> B_2_28_0 [ 15 ] ) ; } } }
ssCallAccelRunBlock ( S , 2 , 137 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 138 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 139 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 156 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 160 , SS_CALL_MDL_OUTPUTS ) ;
ssCallAccelRunBlock ( S , 2 , 177 , SS_CALL_MDL_OUTPUTS ) ; if (
ssIsSampleHit ( S , 1 , 0 ) ) { { if ( ssGetLogOutput ( S ) ) {
sdiSlioSdiWriteSignal ( _rtDW ->
HiddenToAsyncQueue_InsertedFor_Mux_at_outport_0_PWORK_o . AQHandles , _rtDW
-> HiddenToAsyncQueue_InsertedFor_Mux_at_outport_0_PWORK_o . SlioLTF , 0 ,
ssGetTaskTime ( S , 1 ) , ( void * ) & _rtB -> B_2_28_0 [ 19 ] ) ; } } }
ssCallAccelRunBlock ( S , 2 , 193 , SS_CALL_MDL_OUTPUTS ) ; _rtB -> B_2_194_0
[ 0 ] = _rtB -> B_2_28_0 [ 14 ] ; _rtB -> B_2_194_0 [ 1 ] = 0.0 ; _rtB ->
B_2_194_0 [ 2 ] = 0.0 ; _rtB -> B_2_194_0 [ 3 ] = 0.0 ; ssCallAccelRunBlock (
S , 2 , 195 , SS_CALL_MDL_OUTPUTS ) ; ssCallAccelRunBlock ( S , 2 , 196 ,
SS_CALL_MDL_OUTPUTS ) ; UNUSED_PARAMETER ( tid ) ; } static void
mdlOutputsTID5 ( SimStruct * S , int_T tid ) { B_CMFB_T * _rtB ; P_CMFB_T *
_rtP ; _rtP = ( ( P_CMFB_T * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( B_CMFB_T *
) _ssGetModelBlockIO ( S ) ) ; _rtB -> B_2_4_0 = _rtP -> P_26 ; _rtB ->
B_2_34_0 = _rtP -> P_48 ; _rtB -> B_2_42_0 = _rtP -> P_55 ; _rtB -> B_2_58_0
= _rtP -> P_61 ; _rtB -> B_2_59_0 = _rtP -> P_62 ; _rtB -> B_2_61_0 = _rtP ->
P_63 ; _rtB -> B_2_66_0 = _rtP -> P_64 ; _rtB -> B_2_73_0 = _rtP -> P_67 ;
_rtB -> B_2_74_0 = _rtP -> P_68 ; _rtB -> B_2_79_0 = _rtP -> P_69 ; _rtB ->
B_2_88_0 = _rtP -> P_72 ; _rtB -> B_2_91_0 = _rtP -> P_73 ; _rtB -> B_0_0_0 =
_rtP -> P_0 ; _rtB -> B_0_5_0 = _rtP -> P_5 ; _rtB -> B_0_7_0 = _rtP -> P_8 ;
_rtB -> B_0_10_0 = _rtP -> P_9 - _rtB -> B_0_7_0 ; _rtB -> B_0_15_0 = _rtP ->
P_12 ; _rtB -> B_0_16_0 = _rtP -> P_11 - _rtB -> B_0_15_0 ; _rtB -> B_0_25_0
= _rtP -> P_13 ; _rtB -> B_0_27_0 = _rtP -> P_14 ; _rtB -> B_0_29_0 = _rtP ->
P_16 ; _rtB -> B_0_30_0 = _rtP -> P_17 * _rtB -> B_0_29_0 ; _rtB -> B_0_43_0
= _rtP -> P_20 ; _rtB -> B_2_107_0 = _rtP -> P_79 ; UNUSED_PARAMETER ( tid )
; }
#define MDL_UPDATE
static void mdlUpdate ( SimStruct * S , int_T tid ) { B_CMFB_T * _rtB ;
P_CMFB_T * _rtP ; DW_CMFB_T * _rtDW ; _rtDW = ( ( DW_CMFB_T * )
ssGetRootDWork ( S ) ) ; _rtP = ( ( P_CMFB_T * ) ssGetModelRtp ( S ) ) ; _rtB
= ( ( B_CMFB_T * ) _ssGetModelBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 2 ,
1 , SS_CALL_MDL_UPDATE ) ; if ( ssIsSampleHit ( S , 2 , 0 ) ) { _rtDW ->
NextOutput = rt_nrand_Upu32_Yd_f_pw_snf ( & _rtDW -> RandSeed ) * _rtP ->
P_24 + _rtP -> P_23 ; } { real_T * * uBuffer = ( real_T * * ) & _rtDW ->
VariableTimeDelay_PWORK . TUbufferPtrs [ 0 ] ; real_T * * tBuffer = ( real_T
* * ) & _rtDW -> VariableTimeDelay_PWORK . TUbufferPtrs [ 1 ] ; real_T * *
xBuffer = ( NULL ) ; real_T simTime = ssGetT ( S ) ; real_T appliedDelay ;
appliedDelay = _rtB -> B_2_5_0 ; if ( appliedDelay > _rtP -> P_28 ) {
appliedDelay = _rtP -> P_28 ; } _rtDW -> VariableTimeDelay_IWORK . Head = ( (
_rtDW -> VariableTimeDelay_IWORK . Head < ( _rtDW -> VariableTimeDelay_IWORK
. CircularBufSize - 1 ) ) ? ( _rtDW -> VariableTimeDelay_IWORK . Head + 1 ) :
0 ) ; if ( _rtDW -> VariableTimeDelay_IWORK . Head == _rtDW ->
VariableTimeDelay_IWORK . Tail ) { if ( !
CMFB_acc_rt_TDelayUpdateTailOrGrowBuf ( & _rtDW -> VariableTimeDelay_IWORK .
CircularBufSize , & _rtDW -> VariableTimeDelay_IWORK . Tail , & _rtDW ->
VariableTimeDelay_IWORK . Head , & _rtDW -> VariableTimeDelay_IWORK . Last ,
simTime - _rtP -> P_28 , tBuffer , uBuffer , xBuffer , ( boolean_T ) 0 , (
boolean_T ) 0 , & _rtDW -> VariableTimeDelay_IWORK . MaxNewBufSize ) ) {
ssSetErrorStatus ( S , "vtdelay memory allocation error" ) ; return ; } } ( *
tBuffer ) [ _rtDW -> VariableTimeDelay_IWORK . Head ] = simTime ; ( * uBuffer
) [ _rtDW -> VariableTimeDelay_IWORK . Head ] = _rtB -> B_2_2_0 ; } if (
ssIsSampleHit ( S , 1 , 0 ) ) { _rtDW -> Memory_PreviousInput = _rtB ->
B_2_9_0 ; } if ( ssIsSampleHit ( S , 2 , 0 ) ) { _rtDW -> NextOutput_b =
rt_nrand_Upu32_Yd_f_pw_snf ( & _rtDW -> RandSeed_g ) * _rtP -> P_33 + _rtP ->
P_32 ; } { real_T * * uBuffer = ( real_T * * ) & _rtDW ->
VariableTimeDelay1_PWORK . TUbufferPtrs [ 0 ] ; real_T * * tBuffer = ( real_T
* * ) & _rtDW -> VariableTimeDelay1_PWORK . TUbufferPtrs [ 1 ] ; real_T * *
xBuffer = ( NULL ) ; real_T simTime = ssGetT ( S ) ; real_T appliedDelay ;
appliedDelay = _rtB -> B_2_13_0 ; if ( appliedDelay > _rtP -> P_36 ) {
appliedDelay = _rtP -> P_36 ; } _rtDW -> VariableTimeDelay1_IWORK . Head = (
( _rtDW -> VariableTimeDelay1_IWORK . Head < ( _rtDW ->
VariableTimeDelay1_IWORK . CircularBufSize - 1 ) ) ? ( _rtDW ->
VariableTimeDelay1_IWORK . Head + 1 ) : 0 ) ; if ( _rtDW ->
VariableTimeDelay1_IWORK . Head == _rtDW -> VariableTimeDelay1_IWORK . Tail )
{ if ( ! CMFB_acc_rt_TDelayUpdateTailOrGrowBuf ( & _rtDW ->
VariableTimeDelay1_IWORK . CircularBufSize , & _rtDW ->
VariableTimeDelay1_IWORK . Tail , & _rtDW -> VariableTimeDelay1_IWORK . Head
, & _rtDW -> VariableTimeDelay1_IWORK . Last , simTime - _rtP -> P_36 ,
tBuffer , uBuffer , xBuffer , ( boolean_T ) 0 , ( boolean_T ) 0 , & _rtDW ->
VariableTimeDelay1_IWORK . MaxNewBufSize ) ) { ssSetErrorStatus ( S ,
"vtdelay memory allocation error" ) ; return ; } } ( * tBuffer ) [ _rtDW ->
VariableTimeDelay1_IWORK . Head ] = simTime ; ( * uBuffer ) [ _rtDW ->
VariableTimeDelay1_IWORK . Head ] = _rtB -> B_2_2_0 ; } if ( ssIsSampleHit (
S , 1 , 0 ) ) { _rtDW -> Memory1_PreviousInput = _rtB -> B_2_17_0 ; } if (
ssIsSampleHit ( S , 2 , 0 ) ) { _rtDW -> NextOutput_j =
rt_nrand_Upu32_Yd_f_pw_snf ( & _rtDW -> RandSeed_gn ) * _rtP -> P_41 + _rtP
-> P_40 ; } { real_T * * uBuffer = ( real_T * * ) & _rtDW ->
VariableTimeDelay2_PWORK . TUbufferPtrs [ 0 ] ; real_T * * tBuffer = ( real_T
* * ) & _rtDW -> VariableTimeDelay2_PWORK . TUbufferPtrs [ 1 ] ; real_T * *
xBuffer = ( NULL ) ; real_T simTime = ssGetT ( S ) ; real_T appliedDelay ;
appliedDelay = _rtB -> B_2_21_0 ; if ( appliedDelay > _rtP -> P_44 ) {
appliedDelay = _rtP -> P_44 ; } _rtDW -> VariableTimeDelay2_IWORK . Head = (
( _rtDW -> VariableTimeDelay2_IWORK . Head < ( _rtDW ->
VariableTimeDelay2_IWORK . CircularBufSize - 1 ) ) ? ( _rtDW ->
VariableTimeDelay2_IWORK . Head + 1 ) : 0 ) ; if ( _rtDW ->
VariableTimeDelay2_IWORK . Head == _rtDW -> VariableTimeDelay2_IWORK . Tail )
{ if ( ! CMFB_acc_rt_TDelayUpdateTailOrGrowBuf ( & _rtDW ->
VariableTimeDelay2_IWORK . CircularBufSize , & _rtDW ->
VariableTimeDelay2_IWORK . Tail , & _rtDW -> VariableTimeDelay2_IWORK . Head
, & _rtDW -> VariableTimeDelay2_IWORK . Last , simTime - _rtP -> P_44 ,
tBuffer , uBuffer , xBuffer , ( boolean_T ) 0 , ( boolean_T ) 0 , & _rtDW ->
VariableTimeDelay2_IWORK . MaxNewBufSize ) ) { ssSetErrorStatus ( S ,
"vtdelay memory allocation error" ) ; return ; } } ( * tBuffer ) [ _rtDW ->
VariableTimeDelay2_IWORK . Head ] = simTime ; ( * uBuffer ) [ _rtDW ->
VariableTimeDelay2_IWORK . Head ] = _rtB -> B_2_2_0 ; } if ( ssIsSampleHit (
S , 1 , 0 ) ) { _rtDW -> Memory2_PreviousInput = _rtB -> B_2_25_0 ; _rtDW ->
Memory_PreviousInput_m = _rtB -> B_2_38_0 ; } UNUSED_PARAMETER ( tid ) ; }
#define MDL_UPDATE
static void mdlUpdateTID5 ( SimStruct * S , int_T tid ) { UNUSED_PARAMETER (
tid ) ; }
#define MDL_DERIVATIVES
static void mdlDerivatives ( SimStruct * S ) { B_CMFB_T * _rtB ; P_CMFB_T *
_rtP ; DW_CMFB_T * _rtDW ; _rtDW = ( ( DW_CMFB_T * ) ssGetRootDWork ( S ) ) ;
_rtP = ( ( P_CMFB_T * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( B_CMFB_T * )
_ssGetModelBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 2 , 1 ,
SS_CALL_MDL_DERIVATIVES ) ; { } { } { } ssCallAccelRunBlock ( S , 2 , 27 ,
SS_CALL_MDL_DERIVATIVES ) ; }
#define MDL_PROJECTION
static void mdlProjection ( SimStruct * S ) { ssCallAccelRunBlock ( S , 2 , 1
, SS_CALL_MDL_PROJECTION ) ; ssCallAccelRunBlock ( S , 2 , 27 ,
SS_CALL_MDL_PROJECTION ) ; }
#define MDL_FORCINGFUNCTION
static void mdlForcingFunction ( SimStruct * S ) { B_CMFB_T * _rtB ; P_CMFB_T
* _rtP ; DW_CMFB_T * _rtDW ; _rtDW = ( ( DW_CMFB_T * ) ssGetRootDWork ( S ) )
; _rtP = ( ( P_CMFB_T * ) ssGetModelRtp ( S ) ) ; _rtB = ( ( B_CMFB_T * )
_ssGetModelBlockIO ( S ) ) ; ssCallAccelRunBlock ( S , 2 , 1 ,
SS_CALL_MDL_FORCINGFUNCTION ) ; { } { } { } ssCallAccelRunBlock ( S , 2 , 27
, SS_CALL_MDL_FORCINGFUNCTION ) ; }
#define MDL_MASSMATRIX
static void mdlMassMatrix ( SimStruct * S ) { ssCallAccelRunBlock ( S , 2 , 1
, SS_CALL_MDL_MASSMATRIX ) ; ssCallAccelRunBlock ( S , 2 , 27 ,
SS_CALL_MDL_MASSMATRIX ) ; }
#define MDL_ZERO_CROSSINGS
static void mdlZeroCrossings ( SimStruct * S ) { B_CMFB_T * _rtB ; P_CMFB_T *
_rtP ; ZCV_CMFB_T * _rtZCSV ; DW_CMFB_T * _rtDW ; _rtDW = ( ( DW_CMFB_T * )
ssGetRootDWork ( S ) ) ; _rtZCSV = ( ( ZCV_CMFB_T * )
ssGetSolverZcSignalVector ( S ) ) ; _rtP = ( ( P_CMFB_T * ) ssGetModelRtp ( S
) ) ; _rtB = ( ( B_CMFB_T * ) _ssGetModelBlockIO ( S ) ) ;
ssCallAccelRunBlock ( S , 2 , 1 , SS_CALL_MDL_ZERO_CROSSINGS ) ; _rtZCSV ->
DetectEventwiththreshold_Input_ZC = _rtB -> B_2_6_0 - _rtP -> P_30 ; if (
_rtDW -> DetectEventwiththreshold_MODE == 0 ) { _rtZCSV ->
DetectEventwiththreshold_Output_ZC = ( ( _rtB -> B_2_6_0 - _rtP -> P_30 ) * (
real_T ) _rtB -> B_2_7_0 != 0.0 ) ; } else { _rtZCSV ->
DetectEventwiththreshold_Output_ZC = ssGetT ( S ) - ssGetTimeOfLastOutput ( S
) ; } _rtZCSV -> DetectEventwiththreshold1_Input_ZC = _rtB -> B_2_14_0 - _rtP
-> P_38 ; if ( _rtDW -> DetectEventwiththreshold1_MODE == 0 ) { _rtZCSV ->
DetectEventwiththreshold1_Output_ZC = ( ( _rtB -> B_2_14_0 - _rtP -> P_38 ) *
( real_T ) _rtB -> B_2_15_0 != 0.0 ) ; } else { _rtZCSV ->
DetectEventwiththreshold1_Output_ZC = ssGetT ( S ) - ssGetTimeOfLastOutput (
S ) ; } _rtZCSV -> DetectEventwiththreshold2_Input_ZC = _rtB -> B_2_22_0 -
_rtP -> P_46 ; if ( _rtDW -> DetectEventwiththreshold2_MODE == 0 ) { _rtZCSV
-> DetectEventwiththreshold2_Output_ZC = ( ( _rtB -> B_2_22_0 - _rtP -> P_46
) * ( real_T ) _rtB -> B_2_23_0 != 0.0 ) ; } else { _rtZCSV ->
DetectEventwiththreshold2_Output_ZC = ssGetT ( S ) - ssGetTimeOfLastOutput (
S ) ; } _rtZCSV -> DetectEventwiththreshold_Input_ZC_m = _rtB -> B_2_2_0 -
_rtP -> P_49 ; if ( _rtDW -> DetectEventwiththreshold_MODE_g == 0 ) { _rtZCSV
-> DetectEventwiththreshold_Output_ZC_b = ( ( _rtB -> B_2_2_0 - _rtP -> P_49
) * ( real_T ) _rtB -> B_2_36_0 != 0.0 ) ; } else { _rtZCSV ->
DetectEventwiththreshold_Output_ZC_b = ssGetT ( S ) - ssGetTimeOfLastOutput (
S ) ; } _rtZCSV -> Switch_SwitchCond_ZC = _rtB -> B_2_38_0 - _rtP -> P_56 ;
_rtZCSV -> Abs_AbsZc_ZC = _rtB -> B_2_44_0 ; if ( _rtB -> B_2_60_0 < _rtB ->
B_2_61_0 ) { if ( _rtDW -> MinMax1_MODE == 0 ) { _rtZCSV ->
MinMax1_MinmaxInput_ZC = _rtB -> B_2_60_0 - _rtB -> B_2_60_0 ; } else {
_rtZCSV -> MinMax1_MinmaxInput_ZC = _rtB -> B_2_60_0 - _rtB -> B_2_61_0 ; } }
else if ( _rtDW -> MinMax1_MODE == 0 ) { _rtZCSV -> MinMax1_MinmaxInput_ZC =
_rtB -> B_2_61_0 - _rtB -> B_2_60_0 ; } else { _rtZCSV ->
MinMax1_MinmaxInput_ZC = _rtB -> B_2_61_0 - _rtB -> B_2_61_0 ; } if ( _rtB ->
B_2_63_0 > _rtB -> B_2_61_0 ) { if ( _rtDW -> MinMax3_MODE == 0 ) { _rtZCSV
-> MinMax3_MinmaxInput_ZC = _rtB -> B_2_63_0 - _rtB -> B_2_63_0 ; } else {
_rtZCSV -> MinMax3_MinmaxInput_ZC = _rtB -> B_2_63_0 - _rtB -> B_2_61_0 ; } }
else if ( _rtDW -> MinMax3_MODE == 0 ) { _rtZCSV -> MinMax3_MinmaxInput_ZC =
_rtB -> B_2_61_0 - _rtB -> B_2_63_0 ; } else { _rtZCSV ->
MinMax3_MinmaxInput_ZC = _rtB -> B_2_61_0 - _rtB -> B_2_61_0 ; } _rtZCSV ->
Saturation1_UprLim_ZC = _rtB -> B_2_67_0 - _rtP -> P_65 ; _rtZCSV ->
Saturation1_LwrLim_ZC = _rtB -> B_2_67_0 - _rtP -> P_66 ; if ( _rtB ->
B_2_69_0 > _rtB -> B_2_61_0 ) { if ( _rtDW -> MinMax2_MODE == 0 ) { _rtZCSV
-> MinMax2_MinmaxInput_ZC = _rtB -> B_2_69_0 - _rtB -> B_2_69_0 ; } else {
_rtZCSV -> MinMax2_MinmaxInput_ZC = _rtB -> B_2_69_0 - _rtB -> B_2_61_0 ; } }
else if ( _rtDW -> MinMax2_MODE == 0 ) { _rtZCSV -> MinMax2_MinmaxInput_ZC =
_rtB -> B_2_61_0 - _rtB -> B_2_69_0 ; } else { _rtZCSV ->
MinMax2_MinmaxInput_ZC = _rtB -> B_2_61_0 - _rtB -> B_2_61_0 ; } if ( _rtB ->
B_2_28_0 [ 18 ] < _rtB -> B_2_74_0 ) { if ( _rtDW -> MinMax1_MODE_b == 0 ) {
_rtZCSV -> MinMax1_MinmaxInput_ZC_h = _rtB -> B_2_28_0 [ 18 ] - _rtB ->
B_2_28_0 [ 18 ] ; } else { _rtZCSV -> MinMax1_MinmaxInput_ZC_h = _rtB ->
B_2_28_0 [ 18 ] - _rtB -> B_2_74_0 ; } } else if ( _rtDW -> MinMax1_MODE_b ==
0 ) { _rtZCSV -> MinMax1_MinmaxInput_ZC_h = _rtB -> B_2_74_0 - _rtB ->
B_2_28_0 [ 18 ] ; } else { _rtZCSV -> MinMax1_MinmaxInput_ZC_h = _rtB ->
B_2_74_0 - _rtB -> B_2_74_0 ; } if ( _rtB -> B_2_76_0 > _rtB -> B_2_74_0 ) {
if ( _rtDW -> MinMax3_MODE_m == 0 ) { _rtZCSV -> MinMax3_MinmaxInput_ZC_l =
_rtB -> B_2_76_0 - _rtB -> B_2_76_0 ; } else { _rtZCSV ->
MinMax3_MinmaxInput_ZC_l = _rtB -> B_2_76_0 - _rtB -> B_2_74_0 ; } } else if
( _rtDW -> MinMax3_MODE_m == 0 ) { _rtZCSV -> MinMax3_MinmaxInput_ZC_l = _rtB
-> B_2_74_0 - _rtB -> B_2_76_0 ; } else { _rtZCSV -> MinMax3_MinmaxInput_ZC_l
= _rtB -> B_2_74_0 - _rtB -> B_2_74_0 ; } _rtZCSV -> Saturation_UprLim_ZC =
_rtB -> B_2_80_0 - _rtP -> P_70 ; _rtZCSV -> Saturation_LwrLim_ZC = _rtB ->
B_2_80_0 - _rtP -> P_71 ; if ( _rtB -> B_2_82_0 > _rtB -> B_2_74_0 ) { if (
_rtDW -> MinMax2_MODE_i == 0 ) { _rtZCSV -> MinMax2_MinmaxInput_ZC_d = _rtB
-> B_2_82_0 - _rtB -> B_2_82_0 ; } else { _rtZCSV -> MinMax2_MinmaxInput_ZC_d
= _rtB -> B_2_82_0 - _rtB -> B_2_74_0 ; } } else if ( _rtDW -> MinMax2_MODE_i
== 0 ) { _rtZCSV -> MinMax2_MinmaxInput_ZC_d = _rtB -> B_2_74_0 - _rtB ->
B_2_82_0 ; } else { _rtZCSV -> MinMax2_MinmaxInput_ZC_d = _rtB -> B_2_74_0 -
_rtB -> B_2_74_0 ; } _rtZCSV -> DeadZone_LwrReg_ZC = _rtB -> B_2_93_0 - _rtP
-> P_74 ; _rtZCSV -> DeadZone_UprReg_ZC = _rtB -> B_2_93_0 - _rtP -> P_75 ;
_rtZCSV -> If_IfInput_ZC = 0.0 ; if ( ( _rtB -> B_2_90_0 > 0.0 ) && ( _rtB ->
B_2_94_0 > 0.0 ) ) { _rtZCSV -> If_IfInput_ZC = 1.0 ; } { real_T * zcsv = & (
( ( ZCV_CMFB_T * ) ssGetSolverZcSignalVector ( S ) ) -> Clamp_UprLim_ZC ) ;
int_T i ; for ( i = 0 ; i < 4 ; i ++ ) { zcsv [ i ] = 0.0 ; } } if ( _rtDW ->
If_ActiveSubsystem == 0 ) { _rtZCSV -> Clamp_UprLim_ZC = _rtB -> B_2_94_0 -
_rtP -> P_6 ; _rtZCSV -> Clamp_LwrLim_ZC = _rtB -> B_2_94_0 - _rtP -> P_7 ;
_rtZCSV -> Sign_Input_ZC = _rtB -> B_2_28_0 [ 1 ] ; _rtZCSV -> Sign1_Input_ZC
= _rtB -> B_2_28_0 [ 1 ] ; } } static void mdlInitializeSizes ( SimStruct * S
) { ssSetChecksumVal ( S , 0 , 3364594025U ) ; ssSetChecksumVal ( S , 1 ,
3261377728U ) ; ssSetChecksumVal ( S , 2 , 325717770U ) ; ssSetChecksumVal (
S , 3 , 131331690U ) ; { mxArray * slVerStructMat = NULL ; mxArray * slStrMat
= mxCreateString ( "simulink" ) ; char slVerChar [ 10 ] ; int status =
mexCallMATLAB ( 1 , & slVerStructMat , 1 , & slStrMat , "ver" ) ; if ( status
== 0 ) { mxArray * slVerMat = mxGetField ( slVerStructMat , 0 , "Version" ) ;
if ( slVerMat == NULL ) { status = 1 ; } else { status = mxGetString (
slVerMat , slVerChar , 10 ) ; } } mxDestroyArray ( slStrMat ) ;
mxDestroyArray ( slVerStructMat ) ; if ( ( status == 1 ) || ( strcmp (
slVerChar , "8.9" ) != 0 ) ) { return ; } } ssSetOptions ( S ,
SS_OPTION_EXCEPTION_FREE_CODE ) ; if ( ssGetSizeofDWork ( S ) != sizeof (
DW_CMFB_T ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal DWork sizes do "
"not match for accelerator mex file." ) ; } if ( ssGetSizeofGlobalBlockIO ( S
) != sizeof ( B_CMFB_T ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal BlockIO sizes do "
"not match for accelerator mex file." ) ; } if ( ssGetSizeofY ( S ) != sizeof
( ExtY_CMFB_T ) ) { static char msg [ 256 ] ; sprintf ( msg ,
"Unexpected error: Internal ExternalOutputs sizes do "
"not match for accelerator mex file." ) ; } { int ssSizeofParams ;
ssGetSizeofParams ( S , & ssSizeofParams ) ; if ( ssSizeofParams != sizeof (
P_CMFB_T ) ) { static char msg [ 256 ] ; sprintf ( msg ,
"Unexpected error: Internal Parameters sizes do "
"not match for accelerator mex file." ) ; } } _ssSetModelRtp ( S , ( real_T *
) & CMFB_rtDefaultP ) ; if ( ssGetSizeofDWork ( S ) == sizeof ( DW_CMFB_T ) )
{ { ( ( DW_CMFB_T * ) ssGetRootDWork ( S ) ) -> STATE_2_MASS_MATRIX_PR = 0 ;
} } rt_InitInfAndNaN ( sizeof ( real_T ) ) ; ( ( P_CMFB_T * ) ssGetModelRtp (
S ) ) -> P_2 = rtInf ; ( ( P_CMFB_T * ) ssGetModelRtp ( S ) ) -> P_74 =
rtMinusInf ; } static void mdlInitializeSampleTimes ( SimStruct * S ) {
slAccRegPrmChangeFcn ( S , mdlOutputsTID5 ) ; } static void mdlTerminate (
SimStruct * S ) { }
#include "simulink.c"
