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; kwargs...)::String

engee.add_block(
    lib_block_path::String,
    tgt_block_path::String;
    top::Union{Int, Missing} = missing,
    left::Union{Int, Missing} = missing,
    width::Union{Int, Missing} = missing,
    height::Union{Int, Missing} = missing,
    rotation::Union{Int, Missing} = missing,
    is_flipped::Union{Bool, Missing} = missing,
    colors::Union{BlockColors, Missing} = missing,
    annotation::Union{Maybe{String}, Missing} = missing,
    is_name_visible::Union{Maybe{Bool}, Missing} = missing,
)::String

Adds a block from the library. Returns the path to the added block.

When adding a block, you can specify its visual properties. Properties that are not specified take their default values.

Arguments

  • lib_block_path::String: path to the block in the library (begins with /).

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

  • top::Union{Int, Missing}: the top coordinate of the block.

  • left::Union{Int, Missing}: left coordinate of the block.

  • width::Union{Int, Missing}: the width of the block.

  • height::Union{Int, Missing}: block height.

  • rotation::Union{Int, Missing}: block rotation angle.

  • is_flipped::Union{Bool, Missing}: block mirroring flag.

  • colors::Union{BlockColors, Missing}: block colour properties.

  • annotation::Union{Maybe{String}, Missing}: block annotation.

  • is_name_visible::Union{Maybe{Bool}, Missing}: flag to display the block 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")

# Adding a block with visual properties specified
engee.add_block(
    "/Basic/Sinks/Terminator",
    engee.gcm().name * '/';
	# the block will be added at point (50, 50) with dimensions (100, 100)
	top = 50,
	left = 50,
	width = 100,
	height = 100,
)
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 stream) between blocks. Two methods of specifying ports are supported:

  • Via string paths to ports: "block_path/idx" or "block_path/port_name", where block_path is the block’s path relative to the selected system. If the system is not passed as a separate argument, the current system is used.;

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

A port handle (PortHandle) is an object that uniquely identifies a specific block port within model. It does not contain a signal value, but serves as a ‘handle’ for software operations on the ports — it can be to engee.add_line, engee.delete_line, engee.get_lines and other functions.

Features of physical modelling (acausal)

In Engee physical modelling blocks, ports are undirected (acausal). This imposes the following characteristics on the handling of connections:

  • A connection between PortHandle{ACAUSAL} does not specify the direction of data flow, but simply links two physical nodes;

  • A single undirected port may have multiple connections (multiple lines);

  • Connections between blocks are represented by separate objects Line.

Therefore, a step-by-step approach is used when analysing or modifying the model:

  • Obtain the block port using engee.get_ports;

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

  • Retrieve adjacent ports from the Line objects (source and destination);

  • Perform a reconnection using engee.add_line.

Arguments

Line variants:

  • system::System: an object of type System;

  • system_path::AbstractString: path to the system;

  • src_path::AbstractString: relative path to out (output) port or an undirected (acausal) port of the block. Entry format — "system_name/block_name/idx" or "system_name/block_name/port_name";

  • dst_path::AbstractString: relative path to in (input) port or an undirected (acausal) port of the block. The entry format is "system_name/block_name/idx" or "system_name/block_name/port_name".

Variants with port descriptors:

  • src::PortHandle{OUT}, dst::PortHandle{IN} — descriptors for directed source and destination ports;

  • src::PortHandle{IN}, dst::PortHandle{OUT} — reverse direction (where, according to the diagram, the source is the block with the input port);

  • src::PortHandle{ACAUSAL}, dst::PortHandle{ACAUSAL} — descriptors of undirected ports.

Examples

Lines:

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

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

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

# Port names can be used instead of indices
engee.add_line("model", "Resistor/p", "Resistor-1/n")

Descriptors:

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

# Retrieve the block ports
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")

# Connect the output Sine Wave to the first input Add_block
engee.add_line(src_ports.outputs[1], add_ports.inputs[1])

# Connect the output Add_block to the input Terminator
engee.add_line(add_ports.outputs[1], dst_ports.inputs[1])

In physical modelling (acausal), a port may have several connections, so it is not possible to use only source or destination directly. In such cases, a step-by-step approach is used along the chain: port → line → neighbouring port:

  • Retrieve the block port using engee.get_ports;

  • Retrieve the line or lines connected to this port using engee.get_lines;

  • From the object Line, retrieve the adjacent port (line.source or line.destination);

  • We perform the reconnection using engee.add_line.

