9.27.2021

UseStWritePLC.md

How to use structure text to write a simple indexing rotary table plc program

What is a indexing rotary table machine

Brief definition:

  1. At least one material input station and one finished product output station
  2. At least one indexing rotary table
  3. The indexing rotary table has a different number of divisions (or workstations) according to the manufacturing process
  4. Each division can place one or more workpieces
  5. Materials can input by man or feeder.

Found on the Internet:

Program Layout

Generally, I’ll layout the plc program as :

  • “Init” : Initialization code
  • “Always” : The normal execution code, including the Instance of Function Block
  • “Auto” : Automatic mode control
  • “Manual” : Manual mode control
  • “Error” : Error status control code
  • “St1”
  • “Stx” : Cycle control code of each station

State Machine

I’d like to centralization the mode control in one state machine, as shown in the figure:

If it is a simpler system, it will be simplified to only manual/automatic switching, or execute according to individual needs.

Of course, the actions of each station are also processed by their own state machine. In automatic mode, the role of the main state machine is only to evoke the status of whether each station needs to perform an action and check completion.

Timing diagram

  • a: The first automatic action is to turn the indexing rotary table, then let each station act
  • b: After the indexing rotary table is arrived, St2Cycle can work
  • c: The indexing rotary table will be rotated again after the St1 and St2 (all stations) operations are completed

The indexing table basically has only two states:

  • Rotating
  • Stopped in place

And each station basically has two types,

  • Can only act after the indexing rotary table is in place
  • You can do act first, and then continue to act after the indexing rotary table is in place

As shown in the figure above, St1 can pre-act while rotating, while St2 can only be acted after it is in place.

Sample file

Sample file

Summarize

In fact, sometimes its more intuitive to use the ladder style, but the advantage of ST is that it is convenient to write automatic code generator, It can shorten a lot of time during development.

Pay attention to when writing ST:

  1. ":=" equivalent “out” command
  1. The “if” instruction will take up more steps

    If there is only one line of instructions, it is recommended to switch to a single command. Although it is less readable, it saves more steps…

ST writing recommendation reference:PLC結構化文本設計模式和算法_rediculous的專欄-CSDN博客_plc結構化文本編程

沒有留言:

張貼留言