Fortran Coder

查看: 196|回复: 3
打印 上一主题 下一主题

[求助] Aspen Customer Model编写书本实例Fortran错误

[复制链接]

2

帖子

1

主题

0

精华

新人

F 币
12 元
贡献
5 点
跳转到指定楼层
楼主
发表于 2024-9-11 15:31:19 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
实例程序如下:
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行还是出现上面两个错误。请各位大佬帮忙解惑,以前没接触过编程语言,最近实在要用才开始学。
分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

2008

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1538 元
贡献
662 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

地板
发表于 2024-9-11 21:31:40 | 只看该作者
我很确定的是,你的代码并不是 Fortran,你最好去 Aspen 相关的社区去咨询。

2

帖子

1

主题

0

精华

新人

F 币
12 元
贡献
5 点
板凳
 楼主| 发表于 2024-9-11 15:58:17 | 只看该作者
fcode 发表于 2024-9-11 15:46
看起来这似乎并不是 Fortran 代码

Aspen Customer Model里面自定义模型用的语言是Fortran,也直接给提供了一个编写界面,代码我只贴到出现错误的地方,剩下的代码没贴了。

2008

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1538 元
贡献
662 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

沙发
发表于 2024-9-11 15:46:44 | 只看该作者
看起来这似乎并不是 Fortran 代码
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-9-21 16:50

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表