Teaching pack · UAT 202
A 15-week teaching plan, 5 worksheets, a scoring rubric and a map from the course description to the lessons, for instructors to evaluate and adapt before teaching.
Coverage of the course description
The lessons fully teach 10 of 10 description topics. Each topic lists the modules and lesson sections that teach it, and incomplete topics say what is missing.
| Description topic | Modules | Where it is taught | Status |
|---|---|---|---|
| Components of automation systems | M1 | Module 1: components of an automated system · factory levels in ISA-95 · where people fit | Covered |
| Sensors | M2 | Module 2: presence sensors · the 4–20 mA signal | Covered |
| Actuators | M2 | Module 2: actuators (solenoid valves, pneumatic cylinders, motors) | Covered |
| Relays | M2M3 | Module 2: relays and contactors: circuits and contact ratings (coil, NO/NC contacts, latching circuit, flyback diode, resistive against inductive ratings, AC-1/AC-3 utilisation categories, Example 2 choosing a relay or contactor for the station loads) · Module 3: ladder logic compared with the relay seal-in circuit | Covered |
| Sequential control | M3M5 | Module 3: ladder logic, start–stop circuit and TON timer · Module 5: the sequence as a state machine | Covered |
| Basic PLCs | M3 | Module 3: the PLC scan cycle · ladder logic · IEC 61131-3 languages and safety | Covered |
| Feedback control | M1M4 | Module 1: open loop and closed loop · Module 4: the feedback block diagram, ON/OFF, P, I and D, and integral windup | Covered |
| Industrial robots | M5 | Module 5: industrial robots: types and teaching positions (ISO 8373 definition, IFR structural types, cobots under ISO 10218-2:2025, teach pendant, lead-through, offline programming, TCP and user frames, Example 3 a landing pad moved during maintenance) · designing an automation system (Example 4 a robotic battery-swap station) | Covered |
| Device interfacing | M2M5 | Module 2: PNP and NPN, the 4–20 mA signal · Module 5: Modbus, a common language for devices, and automation inside the drone | Covered |
| Introductory automation system design | M5 | Module 5: designing an automation system (the five design questions, Example 4) and the battery-swap station design lab | Covered |
Weekly teaching plan
| Week | Topic | Pre-class | Lecture | Lab | Evidence |
|---|---|---|---|---|---|
| 1 M1 | Components of an automated system | Read module 1 up to 'Components of an automated system' | Sensor, controller, actuator, process and disturbance | Worksheet 1 part A: break down three automated systems around you | Component table for three systems |
| 2 M1 | Open loop and closed loop | Read 'Open loop and closed loop'; run Example 1, a conveyor under extra load | Why feedback holds speed under load changes and the role of gain | Worksheet 1 part B: classify open or closed loop; run Example 1 varying load and gain | Speed under load at several gains |
| 3 M1 | ISA-95 levels and the role of people | Read 'Factory levels in ISA-95' and 'Where people fit'; take the module 1 quiz | ISA-95 levels 0–4 and levels of automation | Worksheet 1 part C: draw the battery-swap station, mark ISA-95 levels and human decision points | Station diagram and quiz result |
| 4 M2 | Presence sensors | Read module 2 'Presence sensors' | Inductive, capacitive and photoelectric sensors, detectable materials and sensing range | Worksheet 2 part A: test three sensor types on metal, plastic and a battery box | Detection-range table |
| 5 M2 | PNP and NPN | Read 'PNP and NPN' | Sinking and sourcing and matching sensors to PLC input modules | Worksheet 2 part B: read labels, identify types and wire sensors to the PLC under supervision | Wiring diagram checked by the lecturer |
| 6 M2 | The 4–20 mA signal and actuators | Read '4–20 mA' and 'Actuators'; run Example 1; take the module 2 quiz | Scaling, broken-wire detection, solenoid valves and cylinders | Worksheet 2 part C: measure a 4–20 mA loop, test a broken wire and drive a cylinder | Worksheet 2 report and quiz result |
| 7 M3 | The PLC scan cycle | Read module 3 'The PLC scan cycle' | Read inputs, execute, write outputs, and the effect of scan time | Worksheet 3 part A: install CODESYS and write a start–stop circuit with E-STOP in LD | Five-case test table for the start–stop circuit |
| 8 M3 | Ladder logic and timers | Read 'Ladder logic'; run Example 1, simulating the conveyor PLC | Contacts, coils, latching and TON | Worksheet 3 part B: add a 1.0 s TON for the arm and compare with Example 1 | LD program and comparison |
| 9 M3 | IEC 61131-3, safety; midterm | Read 'IEC 61131-3 languages and safety'; review modules 1–3; take the module 3 quiz | Midterm examination (modules 1–3) | Worksheet 3 part C: write the same logic in ST and try a button press shorter than the scan | Worksheet 3 report and midterm score |
| 10 M4 | Feedback block diagram; review of rates and accumulation | Read module 4 through the review section; run review examples A and B | Setpoint, error and derivative and integral as seen in data | Worksheet 4 part A: run Example 1 with different ON/OFF hysteresis | Switching count and oscillation band |
| 11 M4 | ON/OFF, P, I and D | Read 'ON/OFF, P, I and D' | Steady-state error of P and the role of the I term | Worksheet 4 part B: raise Kp and record the steady-state error | Kp versus steady-state error table |
| 12 M4 | Integral windup and choosing a controller | Read 'Integral windup'; take the module 4 quiz | Causes of windup and how to stop accumulation | Worksheet 4 part C: windup test from a 45 °C cabinet; use a real fan rig if available | Worksheet 4 report and quiz result |
| 13 M5 | The sequence as a state machine | Read module 5 state-machine section; run Example 1 | States, transitions, timeouts and the safe state | Worksheet 5 part A: write the station state machine in CODESYS; test normal, timeout and emergency-stop cases | Test results for every state |
| 14 M5 | Modbus and automation inside the drone | Read the Modbus and in-drone automation sections; run Example 2; take the module 5 quiz | Registers, function codes and relays in ArduPilot | Worksheet 5 part B: read registers over Modbus TCP and command DO_SET_RELAY in SITL | Register readout and SITL log |
| 15 M5 | Industrial robots and mini-project presentations | Read the industrial robots and design section; run Example 3; prepare the station system diagram | The five design questions and arm capacity | Present the battery-swap station design, demonstrate the program and answer safety questions | Mini-project (design, program and presentation), scored with the rubric |
Worksheets and instructor guide
One worksheet per module. Students open it on the web, print it or download the .docx. The instructor guide under each worksheet gives the class timing, expected results, discussion questions and notes for students with different backgrounds.
1Worksheet 1 Identifying automation components around you
Analysis activity · About 6 h of class time · CLO1, CLO3
Objective: Break down automated systems, classify open and closed loops and place devices on ISA-95 levels
Equipment
- Computer with Python
- Example code at /downloads/uat-202/
- Paper or diagramming software
Safety
- Desk work and observation; do not touch powered equipment
Steps
- Choose three automated systems, e.g. an automatic door, a washing machine and a drone in Loiter
- List sensor, controller, actuator, process and disturbance for each
- State whether each is open or closed loop, with reasons
- Run Example 1, varying load and gain; record speed under load
- Draw the battery-swap station and mark each device's ISA-95 level
- State the automation level of each step and where people must decide
Deliverables
- Component table for three systems
- Results table from Example 1
- Station diagram with ISA-95 levels and human decision points
Checklist
- Table 1 has all three systems, each with sensor, controller, actuator, process and disturbance, and a reason for open or closed loop
- Table 2 has at least 6 runs including Kp = 0, every value has a unit, and the error column is 0.5 m/s minus the speed after loading
- The Example 1 code with the changed load and Kp is attached and runs, and the table values are copied from its printed output
- The station diagram marks the ISA-95 level of every device, the emergency stop button and the points where a person must decide
Instructor guide
Class timing
- Objectives, review of the sense, decide, act loop and desk-work safety30 min
- Break down three everyday systems and fill in Table 190 min
- Run Example 1, vary load and Kp, fill in Table 275 min
- Draw the battery-swap station and mark ISA-95 levels105 min
- Mark automation levels and human decision points; fill in Table 330 min
- Wrap-up, questions and hand-in checklist30 min
Expected results
- Table 1: for example, a drone in Loiter has sensors (IMU, GNSS, barometer), the flight controller, actuators (motors and propellers), position and attitude as the process, and wind as the disturbance; it is closed loop because it measures position and corrects the command. The automatic door and washing machine can be answered either way if the reasoning is right: the test is whether the system measures the result it controls, so a step that runs on a set timer without measuring whether the clothes are clean is open loop. A weak answer says every computer-controlled system is closed loop.
- Table 2 (the Example 1 model gives the same values on every computer): before the load every case is 0.500 m/s; load 0.1: Kp 0 gives 0.400 (e 0.100), Kp 8 gives 0.467 (e 0.033), Kp 20 gives 0.483 (e 0.017), Kp 40 gives 0.491 m/s (e 0.009); load 0.2: Kp 0 gives 0.300 (e 0.200), Kp 8 gives 0.433 (e 0.067), Kp 20 gives 0.467 (e 0.033), Kp 40 gives 0.482 m/s (e 0.018). Accept ±0.001 m/s for rounding.
- Table 3: conveyor and batteries at level 0; sensors, gripper valve and fan at level 1; PLC and control screen at level 2; the fleet mission-scheduling system comparable to level 3; business planning (ERP) at level 4 if the group includes it. Human decision points include at least starting a flight mission and inspecting before leaving a fault or after an emergency stop, while conveying and gripping batteries can be automatic.
- The open loop does not measure speed, so it does not know it slowed and keeps 2.0 V, while feedback adds Kp × e to the command; for example Kp 8 with e 0.033 m/s adds about 0.27 V (2.27 V). The error shrinks as Kp rises (0.033 to 0.009 m/s at load 0.1) but never reaches zero, because some error must remain to produce the extra command; the PI controller of module 4 removes it. A strong answer adds that too high a Kp can make the system oscillate.
- A strong answer: a wash step on a timer is open loop; adding a sensor that measures water cloudiness and washing until the water is clear lets the system handle clothes of different dirtiness. The answer must name the measured quantity, what uses the measurement and which disturbance it handles; naming a sensor without linking it to a disturbance is incomplete.
- The steps that should keep a human decision are starting a flight mission and restarting after a fault. If the system decided everything, a failed sensor or a battery not fully seated could let a drone take off when it is not ready. A strong answer links to the lesson's point that the level of automation depends on the consequences of failure and that people must understand enough to take over.
- Sensors are the IMU, GNSS and barometer, the controller is the flight controller, and the actuators are the motors (through the ESCs) and propellers; wind is the disturbance the feedback loop must correct. The fleet mission-scheduling system is comparable to level 3, as in the lesson. A strong answer notes that the decision to start a mission still belongs to the pilot.
Discussion questions
- Is every computer-controlled system closed loop? Give an everyday example that contradicts this belief.
- If the battery-swap station ran fully by itself, who should be responsible when a drone takes off with a battery that is not seated?
Adapting to student background
- Upper secondary (M.6)
- Have them derive the steady state v = (0.5 + 0.125Kp − load)/(1 + 0.25Kp) from the code before running it and predict Table 2 first; pair them with a peer who has wired or repaired real equipment when analysing everyday systems.
- Vocational certificate
- Start from real equipment they know, such as the building's automatic door, and have them point to each part before writing it down; hand out Example 1 with the lines to edit already marked, and read the error as lost speed.
- Diploma
- Extension: add random noise to the measured speed in Example 1, see how much a high Kp makes the voltage command jump, and propose a usable Kp.
2Worksheet 2 Testing sensors and actuators on the training rig
Lab · About 6 h of class time · CLO1
Objective: Test presence sensors, wire PNP/NPN correctly, measure a 4–20 mA loop and drive a pneumatic actuator
Equipment
- PLC training rig with 24 VDC supply
- Inductive, capacitive and photoelectric sensors
- 4–20 mA calibrator or multimeter
- Solenoid valve, pneumatic cylinder and compressor
- Metal, plastic and battery-box test pieces
Safety
- Power off before connecting or removing any wire; the lecturer checks before power-up
- Wear safety glasses with compressed air and vent pressure before removing hoses
- Keep hands and cables clear of the cylinder stroke
Steps
- Test the three sensors on the three test pieces and record detection distances
- Read sensor and input-module labels; identify PNP/NPN and sinking/sourcing
- Power off, wire to the diagram, have the lecturer check, then power up and test
- Measure the loop at 4, 12 and 20 mA and check with Example 1
- Disconnect one signal wire, observe the reading and check the program flags a fault
- Drive the solenoid valve, time the cylinder stroke and state whether it is single or double acting
Deliverables
- Detection-range table
- Checked wiring diagram
- mA versus scaled-value table and broken-wire result
- Cylinder stroke-time record
Checklist
- Table 1 has all 9 cells (3 sensors × 3 test pieces) in mm, with "not detected" written where nothing was detected
- The wiring diagram carries the lecturer's signature from the check before power-up and shows PNP/NPN and sinking/sourcing matching the labels
- Table 2 has rows for 4, 12 and 20 mA and the broken wire, and the broken-wire row shows a fault message, not a temperature
- Table 3 has at least 3 runs and records that air was vented before every hose was removed
- The answer to question 1 chooses a sensor for all three jobs, with reasons from Table 1
Instructor guide
Class timing
- Safety briefing: power off before wiring, safety glasses and venting air30 min
- Test the three sensors on three test pieces; fill in Table 175 min
- Read labels, wire up, lecturer check, then power-up test75 min
- Measure the 4–20 mA loop and test a broken wire; fill in Table 275 min
- Drive the solenoid valve and time the cylinder; fill in Table 360 min
- Wrap-up, questions and hand-in checklist45 min
Expected results
- Table 1: the inductive sensor detects only the metal piece, so the plastic piece and plastic battery box must read "not detected" (a box with metal parts may be detected on that side only). The capacitive sensor detects all three, and the photoelectric sensor detects whatever blocks or reflects its light. Distances in mm depend on the model: compare them with the sensing distance on the label or datasheet of the model used, which the measured value should not exceed. The lesson gives no distance figures.
- Table 2 (0–100 °C transmitter as in Example 1): 4 mA = 0.0 °C, 12 mA = 50.0 °C, 20 mA = 100.0 °C. If the calibrator is off by ±0.1 mA the temperature is off by about ±0.6 °C (0.1/16 × 100). The broken-wire row should read about 0 mA, which is at or below 3.6 mA, so the program must show "fault: low" rather than a negative temperature. Extra points if chosen: 8.8 mA = 30.0 °C, and 3.8 mA computes as −1.3 °C but must warn to check the sensor.
- Table 3: times depend on the rig's cylinder, air pressure and valve, and the lesson gives no figures. What matters is that repeated runs at the same pressure give similar times. A single-acting cylinder has one air port and returns by spring when the valve closes; a double-acting cylinder has two ports and uses air both to extend and to retract.
- The inductive sensor misses the plastic box because its electromagnetic field detects only metal; the capacitive sensor detects it because its electrostatic field detects metal and non-metal. As in the lesson: the metal gripper arm uses an inductive sensor, the battery box a capacitive sensor and the drone on the pad a photoelectric sensor. A strong answer cites the group's own Table 1.
- A broken wire gives about 0 mA (at or below 3.6 mA), so the program must report a fault rather than a temperature. The signal starts at 4 mA (live zero) so that a true zero can be told from a broken wire. The station must go to a safe state, such as stopping charging, and call a person to inspect.
- A PNP sensor connects the signal wire to the positive supply, so current flows out of it and it needs a sinking input that takes current in. A sourcing input also pushes current out, so no current flows through the input and the PLC sees no signal even though the sensor works (its own indicator may still light). Check the manuals of both the sensor and the input module.
- No. The fan is an inductive load, so it is checked against the 7 A rating, not 10 A, and 6 × 1.25 = 7.5 A exceeds 7 A; choose a relay or contactor with a higher rating. A strong answer explains that the magnetic energy in the coil makes an arc as the contacts open, which is why the inductive rating is lower.
Discussion questions
- If a sensor works and its own indicator lights but the PLC sees nothing, in what order would you look for the cause?
- Why would the station choose a 4–20 mA current signal over a voltage signal on long cables?
- Which station task should use a servo rather than a stepper, and how would you know a stepper had lost steps?
Adapting to student background
- Upper secondary (M.6)
- Have them work out Table 2 with x = x_min + (I − 4)/16 × (x_max − x_min) before measuring, and draw PNP and NPN current directions on paper before wiring; pair them with a hands-on peer for wiring and the multimeter.
- Vocational certificate
- Let them wire and test the real parts first and explain the principle from what they saw; hand out a partly filled mA to °C table and have them check it with the Example 1 code.
- Diploma
- Extension: design the MK-S relay connection with a flyback diode so the PLC switches the 230 V AC fan, and draw a start–stop latching circuit with relay contacts; the lecturer checks the drawing, and no 230 V is wired.
3Worksheet 3 Programming the conveyor PLC
Lab · About 6 h of class time · CLO2
Objective: Write and test LD and ST PLC programs with an emergency stop and timer, and explain scan-cycle effects
Equipment
- Computer with CODESYS Development System and a simulated PLC
- Python and the module 3 example code
- PLC training rig if available
Safety
- Mostly simulation
- If testing on a real rig, confirm E-STOP cuts the outputs before starting the conveyor
Steps
- Create a CODESYS project with a simulated PLC
- Write the start–stop circuit with E-STOP in LD as in Figure 2
- Test five cases: press START, release START, press STOP, E-STOP while running, reset E-STOP
- Add a 1.0 s TON for the arm and compare with Example 1
- Write the same logic in ST and compare readability
- Shorten the button press in Example 1 below the scan time and explain the result
Deliverables
- LD and ST project files
- Five-case test table with results
- Explanation of the short-press result
Checklist
- Table 1 has all 6 cases, including pressing START again after resetting E-STOP, and both LD and ST match the expected results
- In Table 2 the gripper timing in CODESYS matches Example 1 within one scan cycle (0.1 s)
- If a real rig was used, there is a record that E-STOP was shown to cut the outputs before the conveyor started, and STOP and E-STOP are NC contacts in the program
- Record 3 explains the result using the scan cycle and the actual times tried, and compares LD with ST on at least two points
Instructor guide
Class timing
- Objectives, review of the PLC scan cycle and emergency stop safety20 min
- Create the CODESYS project with a simulated PLC40 min
- Write the start–stop circuit in LD and test it with Table 1100 min
- Add the gripper TON and compare with Example 1; fill in Table 270 min
- Write the same logic in ST and retest70 min
- Short-press trial, wrap-up and hand-in checklist60 min
Expected results
- Table 1: press START, motor on; release START, motor stays on because the M contact holds it (seal-in); press STOP, motor off; E-STOP while running, motor off at once; release E-STOP, motor stays off; press START again, motor on. LD and ST must agree in every row; a motor that runs only while START is held means the seal-in is missing.
- Table 2 (Example 1, 0.1 s scan): motor on at 0.5 s; battery arrives at 2.0 s and the gripper closes at 2.9 s (1.0 s counted on the tenth scan); E-STOP at 4.0 s turns motor and gripper off; START at 6.0 s turns the motor on; from 6.5 to 7.0 s the battery is present only 0.5 s, so the gripper stays open; STOP at 8.0 s turns the motor off. CODESYS may differ by up to one scan (±0.1 s) depending on the task cycle set in the project.
- Record 3: a press shorter than the scan that falls between two input reads is never seen. In Example 1, a START press from 0.52 to 0.57 s (0.05 s) does not start the motor at 0.5 s, and it first starts at 6.0 s; a press that spans a read, such as 0.48 to 0.53 s, is still seen, so the result depends on timing. LD versus ST: LD looks like a relay circuit and is easy for electricians to read, while ST is shorter and handles complex conditions and calculations more easily.
- No. The seal-in needs START or M to be true; once E-STOP has made M false, releasing E-STOP alone cannot make M true again, so START must be pressed. This matches the ISO 13850 principle in the lesson that a machine must not restart by itself when the emergency stop is released. A strong answer adds that real systems need certified safety devices, not an ordinary PLC program alone.
- The battery is present only 0.5 s, short of 1.0 s continuously, so the TON never completes and resets when its input drops. With a 0.4 s TON the gripper would close at 6.8 s and open when the battery leaves at 7.0 s, and in the first window it would close earlier, at 2.3 s (simulated from Example 1). A strong answer notes that a shorter preset filters bouncing signals less.
- A signal shorter than the scan may not be seen at all. The worst-case response is about two scans, 2 × 0.1 = 0.2 s. Signals should last several scans, or use an input that captures short pulses (such as an interrupt, if the PLC model has one). A strong answer uses the group's own trial times.
- Wired NC, a broken wire opens the circuit and the machine stops by itself, which is safe. Wired NO, a broken wire means pressing stop sends no signal to the PLC, so the machine cannot be stopped, and nobody knows until it is needed.
Discussion questions
- If two rungs write the same output, what happens, and how would you find this mistake in a long program?
- Which station tasks suit LD, and which suit ST or SFC?
Adapting to student background
- Upper secondary (M.6)
- Have them write the truth table of M = (START ∨ M) ∧ STOP_NC ∧ ESTOP_NC before programming, and trace the first three scans of Example 1 by hand to see read, execute and write.
- Vocational certificate
- Start from the familiar relay seal-in circuit and convert it to LD contact by contact; get LD passing every case first, and let them edit ST from a prepared template.
- Diploma
- Extension: test on the real PLC rig after the lecturer checks the E-STOP, and add a rung that counts passing batteries with a counter, with their own test cases.
4Worksheet 4 Tuning a temperature controller
Lab · About 6 h of class time · CLO2, CLO3
Objective: Compare ON/OFF, P and PI control, test windup and choose a controller for the charging cabinet
Equipment
- Python and the module 4 example code
- Temperature-sensor and fan rig via PLC or microcontroller (if available)
Safety
- Mainly simulation
- With a real rig, keep clear of fan blades and heat sources and stay below the lecturer's temperature limit
Steps
- Run Example 1 with hysteresis of ±0.2 and ±1.0 °C; record switching count and band
- Set P gain Kp to 0.6 and 1.2; record steady-state error and explain why it does not vanish
- Remove the line that stops I accumulation; start from a 45 °C cabinet and compare with anti-windup
- With a rig, implement ON/OFF with hysteresis on a real fan and record the graph
- Conclude which controller the charging cabinet should use, with reasons
Deliverables
- Tables and graphs comparing ON/OFF, P and PI
- Graphs with and without anti-windup
- Controller recommendation for the cabinet
Checklist
- Every row of Tables 1 to 3 comes from the group's own runs with units, and Table 1 covers ±0.2, ±0.5 and ±1.0 °C
- The edited code is attached, the line removed for the windup trial is marked, and the code runs
- Every graph has axis names, units and the 30 °C target line
- The recommendation includes a safety limit, such as cutting charging on overheat, and with a real rig records that the lecturer's temperature limit was never exceeded
Instructor guide
Class timing
- Objectives, review of the cabinet model and rig safety20 min
- Run ON/OFF with three hysteresis bands; fill in Table 170 min
- Run P with three Kp values and PI; fill in Table 270 min
- Windup trial from a 45 °C cabinet; fill in Table 380 min
- Real rig: ON/OFF with a temperature sensor and fan (without a rig, use the time to plot and compare the simulations)80 min
- Controller recommendation, questions and hand-in checklist40 min
Expected results
- Table 1 (Example 1 model, cabinet starting at 32 °C, one hour simulated): ±0.2 °C oscillates 29.79–30.21 °C with 127 fan switches; ±0.5 °C, 29.50–30.51 °C with 52 switches (as in the lesson); ±1.0 °C, 28.99–31.01 °C with 27 switches. The same code must give these values. On a real rig a swing slightly wider than the band is normal, because the sensor and the cabinet air respond slowly.
- Table 2: P with Kp 0.3 settles at 31.68 °C (error 1.68 °C, u 0.505), Kp 0.6 at 30.86 °C (error 0.86 °C, u 0.519), Kp 1.2 at 30.44 °C (error 0.44 °C, u 0.526); PI settles at 30.00 °C (error 0, u 0.533). Check with the heat balance T = (Q + 600Kp × 30 + h × Ta)/(600Kp + h), with Q = 300 W, h = 10 W/K, Ta = 32 °C. Accept ±0.01 °C.
- Table 3 (Kp 0.3, Ki 0.002 as in Example 1, starting at 45 °C): with anti-windup it reaches 30 °C at 15.2 min, dips to 29.66 °C and holds 30.00 °C over the last 20 min; without it, it reaches 30 °C at 14.3 min but cools to 20.56 °C (at about 28 min) and still swings 29.70–33.42 °C over the last 20 min. Accept ±0.1 min and ±0.05 °C.
- A narrow band (±0.2 °C) holds the temperature tighter but switches the fan 127 times an hour; a wide band (±1.0 °C) needs only 27 switches but swings 2 °C. A strong answer picks a middle band such as ±0.5 °C, or argues that the batteries tolerate a 1–2 °C swing, and never uses ON/OFF without hysteresis.
- The cabinet needs about u = 0.53 to sit exactly at 30 °C. A P controller makes its command only from the error (u = Kp × e), so some error must remain to give u near 0.5; for example Kp 0.6 needs 0.86 °C. A higher Kp needs less error but never zero, and too high a Kp risks oscillation. The I term accumulates error until it supplies the needed u by itself, even with zero error.
- Starting at 45 °C the fan is already at full (u = 1) but it is still hot, so the I term keeps accumulating with no effect. When the cabinet reaches 30 °C, the excess still drives the fan hard, so it cools to about 20.6 °C, then overheats past the target and still swings 29.70–33.42 °C after 40 minutes. The version that pauses accumulation while saturated dips only to 29.66 °C. A strong answer uses the group's numbers and explains that the fix is to stop accumulating while the command is saturated.
- A strong answer: PI with anti-windup, because it has no steady-state error, does not oscillate and does not switch the fan often; D is not needed because temperature changes slowly and D is sensitive to noise (if the fan cannot vary its speed, use ON/OFF with hysteresis). A safety limit separate from the controller is also required, such as cutting charging on overheat and when the temperature sensor signal fails (module 2).
- The flight controller uses the same PID feedback, only much faster, holding attitude hundreds of times a second. When the motors hit their limits (the command saturates), the I term winds up just as in the cabinet, making the drone overshoot or oscillate afterwards, so PX4 limits the I term in its rate loop.
Discussion questions
- What happens on a real system with a slow sensor if Kp keeps rising, and can the Example 1 model show this?
- Why should a real system never be tuned without safety limits? Give an example of the damage possible in a lithium battery charging cabinet.
Adapting to student background
- Upper secondary (M.6)
- Have them solve the P steady state from the balance Q − P_max u − h(T − Ta) = 0 by hand before running and compare with Table 2, linking the I term to the area under the graph in the review section.
- Vocational certificate
- Focus on the real rig: let them see the fan switch with temperature first, then change one number at a time in the code from a prepared table; explain P and I by analogy, P presses the accelerator by how far short you are, I keeps pressing harder while you are still short.
- Diploma
- Extension: implement PI with anti-windup on the rig's PLC or microcontroller, drive the fan speed with PWM, and compare its graph with ON/OFF within the lecturer's temperature limit.
5Worksheet 5 Designing the battery-swap station
Lab · About 6 h of class time · CLO2, CLO3
Objective: Design the station sequence as a state machine, link devices with Modbus TCP, command a drone relay and draw the overall system
Equipment
- CODESYS with a simulated PLC and Modbus TCP server
- Computer on the lab's internal network
- ArduPilot SITL and a mission planner
- Python and the module 5 example code
Safety
- Simulation and internal network only; no real flights
- Expose Modbus only on the lab network because the protocol has no authentication
Steps
- Write the state machine in SFC or ST as in Figure 1 with a timeout for each state
- Test normal, timeout in every state and emergency stop; compare with Example 1
- Start the Modbus TCP server and read registers from a PC program; check against Example 2
- Configure a relay in SITL, command DO_SET_RELAY in a mission and check the log
- Compute arm capacity with Example 4
- Draw how drone, station and mission system communicate and where emergency stops are needed
Deliverables
- State-machine program and test table
- Register readout and SITL log
- Capacity calculation
- System diagram with emergency-stop points
Checklist
- Table 1 has the normal case, a timeout in all four timed states (LOCK, SWAP, CHECK, RELEASE) and an emergency stop, and every case passes
- Table 2 has the 12 request bytes matching Example 2, both register values, and the relay state before and after the command from the log
- It states that Modbus TCP ran only on the lab's internal network and that no real flight or fitted propellers were used during relay tests
- The system diagram shows how drone, station and mission system communicate, with emergency-stop points, and Record 3 shows every calculation step with units
Instructor guide
Class timing
- Objectives, network safety and simulation-only testing20 min
- Write the state machine in SFC or ST with a timeout for every state90 min
- Test normal, timeout and emergency-stop cases; fill in Table 160 min
- Start the Modbus TCP server and read registers; fill in Table 260 min
- Configure a relay in SITL, command DO_SET_RELAY and check the log60 min
- Capacity calculation, system diagram, wrap-up and hand-in checklist70 min
Expected results
- Table 1 (timeouts as in Example 1: LOCK 5, SWAP 20, CHECK 5, RELEASE 5 s): normal case landed 0, locked 2, swapped 15, voltage_ok 17, released 19 s ends in IDLE; LOCK timeout (locked at 6 s) gives FAULT at 6 s; SWAP timeout (swapped at 30 s) gives FAULT at 30 s; CHECK timeout (voltage_ok at 21 s) gives FAULT at 21 s; RELEASE timeout (released at 23 s) gives FAULT at 23 s; an emergency stop at 10 s during SWAP gives FAULT at once. FAULT must hold until a person resets it. Groups using other event times may get other results as long as they follow the timeout rules.
- Table 2: the request to read 2 holding registers from address 0 on device 1 must be 00 01 00 00 00 06 01 03 00 00 00 02 (12 bytes, sent to TCP port 502). Both register values must match what the CODESYS program wrote, such as station status and the number of ready batteries, which depend on the group's program. The relay state in the log must change at the DO_SET_RELAY item in the mission.
- Record 3 (Example 4 assumed values: 6 drones, 20-minute sorties, steps 20 + 25 + 25 + 15 + 10 s): a 95 s cycle gives 3600/95 = 37.9, about 38 swaps an hour; demand is 6 × 60/20 = 18 swaps an hour, so arm utilisation is 18 × 95/3600 = 47.5% (about 48%); at no more than 80% one station serves at most 10 drones (0.8 × 3600/95 × 20/60 = 10.1, rounded down to 10, which uses 79.2%). The diagram should show the drone talking to the mission system over its control link, and the mission system querying the station PLC over Modbus TCP on the internal network.
- FAULT means something went wrong whose cause the system does not know, such as a jammed gripper or a battery not seated; exiting by itself could let a drone take off with an unlocked battery. Before resetting, a person should check why it timed out, the battery position and voltage, the gripper and clamps, and that nobody is inside the working area.
- With no authentication or encryption, anyone on the same network can send read or write commands to coils and registers, for example moving the gripper or setting the station status to ready when it is not. A strong answer says the group ran Modbus only on the lab's access-controlled internal network, never on the internet, and mentions OPC UA, which has security built in, as an alternative.
- At the original values one station serves 10 drones. With a 30 s self-test the cycle becomes 110 s, capacity 3600/110 = 32.7 swaps an hour, and 0.8 × 3600/110 × 20/60 = 8.7, rounded down to 8 drones; with 6 drones the arm is busy 55.0%. A strong answer rounds the drone count down, not up.
- Emergency stops belong at the station (cutting the arm, conveyor and air) wherever people can reach the working area, and in the mission system's control room. A DO_SET_RELAY command is a message over a link and ordinary software, which can drop or be delayed, while an emergency stop must cut power by itself under ISO 13850 principles, using certified safety devices.
Discussion questions
- If the mission system sends a drone for a battery swap while the station is in FAULT, how should the two systems be designed to know about each other?
- Why must a flight controller's inner loop be tuned stable before the outer loop, and where does this resemble the station design?
Adapting to student background
- Upper secondary (M.6)
- Have them write the full transition table (current state, event, next state) before programming and explain each field of the Modbus request byte by byte; pair them with a tool-savvy peer when setting up SITL.
- Vocational certificate
- Let them run Examples 1 and 2 first and change event times one at a time before writing SFC in CODESYS; hand out a system-diagram template with drone, station and mission-system boxes, to which they add the links and emergency-stop points.
- Diploma
- Extension: write a PC program that reads the station status over Modbus every second and sends the SITL drone to land only when the station is ready, then test the case where the station enters FAULT while the drone is on its way.
Scoring rubric
For worksheets and the mini-project. Each criterion scores level (1–4) ÷ 4 × weight.
| Criterion | Weight | Excellent (4) | Good (3) | Fair (2) | Needs work (1) |
|---|---|---|---|---|---|
| Correctness of control logic and programs | 30% | Programs pass every test case including timeouts and faults; scan behaviour explained | All main cases pass; some edge cases missing | Works in some cases; logic errors present | Program does not work or was not tested |
| Device wiring, measurement and test evidence | 25% | Correct wiring first time; measurements match calculations; complete tables and graphs | Correct after minor fixes; data nearly complete | Needed much help or data partly missing | Wrong wiring type or no evidence |
| Safety in design and practice | 20% | Emergency stops and safe states everywhere; always follows power and air isolation steps | Nearly complete | Key points missing or steps sometimes skipped | Safety not considered |
| System design and communication | 25% | Clear diagrams and report; choices tied to measurements; precise answers to questions | Clear with minor flaws | Hard to follow or reasons partly missing | Design not communicated |
Assessment map: CLOs and how they are assessed Draft
The CLOs are a web-team draft; the course owner sets the final ones (curriculum book, part 4). This table is built from the worksheet and module-quiz data, so it follows any change to the CLOs.