Discrete Event Simulation, Smart Grids and Other Topics Dan Gordon
My Simulation Journey • Quantum Mechanics of Bose-Einstein Condensation • Airline Crew Scheduling • Biophysics of Ion Channels • Brownian Dynamics • Molecular Dynamics • Smart Grids and Renewables • SmartGridToolbox - Discrete Event Simulation • CONSORT : Bruny Island Battery Trial
Time-Stepped Simulations • Simulate a continuous or regular process • Calculate the state of the system at discrete time steps • Time steps need not be all equal: we could use an adaptive step size that decreases when the system is rapidly changing • Example: simulate the trajectory of a thrown ball
<latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> Trajectory of a Thrown Ball Newton’s Equation of Motion md 2 y dt 2 = − mg − bdy dt Analytical Solution + m 2 g ✓ ◆ y ( t ) = y 0 + mv 0 m t − b ⇣ m t ⌘ 1 − e − b 1 − e − b mt b 2 b Numerical Solution (Simulation using Euler’s Method) ✓ ◆ − g − b v ( t + ∆ t ) = v ( t ) + mv ( t ) ∆ t y ( t + ∆ t ) = y ( t ) + v ( t ) ∆ t t → t + ∆ t
Trajectory of a Thrown Ball
Molecular Dynamics Forces BONDS ! !V(bond) = Kb(b - b0)**2 ! !Kb: kcal/mole/A**2 !b0: A ! !atom type Kb b0 ! !Carbon Dioxide CST OST 937.96 1.1600 ! JES !Heme to Sulfate (PSUL) link SS FE 250.0 2.3200 !force constant a guess !equilbrium bond length optimized to reproduce !CSD survey values of !2.341pm0.01 (mean, standard error) !adm jr., 7/01 C C 600.000 1.3350 ! ALLOW ARO HEM ! Heme vinyl substituent (KK, from propene (JCS)) CA CA 305.000 1.3750 ! ALLOW ARO ! benzene, JES 8/25/89 CE1 CE1 440.000 1.3400 ! ! for butene; from propene, yin/adm jr., 12/95 CE1 CE2 500.000 1.3420 ! ! for propene, yin/adm jr., 12/95 CE1 CT2 365.000 1.5020 ! ! for butene; from propene, yin/adm jr., 12/95 CE1 CT3 383.000 1.5040 ! ! for butene, yin/adm jr., 12/95 CE2 CE2 510.000 1.3300 ! ! for ethene, yin/adm jr., 12/95
Molecular Dynamics
Brownian Dynamics
Discrete Event Simulations • We have seen some examples of time-stepped simulations. What about cases where the action depends on the irregular occurrence of events ? • Basic Sequence: • Work out when next event (event i) occurs • Perform any necessary calculations at event i • Event i may trigger other events • Iterate • Canonical example: queues • Arrivals in the queue occur according to a random distribution. Each arrival is an event . • Random distribution varies according to time of day • Someone reaching front of queue is another event • Someone finishing transaction is another event, with its time calculated according to a random distribution of service times • Calculate statistics of waiting times, etc.
Discrete Event Simulations: BusPlus (Phil Kilby, NICTA) • Proposed system for off-peak public transport • Seven hubs in Canberra with frequent buses running between hubs • Taxi-based ride sharing to and from hubs • Integrated booking for buses and taxis • Advanced scheduling and routing software for taxis • Event-based simulator was developed • Events are: • Passenger bookings • Passenger arrives at collection point (bus stop) • Passenger collections and drop offs • Taxis / bus departures, arrivals, waypoints • Simulator employs advanced scheduling software to route the taxis • Same software intended for the finished product
Discrete Event Simulations: BusPlus (Phil Kilby, NICTA)
Agent-Based Simulation • Identify agents in a simulation: individual entities that determine their own behaviour • This is a kind of object-oriented approach to simulation, since the code for each agent is encapsulated within itself • Agents may interact with other agents, ideally via well- defined (code) interfaces • Classic example: gaming!
<latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> <latexit sha1_base64="(nul)">(nul)</latexit> Electricity Grids Past and Present X | V i || V j | [ G ij cos( θ i − θ j ) + B ij sin( θ i − θ j )] = 0 P i − j X | V i || V j | [ G ij sin( θ i − θ j ) − B ij cos( θ i − θ j )] = 0 Q i − j � 13
Electricity Grids Present and Future • Modern electricity grids are becoming much more complicated • Distributed generation & storage, grid level renewables & storage, the emergence of electricity markets… • Developments in computing and communications make a more active, optimal control strategy possible for electricity grids • This describes the smart grid. • It is inherently harder to model and simulate � 14
SmartGridToolbox Software • Combines traditional power flow equations with discrete- event, agent-based simulation • C++ libraries for flexibility and extensibility • Build custom applications on top of libraries • SgtCore library: utilities and power flow equations • SgtSim library: discrete event simulation, component library (batteries, solar, tap changers, controllers, optimisation…)
SmartGridToolbox Discrete Event Simulations A simulation consists of components • E.g. lines, transformers, loads, generators, houses with PV, • battery, local controller, voltage regulators with control, central controllers / coordination, weather modelling…
SmartGridToolbox Discrete Event Simulations • Each component defines the following member functions (and more): void initializeState() Time validUntil() void updateState(t) • At the start of the simulation, all components get a chance to initialize themselves via the initializeState() funtion • Then, validUntil() is called for each component to work out when the components are next scheduled to update • These updates are sorted by time. If there are several components due to update at the same time, they are sorted according to previously defined dependencies • These scheduled updates are performed one by one, in order, by calling the updateState(t) function of each component
SmartGridToolbox Discrete Event Simulations • During an update, a component may trigger other components to register a contingent update at the current timestep. • Contingent updates are pushed to the end of all updates at the current timestep • This careful ordering of scheduled and contingent updates is, roughly, an example of the three phase* method for discrete event simulations • Updates may be triggered directly from within the updateState(t) function, or may be set up to trigger as a result of other events triggering. This is done through a special event-action mechanism that is a specialisation of the observer pattern of software design. * Michael Pidd (1998). Computer simulation in management science – fourth edition . Wiley.
SmartGridToolbox: Tap Changer Example Distribution networks sometimes use special transformers • called voltage regulators to adjust the network voltage at strategic locations. These are often controlled by special devices known as automatic tap changers , that sense the local voltage and make adjustments to the tap changer to keep the voltage within an allowable range Typically, distribution lines have three wires, each carrying • its own AC voltage stream. This is an example of three phase power. Suppose we have a three-phase voltage regulator, with • three sets of taps, each sensing the voltage between two phases (wires) and adjusting the associated tap if the voltage gets too high or low.
SmartGridToolbox: Tap Changer Example When a network load (e.g. the consumption of a house) • changes, due to a scheduled update, an “injectionChanged” event is triggered. The network is registered to insert a contingent update • into the event queue when this occurs. This update will occur after all scheduled updates are finished. When the network updates, the voltage at its nodes • typically changes. This triggers a “voltageChanged” event. The tap changers are registered to insert a contingent • update into the event queue when this happens. During the updates, the changers decide whether a tap change is necessary, based on the voltage.
SmartGridToolbox: Tap Changer Example If one of the tap changers changes the • transformer tap, the transformer triggers an “admittanceChanged” event. The network inserts a contingent update when • this occurs. Due to dependency ordering, this update happens only after all pending tap changes have occurred After the network updates, the voltages may • change, and the tap changers may again need to change their tap settings. So we may need to iterate a few times before things settle down.
Recommend
More recommend