Engee documentation

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 get started with the target platform «RITM»:

  1. Add A RITM machine to Engee through the app RITM.Manager ritm icon.

  2. Install support RITM BLOCKS:

    engee.package.install("RITM-Engee-Blocks")
  3. Install the External hardware support package:

    engee.package.install("Engee-Device-Manager")
    For more information about the installation process, see Engee.Integrations.
  4. After these steps, modules for working with external hardware that provide programmatic management of the target platform become available. «RITM». To connect the modules, enter the following commands:

    using Main.EngeeDeviceManager.Targets
    using Main.EngeeDeviceManager.Targets.RITM_API
  5. 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_API.Ritm("http://192.168.56.3:8000/")

Basic methods of working with RITM

The following methods are available for working with the equipment on the RITM:

  • RITM_API.buildModel — builds a model based on the RITM.

  • RITM_API.runModel — starts the model on the RITM.

  • RITM_API.stopModel — stops the model on the RITM.

  • RITM_API.isConnected — checks the availability of the RITM.

  • RITM_API.isRunning — checks whether the RITM 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 RITM and returns the path to the image file.

  • RITM_API.getData — returns the result of profiling the model based on the RITM.

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

  1. Connect Modules — Connect namespaces containing target platform definitions «RITM» and its API:

    using Main.EngeeDeviceManager.Targets
    using Main.EngeeDeviceManager.Targets.RITM_API
  2. Create a RITM target platform object and set the URL — create an object ritm representing the target platform, and specify the IP address of the machine.:

    ritm = Targets.RITM_API.Ritm("http://192.168.56.3:8000/")
  3. Check the availability of RITM — check whether the connection is established with the RITM device:

    RITM_API.isConnected(ritm)

    If the method returns false then check the IP address and make sure that the client program is running on the RITM.

  4. The assembly is open in Engee models based on the RITM in independent mode:

    model = engee.gcm()
    RITM_API.buildModel(ritm, model, false)
  5. Launch the model — launch the model on the RITM machine:

    RITM_API.runModel(ritm, model, false)

    After launch, the model will start executing in the previously set mode (in our case, in an independent mode).

  6. Stop the model — stop the execution of all running models on the RITM:

    RITM_API.stopModel(ritm)
  7. 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/")
  8. 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/")
  9. 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 to if not specified, the file will be saved in the current directory. Engee.

  10. Getting information about memory — request data on memory consumption by the model:

    RITM_API.memInfo(ritm, "newmodel_1")
  11. 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.

  12. 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.

  13. 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 executed.

  14. Get profiling data — Get model profiling data from the RITM as a file or string:

    RITM_API.getData(ritm, "", engee_location="", in_file=true)
  15. File Upload — upload the file newmodel_1 To THE RITM:

    RITM_API.uploadFile(ritm, "newmodel_1.engee"; from="/user/", to="/home/ritm")
  16. File Deletion — delete the file newmodel_1 To THE RITM:

    RITM_API.removeFile(ritm, "/home/ritm/newmodel_1.engee")
  17. Getting diagnostics — Get a diagnosis of the RITM machine:

    RITM_API.getDiagnostic(ritm)
  18. Reboot — restart the machine.:

    RITM_API.reboot(ritm)
  19. Shutdown — turn off the machine.:

    RITM_API.poweroff(ritm)