Engee documentation

Public methods of program management

All public methods of program management are presented here. engee. To get acquainted with the methods engee.script refer to the article Software script management.

Methods engee

engee.add_block(lib_block_path::String, tgt_block_path::String)

Adds a block from the library.

Arguments

  • lib_block_path::String: the full path to the block in the library. The path starts from /.

  • tgt_block_path::String: the path to the target system and the expected name of the new block. If only the system name is specified (for example "newmodel_1/"), then the block name will be automatically generated. If the full path with the block name is specified (for example "newmodel_1/Sum1"), then the block will receive the specified name.

Examples

# Adding a block from the library without assigning a name
engee.add_block("/Basic/Math Operations/Add", "newmodel_1/")

# Adding a block with a name
engee.add_block("/Basic/Math Operations/Add", "newmodel_1/Add_block_new")
engee.add_line(src_path::AbstractString, dst_path::AbstractString)
engee.add_line(system::System, src_path::AbstractString, dst_path::AbstractString)
engee.add_line(system_path::AbstractString, src_path::AbstractString, dst_path::AbstractString)

engee.add_line(src::PortHandle{OUT}, dst::PortHandle{IN})
engee.add_line(src::PortHandle{IN}, dst::PortHandle{OUT})
engee.add_line(src::PortHandle{ACAUSAL}, dst::PortHandle{ACAUSAL})

Adds a connection (data flow) between blocks. Two port assignment methods are supported:

  • Using string paths "system_name/block_name/idx" or "system_name/block_name/port_name";

  • Through port descriptors (PortHandle), obtained, for example, using engee.get_ports.

*The __ port descriptor (PortHandle) is an object that uniquely identifies a specific block port within the model. It does not contain the signal value, but serves as a "Handle" for software operation with ports — it can be transmitted to engee.add*line,engee.delete*line,engee.get*lines and other functions.

Features of physical modeling (acausal)

In the Engee physical simulation blocks, the ports are non-directional (acausal). This imposes the following features on working with connections:

  • Connection between PortHandle{ACAUSAL} It does not specify the direction of the data flow, but simply connects two physical nodes.;

  • One non-directional port can have multiple connections (multiple lines);

  • The links between the blocks are represented by separate objects Line.

Therefore, a step-by-step approach is used for programmatic analysis or model modification.:

  • To get the block’s port using engee.get_ports;

  • To get the lines connected to this port using engee.get_lines;

  • From objects Line get neighboring ports (source and destination);

  • Reconnect using engee.add_line.

Arguments

String options:

  • system::System: object type System;

  • system_path::AbstractString: path to the system;

  • src_path::AbstractString: relative path to out (output) port or non-directional (acausal) the block’s port. Recording format — "system_name/block_name/idx" or "system_name/block_name/port_name";

  • dst_path::AbstractString: relative path to in (input) port or non-directional (acausal) the block’s port. Recording format — "system_name/block_name/idx" or "system_name/block_name/port_name".

Options with port descriptors:

  • src::PortHandle{OUT}, dst::PortHandle{IN} — descriptors of directional source ports and receiver ports;

  • src::PortHandle{IN}, dst::PortHandle{OUT} — the opposite direction (when, according to the scheme, the source is a block with an input port);

  • src::PortHandle{ACAUSAL}, dst::PortHandle{ACAUSAL} — descriptors of non-directional ports.

Examples

Lines:

# Connects the first output port of the Sine Wave block and the first input port of the Terminator block in the current system
engee.add_line("Sine Wave/1", "Terminator/1")

# The first parameter can be an object of System
system = engee.gcs()

# The call is equivalent to the previous
engee.add_line(system, "Sine Wave-1/1", "Terminator-1/1")

# Instead of indexes, you can use the names of engee ports
.add_line("model", "Resistor/p", "Resistor-1/n")```



Descriptors:

julia-repl engee.addblock("/Basic/Sources/Sine Wave", "newmodel1/Sine Wave") engee.addblock("/Basic/Math Operations/Add", "newmodel1/Addblock") engee.addblock("/Basic/Sinks/Terminator", "newmodel_1/Terminator")

Получаем порты блоков

srcports = engee.getports("newmodel1/Sine Wave") addports = engee.getports("newmodel1/Addblock") dstports = engee.getports("newmodel1/Terminator")

Соединяем выход Sine Wave с первым входом Add_block

engee.addline(srcports.outputs[1], add_ports.inputs[1])

Соединяем выход Add_block с входом Terminator

engee.addline(addports.outputs[1], dst_ports.inputs[1])

In physical modeling (`acausal`) a port can have multiple connections, so you can't directly use only `source` or `destination`. In such cases, a step-by-step approach is used along the chain port → line → neighboring port.:
- We take the block's port using `engee.get_ports`;
- We get the line or lines connected to this port using `engee.get_lines`;
- From the object `Line` we get a neighboring port (`line.source` or `line.destination`);
- Reconnecting using `engee.add_line`.

Below is an example of replacing a physical block with connection restoration performed along this chain.

julia-repl

We receive the input port of the PID Controller block with the name "in". This is the receiver port

pidinputport = engee.getports("newmodel1/PID Controller").inputs["in"]

We get a connecting line corresponding to this port

pidinputline = engee.getlines(pidinput_port)

Getting the source port for this line

pidsourceport = pidinputline[1].source

We get the input port of the new PID Controller block named "in". This is the receiver port

newpidinputport = engee.getports("newmodel_1/PID Controller New").inputs["in"]

We connect the source port to the receiver port

engee.addline(pidsourceport, newpidinputport)

Getting the output port of the PID Controller

pidoutputport = engee.getports("newmodel1/PID Controller").outputs["out"]

We are getting a connecting line for this port

pidoutputline = engee.getlines(pidoutput_port)

We get a receiver port for this line

piddestport = pidoutputline[1].destination

Deleting the old PID Controller block

engee.deleteblock("newmodel1/PID Controller")

Getting the output port of the new PID Controller block

newpidoutputport = engee.getports("newmodel_1/PID Controller New").outputs["out"]

Connecting the output port of the new PID Controller to the old

engee receiver port.addline(newpidoutputport, piddestport)

Optionally, we do autoformatting of the engee.arrange_system model

(engee.gcs())`

engee.addpath(path::Vararg{String})

Adds one or more paths to a system variable LOAD_PATH. LOAD_PATH — this is a system variable that Engee uses to find the necessary executable objects (for example .engee, .ngscript), as well as any other paths used in commands.

Arguments

path::Vararg{String}: one or more paths in the file system.

Examples

engee.addpath("/user/models")
# Loading the model
engee.load("model.engee")
engee.arrange_system(system::System)

Rebuilds the arrangement of blocks and links in the specified model, automatically arranging the elements so as to reduce line intersections and make the model structure more readable. The function is equivalent to the context menu command "Arrange model" on the Engee canvas. The ordering is performed only for the specified model (without recursively changing the nested subsystems).

Arguments

system::System: an object of the system (model) for which automatic ordering needs to be performed. You can get it using engee.gcs().

Examples

# Organizes the current open model
engee.arrange_system(engee.gcs())
engee.clear()

Clears all variables in the current workspace. clear() deletes all data stored in variables to free up memory for new calculations and data streams. Returns nothing.

engee.clear_all()

Clears all variables, functions, and defined modules from the current workspace. clear_all() returns the current workspace to its original state. Returns nothing.

engee.clearport(portpath::AbstractString)

Удаляет все линии, связанные с переданным портом. При использовании индекса порта вместо имени, порт ищется среди выходных портов блока.

Пример:

engee.clear_port("model/Sine Wave/main_out")
engee.clear_port("model/Terminator/main_in")
engee.close(model_name::String; force::Bool = false)
engee.close(model::Model; force::Bool = false)
engee.close(; force::Bool = false)

Closes the model with the name model_name. The current model becomes the one that is open to the left in the navigation panel for models. If the model is not specified, it closes the current model. If the current model is not set, it does nothing. If the model doesn’t exist anymore, it doesn’t do anything.

Arguments

  • model_name::String: the name of the model that will be closed.

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily open in the GUI.

  • force::Bool: by default is equal to false. If there are unsaved changes and the parameter is equal to false, then exits with an error. If equal to true then unsaved changes will be lost.

Examples

**Unloads the newmodel_1 model from memory**

engee.close("newmodel_1")

**Unloads the newmodel_1 model from memory without saving the latest changes**

engee.close("newmodel_1", force=true)

Closes the newmodel_1 model (unloads and removes from the canvas)

engee.close("newmodel_1", force=true)`

engee.close_all()

Closes all models.

Examples

# Unloads all open models from memory
engee.close_all()
engee.compare_models(model_path_1::String, model_path_2::String)

Compares a pair of models and returns a list of differences.

Arguments

  • model_path_1::String the relative or absolute path to the first model to be compared.

  • model_path_2::String the relative or absolute path to the second model for comparison with the first.

Examples

# Absolute path (specifying the full path to the model file)
m1 = "/user/modelname_1.engee"

# Relative path (specifying the relative path to the model file)
m2 = "modelname_2.engee"

# Comparison of m1 and m2
engee.compare_models(m1, m2)
engee.convert_model(model_path::String, out_path::String="")

Generates an .ngscript file (Engee script) to build the current model using software control commands.

Arguments

  • model_path::String: relative or absolute path to the source model in the format .engee or .slx which needs to be converted.

  • out_path::String: a relative or absolute path to save the generated script. If this argument is not specified, the script is saved in the default folder (/user) and is returned as a string. If a path is specified out_path, then the script is saved to a file with the specified name (the extension can be set arbitrarily, but for subsequent launch in Julia it is recommended to use .jl) and returns nothing.

Examples

# Getting the absolute path and outputting the Engee script
model_path = "/user/newmodel_1.engee"
engee.convert_model(model_path)

# Getting the relative path and outputting the Engee script
m_abs_path = "newmodel_2.engee"
engee.convert_model(m_abs_path)
engee.copy_block(src_path::AbstractString, dst_path::AbstractString; duplicate::Bool=false)::Nothing

Copies the block from the system.

If duplicate=true and src_path points to the block Inport, then the function creates a duplicate of the input port (Inport Shadow): The duplicate gets the same input port number as the original one Inport, and allows you to fork the signal from the input without creating a new subsystem input port.

Arguments

  • src_path::AbstractString: the full path to the block in the system.

  • dst_path::AbstractString: the path to the system and the expected name. Recording format — path/to/system/new_block_name. If the name is not specified, it is set automatically.

  • duplicate::Bool: duplicate flag for blocks Inport. For other types of blocks, setting the flag (duplicate=true) will result in an error: "Duplication not allowed for this block type: only "Inport" blocks can be duplicated".

Examples

# Adds the Add-3 block from the newmodel_1 model and automatically assigns it a name in the newmodel_2 model.
engee.copy_block("newmodel_1/Add-3", "newmodel_2/")

# Adds a block from the newmodel_1 model named Custom Block Name to the nemodel_2 model named Test_name
engee.copy_block("newmodel_1/Custom Block Name", "newmodel_2/Test_name")
engee.copy_contents(src_path::AbstractString, dst_path::AbstractString)

Copies the contents of one system to another. The target system must be empty. Recursive copying is prohibited.

Arguments

  • src_path::AbstractString: the path to the system from which the copy is being made.

  • dst_path::AbstractString: the path to the system to which the copy is being made.

Examples

# Copying content from the newmodel_1 root system to the newmodel_2 root system
engee.copy_contents("newmodel_1", "newmodel_2")

# Copying content from subsystem "newmodel_1/Subsystem" to subsystem `newmodel_1/Subsystem-1`
engee.copy_contents("newmodel_1/Subsystem", "newmodel_1/Subsystem-1")
ERROR: "newmodel_1/Subsystem-1 must be empty. Use `engee.delete_contents`"
engee.delete_contents("newmodel_1/Subsystem-1")
engee.copy_contents("newmodel_1/Subsystem", "newmodel_1/Subsystem-1")
engee.create(model_name::String)::Model

Creates a new model with the name model_name and the default settings. Returns Model. The model becomes the current model. Its root system becomes the current system. If a model with that name already exists, it fails. EngeeException.

Arguments

model_name::String: the desired model name in the system. The model name must not contain the symbol /.

Examples

engee.create("NewModel")
Model(
    name: NewModel
    id: 6b59d80d-8b48-419d-83e7-a90660aa1a6a
)
engee.delete_block(block_path::String)

Deletes the block, all associated lines, and writable ports from the system.

Arguments

block_path::String: the path to the block.

Examples

# Removes the Sine Wave block and all associated lines and blocks from the system
engee.delete_block("newmodel_1/Sine Wave")
engee.delete_contents(system_path::String)

Deletes the contents of the system.

Arguments

system_path::String: the path to the system whose content will be deleted.

Examples

# Removing all blocks from Subsystem-1 in the newmodel_1 model
engee.delete_contents("newmodel_1/Subsystem-1")
engee.delete_line(src_path::AbstractString, dst_path::AbstractString)
engee.delete_line(system::System, src_path::AbstractString, dst_path::AbstractString)
engee.delete_line(system_path::AbstractString, src_path::AbstractString, dst_path::AbstractString)

engee.delete_line(line::Line)
engee.delete_line(src::PortHandle{OUT},   dst::PortHandle{IN})
engee.delete_line(src::PortHandle{IN},   dst::PortHandle{OUT})
engee.delete_line(src::PortHandle{ACAUSAL}, dst::PortHandle{ACAUSAL})

There are three supported ways to specify a connection to be deleted:

  • By string paths to ports ("system_name/block_name/idx");

  • By line item Line received via engee.get_lines;

  • By port descriptors (PortHandle), received via engee.get_ports or from the structure Line.

Line describes a single connection line in the circuit and contains, in particular, source and receiver ports: source::PortHandle, destination::PortHandle.

Removal methods via Line and PortHandle{ACAUSAL} also applicable to non-directional (acausal, physical) connections.

Arguments

String options:

  • system::Union{AbstractString, System}: path to the system or object type System;

  • src_path::AbstractString: relative path to out the (output) port of the block. The port name is its serial number. Recording format — "system_name/block_name/idx";

  • dst_path::AbstractString: relative path to in the (input) port of the block. The port name is its serial number. Recording format — "system_name/block_name/idx".

Options with objects Line and port descriptors:

  • line::Line: the line object returned engee.get_lines(...). Contains the line identifier and the source and receiver port descriptors.;

  • src::PortHandle{OUT}, dst::PortHandle{IN} — descriptors of directional source ports and receiver ports;

  • src::PortHandle{IN}, dst::PortHandle{OUT} — the opposite direction (when the source

is considered to be a block with an input port);

  • src::PortHandle{ACAUSAL}, dst::PortHandle{ACAUSAL} — descriptors of non-directional ports.

Examples

# Deletes the connection between the first input port of the Sine Wave block and the first output port of the Terminator block in the newmodel_1 model
engee.delete_line("newmodel_1", "Sine Wave/1", "Terminator/1")
system = engee.gcs()
engee.delete_line(system, "Sine Wave-1/1", "Terminator-1/1")

# Deletion without specifying the system. It is called by default for the current system.
engee.delete_line("Sine Wave-2/1", "Terminator-2/1")

# An example of working with port descriptors (PortHandle), assuming that the blocks are already connected via engee.add_line, as in the example for add_line
src_ports = engee.get_ports("newmodel_1/Sine Wave")
dst_ports = engee.get_ports("newmodel_1/Terminator")

# Removing the line between the first Sine Wave output and the first Terminator input
engee.delete_line(src_ports.outputs[1], dst_ports.inputs[1])

# Example of deleting all lines connected to a block

# Getting all the lines connected to the Add_block block
all_block_lines = engee.get_lines("newmodel_1/Add_block")

# Deleting all these lines by Line objects
for ln in all_block_lines
  engee.delete_line(ln)
end

# Equivalent notation with dot notation
engee.delete_line.(engee.get_lines("newmodel_1/Add_block"))
engee.eval(code::AbstractString)

Executes the Julia code in the current context of the model.

Arguments

code::AbstractString: a line with code on Julia for execution.

Examples

engee.eval(2 + 3 * 5)
17

engee.eval(sin(π/2))
1.0
engee.find_system(path::String; depth::Int=typemax(Int), blockparams::Vector{<:Pair{<:AbstractString,<:Any}}=Vector{Pair{String, Any}}())

Searches for entities (models/systems/blocks) along the specified path. Returns the paths to the found entities.

Arguments

  • path::String: the path to the entity to be searched for.

  • depth::Int=typemax(Int): the maximum search depth (inclusive). To search without restrictions, use typemax(Int). The enumeration starts from 0. By default typemax(Int).

  • blockparams::Vector: only blocks with the specified parameters will be returned.

Examples

# The list of entities that make up the model named newmodel_1 (subsystems, blocks)
engee.find_system("newmodel_1")

# List of entities of the newmodel_1 model without entering the subsystems
engee.find_system("newmodel_1"; depth=0)

# A list of all blocks with the Value field equal to 1.0 in the newmodel_1 model
engee.find_system("newmodel_1"; blockparams=["Value"=>1.0])
engee.find_system(model::Model; depth::Int=typemax(Int), blockparams::Vector{<:Pair{<:AbstractString,<:Any}}=Vector{Pair{String, Any}}())

Searches for entities (models/systems/blocks) in the specified model passed as an object of the type Model. Returns the paths to the found entities.

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily open in the GUI. The search will be conducted in this model.

  • depth::Int=typemax(Int): the maximum search depth (inclusive). To search without restrictions, use typemax(Int). The enumeration starts from 0. By default typemax(Int).

  • blockparams::Vector: only blocks with the specified parameters will be returned.

Examples

# The list of entities that make up the model (subsystems, blocks)
engee.find_system(model)

# List of model entities without entering subsystems
engee.find_system(model; depth=0)

# A list of all blocks with the Value field equal to 1.0 in the model
engee.find_system(model; blockparams=["Value"=>1.0])
engee.find_system(system::System; depth::Int=typemax(Int), blockparams::Vector{<:Pair{<:AbstractString,<:Any}}=Vector{Pair{String, Any}}())

Searches for entities (models/systems/blocks) in the specified system, passed as an object of the type System. Returns the paths to the found entities.

Arguments

  • system::System: the system in which the search will be conducted.

  • depth::Int=typemax(Int): the maximum search depth (inclusive). To search without restrictions, use typemax(Int). The enumeration starts from 0. By default typemax(Int).

  • blockparams::Vector: only blocks with the specified parameters will be returned.

Examples

# The list of entities that make up the system (subsystems, blocks)
engee.find_system(system)

# A list of system entities without entering subsystems
engee.find_system(system; depth=0)

# A list of all blocks with the Value field equal to 1.0 in the system system
engee.find_system(system; blockparams=["Value"=>1.0])
engee.find_system(; depth::Int=typemax(Int), blockparams::Vector{<:Pair{<:AbstractString,<:Any}}=Vector{Pair{String, Any}}())

Searches for entities (models/systems/blocks) in all available models. Returns the paths to the found entities.

Arguments

  • depth::Int=typemax(Int): the maximum search depth (inclusive). To search without restrictions, use typemax(Int). The enumeration starts from 0. By default typemax(Int).

  • blockparams::Vector: only blocks with the specified parameters will be returned.

Examples

# List of all entities
engee.find_system()

# List of model entities without entering subsystems
engee.find_system(; depth=0)

# A list of all blocks with the Value field equal to 1.0
engee.find_system(; blockparams=["Value"=>1.0])
engee.get_current_block()::String
engee.gcb()::String

Returns the path to the current block. If there is no current block or model, it outputs an error. Current block is not set.

Examples

# The Sine Wave block is highlighted on the canvas
engee.gcb()
"newmodel_1/Sine Wave"
engee.get_current_model()::Model
engee.gcm()::Model

Returns the current model. If there is no current model, it outputs an error. No opened model.

Examples

engee.get_current_model()
Model(
    name: ssc_bridge_rectifier_modified
    id: c390ed60-d2c4-4e17-85df-07129aca8ba4
)
engee.get_current_system()::System
engee.gcs()::System

Returns the current system. If there is no current model, it outputs an error. No opened model.

Examples

engee.gcs()
System(
  name: root,
  id: 039b7ddd-f836-4b0c-bb8d-8232344b22fb,
  path: newmodel_1
)
engee.generate_code(path/to/modelname.engee::String, path/to/output_dir::String; subsystem_name=subsystem_path::String, subsystem_id=subsystem_id::String, target::String, jl_path::String)

Generates code in the specified language for models and/or subsystems. Supports the use of templates to customize the output code (including the function main).

For models

  • Generation is performed for the entire model, set by an absolute or relative path to the model file. .engee.

  • The target code generation can be specified via the parameter target, as well as the path to the custom template via template_path.

Arguments

  • model_path::String: the absolute or relative path to the model from which the code is generated. The model object (type object) can be used as an argument. model received by the function engee.gcm).

  • output_dir::String: the absolute or relative path to the directory where the generated code will be saved. If the directories output_dir if it does not exist, it will be created automatically.

  • target::String: specifying the language for code generation. Supported languages — Си (by default) or Verilog.

  • template_path::String: the path to .jl-a template file (for example, a function template main).

Examples

# Generating the C code for the model
engee.generate_code("newmodel_1.engee", "newmodel_1/codegen_output")

# Verilog code generation, the newmodel_1 file will be created.v with Verilog code
engee.generate_code("newmodel_1.engee", "newmodel_1/verilog_output", target="verilog")

# Code generation with a template containing the main function
engee.generate_code("codegen_model.engee", "codegen_dir", template_path="/user/main_template.jl")

# Getting the current open model and generating code from it
m = engee.gcm()
engee.generate_code(m, "/user/newmodel_1/codegen_output")

For subsystems

  • Generation is performed only for the atomic subsystem specified by name (subsystem_name) or by ID (subsystem_id).

  • The remaining parameters are similar to the generation for the full model.

Arguments

  • subsystem_name::String: the full path to the atomic subsystem from which the code is generated.

  • subsystem_id::String: a unique identifier of the atomic subsystem from which the code is generated (alternative subsystem_name).

  • target::String: specifying the language for code generation. Supported languages — Си (by default) or Verilog.

Examples

# Generating C code for a subsystem by name
engee.generate_code("newmodel_1.engee", "newmodel_1/Subsystem", subsystem_name="Subsystem")

# Code generation for an atomic subsystem by its id
engee.generate_code("/user/newmodel_1.engee", "/user/newmodel_1/Subsystem"; subsystem_id = "88275e0b-a049-4bb5-b8c7-057badd1b536")

# Verilog code generation for the subsystem, the newmodel_1 file will be created.v with Verilog subsystem code
engee.generate_code("newmodel_1.engee", "newmodel_1/verilog_pid", subsystem_name="SubSystem", target="verilog")
engee.generate_code(path/to/modelname.engee::String, path/to/output_dir::String; subsystem_name=subsystem_path::String, subsystem_id=subsystem_id::String, target::String, jl_path::String)

Generates code in the specified language for models and/or subsystems. Supports the use of templates to customize the output code (including the function main).

For models

  • Generation is performed for the entire model, set by an absolute or relative path to the model file. .engee.

  • The target code generation can be specified via the parameter target, as well as the path to the custom template via template_path.

Arguments

  • model_path::String: the absolute or relative path to the model from which the code is generated. The model object can be used as an argument (an object of the type model received by the function engee.gcm).

  • output_dir::String: the absolute or relative path to the directory where the generated code will be saved. If the directories output_dir if it does not exist, it will be created automatically.

  • target::String: specifying the language for code generation. Supported languages — Си (by default) or Verilog.

  • template_path::String: the path to .jl-a template file (for example, a function template main).

Examples

# Generating the C code for the model
engee.generate_code("newmodel_1.engee", "newmodel_1/codegen_output")

# Verilog code generation, the newmodel_1 file will be created.v with Verilog code
engee.generate_code("newmodel_1.engee", "newmodel_1/verilog_output", target="verilog")

# Code generation with a template containing the main function
engee.generate_code("codegen_model.engee", "codegen_dir", template_path="/user/main_template.jl")

# Getting the current open model and generating code from it
m = engee.gcm()
engee.generate_code(m, "/user/newmodel_1/codegen_output")

For subsystems

  • Generation is performed only for the atomic subsystem specified by name (subsystem_name) or by ID (subsystem_id).

  • The remaining parameters are similar to the generation for the full model.

Arguments

  • subsystem_name::String: the full path to the atomic subsystem from which the code is generated.

  • subsystem_id::String: a unique identifier of the atomic subsystem from which the code is generated (alternative subsystem_name).

  • target::String: specifying the language for code generation. Supported languages — Си (by default) or Verilog.

Examples

# Generating C code for a subsystem by name
engee.generate_code("newmodel_1.engee", "newmodel_1/Subsystem", subsystem_name="Subsystem")

# Code generation for an atomic subsystem by its id
engee.generate_code("/user/newmodel_1.engee", "/user/newmodel_1/Subsystem"; subsystem_id = "88275e0b-a049-4bb5-b8c7-057badd1b536")

# Verilog code generation for the subsystem, the newmodel_1 file will be created.v with Verilog subsystem code
engee.generate_code("newmodel_1.engee", "newmodel_1/verilog_pid", subsystem_name="SubSystem", target="verilog")
engee.get_all_models(; sorted=true)::Vector{Model}

Retrieves a list of all models opened in the current session, in the format Vector{Model}. If the parameter sorted=true, then returns a list of models sorted by name.

Arguments

sorted::Bool: by default true. Determines whether the list of models will be sorted by name.

Examples

# A list with a list of all open models
models_list = engee.get_all_models()

# A list with the names of all open models
model_names = [m.name for m in engee.get_all_models()]
engee.get_current_block()::String
engee.gcb()::String

Returns the path to the current block. If there is no current block or model, it outputs an error. Current block is not set.

Examples

# The Sine Wave block is highlighted on the canvas
engee.gcb()
"newmodel_1/Sine Wave"
engee.get_current_model()::Model
engee.gcm()::Model

Returns the current model. If there is no current model, it outputs an error. No opened model.

Examples

engee.get_current_model()
Model(
    name: ssc_bridge_rectifier_modified
    id: c390ed60-d2c4-4e17-85df-07129aca8ba4
)
engee.get_current_system()::System
engee.gcs()::System

Returns the current system. If there is no current model, it outputs an error. No opened model.

Examples

engee.gcs()
System(
  name: root,
  id: 039b7ddd-f836-4b0c-bb8d-8232344b22fb,
  path: newmodel_1
)
engee.get_lines(block_path::AbstractString)::Vector{Line}
engee.get_lines(block_path::AbstractString, causality::PortCausality)::Vector{Line}
engee.get_lines(port::PortHandle)::Vector{Line}

Returns the signal lines connected to a block or a specific port. Returns Vector{Line} — vector of objects Line, each of which describes one connection between two ports.

Line (Line) is an object describing one connection in the diagram:

  • id::UUID — line ID;

  • source::PortHandle — source port;

  • destination::PortHandle — the receiving port.

An object Line for example, you can transfer to engee.delete_line(line::Line) to delete a connection.

Function engee.get_lines(...) always returns a vector of lines (Vector{Line}), even if there is only one line. This is important for non-directional (acausal) physical simulation ports, where one port can have multiple connections.

Arguments

  • block_path::AbstractString: the path to the block in the hierarchy of the model. Recording format — "model_name/block_name" or "model_name/system_name/block_name".

  • causality::PortCausality: the type of ports to receive lines for. Enumeration values are supported PortCausality:

  • IN — lines connected to the input ports of the unit;

  • OUT — lines connected to the output ports;

  • ACAUSAL — lines connected to non-directional ports.

  • port::PortHandle: block port descriptor (PortHandle{IN}, PortHandle{OUT} or PortHandle{ACAUSAL}), for example, obtained via engee.get_ports.

Examples

engee.add_block("/Basic/Sources/Sine Wave",  "newmodel_1/Sine Wave")
engee.add_block("/Basic/Sinks/Terminator",  "newmodel_1/Terminator")
engee.add_block("/Basic/Math Operations/Add", "newmodel_1/Add_block")

# Connecting Sine Wave -> Add_block -> Terminator
src_ports = engee.get_ports("newmodel_1/Sine Wave")
add_ports = engee.get_ports("newmodel_1/Add_block")
dst_ports = engee.get_ports("newmodel_1/Terminator")

engee.add_line(src_ports.outputs[1], add_ports.inputs[1])
engee.add_line(add_ports.outputs[1], dst_ports.inputs[1])

# All lines connected to the Add_block block
all_add_lines = engee.get_lines("newmodel_1/Add_block")

# Only lines to the output ports of the Sine Wave unit
sine_out_lines = engee.get_lines("newmodel_1/Sine Wave", OUT)

# Lines connected to a specific port
first_add_input = add_ports.inputs[1]
lines_to_add_in1 = engee.get_lines(first_add_input)

# Delete all lines connected to the Add_block block
engee.delete_line.(engee.get_lines("newmodel_1/Add_block"))

Getting neighboring ports via lines (port → lines → port):

some_port = add_ports.inputs[1]

lines = engee.get_lines(some_port)

source_ports = getproperty.(lines, :source)
destination_ports = getproperty.(lines, :destination)
engee.get_logs(model::Model)
engee.get_logs()

Retrieves log messages related to the model. If the model is not open, it outputs an error. No opened model. Returns an array with messages.

Arguments

m::Model: the default model for which the operation is performed is the current model.

Examples

engee.get_logs()
4-element Vector{Dict{Symbol, String}}:
 Dict(:datetime => "2025-10-27T20:18:38.465684+00:00", :type => "INFO", :content => "Подготовка симуляции завершена за 5.8178 с.")
 Dict(:datetime => "2025-10-27T20:18:39.412789+00:00", :type => "INFO", :content => "Компиляция модели завершена за 1.833 c.")
 Dict(:datetime => "2025-10-27T20:18:39.412896+00:00", :type => "INFO", :content => "Инициализация модели завершена за 0.0903 c.")
 Dict(:datetime => "2025-10-27T20:18:39.842869+00:00", :type => "INFO", :content => "Симуляция модели завершена за 0.764 c.")
engee.get_param(model::Model)
engee.get_param(path::String, param::Union{Symbol, String})::Any
engee.get_param(path::String, param::Union{Symbol, String})::Any
engee.get_param(block::Block)
engee.get_param(block::Block, param::Union{Symbol, String})::Any

For models

  • If the model name is specified but the parameter name is not specified, it returns the simulation settings for the selected model as a dictionary.

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

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily open in the GUI. The parameters will be extracted from this model.

  • path::String: a string path to the model if a path is used instead of the model object.

  • param::Union{Symbol, String}: the name of the parameter to extract. It can be a string or a character.

For blocks

  • On the way to the block, it returns either the parameter value (if specified) or a dictionary with parameters.

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

Arguments

  • block::Block: the object of the block to extract the parameters for.

  • path::String: a string path to the block if a path is used instead of the block object.

  • param::Union{Symbol, String}: the name of the block parameter to be extracted. It can be a string or a character.

Examples

# Getting a dictionary of all model parameters
m = engee.gcm()
params = engee.get_param(m)
engee.get_ports(block_path::AbstractString)::BlockPorts

Returns the structure BlockPorts, containing the port descriptors of the specified block.

A port descriptor is a special object (PortHandle) that uniquely identifies a specific block port within the model. It contains all the necessary information for working with the port: which block it belongs to, its type (input, output, acausal) and the index inside the block.

The descriptor is not a signal value, but serves as a pointer to a port that can be passed to other functions, such as

  • engee.add_line(src::PortHandle, dst::PortHandle);

  • engee.delete_line(src::PortHandle, dst::PortHandle);

  • engee.get_lines(port::PortHandle).

So, PortHandle — this is a "handle" for software operation with ports in Engee models.

Arguments

block_path::AbstractString: the path to the block in the hierarchy of the model. Recording format — "model_name/system_name/block_name" or "model_name/block_name" for a block in the root system.

Return value

BlockPorts: a structure with three port dictionaries:

  • inputs::IntStringDict{PortHandle{IN}} — input ports;

  • outputs::IntStringDict{PortHandle{OUT}} — output ports;

  • acausal::IntStringDict{PortHandle{ACAUSAL}} — non-directional ports.

Ports are available as by index (ports.outputs[1]), and by port name (ports.outputs["main_out"]).

Physical modeling

For physical modeling blocks, non-directional ports are found in the dictionary ports.acausal. The names of such ports depend on the specific block (for example "p", "n", "pin"). To find out the available port names, use collect(keys(ports.acausal)).

Examples

engee.add_block("/Basic/Sources/Sine Wave",   "newmodel_1/Sine Wave")
engee.add_block("/Basic/Sinks/Terminator",    "newmodel_1/Terminator")
engee.add_block("/Basic/Math Operations/Add",  "newmodel_1/Add_block")

# Getting block ports in the newmodel_1 model
src_ports = engee.get_ports("newmodel_1/Sine Wave")
dst_ports = engee.get_ports("newmodel_1/Terminator")

# Index Access
first_src_out = src_ports.outputs[1]
first_dst_in = dst_ports.inputs[1]

# The ports of the Add_block block are also available by indexes
add_ports = engee.get_ports("newmodel_1/Add_block")

sum_in1 = add_ports.inputs[1]
sum_in2 = add_ports.inputs[2]
sum_out = add_ports.outputs[1]

# Getting block ports with named ports (ports must be pre-named)
add_ports = engee.get_ports("newmodel_1/Add_block")

sum_in1 = add_ports.inputs["in1"]
sum_in2 = add_ports.inputs["in2"]
sum_out = add_ports.outputs["out"]

# Conclusion
# CommandControlTypes.PortHandle{CommandControlTypes.OUT}(Base.UUID("b99ea18d-6ffa-4366-bc4f-43ea5438c530"), Base.UUID("746c1521-0c13-465e-8d26-e4d7f8729e52"), Base.UUID("e23e6f8a-0811-4f91-a597-707c501be315"), Base.UUID("e72aa3ab-7a60-4c4b-a8f1-f2bca8985747"), 1)

Getting non-directional ports of a physical block:

r_ports = engee.get_ports("model/Resistor")

# List of acausal port names
collect(keys(r_ports.acausal))

p = r_ports.acausal["p"]
n = r_ports.acausal["n"]
engee.get_results(model_name::String)
engee.get_results(model::Model)
engee.get_results()

Returns the results of the last simulation of the model as a dictionary Dict{String, DataFrame}, where the key is the name of the monitored port. If the model is not open, it outputs an error. NoModelOpenedException. If the simulation is not running, it outputs an error. ModelIsNotRunningException.

Arguments

model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily open in the GUI. The operation of returning the results of the last simulation will be performed relative to this model.

Examples

m = engee.load("start/examples/powersystems/models/power_line_apv.engee")
results1 = engee.run(m);
results2 = engee.get_results(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…
results1 == results2
true
engee.get_status()::SimulationStatus
engee.get_status(model_name::String)::SimulationStatus
engee.get_status(model::Model)::SimulationStatus

Returns the simulation status as an object of the type SimulationStatus. Returns one of the simulation statuses.:

  • NOT_READY;

  • READY;

  • BUILDING;

  • RUNNING;

  • PAUSED;

  • STARTED;

  • ERROR;

  • STOPPED;

  • DONE.

Arguments

  • model_name::String: the name of the model to get the status for.

  • model::Model: a model object of the type Model, for which you need to get a status.

Examples

engee> engee.get_status()
READY
engee.info(info_message::String)

Transmits an information message to the model diagnostics window. The function is called only inside block callbacks (including masked ones). In messages, you can refer to the names of the parameters in the workspace (in the variables window) via $имя_параметра.

Arguments

info_message::String: the transmitted information message.

Examples

**Example without reference to workspace settings**

engee.info("Модель успешно инициализирована!")

**Message in the diagnostic window:**

**The model has been successfully initialized!**

**Example with a link to the workspace settings**

engee.info ("The model has been successfully initialized with the parameters :Kp and :Ki!")

**Message in the diagnostic window:**

**The model has been successfully initialized with parameters 1.4 and 1.8!**

<a target='_blank' href='https://github.com/JuliaLang/julia/blob/760b2e5b7396f9cc0da5efce0cadd5d1974c4069/base/#L0-L23' class='documenter-source'>source</a><br>

<a id='engee.is_dirty-Tuple{CommandControlTypes.Model}' href='engee.is_dirty-Tuple{CommandControlTypes.Model}'></a> engee.is_dirtyMethod.

engee.is_dirty(model::Model)::Bool
engee.is_dirty(model_name::String)::Bool

Checks if there are unsaved model changes. Returns true if there are unsaved changes, otherwise — false. If the model is already closed, it returns false. On a recently opened model, it can return true if the model is opened from an old version file (the model will be updated when saving).

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily selected by the current model.

  • model_path::String: the path to the model.

Examples

# Checking the current model
model = engee.gcm()
engee.is_dirty(model)

# Checking by model name
engee.is_dirty("newmodel_1")
engee.load(file_path::String; name::Maybe{String}=nothing, force::Bool = false)::Model

Loads the model from a file with the extension .engee, located in file_path. Returns Model. The model becomes the current model. Its root system becomes the current system.

Features

  • If a model with the same name already exists and the parameter is equal to true, then restarts it and all previously unsaved changes will be lost if equal to false, then throws an exception. By default, it is equal to false.

  • The model can be loaded with a different name if it is specified in the parameter name. If the parameter is omitted, it leaves the model name saved in the file.

  • If the file has a different extension or it does not exist, it throws an exception.

Arguments

  • file_path::String: the absolute or relative path to the model file with the extension .engee.

  • name::Maybe{String}: new name for the uploaded model. If not specified, the name from the file is used.

  • force::Bool: the forced download flag. By default, it is equal to false. If equal to true, then the download will be performed if the file has already been previously uploaded.

Examples

engee.load("NewModel.engee"; force = true)
Model(
    name: NewModel
    id: 6b59d80d-8b48-419d-83e7-a90660aa1a6a
)
engee.log(message::String)

Writes a message to the event log. The function is called only inside block callbacks (including masked ones). In messages, you can refer to the names of the parameters in the workspace (in the variables window) via $имя_параметра.

Arguments

message::String: a text message to write to the log.

Examples

engee.log("Условие выполнено за $time" секунд)
Условие выполнено за 6.7538 секунд
engee.model(model_name::String, phase::Symbol)
engee.model(model_name::String,
      t::Union{Float64, Nothing},
      x::Union{Vector{Float64}, Float64, Nothing},
      u::Union{Vector{Float64}, Float64, Nothing},
      phase::Symbol)

Performs model calculations at the specified simulation phase without running a full simulation. It allows you to get service information about the size of the task, outputs and derivatives of states and is used in internal algorithms (search for working points, linearization). It is not intended for step-by-step debugging and does not replace the public method. engee.run.

The function only works if the model file named model_name is open.

Arguments

  • model_name::String: the name of the model.

  • t::Union{Float64, Nothing}: a moment in the simulation time. Used for phases :outputs and :derivatives. For the phase :sizes maybe nothing and it is ignored.

  • x::Union{Vector{Float64}, Float64, Nothing} vector or scalar of model states. For stateless models, there may be nothing. For the phase :sizes ignored.

  • u::Union{Vector{Float64}, Float64, Nothing}: a vector or scalar of the model’s input signals. If the model does not contain input ports, it must be nothing. For the phase :sizes ignored.

  • phase::Symbol: the modeling phase. Values are supported:

    • :sizes Determining the size of the simulation task (number of states, inputs/outputs, and sampling rates);

    • :outputs: calculation of model outputs at specified t, x, u;

    • :derivatives calculation of derivatives of continuous states for given t, x, u.

Return values

Depending on the value phase the behavior of the function will change as follows:

  • phase == :sizes

    • The motorcade is returning:

      • sys — a vector of integers containing information about the structure of the model:

        • sys[1] — number of continuous states;

        • sys[2] — the number of discrete states;

        • sys[3] — the number of outputs of the model;

        • sys[4] — number of model inputs;

        • sys[5] — the number of sampling frequencies (sample time) in the model.

      • x0 — initial values of the model states.

    If the model does not contain blocks with states, it returns nothing.

  • phase == :outputs

    • He’s coming back:

      • y::Union{Vector{Float64}, Float64, Nothing} — outputs of the model at the specified t, x, u.

      • If the model does not contain output ports, it returns nothing.

      • Vector elements y ordered according to the full names of the output blocks.

  • phase == :derivatives

    • He’s coming back:

      • dx::Union{Vector{Float64}, Float64, Nothing} — derivatives of continuous states for given t, x, u.

      • If the model does not contain continuous states, it returns nothing.

      • Vector elements dx they are ordered according to the full names of the blocks containing the states.

Restrictions

The function supports:

  • Continuous models;

  • Discrete models;

  • Models without blocks containing states;

  • Models with virtual subsystems (Subsystem);

  • Models with atomic subsystems;

  • Models that include link models.

The function does not support models containing:

  • Conditionally executable subsystems (enabled, triggered);

  • Subsystems with the Action Port block;

  • Blocks Engee Function;

  • Blocks C Function;

  • Blocks Chart;

  • Blocks Bus Creator, Bus Selector, Bus Assignment;

  • Blocks of physical modeling.

Errors

Errors may be generated if the call conditions are violated.:

  • The model does not exist or is not open: The model "model_name" doesn’t exist;

  • There are unsaved changes in the model: The model "model_name" has unsaved changes;

  • The model contains unsupported blocks: The model "model_name" contains unsupported blocks.

Examples

# Determining the size of the simulation task and initial states
sys, x0 = engee.model("model_name", :sizes)

# Calculating model outputs
t = 0.0
x = [0.0; 0.0; 0.0]
u = 2.0

y = engee.model("model_name", t, x, u, :outputs)

# Calculation of derived states
t = 0.0
x = [0.0; 1.0; 1.0]
u = 2.0

dx = engee.model("model_name", t, x, u, :derivatives)

# Usage scenario in the search algorithm for a working point
sys, x0 = engee.model("model_name", :sizes)

dx = engee.model("model_name", t, x, u, :derivatives)
y = engee.model("model_name", t, x, u, :outputs)
engee.open(path::String)::System
engee.open(model::Model)::System
engee.open(system::System)::System

Returns an open system System. If the model or system does not exist, it fails. EngeeException.

Features

  • The name is specified in the parameter model_name a previously opened model, then it becomes the current model. Its root system becomes the current system.

  • The parameter specifies the path to the existing system. system_path, then the model containing it becomes the current model, and the system itself becomes the current system, which is displayed in the visual editor. Returns System. You can also pass an instance directly instead of the path. Model or System.

Arguments

  • path::String: the path to the model or system.

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily selected by the current model. The default is the current model.

  • system::System: object type System.

Examples

# open model:
s1 = engee.open("NewModel")
System(root)
engee.gcm(), engee.gcs()
(Model(
    name: NewModel
    id: 6b59d80d-8b48-419d-83e7-a90660aa1a6a
)
, System(
    name: root
    id: 69f5da6f-250d-4fa7-a25f-645bac751aea
)
)
# open system:
engee.open("AnotherModel/Subsystem-1")
System(
    name: root
    id: 69f5da6f-250d-4fa7-a25f-645bac751aea
)
engee.gcm(), engee.gcs()
(Model(
    name: AnotherModel
    id: 6b59d80d-8b48-419d-83e7-a90660aa1a6a
)
, System(
    name: Subsystem-1
    id: 69f5da6f-250d-4fa7-a25f-645bac751aea
)
)
engee.pause()

Suspends the running simulation.

engee.rename_model(old_name::AbstractString, new_name::AbstractString)

Renames the model. Changes the name of the model from old_name on new_name.

Arguments

  • old_name::AbstractString: the current name of the model.

  • new_name::AbstractString: the new name of the model.

Examples

# Renaming a model by name
engee.rename_model("OldModel", "NewModel")

# Checking that the model has been renamed
engee.gcm() # Now it shows the NewModel
engee.reset()

Restarts the simulation core.

Examples

engee.reset()
[ Info: Simulation kernel has been reseted.
engee.resume(; verbose::Bool = false)

Resumes the suspended simulation.

Arguments

verbose::Bool = false: enables the output of simulation progress messages.

engee.rmpath(path::String)

Removes a path from a system variable LOAD_PATH. LOAD_PATH — this is a system variable that Engee uses to find the necessary executable objects (for example .engee, .ngscript), as well as any other paths used in commands.

Arguments

path::Vararg{String}: the path in the file system to be deleted from LOAD_PATH.

Examples

engee.addpath("/user/models")

# Loading the model
engee.load("model.engee")
engee.rmpath("/user/models")

# Loading the model will return an error.
engee.load("model.engee")
engee.run(; verbose::Bool=false)
engee.run(model; verbose::Bool=false) where {model <: Union{Model, System, AbstractString}}

Starts the execution of the model. If no model is specified, it starts a simulation of the current model. If the model is not open, it throws an exception. NoModelOpenedException.

Arguments

  • verbose: the flag for printing the progress of execution (by default, it is equal to false — not displayed).

  • m::Model: the model relative to which the operation is performed. The default is the current model.

Examples

# Launching the current model
engee.run()

# Launch with progress output
engee.run(verbose=true)

# Launching a specific model
m = engee.load("/user/start/examples/power_systems/power_line_apv/power_line_apv.engee")
engee.run(m)

# Launching on the model path
engee.run("/user/my_model.engee")

# Asynchronous endless simulation
m = engee.load("/user/start/examples/controls/PID_controller/pid_controls_tf_stable.engee")
engee.set_param!(m, "end_time" => Inf)
ch = Channel(c -> put!(c, engee.run(m)))
sleep(10)
engee.stop()
take!(ch)
engee.save(model_name::String, file_path::String; force::Bool = false)
engee.save(model::Model, file_path::String; force::Bool = false)

Saves the model with the name model_name on the way file_path to a file with the extension .engee. If necessary, intermediate directories are created. Returns nothing.

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily open in the GUI.

  • model_name::String: the desired model name in the system.

  • file_path::String: the directory of the saved model.

  • force::Bool: by default is equal to false. If the file already exists and the parameter is true, then overwrites the file. If equal to false, then ends with an error FileAlreadyExists.

Examples

# Saves the newmodel_1 model to a new newmodel_1.engee file
engee.save("newmodel_1", "newmodel_1.engee")

# Saves the newmodel_1 model to the newmodel_1.engee file (overwrites the file)
engee.save("newmodel_1", "newmodel_1.engee", force = true)
engee.screenshot(to_print::Union{Model, String, System}, save_path::String; position_mode::String="auto")

Saves a screenshot of the model/system to a file along the path save_path. Supported formats: PNG, SVG. In other cases, an error is displayed. ErrorException("unsuported picture format: <format>"). Positioning: "auto", "tiled", in other cases "auto" will be applied.

Arguments

  • to_print::Union{Model, String, System}: the name of the model that the screenshot will be taken from.

  • save_path::String: the path to save the screenshot.

  • position_mode::String : positioning of the screenshot. The following modes are used: "auto" — automatically determine the optimal block location (standard mode); "tiled" — Arrange the blocks in a grid to avoid overlaps and make the structure more readable. Any other value is perceived as "auto".

Examples

engee.screenshot(loaded_model, "/user/saved.png"[; position_mode="tiled"])
engee.set_log(system_path::AbstractString, port_path::AbstractString)
engee.set_log(system::System, port_path::AbstractString)
engee.set_log(port_path::AbstractString)

Sets the port for logging.

Arguments

  • system_path::AbstractString: the path to the system where the port is located.

  • system::System: the system where the port is located.

  • port_path::AbstractString: the relative path to the port. If the system is not provided as the first parameter, then the default open system is used.

Examples

engee.set_log("Sine Wave/1")

# The port of the Sine Wave block in the current system is set to
the engee.set_log entry("newmodel_1/Subsystem","Sine Wave/1")

# The port of the Sine Wave block in the newmodel_1/Subsystem system is set to write
system = engee.gcs()
engee.set_log(system, "Sine Wave/1")

# The port of the Sine Wave block in the system is set to
engee.run()
Dict{String, DataFrames.DataFrame} with 1 entry:
 "Sine Wave.1" => 1001×2 DataFrame…
engee.set_param!(model::Model | model_name::String, param::Pair...)

Updates the parameters of the models. Returns nothing. If the parameters are incorrect, an error occurs.

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily open in the GUI. The parameters will be updated for this model.

  • model_name::String: string path or model name.

  • param::Pair...: one or more parameters in the format "name" => value. If a parameter has units of measurement, its value must be passed as a dictionary. Dict("value" => ..., "unit" => ...), where "value" — numeric value, and "unit" — a string with a unit of measurement (for example "V", "Hz", "deg", "s" and so on).

Examples

engee.set_param!(
  "my_model",
  "amplitude" => Dict("value" => 5.0, "unit" => "V"),
  "frequency" => Dict("value" => 50.0, "unit" => "Hz")
)

The example shows setting parameters with units of measurement.

engee.set_param!("model_1", "SolverName" => "ode45", "StopTime" => "10")

# Getting the parameters of the model_1 model
param_1 = engee.get_param("model_1")

# Copying the parameters from model_1 to model_2
engee.set_param!("model_2", param_1)

The example shows how to change only one parameter of the block (the amplitude), while keeping all other parameters unchanged. Use this approach when you need to modify the block settings point-by-point without risking resetting other parameters.

# Getting the current parameters of Sine Wave
sine_params = engee.get_param("newmodel_1/Sine Wave")

# We create a copy of all the parameters and change only one
modified_params = copy(sine_params)
modified_params["Amplitude"] = "2.5" # we only change the amplitude

# We apply all the parameters (the rest remain as they were)
engee.set_param!("newmodel_1/Sine Wave", pairs(modified_params)...)

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

params = engee.get_param("newmodel_1")

# The params structure is tied to a specific model, similar to engee.set_param!("newmodel_1", "FixedStep" => "0.05")
params["FixedStep"] = "0.05"
0.05

Changing the values in the dictionary params it does not update the model parameters automatically — it is a local copy. For the changes to take effect, you need to send the dictionary back using engee.set_param!.

params = engee.get_param("newmodel_1")
params["FixedStep"] = "0.05"
params["SolverName"] = "Euler"
engee.set_param!("newmodel_1", "FixedStep" => params["FixedStep"], "SolverName" => params["SolverName"])

Each parameter must be represented as a pair consisting of the parameter name and its value (for example "StartTime" => 0.0). For the parameter param:

Simulation Parameters

  • StartTime::String: the start time of the simulation (Float64).

  • StopTime::String: the end time of the simulation (Float64). To set an infinite simulation time, pass the string "Inf" or "inf" (engee.set_param!("model_name", "StopTime" => "Inf")).

  • SolverType::String: type of solver (fixed-step or variable-step).

  • SolverName::String: the name of the solver (depends on the selected type).

Parameters for fixed-step

FixedStep::String: simulation step (Float64).

Parameters for variable-step

  • AbsTol::String: absolute precision (Float64 or 'auto').

  • RelTol::String: relative precision (Float64 or 'auto').

  • InitialStep::String: initial step (Float64 or 'auto').

  • MaxStep::String: maximum step (Float64 or 'auto').

  • MinStep::String: minimum step (Float64 or 'auto').

  • OutputTimes::String: output interval (Float64 or 'auto').

  • DenseOutput::Bool: dense output of results.

engee.stop()

Stops the running simulation.

engee.unset_log(system_path::String, port_path::String)
engee.unset_log(system::System, port_path::String)
engee.unset_log(port_path::String)

Removes the port from recording.

Arguments

  • system_path::String: the system where the port is located.

  • system::System: the system where the port is located.

  • port_path::String: the relative path to the port. If the system is not provided as the first parameter, then the default open system is used.

Examples

engee.set_log("Sine Wave/1")

# The port of the Sine Wave block in the current system is set to write
engee.run()
Dict{String, DataFrames.DataFrame} with 1 entry:
 "Sine Wave.1" => 1001×2 DataFrame…

# We ran the simulation and got the results
engee.unset_log("Sine Wave/1")

# The port of the Sine Wave block in the current system has been removed from recording
engee.run()
Dict{String, DataFrames.DataFrame}()
engee.update_params()
engee.update_params(model::Model)
engee.update_params(model_name::String)

Updates the parameters of a running simulation by recalculating their current values from the workspace.

The feature allows you to dynamically apply parameter changes in the workspace to an already running simulation without having to stop and restart it. If there is no working simulation, then the function does nothing.

It can take as an optional argument the name of the model or the object of the model for which the parameter update should be applied. This functionality is equivalent to clicking the "Compile Model" button during the simulation.

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model can be active in the workspace, but not necessarily open in the GUI.

  • model_name::String: the name of the model whose parameters need to be recalculated.

Examples

# Updates the parameters of all blocks in the current simulation
engee.update_params()

# Updates the parameters of the specified model
model = engee.gcm()
engee.update_params(model)

# Updates the model parameters by name
engee.update_params("newmodel_1")
engee.version()

Returns the short version of Engee.

Examples

engee.version()
"25.11.2"
engee.warning(warning_message::String)

Sends a warning message to the model diagnostics window. The function is called only inside block callbacks (including masked ones). In messages, you can refer to the names of the parameters in the workspace (in the variables window) via $имя_параметра.

Arguments

warning_message::String: the transmitted message is a warning.

Examples

# Example without reference to workspace settings
engee.warning("Параметры округлены, результаты могут быть неточными!")

# A message in the diagnostic window:
# The parameters are rounded, the results may be inaccurate!

# An example with a link to the workspace settings
engee.warning("Параметры округлены до $Nd и $Ns, результаты могут быть неточными!")

# A message in the diagnostic window:
# The parameters are rounded to 1.7 and 1.3, the results may be inaccurate!

Finite state machine methods

engee.sm.add_data(chart_path, scope, name; value, idx)::Nothing

Adds a variable or event to the Chart block (state machine).

Arguments

  • chart_path::String: the path to the Chart block.

  • scope::Symbol: type of event/data. Can take values of: :input

    :output

    :local

    :event.

  • name::String: the name of the variable.

  • value::Any: the value of the variable. Missing by default.

  • idx::Int: serial number of the port. Relevant for type variables :input and :output.

engee.sm.add_junction(path; type)::Tuple{UUID, String, String}

Creating a node and a memory node inside the Chart block (state machine). The degree of nesting is determined by the parameter path. Returns Tuple containing UUID node, node type, and the path to it.

Arguments

  • path::String: the path to the state or the path to the Chart block to which the new node is being added.

  • type::String: node type: "history" (for the memory node)

    nothing.

Examples

# Creating a regular node in the Chart
junction_id, junction_type, junction_path = engee.sm.add_junction("newmodel_1/Chart")

# Creating a memory node
junction_id, junction_type, junction_path = engee.sm.add_junction(
  "newmodel_1/Chart",
  type="history"
engee.sm.add_state(path, name; content)::Tuple{UUID, String, String}

Creates a state inside the Chart block (state machine). The degree of nesting is determined by the parameter path. Returns Tuple containing UUID states, the name of the state, and the path to it.

Arguments

  • path::String: the path to the parent state or to the Chart block to which the new state is added.

  • name::String: the name of the new state.

  • content::String: the entire status code, the code may contain the following sections:

  • entry: code for the section entry, executed at the moment of transition to the state;

  • during: code for the section during, executed at the moment of state activity;

  • exit: code for the section exit, executed at the time of exiting the state.

Examples

# Creating a simple state in the Chart
state_id, state_name, state_path = engee.sm.add_state("newmodel_1/Chart", "State1")
(Base.UUID("a511fb4d-44cc-45dc-bfb0-74f6f9791239"), "State1", "newmodel_1/Chart/State1")

# Creating a state with a code
state_id, state_name, state_path = engee.sm.add_state(
   "newmodel_1/Chart",
   "ActiveState",
   content="""
   entry:
     disp('Вход в активное состояние');
   during:
     counter = counter + 1;
   exit:
     disp('Выход из активного состояния');
   """
)
(Base.UUID("6c8d02d4-da4a-4393-9458-ac381a627520"), "ActiveState", "newmodel_1/Chart/ActiveState")
engee.sm.add_transition(chart_path, source, destination)::Tuple{UUID, String}

Creates a transition inside the Chart block (state machine). Returns Tuple containing UUID the transition and the path to the system in which it is contained.

Arguments

  • chart_path::String: the path to the Chart block.

  • source::Maybe{String}: the path to the state of the source object.

  • destination_id::UUID: The UUID of the target state/node.

  • trigger::Maybe{String}: a trigger for code execution.

  • action::Maybe{String}: the code executed when the condition is met in condition.

  • condition::Maybe{String}: a condition for code execution.

  • content::Maybe{String}: the entire transition code (including the condition - condition, trigger, action).

  • origin::Maybe{String}: default position of the transition starting point (whether the starting point belongs to any state or global state).