Thread Content
I would like to ask the experts: how can one embed FORTRAN within ASPEN, and can ASPEN custom models call the existing model modules in Plus? Since I’m still at a beginner level, my questions might not be very accurate; I hope everyone can offer some guidance. Thank you!
It should be embedded, right? There are two forms of embedding Fortran in A+: one is inline Fortran statements, and the other is Fortran subroutines. Online Fortran statements are relatively simple; for example, when performing sensitivity analysis or using a calculator, new variables can be defined using online Fortran statements. Fortran subroutines are a bit more complex; you need to understand the various variable types, variable names, and their meanings in your model. If you want to use these variables in your subroutine, you must pass them into it. I suppose there’s no need to explain actual parameters and form parameters anymore. In your subroutine, you can also define your own variables, so that you can write your own subroutines; the code syntax just needs to conform to Fortran’s rules. After writing it, the simplest way is to place the subroutine in a subdirectory of your simulation, compile it using the compilation commands provided by A+, and then run your A+ model; it will call the subroutine automatically wherever there is a reference to it. That’s it. If there are any mistakes, please point them out, classmates. I have only shown one way to call a subroutine; for more information, refer to the A+ help files.
I forgot to answer the second question. Although I haven’t used ACM, I’m sure it can directly call the modules in A+.