# Introduction

A MADS model is defined by a text file that follows the MADS grammar. That text file must begin with a Headers section, followed by sections defining, in any order, the various entities that make up the model, i.e. commodities, plans, herds, scripts and/or tables. At least one Plan is required, because calculations are performed for a given plan. A plan must include at least one component to be meaningful, and usually includes a list of Commodity, Herd and/or other plans.

In addition, it is usually necessary to define additional calculations using one or more Script, that would also become part of plan definitions, and to specify report formats by defining Table entities that will be produced for a given plan through table print commands as part of scripts.

All data entities as well as script variables are given a unique ID name that must start with a capital letter and can contain any number of letters, digits or underscore characters (‹_›).

Comments : There are two possible ways to introduce comments in a Mads text file :

- Single-line comments: anything on a same line that comes after a double-slash, i.e. after //
- Multi-line comments start with /* and end with */

Time series : Data often take the form of a series of values over time. This would be represented as a space-separated list enclosed in square brackets : [12 2.3 4 ]. Such a Time Series (TS) is used as follows :

- the first value corresponds to year 1
- if there are less values than years, the last value is copied to all remaining years
- if there are more values than years, excess values are ignored

Time series of values can also be read from and / or written to an external source, as detailed in the Data import-export section.