Below is an example of a physical block replacement with connection restoration, carried out using this sequence.

# Obtain the input port of the block PID Controller named "in". This is the receiver port
pid_input_port = engee.get_ports("newmodel_1/PID Controller").inputs["in"]

# Obtain the connection line corresponding to this port
pid_input_line = engee.get_lines(pid_input_port)

# We obtain the source port for this line
pid_source_port = pid_input_line[1].source

# We obtain the input port of the new block PID Controller named “in ”. This is the sink port
new_pid_input_port = engee.get_ports("newmodel_1/PID Controller New").inputs["in"]

# We connect the source port to the sink port
engee.add_line(pid_source_port, new_pid_input_port)

# Create the output port PID Controller
pid_output_port = engee.get_ports("newmodel_1/PID Controller").outputs["out"]

# Create a connection line for this port
pid_output_line = engee.get_lines(pid_output_port)

# Create a receiver port for this line
pid_dest_port = pid_output_line[1].destination

# Delete the old block PID Controller
engee.delete_block("newmodel_1/PID Controller")

# Retrieve the output port of the new block PID Controller
new_pid_output_port = engee.get_ports("newmodel_1/PID Controller New").outputs["out"]

# Connect the output port of the new block PID Controller to the old receiver port
engee.add_line(new_pid_output_port, pid_dest_port)

# Optionally, perform automatic model formatting
engee.arrange_system(engee.gcs())
engee.addpath(path::Vararg{String})

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

Arguments

path::Vararg{String}: one or more file system paths (absolute or relative).

Examples

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

Reorganises the layout of blocks and connections in the specified model, automatically arranging elements to minimise line crossings and make the model structure more readable. This function is equivalent to the ‘Organise Model’ context menu command on the Engee canvas. Reorganisation is performed only for the specified model (without recursively modifying nested subsystems).

Arguments

system::System: the system (model) object for which automatic reordering is to be performed. Can be obtained using engee.gcs().

Examples

# Sorting the currently open model
engee.arrange_system(engee.gcs())
engee.clear()

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

engee.clear_all()

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

engee.clear_port(port_path::AbstractString)

Deletes all lines associated with the specified port. When using a port index instead of a name, the port is searched for amongst the block’s output ports.

Examples

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 named model_name. The model open to the left in the model navigation pane becomes the current model. If no model is specified, it closes the current model. If no current model is specified, does nothing. If the model no longer exists, does nothing.

Arguments

  • model_name::String: the name of the model to be closed.

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

  • force::Bool: by default, this is equal to false. If there are unsaved changes and the parameter is set to false, the operation will terminate with an error. If it is set to true, any unsaved changes will be lost.

Examples

# Unload the model from memory newmodel_1
engee.close("newmodel_1")

# Unload the model newmodel_1 from memory without saving the latest changes
engee.close("newmodel_1", force=true)

# Close the model newmodel_1 (unload and remove from the canvas)
engee.close("newmodel_1", force=true)
engee.close_all()

Closes all models.

Examples

# Unload from memory and close all open models
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: an absolute or relative path to the first model to be compared.

  • model_path_2::String: the absolute or relative path to the second model to be compared 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 (an Engee script) to construct the current model using programming commands. When the script is run, the model is created in non-interactive mode and is not displayed on the canvas. If an error occurs whilst creating the model, you must execute the command engee.close(...) to rerun the script.

Arguments

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

  • out_path::String: the path where the generated script is to be saved.

    • If out_path is not specified or is equal to "", the function returns the generated script as a string and does not save it to a file.

    • If out_path is specified, the script is saved to the specified path and the function returns nothing. For subsequent execution in Julia, the .jl extension is recommended.

Examples

# Save the script to a file (absolute path)
model_path = "/user/newmodel_1.engee"
engee.convert_model(model_path, "/user/newmodel_1.jl")

# Save the script to a file (relative path)
engee.convert_model("newmodel_2.engee", "newmodel_2.jl")

# Retrieve the script as a string (without saving to a file)
script = engee.convert_model("/user/newmodel_1.engee")
engee.convert_unit(value::T, from::String, to::Maybe{String})::Real where T<:Real

Converts value to other units of measurement: from from to to. If to is equal to nothing, it converts to SI units.

Examples

engee.convert_unit(17, "km", "m")
engee.copy_block(src_path::AbstractString, dst_path::AbstractString; duplicate::Bool=false)::Nothing

Copies a block from the system.

If duplicate=true and src_path point to the block Inport, the function creates a duplicate of the input port (Inport Shadow): the duplicate is assigned the same input port number as the originalInport, and allows the signal from the input to be split without creating a new subsystem input port.

Arguments

  • src_path::AbstractString: path to the block in the model hierarchy (e.g. "model/system/block" or "model/block" for the root folder).

  • dst_path::AbstractString: path to the system and expected name. The record format is path/to/system/new_block_name. If no name is specified, it is assigned automatically.

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

Examples

# Add the block Add-3 from the template newmodel_1 and automatically assign it the name newmodel_2in the template
engee.copy_block("newmodel_1/Add-3", "newmodel_2/")

# Add a block from the model newmodel_1 named Custom Block Name to the model nemodel_2 under the name 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 not permitted.

Arguments

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

  • dst_path::AbstractString: path to the system to which the data is being copied.

Examples

# Copy the contents from the root (root) system newmodel_1 to the root system newmodel_2
engee.copy_contents("newmodel_1", "newmodel_2")

# Copy the contents from the subsystem "newmodel_1/Subsystem" to the 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 default parameters. Returns Model. The model becomes the current model. Its root system becomes the current system. If a model with that name already exists, the operation terminates with the error EngeeException.

Arguments

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

Examples

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

Removes the block, all associated lines and recorded ports from the system.

Arguments

block_path::String: path to the block.

Examples

#
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 contents are to be deleted.

Examples

# Delete the block Subsystem newmodel_1 and all associated lines and blocks from the system
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 ways to specify a connection to be deleted:

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

  • By line object Line, obtained via engee.get_lines;

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

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

The removal methods via Line and PortHandle{ACAUSAL} also apply to undirected (acausal, physical) links.

Arguments

String options:

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

  • src_path::AbstractString: relative path to the out (output) port of the block. The port’s ordinal number is used as its name. Record format — "system_name/block_name/idx";

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

Variants with Line objects and port descriptors:

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

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

  • src::PortHandle{IN}, dst::PortHandle{OUT} — reverse direction (where, for the purposes of this context, the source

is the block with the input port);

  • src::PortHandle{ACAUSAL}, dst::PortHandle{ACAUSAL} — descriptors of undirected ports.

Examples

# Delete all blocks from the subsystem Sine-1 in the model Wave
newmodel_1
engee.delete_line("newmodel_1", "Sine Wave/1", "Terminator/1")
system = engee.gcs()
engee.delete_line(system, "Sine Wave-1/1", "Terminator-1/1")

# Remove the connection between the first input port of the block __CODE_COMMENT_0__ __CODE_COMMENT_1__ and the first output port of the block __CODE_COMMENT_2__ in the model
engee.delete_line("Sine Wave-2/1", "Terminator-2/1")

# Deletion without specifying a system. By default, this is applied to the current system
src_ports = engee.get_ports("newmodel_1/Sine Wave")
dst_ports = engee.get_ports("newmodel_1/Terminator")

# An example of working with port descriptors (Sine), assuming that the blocks are already connected via Wave.Terminator, as in the example for __CODE_COMMENT_3__
engee.delete_line(src_ports.outputs[1], dst_ports.inputs[1])

# We remove the line between the first output __CODE_COMMENT_0__ __CODE_COMMENT_1__ and the first input __CODE_COMMENT_2__

# Example of removing all lines connected to a block
all_block_lines = engee.get_lines("newmodel_1/Add_block")

# Retrieve all lines connected to a block Line
for ln in all_block_lines
    engee.delete_line(ln)
end

# Remove all these lines by object __CODE_COMMENT_0__
engee.delete_line.(engee.get_lines("newmodel_1/Add_block"))
engee.eval(code::AbstractString)

Executes Julia code in the current model context.

Arguments

code::AbstractString: a line of Julia code to be executed.

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 entities found.

Arguments

  • path::String: the path to the entity in which the search will be performed.

  • depth::Int=typemax(Int): maximum search depth (inclusive). To perform an unrestricted search, use typemax(Int). Numbering starts at 0. The default value is typemax(Int).

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

Examples

# Equivalent notation using dot notation
engee.find_system("newmodel_1")

# List of entities comprising the model named newmodel_1 (subsystems, blocks)
engee.find_system("newmodel_1"; depth=0)

# List of entities in the model Value without entering subsystems
engee.find_system("newmodel_1"; 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 entities found.

Arguments

  • depth::Int=typemax(Int): maximum search depth (inclusive). Use typemax(Int) for an unrestricted search. Numbering starts at 0. The default is typemax(Int).

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

Examples

# List of all blocks with the field __CODE_COMMENT_0__ set to 1.0 in the model __CODE_COMMENT_1__
engee.find_system()

# List of all entities
engee.find_system(; depth=0)

# List of model entities without delving into subsystems
engee.find_system(; 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 type System. Returns the paths to the entities found.

Arguments

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

  • depth::Int=typemax(Int): maximum search depth (inclusive). To search without restrictions, use typemax(Int). Numbering starts at 0. The default is typemax(Int).

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

Examples

# List of all blocks with the ‘ system ’ field set to 1.0
engee.find_system(system)

# List of entities comprising the system system (subsystems, blocks)
engee.find_system(system; depth=0)

# List of entities in the system Value without entering subsystems
engee.find_system(system; 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 type Model. Returns the paths to the entities found.

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model may be active in the workspace, but need not necessarily be open in the graphical interface. The search will be carried out within this model.

  • depth::Int=typemax(Int): maximum search depth (inclusive). To search without restrictions, use typemax(Int). Numbering starts at 0. The default is typemax(Int).

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

Examples

# List of all blocks with the field model set to 1.0 in the system __CODE_COMMENT_1__
engee.find_system(model)

# List of entities comprising the model model (subsystems, blocks)
engee.find_system(model; depth=0)

# List of entities in the model Value without delving into subsystems
engee.find_system(model; blockparams=["Value"=>1.0])
engee.get_current_block()::String
engee.gcb()::String

Returns the path to the current block. If the current block or model does not exist, an error is returned Current block is not set.

Examples

# List of all blocks with the field Sine set to 1.0 in the model Wave
engee.gcb()
"newmodel_1/Sine Wave"
engee.get_current_model()::Model
engee.gcm()::Model

Returns the current model. If there is no current model, an error is returned 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, an error is returned 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 customise the output code (including the main function).

For models

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

  • The target for code generation can be specified via the parameter target, as well as the path to a user-defined template via template_path.

Arguments

  • model_path::String: an absolute or relative path to the model from which the code is generated. The argument may be a model object (an object of type model, returned by the function engee.gcm).

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

  • template_path::String: the path to the .jltemplate file (e.g. the function template main).

  • target::String: specification of the language for code generation. Supported languages are C (by default), Verilog or Promela.

Examples

# The block __CODE_COMMENT_0__ __CODE_COMMENT_1__ is highlighted on the canvas
engee.generate_code("newmodel_1.engee", "newmodel_1/codegen_output")

# Generation of C code for the model
engee.generate_code("newmodel_1.engee", "newmodel_1/verilog_output", target="verilog")

#  main code generation; the file __CODE_COMMENT_1__ will be created.__CODE_COMMENT_2__ with __CODE_COMMENT_3__ code
engee.generate_code("codegen_model.engee", "codegen_dir", template_path="/user/main_template.jl")

# Code generation using a template containing the function __CODE_COMMENT_0__
m = engee.gcm()
engee.generate_code(m, "/user/newmodel_1/codegen_output")

For subsystems

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

  • The remaining parameters are the same as for full-model generation.

Arguments

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

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

  • target::String: specifies the language for code generation. Supported languages are Si (default) or Verilog.

Examples

# Retrieving the currently open model and generating code from it
engee.generate_code("newmodel_1.engee", "newmodel_1/Subsystem", subsystem_name="Subsystem")

# Generating C code for a subsystem by name
engee.generate_code("/user/newmodel_1.engee", "/user/newmodel_1/Subsystem"; subsystem_id = "88275e0b-a049-4bb5-b8c7-057badd1b536")

# Generating code for an atomic subsystem based on its Verilog
engee.generate_code("newmodel_1.engee", "newmodel_1/verilog_pid", subsystem_name="SubSystem", target="verilog")

# Generating Promela code for a subsystem; the file Subsystem will be created.__CODE_COMMENT_2__ with __CODE_COMMENT_3__ subsystem code
engee.generate_code("newmodel_1.engee", "newmodel_1/Subsystem", subsystem_name="Subsystem", target="promela")
engee.get_all_models(; sorted=true)::Vector{Model}

Returns a list of all models open in the current session, in the format Vector{Model}. If the parameter is sorted=true, it returns a list of models sorted by name.

Arguments

sorted::Bool: the default is true. Specifies whether the list of models should be sorted by name.

Examples

# Generating code __CODE_COMMENT_0__ for the subsystem “__CODE_COMMENT_1__ ” will create the file
models_list = engee.get_all_models()

# List 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 the current block or model does not exist, an error is returned Current block is not set.

Examples

# The block Sine Wave 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, an error is returned 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, an error is returned 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 (Line) connected to the block or a specific port. Returns Vector{Line} — a vector of Line objects, each of which describes a single connection between two ports.

Line is an object describing a single connection in a diagram:

  • id::UUID — the line identifier;

  • source::PortHandle — source port;

  • destination::PortHandle — destination port.

The object Line can, for example, be passed to engee.delete_line(line::Line) to remove the connection.

The function engee.get_lines(...) always returns a vector of lines (Vector{Line}), even if there is only one line. This is important for undirected (acausal) physical modelling ports, where a single port may have multiple connections.

Arguments

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

  • causality::PortCausality: the type of ports for which lines are to be retrieved. The following enumeration values are supported: PortCausality:

    • IN — lines connected to the block’s input ports;

    • OUT — lines connected to the output ports;

    • ACAUSAL — lines connected to undirected 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")

# Connect Sine Wave -&gt; Add_block -&gt; 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 block Add_block
all_add_lines = engee.get_lines("newmodel_1/Add_block")

# Only lines to the block’s output ports Sine Wave
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)

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

Retrieving neighbouring 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 messages from the log associated with the model. If the model is not open, it returns an error No opened model. Returns an array containing the messages.

Arguments

m::Model: the model on which the operation is performed; by default, this 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 a model name is specified but no parameter name is given, returns the simulation settings for the selected model as a dictionary.

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

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model may be active in the workspace, but need not necessarily be open in the graphical interface. Parameters will be extracted from this model.

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

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

For blocks

  • Returns either the parameter value (if specified) or a dictionary of parameters based on the path to the block.

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

Arguments

  • block::Block: the block object from which the parameters are to be extracted.

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

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

Examples

# List of the names of all open models
m = engee.gcm()
params = engee.get_param(m)
engee.get_ports(block_path::AbstractString)::BlockPorts

Returns a structure BlockPorts containing the port descriptors for the specified block.

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

The descriptor is not a signal value, but serves as a pointer to the port, which 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 is a ‘handle’ for software-based port management in Engee models.

Arguments

block_path::AbstractString: path to the block within the model hierarchy. The record format is "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}} — undirected ports.

Ports are accessible both by index (ports.outputs[1]) and by port name (ports.outputs["main_out"]).

Physical modelling

For physical modelling blocks, undirected ports are located in the ports.acausal dictionary. The names of these 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")

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

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

# Block ports Add_block are also accessible by index
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]

# Retrieving block ports with named ports (ports must be named beforehand)
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)

