Development of Traffic Lights

3 downloads 0 Views 2MB Size Report
Modul. Integration. & Test. System. Integration. & Test. Late system level response. → The later failures ... Traffic engineering programs like LISA+ facilitate an planning process. .... East-west road linear increases. Analysis: Constant green ...
LCCC Workshop System Design meets Equation-based Languages Functional Development with Modelica Dr. Stefan-Alexander Schneider Dr. Stefan-Alexander Schneider

21. September 2012

Page 1

The Winchester House Neither Architecture nor Plan

Winchester House (construction 1884-1922) 160 rooms over 7 floors Neither Architecture nor Plan see http://www.winchestermysteryhouse.com/ Dr. Stefan-Alexander Schneider

Page

Systems Engineering

As Is

To Be

Problem

Early system level response

Late system level response Requirements

System Integration & Test

System Design Modul Design Component Design

Modul Integration & Test

How to achieve an earlier system level response?

System Design Modul Design Component Design

Component Test

 The later failures are found, the more expensive they are!

Requirements

Solution

System Integration & Test Modul Integration & Test Component Test

 Early evaluation of system reduces the risk of missing the „best solution“!

Virtual System Prototyping

Dr. Stefan-Alexander Schneider

Page

The Vee-Model of the Systems Engineering Short Feedback Loops by Virtual Integration

Time

Solution

modeling

System

Hand-over and Usage System Integration & Test

System Design

Component

Design

Modul

Module Design

Module Implementation

Module Integration & Test

Component Test

Integration

System

System Level Requirements

Modul

simulation

Component

Task

conventional way

Dr. Stefan-Alexander Schneider

Page

Dr. Stefan-Alexander Schneider

Page

Traffic Flow Optimization with a Traffic Light

Traffic Planning includes among others • Traffic Flow Optimization and • Avoiding Traffic jams Dr. Stefan-Alexander Schneider

Page

Traffic Lights serve to control the traffic and arrange for traffic participants a behavior

Typical Sequence of coloured lights: Red Light prohibits any traffic from proceeding, Red and Yellow Light prepare to cross, Green Light allows traffic to proceed in the direction denoted, and Yellow Light denotes, if safe to do so, stop.

circulation time (t_Clock) denotes the sum of all traffic lights phases Dr. Stefan-Alexander Schneider

Page

Plan of Signal Times Presentation similar to GANTT-Charts Traffic engineering programs like LISA+ facilitate an planning process.

Dr. Stefan-Alexander Schneider

Page

Task Restriction to a simple crossing of 4 lanes and traffic lights:

How looks like a workflow to development an embedded system, here the control system of the traffic lights, using the design environment Modelica? Dr. Stefan-Alexander Schneider

Page

System Level Requirements

Task

Solution

System Level Requirements

Hand-over and Usage System Integration & Test

System Design

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Component Test

Page

Requirements to system road intersection

1. Sum of all waiting times should be minimized. 2. Both directions should periodically served with the minimum green signal time t_Min.

Dr. Stefan-Alexander Schneider

Page

Functional Safety: Desired Behavior for System Failure Emergency control mode: Traffic lights from the major roads turn off and the traffic lights from the side streets blink yellow. This indicates that the proper operation of the traffic lights is not guaranteed and supports on the other hand the given traffic signs. Secure on the electrical level: If a light source is out of order, so none of the directions may be given the green signal and it should, if possible, the red signal shown.

Dr. Stefan-Alexander Schneider

Page

System Design

Task

Solution

System Level Requirements

Hand-over and Usage

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Component Test

Integration

System Integration & Test

System Design

Page

Design of the System System Traffic Lights: Plant-Controller with to be defined interfaces for the components of plant and controller.

Dr. Stefan-Alexander Schneider

Page

Description of System Component Plant: Crossing of two lanes. Component Controller : Calculates from given numbers of traffic members using an explicit computation rule for the duration of the green phase. Description of Interfaces: Interface between plant and controller is given by six real values: four numbers of vehicles in the waiting queues n_North, n_East, n_South, and n_West and the two green phase values t_NorthSouth and t_EastWest.

Dr. Stefan-Alexander Schneider

Page

Implementation of the System

t_Clock

Dr. Stefan-Alexander Schneider

Page

Module Design

Task

Solution

System Level Requirements

Hand-over and Usage

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Component Test

Integration

System Integration & Test

System Design

Page

Design of the Plant

Simple Growth Model for all four queues: 

n North, East,South,West

