Software control of RITM
|
To work with the functions of the program control of the KPM "RITM" in Engee, install the Engee subsystem.Integrations:
|
On this page all available functions of the program management of the KPM "RITM" in Engee are presented.
Methods RITM
#
EngeeDeviceManager.Targets.RITM_API.Ritm — Method
RITM_API.Ritm(url::String)
Установление адреса машины РИТМ.
Аргументы
-
url::String: Адрес машины РИТМ, например, "http://192.168.56.3:8000/".
Примеры
# Создадим объект РИТМ:
ritm = RITM_API.Ritm("http://192.168.56.3:8000/")
#
EngeeDeviceManager.Targets.RITM_API.buildModel — Function
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)
#
EngeeDeviceManager.Targets.RITM_API.disableAutostart — Method
RITM_API.disableAutostart(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}
Удаление модели из автозапуска.
Аргументы
-
ritm::Any: объект целевой платформы РИТМ.
Примеры
RITM_API.disableAutostart(ritm)
#
EngeeDeviceManager.Targets.RITM_API.getAutostart — Method
RITM_API.getAutostart(ritm)::Union{Dict{String, Union{String, Int64, Bool, Nothing}}, Nothing}
Получение модели, находящейся в автозапуске.
Аргументы
-
ritm::Any: объект целевой платформы РИТМ.
Примеры
RITM_API.getAutostart(ritm)
#
EngeeDeviceManager.Targets.RITM_API.getData — Function
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 commandsritm = Targets.RITM.Ritm()andTargets.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 (ifin_file = true). Ifin_file = false, the value is ignored. -
in_file::Bool = false: specifies how to return the result. Iftrue, the data is saved to a file byfile_path. Iffalse, 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)
#
EngeeDeviceManager.Targets.RITM_API.getData — Method
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)
#
EngeeDeviceManager.Targets.RITM_API.getDiagnostic — Method
getDiagnostic(ritm)::Nothing
Загружает диагностический архив ritm_diagnostic.zip в текущую директорию Engee.
Аргументы
-
ritm::Any: объект целевой платформы РИТМ.
Примеры
RITM_API.getDiagnostic(ritm)
#
EngeeDeviceManager.Targets.RITM_API.getFile — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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="")
#
EngeeDeviceManager.Targets.RITM_API.getLog — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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)
#
EngeeDeviceManager.Targets.RITM_API.getPtpSettings — Method
getPtpSettings(ritm) -> Vector{String}
Получает сохраненные настройки PTP. Возвращает настройки PTP — вектор строк с выбранным интерфейсом, механизмом задержки, сетевым транспортом, ролью и атрибутами PTP-часов.
Примеры
getPtpSettings(ritm)
#
EngeeDeviceManager.Targets.RITM_API.getPtpState — Method
getPtpState(ritm) -> Vector{String}
Получает состояние PTP — вектор строк, обычно с интерфейсом, ролью и состоянием. Возвращает текущее состояние PTP: запущен или остановлен, а также интерфейс и роль, если PTP запущен.
Примеры
getPtpState(ritm)
#
EngeeDeviceManager.Targets.RITM_API.getScreenshot — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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")
#
EngeeDeviceManager.Targets.RITM_API.isConnected — Method
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)
#
EngeeDeviceManager.Targets.RITM_API.isRunning — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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")
#
EngeeDeviceManager.Targets.RITM_API.listFiles — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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/")
#
EngeeDeviceManager.Targets.RITM_API.memInfo — Function
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 commandsritm = Targets.RITM.Ritm()andTargets.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")
#
EngeeDeviceManager.Targets.RITM_API.poweroff — Method
RITM_API.poweroff(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}
Выключает машину.
Аргументы
-
ritm::Any: объект целевой платформы РИТМ.
Примеры
RITM_API.poweroff(ritm)
#
EngeeDeviceManager.Targets.RITM_API.readFile — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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/")
#
EngeeDeviceManager.Targets.RITM_API.reboot — Method
RITM_API.reboot(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}
Перезагружает машину.
Аргументы
-
ritm::Any: объект целевой платформы РИТМ.
Примеры
RITM_API.reboot(ritm)
#
EngeeDeviceManager.Targets.RITM_API.removeFile — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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")
#
EngeeDeviceManager.Targets.RITM_API.resetPtpSettings — Method
resetPtpSettings(ritm) -> Dict{String, Union{String, Int64, Bool, Nothing}}
Сбрасывает сохраненные настройки PTP на РИТМе. Возвращает словарь с результатом операции: статус и сообщение об ошибке (если есть).
После сброса перед запуском PTP нужно заново настроить нужный интерфейс через setupEthPtp.
#
EngeeDeviceManager.Targets.RITM_API.runModel — Function
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)
#
EngeeDeviceManager.Targets.RITM_API.setAutostart — Method
RITM_API.setAutostart(ritm, model_name::String)::Dict{String, Union{String, Int64, Bool, Nothing}}
Помещение модели в автозапуск.
Аргументы
-
ritm::Any: объект целевой платформы РИТМ. -
model_name::String: имя модели.
Примеры
RITM_API.setAutostart(ritm)
#
EngeeDeviceManager.Targets.RITM_API.setupEthPtp — Function
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.
#
EngeeDeviceManager.Targets.RITM_API.setupEthernet — Method
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)
#
EngeeDeviceManager.Targets.RITM_API.startPtp — Method
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)
#
EngeeDeviceManager.Targets.RITM_API.stopModel — Method
RITM_API.stopModel(ritm)::Nothing
Останавливает модель на РИТМе.
Аргументы
-
ritm::Any: объект целевой платформы РИТМ.
Примеры
RITM_API.stopModel(ritm)
#
EngeeDeviceManager.Targets.RITM_API.stopPtp — Method
stopPtp(ritm, eth_number) -> Dict{String, Union{String, Int64, Bool, Nothing}}
Останавливает PTP на выбранном Ethernet-интерфейсе РИТМа. Возвращает словарь с результатом операции: статус и сообщение об ошибке (если есть).
Аргументы
-
eth_number: номер Ethernet интерфейса. Возможные значения"HostTarget"или"1"—"max ethernet number".
Примеры
stopPtp(ritm, 1)
#
EngeeDeviceManager.Targets.RITM_API.updateFirmware — Function
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")
#
EngeeDeviceManager.Targets.RITM_API.updateSupportPackage — Function
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)
#
EngeeDeviceManager.Targets.RITM_API.uploadFile — Method
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 commandsritm = Targets.RITM.Ritm()andTargets.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/")