Gridsim Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 15

DownloadGridsim Manual
Open PDF In BrowserView PDF
GridSim simulator manual

TM/ROBOLABO/2014-003

Developed by ROBOLABO
www.robolabo.etsit.upm.es

Authors:
Manuel Castillo Cagigal
Eduardo Matallanas de Avila
Dr. Alvaro Gutiérrez Martı́n

February 13, 2019

Contents
1 Simulator description

5

2 Installation
2.1 Parallel launcher compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Documentation generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7
8
8

3 Execution
3.1 Parallel launcher . . . . . . . . .
3.2 Experiment configuration . . . .
3.2.1 Visualization definition .
3.2.2 Structure definition . . .
3.3 Parallel experiment configuration

.
.
.
.
.

9
9
9
10
11
13

4 Examples
4.1 MuFCO demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15
15

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

4

CONTENTS

Chapter 1

Simulator description
GridSim1 is an open source simulator developed to analyze the power balances on a virtual
electrical grid. Figure 1.1 shows a scheme of its modular architecture. The grid is composed by
lines. A line represents a set of nodes with the same features. The nodes are complex elements
connected to the lines which can be equipped with different types of consumption, Distributed
Energy Resources (DER) technologies and control systems. These nodes can represent from a
single device which only consumes as a single device to a complex microgrid. In addition, a base
consumption function can be added to the grid. It represents an uncontrollable consumption
which is added to the aggregated consumption of the simulated grid.
The structure of a grid is defined by an XML file. In this file, the number of lines and the
number of nodes per line can be defined. Each line has a concrete type of node; it means that all
the nodes of each line have the same features. GridSim can run multiple executions in parallel.
This feature of the simulator has been implemented by making use of the MPI2 protocol.
GridSim calculates the power balances of every node and they are aggregated in their
common line. The aggregated consumption of the virtual electrical grid is calculated as the
sum of the power balances of every line plus the base consumption function. The nodes can be
equipped with different controllers to control the possible elements which a node is composed of.
For example, the charge power of the storage system can be controlled by a battery controller.
The controllers can obtain information from every element of the GridSim simulator.
Algorithm 1 describes the operation of GridSim. In the first place, the simulator is
initialized—see from line 1 to 3 . The virtual electrical grid is created by using a configuration
file which indicates structure of the grid. In addition, the counter of time steps is set to zero.
A time step is one execution of the main loop of the simulator. It is the virtual clock of a
simulation which marks the events that happen. A time step is related to an amount of time
in the real world. For example, if a time step represents one minute, in each execution of the
1

GridSim is released under GPLv3.0. It can be downloaded from: https://github.com/Robolabo/gridSim.git
Message Passing Interface (MPI) is a standardized and portable message-passing system designed by a group
of researchers from academia and industry to function on a wide variety of parallel computers. The standard
defines the syntax and semantics of a core of library routines useful to a wide range of users writing portable
message-passing programs in different computer programming languages.
2

6

1. Simulator description

Node

...
...

Node

p(t)

Node
t

Node

...

Base consumption

Grid

Node

Line 1

...
...

Node

Node

Line i
Node

Figure 1.1: Scheme of the modular architecture of GridSim simulator.
Algorithm 1 High-level description of the main loop of GridSim simulator.
1: /* Initialization */
2: createGrid(< conf igurationF ile >)
3: T imeStep ← 0
4: /* Main Loop */
5: while T imeStep < T imeStepLimit do
6:
/* Execute main control function */
7:
mainControlFunction()
8:
/* Execute virtual user functions on all nodes */
9:
for i < numN odes do
10:
node[i]→userFunction()
11:
end for
12:
/* Execute control functions on all nodes */
13:
for i < numN odes do
14:
node[i]→controlFunction()
15:
end for
16:
/* Execute grid energy balance - physics engine */
17:
gridExecutionFunction()
18:
T imeStep + +
19: end while
main loop, the power balances are calculated for one minute in the real world. The lower the
amount of time in the real world is, the higher the accuracy of the simulator is, but also the
greater the computing power. After GridSim is initialized, the main loop begins. The main loop
simulates the virtual electrical grid, the virtual users and controllers in each time step. The
counter of time steps is increased at the end of this loop. When the main loop finishes, the
simulation finishes. This condition is satisfied when the counter of time steps reaches a certain
value indicated in the configuration file—see the condition of line 5.

Chapter 2

Installation
GridSim is open source simulator of electrical grids released under GPLv3.0. It can be
downloaded from: https://github.com/Robolabo/gridSim.git. The repository can also be
directly downloaded from github in your computer:
$ g i t c l o n e h t t p s : / / g i t h u b . com/ Robolabo / g r i d S i m . g i t

Once the simulator has been downloaded, you can attempt to install it.
GridSim must be compile in your computer. It is preapared to be compile and executed
in Linux, this manual does not indicate how to install GridSim in other operating systems. In
addition, this manual describes the instllation process for an Ubuntu distribution. GridSim is
programmed in C++, thus, the C++ compiler is required. The simulator’s compilation has been
teste for g++ compiler version 4.4 or higher. The installation of this compiler is recommended:
$ sudo apt−g e t i n s t a l l g++

The compilation of GridSim is performed by autotools with libtool. Therefore, these tools
should be installed in your computer:
$ sudo apt−g e t i n s t a l l automake a u t o t o o l s −dev l i b t o o l

There is a compilation script which prepare the compilation folder and compile the simulator.
To execute this script:
$ . / b u i l d s i m u l a t o r . sh

It creates the build folder. All compilation files are in this folder. After the compilation, the
executable file is copied in the main folder of GridSim. This file is called gridSim.

8

2. Installation

2.1

Parallel launcher compilation

