Engee documentation

EULER software control

This page presents all available EULER software control functions in Engee.

To work with EULER software control functions in Engee. install the hardware support package as specified in article. After installation, run:

using Main.EngeeDeviceManager.EULER_API

Next, you need to create a session object:

session = EULER_API.createSession()

All methods take the first argument session — session object.

Status codes are not sent out: if an error occurs, the method throws an exception with its description.

Main.EngeeDeviceManager.EULER_API.closeProjectMethod

EULER_API.closeProject(session) -> Nothing

Closes the current open project. Frees up project resources, but the session remains active.

An exception is thrown in case of an error.

Examples

Closing the project:

EULER_API.closeProject(session)

println("Проект закрыт")

Main.EngeeDeviceManager.EULER_API.closeSessionMethod

EULER_API.closeSession(session) -> Nothing

Ends the session with EULER. Frees up all resources, closes the solver. After calling this function, the object session invalid.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Examples

Session Termination:

EULER_API.closeSession(session)

println("Сеанс завершен")

Main.EngeeDeviceManager.EULER_API.createSessionMethod

EULER_API.createSession(euler_path::String="") -> session

Creates a session with the EULER solver. Initializes the solver core.

Returns session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession} — the session object passed to all other methods.

Arguments

  • euler_path::String: the path to the EULER executable. By default euler_path="" — auto-detection.

Examples

Creating a session:

session = EULER_API.createSession()

Main.EngeeDeviceManager.EULER_API.getCurrentTimeMethod

EULER_API.getCurrentTime(session) -> Float64

Returns the current model time in seconds.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Examples

Current model time:

t = EULER_API.getCurrentTime(session)

println("Model time: $t s")

Main.EngeeDeviceManager.EULER_API.getLastProjectMethod

EULER_API.getLastProject(session) -> String

Returns the full path to the .elr file of the latest EULER project. It is useful for restoring the state after a restart.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Main.EngeeDeviceManager.EULER_API.getRigidBodyCountMethod

EULER_API.getRigidBodyCount(session) -> Int

Returns the number of solids in the current project.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Main.EngeeDeviceManager.EULER_API.getRigidBodyPosMethod

EULER_API.getRigidBodyPos(session, index=0) -> Vector{Float64}

Returns an array of 12 elements: the coordinates of the center of mass (X, Y, Z) and a 3×3 orientation matrix (9 elements, expanded in columns).

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • index::Int64: the index of a solid; the counting of the indices begins with 0. By default 0.

Main.EngeeDeviceManager.EULER_API.getSensorUnitsMethod

EULER_API.getSensorUnits(session, name) -> String

Returns a string with measurement units of the sensor in the SI system by its name, for example, "N", "m", "m/s".

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • name::String: the name of the sensor.

Examples

Sensor reading (available only in research mode):

EULER_API.setCalcRegime(session)

sensor_val = EULER_API.getSensorValue(session, "X")

sensor_units = EULER_API.getSensorUnits(session, "X")

println("Sensor X = $sensor_val $sensor_units")

Main.EngeeDeviceManager.EULER_API.getSensorValueMethod

EULER_API.getSensorValue(session, name) -> Float64

Returns the current sensor value by name in SI units. The value corresponds to the last calculated point.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • name::String: the name of the sensor (for example, "fx_sensor", "X", "Y").

Examples

Sensor reading (available only in research mode):

EULER_API.setCalcRegime(session)

sensor_val = EULER_API.getSensorValue(session, "X")

sensor_units = EULER_API.getSensorUnits(session, "X")

println("Датчик X = $sensor_val $sensor_units")

Main.EngeeDeviceManager.EULER_API.getUserCommandsMethod

EULER_API.getUserCommands(session) -> String

Returns a string with the names of the available user commands. The commands are separated by a symbol ";". Available in any mode after opening the project.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Examples

Getting a list of available commands:

commands = EULER_API.getUserCommands(session)

println("Доступные команды: $commands")

Main.EngeeDeviceManager.EULER_API.getVersionMethod

EULER_API.getVersion(session) -> String

Returns the version of the EULER solver as a string (for example, "13.05.43").

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Examples

Solver Version:

ver = EULER_API.getVersion(session)

println("Версия ЭЙЛЕР: $ver")
EULER_API.journalLoadPoint(session, index) -> Nothing

Loads the log point by index into the current context. After downloading getSensorValue it will return sensor values for this point, not for the last calculated one.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • index::Int64: point index (the index count starts from 0).

Main.EngeeDeviceManager.EULER_API.journalSensorValuesMethod

EULER_API.journalSensorValues(session, name) -> Vector{Float64}

Returns an array of sensor values at all points in the calculation log in chronological order.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • name::String: the name of the sensor.

EULER_API.journalSize(session) -> Int

