Home Page Up One Level Introduction Design Plotting Availability

Introduction to BSIM

William Silvert

What is BSIM?

BSIM is a software package (i.e., a set of computer programs) designed to help develop ecosystem models. It is based on the idea that it is relatively easy to translate scientific concepts into a computer simulation model if you don't have to worry about the technical details that programming entails. The BSIM package is intended to handle all the hard parts of programming and let the users focus on translating their ideas into quantitative expressions that a computer can deal with.

The BSIM Package

The parts of the BSIM package can be divided into three categories. These are the submodel, model, and system components. Submodel refers to the part of the package that you deal with directly, namely a set of subroutines that represent the working of real ecosystem components. The model itself is the combined set of submodels that you and other scientists work on together. The system part is what makes the computer run the model you construct, and if it works right you won't have to worry about it.

The submodels, and the model which includes them, are Fortran subroutines consisting almost entirely of equations written by the users. All the complicated stuff which Fortran insists on is handled by BSIM system software; this includes subroutines for input, output, data manipulation, plotting, integration, and so on, as well as compilation, loading, and other machine-dependent processes.

The BSIM package contains two standard programs and a set of subroutines for building models. The programs are BSETUP, which helps generate code for new models, and BSEE, which is used for viewing and analysing the output of a simulation. The user has to create additional programs for each model -- using the BSIM tools, an experienced user can create a new model in as little as two minutes!

Example: The Medieval Forest Model

Suppose that you are working on a model of an ancient forest, and it has been agreed to break the total model into three submodels, dealing with unicorns, virgins, and hunters. It would be possible to write the entire model as a single subroutine, but it is better to break it into separate modules so that, for example, researchers whose main interest is virgins do not have to become involved in the modelling of unicorns and hunters.

The main subroutine for the model looks like this:

      CALL SRU
      CALL SRV
      CALL SRH
You are in charge of the unicorn submodel, and you start with the empty subroutine:
These three lines constitute a null submodel -- it doesn't do anything until you add some program lines to it. Your contribution to the model goes between the first and second lines and consists mainly of a set of equations. For unicorns the population dynamics are known to be described by the differential equation:
To translate this into Fortran we have to shorten the names to a maximum of six characters, but BSIM is a bit stricter and imposes a five-character limit on state variables, so we use UNCRN for the number of unicorns and VIRGN for the number of virgins. BSIM has a special subroutine to compute derivatives, so the computer form of this is:
with everything in capitals. Thus the unicorn submodel with the equation (and a bit of documentation to explain it) looks like:
C     Unicorn submodel for the MFM
C     Unicorns can only be captured by Virgins
The only remaining problem is to let this subroutine comunicate with the rest of the model, which is by means of INCLUDE files which are explained in detail in the BSIM Programmers' Manual. The answer is to use INCLUDE files, which are not part of the Fortran standard but which are supported by most compilers. The format of these INCLUDE statements depends on the compiler, but one possible form of the Unicorn submodel is:
C Unicorn submodel for the MFM
      include STATE.I
      include COMMON.I
C Unicorns can only be captured by Virgins
where STATE.I and COMMON.I are standard BSIM files.

This completes the Unicorn subroutine, but undoubtedly you are interested in virgins and may even want to join the group handling them. The population dynamics of virgins in a forest can be described by a model of the form:

