We can now create the operator that will handle the control, in this case, the status of the pulse depends on the provided input. We create a second operator and define a single input and a single output for this process: the given uptime of the pulse as the input and the pulse status as the output (bool type). We will also need a local variable to store the previous status so the controller knows when to switch, therefore this operator should be a Node Operator. We can then go to the diagram of the operator and add the State Machine that will implement this logic.
In the State Machine, we will define the two different states of the pulse: UP and DOWN. The DOWN state will only need a Textual Expression (“false”) and the output defined in the operator. The UP state will need a “true” Textual Expression, the output of the operator, and an additional logic using the input of the operator to initialize it and store it in a local variable. The initialization will use the Last Reference of the local variable (enabled by right click) and the value will be stored in the same local variable (change the Use to “Out” in the properties).
We can now connect the two states with two different paths of Weak kind by clicking on their corners: one from DOWN to UP and one from UP to DOWN. In the Activation property we can define the condition under which the states will change:
UP → DOWN: local_variable times true
DOWN → UP: (uptime>0) and (local_variable<>uptime)
These conditions will enable the pulse to switch to UP and stay there for the designated amount of time resulting from the previous operator based on the rotation input provided by the user. The resulting diagram should look like this:
Fig 3 Resulting Diagram
We can now connect the two operators.