Skip to content

Application Overview

This section briefly describes how to build an application for HCC2 using the example source code that was downloaded and installed in the previous section. Please note that this constitutes an example on how to build an application but does not limit the use of other approaches or methodologies. For example, if more appropriate for the app behavior, one could request data from the Modbus server on demand, without the continuous polling and data storage as done in the example.

The high-level architecture of the app created with the sample code is presented in the figure below.

Application Architecture Block Diagram

The application structure is based on the following building blocks (see numbers on above image):

  1. The application includes a Modbus TCP Client. This client periodically scans data (and issue writebacks) to a Modbus Server available as part of the HCC2 core software.

  2. Scanned data are stored in a real-time memory storage that is also part of the application. Likewise, data written to the memory storage are written back to the HCC2 Modbus Server.

  3. The application has access to read/write data from/to the memory storage using API methods. Those methods are:

    • For Python
      get_value(tag_name)        - gets the last scanned value of tag_name.
      set_value(tag_name, value) - sets (writeback) a value on that tag_name.
      
    • For C#
      GetValue(tag_name)        - gets the last scanned value of tag_name.
      SetValue(tag_name, value) - sets (writeback) a value on that tag_name.
      
  4. The HCC2 Modbus Server must be properly configured to accept queries and writebacks from the application.

The following sections will describe each one of the above steps.