Cyber-Physical Systems (BIL-435), week 7 of 14
Prof. Dr. Utku Kose, Süleyman Demirel University
Two parts of this interactive lab are virtual laboratories in three dimensions (3D) with the hardware in the foreground. Part A records the schedule of the controller of the battery container on a bench with a logic analyzer. Part C opens the cabinet of the programmable logic controller (PLC) of the main switchboard. Part B computes the formulas of the lecture step by step, and Part D asks for the values of stage 7 by hand. Part E is a field task with the PLC and its programming software, as on site. In the calculator every intermediate value is rounded, and the next step continues with the rounded value. The results of Parts A and C can be copied into the Colab notebook. Each laboratory first shows its room. Start moves the view to the bench or the cabinet, and the view returns to the room at the end. The laboratories work best with a mouse or a touchpad on a computer.
The controller bench holds the embedded controller of the battery container with its real-time operating system. Each task sets one output pin while it runs, and a logic analyzer records the four pins. The screen shows 200 ms, two hyperperiods, with the releases as grey marks and every missed deadline as a red cross.
Choose the scheduler, the execution time of the battery management task and the Modbus task below the view and press Run. Your missions: First, run three tasks and four tasks under rate-monotonic (RM) scheduling with 5 ms for battery management. Second, find the execution time at which RM misses a deadline while the utilization stays below 1, and run the same case under earliest deadline first (EDF). Third, overload the processor and run it under both schedulers to compare which tasks miss their deadlines.
| Run | Scheduler | Battery management (ms) | Modbus | Utilization | Missed deadlines | Missed by task | Worst response of Modbus (ms) |
|---|
Back to the lecture: Earliest deadline first, where the text continues after the box of this part.
Continue in Colab, section 3: Paste your runs into MY_RUNS and compare them with the model.
The calculator follows the formulas of the lecture. It computes the utilization of the four tasks of the controller and the response times of battery management and Modbus under RM for the chosen execution times. It then checks the test of EDF and the worst reaction of the PLC of the main switchboard for the chosen program.
Back to the lecture: Earliest deadline first, where the text continues after the box of this part.
Continue in Colab, section 3: Compare RM and EDF for the tasks of the controller.
The PLC cabinet of the main switchboard holds the power supply and the central processing unit (CPU) of the PLC. Beside them sit a module of digital inputs and a module of relay outputs. Input I0 reads an auxiliary contact of the grid breaker Q1. Output Q0 drives the contactor Q2 of the car park feeder, which opens when the campus loses the grid. A trip recorder measures each reaction from the input terminal to the output terminal.
Set the size of the program below the view and press Trip the breaker 20 times. Your missions: First, run at least three sizes of the program and compare the longest reaction with the worst case. Second, find the largest program, in thousand instructions, whose worst case stays within 50 ms. Third, enlarge the program until the watchdog stops the PLC.
| Run | Program (thousand instructions) | Scan time (ms) | Trips | Shortest (ms) | Mean (ms) | Longest (ms) | Worst case (ms) | Result |
|---|
Back to the lecture: The PLC scan cycle, where the text continues after the box of this part.
Continue in Colab, section 4: Paste your runs into MY_PLC and compare them with the model.
A faster driver lets the Modbus task finish in 6 ms instead of 9 ms, with 5 ms for battery management. Compute the utilization of the four tasks to two decimals. Then compute the response time of the Modbus task under RM in ms. Finally, compute the worst reaction of a PLC with a scan time of 12 ms, an input filter of 3 ms and a relay of 6 ms.
Back to the lecture: The campus microgrid, stage 7: Real-time tasks of the microgrid controller, where the text continues after the box of this part.
Continue in Colab, section 5: Compute the results of stage 7 of the campus microgrid.
The PLC of Part C switches the car park feeder with the program Q0 := I0. The operator of the campus asks for a change, and the engineer brings a laptop with the programming software. Its editor holds the new program with three gaps to fill. The CPU module of the PLC has a key for each of its two modes, run and stop. The online monitor of the laptop shows the variables of the running program.
Back to the lecture: In the field: Changing the program of the PLC, where the text continues after the box of this part.
Answer each question, rate your confidence and check the answer. The self-assessment is for your own practice and does not count towards the grade. Results stay in this browser.
Write a short answer to each question. The text is saved in this browser and is included when you export the learning log, together with the results of the practice parts.