METHODS

From ASCEND

Jump to: navigation, search

The METHODS part of a MODEL is where procedural statements are contained. In this part of your model declaration, you can not declare new variables or equations, but you can set the values of variables, make equations active/inactive, perform bounds checking and run External Methods.

See Thin-walled_tank/Adding_methods_to_a_model for an introduction to the use of METHODS including some 'standard' method naming conventions.

Standard METHOD names

There is a suggested set of names for METHODs that you should consider using in a model if you would like to make it easy for other people to reuse it. These are

  • specify
In this method, RUN ClearAll, then FIX any variables that you would like to set as known values.
  • values
In this method, set the values of your FIXed variables.
  • default_self
Set any other default values for variables in your model. Often, setting these default (initial/pre-solve) values this is necessary in order for your model to converge to the desired solution.
  • bound_self
Set the upper_bound and lower_bound for any variables that don't already have suitable bounds from their ATOM definitions.
  • scale_self
Set (or re-set) the scaling for your model. Correct model scaling is critical for the good numerical behaviour of some models. Sometimes it can even be useful to re-scale the model after solving it with some 'easy' initial conditions.
  • on_load
Write this model to make calls to the other METHODs in suitable sequence. The intention here is that after the GUI automatically runs this method, the model should be in a state where it 'just solves', so that the user can see what the results are.

Sometimes models require an unusual set of METHODs in order to be configured to solve the problem at hand. In this case, it is recommended that instructions for solving your model be added using NOTES on the model, perhaps giving the notes category as "solving", for example.

Built-in methods

  • ClearAll
This method automatically FREEs all variables in the whole model tree.
Personal tools