Example Code

Object Oriented Sequence/State Execution Engine With LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Hi all,

 

Here's a take on a sequence/state based execution engine for those who need to connect a sequence of states with timing and transition information to a set of outputs, such as controller setpoints, controller modes and direct outputs (open-loop). This example requires the Report Generation Toolkit, which is now included in LabVIEW Professional

This example also exist as a constantly evolving example in the LabQT LGPL Open Source library.

 

Sequence.jpg

 

In the example detailed above the feedback controller runs a sequence of setpoints defined by a excel sheet. Each state transition is controlled by a minimum time, criterias for making the jump and to which state to jump.

 

In order to set up one sequenced setpoint execution one proceeds as the following.

 

  1. Select and edit either a TDMS or an .XLS, or XLSX excel file and define the state transition logic using Criterias (boolean variables), jump (transition to the next state), dt (minimum time spent in each state) and then the setpoints (Pressure:1, Flow:1, Force:1, Force:2)
  2. Drag the newly created/edited file into the sequence composition listbox. Here you can drag one or more sequences.
  3. Create the sequence by pressing the "Create" button
  4. Start execution of the sequence by right-click and select "start". Here is also possible to stop, pause and delete the sequence during runtime.
  5. As the sequence executes all metadata during runtime will be presented here for the ease of debugging
  6. The sequence will block on state 1, do transitions on state 5 and 34 as defined by the excel sheet. This behaviour is controlled by the Boolean network shared variables connected to the buttons.

 

Have fun experimenting with this framework and see if it can fit into your project. It is fairly heavy on LVOOP, so be prepared.

 

Br,

 

/Roger

 

Edit 1: Updated the example and added a path to the originating source library

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors