Skip to main content

Vensim Model Context Example

These are examples of a model context file for a Vensim model.

Learn more

For a comprehensive reference on the model context schema, please read Model context schema.

Saving run variables to database

To save all variables, add a variables property to the defaults object in your model context file, as in the context file sample below.

To optimize the amount of data saved to the database, use the reportPer property of the variables object.

Save all variables by default
    "defaults": {
"variables": {
"save": true,
"reportPer": 1
}
}

To save only specific variables, add a variables object to your model context.

Specify which variables to save
    "variables": { 
"reportPer": 1,
"myVarName1": {
"save": true
},
"myVarName2": {
"save": true
}
}

Sensitivity testing

Vensim model context example for sensitivity testing
{
"control": {
"vensim": {
"extensionModule": "sensitivity_aggregation.py",
"sensitivityControl": {
"algorithm": "M",
"numberOfSimulations": 500,
"noiseSeed": 1234,
"parameters": [
"modelfactor1=RANDOM_UNIFORM(0,1)",
"modelfactor2=RANDOM_UNIFORM(0,1)"
]
}
}
}
}