LPA Application Brief #1
|Company||The Forestry Commission|
"But it was only using the Prolog he had written that we were able to confirm this"
Given the potential consequences of a shifting world ecology it will come as no surprise that the forestry commission is developing software models to simulate the effects of environmental change on forests. At the Alice Holt Research Station, Tony Ludlow uses a development environment written in LPA Prolog to create and manage the complex mathematical models needed to simulate forest development.
The models are written in a Fortran-based language named DareP, that allows submodels to be written and combined. The DareP translator boils this all down into a set of Fortran routines that can be executed. At the level of complexity that the modelling system works, the interdependence of sub-models and terms can quickly become very difficult to check. Ludlow recognised this problem early on when he and a student who was assisting him had to check a large program.
It took about five hours to check all the units. He asked his student to write a Prolog program to check the units for him. A couple of weeks later he came back with the news that the units had been wrong. "But it was only using the Prolog he had written that we were able to confirm this," said Ludlow. The unit checker is just one part of the environment, which has evolved into an integrated development tool which now supports code reusability.
The equations that make up models and sub-models are stored in a Prolog database. This not only means that several models can use the same physical lines of code, but also that a model can be built by specifying how existing sub-models and equations interact.
The system checks the left hand side of each equation as it is written and tries to find a match in its data base. If it exists in the database the programmer will be asked if he would like to use the existing version. He or she can then examine that sub-model or term, and then if necessary edit it, and save an additional version.
If the term does not exist in the database the programmer is invited to specify its units and define the right hand side of the equation. As terms are added to the right hand side their units are requested, unless they are already in the database. The consistency of units is checked when the right hand side is completed. The system editor keeps a list of terms which have not yet been defined in the current model.
At present the DareP translator cannot be invoked from within the Prolog system, the eventual aim is to build an integrated development and management environment for DareP models.
Copyright © 2018 LPA Ltd
All rights reserved