Retrieving the undirected 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 latest model simulation as a dictionary Dict{String, DataFrame}, where the key is the name of the port being tracked. If the model is not open, an error is displayed NoModelOpenedException. If the simulation has not been started, an error is returned ModelIsNotRunningException.

Arguments

model::Model: a model object that can be loaded into memory using the function engee.gcm. This model may be active in the workspace, but need not necessarily be open in the graphical interface. The operation to retrieve the results of the latest 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 type SimulationStatus. Returns one of the model’s simulation statuses:

  • NOT_READY;

  • READY;

  • BUILDING;

  • RUNNING;

  • PAUSED;

  • STARTED;

  • ERROR;

  • STOPPED;

  • DONE.

Arguments

  • model_name::String: the name of the model for which the status is to be retrieved.

  • model::Model: a model object of type Model for which you wish to retrieve the status.

Examples

engee> engee.get_status()
READY
engee.get_view(block_path::AbstractString)::Maybe{BlockView}

Returns the visual properties of the block. If the block lacks the view field, the function returns nothing.

Arguments

  • block_path::AbstractString: a string path to the block.

Examples

view = engee.get_view("model/system/Myblock")
view.colors = BlockColors(;
	border = Color("#352A87")
)
view.width = 150
view.height = 90
engee.info(info_message::String)

Sends an information message to the model diagnostics window. The function is called only within block callbacks (including masked ones). Messages may refer to parameter names in the workspace (in the variables window) via $parameter_name.

Arguments

info_message::String: the message being transmitted.

Examples

# Retrieving the dictionary of all model parameters
engee.info("Модель успешно инициализирована!")

# Example without a reference to workspace parameters
# Message in the diagnostics window:

# The model has been successfully initialised!
engee.info("Модель успешно инициализирована с параметрами $Kp и $Ki!")

# Example with a reference to workspace parameters
# Message in the diagnostics window:
engee.is_dirty(model::Model)::Bool
engee.is_dirty(model_name::String)::Bool

Checks whether there are any unsaved changes to the model. Returns true if there are unsaved changes, otherwise false. If the model is already closed, it returns false. For a recently opened model, it may return true if the model was opened from a file of an older version (the model will be updated upon saving).

Arguments

  • model::Model: a model object that can be loaded into memory using the function engee.gcm. This model may be active in the workspace, but is not necessarily selected as 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 a model from a file with the extension .engee, located at the path file_path. Returns an object Model. The loaded model becomes the current model, and its root system becomes the current system.

Features

  • The identifier for a ‘previously loaded’ model within a session is the model’s name (either read from a file or specified via name).

  • If a model with that name has already been loaded:

    • When force=false (by default), the function retrieves the model from memory and does not re-read the file from the specified path (including if file_path points to a different file or directory, but the model name matches);

    • When force=true is specified, the file at the specified path is forcibly reloaded; any unsaved changes to the current model with that name will be lost.

  • To load multiple files that contain the same model name, specify a unique name (otherwise, the model already open in memory will be used).

  • For batch processing (converting/saving multiple models), it is recommended either to call engee.load(...; force=true) each time a model is opened, or to close the model after saving (for example, engee.close(...)/engee.close()), so as not to leave it in memory between iterations.

  • If the file does not exist or has a different extension, an exception will be thrown.

Arguments

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

  • name::Maybe{String}: the name under which the model will be loaded into the current session. If not specified, the name saved in the file is used.

  • force::Bool: forced loading flag.

    • false — if a model with this name has already been loaded, an instance is returned from memory (the file is not re-read);

    • true — forces the model to be loaded from the file at the specified path, even if a model with that name has already been loaded (unsaved changes will be lost).

Examples

# Normal loading (force = false by default)
engee.load("NewModel.engee")
Model(
        name: NewModel
        id: 6b59d80d-8b48-419d-83e7-a90660aa1a6a
)

# Reload the same model when  force=false
# (if a model named  NewModel  is already open, the same one will be retrieved from memory)
engee.load("NewModel.engee"; force = false)
Model(
        name: NewModel
        id: 6b59d80d-8b48-419d-83e7-a90660aa1a6a
)

# Force a reload from the file at the specified path ( force=true )
# The model will be reloaded from the file. Any unsaved changes to the current model will be lost.
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. This function is called only within block callbacks (including masked ones). Messages may refer to parameter names in the workspace (in the variables window) via $parameter_name.

Arguments

message::String: text message to be logged.

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. Allows you to obtain internal information about the problem size, outputs and state derivatives, and is used in internal algorithms (operating point search, linearisation). It is not intended for step-by-step debugging and does not replace the public method engee.run.

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

Arguments

  • model_name::String: model name.

  • t::Union{Float64, Nothing}: simulation time. Used for phases :outputs and :derivatives. For phase :sizes, it may be nothing and is ignored.

  • x::Union{Vector{Float64}, Float64, Nothing}: a vector or scalar representing the model’s states. For models without states, this may be nothing. For the :sizes phase, this is ignored.

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

  • phase::Symbol: simulation phase. Supported values:

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

    • :outputs: calculation of the model outputs for the given t, x, u;

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

Return values

Depending on the value of phase, the function’s behaviour will change as follows:

  • phase == :sizes

    • A tuple is returned:

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

        • sys[1] — the number of continuous states;

        • sys[2] — number of discrete states;

        • sys[3] — number of model outputs;

        • sys[4] — number of model inputs;

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

      • blks — the names of the blocks containing states.

      • x0 — initial values of the model’s states. If the model does not contain any blocks with states, nothing is returned.

  • phase == :outputs

    • The following is returned:

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

      • If the model contains no output ports, nothing is returned.

      • The elements of the vector y are ordered according to the full names of the output blocks.

  • phase == :derivatives

    • Returns:

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

      • If the model does not contain continuous states, nothing is returned.

      • The elements of the vector dx 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;

  • Models with atomic subsystems (Atomic Subsystem);

  • Models that include reference models.

