You are not logged in. Click here to log in.

Application Lifecycle Management

Search In Project

Search inClear

Parameter #17067/HEAD / v10
Tags:  not added yet

DSL Element: parameter{} (for Model Definition)

The model parameter element allows the specification of input values for a model. It can reference a external file that contains the model parameters. This element also allows the direct specification of parameters as sub-elements. An example:
    ...
    model(classname:"tw.Thornthwaite") {
       // parameter
       parameter(file:"params.csv") {
          climateFile "c:/od/projects/ngmf.models/src/tw/climate.csv"
          outputFile "output.csv"
          runoffFactor 0.5
          latitude 35.0
          smcap 200.0
       }
    }
    ...

The parameter 'file' property takes a file name. Note that this file can be an absolute file path or a relative one, that will relate to the base directory of the simulation. The parameter element can also have the parameter names/values as sub-elements as shown above. Names are matching the @In tagged fields of the model that is named in the surrounding model element. Values are space separated from their keys and have valid Java/Groovy data types such as Strings, Numbers, Files, etc. Those data types have to match the data type of the corresponding @In field in the model. However, the system will convert the values into the proper field data type, if the value is provided as String. (The climateFile value in the example above is of type File, but for convenience purposes it is provided as String.

If both, the file property is provided and there are also parameter values given, and both the file and the subsection specifies the same parameter, then the sub element will overwrite the file specified parameter.

The following use of the parameter element is possible. Multiple parameter elements can help splitting parameter sets in groups and allow for redefinition.

    ...
    model(classname:"my.model") {

        // definition of parameter file only
        parameter(file:"params.csv")

        // definition of parameter file only  
        parameter(file:"params-dates.csv")    

        // definition of parameter file and explicit parameters
        parameter(file:"params-files.csv") {    
            testdir "/tmp/test"
        }

        // definition of explicit parameter only
        parameter {                          
            coeff 2.34
        }
    }
    ...

More general about parameter value reading and setting order: a parameter at a higher line number will overwrite the same one at a lower line number. It is not relevant if it comes from a file or is specified explicitly.

Element parameter{}

Specification

Name
parameter - describes a model parameter

Properties Description Type Required
file the parameter file String (csd - file) N

Sub-Elements Description Type Default Occurrences
<pname> <pvalue> single model parameter <component field type> - zero to many

Parent(s)
model{}

Notes

  • A parameter element must have either a file property or at least one single parameter subelement. It can have both, but not none of each.