Organization blocks, functions and function blocks
Цель: Изучить тему «Organization blocks, functions and function blocks» и закрепить её практическими заданиями и самопроверкой.
2 акад. часа чтение и разбор теории, решение задач, работа со схемой или виртуальным стендом и проверка понимания.
Основной материал
Large program should be modular. Siemens terminology: OB organization block defines execution context; FC function generally has no persistent instance state; FB function block uses instance DB for state. Other PLC brands use programs/functions/function blocks with similar concepts.
Encapsulation
Motor logic should not be copied 50 times manually. A reusable Motor FB accepts commands and feedback, produces state/alarm. Each motor gets its instance data. This reduces errors and makes changes controlled.
Interface design
Function block interface should separate inputs, outputs and internal states. Avoid excessive global variables because dependencies become hidden.
Практическая работа
Design interface of Valve_FB: OpenCmd, CloseCmd, OpenLS, CloseLS, Permissive, Reset; outputs OpenOut, CloseOut, State, Fault, TimeoutAlarm.
Самопроверка
• What is modular programming?
• Difference function vs function block concept?
• What is instance data?
• Why avoid copy-paste logic?
• What belongs in block interface?
Что нужно запомнить
- Siemens terminology: OB organization block defines execution context; FC function generally has no persistent instance state; FB function block uses instance DB for state.
- Other PLC brands use programs/functions/function blocks with similar concepts.
- A reusable Motor FB accepts commands and feedback, produces state/alarm.
- Function block interface should separate inputs, outputs and internal states.
- Avoid excessive global variables because dependencies become hidden.