-
大小: 15KB文件类型: .c金币: 1下载: 0 次发布日期: 2021-06-03
- 语言: Matlab
- 标签: FAS v8 S_function
资源简介
FAST v8 版本S_function 的资源,可以在Simulink中利用NREL的FAST
code 进行风力机的仿真
代码片段和文件信息
/*
* TEMPLATE File: sfuntmpl_gate_fortran.c
* TEMPLATE Copyright 1990-2013 The MathWorks Inc.
*
* Modified by B. Jonkman National Renewable Energy Laboratory
* for use with FAST v8
* 20-Jan-2015
*/
/*
* You must specify the S_FUNCTION_NAME as the name of your S-function
* (i.e. replace sfungate with the name of your S-function which has
* to match the name of the final mex file e.g. if the S_FUNCTION_NAME
* is my_sfuntmpl_gate_fortran the mex filename will have to be
* my_sfuntmpl_gate_fortran.mexXXX where XXX is the 3 letter
* mex extension code for your platform).
*/
#define S_FUNCTION_LEVEL 2
#define S_FUNCTION_NAME FAST_SFunc
/*
* Need to include simstruc.h for the definition of the SimStruct and
* its associated macro definitions.
*/
#include “simstruc.h“
#include “mex.h“ // for mexPutVariable
#include “matrix.h“ // for mxCreateDoubleScalar
#include “FAST_Library.h“
#define PARAM_FILENAME 0
#define PARAM_TMAX 1
#define PARAM_ADDINPUTS 2
#define NUM_PARAM 3
// two DWork arrays:
#define WORKARY_OUTPUT 0
#define WORKARY_INPUT 1
static double dt = 0;
static double TMax = 0;
static int NumInputs = NumFixedInputs;
static int NumAddInputs = 0; // number of additional inputs
static int NumOutputs = 1;
static int ErrStat = 0;
static char ErrMsg[INTERFACE_STRING_LENGTH]; // make sure this is the same size as IntfStrLen in FAST_Library.f90
static char InputFileName[INTERFACE_STRING_LENGTH]; // make sure this is the same size as IntfStrLen in FAST_Library.f90
static int n_t_global = -2; // counter to determine which fixed-step simulation time we are at currently (start at -2 for initialization)
// function definitions
static int checkError(SimStruct *S);
static void mdlTerminate(SimStruct *S); // defined here so I can call it from checkError
static void getInputs(SimStruct *S double *InputAry);
static void setOutputs(SimStruct *S double *OutputAry);
/* Error handling
* --------------
*
* You should use the following technique to report errors encountered within
* an S-function:
*
* ssSetErrorStatus(S“Error encountered due to ...“);
* return;
*
* Note that the 2nd argument to ssSetErrorStatus must be persistent memory.
* It cannot be a local variable.
*/
static int
checkError(SimStruct *S){
if (ErrStat >= AbortErrLev){
ssPrintf(“\n“);
ssSetErrorStatus(S ErrMsg);
mdlTerminate(S); // terminate on error (in case Simulink doesn‘t do so itself)
return 1;
}
else if (ErrStat >= ErrID_Warn){
ssPrintf(“\n“);
ssWarning(S ErrMsg);
}
else if (ErrStat != ErrID_None){
ssPrintf(“\n%s\n“ ErrMsg);
}
return 0;
}
static void
getInputs(SimStruct *S double *InputAry){
int k;
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S 0);
for (k = 0; k < ssGetDWorkWidth(S WORKARY_INPUT); k++) {
InputAry[k] = (double)(
- 上一篇:图像处理中经典细化算法集合matlab
- 下一篇:EKF_matlab
相关资源
- 相关向量机的快速算法
- MATLAB的S-Function编写指导
- Faster-RCNN+ZF制作自己的数据集和训练模
- FASTICA盲源信号分离代码Matlab
- fastFWI-master.zip
- Clustering by fast search and find of density
- Faster-RCNN+ZF制作自己的数据集和训练模
- matlab开发-功率曲线FAsmallscalewindturbi
- Clustering by fast search and find of density
- matlab S-Function编写指导
- fast角点检测算法for matlab
- 快速引导滤波
- FAST特征点检测算法的matalb源码实现
-
SIMUli
nk中自抗扰控制技术自定义模块 - FAST角点检测算法MATLAB程序
- 基于FASTica算法的独立成分分解
- FCT(Fast Compress Tracking)目标跟踪程序
- FasterRCNN mex等文件
- Fast Subspace Clustering via RepresentationSp
- RCNNfast-RCNN和faster-RCNN最全文献和matl
- MATLAB的S-Function编写指导以及一些
- fastKICA matlab程序
- FastIca独立成分分析代码
- Fast_Kurtogram.m
- FastICA2.5
- FAST检测角点+SIFT特征描述符描述角点
- FasterRcnn2.m
- FASTICA盲源信号分离代码Matlab(复信号
- FastSLAMmatlab仿真算法
- 超详细的ORB解读.md
评论
共有 条评论