c  c _ Out  , nNorth, East,South,West  0 c 

Green Phase Values:

tMin  t NorthSouth, EastWest  tClock

Growth Constant: c Decay Constant: c_Out

Dr. Stefan-Alexander Schneider

Page

Design of Controller Controller maps from IR4 to IR2: infinite number of implementations!

We are in the Zugzwang!

Dr. Stefan-Alexander Schneider

Page

First Strategy to Design the Controller

Simple Strategy: Initialize both direction with red Default-Controller: distribute the available time (circulation time (t_Clock)) equally to both green phases

t NorthSouth, EastWest  tClock / 2

Dr. Stefan-Alexander Schneider

Page

Module Implementation

Task

Solution

System Level Requirements

Hand-over and Usage System Integration & Test

System Design

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Module Test

Page

Implementation First Controller Strategy

Dr. Stefan-Alexander Schneider

Page

Interaction with Sensors and Actors Initialize Plant; while (true) {

transfer values of vehicles to Controller; calculate length of green phases; simulate traffic lights; update vehicle values;

// interface // update Controller // interface // update Plant

}

Dr. Stefan-Alexander Schneider

Page

Module Integration and Test

Task

Solution

System Level Requirements

Hand-over and Usage System Integration & Test

System Design

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Module Test

Page

First Use Case

Both roads north-south and east-west are equally frequented. Parameters: c_EastWest = 1 [1/s] c_NorthSouth = 1 [1/s] c_Out = 2.2 [1/s]

n_North = n_South = 100 [1] n_East = n_West = 50 [1] t_Min = 10 [s] t_Clock = 150 [s] Dr. Stefan-Alexander Schneider

Page

Results of Model-in-the-Loop

Both roads north-south and east-west are equally frequented. Parameters: c_EastWest = 1 [1/s] c_NorthSouth = 1 [1/s] c_Out = 2.2 [1/s]

n_North = n_South = 100 [1] n_East = n_West = 50 [1] t_Min = 10 [s] t_Clock = 150 [s] Dr. Stefan-Alexander Schneider

Page

Conclusion of first Use Case

The symmetric control strategy works as expected. We study a further use case to test our implementation.

Modelica 3D Animation, Special Thanks to Christoph Höger, TU Berlin

Dr. Stefan-Alexander Schneider

Page

Second Use Case North-south road less traveled and east-west road however strong. Parameters: c_EastWest = 2 [1/s] c_NorthSouth = 0.2 [1/s] c_Out = 2.2 [1/s] n_North = n_South = 100 [1] n_East = n_West = 50 [1] t_Min = 10 [s] t_Clock = 150 [s]

Dr. Stefan-Alexander Schneider

Page

Results of Second Use Case North-south road less traveled and east-west road however strong. Parameters: c_EastWest = 2 [1/s] c_NorthSouth = 0.2 [1/s] c_Out = 2.2 [1/s] n_North = n_South = 100 [1] n_East = n_West = 50 [1] t_Min = 10 [s] t_Clock = 150 [s]

Dr. Stefan-Alexander Schneider

Page

Analysis of second Use Case Observation: North-south road drops to 0 and remains constant, where as East-west road linear increases Analysis: Constant green phase ratio reflected by 1 to 1 (north-south to east-west) obviously does not reflect the asymmetric vehicle ratio of 1 to 10 good enough

Conclusion: This undesirable behavior motivates another requirement for our controller.

Dr. Stefan-Alexander Schneider

Page

System Level Requirements Additional Requirement

Task

Solution

System Level Requirements

Hand-over and Usage System Integration & Test

System Design

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Component Test

Page

Additional Requirement to Controller Introduction of two key indicators:

Ratio of queues

k1 : nNorth  nSouth / nEast  nWest 

Ratio of green phase

k2 : t NorthSouth/ t EastWest

"The longer the green phases, the more vehicles can pass.“ In the sense of the customers of the intersection, we additionally require:

k1  k2

Dr. Stefan-Alexander Schneider

Page

Alternative Implementation of the Controller Alternative controller with:

This implementation has the following desirable properties:

 = 0 reflects no traffic in east-west direction and consequently minimum green time for east-west = 1 correspondingly for the other direction Dr. Stefan-Alexander Schneider

Page

Implementation of alternative Controller

Dr. Stefan-Alexander Schneider

Page

Results of Model-in-the-Loop of second Use Case

Dr. Stefan-Alexander Schneider

Page

Results of Model-in-the-Loop of second Use Case

The temporal evolution of the vehicle values ​in the first application with alternative controllers. Also the first application can be controlled by the alternate controller. Although he produced, in contrast to the first controller has a vibration, but remain limited to vehicle values​​.

Dr. Stefan-Alexander Schneider

Page

Results of Model-in-the-Loop of second Use Case

The temporal evolution of the vehicle values ​in the first application with alternative controllers. Also the first use case can be controlled by the alternate controller. Although it produces, in contrast to the first controller, a small oscillation, but remain limited to vehicle values​​. Dr. Stefan-Alexander Schneider

Page

System Integration and Test

Task

Solution

System Level Requirements

Hand-over and Usage System Integration & Test

System Design

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Module Test

Page

Implementation of Traffic Lights by Light Emitting Diodes (LEDs)

Dr. Stefan-Alexander Schneider

Page

Driving the actuators

Dr. Stefan-Alexander Schneider

Page

Development in C for µController

MPLAB Version 8.84 from Microchip Technology Inc. Dr. Stefan-Alexander Schneider

Page

PIC32 Starter Kit

µController with 80 MHz, 512KB Flash, 32KB RAM, USB Dr. Stefan-Alexander Schneider

Page

Target Code Generation

Python-Script Dymola2C.py

Dr. Stefan-Alexander Schneider

Page

Processor-in-the-Loop Simulation

Dr. Stefan-Alexander Schneider

Page

Results of Processor-in-the-Loop of second Use Case

red light

ready to operate

yellow light

Debug mode

Dr. Stefan-Alexander Schneider

green light

Page

Advantages of Virtual Integration Common Technical Basis concept

design

implementation

Check Yes / No

virtual integration

classic

#include if (result_b > result_d) var_i = 0.7 * result_ else

check

Dr. Stefan-Alexander Schneider

Page

System Integration and Test

Task

Solution

System Level Requirements

Hand-over and Usage System Integration & Test

System Design

Module Design

Module Implementation

Dr. Stefan-Alexander Schneider

Module Integration & Test

Module Test

Page

Development of Traffic Lights

Dr. Stefan-Alexander Schneider

Page

Architecture of the Library SafeDiscreteControl Concept for: Basic Blocks, Composite Blocks, Clocks, Clock Blocks, Atomic blocks, … Support for Datatypes: UInt4, Sint4, UInt8, SInt8, UInt16, SInt16, UInt32, SInt32, Float, Double, Boolean, Char8, Char16, …

Equations v = expr; or, but not – sin(u) + y = 0; Arithmetic Operations: +, -, *, /, gain, …

Numerical Support functions: abs, sign, min, max, sin, cos, tan, log, exp, … Concept for review, traceability, …

Dr. Stefan-Alexander Schneider

Page

Acknowledgments, Literatur, and Links Acknowledgments Bernhard Thiele, DLR, Synchronos conform modeling, defining the subset Christoph Höger, TU Berlin, Modelicca3d Animations Tobias Hofmann, TU München

Literatur & Links • • • •

Brunner, Ritz; Traffic Light Flower; http://www.brunner-ritz.de/bau.html; 2002 Wikipedia. LISA+ Wikipedia, Die freie Enzyklopädie, 2011. [Online; 28. März 2012]. Huckle, Schneider; Numerische Methoden; Springer; 2005 Bonvinia, Donidab, Leva; Modelica as a design tool for hardware-in-the-loop simulation; 7th Modelica Conference; 2009

Any questions, any hints?

Dr. Stefan-Alexander Schneider

Page

Development of Traffic Lights Dr. Stefan-Alexander Schneider

Thank you for your attention!

Dr. Stefan-Alexander Schneider

Page

The End.

Dr. Stefan-Alexander Schneider

Page

Aufgedeckte Abweichungen am Beispiel numerischer Aspekte der funktionalen Sicherheit ShiftOperationen Inkorrekte Optimierung durch Einsatz von Fused Multiply-Add/Subtract Opcodes (madd.f/msub.f)

Unäres Minus für Uint

Compilerfehler beim Vergleich von +0 und -0 Integrationsverfahren für embedded Systeme Float vs. Fix-Point Übersicht aktuelle Doktorabreiten

Dr. Stefan-Alexander Schneider

Page

Unexpected Behaviour in SHIFT-Operations Fehlerbeschreibung: The shift operator e.g. on Uint16 has unexpected behaviour. If a value is shifted by more than 16, than the result is not allways 0, e.g.

13