📄 example6_acc.c
字号:
#if 0
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.
If you do not have the Real-Time Workshop licensed, this file contains
encrypted block names, etc. If you purchase the Real-Time Workshop,
this file will contain full block descriptions and improved variable
names.
#endif
/*
* example6_acc.c
*
* Real-Time Workshop code generation for Simulink model "example6_acc.mdl".
*
* Model Version : 1.42
* Real-Time Workshop file version : 4.1 $Date: 2001/05/16 13:59:43 $
* Real-Time Workshop file generated on : Sun May 18 17:35:27 2003
* TLC version : 4.1 (May 19 2001)
* C source code generated on : Sun May 18 17:35:27 2003
*
* Relevant TLC Options:
* InlineParameters = 0
* RollThreshold = 5
* CodeFormat = S-Function
*
* Simulink model settings:
* Solver : VariableStep
* StartTime : 0.0 s
* StopTime : 10.0 s
* Variable step solver used
*/
#include <math.h>
#include <string.h>
#include "example6_acc.h"
#include "example6_acc_prm.h"
/* Start of Functions in model "example6_acc" */
/* Compute block outputs */
static void mdlOutputs(SimStruct *S, int_T tid)
{
/* simstruct variables */
example6_BlockIO *example6_B = (example6_BlockIO *) _ssGetBlockIO(S);
example6_D_Work *example6_DWork = (example6_D_Work *) ssGetRootDWork(S);
example6_Parameters *example6_P = (example6_Parameters *) ssGetDefaultParam(S);
/* local block i/o variables */
real_T rtb_temp8[3];
real_T rtb_temp9[3];
/* DSP Blockset Random Source (sdsprandsrc2) - <S3>/Random Source */
/* Create the Random Numbers */
{
real_T *y = (real_T *)&rtb_temp9[0];
uint32_T *urandSeed = (uint32_T *)&example6_DWork->Random_Source_a_RAND_SEED;
real_T *pMin = (real_T *)&example6_P->Random_Source_a_Min;
real_T *pMax = (real_T *)&example6_P->Random_Source_a_Max;
int_T j;
for(j=0;j<3;j++ ) {
/* Generate real uniform random numbers */
*y++ = DSP_UniformRand(urandSeed) * (*pMax - *pMin) + *pMin;
}
}
/* Constant: '<S4>/Constant' */
rtb_temp8[0] = example6_P->Constant_Value[0];
rtb_temp8[1] = example6_P->Constant_Value[1];
rtb_temp8[2] = example6_P->Constant_Value[2];
/* ZeroOrderHold Block: '<S4>/zoh'
*
* Regarding '<S4>/zoh':
* Eliminated since input and output rates are identical
*/
/* RelationalOperator: '<S3>/Relational Operator' */
rtb_temp9[0] = (rtb_temp9[0] > rtb_temp8[0]);
rtb_temp9[1] = (rtb_temp9[1] > rtb_temp8[1]);
rtb_temp9[2] = (rtb_temp9[2] > rtb_temp8[2]);
/* S-Function Block: <S3>/Reshape */
example6_B->Reshape[0] = rtb_temp9[0];
example6_B->Reshape[1] = rtb_temp9[1];
example6_B->Reshape[2] = rtb_temp9[2];
/* Level2 S-Function Block: <Root>/Convolutional Encoder (scomconvenc) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 6, SS_CALL_MDL_OUTPUTS);
/* Level2 S-Function Block: <S2>/M-PSK Modulator Baseband (scomapskmod) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 7, SS_CALL_MDL_OUTPUTS);
/* DSP Blockset Random Source (sdsprandsrc2) - <S1>/Random Source */
/* Create the Random Numbers */
{
creal_T *y = (creal_T *)&example6_B->Random_Source_b[0];
cuint32_T *urandSeed = (cuint32_T
*)&example6_DWork->Random_Source_b_RAND_SEED;
real_T *pMean = (real_T *)&example6_P->Random_Source_b_Mean;
real_T *pVar = (real_T *)&example6_P->Random_Source_b_Variance;
int_T j;
for(j=0;j<6;j++ ) {
/* Generate complex normal (gaussian) random numbers */
y->re = DSP_NormalRand(&urandSeed->re) * sqrt(*pVar/2) + *pMean;
(y++)->im = DSP_NormalRand(&urandSeed->im) * sqrt(*pVar/2);
}
}
/* Level2 S-Function Block: <S1>/Dynamic AWGN (scomawgnchan2) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 9, SS_CALL_MDL_OUTPUTS);
/* ComplexToRealImag: '<Root>/Complex to Real-Imag' */
{
int_T i1;
const creal_T *u0 = &example6_B->Dynamic_AWGN[0];
real_T *y0 = &example6_B->Complex_to_Real_Imag[0];
for (i1=0; i1 < 6; i1++) {
y0[i1] = u0[i1].re;
}
}
/* Level2 S-Function Block: <Root>/Viterbi Decoder (scomviterbi) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 11, SS_CALL_MDL_OUTPUTS);
/* Level2 S-Function Block: <Root>/Error Rate Calculation (scomerrrate2) */
/* Call into Simulink for MEX-version of S-function */
ssCallAccelRunBlock(S, 0, 12, SS_CALL_MDL_OUTPUTS);
/* Display: '<Root>/Display' */
/* Call into Simulink for Display */
ssCallAccelRunBlock(S, 0, 13, SS_CALL_MDL_OUTPUTS);
}
/* Perform model update */
#define MDL_UPDATE
static void mdlUpdate(SimStruct *S, int_T tid)
{
/* (no update code required) */
}
/* End of Functions in model "example6_acc" */
#include "example6_acc_reg.h"
/* [EOF] example6_acc.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -