www.tech-doc.cn 多行宏指令

多行宏指令


动态块多行宏指令的命名规范与标准子模型不同。变量名称会直接包含在关联函数的名称中,即使该多行宏没有动态维度大小。

此外,macindex参数总是会被传递给多行宏函数。

由于同一个多行宏函数会关联多个变量,因此需要向宏函数传递补充信息:

以下代码示例展示了一个包含多行宏v1的子模型MAS21DBK,该宏具有可变大小,并属于动态端口。v1大小在v1_size中计算。

extern double mas21b_macro0_(int *n, double rp[18], int ip[2]
, double c[2], int ic[10])


{
double v1;
int loop;
/* >>>>>>>>>>>>Extra Macro Function macro0 Declarations Here. */
/* <<<<<<<<<<<<End of Extra Macro macro0 declarations. */
int stoptype, strib;
double mass, fstick, fcoul, rvisc, wind, dvel, restdvel, restcoeff
, astrib, xmin, Kbmin, Dbmin, Pdmin, xmax, Kbmax, Dbmax, Pdmax, 
theta;


stoptype = ip[0];
strib = ip[1];


mass = rp[0];
fstick = rp[1];
fcoul = rp[2];
rvisc = rp[3];
wind = rp[4];
dvel = rp[5];
restdvel = rp[6];
restcoeff = rp[7];
astrib = rp[8];
xmin = rp[9];
Kbmin = rp[10];
Dbmin = rp[11];
Pdmin = rp[12];
xmax = rp[13];
Kbmax = rp[14];
Dbmax = rp[15];
Pdmax = rp[16];
theta = rp[17];
loop = 0;


/*

Define and return the following macro variable:


v1 = ??;
*/