Optimisation API
Get the API documentation
MPC's optimisation is configured through an API. The API exposes a lot more than is needed just for configuration (e.g. an extension points to plug in new types of surrogate models, and an extension point to plug in an optimisation solver).
The full API documentation is available for download. If you only see a tree in the left pane when you open the .chm-file, but no content, you need to "unblock" the .chm-file in the file's properties.

For configuration of MPC's optimisation you will mainly need to access the Configuration class. The Configuration class has some overall properties as name of the configuration and time step of the model.
Model elements as a reach or a reservoir are added by the methods AddReach and AddReservoir and connected by the Connect-methods.
Constraints and targets are added to the model elements via a number of other Add-methods.
Below is a cheat sheet, which for all combinations of targets, constraints and penalities lists which Add-method.
Cheat sheet
| Constraints |
Manipulated flow |
Output |
|
AddConstraint |
AddConstraint |
| constant |
x |
x |
| time-varying |
x |
x |
| rate-of-change |
x |
-- |
| allow violation |
-- |
x |
| Targets |
Manipulated flow |
Output |
|
AddTarget |
AddTarget |
| constant |
x |
x |
| time-varying |
x |
x |
| Penalties |
Manipulated flow |
Output |
| deviation from target |
AddTarget |
AddTarget |
| constant |
x |
x |
| time-varying |
x |
x |
| Penalties |
Manipulated flow |
Output |
| violation of soft constraints |
-- |
AddConstraint |
| constant |
-- |
x |
| time-varying |
-- |
-- |
| Penalties |
Manipulated flow |
Output |
| rate-of-change |
AddChangePenalty |
-- |
| constant |
x |
-- |
| time-varying |
-- |
-- |