Florian Schlögl, Okko Nannen, Cornelius Steinbrink Bilbao ... · Bilbao, September 2016 The...

45
Florian Schlögl, Okko Nannen, Cornelius Steinbrink Bilbao, September 2016 The flexible smart-grid co-simulation framework

Transcript of Florian Schlögl, Okko Nannen, Cornelius Steinbrink Bilbao ... · Bilbao, September 2016 The...

Florian Schlögl, Okko Nannen, Cornelius Steinbrink Bilbao, September 2016

The flexible smart-grid co-simulation framework

Agenda

• Why mosaik?

• Architecture / functionalities

• Connections to FMI

• Advanced topics / examples

2

Why mosaik?

4

Control Strategies

Simulated Infrastructure

Simulation data Commands / Schedules

5

Modular design

mosaik

Eco-system

6

Model/Simulator

• Model:

• Simplified representation of a real world system/object or process

• Reproduces relevant system aspects for analysis; purpose specific

• Simulator:

• Implementation of a model

• Includes functionalities to run the model

7

Co-Simulation/Scenario

• Co-Simulation:

• Synchronized data exchange

• Every simulator provides its “solver”

• Simulation scenario:

• Numbers and connections of system entities

• Parameter values, input, runtime given

• Described in executable file

8

Another Sim Proc Simulator Process

Sim Manager

Scheduler Scenario API

Sim API Sim API

Architecture

9

Another Sim Proc Simulator Process

Sim Manager

Scheduler Scenario API

Sim API Sim API

10

11

Simulator w/ low-level API

Simulator w/ high-level API

mosaik mosaik

Mo

saik AP

I

socket socket

socket

JSON

BaseInterface

socket

JSON

Interface

Simulator

Interface

Simulator

Implemented by user

Implemented by mosaik

API Overview

• API to integrate simulators (and other components: database, visualization, etc.)

• Meta description:

• Object models provided

• Parameters

• Connection attributes

12

Example: “HouseSim” Model: Household Param: Inhabitant number Attr: Active Power (sending)

API Overview

• Four API methods for control:

• init() start simulator process

• create() instantiate model entities

• step() provide input data and advance simulator in time

• get_data() obtain output data

13

data

next time step

entities

meta data

init()

create()

step()

get_data()

loop

mosaik-API

14

Simulator Interaction

15

Simple example, two simulators

Active Power P

Example

step1()

get_data1()

get_data1()

step1()

16

step2()

get_data2()

2

get_data2()

step2()

1

Another Sim Proc Simulator Process

Sim Manager

Scheduler Scenario API

Sim API Sim API

17

Management Possibilities

18

Sim AP

I

Sim AP

I

Module

AP

I

Sim

Python import

Other protocol

TCP connection

TCP

etc

Another Sim Proc Simulator Process

Sim Manager

Scheduler Scenario API

Sim API Sim API

19

Scenario Creation

List and initialize simulators

20

Scenario Creation

Create entities

21

Scenario Creation

Connect entities

Connections are: • Rule-based

• Established for complete sets

22

Overview Scenario definition

Scenario-API

Scheduler Simulation Manager

mosaik-API

MAS

mosaik API

Visualization

mo

saik

AP

I

Centralized Control

mosaik API

Simulator

mo

saik

AP

I

Simulator

mo

saik

AP

I

Simulator

mo

saik

AP

I

Component Simulator

mo

saik

AP

I

Database

mo

saik

AP

I

23

Power Flow Simulator

mo

saik

AP

I

Simulation Utility

Control

Another Sim Proc Simulator Process

Sim Manager

Scheduler Scenario API

Sim API Sim API

24

A.step(0) → 1 A.step(1) → 2

0 1 2 3 4

A 1s

A-0 A-1 A-2 A-3

t [s]

25

0 1 2 3 4

A.step(0) → 1 B.step(0) → 1 A.step(1) → 2 B.step(1) → 2

A 1s

A-0 A-1

B 1s

B-0 B-1

A-2

B-2

A-3

B-3

t [s]

26

B.step(0) → 2 A.step(0) → 1 C.step(0) → 3 A.step(1) → 2; B.step(2) → 4 A.step(2) → 3 A.step(3) → 4 C.step(3) → 6

0 1 2 3 4

A-1

B 2s

B-0

A-2

B-2

A 1s

