Executing SPEL+ Programs

A SPEL+ program contains one or more functions, and the program is run by starting the main function of the program. You can run any of the 64 built-in main functions in the current Controller project by using the Start method of the Spel class. The main function(s) that you start must be defined in your SPEL+ code. When you start a main function, all global variables and module variables are cleared to default values.
The table below shows the program numbers and their corresponding function names in the SPEL+ project.

Program Number SPEL+ Function Name
0 main
1 main1
2 main2
3 main3
... ...
63 main63

Here are examples that start function “main”:
VB Example:

Sub btnStart_Click( _  
       ByVal sender As System.Object, _  
       ByVal e As System.EventArgs) _  
       Handles btnStart.Click  
  
    m_spel.Start(0) ' Starts function main  
    btnStart.Enabled = False  
    btnStop.Enabled = True  
End Sub  

C# Examples:

void btnStart_Click(object sender, EventArgs e)  
{  
    m_spel.Start(0); // Starts function main  
    btnStart.Enabled = false;  
    btnStop.Enabled  = true;  
}