⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_code.c

📁 wcdma模型
💻 C
字号:
/* | Project:     WCDMA simulation environment | Module:       | Author:       | Date:        February, 1999 | | History: |              May 20,  1999 Maarit Melvasalo  | |  File    :   s_code.c |  Abstract: |              This function       | | USER GIVEN PARAMETERS | | 0: SF   = Spreading code length   | | | Copyright disclaimer: |   This software was developed at the National Institute of Standards |   and Technology by employees of the Federal Government in the course |   of their official duties. Pursuant to title 17 Section 105 of the |   United States Code this software is not subject to copyright |   protection and is in the public domain. | |   We would appreciate acknowledgement if the software is used. * */#define S_FUNCTION_NAME s_code#define S_FUNCTION_LEVEL 2#include <math.h>#include "simstruc.h"#include "tmwtypes.h"#include "config_wcdma.h"/* USER GIVEN PARAMETERS AND DEFINITIONS /**//*Number of input and output ports/**/#define NINPUTS   0#define NOUTPUTS  1/* Number of user given parameters/**/  #define NPARAMS 1/* Spreading code parameter /**/#define C_PARAM(S) ssGetSFcnParam(S,0)           #define nCode (int_T)(mxGetPr(C_PARAM(S))[0])    #define td 1static void mdlInitializeSizes(SimStruct *S){  ssSetNumSFcnParams(S, NPARAMS);    if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S))  {      return; }    if (!ssSetNumInputPorts(S, NINPUTS)) return;    if (!ssSetNumOutputPorts(S, NOUTPUTS)) return;    ssSetOutputPortWidth(S, 0, nCode);     ssSetNumSampleTimes(S, 1);    ssSetNumIWork(S, nCode + 1);    ssSetSFcnParamNotTunable(S,0);  /* speeds up simulations*/      /* Take care when specifying exception free code - see sfuntmpl.doc */    ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);    /* do not use mxCalloc or  mexErrMsgTxt functions */}/* Function: mdlInitializeSampleTimes ========================================= * Abstract: *    Specifiy that sampletime is given by the user */static void mdlInitializeSampleTimes(SimStruct *S){  ssSetSampleTime(S, 0, td);     ssSetOffsetTime(S, 0, 0.0);}#define MDL_INITIALIZE_CONDITIONS/* Function: mdlInitializeConditions ======================================== * Abstract: */static void mdlInitializeConditions(SimStruct *S){    int_T             *iwork = ssGetIWork(S);    int_T i;    iwork[nCode ] = wcdma_code_init(nCode);    i= wcdma_ovsf_code(iwork[nCode],iwork);/**/}/* Function: mdlOutputs ======================================================= * Abstract: * The output is the inpulse response convoluted with the received bits  * for NDISKS previous time intervals. *  */static void mdlOutputs(SimStruct *S, int_T tid){  real_T            *y    = ssGetOutputPortRealSignal(S,0);  int_T             *iwork = ssGetIWork(S);     int_T i;      {    for (i = 0; i< nCode; i++) {       y[i] = iwork[i] ;    }   }}/* Function: mdlTerminate ===================================================== * Abstract: *  */static void mdlTerminate(SimStruct *S){    int_T             *iwork = ssGetIWork(S);     int_T tmp;  tmp = wcdma_code_free(iwork[nCode]);/**/}#ifdef  MATLAB_MEX_FILE    /* Is this file being compiled as a MEX-file? */#include "simulink.c"      /* MEX-file interface mechanism */#else#include "cg_sfun.h"       /* Code generation registration function */#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -