Application Examples
Welcome to the page dedicated to application examples of SIR 3S Toolkit! Here, you will find a variety of tutorials, examples and networks. You need to already have Toolkit installed (Install instructions).
Tutorials are meant to introduce new Toolkit users to its basic functionalities. Examples introduce Toolkit users who understand its basic functionality to real-world application Examples. The networks are examples of SIR 3S model topologies.
Note
The Data necessary for running the notebooks has not been included yet.
Tutorials
These Tutorials are meant to introduce new Toolkit users to its basic functionalities. They built on each other, so if you want a very quick overview on how Toolkit works, just view the last Tutorial.
Each tutorial is available for both viewing as an .ipynb file and downloading as a .zip archive containing additionally all data necessary for running the notebook on your local machine.
You can also download all tutorials and their respective data in a joint .zip archive at once here.
Tutorial 1: Importing and Initialization
This Tutorial demonstrates how to import the Toolkit and intialize instances of its classes.
You can view the Notebook here.
You can download the Notebook file and data necessary to run the Tutorial locally here.
Tutorial 2: Creating or Opening a SIR 3S Model
This Tutorial demonstrates how to create new SIR 3S Models or open already existing ones.
You can view the Notebook here.
You can download the Notebook file and data necessary to run the Tutorial locally here.
Tutorial 3: Getting and Setting Values
This Tutorial demonstrates how to get and set values of object based on their tk.
You can view the Notebook here.
You can download the Notebook file and data necessary to run the Tutorial locally here.
Tutorial X: Template
This tutorial does not demonstrate use cases of SIR 3S Toolkit, but serves as a template for contributors, who want to create their own Example.
You can view the Notebook here.
You can download the Notebook file and data necessary to run the Tutorial locally here.
Examples
Examples introduce Toolkit users who understand its basic functionality to real-world application Examples.
Each example is available for both viewing and downloading as an .ipynb file.
Example 1: Shapeimport
This Example demonstrates how to create a connected topological network of nodes and pipes in SIR 3S via Toolkit based on shp data. The data used comes from ‘SIR 3SModelleBeispieleWasserManualProjektdaten01 Shape-Dateien’.
You can view the Notebook here.
You can download the Notebook file here
.
Example X: Template
This example does not demonstrate use cases of SIR 3S Toolkit, but serves as a template for contributors, who want to create their own Example.
You can view the Notebook here.
You can download the Notebook file here
.
Networks
The networks are examples of SIR 3S model topologies.
Each network is available for both viewing and downloading as an .py file. You can open and run it via the Python Console in SIR Graf.
Network 1
You can view the code below
1import clr as net
2from PythonWrapperToolkit import SIR3S_Model
3import Sir3S_Repository.Interfaces as Interfaces
4net.AddReference("Sir3S_Repository.Interfaces")
5import Sir3S_Repository.Interfaces
6model = SIR3S_Model()
7
8# Abbreviations for ObjectTypes used
9TNode = Sir3S_Repository.Interfaces.Sir3SObjectTypes.Node
10TPipe = Sir3S_Repository.Interfaces.Sir3SObjectTypes.Pipe
11TPump = Sir3S_Repository.Interfaces.Sir3SObjectTypes.Pump
12TTank = Sir3S_Repository.Interfaces.Sir3SObjectTypes.OpenContainer
13
14#Create Nodes and Pipes
15model.StartEditSession("Insert Elements")
16
17# Add nodes
18node10 = model.AddNewNode("-1", "Node10", "QKON", 200, 700, 213, 0, 1, "DNODE 10", "RefNode 10", 0)
19node11 = model.AddNewNode("-1", "Node11", "QKON", 300, 700, 213, 0, 1, "DNODE 11", "RefNode 11", 0)
20node12 = model.AddNewNode("-1", "Node12", "QKON", 500, 700, 210, 0, 1, "DNODE 12", "RefNode 12", 0)
21node13 = model.AddNewNode("-1", "Node13", "QKON", 700, 700, 208.5, 0, 1, "DNODE 13", "RefNode 13", 0)
22node21 = model.AddNewNode("-1", "Node21", "QKON", 300, 400, 210, 0, 1, "DNODE 21", "RefNode 21", 0)
23node22 = model.AddNewNode("-1", "Node22", "QKON", 500, 400, 208.5, 0, 1, "DNODE 22", "RefNode 22", 0)
24node23 = model.AddNewNode("-1", "Node23", "QKON", 700, 400, 207, 0, 1, "DNODE 23", "RefNode 23", 0)
25node31 = model.AddNewNode("-1", "Node31", "QKON", 300, 100, 210, 0, 1, "DNODE 31", "RefNode 31", 0)
26node32 = model.AddNewNode("-1", "Node32", "QKON", 500, 100, 213, 0, 1, "DNODE 32", "RefNode 32", 0)
27node9 = model.AddNewNode("-1", "Node9", "PKON", 150, 700, 255, 0, 1, "PNODE 9", "RefNode 9", 0)
28node2 = model.AddNewNode("-1", "Node2", "QKON", 500, 850, 240, 0, 1, "Tank 2", "RefNode 2", 0)
29
30# Add pipes
31model.AddNewPipe("-1", node10, node11, 3160, "LINESTRING(200 700, 300, 700)", "STDROHR", "450", 0.25, "Ref Pipe 10", "Pipe from Pump to network", 0)
32model.AddNewPipe("-1", node11, node12, 1584, "LINESTRING(300 700, 500, 700)", "STDROHR", "350", 0.25, "Ref Pipe 11", "Pipe from 11 to 12", 0)
33model.AddNewPipe("-1", node12, node13, 1584, "LINESTRING(500 700, 700, 700)", "STDROHR", "250", 0.25, "Ref Pipe 12", "Pipe from 12 to 13", 0)
34model.AddNewPipe("-1", node21, node22, 1584, "LINESTRING(300 400, 500, 400)", "STDROHR", "250", 0.25, "Ref Pipe 21", "Pipe from 21 to 22", 0)
35model.AddNewPipe("-1", node22, node23, 1584, "LINESTRING(500 400, 700, 400)", "STDROHR", "300", 0.25, "Ref Pipe 22", "Pipe from 22 to 23", 0)
36model.AddNewPipe("-1", node31, node32, 1584, "LINESTRING(300 100, 500, 100)", "STDROHR", "150", 0.25, "Ref Pipe 31", "Pipe from 31 to 32", 0)
37model.AddNewPipe("-1", node2, node12, 60, "LINESTRING(500 850, 500, 700)", "STDROHR", "450", 0.25, "Ref Pipe 110", "Pipe from Tank to network", 0)
38model.AddNewPipe("-1", node11, node21, 1584, "LINESTRING(300 700, 300, 400)", "STDROHR", "250", 0.25, "Ref Pipee 111", "Pipe from 11 to 21", 0)
39model.AddNewPipe("-1", node12, node22, 1584, "LINESTRING(500 700, 500, 400)", "STDROHR", "300", 0.25, "Ref Pipee 112", "Pipe from 12 to 22", 0)
40model.AddNewPipe("-1", node13, node23, 1584, "LINESTRING(700 700, 700, 400)", "STDROHR", "200", 0.25, "Ref Pipee 113", "Pipe from 13 to 32", 0)
41model.AddNewPipe("-1", node21, node31, 1584, "LINESTRING(300 400, 300, 100)", "STDROHR", "200", 0.25, "Ref Pipee 121", "Pipe from 21 to 31", 0)
42model.AddNewPipe("-1", node22, node32, 1584, "LINESTRING(500 400, 500, 100)", "STDROHR", "150", 0.25, "Ref Pipee 122", "Pipe from 22 to 32", 0)
43
44# Add pump
45model.AddNewConnectingElement("-1", node9, node10, 175, 700, 0, TPump, 200, 1, 0, "Pumpe", "standard pump")
46
47#add tank
48model.AddNewBypassElement("-1", node2, 500, 850, 255, 1, TTank, "Tank", "Storage tank")
49
50#Stop edit sesssion
51model.EndEditSession();
52
53#Add text
54text = model.InsertElement(Sir3S_Repository.Interfaces.Sir3SObjectTypes.Text, "RefBspText")
55model.SetGeometryInformation(text, "POINT(750 850 0)")
56model.SetValue(text, "Graftext", "Network 1 createed by SIR 3S PythonToolkit")
57model.SetElementColor_RGB(text, 255,0,0,True)
58
59# draw network in map
60model.RefreshViews()
61
62# run steady-state calculation
63model.ExecCalculation(True);
You can download the Network file here
.