Getting Started: Flows

What Does This Article Cover?

  • What is a Flow?
  • Flow Considerations
  • How to create a Flow
  • Understanding Flow settings
  • Advanced Flow Examples

What is a Flow?

A Flow signifies the transfer of data from one or more sources to one or more targets. Sources can be Inputs, Instances, and Conditions, whereas targets can be Outputs or Pipelines.

Flow Considerations

  1. Engage with target system(s) Subject Matter Experts(SMEs): Before implementing any Flow. They can provide insights on how frequently the system can receive data without being overwhelmed or causing performance issues.
  2. Engage with source system(s) Subject Matter Experts(SMEs): Before implementing any Flow. They can provide insights on how frequently the system can provide data without being overwhelmed or causing performance issues.
  3. Determine Flow Execution Mode: Understand and choose the most appropriate mode for your Flow’s execution based on your specific needs:
  • Always: This mode ensures that the Flow will execute at each specified interval, regardless of whether there have been any changes in the data source. Use this when you want consistent and continuous data transfer.
  • On Change: Here, the Flow triggers only when there is a change from the previous reading. This mode is efficient when you only need updates when actual changes occur.
  • On True: The Flow is executed when a specified expression transitions from false to true. This can be useful when you want the Flow to act upon a particular event or threshold being reached, like a temperature surpassing a certain limit.
  • While True: In this mode, the Flow keeps executing as long as a certain condition remains true. For example, if you want continuous data transfer while temperature is above a certain threshold, this mode would be appropriate.
  1. Determine the Publish Mode: The choice of publish mode is critical as it defines how the data from your source will be sent to the target system. Consider your data’s nature and the frequency of changes to determine the best fit:
  • All Values: With this mode, all successfully read data values are sent at each interval. This ensures that the target receives comprehensive data but might send redundant information if values haven’t changed.
  • Only Changes: This mode will transmit only the data values that have altered since the last interval. It’s an efficient choice when you want to minimize data traffic and only focus on changes.
  • Only Changes Compressed: Similar to the “Only Changes” mode, but even more streamlined. Here, for modeled instances, only the specific attributes that have changed are transmitted. It ensures the leanest data package while still capturing changes.
  1. When choosing a publish mode, think about the balance between data completeness and data transfer efficiency. Your choice can influence network traffic, storage requirements, and the speed at which downstream systems can process incoming data.
  2. Templating: If you plan to create multiple similar Flows, consider using templates. Flow templating can greatly speed up the setup process and ensure consistency across multiple Flows.
  3. Error Handling: Be mindful of how the system behaves in case of write errors. Some Flows may transition into an error state if there are write errors, which could impact the overall functionality.

How to create a Flow

  1. Navigate to the Flows section in the configuration’s view, where you can add, edit, and view Flows.
  2. Click on the New Flow button to add a Flow.
  3. Name and describe your Flow. Enter a name that represents your Flow. Optionally, you can add a description or categorize the Flow under a Group As folder.
  4. Add sources and targets. To add sources, view and select Inputs for any Connection and/or Instances from the References panel, and drag them to the Sources field. For targets, view and select Outputs for any Connection from the same panel and drag them to the Targets field.
  5. Configure Flow settings. Set additional settings according to your needs and click the Submit button to finish creating the Flow.

Understanding Flow Settings

Flow Status

The Flow status indicates whether the Flow is enabled or not. If disabled, the Flow does not read sources or write data to targets.

Sources & Targets

Sources

Sources are the origin of the data read when a Flow is executed. They can be templated or take parameters.

Targets

Targets are the location to which the data is written once all source reads are complete. They can be Outputs or Pipelines.

Flow Settings

Type

This specifies the trigger type for the Flow: Polled or Event.

  • Polled: Operates on an interval basis.
  • Event: Executes when a new event occurs.

Interval

For Polled mode, this determines how often the Flow is processed.

Mode

This specifies the operation mode of the Flow: Always, OnChange, OnTrue, WhileTrue.

Expression

A JavaScript expression that assigns a source’s data value or performs a calculation on one or more source data.

Trigger Delay

This is applicable when the Flow is in Event Mode. It represents the waiting time from Event Source/Expression evaluation to reading source data.

Publish Mode

This controls what is published per source: All, OnlyChanges, OnlyChangesCompressed.

Flow Templating

Flows can be templated just like Inputs and Instances. Templating a Flow facilitates the creation of many Flows that share the same basic configuration.

Advanced Flow Examples

Imagine a factory equipped with a temperature sensor. This section will explore various configuration scenarios for optimal data management for the factory’s temperature sensor.

Scenario 1: Always mode for continuous monitoring

Using the Always mode ensures data is sent every interval, providing consistent monitoring.

Settings:

Type: Polled

Interval: 5 seconds

Mode: Always

Publish Mode: All Values

Result: Data is outputted to the target every 5 seconds regardless of whether the temperature has changed.

Scenario 2: Efficient data communication with On Change

The On Change mode is selected to transmit only when there are new or altered readings, optimizing data transfers.

Settings:

Type: Polled

Interval: 5 seconds

Mode: On Change

Publish Mode: All Values

Expression: {{Connection.HB_OPC_UA.Packaging_InjectionMolding1_Temperature}}

Result: Data is output to the target every 5 seconds, but only if the temperature sensor detects a new value since its last poll.

Scenario 3: Triggering data on specific threshold with On True

With the On True mode, data is transmitted only when temperature surpasses a set threshold.

Settings:

Type: Polled

Interval: 5 seconds

Mode: On True

Publish Mode: All Values

Expression: {{Connection.HB_OPC_UA.Packaging_InjectionMolding1_Temperature}} > 40


Result: Data is output to the target only when temperature exceeds 40C. After triggering, the system will not send further data until polled again and if the condition transitions from false to true.

Scenario 4: Persistent monitoring above a threshold with While True

The While True mode continuously sends data as long as temperatures remain above a certain limit.

Settings:

Type: Polled

Interval: 5 seconds

Mode: While True

Publish Mode: All Values

Expression: {{Connection.HB_OPC_UA.Packaging_InjectionMolding1_Temperature}} >40


Result:
As long as the temperature remains above 40C, data will be continuously outputted to the target every 5 seconds. Once it drops below 40C, the system will stop sending data.

Scenario 5: Selective reporting above threshold with On Change

Only changes in temperature readings above a specific threshold are communicated using On Change mode paired with Only Changes publish mode.

Settings:

Type: Polled

Interval: 5 seconds

Mode: On Change

Publish Mode: Only Changes

Expression: {{Connection.HB_OPC_UA.Packaging_InjectionMolding1_Temperature}} >40


Result:
Data is sent to the target only when the temperature exceeds 40C and has a new value since the last poll. If the temperature remains at a constant value above 40C, no further data is sent.

Scenario 6: Managing sudden surges of temperature Events

Suppose the factory experiences unexpected situations in which sudden temperature surges occur, leading to a rapid influx of events. These surges can overwhelm systems that aren’t equipped to handle them in real-time. 

Settings:

- Type: Event

- Mode: On True (or the specific event-trigger mode)

- Publish Mode: Only Changes Compressed

- Expression: {{Connection.HB_OPC_UA.Packaging_InjectionMolding1_Temperature}} > 40

Result: With the event-based flow an event is triggered and queued as soon as the temperature exceeds the 40°C threshold. For instance, if there’s a malfunction causing 100 rapid temperature changes in a single second, each of these events is queued and processed in order. This ensures that no temperature alert is missed.

Considerations: While the event-based flow ensures no data is missed, it requires a resilient downstream system capable of handling potential data backlogs. If the target system can’t process the queued events quickly enough, there’s a risk of the queue growing indefinitely. This could lead to delays in data processing or, in worst-case scenarios, system bottlenecks.