Engee documentation

Software control of RITM

To work with the functions of the program control of the KPM "RITM" in Engee, install the Engee subsystem.Integrations:

engee.package.install("Engee-Device-Manager")

On this page all available functions of the program management of the KPM "RITM" in Engee are presented.

Methods RITM

RITM_API.Ritm(url::String)

Установление адреса машины РИТМ.

Аргументы

  • url::String: Адрес машины РИТМ, например, "http://192.168.56.3:8000/".

Примеры

# Создадим объект РИТМ:

ritm = RITM_API.Ritm("http://192.168.56.3:8000/")
buildModel(ritm, model, is_interactive_mode::Bool=false)::Nothing

Собирает и подготавливает модель для запуска на РИТМе.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

  • model::Any: структура модели.

  • is_interactive_mode::Bool: флаг, указывающий режим выполнения модели: true — модель выполняется в интерактивном режиме; false (по умолчанию) — модель выполняется в независимом режиме.

Примеры

# Собираем и запускаем на РИТМе открытую на холсте standalone-модель:

model = engee.gcm()
RITM_API.buildModel(ritm, model, false)
RITM_API.runModel(ritm, model, false)
RITM_API.disableAutostart(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}

Удаление модели из автозапуска.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

Примеры

RITM_API.disableAutostart(ritm)
RITM_API.getAutostart(ritm)::Union{Dict{String, Union{String, Int64, Bool, Nothing}}, Nothing}

Получение модели, находящейся в автозапуске.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

Примеры

RITM_API.getAutostart(ritm)
RITM_API.getData(ritm::Any, model_name::String, file_path::String, in_file::Bool = false)

Returns the result of profiling the model based on the RITM. Depending on the value in_file the result can be returned as a string or saved to a file using the specified path.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • model_name::String: the name of the model for which profiling data is requested.

  • file_path::String: the path to save the result (if in_file = true). If in_file = false, the value is ignored.

  • in_file::Bool = false: specifies how to return the result. If true, the data is saved to a file by file_path. If false, returns the result string.

Examples

# Gets the profiling data as a string
result = RITM_API.getData(ritm, "newmodel_1", "", false)

# Saves data to a file at RITM
RITM_API.getData(ritm, "newmodel_1", "/user/profile.txt", true)
RITM_API.getData(ritm::Any, model_name::String, file_path::String, in_file::Bool = false)

Возвращает результат профилирования модели на РИТМе. В зависимости от значения in_file, результат может быть возвращен как строка либо сохранен в файл по указанному пути.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

  • model_name::String: имя модели, для которой запрашиваются данные профилирования.

  • file_path::String: путь, по которому сохранить результат (если in_file = true). Если in_file = false, значение игнорируется.

  • in_file::Bool = false: указывает, как вернуть результат. Если true, данные сохраняются в файл по file_path. Если false, возвращается строка с результатом.

Примеры

# Получает данные профилирования как строку
result = RITM_API.getData(ritm, "newmodel_1", "", false)

# Сохраняет данные в файл на РИТМе
RITM_API.getData(ritm, "newmodel_1", "/user/profile.txt", true)
getDiagnostic(ritm)::Nothing

Загружает диагностический архив ritm_diagnostic.zip в текущую директорию Engee.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

Примеры

RITM_API.getDiagnostic(ritm)
RITM_API.getFile(ritm::Any, file_name::String; from=/mydir::String, to=::String)

Retrieves the specified file file_name from the directory /home/ritm/build/model_name/build/, where model_name — the name of the model in Engee.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • file_name::String: the name of the file of interest.

  • from=/mydir::String: the path to the directory with the file of interest (by default /home/ritm/build/model_name/build/).

  • to=::String: the path to the directory in Engee to save the file (by default in the current one).

Examples

RITM_API.getFile(ritm, "install_manifest.txt"; from="/home/ritm/build/newmodel_1/build/", to="")
RITM_API.getLog(ritm::Any, num::Int64)

Returns the specified number of lines of model execution logs for the RITM.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • num::Int64: the number of output lines from the logs.

Examples

RITM_API.getLog(ritm, 10)
getPtpSettings(ritm) -> Vector{String}

Получает сохраненные настройки PTP. Возвращает настройки PTP — вектор строк с выбранным интерфейсом, механизмом задержки, сетевым транспортом, ролью и атрибутами PTP-часов.

Примеры

getPtpSettings(ritm)
getPtpState(ritm) -> Vector{String}

Получает состояние PTP — вектор строк, обычно с интерфейсом, ролью и состоянием. Возвращает текущее состояние PTP: запущен или остановлен, а также интерфейс и роль, если PTP запущен.

Примеры

getPtpState(ritm)
RITM_API.getScreenshot(ritm::Any, filename::String = "screenshot.png")

Creates a screenshot on the target RITM platform, and returns the path to the saved image. The screenshot is saved in a temporary directory on the RITM machine. The name of the output file can be specified explicitly; by default, it is used "screenshot.png".

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • filename::String = "screenshot.png": the name of the file where the screenshot will be saved (on the RITM side).

Examples

# Creates a screenshot and gets the path to it
path = RITM_API.getScreenshot(ritm, "example.png")
RITM_API.isConnected(ritm::Any)

Checks the availability of the RITM.

Arguments

ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

Examples

RITM_API.isConnected(ritm)
RITM_API.isRunning(ritm::Any, model_name::String)

Checks whether the specified model is running on the target RITM platform. Returns true if the model with the specified name is currently in progress on the RITM machine, and false if it is not executed.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • model_name::String: the name of the model whose condition needs to be checked.

Examples

# Checks whether the "newmodel_1" model is running
is_active = RITM_API.isRunning(ritm, "newmodel_1")
RITM_API.listFiles(ritm::Any, path::String)

Displays a list of files in the specified directory.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • path::String: the path to the directory of interest.

Examples

RITM_API.listFiles(ritm, "/home/ritm/")
RITM_API.memInfo(ritm::Any, model::String)

Displays information about the memory consumed by the model.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • model::String: the name of the model. If left empty "", then returns the result of profiling the system in the form [total, used, free]. If you specify the model name, it returns the number of bytes of memory consumed by the model.

Examples

RITM_API.memInfo(ritm, "newmodel_1")
RITM_API.poweroff(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}

Выключает машину.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

Примеры

RITM_API.poweroff(ritm)
RITM_API.readFile(ritm::Any, file_name::String; path=/mydir::String)

Outputs the contents of the specified file file_name from the directory /home/ritm/build/model_name/build/, where model_name — the name of the model in Engee.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • file_name::String: the name of the file of interest.

  • path=/mydir::String: the path to the directory with the file of interest (by default /home/ritm/build/model_name/build/).

Examples

RITM_API.readFile(ritm, "install_manifest.txt"; path="/home/ritm/build/newmodel_1/build/")
RITM_API.reboot(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}

Перезагружает машину.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

Примеры

RITM_API.reboot(ritm)
RITM_API.removeFile(ritm::Any, path::String)::String

Deletes the file using the specified path on the target RITM platform. Returns the file deletion status from the RITM.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • path::String: the path to the file being deleted from the RITM.

Examples

using Main.EngeeDeviceManager.Targets
using Main.EngeeDeviceManager.RITM_API

# Creates the RITM object and sets the address
ritm = Targets.RITM.Ritm()
ritm.set_url("http://192.168.56.3:8000/")

# Deletes the file on RITM
status = RITM_API.removeFile(ritm, "/home/ritm/data/log.txt")
resetPtpSettings(ritm) -> Dict{String, Union{String, Int64, Bool, Nothing}}

Сбрасывает сохраненные настройки PTP на РИТМе. Возвращает словарь с результатом операции: статус и сообщение об ошибке (если есть).

После сброса перед запуском PTP нужно заново настроить нужный интерфейс через setupEthPtp.

RITM_API.runModel(
    ritm,
    model,
    is_interactive_mode::Bool=false;
    simulation_uuid=string(uuid4()),
    status_callback=(args...) -> nothing,
    termination_callback=(args...) -> nothing,
) -> Union{Channel{TargetSimulationStatus}, Nothing}

Запустить на РИТМе ранее собранную модель.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

  • model::Any: структура модели.

  • is_interactive_mode::Bool: флаг, указывающий режим выполнения модели: true — модель выполняется в интерактивном режиме; false (по умолчанию) — модель выполняется в независимом режиме.

  • simulation_uuid::String: идентификатор запуска для интерактивного режима.

  • status_callback: функция вызывается для каждого полученного статуса выполнения.

  • termination_callback: функция вызывается по завершении интерактивного выполнения.

Значение nothing используется для автономного выполнения или для канала состояния интерактивного выполнения.

Примеры

RITM_API.runModel(ritm, model)
RITM_API.setAutostart(ritm, model_name::String)::Dict{String, Union{String, Int64, Bool, Nothing}}

Помещение модели в автозапуск.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

  • model_name::String: имя модели.

Примеры

RITM_API.setAutostart(ritm)

setupEthPtp(
    ritm,
    eth_number,
    role="Master";
    delay_mech="E2E",
    network_tr="UDPv4",
    priority1=128,
    priority2=128,
    clock_class=248,
    clock_accuracy=254,
) -> Dict{String, String}

Настраивает PTP на выбранном Ethernet-интерфейсе РИТМа. Возвращает словарь с результатом операции: статус и сообщение об ошибке (если есть).

Аргументы

  • eth_number: номер Ethernet-интерфейса РИТМа, например 1 для Ethernet 1.

  • role: задает роль локальных часов PTP: "Master" или "Slave".

  • delay_mech: режим работы PTP. Возможные значения "E2E", "P2P" или "Auto". Значение по умолчанию "E2E".

  • network_tr: сетевой протокол. Возможные значения "UDPv4", "UDPv6" and "L2". Значение по умолчанию "UDPv4".

  • priority1: атрибут локальных часов "Приоритет 1". Возможный диапазон 0 до 255. Значение по умолчанию 128.

  • priority2: атрибут локальных часов "Приоритет 2". Возможный диапазон 0 до 255. Значение по умолчанию 128.

  • clock_class: атрибут локальных часов "Класс". Возможный диапазон 0 до 255. Значение по умолчанию 248.

  • clock_accuracy: атрибут локальных часов "Точность". Возможный диапазон 0 до 255. Значение по умолчанию 254.

RITM_API.setupEthernet(ritm, interface_id::Int64, ip::String, mask::Int64)::Dict{String, Union{String, Int64, Bool, Nothing}}

Настройка Ethernet-интерфейса машины.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

  • interface_id::Int64: идентификатор Ethernet-интерфейса.

  • ip::String: IP-адрес интерфейса.

  • mask::Int64: маска сети.

Примеры

RITM_API.setupEthernet(ritm, 0, "192.168.0.10", 24)
startPtp(ritm, eth_number) -> Dict{String, Union{String, Int64, Bool, Nothing}}

Запускает PTP на выбранном Ethernet-интерфейсе РИТМа. Возвращает словарь с результатом операции: статус и сообщение об ошибке (если есть).

Перед запуском PTP необходимо настроить интерфейс через setupEthPtp.

Аргументы

  • eth_number: номер Ethernet интерфейса. Возможные значения "HostTarget" или "1" — "max ethernet number".

Примеры

startPtp(ritm, 1)
RITM_API.stopModel(ritm)::Nothing

Останавливает модель на РИТМе.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

Примеры

RITM_API.stopModel(ritm)
stopPtp(ritm, eth_number) -> Dict{String, Union{String, Int64, Bool, Nothing}}

Останавливает PTP на выбранном Ethernet-интерфейсе РИТМа. Возвращает словарь с результатом операции: статус и сообщение об ошибке (если есть).

Аргументы

  • eth_number: номер Ethernet интерфейса. Возможные значения "HostTarget" или "1" — "max ethernet number".

Примеры

stopPtp(ritm, 1)

RITM_API.updateFirmware(
    ritm,
    firmware_path::String="",
    checksum_path::String="";
    reboot::Bool=true,
    show_progress=false,
)::Nothing

Обновляет прошивку РИТМ.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

  • firmware_path::String: локальный путь к файлу прошивки.

  • checksum_path::String: локальный путь к файлу контрольной суммы.

  • reboot::Bool: перезагрузка машины РИТМ после успешного обновления. Значение по умолчанию — true.

  • show_progress::Bool: вывести в лог информацию о ходе обновления.

Примеры

RITM_API.updateFirmware(ritm; show_progress=true)
RITM_API.updateFirmware(ritm, "/user/firmware.raucb", "/user/firmware.raucb.checksum")
RITM_API.updateSupportPackage(ritm, support_package_path::String=""; show_progress=false)::Nothing

Обновляет пакет поддержки РИТМ.

Если аргумент support_package_path не указан, устанавливается пакет, соответствующий текущей версии Engee. Если аргумент support_package_path задан, устанавливается пакет из указанного локального файла.

Аргументы

  • ritm::Any: объект целевой платформы РИТМ.

  • support_package_path::String: локальный путь к пакету поддержки.

  • show_progress::Bool: выводить в лог информацию о ходе выполнения обновления.

Примеры

RITM_API.updateSupportPackage(ritm)
RITM_API.updateSupportPackage(ritm, "/user/ritm_support_package.tar.gz"; show_progress=true)
RITM_API.uploadFile(ritm::Any, filename::AbstractString; from::AbstractString=pwd(), to::AbstractString="/home/ritm")::String

Uploads a file from Engee to the target RITM platform.

Arguments

  • ritm::Any: an object of the target RITM platform. It is set using consecutive commands ritm = Targets.RITM.Ritm() and Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/").

  • filename::AbstractString: the name of the file uploaded to the server.

  • from::AbstractString = pwd(): the path in Engee to the directory where the downloaded file is located (by default, the current directory).

  • to::AbstractString = "/home/ritm": the path on the RITM where the file will be uploaded (by default — /home/ritm).

Examples

using Main.EngeeDeviceManager.Targets
using Main.EngeeDeviceManager.Targets.RITM.RITM_API

# Creates a RITM object and sets the address
ritm = Targets.RITM.Ritm()
ritm.set_url("http://192.168.56.3:8000 /")

# Downloads the test file.bin from the current Engee directory (pwd()) to /home/ritm on the RITM
res = RITM_API.uploadFile(ritm, "test.bin")

# Downloads a file from the specified Engee directory (/user/...) to the specified directory on the RITM
res = RITM_API.uploadFile(ritm, "install_manifest.txt "; from="/user/project/", to="/home/ritm/data/")