Updated
Updated
Updated
The railroad controller represented in the figure below is supposed to be a safe solution for two railroad
circuits sharing a single bridge (Illustration of the circuits is given es well.)
(a) Four lines of code in the controller are redacted: write what those lines should contain. Explain the
reasoning (and the pitfalls of simplistic solutions for this problem!)
.(b) Draw the reachable subgraph of this controller. Discuss the difference between the full graph and this
subgraph, and explain what the subgraph proves
(c) For some peculiar reason, the railway company wants to add multiple circuits to this system in the
future, so that the bridge is shared by even more trains. Flow would you restructure the controller for that,
and what might be the sources of technical debt in such a system subject to scaling?
a)Assuming that the goal is to control the signals and prevent collisions, the redacted lines might include
logic for checking the status of the bridge and managing train movements. Here's a generic example in
pseudocode:
code
# Initial state
{green, red} signalw
{green, red} signalE
west := red
east := red
bool nearw := 0
bool nearE := 0
# Events
Event {arrive, leave} outw
Event {arrive, leave} outE
# Rules
A1: If West --> signalw
A2: If East --> signalE
A3: If west, east, outE, outw, nearE, nearw
---> east, west, nearw, nearE
# State transitions based on events
if outE? arrive then nearE := 1
if outE? leave then nearE := 0
if outw? arrive then nearw := 1
if outw? leave then nearw := 0
if <condition> then east := red
else if <condition> then east := green
if <condition> then west := red
else if <condition> then west := green
# Conditions for signal changes
{green, red} signal
{green, red} signalE
The status of the bridge and managing train movements.
# Redacted lines of code in the controller
# Check if the bridge is clear before allowing a train to cross
if bridge_is_clear():
# Allow the train to cross
allow_train_to_cross()
else:
# Prevent the train from crossing and implement a waiting mechanism
wait_for_clearance()
# Function to check if the bridge is clear
function bridge_is_clear():
# Logic to check if the bridge is not occupied by another train
# Return True if the bridge is clear, False otherwise
# Function to allow a train to cross the bridge
function allow_train_to_cross():
# Logic to control the signals and allow the train to cross the bridge
# Function to implement a waiting mechanism
function wait_for_clearance():
# Logic to manage the waiting mechanism, such as queuing trains or delaying movement
b)Reasoning:
1. Checking Bridge Clearance: The controller needs to ensure that the bridge is clear before
allowing a train to cross. This involves checking the status of the bridge and deciding whether it's
safe for a train to proceed.
2. Allowing Train to Cross: If the bridge is clear, the controller should implement the logic to
allow the train to cross safely.
3. Waiting Mechanism: If the bridge is not clear, the controller should implement a waiting
mechanism. This might involve queuing trains or delaying their movement until the bridge
becomes available.
Pitfalls of Simplistic Solutions:
1. Deadlocks: A simplistic solution might overlook scenarios where multiple trains approach the
bridge simultaneously, leading to potential deadlocks or collisions.
2. Inefficient Resource Usage: The controller might not optimize the use of the bridge, leading to
inefficient resource allocation and potential delays.
3. Lack of Scalability: A basic solution may not be easily scalable to accommodate more complex
railway systems with multiple circuits and trains.
Graph Draw Code
Initial State: {green, red} signalw
{green, red} signalE
west := red
east := red
nearw := 0
nearE := 0
c)
Explanation of the Subgraph:
The reachable subgraph essentially proves that, under normal operating conditions, the system can
transition between a specific set of states. It demonstrates the feasible behaviors of the railroad controller
and helps ensure that, during regular operations, the system remains within a safe and controlled state
space.
By studying the reachable subgraph, developers and engineers can gain insights into how the controller
manages train movements, responds to events, and ensures the safety of the railway system. It's a valuable
tool for both analysis and validation of the control system's behavior.
Significance of the Reachable Subgraph:
1. Safety Analysis:
The reachable subgraph provides insights into the system's safe operational states. It
helps identify states where collisions or unsafe conditions could occur.
2. Behavioral Analysis:
Focuses on the actual behavior of the system during regular operation. This is essential
for understanding how the controller responds to events and manages train movements.
3. Efficiency Assessment:
By excluding unreachable states, the reachable subgraph can be used to assess the
efficiency of the controller in terms of resource utilization and avoiding unnecessary
delays.
4. Debugging and Testing:
Provides a subset of the graph that can be used for testing and debugging. It allows
developers to focus on scenarios that are likely to occur in practice.
On a simplified model of a motorway, drivers choose their lanes according to the Information about the
expected duration of their trip: large displays inform them about estimated time of arrival for each of the
lanes, and they select accordingly (all lanes lead to the same destination).
(a) In terms of positive, negative feedback loops, and other systems theoretic concepts you have learned,
explain the dynamics of such a system: where will drivers go, what effects will they cause?
(b) Try proposing a solution for the motorway authority: what information the displays could show to
improve the routing of the cars on the motorway?
(c) Imagine, for a moment, a somewhat similar scenario. In a futuristic setup, flying mobile charging
stations for electric vehicles are deployed around Dublin by the following simple strategy: the higher the
density of traffic Is In a part of the city, the more flying charging stations are deployed there. What are the
advantages and disadvantages of such a scheme from the systemic point of view? What improvements to
strategy, If any, would you propose? What are the parameters the success of this deployment relies on?
Question: 2
(a) Dynamics of the Motorway System:
Positive Feedback Loop: Drivers choosing lanes with shorter estimated time of arrival (ETA) will
experience faster travel times.
As more drivers switch to faster lanes, those lanes will become more crowded, potentially increasing the
ETA.
Negative Feedback Loop: As lanes become more crowded due to increased traffic, the ETA for those
lanes will increase.
Higher ETAs might discourage drivers from choosing crowded lanes, leading to a redistribution of traffic.
Systems Theoretic Concepts:
Equilibrium: The system may reach an equilibrium where each lane has a certain level of congestion, and
drivers distribute themselves among lanes to minimize their travel time.
Adaptation: Drivers adapt their lane choices based on real-time information displayed on the large
screens.
(b) Proposed Solution for the Motorway Authority:
To improve routing on the motorway, the displays could show additional information such as:
Traffic Flow Rate:
Indicate the rate of vehicles passing through each lane per unit time.
Drivers may choose lanes with a more consistent and higher flow rate.
Historical Travel Time Data:
Display historical travel time data for each lane during the same time period on previous days.
Help drivers anticipate trends and choose lanes with historically shorter travel times.
Dynamic Lane Management:
Implement a smart system that dynamically adjusts speed limits or lane configurations to
optimize traffic flow.
Direct drivers to lanes that are underutilized to balance traffic distribution.
(c) Advantages and Disadvantages of Flying Mobile Charging Stations:
Advantages:
Flexibility: Charging stations can be deployed where needed, addressing congestion and demand
dynamically.
Reduced Range Anxiety: Increases the appeal of electric vehicles by providing on-the-go charging
support, reducing concerns about running out of battery.
Optimized Resource Allocation: Allocating charging stations based on traffic density optimizes resources
and minimizes unused charging stations.
Disadvantages:
Infrastructure Costs: Deploying and maintaining a fleet of flying charging stations can be expensive.
Traffic Congestion: The presence of charging stations might attract more vehicles, contributing to
increased traffic in certain areas.
Navigation Challenges: The airspace management and coordination of flying charging stations could be
complex, requiring robust navigation systems.
Improvements and Parameters for Success:
Efficient Deployment Algorithm: Develop algorithms that consider both current traffic density
and predicted traffic patterns to optimize charging station deployment.
Fast-Charging Technology: Implement fast-charging technologies to minimize the time vehicles
spend at charging stations.
Communication and Coordination: Establish effective communication between charging stations
and vehicles to ensure optimal utilization and avoid congestion in the charging process.
Energy Source: Ensure the charging stations use sustainable energy sources to minimize
environmental impact.
Parameters for Success:
User Adoption: The success relies on users adopting electric vehicles and utilizing the flying
charging stations.
System Reliability: The reliability and efficiency of the charging stations in providing fast and
consistent charging.
Traffic Management: Effective coordination with existing traffic management systems to avoid
causing or exacerbating congestion.
Question: 3
Consider a bouncing ball system, In which you are observing the one-dimensional dynamics of a ball
falling from a given height, bouncing off a surface, falling to the surface again, etc.
(a) Write a pseudo-code that would compute the position of the ball x(t) by using the spring bouncing
approxlmatIve model. You can assume that differential equations are solved once you write them
into the code (like In Acumen). Discuss the modelling choices you make (parameters, forces to
include, etc).
(a) Pseudo-code for Bouncing Ball System:
# Constants
gravity = 9.81 # m/s^2, acceleration due to gravity
ball_mass = 0.1 # kg, mass of the ball
spring_constant = 100.0 # N/m, spring constant
damping_coefficient = 0.1 # Ns/m, damping coefficient
initial_height = 1.0 # m, initial height of the ball
initial_velocity = 0.0 # m/s, initial velocity of the ball
# Simulation Parameters
time_step = 0.01 # s, time step for numerical integration
total_time = 10.0 # s, total simulation time
# Initial Conditions
position = initial_height
velocity = initial_velocity
# Simulation Loop
for t in range(int(total_time / time_step)):
# Compute forces
gravitational_force = ball_mass * gravity
spring_force = -spring_constant * position
damping_force = -damping_coefficient * velocity
# Compute acceleration using Newton's second law (F = ma)
acceleration = (gravitational_force + spring_force + damping_force) / ball_mass
# Update position and velocity using numerical integration (Euler's method)
position = position + velocity * time_step + 0.5 * acceleration * time_step**2
velocity = velocity + acceleration * time_step
# Check for collision with the ground (simple reflection model)
if position < 0:
position = -position
velocity = -velocity
# Print or store the position at each time step
print(f"Time: {t * time_step:.2f}s, Position: {position:.4f}m, Velocity: {velocity:.4f}m/s")
Modeling Choices:
Forces Included:
Gravity: Represents the gravitational pull on the ball.
Spring Force: Models the force exerted by a spring-like surface when the ball hits it.
Damping Force: Accounts for damping effects, such as air resistance.
Parameters:
gravity: Represents the acceleration due to gravity.
ball_mass: Mass of the ball affects the gravitational force.
spring_constant: Models the stiffness of the surface.
damping_coefficient: Represents the damping effects.
Numerical Integration:
Euler's method is used for simplicity. More advanced methods like Runge-Kutta can be
used for better accuracy.
(b) (b) In part (a) you were supposed to include some ordinary differential equations (ODE)
governing the motion of the ball. We often make the point that ODE can be replaced with transfer
functions in modelling: this is not necessarily the case for this problem. Why would a transfer
function not be a good model paradigm here?
some ordinary differential equations (ODEs) that govern the motion of the ball in the bouncing
ball system. We'll use a simple spring-damping model for the ball's motion, considering the
gravitational force, spring force, and damping force. The ODEs can be expressed as follows:
Here:
m is the mass of the ball,
g is the acceleration due to gravity,
x is the displacement of the ball from its equilibrium position,
k is the spring constant representing the stiffness of the surface,
c is the damping coefficient representing damping effects.
To solve these ODEs numerically, we'll use a simple numerical integration method like Euler's method.
The corresponding pseudo-code would look like this:
# Constants
m = 0.1 # kg, mass of the ball
g = 9.81 # m/s^2, acceleration due to gravity
k = 100.0 # N/m, spring constant
c = 0.1 # Ns/m, damping coefficient
# Initial Conditions
x = 1.0 # Initial displacement
v = 0.0 # Initial velocity
# Simulation Parameters
time_step = 0.01 # s, time step for numerical integration
total_time = 10.0 # s, total simulation time
# Simulation Loop
for t in range(int(total_time / time_step)):
# Compute forces
gravitational_force = m * g
spring_force = -k * x
damping_force = -c * v
This pseudo-code includes the ordinary differential equations that govern the motion of the ball and uses
Euler's method for numerical integration. It simulates the motion of the ball, accounting for gravitational,
spring, and damping forces, as well as the collisions with the surface.
(c) (c) Assume now the existence of a robotic arm swinging a paddle and hitting the ball. Ignoring
the problems of control, aim, etc, write the pseudo-code that would estimate the power
consumption of this robotic arm. Discuss the Inputs that you need to have and assumptions that
you have to make (Acumen ping pong model does a very similar computation).
Pseudo-code to estimate the power consumption of a robotic arm swinging a paddle and hitting a ball.
We'll consider the kinetic energy of the robotic arm as the main factor contributing to power
consumption. This is a simplified model
# Constants
efficiency_factor = 0.9 # Efficiency factor of the robotic arm
time_step = 0.01 # s, time step for numerical integration
total_time = 10.0 # s, total simulation time
# Simulation Parameters
angular_velocity = 2.0 # rad/s, angular velocity of the robotic arm
moment_of_inertia = 0.5 # kgm^2, moment of inertia of the arm
# Initial Conditions
angular_position = 0.0 # Initial angular position
angular_velocity = 2.0 # Initial angular velocity
# Power Calculation
power_consumption = 0.0
# Simulation Loop
for t in range(int(total_time / time_step)):
# Compute torque applied by the robotic arm
torque = moment_of_inertia * angular_velocity
# Update angular position and velocity using numerical integration (Euler's method)
angular_position = angular_position + angular_velocity * time_step
angular_velocity = angular_velocity # assuming no external torques affecting angular velocity
a) You are In charge of designing a solution for the management of drones flying from A to B, they
would be charged a toll for the route they are about to choose at departure, and the toll would
change dynamically based on the number of the drones already flying on the route. In other
words, the toll T, for the lane 1 would be a function of the number of drones on the lane 1, and
the carrying capacity C1. (number of drones lane 1 can take without causing congestions)—same
for lane 2. Suggest a mechanism for this. Explain what type of feedback loop it is. Sketch plots of
drone numbers per lane with respect to time under your proposed scheme.
b) When Implementing your proposed scheme, the programmer accidentally switched the signs, so
the toll was getting cheaper when It was supposed to get more expensive and vice versa. The
investor, however, liked the end result and decided to keep it as is. What could be the reason for
this? Sketch the plots of drone numbers per lane again, and discuss the type of feedback loop.
Let's define n1 as the number of drones on Lane 1, n2 as the number of drones on Lane 2, C1 as the
carrying capacity of Lane 1, and C2 as the carrying capacity of Lane 2.
The toll function for Lane 1 ( T1) and Lane 2 (T2) could be defined as:
T1 – k1 .1 – n1/c1
T2 – k2 .1 – n2/c2
where k1 and k2 are constants that determine the rate at which the toll changes with
respect to the drone count.
This mechanism ensures that as the number of drones on a lane approaches its capacity,
the toll for that lane increases, encouraging drones to choose the less congested lane.
Sketch of Drone Numbers per Lane with Respect to Time: In the initial stages, both lanes may have a
low toll, attracting drones. As the number of drones on a lane increases, the toll for that lane rises, leading
to a decrease in the number of drones on that lane. This process continues, creating a self-regulating
system.
Question
(a) What can be said about the parameters of the PID controller for which the plant achieves the response
shown in Figure 1.1?
The PID controller parameters affect the system response and the typical plots involved.
1. Actual Output (c(t)) vs. Desired Output:
In a PID-controlled system, the actual output (c(t)) is compared to the desired output. The
controller adjusts the system to minimize the error (difference between actual and desired output).
2. Steady State:
The steady state is the condition when the system has reached a stable, constant output. In an
ideal PID-controlled system, the steady-state error should be minimized, resulting in the actual
output closely tracking the desired output.
3. c(t) at Y-Axis vs. t at X-Axis:
The plot of c(t) (actual output) against time (t) is known as the response of the system. It provides
insights into how the system behaves over time under the influence of the PID controller.
PID Controller Parameters and System Response:
1. Proportional Gain (Kp):
A higher Kp generally leads to a faster response to changes in the desired output but may
introduce overshoot and oscillations.
2. Integral Gain (Ki):
Ki eliminates steady-state error and improves the system's ability to track the desired
output. However, too much Ki can lead to instability and oscillations.
3. Derivative Gain (Kd):
Kd helps dampen oscillations caused by proportional control and improves the system's
response to rapid changes in the desired output.
(b) You are designing an automatic door which opens when a person approaches it. You are given four
sensor options: an infra-red sensor which detects whether there is something between the transmitter and
the receiver of the IR light; an ultra-sonic sensor which detects the distance at which an object lies in front
of the sensor; a standard camera; and an infra-red thermal camera. Which sensor would be your first,
second, third, and fourth option and why? Discuss cases where you would have to use sensors that are not
your first choice
(c) In three guest lectures related to use cases this year we discussed:
(1) acoustic noise pollution originating from the drones
(2) possibility to use drones for extending cellphone coverage
(3) possibility to use drones for urban delivery
Discuss the different relationships of (1) with (2) and (1) with (3). What are the trade-offs involved?
Question 5
In this new scenario, Dublin drone (UAV) urban traffic has one lane for drones going from point A to
point B, and one for drones going in the opposite direction (see figure 4.1 below). The local authority
allowed only a single lane in one part of the city—between points W(est) and E(ast), which forced the
placement of a traffic light system for drones at points W and E. The main security concern is that at any
given point In time, only drones travelling In one direction (A to B or B to A) should be allowed on the
WE segment. The engineering team decided to repurpose a system from the national railway company for
this purpose—a system that was supposed to govern trains with the same railway scheme as the one
planned for drones (bridge shared between two rail lines)
(a) The system in Figure 4.2 is not suitable for trains either: it could cause two trains to end up on the
bridge together, while travelling in opposite directions. Prove that can happen.
(a) Unsuitability of the System for Trains: The given system has a potential issue that could allow
two trains traveling in opposite directions to end up on the bridge together. This situation can occur
during the transition of the traffic lights from red to green. Let's analyze the scenario:
1. Initially, both signals are green, allowing trains from both directions to proceed.
2. A train is on the WE segment heading from W to E.
3. The signal at W turns red, indicating that no more trains should enter the WE segment.
4. Simultaneously, the signal at E turns green, allowing trains to enter the WE segment from the
opposite direction (E to W).
As a result, there is a brief moment when both signals are red, and trains from both directions might
be on the bridge simultaneously.
(b) Repair the system so that it works for trains and explain why your new design is safe.
(b) Repairing the System for Trains: To address this issue, we need to ensure that the signals change in
a way that prevents simultaneous access from both directions. One way to achieve this is by introducing a
buffer time during the transition between red and green signals. The repaired system could look like this:
if outE ? leave then west := green;
if outw ? leave then east := green;
if outE ? arrive then
west := red;
wait_for_buffer_time();
east := green;
else if outw ? arrive then
east := red;
wait_for_buffer_time();
west := green;
The wait_for_buffer_time() function ensures that there is a delay before the signal at the opposite end
turns green. This delay provides a safety buffer to clear the bridge before allowing trains from the other
direction to enter.
(c) How would you now repurpose the system from point (b) to be usable by drones? What Is the male
difference between the train scenario and a drone scenario?
(c) Repurposing for Drones: To repurpose the system for drones, we need to consider the differences in
the behavior and dynamics of drones compared to trains. Drones are more agile and can change direction
quickly. Therefore, the safety mechanisms need to be adapted.
The main difference lies in the fact that drones can quickly change direction, while trains have more
inertia and cannot change tracks rapidly. In the drone scenario, we can simplify the system:
if outE ? leave then west := green;
if outw ? leave then east := green;
In this simplified system, drones arriving at the WE segment are immediately stopped, and the traffic light
system only controls departures. Drones can change direction rapidly, so there is no need for a buffer time
as in the train scenario.
Main Difference: The key difference is that drones can quickly change direction, allowing for a simpler
control mechanism. Unlike trains, there is no need to enforce a buffer time for drones when transitioning
between directions on the shared segment.
References :