Pulse / Sustain Actions

You can associate Pulse and Sustain actions to a step.

Pulse and Sustain actions contain an expression which assigns a value to a signal or a port. The assignment of the value will trigger the emission (that is, the status present or absent) of the signal.

The creation of Pulse and Sustain actions are identical. The difference concerns the simulation:


  • A Pulse action is executed the first cycle that the step is active.

  • A Sustain action is executed each cycle that the step is active.

This task shows you how to:


Before you begin:

The SFC+ Editor workbench should be opened and a step is already created.

Assign Literal Values

You can assign literal values to a signal or a port.

  1. For this task, some ports and signals must be already defined.

    1. Double-click the node Ports in the specification tree. The Block Properties window is opened at the Ports tab.

    2. Click Add Port .

      A new port is created.

    3. Change its name to s.

    4. Create another s1 port.



    5. Click OK. The two ports are available in the specification tree.



  2. Click Add Action and select step S0 in the graph.

    This dialog box appears:

    If Show Label is selected and the Label field is filled, the label will be displayed in the action. Otherwise, the expression is displayed.

  3. Select the type Pulse (or Sustain) and enter the following values.



    Tip: To enter the port name in the expression, you can directly click the port in the specification tree.

    In this example, the value 5 is assigned to the signal s. A condition has been added: the expression is executed, if and only if, the value of the signal s1 is equal to true.

  4. Click OK. The pulse action is represented as follows in the editor:



    In the specification tree, notice that the inference mechanism has automatically computed the direction and the type of the ports from their usage in the action.

    s1 is read and compared to a Boolean value, so the port is computed as a Boolean input. The value 5 is assigned to s, so the port is computed as an output of the type Number.



    Note: If the signals s and s1 were not defined in the block, the action would be highlighted in red. The error message is available by scrolling over the step. To solve the problem, you must create the ports as explained in step 1.



  5. Repeat step 4 to create a new action.

  6. Fill the Action Properties dialog box as follows:



  7. Click OK. The Sustain action is represented as follows in the editor:



    Note: N ( for non-stored) is the identifier of a Sustain action.

Assign Ports and Signals

You can assign the value of a port or a signal to another port or signal.

  1. For this task, delete the action created above but do not remove the ports s and s1.

  2. Click Add Action and select step S0 in the graph. The Action Properties dialog box appears.

  3. Select the type Pulse (or Sustain) and enter the following values.



    Tip: To enter the port name in the expression, you can directly click the port in the specification tree.

  4. Click OK. The pulse action is represented as follows in the editor:



    The value of s1 is assigned to s.

  5. You can also assign an element of a structure or a tuple (see a typical example below).

    Click directly the element of the structure or the tuple in the specification tree to fill the Action Properties dialog box.



Assign Structured Data Types

You can assign a structured data type to a port or a signal.

  1. For this task, delete the action created above but do not remove the 2 ports s and s1.

  2. Click Add Action and select step S0 in the graph. The Action Properties dialog box appears.

  3. Select the type Pulse (or Sustain) and enter the following values.



  4. Click OK. The pulse action is represented as follows in the editor:



    Notice that the computed type of s is a data composite type.

Assign Function Result

You can assign the result of a function to a port or a signal.

  1. For this task, create a new function in the specification tree.

    1. In the contextual menu of the block, select Insert ... > Functions ... > Function.

    2. If the Position dialog box appears, select Before and click OK.

    3. In the Function Properties dialog box, rename the function to Plus.

    4. Define the input parameters of the function as follows:



    5. Define the Result of the function as follows:



    6. Click OK. The function is added to the specification tree.



  2. Click Add Action and select step S0 in the graph. The Action Properties dialog box appears.

  3. Select the type Pulse (or Sustain) and enter the expression as follows:



  4. Click OK. The pulse action is represented as follows in the editor:



  5. If the function is created with the option Named Interface (see step 1.d), the input parameters of the function are structured. In this case, the function must be called with the following syntax.



Assign Constants

You can assign the value of a constant to a port or a signal.

  1. For this task, create a new constant in the specification tree.

    1. In the contextual menu of the block, select Insert ... > Constants ... > Constant.

    2. If the Position dialog box appears, select Before and click OK.

    3. In the Constant Properties dialog box, add a constant value and click OK. The constant is added to the specification tree.



  2. Click Add Action and select step S0 in the graph. The Action Properties dialog box appears.

  3. Select the type Pulse (or Sustain) and click the signal and the constant in the specification tree to fill Expression.



  4. Click OK. The pulse action is represented as follows in the editor:



Assign Parameters Defined as Constants or Functions

Parameters are used in the same way as predefined constants and functions.

  1. For this task, you need to define two block parameters, one parameter has to be a constant, the other one has to be a function. You can used the constant PI and the function Plus defined in the previous tasks as default values for the parameters.

    1. Open the Block Properties window and add the two parameters.



    2. Click OK. The parameters are visible in the specification tree.



  2. Click Add Action and select step S0 in the graph. The Action Properties dialog box appears.

  3. Select the type Pulse (or Sustain) and click the signal and the constant parameter in the specification tree to fill Expression.



  4. Click OK. The pulse action is represented as follows in the editor:



  5. Click again Add Action and select step S0 in the graph. The Action Properties dialog box appears.

  6. Select the type Pulse and click the signal s1 and the function parameter in the specification tree to fill Expression.



  7. Click OK. The pulse action is represented as follows in the editor: