Implications
Nutrient losses from pig and dairy farms contribute to several environmental issues. Dynamic models are useful tools to evaluate the effects of production strategies on nutrient flows. This paper presents the development of a new whole-farm model dynamically simulating the flows of carbon, nitrogen, phosphorus, copper, zinc and water over several years. The development of the model was based on an original conceptual framework to integrate detailed biotechnical models as well as decisional models. The resulting model is able to simulate consistent farming systems to study nutrient flows and to integrate them into comprehensive multi-criterion assessment.
Introduction
In regions of intensive pig and dairy farming, water quality can be threatened by nutrient losses from these farming systems. Greenhouse gas emissions from animal production contribute to climate change, and ammonia emissions are a threat for air quality. Accumulation of trace elements like copper and zinc in soils are also sources of concern. Water availability is an important resource for agricultural systems, which could be more often limiting with climate change. Although farming systems impact their environment in many different ways, positive or negative, nutrient flows are one of the first concerns, at least in regions of high animal densities (Steinfeld et al., Reference Steinfeld, Gerber, Wassenaar, Castel, Rosales and Haan2006). Nutrient losses and the subsequent impacts depend on many factors, including climate (temperate and rain amount) and soil type but also farmer decisions, from the strategic level (stocking rate, type of animal housing, crops grown, etc.) to the operational level (waste handling and application, etc.). The decisional system is essential in mixed farms (crops and livestock) to represent the interactions between the different fluxes. Furthermore, all impacts are linked and changes of practices to improve one aspect can have negative consequences on other aspects, creating some dilemmas. The simple addition of best practices is not sufficient and an overall view of the system is required to avoid risks of pollution swapping. Therefore, tools are required to compare risks between livestock farming systems on the basis of several criteria (Payraudeau and Van der Werf, Reference Payraudeau and van der Werf2005).
Several dynamic mechanistic models deal with nutrient flows in pig and/or dairy farms. Among these models, the Integrated Farm Systems Model (IFSM; Rotz et al., Reference Rotz, Corson, Chianese, Montes, Hafner, Jarvis and Coiner2011), DairyNZ's Whole Farm Model (WFM; Wastney et al., Reference Wastney, Palliser, Lile, McDonald, Penno and Bright2002), Farm ASSEsment Tool (FASSET; Jacobsen et al., Reference Jacobsen, Petersen, Berntsen, Boye, Sørensen, Søgaard and Hansen1998) and DairyWise (Schils et al., Reference Schils, de Haan, Hemmer, van den Pol-van Dasselaar, de Boer, Evers, Holshof, van Middelkoop and Zom2007). These models also provide technical and economic results of the modelled farm. IFSM, WFM and DairyWise models deal only with dairy farms, the first one mainly in the United States of America but with worldwide potential applications, the other two mainly in New Zealand and the Netherlands. The FASSET model simulates both pig and dairy farming systems. In IFSM, production systems are simulated over multiple years of weather, with a detailed biotechnical module. However, the decisions made by the farmer are mostly model inputs, very often as a set of operations and dates, sometimes as rules. In the WFM, decisions, like movement of the herd between paddocks, are modelled. FASSET performs long-term simulations (30 years) of pig and dairy farming systems, and associates a decision module and a biotechnical module. The decision module is a linear programming procedure used to plan the farm activities every year. During the year, little adaptations are made considering the state of the system, and the production plans are applied without modifications. DairyWise integrates management rules, but performs simulations for an average climatic year and does not integrate climate variability.
This paper presents the development of the model MELODIE (French acronym for ‘object oriented model of animal farms to evaluate their environmental impacts’), which aims to evaluate the environmental impacts of production strategies in pig and dairy farms. The model focuses on nutrient flows and the associated environmental risks. A specification of MELODIE is to allow ex ante evaluations, which means that it could be used to simulate innovative systems that do not exist yet or to evaluate the possible evolutions of existing farms. Furthermore, the goal was to study the emerging properties of the system: because of the interactions between the different parts of the farm and the trade-offs between different economic and/or environmental objectives, the environmental impact of a farming system may be different from what was inferred at lower scales. In order to take climate variability into account, long-term simulations are performed, which means that farmer tactical and operational decisions have to be modelled. Integrating the effect of farmers’ practices is a key element to find environmentally friendly production systems. The model is intended to be used in research, to compare different strategies at different time scales. The aim is not to use it directly as a decision support system for farm management. MELODIE has been designed primarily for systems encountered in France (where dairy and/or pig farms often also produce annual crops), but it could be adapted to simulate other contexts and other countries if specific soil and crop models are available. Moreover, MELODIE was built to be able to run with different sub-models describing a given process, for example, different crop models.
Model description
Overview
MELODIE is a model simulating nutrient flows over several decades at the farm scale in pig and dairy farms. The nutrients taken into account are carbon (C), nitrogen (N), phosphorus (P), potassium (K), copper (Cu) and zinc (Zn). Water (H2O) flows are also simulated. MELODIE is based on the ontology of agricultural production systems proposed by Martin-Clouaire and Rellier (Reference Martin-Clouaire and Rellier2003 and Reference Martin-Clouaire and Rellier2009). Some elements of description of this ontology are given throughout the presentation of MELODIE. Only the concepts that are essential to this paper are addressed. In the ontology, a production system is composed of three sub-systems: the biotechnical system (or controlled system), the decision system (or manager) and the operating system (labour and machinery; Martin-Clouaire and Rellier, Reference Martin-Clouaire and Rellier2003 and Reference Martin-Clouaire and Rellier2009). For a detailed illustration, this ontology is also used in a model considering grassland-based beef-cattle farms (Martin et al., Reference Martin, Martin-Clouaire, Rellier and Duru2011).
The nutrient flows are calculated at a daily time step by the biotechnical system, which is a set of connected sub-models. In the biotechnical system, four main nutrient pools are considered (Figure 1): animals, agricultural wastes (storage and treatment), soils and crops and feedstuffs. Internal flows between and within these pools are simulated, as well as nutrient losses to air and H2O, such as nitrate leaching. For example, animals are grouped in batches, and the nutrient flows are calculated separately for each batch. For soils and crops, each field is represented individually. Different levels of precision are associated with the nutrients, depending on available knowledge: for example, the N cycle is more detailed than the Cu or Zn flows, for which only balances between pools are calculated.
General organization of the different components of MELODIE. The decision system works with two time scales, and interacts with the biotechnical system. Nutrient flows are calculated daily within the biotechnical system, as well as nutrient emissions in the air, H2O and soils.
Decisions made by farmers are simulated by the decision system, which interacts with the biotechnical system throughout the simulation (Figure 1). Decisions are taken at two time scales. Every year, a planning module generates flexible plans. These plans are examined every day, for context-dependent application: the operations scheduled are executed only when the conditions are suitable. The plans may also be modified if the conditions are never satisfied.
The model simulates dynamically animal, manure and crop production, the emissions of greenhouse gas (CH4, N2O), ammonia (NH3), nitrate leaching and the evolution of the system (such as organic matter in soils). Nutrient flows are calculated daily over decades for each animal class, field or waste storage unit. Then they are aggregated to calculate indicators of environmental impact, such as those used in life cycle analysis.
The basic structure of MELODIE is made of specializations of general concepts described in the ontology of agricultural production systems (Martin-Clouaire and Rellier, Reference Martin-Clouaire and Rellier2003 and Reference Martin-Clouaire and Rellier2009), as shown in Figure 2. As a result, MELODIE naturally follows the object-oriented paradigm. The basic structure of MELODIE is a set of objects describing the state of the system at a given time. The basic structure can be used to simulate all farmed species (pigs and dairy cattle in the present version) with the same underlying principles either in specialized or mixed farms. Indeed, generic entities were created wherever possible (e.g. ‘animal’) and specializations were then created for more specific purposes (e.g. ‘bovine’, ‘dairy cow’, ‘heifer’). MELODIE could therefore be seen as (or be the base of) an ontology of animal production systems. MELODIE was built to be able to run with different sub-models describing a given process, for example, different crop models. Therefore, some entities describe the core of MELODIE, that is, these entities are essential in the model, and some specializations contain data used only by specific sub-models.
The conception of MELODIE is based on ontology of agricultural production systems.
MELODIE heavily relies on two mechanisms stemming from the object-oriented paradigm: inheritance and polymorphism. Inheritance is the mechanism by which concepts are derived from more general ones. For example, dairy cows inherit the properties of the ‘animal’ concept. Polymorphism enables one to create different specialization sharing a common interface. For example, the concept ‘bovine’ has a general function calculating feed intake, with different equations for dairy cows and heifers. The function can be called regardless of the type of bovine, and the appropriate equation is automatically used since it is defined differently for dairy cows and heifers. These mechanisms provide features that can hardly be obtained with the procedural paradigm. Particularly, through this generic structure, new sub-models can be added to replace (and coexist with) existing ones.
As a result of the object-oriented analysis of the system, MELODIE is highly adaptable. It provides a set of objects and dynamic processes that can be used (or not) and combined at run time, making it possible for users to build simulations tailored to their needs. MELODIE comprises basic concepts that are required for simulating animal farming systems, but is not tied to a given farm structure, as the latter is specified at run time. The farming systems that can be simulated are widely variable, in terms of type of farm, management strategy and context. For example, one may build a simulation with only a dairy herd, only pigs or with both. Animal housing is designed accordingly and all wastes can be collected in a single storage, or in separate storages leading to different fertilizers (farm yard manure and slurry, for example).
The biotechnical system
In the model, the biophysical system is composed of successive levels of entities related by composition or aggregation relationships. The highest level composite is the farm, which is composed of entities such as herd and feed stores composite, housing and manure storage composite, fields and crops. At the basic level, entities are associated with biological processes, which simulate daily nutrient flows. For that processes, models or equations already available in literature were studied, and the most appropriate were chosen. When no suitable model was found, the principle was to develop a new model.
For dairy cows and heifers, feed intakes are calculated using the equations of the INRA system (INRA, 2007). In case of grazing, the grass intake is calculated taking into account the grass allowance per cow and daily access time to pasture (Delagarde et al., Reference Delagarde, Faverdin, Baratte and Peyraud2011; Faverdin et al., Reference Faverdin, Baratte, Delagarde and Peyraud2011). Nutrient balances of dairy cattle (N, C, minerals, H2O), nutrient content of urine and faeces and methane production are calculated with equations from literature or specifically developed using data from several previous experiments, as described in Faverdin et al. (Reference Faverdin, Maxin, Chardon, Brunschwig and Vermorel2007) and Maxin (Reference Maxin2006). For pigs, the equations used for growth, feed intake and nutrient excretion for each individual stage are fully described in Rigolot et al. (Reference Rigolot, Espagnol, Pomar and Dourmad2010a).
The equations for manure evolution and gaseous emissions module were built specifically for MELODIE from a set of existing empirical equations and emission factors (Rigolot et al., Reference Rigolot, Espagnol, Robin, Hassouna, Béline, Paillat and Dourmad2010b). The equations and parameters were found in the literature, or they are based on expert knowledge. The module calculates the evolution of the wastes and the losses to the air for the main animal housing systems and storage facilities encountered in France. Most common waste treatment processes (biological treatment, composting, etc.) are also included.
The soils and crops module of MELODIE uses STICS (Brisson et al., Reference Brisson, Gary, Justes, Roche, Mary, Ripoche, Zimmer, Sierra, Bertuzzi and Burger2003), a generic model simulating the flows of N, organic matter (i.e. C) and H2O, as well as crop growth and development and nitrate leaching. STICS has been parameterized for a wide range of crops. STICS operates at a daily time step and most simulated processes are climate dependent. The model is sensitive to N fertilization. The nutrient content of organic fertilizers is calculated by the wastes sub-model and their degradation in soil is calculated by STICS using specific parameters obtained by fitting experimental data. The crops harvested can be either sold or fed to animals (including pastured grass).
The decision system
The role of the decision system is to dynamically determine the operations that should be applied to the different entities of the biotechnical system, in order to apply the farmer's management strategy. The decision-making and ensuing execution of actions are responsive to the state of the whole system and its environment. Decisions are made at annual and daily time scales, aiming to generate and to apply activity plans, respectively (Figure 1). In the ontology, a strategy consists of a plan of activities to apply to the biotechnical system and of rules to apply and to adapt this plan when particular events occur. The activity plan is a set of activities organized by different temporal or programmatic operators indicating how the plan should unfold (e.g. sequence or iteration). In this paper, only the main activity plans are detailed to illustrate the structure of MELODIE. They correspond to (a) herd management, (b) dairy cow feeding management, (c) crop management and (d) annual planning modules. Moreover, the coherency at farm scale is provided by annual planning modules, which are also described below.
Herd management
For pigs, batch farrowing is very common in many countries for the management of sow herds. This consists of grouping the sows in batches, whose number is determined by farmer strategy, according to his work organization plans. At each weaning of a farrowing batch a new cohort of growing pigs is created. In the ontology language, the management of sow batches is a cyclical repetition of the sequence of activities (weaning of piglets, farrowing, etc.). The duration of the cycle corresponds to the physiological cycle of the sow (Rigolot, Reference Rigolot2009). For dairy cows and heifers, the model GEDEMO (Coquil et al., Reference Coquil, Faverdin and Garcia2005) dynamically simulates the demography of the herd, which corresponds to the size of the 21 animal classes, including heifers and dairy cows. GEDEMO is able to simulate the wide variability of breeding strategies encountered in French farms. The main parameters of GEDEMO correspond to age at first calving, replacement rate of dairy cows, natural death and distribution of calving period (all-year or grouped).
Dairy cow feeding
Dairy cow feeding is adapted to the resources available on farm. It is thus very variable within years (several diets are used depending on the season) as well as between years (dates of transition between diets and quantities of complementary forage at grazing are variable). As a result, grazing management involves several decisions. Management of dairy cow feeding is a good example of the use of the ontology concepts and decision rules to provide flexibility to the management system (Martin et al., Reference Martin, Martin-Clouaire, Rellier and Duru2011). The management of dairy cow feeding in MELODIE is fully described in Chardon (Reference Chardon2008), and the main principles are reported here.
To run a simulation with MELODIE, the model user must provide a feeding road map for the animals, that is, the feed (type and amount) corresponding to different periods of the year and for different groups of animals (Figure 3). The user must also provide an activity plan containing (i) the activities of transition between diets and (ii) the activities of grazing management (paddock changes and diet adjustment). Animal feeding is therefore planned, but the plan leaves room for context-dependent application.
Grazing management is based on interactions between a feeding road map (right) and an activity plan (left, defined by the ontology of agricultural production systems). Activity blocks connected with arrows are in a sequence operator before (A, B). Other operators (iteration, costarting) are explicit. Italic fonts highlight the possibilities of adjustment relatively to the plan.
At the beginning of a simulation, animals are indoors for wintering. In spring, when the quantity of grass available per cow on the whole farm reaches a fixed threshold, the opening predicate of the ‘turn out to grazing’ activity becomes true, triggering the grazing season. During this period, an activity of moving the herd from a paddock to another is iterated. At each paddock change, the state of the system is examined and decisions are made, according to the ratio between the quantity of grass available and the quantity of grass eaten every day by the cows. Decisions involved may be cutting paddocks initially intended to be grazed, or conversely, and increasing or decreasing the supplementation level. An example is given in Figure 3.
Crop management
Each crop is associated with a pre-defined activity plan, which is specified by the user. These plans must include all the technical operations required by the crop, including all possible waste applications. The activity plan can depend on the preceding crop. For example, maize fertilization is different after grassland and after wheat. When the cropping plan is generated, for each field, the relevant corresponding activity plan is duplicated and added to the manager's global activity plan. Mineral N fertilization is calculated as the difference between the total quantity of N required for the field and the quantity available through waste.
Coherency at farm scale: annual planning module
In the ontology of agricultural production systems, activity plans are considered as an input. However, for crops and manure spreading, activity plans are not fully predetermined: they are partly designed during the simulation, taking into account the state of the system. Therefore, a planning module was created to transmit activity plans to the manager component (see Figure 1). The general organization of this module is shown in Figure 4. The goal of this module is to generate a cropping plan and a waste application and fertilization plan for the upcoming year.
Organization of the planning module. The feeding road map is used every year to determine the cropping plan and the waste allocation, which are translated into a plan of activities to apply to the biotechnical system.
Crops are allocated to fields by the cropping plan generator Tournesol (Garcia et al., Reference Garcia, Faverdin, Delaby and Peyraud2005). It considers the feed and straw requirements associated with the feeding strategy and applies agronomic knowledge (potential of the fields and effects of crop sequences) to generate a cropping plan that best satisfies the goals and priorities defined by the model user (including profit). Likewise, the model FUMIGENE (Chardon et al., Reference Chardon, Le Gall, Raison, Morvan and Faverdin2008) is used to generate yearly waste allocation plans, according to the needs of each field and to management rules. The needs of each field are calculated using a balance sheet method that takes into account the type of soil, the history of the field (fertilization and past cultivation of grass if any), the crop to be grown for the current year and its expected yield. The farmer's preferences and constraints are modelled as a set of priorities associated with each field on the one hand and with each combination of crop, waste and period on the other hand. The waste application plan of a given year is selected by a linear programming procedure, aiming to maximize the priority associated with the application of wastes while respecting constraints at the farm and field levels.
The planning sub-models TOURNESOL and FUMIGENE interact with the biotechnical system by using information on the yearly variations of stocks of feed, straw and wastes. For example, if in a given year the quantity of grazed grass is high because of favourable conditions, the maize silage stocks will be high at the end of the year. Therefore, the cropping area devoted to maize the following year will be decreased. Similarly, if the quantity of slurry is higher than expected, more slurry applications are planned, and the mineral fertilization is adapted to N amounts in manure.
Implementation
MELODIE was implemented as a C++ program. It relies heavily on the library DIESE, which is both an implementation of the ontology of agricultural production systems (Martin-Clouaire and Rellier Reference Martin-Clouaire and Rellier2003 and Reference Martin-Clouaire and Rellier2009) and a discrete-event simulation engine. Model inputs are made through standard text files with a pre-defined syntax so as to be parsed by DIESE. Outputs are also handled by DIESE. Daily values of a set of chosen variables can be either written to text files or transmitted to a database management system. The current version uses PostgreSQL 8.3 (PostgreSQL Global Development Group, 2008) and other backends can be added easily. SQL queries can be used for data aggregation (e.g. nitrate leaching per year) and for the calculation of environmental indicators. Graphing and statistical analysis can be made with R (R Development Core Team, 2008), which has the ability to extract data from PostgreSQL using SQL queries.
Application example on N balance of farms: simulation of the effect of different dairy cow feeding strategies in a Brittany farm with MELODIE
In Brittany, the feeding of dairy cows is generally based on more and less maize or grass, with a low amount of concentrates due to the high quality of roughages. The foraging system is often seen as a key element to explain nutrient efficiency on existing farm, or to design new ecologically intensive farms. However, there are currently few tools and methods for a real systemic approach. A first use of MELODIE was intended to better understand the complex relationships between all parts of the system, and their consequences on nutrient flows and losses to the environment. We focused here the use of MELODIE to study the interpretation of the N farm-gate budget indicator. In spite of the numerous uncertainties associated to this indicator, it seems one of the most suitable as environmental performance (Oenema et al., Reference Oenema, Kros and de Wris2003). In practice, the calculation of this indicator with data of commercial farms generally shows a poor repeatability (Swensson, Reference Swensson2003; Institut de l'Elevage, personal communication). With a constant farm management (strategy and farm structure), it is interesting to see how this indicator varies between different systems and different years.
For the simulations, a reference dairy farm, with feeding based on high levels of maize (scenario M), in which maize crop represents more than 55% of the area used for forage production, has been designed and parameterized from a typology of extension services. The same farm structure (i.e. same quota, building, area, soil and climate) was then used either with different foraging systems with more grass (G, grass scenarios, with maize crop representing less than 45% of the area used for forage production), and/or with different supplementation levels (h (high), m (medium), l (low)). The combination of the two foraging systems and the three supplementation levels gives six feeding strategies (G/h, G/m, G/l, M/h, M/m and M/l). Given the huge amount of data and information provided by MELODIE, only the main characteristics and results of the simulations concerning N are reported in this section. A more detailed analyse is given in Chardon (Reference Chardon2008).
System description and parameterization
The main characteristics of the typical farm are reported in this section and Table 1. System descriptions correspond to average data (for a ‘normal’ climatic year). However, in the simulations these characteristics are modified by MELODIE, depending on the actual circumstances (e.g. crop yields and milk production). In the typical farm, the herd is composed of 52 dairy cows, with a milk potential of 9000 kg/lactation of adult cows. Calving occur all year long except between April and June. Dairy cows are housed on slatted floor, producing slurry and heifers are housed in a stall with a deep litter system producing solid manure. The diet of dairy cows is composed of three diets (winter, grazing and transition diet). Grazing can start on 1 March. The transition diet last at least 20 days. Winter diet is composed of ad libitum maize silage and 175 g of soya bean meal per ingested kg of maize. During grazing, grass is fed ad libitum, but if grass availability decreases, cows are supplemented with increasing amounts of maize silage and soya bean meal. The supplementation level is 4 kg dry matter (DM) for dairy cow at the beginning of lactation, and 3 kg DM for dairy cow at the middle of their lactation. To simplify the simulation, heifers are fed with conserved diet based on maize silage, straw and soya bean meal, which explains the high proportion of maize in the standard farm. The field area is 50 ha divided in 26 fields, and 38 ha are available for dairy cows. For the planning module, the self-sufficiency for grass and maize has a high priority in the farmer strategy. Cereals producing straw (wheat and barley) are grown on remaining area. Grass is produced on temporary pure ryegrass swards. Solid manure and slurry are first spread on maize. Slurry is then spread on pasture, with a priority decreasing when the distance to the farm increase. Mineral fertilizers are used to balance the mineral requirements of crops and grass production. The climate corresponds to a 40-year time series in Brittany, France. The soil is a clay-loamy soil representative of the geographic area.
Main characteristics of the reference farm
In the grass (G) scenarios, the diet during grazing season only contains ad libitum grass and concentrate, and generally no maize silage contrary to the reference maize (M) scenario. All the other characteristics are kept the same with the reference scenario, excepted when parameters are known to be correlated with the foraging system (e.g. herd renewal rate is 35%/year in maize system and 30%/year in grass system). In addition, the three concentrate levels are modulated in order to match with the foraging systems (maize or grass), as illustrated for dairy cows in the middle of their lactation in Table 2. Because the effective milk production of the cows varies with the feeding system, the number of cows was adjusted in each system to maintain the milk production to the same quota. The area required for the different crops is determined by the decision model of MELODIE, the priority being given to make the system self-sufficient for forage production.
Maize silage and concentrate supplementation for dairy cows in the middle of their lactation in the six systems during the grazing season

DM = dry matter; M = maize; h = high; m = medium; l = low; G = grass.
*Reference system.
Calibration and validation
For the calibration, we assume that the first 10 years are sufficient to reach the equilibrium for the systems. After that period, yields, performances, decisions, nutrient balances and annual losses to the environment are compared to references with the expertise of several members of the project. In all simulations, the dynamic number of animals of each physiological stage simulated by the GEDEMO model has been satisfactorily compared with references for all-year calving strategy and the replacement rates. The cropping plan and manure-spreading plan for each year are coherent with the state of the system (maize and grass stores) and agronomic rules. A range of indicators are also coherent and match with expert knowledge, such as average manure production or manure content (Chardon, Reference Chardon2008). A central point of the model is the ability to reproduce feeding strategy, because it drives the behaviour of the whole system. In these simulations, classic indicators of grazing management have been checked and compared with well-known references, as proposed by Cros et al. (Reference Cros, Duru, Garcia and Martin-Clouaire2004). As an illustration, the average diet of a dairy cow for an average climatic year and the corresponding grazing plan in the reference system (Figure 5) has been used by the experts of the project to verify the simulation. When discrepancies are founded, parameters may be modified, or deeper limits of the model may be identified (see ‘Discussion’).
Annual diet of a dairy cow and grazing planning of dairy cows. In this simulation, the annual diet of a cow is composed of a winter diet, a summer diet and transition diets between. The paddocks with grass are chosen each year by the cropping plan generator Tournesol. During the year, the paddocks for dairy cows are dynamically chosen by the grazing module depending on grass growth on each field, and grass availability in the total foraging area. The precise composition of the diet is adjusted each time the animal lot move from one paddock to another and animal intake is calculated daily.
Results and interpretation
After the calibration process, the six systems are considered to be consistent. Therefore, it is possible to study indicators such as N inputs, outputs and N farm-gate budget (Table 3), as well as N losses (Table 4). In the simulations, all these indicators are coherent with reference values for these kinds of systems. The foraging system has an impact on feed inputs because of soya bean meal in maize-based diets. In addition, the concentrate level obviously has an effect on feed inputs, which is higher with high supplementation. The feeding strategy has also consequences on fertilization (because of the differences in the time spent indoor and to the different fertilization rules for maize and pastures), as well as consequences on crop sold (which result from crop allocations and crop yields; Table 3). Nitrogen balance tends to be similar on average in pasture-based system compared with maize, in spite of lower N inputs (less N feeds and more N fertilizer), because N output with crops is also reduced. The similar rules of N fertilization of crops and grassland, the absence of grass–clover swards and the medium change in grass use explains this absence of response between the different proportions of maize in the diet. However, the reduction of concentrate use decreases N balance of about 10 kg nitrogen/year, in spite of lower N output.
Nitrogen inputs, outputs and N farm-gate budget (in kg N/ha per year) in the six simulated farms (with the six feeding strategies)

N = nitrogen; M = maize; h = high; m = medium; l = low; G = grass.
Nitrogen emissions to the environment (in kg N/ha per year) in the six simulated farms (with the six feeding strategies)

N = nitrogen; M = maize; h = high; m = medium; l = low; G = grass.
Nitrogen emissions to the environment are presented in Table 4. The difference between average N losses and N farm-gate budget corresponds to N provided by the soil (mineralization, not shown), which is another indicator of the validity of the simulations. In these simulations, feeding strategy has an effect on nitrate leaching, whereas gaseous emissions are quite similar between systems. Moreover, N farm-gate budget seems to be a good indicator of total N losses and N leaching. However, the results of the simulations show that for a given year, the nitrate leaching during the winter is often poorly correlated with the N farm-gate budget. In fact, the analyses of the outputs of MELODIE enables to quantify a good nonlinear correlation between nitrate leaching and both the inverse function of winter rainfall (WRF in m) and residual mineral N in soil at fall (1 November, RN): N leaching (kg N-NO3/ha) = 43.4 + 0.9 RN (kg N/ha)−10.8/WRF (R 2 = 0.93). The farm-gate N surplus of the year has a medium correlation with residual mineral N in soil at fall (R = 0.72 on average, but with large variation). As it also does not consider the amount of winter rainfall, it is a poor predictor of nitrate leaching of the year, but remains an interesting relative indicator over several years to evaluate the evolution of the system. This tends to prove that a specific annual farm-gate budget is more difficult to interpret than a mobile average on several consecutive years, which smooth climatic variations. This observation confirms the poor correlation observed between years and within commercial farms (Swensson, Reference Swensson2003). With such a modelling approach, it is possible to consider that the changes in the structure or in the management of the farm are not responsible for this variability. The climatic variability is sufficient to generate important variation in this indicator.
In a next step, MELODIE will also enable to decompose the losses for each animal lot, or each animal house or individual fields. Indeed, nutrient losses may be quantified with a temporal and spatial heterogeneity. For example, during a long-term simulation, each field follows its own trajectory. Nutrient excretion can be traced for each animal lot each day for each year of the simulation. Compared with inquest or experimental data, soil and climatic data for simulation are perfectly known, and they are exactly the same between compared systems. To investigate more deeply the question of the effect of feeding strategy on nutrient flows, new simulations could be parameterized with other climate and soil database, or more contrasted feeding strategy. The analyses will also include other nutrients than N, to identify possible trade-off, for example, with greenhouse gas emissions.
Discussion
Originality of MELODIE
Compared with other models, MELODIE combines a very detailed biotechnical system mixing animal and crop production with an original decision system that enables to study pluriannual evolutions at farm scale. Each field is individualized, as well as each animal lot, each animal house and each manure storage and treatment unit. MELODIE also simulate several nutrient flows (N, P, K, C, Cu, Zn), which enable comprehensive multi-criterion assessment. The management system ensures the consistency of the whole system at farm scale in the long run. The ontology of agricultural production systems adapts the planning and the execution of the activities to the state of the system and the strategy of the farmer. Therefore, it is possible with MELODIE to design ex ante simulations of farming systems and to track nutrient flows both in the short run and the long run, taking into account the effects of the climatic conditions and evolutions.
Domain of validity
For the simulations at farm scale presented in this paper, MELODIE reproduce a realistic behaviour of the system and nutrient flows well match to references. This section deals with the ability of the model to cope more generally with contrasted systems in contrasted contexts. All sub-models integrated in the biotechnical system of MELODIE have been validated independently for a given range of situations. When available, experimental measurements were used to validate simulated values, as reported by Rigolot et al. (Reference Rigolot, Espagnol, Pomar and Dourmad2010a) for the sub-model of pig excretion and Faverdin et al. (Reference Faverdin, Maxin, Chardon, Brunschwig and Vermorel2007) for the sub-model of dairy cow nutrient balance. When experimental data were lacking, expert validation of biological equations was performed, as reported by Rigolot et al. (Reference Rigolot, Espagnol, Robin, Hassouna, Béline, Paillat and Dourmad2010b) for gas emissions from manure. With regard to crop production, STICS is a validated and published model, for which the precision of the prediction is variable depending on simulated crops, evaluated parameters and contexts (Brisson et al., Reference Brisson, Gary, Justes, Roche, Mary, Ripoche, Zimmer, Sierra, Bertuzzi and Burger2003). Generally, the sub-models are often precise in situations where animal and crop productions are close to a given potential. For example, the tests of the animal models show that they are robust in well-controlled situations (Faverdin et al., Reference Faverdin, Maxin, Chardon, Brunschwig and Vermorel2007; Rigolot et al., Reference Rigolot, Espagnol, Pomar and Dourmad2010a), but they probably become imprecise to integrate responses of animal growth and milk production to strong feed restrictions. Moreover, some sub-models are not very sensitive to farmer practices. For example, some gaseous emissions are calculated as a simple percentage of a given nutrient flow, using simple emission factors (Rigolot et al., Reference Rigolot, Espagnol, Robin, Hassouna, Béline, Paillat and Dourmad2010b). In addition, the ability of the decisional sub-models TOURNESOL and FUMIGENE to simulate farmer's behaviour have been evaluated with observations on a real farm (Garcia et al., Reference Garcia, Faverdin, Delaby and Peyraud2005; Chardon et al., Reference Chardon, Le Gall, Raison, Morvan and Faverdin2008, respectively), which is more complete than expert judgement performed in our simulations. The evaluation of the decisional sub-modules on the case study also indicates that they are able to test numerous kinds of rules (regulatory or agronomic rules, farmer preferences, etc.). However, their complexity requires skills and training of the model user, and sometimes a significant parameterization time.
For the comprehensive simulations at farm scale, resulting from the interactions of decisional and biotechnical systems, a validation step is not fully conceivable, because of the complexity of MELODIE. The validity of the sub-models for limited domains does not insure the validity of the global model, even for a limited domain, because emergences may appear at larger scale. For example, the succession of crops on fields induces mineralization or organization flows and the validation of crop models for 1 year does not ensure the validity of the whole cropping system in the long run (Brisson et al., Reference Brisson, Gary, Justes, Roche, Mary, Ripoche, Zimmer, Sierra, Bertuzzi and Burger2003). Yet, the long-term dynamics of soil organic matter in fields alternating between grasslands and other crops is crucial to simulate nitrate leaching, C sequestration or emissions and the coherency of the whole system. Moreover, the added value of MELODIE is related to its ability to simulate the variability of environmental results between years, and to explain them in detail for a given year, taking into account spatial and temporal variability. To fully analyse and interpret huge amounts of data provided by MELODIE, new specific conceptual developments (data mining) are currently implemented.
Perspectives
Because MELODIE has been constructed from the available knowledge, it provides some kind of synthesis from the state of the art. Therefore, the limits of validity should not be seen only as shortcomings of the model, because they are also helpful to identify research needs. For example, the formalization of equations able to simulate biological processes far from the optimum would allow simulating a wider variety of strategies, with greater adaptations to the variability of climate and feed production. For gaseous emissions, new experimental measurements are required to develop new models more sensitive to farmer practices and less complicated than true mechanistic models. The crop model could be improved by implementing new versions of STICS model, or other models also able to predict both short-term and long-term dynamics of N, C and organic matter in relation with the crops grown (Berntsen et al., Reference Berntsen, Petersen, Olesen, Eriksen and Sregaard2005).
With regard to the model, MELODIE has also already been used for pig production systems, in order to test the effects of different manure management systems on nutrient flows, and to perform comprehensive multi-criterion assessment (Rigolot, Reference Rigolot2009). New simulations are currently implemented for other innovative dairy systems and pig systems, as well as for farms with pig and dairy cows, to understand the links and possible synergies between both productions. In the future, MELODIE could also be extended to deal with other issues than nutrient flows, for example, in order to provide economic evaluations of farming systems, as proposed for example in the MODAM model (Kächele and Dabbert, Reference Kächele and Dabbert2003). Some possibilities and concepts offered by the ontology could facilitate new developments of MELODIE involving entities such as machinery and workers availability, because these changes would not require wide changes of the current model structure. Indeed, MELODIE constitutes an evolving framework. All sub-model can be easily updated and new equations and sub-models can be implemented without changing the general structure of the model. The model is also generic and the structure will be used to simulate other productions (suckling cows and poultry). Furthermore, because each field is represented on the farm, the farm model can be upscaled to catchments scale. To this aim, a coupling of MELODIE with a hydrological model TNT2 (Beaujouan et al., Reference Beaujouan, Durand and Ruiz2001) is currently implemented.
Conclusion
The whole-farm model MELODIE is especially designed to simulate farming systems mixing animal and crop production, which is very important for dairy and pig farms. The combination of a decision model coupled with a complex biotechnical model of the different entities of a farming system gives original properties to the model, such as flexibility to cope with variations in climatic conditions. The present version of MELODIE can be used to simulate existing or innovative farming strategies. An example with different feeding systems in dairy farms illustrates how MELODIE could be used to study the dynamic behaviour of the system and the dynamic of nutrient flows. It shows that the N farm-gate budget indicator is able to reflect small differences in N losses between different systems, but it can only be interpreted using a mobile average, not on a yearly basis. Prospective scenarios are currently designed for the simulations, possibly with the participation of actors. They are also complementary with experimental approaches. These perspectives well illustrate the possible relevancy of comprehensive models such as MELODIE to structure multi-disciplinary projects.
Acknowledgement
The authors would like to thank CASDAR and SPA/DD (ANR-06PADD-017) programs for their financial support.


