Integration of legacy sub-system components into an object-oriented simulation model of a complete pastoral dairy farm

https://doi.org/10.1016/S1364-8152(99)00013-4Get rights and content

Abstract

An object-oriented (OO) approach to developing a computer simulation of a complete pastoral dairy farm system is outlined. Since component models already existed which encapsulated the functionality of the high level objects in the overall system it was a primary design goal to be able to incorporate them into the OO framework. These components had been developed in procedural programming languages and techniques were investigated to incorporate them with little or no re-coding, and which allow them to be used in an ‘object-like’ way. The techniques involved recompilation of legacy source-code as dynamic link libraries (DLL's), and accessing stand-alone executable programs through inter-process communication (IPC) protocols. A cow metabolism model developed in the proprietary ACSL environment, and a pasture growth model for which FORTRAN source code was available were incorporated into the Smalltalk OO framework using the Microsoft Component Object Model (COM) techniques. Multiple instances of each component (each representing a distinct real farm entity) were required by the OO framework and the COM methodology was able to support this. The integration of these components into the host OO framework involved using proxy objects to provide translation to/from the COM messaging, thus providing the OO framework with consistent inter-object communication.

Introduction

This paper describes techniques for integrating existing software models of real-world entities — legacy component models — into a broader object-oriented (OO) simulation framework. As discussed in a preliminary account of this work (Neil et al., 1997, Sherlock et al., 1997), it was advantageous to do this as part of our on-going development of a simulation model of a complete pastoral dairy farm. The work described here is a further development of those ideas, which are clearly applicable to other systems having the same general characteristics as our specific problem.

Pastoral dairying (the predominant dairy production system in New Zealand and parts of Australia and South America) utilises grazed pasture as the principal feed source (Holmes and Wilson, 1987). The major discrete entities are cows (both lactating and non-lactating) and paddocks (enclosed land areas growing pasture herbage for grazing or, less frequently, crops for feed supplements). The basic management goal is to maximise sustainable economic return, and broadly this requires maximising both production and utilisation of feedstuffs. However, the presence of complex feedback loops in a system of inherently complex components makes a predictive understanding of the overall system behaviour very difficult (e.g. overall pasture production depends on the pattern of harvesting, which depends on the pattern of feed demand, which depends on the calving pattern, which depends on the nutritional state of the cows, which depends on overall pasture production). These difficulties are compounded by uncontrollable, and largely unpredictable climate variables (the dominant system inputs) which make unambiguous farmlet experiments virtually impossible to perform.

Numerous component models which simulate aspects of pastoral dairying do exist. For example, the mechanistic MOLLY bovine metabolism model of Baldwin (1995) is extremely detailed and accurate, and is the result of some 30 years of development. However, there is a clear need for a whole-farm system computational model which would allow agricultural scientists to conduct simulation experiments unbiased by uncontrolled variables. Such a model would also minimise the need for (and focus the direction of) costly field investigations — particularly those which centre on management practices (e.g. stocking rates, grazing patterns, supplementary feeding strategies etc.). This framework would support simulation experimentation beyond current normal farm system operational boundaries and provide a basis for automated searches for optimal conditions (e.g. see Mayer et al., 1996, Hart et al., 1998). The development of a whole farm system simulation model should, however, capitalise on the existing models of system components. A primary design goal should therefore be to provide a framework in which the components can be incorporated in a way consistent with the overall design of the model. In this way the whole-farm model should also constitute a repository for the best current description and understanding (expressed in an operational form) of the system components and processes and will also provide a contextual framework for future component model development and refinement. The development and maintenance of such a research model is a long-term goal of this group; preliminary reports have been given by Sherlock and Penno (1996) and Sherlock et al. (1997).

Section snippets

Outline design of a farm simulation framework

Although the major farm components are highly complex dynamical systems, the fact that they are distinct biological entities gives a sensible and natural decomposition of the farm into well-encapsulated ‘lumped element’ sub-systems. Furthermore, the major interactions have the property that (to a useful first approximation at least) they can be described in terms of small subsets of the sub-system state variables, and hence be represented by a relatively simple ‘communication’ between them.

Integration strategies

The following strategies describe the incorporation of existing legacy models (components) into a new more complete OO model (the framework). While these strategies and techniques used are in the context of a Microsoft Windows NT environment, the general principles are applicable for component model integration on other operating systems.

Actual integration procedures using COM specifications

In the development of our FSF, two procedural based legacy components were identified as having functionality required by high level farm objects. A FORTRAN model (McCall, 1984), for which source code was available, contained the functionality for pasture growth, while the ACSL, MOLLY model (Baldwin, 1995), provided the cow nutrition and metabolism functionality. In a previous paper (Neil et al., 1997) we described the integration of these two components using DLL and DDE methodologies

Conclusion

A variety of techniques are available for incorporating component models into an OO framework. In general the interfacing to the component requires a different messaging protocol to that of the framework. Ideally, this difference should be hidden from other objects in the system through using a single proxy object to interface to each instance of the component. The reason for this is twofold; OO programming facilitates development by multiple contributors, each of whom will be familiar with the

Acknowledgements

The authors would like to thank Mike Maguire and Leigh Roberts for their valuable mentoring in the detailed aspects of VisualWorks Smalltalk. This work was supported by the New Zealand Foundation for Research, Science and Technology.

References (20)

There are more references available in the full text version of this article.

Cited by (7)

  • Simulating grazing beef and sheep systems

    2022, Agricultural Systems
    Citation Excerpt :

    In order to simulate ruminant livestock systems, the components of animal genetics (breed), nutrition (forage), management practices and their subsequent impact on the surrounding environment (emissions to air and water) must be considered as a whole in computational models. Several mechanistic process-based simulation models have attempted to simulate the whole system, e.g. the Hurley Pasture Model (Thornley, 1998) and its subsequent revisions - PaSim (Graux et al., 2011), WFM (Neil et al., 1999), GRAZPLAN (Donnelly et al., 2002), GrazeIn (Faverdin et al., 2011), SEDIVER (Martin et al., 2011), e-Dairy (Baudracco et al., 2013) and LiGAPS-Beef (van der Linden et al., 2019). Challenges remain in modelling ruminant systems, due to the symbiotic relationship between rumen microbial anaerobic fermentation and subsequent mammalian metabolism of a combination of derived rumen microbial biomass (microbial protein), fermentation by-products (volatile fatty acids and ammonia) and dietary components which by-pass rumen fermentation.

  • Incorporating a prediction of postgrazing herbage mass into a whole-farm model for pasture-based dairy systems

    2014, Journal of Dairy Science
    Citation Excerpt :

    This data set was previously used by Beukes et al. (2008) to evaluate the WFM and, therefore, helped to illustrate the adequacy and improvement of the new model development. Details of the WFM and its capabilities have been previously described (Neil et al., 1999; Wastney et al., 2002; Beukes et al., 2008). In brief, in the WFM, animals and paddocks are represented by instances (individual replicates) of the cow and pasture models initialized for each age, breed, and other characteristics unique for each cow instance.

  • Integrating legacy components into a software system for storm sewer simulation

    2006, Environmental Modelling and Software
    Citation Excerpt :

    Concepts as well as technologies have been proposed to integrate the legacy models to accurately describe the storm sewer simulation or provide a friendly user interface that makes these models easier to use. The term “legacy component” or “legacy model” is used here to refer to software with older-technology (Lutz, 1995), typically in the form of Fortran subroutines (Ewer et al., 1995; Achee and Carver, 1997; Neil et al., 1999; Tolsma and Barton, 2000; Sang et al., 2002; Guo, 2003). The approaches for integrating legacy components into a software system can be classified into two groups with different levels of difficulty.

  • Decision support for temperate grasslands: Challenges and pitfalls

    2005, Utilisation of Grazed Grass in Temperate Animal Systems: Proceedings of a Satellite Workshop of the XXth International Grassland Congress, July 2005, Cork, Ireland
View all citing articles on Scopus
View full text