Table Of Contents

Creating a Basic Real-Time Sequence

Last Modified: June 10, 2021

Create a real-time sequence that starts, stalls, and stops the engine demo.

Before you begin, deploy the engine demo's system definition.
  1. In the VeriStand Editor, click Tool Launcher »Stimulus Profile Editor.
  2. In the Stimulus Profile Editor, click New Real-Time Sequence.
  3. Save the sequence as Engine Demo Basics tutorial.nivsseq in the <Common Data> \VeriStand Projects\Engine Demo\Stimulus Profiles\Basic Engine Demo directory.
  4. Add blocks to organize your code.
    1. In the Primitives palette, expand Miscellaneous and drag a Block into the Setup section of the real-time sequence.
    2. In the Property Browser Name field, enter Turn on engine.
    3. Add a block to the Main section and name it Set engine speed to 2500 and wait.
    4. Add a block to the Clean Up section and name it Turn off engine.
  5. Create variables.
    spd-note-note
    Note  

    For an example of how to use channel references to access channels, refer to Reading and Writing Channels Directly from a Real-Time Sequence Tutorial.

    1. In the Primitives palette, expand Variables and drag a Boolean into the Parameters section of the Variables pane.
    2. In the Property Browser next to Default Assignment, click Browse to display the system definition channel tree.
    3. Click View aliases to display the aliases defined in the system definition.
    4. Double-click EnginePower to assign this alias to the parameter.
    5. In Identifier, enter EnginePower.
    6. In Units, enter On/Off.
    7. Select Double from the Primitives palette and drag it to Parameters to add a double-precision numeric parameter after EnginePower.
    8. In the Property Browser, name the new parameter DesiredRPM, map the parameter to the corresponding alias, and enter the units as RPM.
  6. Add variables to the sequence code and set their values.
    1. In the Variables pane, drag EnginePower into the Turn on engine block.
    2. In the Property Browser, edit the Expression to EnginePower = true. This value will turn the engine on when the block executes.
    3. Drag DesiredRPM into the Set engine speed to 2500 and wait block.
    4. Set DesiredRPM to 2500.
    5. Press <Ctrl> and drag DesiredRPM from the Set engine speed to 2500 and wait block into the Turn off engine block.
    6. Set DesiredRPM to 0.
    7. In the Variables pane, right-click EnginePower and select Copy.
    8. Right-click Turn off engine and select Paste. Leave the value as false to turn the engine off when the block executes.
  7. Set the expression to wait before it executes.
    1. In the Sequences palette, expand Real-Time Sequence Library»Standard»Timing and drag Wait into the Set engine speed to 2500 and wait block.
    2. In the Property Browser, edit the Expression to replace Duration with 20. This will hold the DesiredRPM value at 2500 for 20 seconds when this step executes.
  8. Set a return value.
    1. In the Primitives palette, expand Variables and drag Void Return Value into the Return Variable section of the Variables pane.
      spd-note-note
      Note  

      By default, the return value node is named Pass.

    2. In the Property Browser, enter the Identifier as Output to change the name of the return value node.
  9. Save the real-time sequence.
The real-time sequence code will look like the following image.
After creating this real-time sequence code, you must add it to a stimulus profile.

Recently Viewed Topics