|
实例程序如下:
Model Distilla
// <parameter name> as <parameter type> (<default>, description:"<description>");
// <variable name> as <variable type> (default, <spec>, description:"<description>");
// <submodel name> as <model type> (<submodel variable> = <variable name>,...);
// <structure name> as external <structure type>("<default instance>");
// <port name> as <Input or Output> <port type>;
// <equation_name> : <expression1> = <expression2>;
// Call (<output argument list>) = <procedure name>(<input argument list>);
//定义变量
//(1)进料状态、流量、压力、组成、更各组分摩尔流量
FLOW_Feed as Flow_Mol (Description:"Feed Flow");//(kmol/h)
Temp_Feed as Temperature (Description:"Temperature of Feed");//(℃)
Pre_Feed as Pressure (Description:"Pressure of Feed");//(bar)
Z_Feed(ComponentList) as Molefraction (Description:"Feed mole fraction");
mw(ComponentList) as Notype (Description:"mole mass of each component");//(kg/kmol)
mw("H2O")=18; //mole mass of each component)
mw("HAC")=60.05;
mw("ETAC")=88.11;
mw("ETOH")=46.01;
//膜参数
Acell as Area (100,FIXED,Description:"Area of membrane(m2)");//膜面积
Ncells as IntegerParameter (10,Description:"Number of cross flow cells");
//midu as IntegerParameter (Description:"Liquid density");
midu([1:Ncells]) as dens_mass (Description:"Liquid density");
//滞留状态
Flow_Ret([0:Ncells]) as Flow_Mol (Description:"Retentate Flow");//(kmol/h)
Temp_Ret([0:Ncells]) as Temperature (Description:"Temperature of Rententate");//(℃)
Pre_Ret([0:Ncells]) as Pressure (Description:"Pressure of Rententate");//(bar)
Z_Ret(ComponentList,[0:Ncells]) as Molefraction (Description:"Retentate mole fraction");
Z_Retwt(ComponentList,[1:Ncells]) as Massfraction (Description:"Retentate mass fraction");
C_Ret(ComponentList,[1:Ncells]) as Notype (Description:"Retentate mass composition(kg/m3)");//方程中定义的推动力,所以额外定义
//渗透相状态
Flow_Perm([1:Ncells]) as Flow_Mol (Description:"Permeate Flow");//(kmol/h)
Temp_Perm([1:Ncells]) as Temperature (Description:"Temperature of Retentate");//(℃)
Pre_Perm([1:Ncells]) as Pressure (Description:"Pressure of Retentate");//(bar)给定渗透测压力
Pressure_Perm as Pressure (0.0035,FIXED,Description:"Pressure of Permeate");//(bar)渗透侧减压操作,单独定义压力,不同渗透侧炔煌醚沽χ怠
Z_Perm(ComponentList,[1:Ncells]) as Molefraction (Description:"Permeate mole fraction");
C_Perm(ComponentList,[1:Ncells]) as Notype (Description:"Permeate mass composition(kg/m3)");
//混合后渗透相
Flow_Perm_sum as Flow_Mol (Description:"Permeate Flow");//(kmol/h)
Temp_Perm_sum as Temperature (Description:"Temperature of Permeate");//(℃)
Pre_Perm_sum as Pressure (Description:"Pressure of Permeate");
Z_Perm_sum(ComponentList) as Molefraction (Description:"Permeate mole fraction");
vaporenthalpy_P_ASPEN_sum as Enth_Mol_Vap (Description:"Aspen liquid enthalpy of Permeate"); //(GJ/kmol)
//扩散方程
Diffusion(ComponentList,[1:Ncells]) as Notype (Description:"diffusion coefficients(m3/h)";//(根据不同的单元计算)扩散系数
//焓
vaporenthalpy_P_ASPEN([1:Ncells]) as Enth_Mol_Vap (Description:"Aspen vapor enthalpy of Retentate"); //(GJ/kmol)
liquidenthalpy_R_ASPEN([0:Ncells]) as Enth_Mol_Liq (Description:"Aspen liquid enthalpy of Retentate"); //(GJ/kmol)
//liquidenthalpy_R_ASPEN_Feed as Enth_MOL_Liq (Description:"Aspen Liquid enthalpy of Feed");//(GJ/kmol)
程序有两个错误,都是变量vaporenthalpy_P_ASPEN的问题
Information: Reading type Distilla
55: vaporenthalpy_P_ASPEN([1:Ncells]) as Enth_Mol_Vap (Description:"Aspen vapor enthalpy of Retentate"); //(GJ/kmol)
Error at position 38: property vaporenthalpy_P_ASPEN does not exist in Model Distilla
55: vaporenthalpy_P_ASPEN([1:Ncells]) as Enth_Mol_Vap (Description:"Aspen vapor enthalpy of Retentate"); //(GJ/kmol)
Error at position 38: Reserved word "as" unexpected - bad syntax or (missing) punctuation
我想咨询一下各位大佬,为什么一开始定义vaporenthalpy_P_ASPEN这个变量就报错说变量不存在。我一开始以为是写错了,检查了好几遍,55行前面都和给的实例一样的。我看前面有个vaporenthalpy_P_ASPEN_sum变量,以为是这个变量干扰程序,把vaporenthalpy_P_ASPEN都改成了vaporenthalpy_P_ASPEN_sum,但是在55行还是出现上面两个错误。请各位大佬帮忙解惑,以前没接触过编程语言,最近实在要用才开始学。
|
|