Returns the number of points saved in the calculation log. Meaning 0 corresponds to an empty magazine.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Examples

Working with the calculation log:

n_points = EULER_API.journalSize(session)

println("Точек в журнале: $n_points")



if n_points > 0

    t_last = EULER_API.journalTime(session, n_points - 1)

    println("Время последней точки: $t_last с")

end



x_vals = EULER_API.journalSensorValues(session, "X")

println("Значений датчика X: $(length(x_vals))")

Main.EngeeDeviceManager.EULER_API.journalTimeMethod

EULER_API.journalTime(session, index) -> Float64

Returns the model time in seconds for the log point by index.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • index::Int64: point index (the index count starts from 0).

Main.EngeeDeviceManager.EULER_API.openProjectMethod

EULER_API.openProject(session, path) -> String

Opens the EULER project (the .elr file). After opening, commands, sensors, and parameters are available. Returns the path to the uploaded project as a string; an exception is thrown if an error occurs.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • path::String: the full path to the .elr file.

Examples

Project opening:

project = raw"C:\Users\Public\Engee\sample_project.elr"

EULER_API.openProject(session, project)

println("Проект открыт: $project")

Main.EngeeDeviceManager.EULER_API.runAnyCommandMethod

EULER_API.runAnyCommand(session, command, step=1) -> Nothing

Runs a custom command with no time limit. The calculation is performed before the natural completion of the command. Available only in research mode.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • command::String: the name of the team.

  • step::Int64: the output step. By default 1.

Main.EngeeDeviceManager.EULER_API.runCommandMethod

EULER_API.runCommand(session, command, calc_time=10.0, step=1.0) -> Nothing

Runs a custom command with a time limit. The calculation will stop when it reaches calc_time seconds of the model time or at the end of the command, whichever comes first. Available only in research mode (setCalcRegime).

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • command::String: the name of the team (from the list getUserCommands).

  • calc_time::Float64: the maximum calculation duration in seconds of the model time. By default 10.0.

  • step::Float64: the output step for this command. By default 1.0 (each step of the integrator).

Main.EngeeDeviceManager.EULER_API.saveProjectMethod

EULER_API.saveProject(session) -> Nothing

Saves the current project. The changes are written to the original one.the elr file.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Main.EngeeDeviceManager.EULER_API.saveResultsMethod

EULER_API.saveResults(session, path) -> Nothing

Saves the calculation results to the .epp (Euler Project Package) file.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • path::String: the path to save the .epp file.

EULER_API.setCalcRegime(session) -> Nothing

Puts the project into research (calculation) mode. Commands can be run in this mode (runCommand, runAnyCommand) and sensor reading. Changing scalars is not available.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Main.EngeeDeviceManager.EULER_API.setEditRegimeMethod

EULER_API.setEditRegime(session) -> Nothing

Switches the project to editing mode. In this mode, you can change the parameters (scalars) via setScalar. The calculation launch is unavailable.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Main.EngeeDeviceManager.EULER_API.setOutputParamMethod

EULER_API.setOutputParam(session, step_out=1, time_out=0.0, before_event=false, after_event=false) -> Nothing

Adjusts the parameters for displaying the results in the calculation log.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • step_out::Int64: the output step. Each nth calculated point gets into the log. By default 1.

  • time_out::Float64: frequency of output according to the model time in seconds. By default 0.0 (disabled, only used step_out).

  • before_event::Bool: whether to save a point before the event. By default false — do not save.

  • after_event::Bool: whether to save the point after the event. By default false — do not save.

Main.EngeeDeviceManager.EULER_API.setScalarMethod

EULER_API.setScalar(session, name, value) -> Nothing

Sets the value of a scalar parameter by name. Available only in edit mode (setEditRegime).

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

  • name::String: the name of the scalar (for example, "FX", "mass").

  • value::Float64: a new scalar value.

Examples

Changing a scalar parameter (available only in edit mode):

EULER_API.setEditRegime(session)

EULER_API.setScalar(session, "mass", 2.0)

println("Scalar mass = 2.0")

Main.EngeeDeviceManager.EULER_API.startCalcMethod

EULER_API.startCalc(session) -> Nothing

Resets the model time to 0.0 (starting position) and initializes the calculation. It is called once before the first command. runCommand or runAnyCommand.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Examples

Time-limited command launch (available only in research mode):

EULER_API.setCalcRegime(session)

EULER_API.startCalc(session)

EULER_API.setOutputParam(session, 10, 0.0)

EULER_API.runCommand(session, "RK4_coarse", 15.0)

println("Расчет запущен (с ограничением 15 с)")

Running a command with no time limit (the command is executed until its natural completion.):

EULER_API.startCalc(session)

EULER_API.runAnyCommand(session, "RK4_coarse")

println("Расчет запущен (без ограничения времени)")

Main.EngeeDeviceManager.EULER_API.stopCalcMethod

EULER_API.stopCalc(session) -> Nothing

Stops the current calculation. It can be called at any time after startup. runCommand or runAnyCommand. The moment of the stop can be obtained via getCurrentTime.

An exception is thrown in case of an error.

Arguments

  • session::Tuple{Main.EngeeDeviceManager.EULER_API.EulerSession}: session object.

Examples

Stopping the calculation:

EULER_API.stopCalc(session)
stop_time = EULER_API.getCurrentTime(session)

println("The calculation is stopped. Stop time: $stop_time with")

Operating modes

After opening, the project is in editing mode — you can open/close the project, change the parameters (scalars) via setScalar. Starting the calculation in this mode is not available. To run the model, switch to research mode (setCalcRegime), after which it becomes possible to run commands (runCommand, runAnyCommand) and reading the sensors during the calculation process (getSensorValue, journalSensorValues), but changing scalars will be blocked. Switching between modes is performed via setEditRegime and setCalcRegime.

Example: simulation of a ball throw with a mass of 1 kg and a diameter of 20 cm with a visualization of the trajectory

After installation hardware support package execute:

using Main.EngeeDeviceManager
using Main.EngeeDeviceManager.EULER_API
using Main.EngeeDeviceManager.UTILS_API

Creating a session:

session = EULER_API.createSession()
ver = EULER_API.getVersion(session)
println("Версия ЭЙЛЕР: $ver")
Версия ЭЙЛЕР: Solver 13.05.43.beta Pro (Windows x64)

Uploading a test project:

engee.package.getdemos("Engee-Device-Manager")
"/user/Engee-Device-Manager-demos"

First, copy the test one.elr file from the demo folder Engee to the user’s computer via the module Utils:

# Создаем объект Utils для файловых операций
utils = UTILS_API.Utils()

# Определяем пути к демонстрационному проект ЭЙЛЕР в Engee и директории, куда будет скопирован проект
euler_local_project_path = "/user/Engee-Device-Manager-demos/example_euler/sample_project.elr"
host_project_dir = raw"C:\Users\Public\Engee"

# Создаем тестовую директорию и загружаем проект на хост
UTILS_API.createFolder(utils, host_project_dir, "")
UTILS_API.uploadFile(utils, euler_local_project_path, host_project_dir)

println("Проект загружен в $host_project_dir")
Проект загружен в C:\Users\Public\Engee

Opening the project and starting the calculation:

# Открываем проект
project_path = joinpath(host_project_dir, "sample_project.elr")
EULER_API.openProject(session, project_path)
println("Проект открыт: $project_path")

# Получаем список доступных команд
cmds = EULER_API.getUserCommands(session)
println("Доступные команды: $cmds")

# Переключаем в режим исследования проекта
EULER_API.setCalcRegime(session)
println("Режим исследования проекта")

# Настраиваем вывод каждого 10-го шага
EULER_API.setOutputParam(session, 10, 0.0)

# Запускаем расчет на 15 секунд
EULER_API.runCommand(session, "RK4_coarse", 15.0)
println("Расчет запущен")
Проект открыт: C:\Users\Public\Engee/sample_project.elr
Доступные команды: RK4_fine;RK4_coarse;
Режим исследования проекта
Расчет запущен

Getting results:

# Получаем все точки из журнала расчета
x_vals = EULER_API.journalSensorValues(session, "X")
y_vals = EULER_API.journalSensorValues(session, "Y")

n_points = length(x_vals)
println("Получено $n_points точек")

# Выводим первые и последние точки
println("Первая точка: X=$(round(x_vals[1], digits=2)) м, Y=$(round(y_vals[1], digits=2)) м")
if n_points > 1
    println("Последняя точка: X=$(round(x_vals[end], digits=2)) м, Y=$(round(y_vals[end], digits=2)) м")
end
Получено 1447 точек
Первая точка: X=0.0 м, Y=0.0 м
Последняя точка: X=1019.72 м, Y=-0.0 м

Visualization of the trajectory:

using Plots

# Получаем время каждой точки (значения датчик "t")
t_vals = EULER_API.journalSensorValues(session, "t")

# График высоты от времени
plot(t_vals, y_vals,
    xlabel = "Время, с",
    ylabel = "Высота Y, м",
    title = "Траектория броска шара
    D = 20 см
    m = 1 кг",
    legend = false,
    linewidth = 2,
    color = :blue,
    size = (600, 400)
)

hline!([0.0], color = :orange, linewidth = 1, linestyle = :dash, label = "Земля")

euler functions 1

Completion of work:

EULER_API.closeSession(session)
println("Сеанс завершен")
The session is over