Let’s startup Studio 5000, and select the program RealPars_IEC61131, previously created in the first section.
After the Studio 5000 program starts up, the “Logic Designer GUI” appears. In the “Controller Organizer Area” - “Tasks” folder - “MainProgram” folder, we can see the three different program file types created in the first section, they are:
- RealPars_FunctionBlock,
- RealPars_Ladder,
- RealPars_StructuredText.
The ladder routine was created in the previous section so now let’s continue where we left off and work on the Structured Text routine.
We will program while online with the processor so let’s download the program to the “Emulator PLC”.
Next, under the “MainProgram” folder, double left-click on the “RealPars_StructuredText” routine. Select the “Edit” icon.
When the blank routine window is displayed, we will copy/paste or type the sample “Structured Text” script in the routine window:
// Let's begin Structured Text Sample
If SoftWaterTank.TankLevel >= SoftWaterTank.PumpStart_SP then /*Check Tank level for Pump Start SP Level */
SoftWaterTank.PumpStarter:= 1; /* Turn Pump ON */
SoftWaterTank.WaterValve:= 1; /* OPEN Water Valve */
ElsIf SoftWaterTank.TankLevel <= SoftWaterTank.PumpStop_SP then /*Check Tank level for Pump Stop SP Level */
SoftWaterTank.PumpStarter:= 0; /* Turn Pump OFF */
SoftWaterTank.WaterValve:= 0; /* CLOSE Water Valve */
End If;
After we paste or type the sample “Structured Text”, the window displays the coded text.
With the “Structured Text” routine, we will use an “If-Then-Else” function. The “If” statement will perform the comparison using the “greater than or equal” (>=) and “less than or equal” (<=) symbols.
We will begin by opening the RealPars_FunctionBlock routine.
Sheet 1 of 1 will be displayed. Select the Edit icon.
The routine will now be in edit mode and display the Accept Edits toolbar.
With Function Block programming we will use similar compare GEQ (Greater than or equal) and LEQ (Less t...