April 19, 2024, 10:38:31 AM
Forum Rules: Read This Before Posting


Topic: Aspen Plus: Execute command line through Fortran Calculator  (Read 2774 times)

0 Members and 1 Guest are viewing this topic.

Offline Miguel

  • New Member
  • **
  • Posts: 5
  • Mole Snacks: +2/-0
Aspen Plus: Execute command line through Fortran Calculator
« on: August 06, 2018, 03:41:04 AM »
Hello there,

I am working on a simulation which needs a calculator to call some Python models I made. My strategy is to use Fortran i/o functions to write export values, call Python programs through command prompt and read their outputs as import values from Fortran. I don't have too much experience working with Fortran, here is my code:

Code: [Select]
      open(unit=1, file="in.txt")
      open(unit=2, file="bioprox.txt")
      open(unit=3, file="bioult.txt")
      open(unit=4, file="biosul.txt")
     
      write(1,*) WATER, ACID, BIOMASS
      write(2,'(1x,f4.2)') BIOPROX
      write(3,'(1x,f6.3)') BIOULT
      write(4,'(1x,f4.2)') BIOSUL
     
       
      close(1)
      close(2)
      close(3)
      close(4)

This works fine, but when I tried to call terminal I get some errors. If I add the following statement:

Code: [Select]
      call execute_command_line("mkdir hey")
Quote
  ****TERMINAL ERROR
      COULD NOT LOAD DYNAMIC LOAD MODULE




 ********************************************************************
 *  ERROR SEVERITY LEVEL OF  0 IS <= ABORT LEVEL OF  0              *
 *  EXECUTION IS TERMINATED: SIMULATION WILL NOT BE EXECUTED        *
 ********************************************************************



! Errors while processing input specifications

An if I use system calling:

Code: [Select]
      call system("mkdir hey")
Quote
  *** SEVERE ERROR
      ERROR DURING DYNAMIC LINK OF USER ROUTINE(S) OR IN-LINE FORTRAN
      PLEASE CHECK FILE _3340afg.ld FOR LINKER MESSAGES.

  *** SEVERE ERROR
      COULD NOT RESOLVE USER OR IN-LINE FORTRAN SUBROUTINE(S):

      SUBROUTINE "ZZFORT" IS MISSING

  *** SEVERE ERROR
      PROGRAM TERMINATED DUE TO UNRESOLVED ROUTINES

! Errors while processing input specifications

And checking the linker file:

Quote
_3340afg.txt : error LNK2019: símbolo externo _SYSTEM@8 sin resolver al que se hace referencia en la función _ZZFORT
_3340afg.dll : fatal error LNK1120: 1 externos sin resolver
Link failure, status = 1120

Any clue of what is wrong? Is it possible to do what I am trying?

Thanks!!
Miguel

Sponsored Links