Engee documentation

Working with external equipment via RITM in Engee

RITM is a hardware solution for running models in real time. It allows you to integrate and control physical hardware scenarios directly from Engee.

To get started with the RITM target platform:

  1. Add a RITM machine to Engee via the RITM.Manager application ritm icon.

  2. Install support for RITM blocks:

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

    engee.package.install("Engee-Device-Manager")
    For more information on the installation process, see Integration of Engee with equipment.
  4. After these steps the modules for working with external equipment that provide software control of the target platform "RITM" become available. To connect the modules, enter the following commands:

    using Main.EngeeDeviceManager.Targets
    using Main.EngeeDeviceManager.Targets.RITM.RITM_API
  5. In the last step, create an object of the RITM target platform for interaction with devices and specify the IP address of the corresponding device:

    ritm = Targets.RITM.Ritm()
    Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/")

Basic methods of working with RITM

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

  • Targets.upload_model - uploads the model to RITM.

  • Targets.generate_executable_code - generates C pipelining on RITM.

  • Targets.compile_model - builds the model on the RITM.

  • Targets.start_model - starts the model on the RITM.

  • Targets.stop_model - stops the model on RITM.

  • RITM_API.isConnected - checks if the RITM is available.

  • RITM_API.isRunning - checks if the RITM model is running.

  • RITM_API.listFiles - displays the 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 - outputs information about memory consumed by the model.

  • RITM_API.getLog - returns the specified number of lines of logs of model execution on RITM.

  • RITM_API.getScreenshot - creates a screenshot on RITM and returns the path to the image file.

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

Detailed description of each method is presented in the article Software control of RITM.

Step-by-step example of working with the RITM model

  1. Modules connection - connect namespaces containing definitions of the target platform "RITM" and its API:

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

    ritm = Targets.RITM.Ritm()
    Targets.RITM.set_url(ritm, "http://192.168.56.3:8000/")
  3. Check RITM Availability - check if communication with the RITM machine is established:

    RITM_API.isConnected(ritm)

    If the method returns false, check the IP address and whether the client program is running on the RITM.

  4. Build a model opened in Engee on RITM in independent mode:

    model = Engee.engee.gcm()
    Targets.upload_model(ritm, model)
    Targets.generate_executable_code(ritm, model, false)
    Targets.compile_model(ritm, model)
  5. Start the model - start the model on the RITM machine:

    Targets.start_model(ritm, model)

    After starting, the model will start running in the previously set mode (in our case in independent mode).

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

    Targets.stop_model(ritm)
  7. Directory contents output on RITM - get the list of files in the specified directory (/home/ritm/):

    RITM_API.listFiles(ritm, "/home/ritm/")
  8. Read file contents - output the contents of the file (install_manifest.txt) at the specified path (/home/ritm/build/newmodel_1/build):

    RITM_API.readFile(ritm, "install_manifest.txt"; path="/home/ritm/build/newmodel_1/build/")
  9. Fetch file to 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 to parameter is not specified, the file will be saved in the current Engee directory.

  10. Get memory information - request data about memory consumption by the model:

    RITM_API.memInfo(ritm, "newmodel_1")
  11. View last 10 log lines - 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 RITM machine:

    RITM_API.getScreenshot(ritm, "example.png")

    The file will be saved in a temporary directory on the RITM and its path will be returned as a string.

  13. Check the model state - make sure that the model is running on the target platform "RITM":

    RITM_API.isRunning(ritm, "newmodel_1")

    If the function returns true, the model is in progress.

  14. Get profiling data - get model profiling data from RITM as a file or string:

    RITM_API.getData(ritm, "newmodel_1", "/user/", true)