the fortran simulation translator, a simulation language

3
Short communication The Fortran simulation translator, a simulation language D.W.G. van Kraalingen, C. Rappoldt, H.H. van Laar Wageningen University and Research Centre, P.O. Box 430, AK-6700 Wageningen, The Netherlands Abstract The Fortran simulation translator (FST) is a simulation language, that enables the researcher to develop concepts, in terms of mathematical equations, e.g. about agro-ecological systems, that are converted in a Fortran program with data files (Fortran simulation environment, FSE). This generated Fortran program is well-structured and can be executed using both user developed and standard mathematical library subroutines (e.g. IMSL). The possibility to use the generated Fortran program as a starting point for further model development makes FST a valuable tool, both for research and education. # 2002 Elsevier Science B.V. All rights reserved. Keywords: Fortran simulation translator; Fortran simulation environment; Simulation language 1. Introduction Fortran simulation environment (FSE; van Kraalingen, 1995) has been developed to provide crop modellers with a flexible and powerful programming environment in Fortran 90. The simulation environment is developed as a frame- work that provides functionality for specification of (sub)model processes, integration of rate vari- ables, time update, input of weather data, reading of model parameters from files and graphical presentation of results. The Fortran simulation translator (FST; Rap- poldt and van Kraalingen, 1996) was developed because there was a need for a simple simulation language that, at the same time, allows the user to shift to the more powerful and flexible simulation environment that FSE provides. This shift is made easy because the FST translator translates the FST source code into a clean and versatile Fortran program and also generates the corresponding data files needed in the FSE (see Fig. 1). Primarily, FST should be seen as a language for education and simple modelling purposes. The quality of the generated Fortran, however, pro- vides an excellent starting point for users who need even more flexibility than FST provides. How these generated Fortran routines operate is dis- cussed in Chapter 10 in Leffelaar (1999). In 2001, the C.T. de Wit Graduate School for Production Ecology and Resource Conservation of Wageningen University sponsored a project to adapt the FST software for Windows */FSTWin. Corresponding author E-mail address: gon.v[email protected] (H.H. van Laar). Europ. J. Agronomy 18 (2003) 359 /361 www.elsevier.com/locate/eja 1161-0301/02/$ - see front matter # 2002 Elsevier Science B.V. All rights reserved. PII:S1161-0301(02)00131-4

Upload: dwg-van-kraalingen

Post on 19-Sep-2016

274 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: The Fortran simulation translator, a simulation language

Short communication

The Fortran simulation translator, a simulation language

D.W.G. van Kraalingen, C. Rappoldt, H.H. van Laar �

Wageningen University and Research Centre, P.O. Box 430, AK-6700 Wageningen, The Netherlands

Abstract

The Fortran simulation translator (FST) is a simulation language, that enables the researcher to develop concepts, in

terms of mathematical equations, e.g. about agro-ecological systems, that are converted in a Fortran program with data

files (Fortran simulation environment, FSE). This generated Fortran program is well-structured and can be executed

using both user developed and standard mathematical library subroutines (e.g. IMSL). The possibility to use the

generated Fortran program as a starting point for further model development makes FST a valuable tool, both for

research and education.

# 2002 Elsevier Science B.V. All rights reserved.

Keywords: Fortran simulation translator; Fortran simulation environment; Simulation language

1. Introduction

Fortran simulation environment (FSE; van

Kraalingen, 1995) has been developed to provide

crop modellers with a flexible and powerful

programming environment in Fortran 90. The

simulation environment is developed as a frame-

work that provides functionality for specification

of (sub)model processes, integration of rate vari-

ables, time update, input of weather data, reading

of model parameters from files and graphical

presentation of results.

The Fortran simulation translator (FST; Rap-

poldt and van Kraalingen, 1996) was developed

because there was a need for a simple simulation

language that, at the same time, allows the user to

shift to the more powerful and flexible simulation

environment that FSE provides. This shift is made

easy because the FST translator translates the FST

source code into a clean and versatile Fortran

program and also generates the corresponding

data files needed in the FSE (see Fig. 1).

Primarily, FST should be seen as a language for

education and simple modelling purposes. The

quality of the generated Fortran, however, pro-

vides an excellent starting point for users who need

even more flexibility than FST provides. How

these generated Fortran routines operate is dis-

cussed in Chapter 10 in Leffelaar (1999).

In 2001, the C.T. de Wit Graduate School for

Production Ecology and Resource Conservation

of Wageningen University sponsored a project to

adapt the FST software for Windows*/FSTWin.� Corresponding author

E-mail address: [email protected] (H.H. van Laar).

Europ. J. Agronomy 18 (2003) 359�/361

www.elsevier.com/locate/eja

1161-0301/02/$ - see front matter # 2002 Elsevier Science B.V. All rights reserved.

PII: S 1 1 6 1 - 0 3 0 1 ( 0 2 ) 0 0 1 3 1 - 4

Page 2: The Fortran simulation translator, a simulation language

2. Description of the software

In FSE, state and rate calculations are imple-

mented in separate sections in the major subrou-

tines for the plant and soil processes. The main

program controls which section is activated

through the concept of task-controlled execution.

The program lines of the plant and soil water sub-