where b is the birth rate and v is an interaction coefficient (oral tradition has it that hunters turned the heads of maidens with violins, probably a reference to the popular and portable viol d'amore); this equation appears in the computer program as:
The presence of virgins tends to reduce the number of active hunters. Even though most of the dynamics of the hunter population is contained in the submodel SRH, the contribution from the virgin submodel SRV can be taken into account by the subroutine CHANGE without worrying about what other submodels may affect the HUNTR population; this is done as follows:
The virgin subroutine thus looks like this:
C Virgin submodel for the MFM
      include STATE.I
      include COMMON.I
C Virgins are born at constant rate B, but they
C may cease to be Virgins after meeting Hunters:
C Hunters seem to prefer Virgins to Hunting:
The hunter submodel is constructed similarly. It depends only on the sociopolitical dynamics of the nation, particularly the labour market and the defense budget, and on the whims of the monarchy -- its construction is left as an exercise for the reader.

From the viewpoint of a user the modelling process involves converting scientific understanding of ecological processes into equations, and expressing these equations in computerese as shown above. The purpose of the BSIM package is to handle everything else. If you have written Fortran programs before you know that that there is a lot to be done before you actually see the output from subroutines like the ones above. BSIM does it.

History of BSIM

The BSIM approach originated with the Institute of Animal Resource Ecology (IARE) at the University of British Columbia and was motivated by a conviction that the modelling of complex systems required a methodology which brought together specialists from different disciplines. This group pioneered the computer workshop approach and developed a computer language, SIMCON, which made it possible to develop models quickly and interactively, and to present the results in easily understood graphical form (Hilborn 1973). A German visitor to IARE, Wolf Greve from the Biologische Anstalt Helgoland (BAH), undertook to develop a minicomputer-based version of SIMCON to facilitate this methodology, and the simulation package BAHSIM was written by Volker Kartheus at Helgoland under his direction. BAHSIM was then adopted by the Dutch group Biologisch Onderzoek Eems-Dollard Estuarium (BOEDE) for their modelling study of the Ems-Dollard estuary. They held several workshops with it and developed a new version known as BOESIM.

I have attended most of the BOEDE workshops and the experience convinced me that the workshop approach with the BAHSIM/BOESIM software was an ideal way to approach the modelling of complete ecosystems. Don Gordon from MEL spent several months working with the BOEDE group in 1982 and felt that a comparative modelling study of the Ems-Dollard and Cumberland Basin estuaries would be valuable to both groups, so in March 1983 a group of scientists (Peter Schwinghamer, Ken Mann, Don Gordon and myself from MEL, and Graham Daborn from Acadia) attended a joint workshop with the BOEDE group in Holland, where a preliminary attempt was made to model the Cumberland Basin in the same way as the Ems-Dollard estuary. The results were very promising, and so I spent the summer of 1983 with the BOEDE group studying the simulation software and preparing a similar package to run at MEL.

BSIM is now extensively used for modelling studies at the Bedford Institute of Oceanography. In addition to the Cumberland Basin model mentioned above (Gordon et al 1986, Keizer et al 1987), it has been used for several continental shelf modelling studies, both specific (the Grand Banks of Newfoundland) and generic in scope (Silvert 1988). It has also been useful in other areas, such as bioeconomic modelling (Silvert and Crawford 1988).

The present BSIM package is written strictly according to Fortran-77 standards and can be run with little change on any machine having a compiler which conforms to this standard. The main menus and utility programs are modelled on those used in the BAHSIM and BOESIM versions, and BSIM has run models written under each of these systems. Additional subroutines have been written by myself and Wolfgang Ebenhoeh from the University of Oldenburg (Germany) which simplify the use of the system and improve the treatment of many of the processes common to many ecological models, such as tidal flushing and daily light cycles. Paul Keizer from the Bedford Institute of Oceanography has also contributed extensively to the development of BSIM.

A Typical BSIM Workshop

BSIM can be used by individual scientists as a research tool, but it is at its best when used in a workshop environment where it can be used to coordinate the work of individuals who may be working on different parts of an ecosystem. Here is a description of a typical BSIM workshop.

Before or at the beginning of the workshop the various participants decide how the model should be structured and how the subcomponents talk to each other. For example, a marine ecosystem investigation may involve separate subgroups dealing with transport process, pelagic organisms, and benthos, and they may decide that they are mainly interested in fluxes of carbon and nitrogen.

The participants then form separate groups and work on Fortran subroutines describing the subsystems. While they do this, the workshop organizer(s) customize the system for the given model structure -- this is a routine task taking no more than an hour or so. If the model structure is agreed on before the workshop, then a simple starting model can be prepared in advance.

Once a starting form of the model is ready, each subgroup runs simulations to test and evaluate their submodel. Most of the workshop consists of alternation between editing sessions and simulation runs, since once the basic structure of a submodel is developed it is feasible to make small changes and study their effects as part of the modelling process. This is one of the reasons why this kind of interactive modelling is such a valuable learning experience. The other submodels are taken from a standard library which was set up before the workshop, so changes in one submodel can be studied independently of modifications which another group is simultaneously making to another one. Groups can however work together and combine different versions of the submodels in any way they choose. Regularly the subgroups meet together in plenary session to discuss their results. At this time the standard model library can be updated with improved subroutines, so future simulations include the updated routines of the other groups. This stepwise approach to model development makes it possible to see how each change in each submodel separately affects the system.

Once the modelling process has started, the groups usually work closely together to resolve discrepancies and incompatibilities -- for example, the benthic subgroup may discover that its input from the pelagic subsystem is not enough to maintain observed rates of production. This is the best part of the workshop. The different subgroups also do preliminary sensitivity analyses to see how changes in the various parameter values change the behaviour of the system.

By the end of the workshop the model has been refined and improved, but there always remain unresolved questions. One of the main functions of the workshop is to help define these questions and to identify areas where experimental uncertainties limit our ability to understand the system.

Using BSIM

BSIM is available for virtually any computer that has a Fortran-77 compiler. It currently runs on microcomputers -- MS-DOS, Macintosh, and Atari ST -- as well as Unix systems and mainframes. It is distributed at no charge by anonymous ftp. Please contact Bill Silvert for further information.


Gordon, D. C. Jr., P. D. Keizer, G. R. Daborn, P. Schwinghamer and W. L. Silvert. 1986. Adventures in holistic ecosystem modelling: the Cumberland Basin ecosystem model. Neth. J. Sea Res. 20:325-335.

Hilborn, Ray. 1973. A control system for FORTRAN simulation programming. Simulation (May 1973), pp. 172-175.

Keizer, P. D., D. C. Gordon, Jr., P. Schwinghamer, G. R. Daborn and W. Ebenhoh. 1987. Cumberland Basin Ecosystem Model: Structure, Performance and Evaluation. Can. Tech. Report Fish. Aquat. Sci. No. 1547.

Silvert, William. 1988. Generic Models of Continental Shelf Ecosystems. Ecodynamics, a Workshop on Theoretical Ecology, Jülich, Oct. 1987. Springer-Verlag Lecture Notes in Physics.

Silvert, W., and R. J. M. Crawford. 1988. The Periodic Replacement of One Fish Stock by Another. Proc. Int. Symp. on Long Term Changes in Marine Fish Populations, Vigo, Spain, Nov. 1986, 161-180.

Developed and maintained by William Silvert.