Example #1
0
                      /* 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);
        }
Example #2
0
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 ) ; }
Example #3
0
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
Example #4
0
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 ) ; }