Cyber-Physical Systems (BIL-435), week 8 of 14
Prof. Dr. Utku Kose, Süleyman Demirel University
Three parts of this interactive lab are virtual laboratories in three dimensions (3D) with the hardware in the foreground. Part A puts a Modbus bus on the bench, with a controller, three devices and an oscilloscope. Part B lets you configure the subscribers of an MQTT broker that runs on a Raspberry Pi. Part C runs the frequency loop of the microgrid through a network whose delay you set. Parts A and C also compute the formulas of the lecture step by step, and Part D asks for the values of stage 8 by hand. Part E is a field task with a new meter on the bus of the battery container. In the calculators every intermediate value is rounded, and the next step continues with the rounded value. The results of Parts A, B and C can be copied into the Colab notebook. Each laboratory first shows its room. Start moves the view to the bench, and the view returns to the room at the end. The laboratories work best with a mouse or a touchpad on a computer.
The bench holds the controller of the battery container on the left and three devices on the mounting rail. They are the container meter with address 1, the battery inverter with address 2 and the battery management system (BMS) with address 3. A twisted pair, the RS-485 bus, runs from the controller from device to device, and the probe of the oscilloscope sits on the bus. The controller reads 10, 20 and 40 registers from the three devices, and each device answers after 5 ms.
Play four rounds. In each round, first predict the time of the poll in milliseconds with the formula of the lecture. Then press Poll and watch the frames on the cable and on the oscilloscope. The poll runs in slow motion, and the controller measures its real duration. One round hides a fault on the bus: Find it and click the part of the bench that repairs it. In the last round, choose the baud rate yourself.
| Round | Baud | Devices | Predicted (ms) | Measured (ms) | CRC errors | Result |
|---|
The calculator below repeats the worked example of the poll time one step at a time. Its sliders set the baud rate, the number of registers and the reply delay. The figure shows the transaction on the line.
Back to the lecture: Modbus: Polling the field devices, where the text continues after the box of this part.
Continue in Colab, section 1: Paste your rounds into MY_BENCH and compare your predictions with the model.
The bench of the control room holds the MQTT broker of the campus, a Raspberry Pi joined to an Ethernet switch. On the mounting rail behind it, nine devices publish twelve topics, such as campus/b2/meter/power. Three clients subscribe: The data logger on the bench, the dashboard on the wall and the battery controller at the end of the rail.
Play six missions. In the first five, type the topic filter of the named subscriber, or several filters separated by semicolons, and press the button. The devices publish once, and the broker forwards each message to the subscriber only if a filter matches. The mission is solved when the subscriber receives exactly the topics it needs. The sixth mission asks for the packets of a quality of service.
| Mission | Subscriber | Your filters or answer | Received | Wanted | Result |
|---|
Back to the lecture: MQTT: Publish and subscribe, where the text continues after the box of this part.
Continue in Colab, section 2: Paste your filters into MY_TOPICS and check them mission by mission.
The microgrid runs as an island. Its battery container stands next to the car park. The microgrid controller in the rack measures the frequency at the point of common coupling and sends power set points to the battery inverter. Between them sits a network emulator, a box that delays every message by the time set on its dial. When three cars plug in at the chargers, 66 kW of load switch on, and the battery has to answer.
Find the largest delay at which the frequency still settles. Set the delay and the gain below the view and press Plug in the cars. The trace on the screen shows the frequency deviation. The run ends as settled, as growing or as tripped, when the under-frequency relay disconnects the loads below 47.5 Hz. Try as many delays as you need, then enter your estimate of the boundary.
| Trial | Delay (s) | Gain (kW/Hz) | Lowest deviation (Hz) | Outcome |
|---|
The calculator below repeats the worked example of the delay margin one step at a time. Its sliders set the inertia, the damping and the gain. The figure shows the delay margin against the gain.
Back to the lecture: Control over a network, where the text continues after the box of this part.
Continue in Colab, section 4: Paste your trials into MY_LOOP and compare your boundary with the delay margin.
The battery container polls a meter with 10 registers, an inverter with 20 and a battery management system with 40. The line runs at 19200 baud, and each device replies after 5 ms. The Colab notebook gives a poll cycle of 129.6 ms. Check it to one decimal. Then add the loop delay through the campus server: Half of a sampling period of 0.2 s, 0.15 s up, 0.05 s in the controller and 0.10 s down. Finally, compute the share of the delay margin of 1.072 s that the loop keeps, in percent to one decimal.
Back to the lecture: The campus microgrid, stage 8: The communication design with a delay budget, where the text continues after the box of this part.
Continue in Colab, section 5: Compute the results of stage 8 of the campus microgrid.
The battery container gets a fourth device on its RS-485 bus: A meter for its auxiliary supply, the air conditioning and the fans. The installer has mounted and wired it at the end of the bus, behind the BMS. The meter still has the settings of its maker. The controller of the container polls the addresses 1 to 4 and checks every answer with its cyclic redundancy check (CRC). Both the BMS and the new meter have a switch for their termination resistor.
The keys work as on the real device. The keys ▲ and ▼ choose a line, OK opens it or starts and saves a change, and the escape key (ESC) goes back. A number changes digit by digit: ◀ and ▶ choose the digit, and ▲ and ▼ change it. On a computer, the arrow keys, Enter and Escape work as well, once the front panel has been clicked.
Back to the lecture: In the field: A new device on the bus, 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.