Whenever a PLC programmer starts to develop logic, the first thing he faces is which language to select. As there are five languages in PLC programming, choosing the right one according to your requirements is necessary for easy understanding.
Structured text is a language which is high-level and used by many programmers for complex calculations and algorithms. One of the general logic used in many systems is conveyor speed control. In this post, we will see how to write a conveyor speed control logic using structured text language.
Conveyor Speed Logic
First, let us see the test bench criteria and condition of the logic. As soon as the start button is pressed, the conveyor will start. When the stop button is pressed, the conveyor will stop.
When the conveyor is running, a three-speed selector switch will be taken into consideration. It will be an analog input with a preset speed of 10%, 40% and 80%.
Corresponding to this, the actual PLC input in raw counts will be 5, 20, and 40. Whichever speed input is received, the speed target percentage will be moved to the analog output of the conveyor speed reference.
When the conveyor is not running, then the speed too will be zero.
Structured Text in PLC
Now that we have seen the question, let us come up with an answer using structured text language. Refer to the below image for the logic written.
We have used two inputs – start and stop push buttons, one output – logic running, one analog input – for speed input, and one analog output – for speed reference.
Now, let us start developing the PLC logic. As per the first condition, when we press start, the conveyor turns on and when we press the stop button, the conveyor turns off. So, we have used an if statement. If the start push button is received, then the conveyor will run; and when the stop button is received, then the conveyor will stop.
[For comparing, “=” is used and for assigning a value, “:=” is used. Each statement needs to be terminated by a semicolon and a preceding word – “END_IF”. Semicolon does not come in the condition; it comes in the assignment statement. Refer to the image for more understanding.]
Now, when the conveyor is running, we use the analog input as speed input. In the field side, it is a 3-way selector switch. At the first position, a raw count of 5 is received in the input. At the second position, a raw count of 20 is received in the input. At the third position, a raw count of 40 is received in the input.
For simplicity and shortcuts, we use case statements. As the name implies, it takes the case number of the analog input. So, when the number is 5, we move a value of 10 in the analog output. When the number is 20, we move a value of 40 in the analog output. So, when the number is 40, we move a value of 80 in the analog output.
As per the last condition of the question, by pressing the stop button, the speed should be zero. So, on this input, we have reset the conveyor output bit and also moved the value ‘0’ in the analog output. This is written in the else statement. This means, if the conveyor is running, then move analog speeds, else move zero.
In this way, we have seen the conveyor speed logic using structured text.
Read Next:
- Difference Between PLC and CNC Machine
- PLC Conveyor Ladder Logic Programming
- AI, AO, DI, DO Questions (PLC I/O Types)
- Global Acknowledgment in Safety PLC Logic
- How to Detect Speed of Conveyor in PLC?