+
+ +
+

FieldBus

+

FieldBus related API functions.

+
+
+GHS.ghs_get_fieldbus_data_count() tuple[str, int | None][source]
+

Gets the number of data that are configured to be sent through the field bus, excluding the timestamp.

+
+
Returns:
+

    +
  • GHSReturnValue - API return values

  • +
  • data_count - The number of data that are selected to be published, excluding timestamp.

  • +
+

+
+
+
+ +
+
+GHS.ghs_get_fieldbus_data_name_and_unit(data_index: int) tuple[str, str | None, str | None][source]
+

Gets the name of specific field bus data value, by giving the index of the data value. +The number of data values can be retrieved by GHSGetFieldBusDataCount().

+

In case of no formulas (or reserved values acquisition state and latency) published, +an error code is returned: GHSReturnValue_FieldBusError_NoFormulasDeployed.

+
+
Parameters:
+

data_index – Zero-based index of the data value.

+
+
Returns:
+

    +
  • GHSReturnValue - API return values

  • +
  • data_name - Name of the data value.

  • +
  • data_unit - Unit of the data value.

  • +
+

+
+
+
+ +
+
+GHS.ghs_initiate_fieldbus_data_transfer(update_rate: int) tuple[str, int | None, int | None][source]
+

Opens a new connection for the field bus data, and waits for client +to connect. Once the client connects, if the acquisition state is +active, data is sent to the client. Otherwise nothing is sent.

+

If no formulas are present then you get error code back:GHSReturnValue_FieldBusError_NotConfigured

+

If the field bus is already initiated then an error code is returned: +GHSReturnValue_FieldBusError_FieldBusEnabled.

+

To change the update rate the field bus needs to be stoped and inititated again with a new update rate.

+
+
Parameters:
+
    +
  • update_rate – (in Hz) The update rate should be a part of the list

  • +
  • rates (containing the supported update) –

  • +
+
+
Returns:
+

    +
  • GHSReturnValue - API return values

  • +
  • update_rate - If the update rate selected by the user is not supported, the mainframe will adjust the update rate based on a minimum distance from the supported rates and returns back to the client.

  • +
  • data_count - The number of published data on the setup. Timestamp is not included in this count.

  • +
+

+
+
+
+ +
+
+GHS.ghs_stop_fieldbus_data_transfer() str[source]
+

Closes the socket dedicated for the field bus data and stops transfering data. +The ring buffer allocated for the transfer data is deleted.

+

Field bus data transfer must have been initiated before calling this function

+
+
Returns:
+

    +
  • GHSReturnValue - API return values

  • +
+

+
+
+
+ +
+
+GHS.ghs_receive_fieldbus_data() str[source]
+

Used to retrieve the FieldBus data from the new socket connection and write on the buffer.

+

Can be used in a thread and if so, mutual exclusion should be used with GHSStopFieldBusDataTransfer.

+

This function should be used in a loop if continuous delivery of Async Data is desired.

+

Field bus data transfer must have been initiated before calling this function.

+
+
Returns:
+

    +
  • GHSReturnValue - API return values

  • +
+

+
+
+
+ +
+
+GHS.ghs_read_next_snapshot(call_type: str | int) tuple[str, float | None, float | None, int | None][source]
+

Retrieves the next snapshot in the buffer.

+

The timestamp is grid aligned - as specified by the ‘updateRate’ argument +of the GHSInitiateFieldBusDataTransfer() method.

+
+
Parameters:
+

call_type – flag to control the receiving of FieldBus data: +If set to GHS_BlockingCall it blocks while waiting for new FieldBus data. +*If set to GHS_NonBlockingCall then returns last FieldBus data when no new data available. +*GHS_BlockingCall is the preferred value as this results in the lowest CPU load +and highest data troughput.

+
+
Returns:
+

    +
  • GHSReturnValue - API return values

  • +
  • Timestamp - timestamp of the FieldBus data relative to start of acquisition GHSGetAcquisitionStartTime()

  • +
  • Values - the values published on the FieldBus.

  • +
  • Overrun - is one if overrun happened in the buffer, zero if not.

  • +
+

+
+
+
+ +
+
+GHS.ghs_request_fieldbus_snapshot(dataCount: int) tuple[str, float | None, int | None, tuple[float] | None][source]
+

Request a single snapshot of the field bus data. +In this case the timestamp received is not grid aligned.

+

If the system is not acquiring the method returns an error code:GHSReturnValue_SystemNotRecording

+

In case of no formulas you get the error return code back:GHSReturnValue_FieldBusError_NotConfigured

+

If the field bus is already enabled then this method is not allowed. +An error return code is returned:FieldBusError_UnavailableFunctionality.

+
+
Returns:
+

    +
  • GHSReturnValue - API return values

  • +
  • timestamp - Timestamp of the FieldBus data relative to start of acquisition (not grid aligned) GHSGetAcquisitionStartTime

  • +
  • data_count - Actual number of elements(formulas) in the data parameter. If number of elements allocated by the customer are less than the actual formulas number, then we return an error code.

  • +
  • data - Array of floats that contains the data

  • +
+

+
+
+
+ +
+ + +
+