Software control of the model simulation
Working with models
Running a simulation
Before editing a model, open it using the open method. After editing, don’t forget to save the results with save.
To run the simulation of the model use the public method run
engee.run(model_name; verbose=false)
engee.run(model; verbose=false)
engee.run(; verbose=false)
-
Runs the simulation of the model. Returns the results of the simulation.
-
If no model is specified, runs a simulation of the current model.
-
If
verbose=true
, outputs the simulation progress. By defaultverbose=false
.
Example.
m = engee.load("/user/start/examples/power_systems/power_line_apv/power_line_apv.engee") #загружает модель из указанного пути присваивает ее переменной m
#другой вариант
m = "power_line_apv"
engee> engee.run(m)
Dict{String, DataFrame} with 6 entries:
"Va" => 40001×2 DataFrame…
"Ia" => 40001×2 DataFrame…
"Ib" => 40001×2 DataFrame…
"Ic" => 40001×2 DataFrame…
"Vc" => 40001×2 DataFrame…
"Vb" => 40001×2 DataFrame…
Suspending a running simulation
The public method pause is used
engee.pause(model_name)
engee.pause(model)
engee.pause()
-
Pauses the running simulation of the model. Returns
nothing
.
Errors
If the simulation is not running, it will generate an error Engee.Exceptions.SimulationError("Only running simulation may be paused")
.
Resuming a paused simulation
The public method resume is used
engee.resume(model_name)
engee.resume(model)
engee.resume()
-
Resumes a suspended simulation of the model. Returns the simulation results.
Simulation interruption
Uses the public method stop
engee.stop(model_name)
engee.stop(model)
engee.stop()
-
Stops the running simulation of the model. Returns
nothing
.
View simulation results
Uses the public method get_results
engee.get_results(model_name)
engee.get_results(model)
engee.get_results()
-
Returns the simulation results of the specified model in the form of a Dict dictionary, where the key is the name of the port being tracked.
-
If no model is specified, returns the results of the last simulation.
-
The method is directly linked to the simout variable storing the simulation results of the model. For more details on working with simout variable see Software processing of simulation results in Engee.
Example
engee.get_results("newmodel_1")
#вывод
Dict{String, DataFrames.DataFrame} with 1 entry:
"Integrator.1" => 1001×2 DataFrame…
Errors
-
If the model is not open, an exception
Engee.Exceptions.ModelDoesntExistException
is thrown.
Viewing the status of the model simulation
The public method get_status is used
engee.get_status(model_name)
engee.get_status(model)
engee.get_status()
-
Returns the status of the simulation as
SimulationStatus
.
Viewing simulation events
Uses the public method get_logs
engee.get_logs(model_name)
engee.get_logs(model)
engee.get_logs()
-
Gets the log messages associated with a model.
-
Returns an array of log messages associated with the specified model.
All public methods of programme management available in Engee are presented in the article Public methods of programme management. |
Examples
engee.run("newmodel_1") # запускает симуляцию модели. Возвращает результаты симуляции
engee.pause("newmodel_1") # останавливает запущенную симуляцию модели
engee.resume("newmodel_1") # возобновляет процесс симуляции модели
engee.stop() # останавливает запущенную симуляцию модели
engee.get_results("newmodel_1") # возвращает результаты симуляции в виде словаря Dict
engee.get_status("newmodel_1") # возвращает статус симуляции как SimulationStatus
engee.get_logs("newmodel_1") # получает сообщения из журнала, связанные с моделью