processes are separated into rate and state sections

and only one of these tasks is executed during a

single call from the main program. Four different

tasks are distinguished: initialization, rate calcula-

tion, integration and terminal calculation (Fig. 2).FSTWin (Windows Version of FST, using the

Compaq Visual Fortran Compiler) has been

developed to provide the user a friendly andeasy-to-use simulation language providing clear

error messages. The syntax of the FST language is

based on the syntax of CSMP (IBM Corporation,

1975). In FST, three sections can be distinguished:

INITIAL, DYNAMIC and TERMINAL. These

keywords indicate that the computations must be

performed before, during and after a simulation

run, respectively.The INITIAL section can well be used to specify

the input data (initial conditions and parameters)

and the time variables, and to define data output

and the integration method used in the model.

Furthermore, the computation of results that are

used as input for the dynamic section of the

program may be executed here. The DYNAMIC

section contains the complete description of themodel dynamics, together with any other compu-

tation required during the simulation. It is, there-

fore, usually the most extensive section in a model.

The TERMINAL section can be used for

computations and specific output that is only

available at the end of the simulation run. This

could be a computation based on the final values

of one or more variables.FST is provided with a sorting algorithm to

allow the user to think in terms of process

descriptions rather than in terms of correctly

sequencing the statements. Sorting of the state-

ments and checking the technical integrity is done

for each section separately.

Important features of FST are, e.g., the clear

error messages, graphical output and the possibi-lity to read external weather data (see van Kraa-

lingen et al., 1991).

3. Results

The ‘Wageningen’ models such as SUCROS

(van Laar et al., 1997), ORYZA1 (Kropff et al.,

1994) and INTERCOM (Kropff and van Laar,1993) have been programmed in FST/FSE. At the

International Rice Research Institute, Philippines,

a successor of the ORYZA models has been

developed: ORYZA2000, including water and

nitrogen modules (Bouman et al., 2001). The

modellers group in Gainesville, FL, recently re-

Fig. 1. Organization of translation of an FST model into a

model that can run in the FSE.

Fig. 2. General structure for incorporating several sub-pro-

cesses illustrated for a plant and a soil routine containing Euler

integration and rate calculation into a single simulation model.

D.W.G. van Kraalingen et al. / Europ. J. Agronomy 18 (2003) 359�/361360

Page 3: The Fortran simulation translator, a simulation language

organized their CROPGRO model into the mod-ular format as described in FSE.

4. Access to the software

FST is available via anonymous ftp

at ftp1.dpw.wageningen-ur.nl/exchange/Graduate

SchoolPERC. Copy the FST.zip file to C:\; andrun the set-up file.

References

Bouman, B.A.M., Kropff, M.J., Tuong, T.P., Wopereis,

M.C.S., ten Berge, H.F.M., van Laar, H.H., 2001.

ORYZA2000: modeling lowland rice. International Rice

Research Institute, Manila, Philippines, 235 pp.

IBM Corporation, 1975. Continuous Simulation Modelling

Programme III (CSMP III). Programme Reference Manual

SH 19-7001-3. Data Processing Division, 1133 Westchester

Avenue, White Plains, New York, 206 pp.

Kropff, M.J., van Laar, H.H. (Eds.), 1993. Modelling Crop�/

Weed Interactions. CAB International, Wallingford, UK,

274 pp.

Kropff, M.J., van Laar, H.H., Matthews, R.B. (Eds.), 1994.

ORYZA1: An Ecophysiological Model for Irrigated Rice

Production. SARP Research Proceedings. International

Rice Research Institute, Manila, Philippines, 110 pp.

Leffelaar, P.A. (Ed.), 1999. On Systems Analysis and Simula-

tion of Ecological Processes, Vol. 4, 2nd ed. Current Issues

in Production Ecology. Kluwer Academic Publishers, Dor-

drecht, 318 pp.

Rappoldt, C., van Kraalingen, D.W.G., 1996. The Fortran

Simulation Translator FST Version 2.0. Introduction and

Reference Manual. Quantitative Approaches in Systems

Analysis No. 5, June 1996. C.T. de Wit Graduate School for

Production Ecology, Wageningen, The Netherlands, 178 pp.

van Kraalingen, D.W.G., 1995. The FSE System for Crop

Simulation, Version 2.1. Quantitative Approaches in System

Analysis No. 1. C.T. de Wit Graduate School for Produc-

tion Ecology, Wageningen, 27 pp.

van Kraalingen, D.W.G., Stol, W., Uithol, P.W.J., Verbeek,

M.G.M., 1991. User Manual of CABO/TPE Weather

System. CABO/TPE Report. Centre for Agrobiological

Research, Wageningen, The Netherlands, 28 pp.

van Laar, H.H., Goudriaan, J., van Keulen, H. (Eds.), 1997.

SUCROS97: Simulation of Crop Growth for Potential and

Water-limited Production Situations. Quantitative Ap-

proaches in Systems Analysis No. 14. C.T. de Wit Graduate

School for Production Ecology, Wageningen, The Nether-

lands, 52 pp.

D.W.G. van Kraalingen et al. / Europ. J. Agronomy 18 (2003) 359�/361 361