Example 2 — Create a new sequence
- Last UpdatedJan 06, 2025
- 1 minute read
This example demonstrates how to create a new sequence by copying an existing one.
Sequences are defined in the sequences folder of the AVEVA Real-Time System (RTS) installation. Each sequence has its own subfolder in the sequences folder. See Sequence folder structure for more information.
Create a new sequence
-
Open File Explorer and browse to the sequences folder of the RTS installation.
-
Copy the sequence_basicsample subfolder and give it another name, such as sequence_mysequence.
-
In the sequence_mysequence folder, open the cycle_script.csx file in a text editor.
Consider the structure of this file:
bool Init()
{
Log.Information($"From Init event for sequence: {SequenceName}, HistTimestamp: {HistTimestamp}");
return true;
}
bool Run()
{
Log.Information($"From Run event for sequence: {SequenceName}, HistTimestamp: {HistTimestamp}");
return true;
}
bool Shutdown()
{
Log.Information($"From Shutdown event for sequence: {SequenceName}, HistTimestamp: {HistTimestamp}");
return true;
}
The Init, Run, and Shutdown functions are Events that the ScriptRunner invokes, in that order. The contents of the functions support most C# syntax. See Cycle script files for details.
-
Edit the cycle_script.csx file in the sequence_mysequence folder.
For example, add the following line in the Run() Event:
Log.Information($"I made this change.");
-
Open the RTS shell.
See Open the AVEVA Real-Time System shell to run commands for more information.
-
Enter the following command:
rts run mysequence
You should see the updated text in the shell and log files.
You don't need to restart RTS after you update sequence scripts or create new sequences.