The function does not support models containing:

  • Conditionally executable subsystems (enabled, triggered);

  • Subsystems with an Action Port block;

  • Engee Function blocks;

  • Blocks C Function;

  • Blocks Chart;

  • Blocks Bus Creator, Bus Selector, Bus Assignment;

  • Physical modelling blocks.

Errors

Errors may be generated if the call conditions are not met:

  • 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

# Defining model parameters
sys, blks, 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)

# Calculating state derivatives
t = 0.0
x = [0.0; 1.0; 1.0]
u = [2.0]

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

Returns the open system System. If the model or system does not exist, an error is returned EngeeException.

Features

  • If the parameter specifies the name model_name of a previously opened model, that model becomes the current model. Its root system becomes the current system.

  • If the parameter specifies the path to an 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. Alternatively, instead of a path, you can pass an instance of Model or System directly.

Arguments

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

  • model::Model: a model object that can be loaded into memory using the engee.gcm function. This model may be active in the workspace, but need not be the currently selected model. By default, it is the current model.

  • system::System: an object of 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()

Pauses a running simulation.

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

Renames the model. Changes the model name from old_name to new_name.

Arguments

  • old_name::AbstractString: current model name.

  • new_name::AbstractString: new model name.

Examples

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

# Checking that the model has been renamed
engee.gcm()  # It now displays NewModel
engee.reset()

Restarts the simulation core.

Examples

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

Resumes a paused simulation.

Arguments

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

engee.rmpath(path::String)

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

Arguments

path::Vararg{String}: the file system path that must be removed from LOAD_PATH.

Examples

engee.addpath("/user/models")

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

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

Runs the model. If no model is specified, it runs a simulation of the current model. If no model is open, throws an exception NoModelOpenedException.

Arguments

  • verbose: flag to print execution progress (by default set to false — not printed).

  • m::Model: the model on which the operation is performed. By default, this is the current model.

Examples

# Running the current model
engee.run()

# Running with progress display
engee.run(verbose=true)

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

# Asynchronous infinite simulation
m = engee.load("/user/start/examples/controls/PID_controller/pid_controls_tf_stable.engee")
engee.set_param!(m, "StopTime" => 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 named model_name at the path 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 may be active in the workspace, but need not necessarily be open in the graphical user interface.

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

  • file_path::String: the directory where the model is to be saved.

  • force::Bool: by default, this is equal to false. If the file already exists and the parameter is set to true, the file is overwritten. If it is set to false, the operation terminates with error FileAlreadyExists.

Examples

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

# Save the model newmodel_1 to the file newmodel_1.engee (rewrites 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 at the path save_path. Supported formats: PNG, SVG. In other cases, the error ErrorException("unsuported picture format: <FORMAT>") is displayed. Positioning: ‘auto’, ‘tiled’; in other cases, ‘auto’ is used.

Arguments

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

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

  • position_mode::String : screenshot positioning. The following modes are available: "auto" — automatically determine the optimal layout of blocks (default mode); "tiled" — arrange blocks in a grid to avoid overlaps and make the structure more readable. Any other value is treated 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 in which the port is located.

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

Examples

# Block port Sine Wave in the current system is set to write
engee.set_log("Sine Wave/1")

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

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

# We run the simulation and obtain the results
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 model parameters. 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 may be active in the workspace, but need not necessarily be open in the graphical interface. The parameters will be updated for this model.

  • model_name::String: a 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" is the numerical value, and "unit" is a string containing the 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")
)

This example shows how to specify parameters with units of measurement.

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

# We retrieve the model parameters model_1
param_1 = engee.get_param("model_1")

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

This example shows how to change only one block parameter (amplitude) whilst keeping all other parameters unchanged. Use this approach when you need to make precise modifications to a block’s settings without the risk of resetting other parameters.

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

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

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

The simulation settings structure is linked to a specific model — you can change the model settings directly by setting the structure’s fields, in which case:

params = engee.get_param("newmodel_1")

# The structure params is linked to a specific model, similarly to engee.set_param!("newmodel_1", "FixedStep" =&gt; "0.05")
params["FixedStep"] = "0.05"
0.05

Changing values in the dictionary params does not automatically update the model parameters — this is a local copy. For the changes to take effect, you must 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: simulation start time (Float64).

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

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

  • SolverName::String: solver name (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 size (Float64 or 'auto').

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

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

  • DenseOutput::Bool: compact output of results.

engee.set_view!(block_path::AbstractString, view::BlockView)
engee.set_view!(block_path::AbstractString; kwargs...)

engee.set_view!(
    block_path::AbstractString,
    top::Union{Int, Missing} = missing,
    left::Union{Int, Missing} = missing,
    width::Union{Int, Missing} = missing,
    height::Union{Int, Missing} = missing,
    rotation::Union{Int, Missing} = missing,
    is_flipped::Union{Bool, Missing} = missing,
    colors::Union{BlockColors, Missing} = missing,
    annotation::Union{Maybe{String}, Missing} = missing,
    is_name_visible::Union{Maybe{Bool}, Missing} = missing,
)::String

Sets or changes the visual properties of the block.

Arguments

  • block_path::AbstractString: a string path to the block.

  • view::BlockView: block visual properties object.

  • top::Union{Int, Missing}: top coordinate of the block.

  • left::Union{Int, Missing}: the left-hand coordinate of the block.

  • width::Union{Int, Missing}: block width.

  • height::Union{Int, Missing}: block height.

  • rotation::Union{Int, Missing}: block rotation angle.

  • is_flipped::Union{Bool, Missing}: block mirroring flag.

  • colors::Union{BlockColors, Missing}: block colour properties.

  • annotation::Union{Maybe{String}, Missing}: block annotation.

  • is_name_visible::Union{Maybe{Bool}, Missing}: flag for displaying the block name.

Examples

view = engee.get_view("model/system/Myblock")
view.colors = BlockColors(;
	border = Color("#352A87")
)
view.width = 150
view.height = 90

engee.set_view!("model/system/Myblock", view)
engee.set_view!("model/system/Myblock"; rotate = 90)
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 in which the port is located.

  • system::System: the system in which the port is located.

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

Examples

# The block port Sine Wave in the current system is set to write
engee.set_log("Sine Wave/1")

# We run the simulation and obtain the results
engee.run()
Dict{String, DataFrames.DataFrame} with 1 entry:
  "Sine Wave.1" => 1001×2 DataFrame…

# The port of block Sine Wave in the current system is set to ‘read-only’
engee.unset_log("Sine Wave/1")

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.

This function allows you to dynamically apply changes to parameters in the workspace to a simulation that is already running, without having to stop and restart it. If there is no running simulation, the function does nothing.

It may accept, as an optional argument, the name of the model or a model object to which the parameter update is to be applied. This functionality is equivalent to clicking the ‘Compile Model’ button whilst the simulation is running.

Arguments

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

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

Examples

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

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

# Update the parameters of a model 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 only called within block callbacks (including masked ones). Messages may refer to parameter names in the workspace (in the variables window) via $parameter_name.

Arguments

warning_message::String: the warning message being transmitted.

Examples

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

# Message in the diagnostics window:
# Parameters have been rounded; results may be inaccurate!

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

# Message in the diagnostics window:
# The parameters have been 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 (finite state machine).

Arguments

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

  • scope::Symbol : event/data type. Can take the following values: :input, :output, :local, :event.

  • name::String : variable name.

  • value::Any : variable value. Omitted by default.

  • idx::Int : port number. Applicable to variables of type :input and :output.

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

Creating a node and a memory node within a Chart block (finite state machine). The nesting level is determined by the parameter path. Returns a Tuple containing the UUID of the node, the 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 added.

  • type::String : node type: "history" (for a memory node), nothing.

Examples

# Creating a regular node in 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 within the Chart block (finite state machine). The nesting level is determined by the path parameter. Returns a Tuple containing the UUID of the state, the state name 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 being added.

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

  • content::String : the entire state code; the code may contain the following sections:

    • entry: code for the '` entry ’ section, executed when transitioning into the state;

    • during: code for the '` during ’ section, executed whilst the state is active;

    • exit: code for the section exit, executed when exiting the state.

Examples

# Creating a simple state in 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 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 within a Chart block (finite state machine). Returns Tuple containing UUID of the transition and the path to the system in which it is contained.

Arguments

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

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

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

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

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

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

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

  • origin::Maybe{String} : the default position of the transition’s start point (whether the start point belongs to a particular state or to the global state).