# BioMA

Modelling frameworks are used in modelling and simulation and can consist of a software infrastructure to develop and run mathematical models. They have provided a substantial step forward in the area of biophysical modelling with respect to monolithic implementations. The separation of algorithms from data, the reusability of I/O procedures and integration services, and the isolation of modelling solutions in discrete units has brought a solid advantage in the development of simulation systems. Modelling frameworks for agriculture have evolved over time, with different approaches and targets
BioMA is a software framework developed focusing on platform-independent, re-usable components, including multi-model implementations at fine granularity.

## BioMA - Biophysical Model Applications

BioMA (Biophysical Model Applications) is a public domain software framework designed and implemented for developing, parameterizing and running modelling solutions based on biophysical models in the domains of agriculture and environment. It is based on discrete conceptual units codified in freely extensible software components .
The goal of this framework is to rapidly bridge from prototypes to operational applications, enabling running and comparing different modelling solutions. A key aspect of the framework is the transparency which allows for quality evaluation of outputs in the various steps of the modelling workflow. The framework is based on framework-independent components, both for the modelling solutions and the graphical user's interfaces. The goal is not only to provide a framework for model development and operational use but also, and of no lesser importance, to provide a loose collection of objects re-usable either standalone or in different frameworks. The software is developed using Microsoft C# language in the .NET framework.
The framework is a development of the work carried out under the APES task of the 6th EU Framework Program SEAMLESS project.
Deployments of the platform and its tools and components have been used:
* to create weather datasets for biophysical simulation,:
* to assess the impact on crop production in Europe, and adaptation,
* to simulate the development of soil pathogens under climate change,
* to reproduce the growth and development of tree species,
* to estimate the survival of insects damaging maize under climate change
* to estimate crop suitability to environment,
* to perform modelling solutions comparison at sub-model level,
* to develop a library of reusable models for crop development and growth,
* to estimate the impact of climate change on crop production in Latin America,
* to simulate fungal infections and the dynamics of plant epidemics,
* to estimate agro-meteorological variables,
* to develop a library of functions to estimate soil hydraulic properties,
* to estimate quality of agricultural products.
* to simulate the timing and the application of agricultural management practices
* to develop a library to perform sensitivity analysis on agricultural models
* to define a library to evaluate crop model performances in reproducing field experiments
* to develop a new model of quantitative and qualitative aspects of winter rapeseed productions
* to adapt the Canegro sugar cane model for giant reed
BioMA applications and modelling solutions are the simulation tools used by the MARS unit of the European Commission to simulate agricultural production under scenarios of climate change. BioMA is also used in the EU FP7 project MODEXTREME.

### The architecture

The simulation system is discretized in layers, each with its own features and requirements. Such layers are the Model Layer (ModL), where fine granularity models are implemented as discrete units, the Composition Layer (CompL), where basic models are linked into more complex, aggregated models, and the Configuration Layer (ConfL), which allows providing context specific parameterization (in the software sense) for operational use. Applications can span from simple console applications to user-interacting applications based on the model-view-controller pattern, in the simplest cases linking either directly to either the ModL or the CompL, or accessing model ConfL. In all cases, the component oriented architecture allows implementing a set of functionalities which impact on the richness of functionality of the system and on its transparency. Layers implement no top-down dependency among them, hence facilitating the independent reuse of tools, utilities, and model components in different applications and frameworks.
| Architectural layers of the BioMA simulation system | Model layer: fine grained/composite models implemented in components Composition layer: modeling solutions from model components Configuration layer: adapters for advanced functionalities in controllers Applications: from console to advanced MVC implementations Development Tools: tools mostly using code generation |
| Re-usable components implementing model libraries are composed into modelling solutions. Modeling solutions are not specific to one modelling framework. An adapter creates a version of the modelling solution specific to a framework application, such as BioMA. The semantically explicit interfaces allow creating rich applications | From model components to modelling solutions, and to adapters |

### Cloud Architecture

In the context of the AgriDigit project, carried out at CREA, the BioMA framework has been adapted to execution in the Cloud via a SaaS architecture. Model calls will be treated as an HTTP invocation, so the Model View Controller architecture is no longer needed. Hence, the Configuration Layer has been eliminated (it is not used) for cloud services. Also the Composition Layer has been simplified.

### Applications

Advanced applications can be grouped under two categories:
* BioMA-Spatial, were models are run iteratively against spatially explicit units, as either grid cells or polygons. These application can include a layer to model interaction among the spatial units;
* BioMA-Site, were models are run against specific sites. These applications can be specialized for specific crops, and in general allow a more detailed access to model constituent blocks and outputs.
Applications can be built based on the libraries as in the following figure. The libraries can be extended implementing new models, as shown in the software development kits, and new libraries can be added.

### Availability

Model components and tools can be autonomously downloaded with the SDK at the components' portal. Same for modelling solutions (the portal is being renovated).
Acces to modelling solutions as SaaS need to be requested.

### The BioMA Intellectual Property Rights model

Code of core components is available under the MIT license, however, the reuse of binaries falls under the Creative Commons license as below, implying the no-commercial, share-alike clauses.
Application and tools are available under the Creative Commons license as binaries, however code can be shared under specific agreements between parties. Model component developers may make code available, however, they must make binaries available for reuse.