An example of using software management to work with KPM "RITM"
RITM is a hardware solution for running models in real time. It allows you to integrate work scenarios with physical equipment and manage it directly from Engee.
To start working with the target RITM platform:
-
Add A RITM machine to Engee through the app RITM.Manager
. -
Install support RITM BLOCKS:
engee.package.install("RITM-Engee-Blocks") -
Install the External hardware support package:
engee.package.install("Engee-Device-Manager")For more information about the installation process, see Engee.Integrations. -
After these steps, modules for working with external equipment become available, providing software management of the target RITM platform. To connect the modules, enter the following commands:
using Main.EngeeDeviceManager.Targets using Main.EngeeDeviceManager.Targets.RITM_API -
At the last stage, create an object of the target RITM platform for interacting with devices and specify the IP address of the corresponding device.:
ritm = Targets.RITM.Ritm() ritm.set_url("http://192.168.56.3:8000/")
Basic methods of working with RITM
The following methods are available for working with RITM equipment:
-
ritm.upload_model— loads the model to the RITM. -
ritm.generate_executable_code— generates a C-binding on the rhythm. -
ritm.compile_model— builds a model based on the rhythm. -
ritm.start_model— starts the model on the rhythm. -
ritm.stop_model— stops the model on the rhythm. -
RITM_API.isConnected— checks the availability of the rhythm. -
RITM_API.isRunning— checks whether the rhythm model is running. -
RITM_API.listFiles— displays a list of files in the specified directory. -
RITM_API.readFile— outputs the contents of the specified file from the specified directory. -
RITM_API.getFile— retrieves the specified file from the specified directory. -
RITM_API.memInfo— displays information about the memory consumed by the model. -
RITM_API.getLog— returns the specified number of lines of model execution logs on the RITM. -
RITM_API.getScreenshot— creates a screenshot on the rhythm and returns the path to the image file. -
RITM_API.getData— returns the result of profiling the model based on the rhythm.
| A detailed description of each method is provided in the article. Software control of RITM. |
Step-by-step example of working with the RITM model
-
Connect modules — connect namespaces containing definitions of the target RITM platform and its API:
using Main.EngeeDeviceManager.Targets using Main.EngeeDeviceManager.Targets.RITM_API -
Create a RITM target platform object and set the URL — create an object
ritmrepresenting the target platform, and specify the IP address of the machine.:ritm = Targets.RITM.Ritm() ritm.set_url("http://192.168.56.3:8000/") -
Check the availability of RITM — check whether the connection is established with the RITM device:
RITM_API.isConnected(ritm)If the method returns
falsethen check the IP address and whether the client program is running on the server. -
The assembly is open in Engee models based on the rhythm in independent mode:
model = Engee.engee.gcm() ritm.upload_model(model) ritm.generate_executable_code(model, false) ritm.compile_model(model) -
Launch the model — launch the model on the RITM machine:
ritm.start_model(model)After launch, the model will start executing in the previously set mode (in our case, in an independent mode).
-
Stop the model — stop the execution of all running models on the RITM:
ritm.stop_model() -
Output the contents of the directory to the RITM — get a list of files in the specified directory (
/home/ritm/):RITM_API.listFiles(ritm, "/home/ritm/") -
Reading the contents of the file — output the contents of the file (install_manifest.txt ) on the specified path (
/home/ritm/build/newmodel_1/build):RITM_API.readFile(ritm, "install_manifest.txt"; path="/home/ritm/build/newmodel_1/build/") -
Getting a file to the current directory — get the specified file in Engee:
RITM_API.getFile(ritm, "install_manifest.txt"; from="/home/ritm/build/newmodel_1/build/", to="")If the parameter
toif not specified, the file will be saved in the current directory. Engee. -
Getting information about memory — request data on memory consumption by the model:
RITM_API.memInfo(ritm, "newmodel_1")
-
View the last 10 lines of logs — get the last lines of the model execution log:
RITM_API.getLog(ritm, 10)Use them to debug and diagnose the model.
-
Create a screenshot and get the path to it — Take a screenshot from the machine.:
RITM_API.getScreenshot(ritm, "example.png")The file will be saved in a temporary directory on the RITM and the path to it will be returned as a string.
-
Check the status of the model — make sure that the model is running on the target platform "RITM":
RITM_API.isRunning(ritm, "newmodel_1")If the function returns
true, then the model is in progress. -
Getting profiling data — Get the profiling data of the model from the RITM as a file or string:
RITM_API.getData(ritm, "", engee_location="", in_file=true)