C 3s

C-0

A-0

C-3

A-3

t [s]

27

A.step(0) → 0.5 A.step(0.5) → 2

0 1 2 3 4

A ?s

A-0 A-1 A-2 A-3

t [s]

28

Summary of mosaik

• Mosaik is a co-simulation tool

• Main functionalities:

• Organize data exchange

• Synchronization

• Main use cases:

• Create scenario

• Connect simulators

29

Mosaik and FMI Functional Mock-Up Interface Mosaik

FMI for Co-Simulation Mosaik-API for simulators

Slave / FMU Simulator

Master (no part of FMI) Scheduler

Advantages: • More complete model description • Extensive interface for nuanced

control

Advantages: • Interface more easily implemented • Scheduling included • Flexible scenario creation

Conclusion: • No “either/or”

• Mosaik as possible master for FMI (mapping between mosaik-API and FMI)

30

Simple Demo Scenario

Scenario definition

Scenario-API

Scheduler Simulation Manager

mosaik-API

31

Simple Demo Scenario (II)

Scenario definition

Scenario-API

Scheduler Simulation Manager

mosaik-API

32

• One MV grid with sub-ordinate LV grids • About 8k nodes in total

• Decentral producers, consumers and storage • About 55k units in total

• Discrete step size: • 1 minute

Application Cases

Application Cases (II)

• Mosaik-IPSYS

• First external use of mosaik (by DTU)

• Couple a Java simulation (IPSYS) and a Java MAS (MasSim and JadeSim)

• Relatively small scenario

Cyclic Data Dependencies

No problem Data flow

Problem (Who comes first?)

Mosaik solution: Asynchronous Requests

35

Cyclic Data Dependencies

• Establish data connection in one direction

• Include asynchronous request

• Cycle is resolved via a shift in time

36

0 1 2 3 4

A.step(0) → 1 B.step(0) → 1 A.step(1) → 2 B.step(1) → 2

A 1s

A-0 A-1

B 1s

B-0 B-1

A-2

B-2

A-3

B-3

t [s]

37

With mosaik toward HiL

... VPN Gateway Router/Firewall

Internet

HERO Cluster (High-End Computing Resource Oldenburg)

25 (max. 100) Sessions @ 1Gbit/s

...

...

6x BECKHOFF CX2020 RT-Anlagen-Targets Komponentenmodelle

Agenten Regler

18x

Kommunikationssimulation

38

D/A

EtherCAT

Ethernet

96x Ports

48x Ports

I/O-Switch

Stationsanzeigen Schaltzustände Auslastung LabView Console

2x 6x CPUs @ 2,6 GHz

Virtualisierungsserver mosaik-Simulation Entwicklungsumgebungen Lizenzserver

Leitstand SCADA

IEC 60870

IEC

618

50

U

ML

CIM

(619

70/6

196

8)

OP

C U

A (6

254

1)

Standardkonforme Informations- und

Prozessketten

Protocol Switch 18x

6x Kerne (~140 Knoten)

... Stationsrechner Leitsystem Schutzsystem Komponentenmodelle Agenten Regler

3x BECKHOFF C6920

D/A

D/A

Geplanter Ausbau

RT-Netz-Target Netzmodell

Komponentenmodelle

3x Kerne (~70 Knoten)

OPAL-RT eMEGAsim

SESA-Lab

38

With mosaik toward HiL

m

39

With mosaik toward HiL

40

.exe

Analog I/O

41

mosaik.offis.de Help: [email protected] Docs: mosaik.readthedocs.org Code: bitbucket.org/mosaik

Scenario definition

Scenario-API

Scheduler Simulation Manager

mosaik-API

Multi- Agent- System

mosaik API

Visualization

mo

saik

AP

I

Centralized Control

mosaik API

Simulator

mo

saik

AP

I

Simulator

mo

saik

AP

I

Simulator

mo

saik

AP

I

Consumption Simulator

mo

saik

AP

I

Database

mo

saik

AP

I

43

Power Flow Simulator

mo

saik

AP

I

Simulation

Utility

Control

Weather

Market

Generation

A-0 A-1 A-2 A-3

B-2

C-0 C-3

0 1 2 3 4

B-0

A 1s

B 2s

C 3s

Another Sim ProcSimulator Process

Sim Manager

SchedulerScenario API

Sim API Sim API