📄 untitled_acc.c
字号:
/*
* This file is not available for use in any application other than as a
* MATLAB(R) MEX file for use with the Simulink(R) Accelerator product.
*/
/*
* Real-Time Workshop code generation for Simulink model "untitled_acc.mdl".
*
* Model Version : 1.0
* Real-Time Workshop file version : 5.0 $Date: 2002/05/30 19:21:33 $
* Real-Time Workshop file generated on : Mon Sep 10 16:33:36 2007
* TLC version : 5.0 (Jun 18 2002)
* C source code generated on : Mon Sep 10 16:33:37 2007
*/
#include <math.h>
#include <string.h>
#include "untitled_acc.h"
#include "untitled_acc_private.h"
#include <stdio.h>
#include "simstruc.h"
#define CodeFormat S-Function
#define AccDefine1 Accelerator_S-Function
/* Outputs for root system: '<Root>' */
static void mdlOutputs(SimStruct *S, int_T tid)
{
/* simstruct variables */
untitled_BlockIO *untitled_B = (untitled_BlockIO *) _ssGetBlockIO(S);
untitled_D_Work *untitled_DWork = (untitled_D_Work *) ssGetRootDWork(S);
untitled_Parameters *untitled_P = (untitled_Parameters *) ssGetDefaultParam(S);
/* tid is required for a uniform function interface. This system
* is single rate, and in this case, tid is not accessed. */
UNUSED_PARAMETER(tid);
/* DSP Blockset Random Source (sdsprandsrc2) - '<S1>/Random Source' */
MWDSP_RandSrc_U_D((real64_T*)&untitled_B->Random_Source_a,&untitled_P->Random_Source_a_Min,1,&untitled_P->Random_Source_a_Max,1,&untitled_DWork->Random_Source_a_STATE_DWORK[0],1,1);
/* Constant: '<S3>/Constant' */
untitled_B->Constant = untitled_P->Constant_Value;
/* RelationalOperator: '<S1>/Relational Operator' */
untitled_B->Relational_Operator_a = (untitled_B->Random_Source_a >
untitled_B->Constant);
/* S-Function Block: <S1>/Reshape */
untitled_B->Reshape = untitled_B->Relational_Operator_a;
/* DSP Blockset Random Source (sdsprandsrc2) - '<S2>/Random Source' */
MWDSP_RandSrc_U_D((real64_T*)&untitled_B->Random_Source_b,&untitled_P->Random_Source_b_Min,1,&untitled_P->Random_Source_b_Max,1,&untitled_DWork->Random_Source_b_STATE_DWORK[0],1,1);
/* Constant: '<S2>/Constant1' */
untitled_B->Constant1 = untitled_P->Constant1_Value;
/* RelationalOperator: '<S2>/Relational Operator' */
untitled_B->Relational_Operator_b = (untitled_B->Random_Source_b <
untitled_B->Constant1);
/* Level2 S-Function Block: <S6>/Inherit Shape1 (scominhshape) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 7, SS_CALL_MDL_OUTPUTS);
/* Logic: '<S2>/Logical Operator' */
untitled_B->Logical_Operator = (real_T)((untitled_B->Reshape != 0.0) ^
(untitled_B->Inherit_Shape1 != 0.0));
/* Level2 S-Function Block: <Root>/Error Rate Calculation (scomerrrate2) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 9, SS_CALL_MDL_OUTPUTS);
/* Display: '<Root>/Display' */
/* Call into Simulink for Display */
ssCallAccelRunBlock(S, 0, 10, SS_CALL_MDL_OUTPUTS);
/* Level2 S-Function Block: <S2>/a (scompropattrib) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 11, SS_CALL_MDL_OUTPUTS);
}
/* Update for root system: '<Root>' */
#define MDL_UPDATE
static void mdlUpdate(SimStruct *S, int_T tid)
{
/* tid is required for a uniform function interface. This system
* is single rate, and in this case, tid is not accessed. */
UNUSED_PARAMETER(tid);
}
/* Function to initialize sizes */
static void mdlInitializeSizes(SimStruct *S)
{
/* checksum */
ssSetChecksumVal(S, 0, 280437156U);
ssSetChecksumVal(S, 1, 223447402U);
ssSetChecksumVal(S, 2, 1644250982U);
ssSetChecksumVal(S, 3, 783953108U);
/* options */
ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);
/* Accelerator check memory map size match for DWork */
if (ssGetSizeofDWork(S) != sizeof(untitled_D_Work)) {
ssSetErrorStatus(S,"Unexpected error: Internal DWork sizes do "
"not match for accelerator mex file.");
}
/* Accelerator check memory map size match for BlockIO */
if (ssGetSizeofGlobalBlockIO(S) != sizeof(untitled_BlockIO)) {
ssSetErrorStatus(S,"Unexpected error: Internal BlockIO sizes do "
"not match for accelerator mex file.");
}
/* model parameters */
_ssSetDefaultParam(S, (real_T *) &untitled_DefaultParameters);
}
/* Empty mdlInitializeSampleTimes function (never called) */
static void mdlInitializeSampleTimes(SimStruct *S) { }
/* Empty mdlTerminate function (never called) */
static void mdlTerminate(SimStruct *S) { }
/* MATLAB MEX Glue */
#include "simulink.c"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -