This page contains a series of questions to accompany an article exploring structured text as applied to a User-Defined Function Block (UDFB) as built in the Siemens TIA Portal. Please review the primary article to provide context for the following questions
These questions may be assigned as homework, an interactive group discussion, or as part of an AI-directed learning exercise. Note that the AI can serve as a strong sounding board from which you can explore the questions.
Note: This learning companion supplements the primary article, which should be considered the canonical reference.
Figure 1: Screen capture of the live debug for structured text showing an IF statement that evaluates as true.
Recommendation for use of an AI-based More Knowledgeable Other (Vygotsky’s MKO)
-
Provide context for AI’s attention to the primary article.
-
Prompt the AI to ask each question, one at a time, from this list and provide feedback from the perspective of an experienced control system’s engineer.
Question organization in this document
Questions are listed in order of increasing complexity.
-
The first questions are taken directly from the associated document. They are practical and directly test your understanding of the material. (Type: Explicit)
-
Questions in the middle offer increasing levels of complexity. Instead of implicitly questioning the material, they ask the reader to deeply consider the material and draw implication. (Type: Implicit)
-
The final critical thinking question(s) address topics adjacent to the article material. These critical thinking questions expand the article’s content allowing you to develop a big picture understanding of the material and its relationship to adjacent topics. They are often open ended, require research, and are best answered in essay form. (Type: Topic Adjacent)
Each question is categorized with a recommendation audience:
-
Technicians – Practical, troubleshooting-oriented
-
Students – Academic understanding
-
Capstone/Field Engineers – System-level analysis, design tradeoffs
Questions for anchored AI-assisted learning
This section contains a list of questions with answers to help you better understand the material.
1) What languages may be used to construct a UDFB?
Type: Explicit
Recommended for: Technicians,
Students
Answer:
In general, any IEC61131-3 language may be used to construct a UDFB. Popular implementations include ladder logic, structured text, and function block.
The exact answer depends on the capabilities of the individual development environment.
2) Describe the three state changes that could occur when exiting state uiStOpening.
Type: Explicit
Recommended for: Technicians,
Students
Answer:
The closing state captures the motor starter’s transition from the open state (coil not energized) to the closed state (coil energized and contactor closed). There are three ways to exit the state:
A) To the closed state if the contactor, as monitored by the motor starter’s auxiliary contact is in the closed (energized) position.
B) To the opening state if the user decides to cancel the transition before the contactor has a time to physically close.
C) To the fault state if the contactor, as monitored by the auxiliary contact fails to close in the specified time.
3) What is a one shot and how does it apply to this featured code?
Type: Explicit
Recommended for: Technicians,
Students
Answer:
The term “one shot” describes a variable that is TRUE for a single PLC program scan. In this example, a change in state asserts #xTimerEnable := FALSE;. On the next program scan, the timer will be disabled. Then, on the subsequent scan associated with the new state, the timer is reenabled along with the new PT.
4) In your opinion, is ladder logic easier to debug and troubleshoot than structured text?
Type Implicit
Recommended for: Technicians,
Students
Capstone/Field Engineers
Answer:
Answers will vary based on personal experience. However, ladder logic is generally simpler to troubleshoot as the state of each logic expression is easily determined by the high contrast graphical On and Off lines. For a 3 AM troubleshooting session, the cognitive load is reduced relative to structured text. However, as the program complexity increases, structured text may be preferred.
On a related note, program structure can impact readability. Readability is an advantage of the UDFB featured in this article. The operation can be understood at a high level. If necessary, the technician can drill down into the UDFB to see the operation.
5) Review the PLCopen Coding Guidelines and describe the benefits of using variable prefixes (e.g. Hungarian Notation).
Type: Implicit
Recommended for: Students
Capstone/Field Engineers
Answer:
Hungarian notation is one of several styles used to improve program readability by explicitly identifying data types. With regard to the UDFB, the Hungarian notation serves as a quick reminder of the data types especially when the UDFB is instantiated as ladder logic at the top level of the program. Note that this mixed programming language approach may be beneficial for the technician.
6) Order of operations is important to structured text. For example, at the top of the uiStOpening state, we encounter the xTimerEnable := TRUE; statement. What would happen if this was moved down to where the state’s Boolean outputs are configured?
Type: Implicit
Recommended for: Students
Capstone/Field Engineers
Answer:
The timer would never reset via the implicit one shot associated with a change in state.
Careful analysis shows that each change of state includes an xTimerEnable := FALSE; statement. As written, a change of state will reset the TON. With the modification, the TON would not reset on change of state. This could lead to unexpected triggering of TON.
7) The fault reset state for this UDFB is controlled by NOT xEnable AND NOT xSensor, and xReset. Describe the impact if xEnable or xSensor were removed from the conditional logic statement.
Type: Implicit
Recommended for: Students
Capstone/Field Engineers
Answer:
-
Removal of NOT xEnable is dangerous, as the machine is unpredictable. A reset could cause an unexpected start of the motor.
-
Removal of NOT xSensor is undesirable as we attempt to reset the system while a fault is still present. Recall that an active xSensor indicates that the motor starter’s contacts are welded closed or the presence of a wire failure.
About this author
Aaron Dahlen, LCDR USCG (Ret.), serves as an application engineer at DigiKey. He has a unique electronics and automation foundation built over a 27-year military career as a technician and engineer which was further enhanced by 12 years of teaching (interwoven). With an MSEE degree from Minnesota State University, Mankato, Dahlen has taught in an ABET-accredited EE program, served as the program coordinator for an EET program, and taught component-level repair to military electronics technicians. Dahlen has returned to his Northern Minnesota home and thoroughly enjoys researching and writing articles such as this.