Engee documentation

Software control of simulation parameters

Working with models

Getting Simulation settings

Before editing the model, open it using the method open. After editing, don’t forget to save the results using save.

A public method is used to get the simulation settings. get_param

engee.get_param(model)
engee.get_param("path")
engee.get_param("path", param)
  • If the model name is specified, but the parameter name is not specified, it returns the simulation settings for the selected model in the form of the ModelParameters structure.

  • If the parameter name is specified, it returns the parameter value.

All values of the model simulation settings can be passed to a variable:

m = "example_model"

Via engee.get_param("path", param) can output the value of a specific model parameter:

engee.get_param(m, :start_time) # outputs the start_time value

Changing the model simulation settings

The public method is used set_param!

engee.set_param!(model_name, param...)
engee.set_param!(model_name, param)
engee.set_param!(model, param...)
engee.set_param!(model, param)
  • Updates the selected parameters of the model Model with the name `model_name'.

  • Returns `nothing'.

  • If the simulation settings structure is passed to param, the settings will be copied from it.

  • If the parameters are incorrect, it ends with a corresponding error.

  • The structure of the simulation settings is tied to a specific model. You can change the model settings directly by setting the structure fields.

Output
engee.set_param!("model_1", "SolverName"=>"ode45", "StopTime"=>15)
param_1 = engee.get_param("model_1")::ModelParameters
engee.set_param!("model_2", param_1)

Updating block parameters

There are several methods available for working with block parameters:

To dynamically update the parameters of a running simulation, it is convenient to use update_params:

engee.update_params()
engee.update_params(model::Model)
engee.update_params(model_name::String)
  • Recalculates the parameters of a running simulation by reading their current values from the workspace.

  • Allows you to apply parameter changes to an already running simulation without stopping or restarting.

  • If the simulation is not running, the function does not perform any actions.

  • Equivalent to pressing a button "Update model» compile button 1 during the simulation.

  • It can optionally accept a model object or a model name for the target update.

Output
# Update the parameters of the current simulation
engee.update_params()

# Update the parameters of a specific model
model = engee.gcm()
engee.update_params(model)

# Update the model parameters by name
engee.update_params("my_model")

A public method is also used. set_param!

engee.set_param!(block_path, params...)
engee.set_param!(block, params...)
engee.set_param!(block, block_params)
engee.set_param!(block_path, block_params)
  • Updates the selected block parameters.

  • If a parameter is changed that entails changes in the number of ports or the state, then the number of ports and the state are changed according to the passed parameter values.

  • Returns `nothing'.

  • If the block settings structure is passed as the second parameter, its parameters will be copied. If the parameters are incorrect, it ends with a corresponding error.

Changing the simulation settings of the model using the structure

  • The structure of the simulation settings is linked to a specific model. You can change the model settings directly by setting the structure fields.

Output
params = engee.get_param("newmodel_1")
# the params structure is tied to a specific model
params.FixedStep = 0.05
0.05
# similar to `engee.set_param!(model, "FixedStep" => 0.05)
All public software management methods available in Engee are presented in the article. Public methods of programme management.