Different instances of GridSim can be launched in parallel. It allows to use the possibilities of a
multicore machine or a cluster. This parallel execution is based on MPI. Thus, MPI should be
installed in your computer:
$ sudo apt−g e t i n s t a l l openmpi−b i n mpi−d e f a u l t −dev
There is a compilation script for the compilation of the parallel launcher:
$ . / b u i l d s i m u l a t o r p a r a l l e l . sh
After the compilation, the executable file is copied in the main folder of GridSim. It is called
gridSim parallel.

2.2

Documentation generation

This manual can be compile from the LATEX sources. The LATEX packages should be installed in
your computer:
$ sudo apt−g e t i n s t a l l t e x l i v e −l a t e x −e x t r a t e x l i v e −l a t e x −recommended
t e x l i v e −b i b t e x −e x t r a t e x l i v e −math−e x t r a
There is compilation script for the documentation compilation:
$ . / b u i l d d o c . sh
After the compilation, the documentation file is copied in the main folder of GridSim. It is
called gridsim manual.pdf.

Chapter 3

Execution
GridSim is executed by using its executable file gridSim. The execution requires a configuration
file to configure the experiment that you want to simulate. The content of this file is explained
in Section 3.2. It is launch through:
$ . / g r i d S i m −p 
The simulator is launched during the stipulated time.

3.1

Parallel launcher

The parallel launcher of GridSim is based on MPI. The parallel executin must be configured with
an independent file. The content of this file is explained in Section 3.3. It is launch through:
$ mpirun −np  . / g r i d S i m p a r a l l e l
−p 
where < N P ROCESS > is the number of process launched in parallel. Notice that the
parallel execution requires a master process which does not calculate nothing, it is only a job
dealer. Therefore, < N P ROCESS > should be at least 2, one master dealing job and a slave
simulating.

3.2

Experiment configuration

The experiments are configured by using the xml configurations files. These files have the
following main structure:




WINDOWS_DEF
...



STRUCTURE_DEF





Table 3.1 shows the definition of the configurable parameters previously defined.
Name

Description

SED NUMBER
LENGTH
SMP PERIOD
FFT LENFGTH
DATA FOLDER
FLAG ACTIVE
RF RATE
WINDOWS DEF
GRID PROFILE
GRID AMP
STRUCTURE DEF
OUTPUT FILE
MAIN CTR

The initial random number seed
Duration of experiment in real world in minutes
Sampled period for DFT
DFT window length
Data folder address
0 deactivate visualization; 1 activate visualization
Refresh rate for visualization
Definition of windows (see Section 3.2.1)
Base consumption profile file name
Amplitude of the base consumption
Definition of structure (see Section 3.2.2)
Output file name
Main controller name
Table 3.1: Experiment configuration parameters.

3.2.1

Visualization definition

The windows for visualization are defined with the following structure in the xml file:


Data
type
int
int
int
int
string
bool
int
string
float
string
string

3.2. Experiment configuration

11

Table 3.2 shows the definition of the configurable parameters previously defined.
Name

Description

TITLE
X LENGTH
Y INI
Y END

Title of the window
Length of the x-axis in samples
Initial y-axis value
Final y-axis value

Data
type
string
int
int
int

Table 3.2: Window configuration parameters.

3.2.2

Structure definition

The structure of the simulated grid is defined with the following structure in the xml file:


...

ELEMENTS



Table 3.3 shows the definition of the configurable parameters previously defined.
Name

Description

LINES NUMBER
line X
NODES NUMBER
NODE NAME
ELEMENTS

Number of lines
Definition of line X
Number on nodes
Definition of the nodes of the line
Elements in the node (explained below)

Data
type
int
int
int
string

Table 3.3: Structure configuration parameters.

The structure of the simulated node is defined with the following structure in the xml file:







Table 3.4 shows the definition of the configurable parameters previously defined.
Name

Description

ND TYPE
ND AMP
ND FILE
PV TYPE
PV PROFILE
PV FR PROFILE
PV AMP
CAP
NUM INV
CTR NAME
CTR CONF

No deferrable consumption type (see Table 3.5)
No deferrable consumption amplitude
No deferrable consumption file
PV type (see Table 3.6)
PV profile file
PV forecast file
PV inverter nominal power
Storage system capacity
Storage system number of inverters
Node controller name
Configuration of the node controller

Data
type
int
float
string
int
string
string
float
float
int
string

Table 3.4: Node configuration parameters.

Table 3.5 shows the different types of no deferrable consumption.
Number
0
1
2

Description
Constant consumption; ND AMP indicates its amplitude
Consumption defined by a file; ND FILE indicates the address
Consumption defined by the base consumption profile
Table 3.5: No deferrable types.

Table 3.6 shows the different types of PV generation.
Number
0
1

Description
PV profile defined by file; PV PROFILE indicates the adress
PV profile generated by internal model
Table 3.6: No deferrable types.

3.3. Parallel experiment configuration

3.3

Parallel experiment configuration

13

14

3. Execution

Chapter 4

Examples
4.1

MuFCO demo

The configuration file for the MuFCO demo experiment can be executed with:
$ . / g r i d S i m −p c n f / mufco demo . xml
The MuFCO demo has the following configuration parameters:
Name
ctr act time
wt beg
wt end

Description
Simulation step after which the controllers
start running
Simulation step after which data starts
being written
Simulation step when data stops to be
written

Data
type

Range

int

[0, int length]

int

[0, int length]

int

[0, int length]

Table 4.1: MuFCO demo configuration parameters.



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Mode                       : UseOutlines
Page Count                      : 15
Creator                         : LaTeX with hyperref package
Producer                        : dvipdfm
Create Date                     : 2019:02:13 08:04:26+01:00
EXIF Metadata provided by EXIF.tools

Navigation menu