Tutorial 56: Nominal Diameter Tables
SIR 3S Toolkit
Regular Import/Init
[1]:
SIR3S_SIRGRAF_DIR = r"C:\3S\SIR 3S\SirGraf-90-15-00-24_Quebec-Upd2" #change to local path
[2]:
from sir3stoolkit.core import wrapper
[3]:
wrapper
[3]:
<module 'sir3stoolkit.core.wrapper' from 'C:\\Users\\aUsername\\3S\\sir3stoolkit\\src\\sir3stoolkit\\core\\wrapper.py'>
[4]:
wrapper.Initialize_Toolkit(SIR3S_SIRGRAF_DIR)
Additional Import/Init for Dataframes class
[5]:
from sir3stoolkit.mantle.dataframes import SIR3S_Model_Dataframes
[6]:
s3s = SIR3S_Model_Dataframes()
Initialization complete
Additional
[7]:
import pandas as pd
from shapely.geometry import Point
import re
import folium
from folium.plugins import HeatMap
import numpy as np
import geopandas as gpd
from shapely import wkt
import matplotlib.pyplot as plt
import contextily as cx
Open Model
[8]:
s3s.OpenModel(dbName=r"Toolkit_Tutorial56_Model.db3",
providerType=s3s.ProviderTypes.SQLite,
Mid="M-1-0-1",
saveCurrentlyOpenModel=False,
namedInstance="",
userID="",
password="")
Model is open for further operation
View Nominal Diameter Tables
We can use the function get_dataframes_from_nominal_diameter_tables() to obtain a dictionary of all nominal diameter tables.
[9]:
_, dfs, tks = s3s.get_dataframes_from_nominal_diameter_tables()
[10]:
for id, tk in enumerate(tks):
print(f"{id}: {tk}: {s3s.GetValue(tk, 'Name')[0]}")
0: 4929824488020291605: STDROHR
1: 4862079620528720750: FLEXWELL-F
2: 5157457566256524875: STDROHR_2
3: 4927972999088213410: KMR
Now we can view the individual nominal diameter tables.
STDROHR
[11]:
dfs[tks[0]].head(3)
[11]:
| tk_merge | Table Name | Name | Fk | Dn | Di | Da | S | Wsteig | Wtiefe | Kt | Pn | Ausfallzeit | Reparatur | Rehabilitation | Tk | Pk | InVariant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 5515865002497708428 | STDROHR | DN 3 | 4929824488020291605 | 3 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5515865002497708428 | 5515865002497708428 | False |
| 1 | 5623248152587240406 | STDROHR | DN 4 | 4929824488020291605 | 4 | 4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5623248152587240406 | 5623248152587240406 | False |
| 2 | 5195383577550917235 | STDROHR | DN 5 | 4929824488020291605 | 5 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5195383577550917235 | 5195383577550917235 | False |
KMR
[12]:
dfs[tks[3]].head(3)
[12]:
| tk_merge | Table Name | Name | Fk | Dn | Di | Da | S | Wsteig | Wtiefe | Kt | Pn | Ausfallzeit | Reparatur | Rehabilitation | Tk | Pk | InVariant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 5636244102636904922 | KMR | DN 25 | 4927972999088213410 | 25 | 22,3 | 26,9 | 2,3 | 0 | 0 | 0,19 | 0 | 0 | 0 | 100 | 5636244102636904922 | 5636244102636904922 | False |
| 1 | 4845758090437917162 | KMR | DN 32 | 4927972999088213410 | 32 | 28,5 | 33,7 | 2,6 | 0 | 0 | 0,195 | 0 | 0 | 0 | 200 | 4845758090437917162 | 4845758090437917162 | False |
| 2 | 5728256818453294508 | KMR | DN 50 | 4927972999088213410 | 50 | 54,5 | 60,3 | 2,9 | 0 | 0 | 0,225 | 0 | 0 | 0 | 300 | 5728256818453294508 | 5728256818453294508 | False |
df pipes
When creating a element dataframe of pipes, the nominal diameter table values will automatically be added with the prefix “PipeTable:”.
[13]:
df_pipes = s3s.generate_element_dataframe(element_type=s3s.ObjectTypes.Pipe)
[2026-03-27 18:30:38,411] INFO in sir3stoolkit.mantle.dataframes: [generate_element_dataframe] Generating df for element type: ObjectTypes.Pipe ...
[2026-03-27 18:30:38,414] DEBUG in sir3stoolkit.mantle.dataframes: [generate_element_dataframe] Generating df_model_data for element type: ObjectTypes.Pipe ...
[2026-03-27 18:30:39,221] INFO in sir3stoolkit.mantle.dataframes: [model_data] Generating model_data dataframe for element type: ObjectTypes.Pipe
[2026-03-27 18:30:39,232] INFO in sir3stoolkit.mantle.dataframes: [model_data] Retrieved 524 element(s) of element type ObjectTypes.Pipe.
[2026-03-27 18:30:39,308] INFO in sir3stoolkit.mantle.dataframes: [Resolving model_data Properties] No properties given → using ALL model_data properties for ObjectTypes.Pipe.
[2026-03-27 18:30:39,310] INFO in sir3stoolkit.mantle.dataframes: [Resolving model_data Properties] Using 46 model_data properties.
[2026-03-27 18:30:39,313] INFO in sir3stoolkit.mantle.dataframes: [model_data] Retrieving model_data properties ['Name', 'FkdtroRowd', 'Fkltgr', 'Fkstrasse', 'L', 'Lzu', 'Rau', 'Jlambs', 'Lambda0', 'Zein', 'Zaus', 'Zuml', 'Asoll', 'Indschall', 'Baujahr', 'Hal', 'Fkcont', 'Fk2lrohr', 'Beschreibung', 'Idreferenz', 'Iplanung', 'Kvr', 'LineWidthMM', 'DottedLine', 'DN', 'Di', 'KvrKlartext', 'HasClosedNSCHs', 'Tk', 'Pk', 'InVariant', 'Xkor', 'Ykor', 'GeometriesDiffer', 'bz.Fk', 'bz.Qsvb', 'bz.Irtrenn', 'bz.Leckstatus', 'bz.Leckstart', 'bz.Leckend', 'bz.Leckort', 'bz.Leckmenge', 'bz.Imptnz', 'bz.Zvlimptnz', 'bz.Kantenzv', 'bz.ITrennWithNSCH'], geometry, end nodes...
[2026-03-27 18:30:45,561] INFO in sir3stoolkit.mantle.dataframes: [model_data] 2 non-empty end node columns were created.
[2026-03-27 18:30:46,019] INFO in sir3stoolkit.mantle.dataframes: [model_data] Transforming DataFrame to GeoDataFrame successful with EPSG: 25832
[2026-03-27 18:30:46,020] INFO in sir3stoolkit.mantle.dataframes: [model_data] Done. Shape: (524, 67)
[2026-03-27 18:30:46,141] DEBUG in sir3stoolkit.mantle.dataframes: [generate_element_dataframe] Generating df_results for element type: ObjectTypes.Pipe; at timestamp: 2023-02-13 00:00:00.000 +01:00 ...
[2026-03-27 18:30:46,141] INFO in sir3stoolkit.mantle.dataframes: [results] Generating results dataframe for element type: ObjectTypes.Pipe
[2026-03-27 18:30:46,271] INFO in sir3stoolkit.mantle.dataframes: [Resolving Timestamps] Only static timestamp 2023-02-13 00:00:00.000 +01:00 is used
[2026-03-27 18:30:46,272] INFO in sir3stoolkit.mantle.dataframes: [Resolving Timestamps] 1 valid timestamp(s) will be used.
[2026-03-27 18:30:46,276] INFO in sir3stoolkit.mantle.dataframes: [Resolving tks] Retrieved 524 element(s) of element type ObjectTypes.Pipe.
[2026-03-27 18:30:46,281] INFO in sir3stoolkit.mantle.dataframes: [results] Using 82 result properties.
[2026-03-27 18:30:46,326] INFO in sir3stoolkit.mantle.dataframes: [results] Retrieving result values...
[2026-03-27 18:30:56,801] INFO in sir3stoolkit.mantle.dataframes: [results] 26724 fully NaN columns dropped.
[2026-03-27 18:31:00,716] INFO in sir3stoolkit.mantle.dataframes: [results] Done. Shape: (1, 16244)
[2026-03-27 18:31:00,723] DEBUG in sir3stoolkit.mantle.dataframes: [generate_element_dataframe] Merging df_model_data with df_results for element type: ObjectTypes.Pipe ...
[14]:
df_pipes.head(3)
[14]:
| tk | Name | FkdtroRowd | Fkltgr | Fkstrasse | L | Lzu | Rau | Jlambs | Lambda0 | Zein | Zaus | Zuml | Asoll | Indschall | Baujahr | Hal | Fkcont | Fk2lrohr | Beschreibung | Idreferenz | Iplanung | Kvr | LineWidthMM | DottedLine | DN | Di | KvrKlartext | HasClosedNSCHs | Tk | Pk | InVariant | Xkor | Ykor | GeometriesDiffer | bz.Fk | bz.Qsvb | bz.Irtrenn | bz.Leckstatus | bz.Leckstart | bz.Leckend | bz.Leckort | bz.Leckmenge | bz.Imptnz | bz.Zvlimptnz | bz.Kantenzv | bz.ITrennWithNSCH | geometry | fkKI | fkKK | PipeTable: Table Name | PipeTable: Name | PipeTable: Fk | PipeTable: Dn | PipeTable: Di | PipeTable: Da | PipeTable: S | PipeTable: Wsteig | PipeTable: Wtiefe | PipeTable: Kt | PipeTable: Pn | PipeTable: Ausfallzeit | PipeTable: Reparatur | PipeTable: Rehabilitation | PipeTable: Tk | PipeTable: Pk | PipeTable: InVariant | A | DTTR | DWVERL | DWVERLABS | IAKTIV | IRTRENN | JV | MVEC_start | MVEC_end | MVEC_sequence | PDAMPF | PHR | PMIN | PVEC_start | PVEC_end | PVEC_sequence | PVECMAX_INST_start | PVECMAX_INST_end | PVECMAX_INST_sequence | PVECMIN_INST_start | PVECMIN_INST_end | PVECMIN_INST_sequence | QMAV | QMI | QMK | RHOI | RHOK | RHOVEC_start | RHOVEC_end | RHOVEC_sequence | SVEC_start | SVEC_end | SVEC_sequence | TI | TK | TTRVEC_start | TTRVEC_end | TTRVEC_sequence | TVEC_start | TVEC_end | TVEC_sequence | VAV | VI | VK | VOLDA | WVL | ZVEC_start | ZVEC_end | ZVEC_sequence | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 4614463970292122863 | Rohr R-K4383S R-K4183S | 4689226368751411179 | 4779752876656844188 | 5431845028903382031 | 7.780674 | 0 | 0.05 | 1 | 0 | 0 | 0 | 0 | 1000 | 0 | 0 | 5029128874972463118 | 4713734746689397424 | OSM: Knoten 450994211 -> Knoten 476971188; Län... | 166815824 | 5 | 2 | 0.005 | 0 | 999 | 994.0 | Rücklauf | 4614463970292122863 | 4614463970292122863 | False | 714262.482930 | 5.578857e+06 | False | 4614463970292122863 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | LINESTRING (714262.483 5578857.42, 714269.543 ... | 4730066059089961857 | 4917189080965035120 | KMR | DN 999 | 4927972999088213410 | 999 | 994.0 | 1014.0 | 10.0 | 0 | 0 | 1.212 | 0 | 0 | 0 | 1950 | 4689226368751411179 | 4689226368751411179 | False | 0.0 | 7.780674 | 0.0 | 0.0 | 1.0 | 0.0 | 0.0 | 5.748007e-10 | 5.748007e-10 | (5.748007e-10, 5.748007e-10) | 0.0123 | 0.0 | 1.615057 | 1.615055 | 1.68863 | (1.615055, 1.68863) | 1.615055 | 1.68863 | (1.615055, 1.68863) | 1.615055 | 1.68863 | (1.615055, 1.68863) | 0.0 | 0.0 | 0.0 | 1000.3 | 1000.3 | 1000.3000 | 1000.3000 | (1000.3, 1000.3) | 0.0 | 7.780674 | (0.0, 7.780674) | 9.999994 | 9.999994 | 166.698300 | 174.479000 | (166.6983, 174.479) | 10.0000 | 10.000 | (10.0, 10.0) | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 545.09 | 544.34 | (545.09, 544.34) | ||
| 1 | 4615723899944629797 | Rohr V-K203S V-K213S | 4689226368751411179 | 4779752876656844188 | 5728726059620036726 | 64.287240 | 0 | 0.05 | 1 | 0 | 0 | 0 | 0 | 1000 | 0 | 0 | 5029128874972463118 | 4938076287810941486 | OSM: Knoten 390310977 -> Knoten 1368674233; Lä... | 24633100 | 5 | 1 | 0.005 | 0 | 999 | 994.0 | Vorlauf | 4615723899944629797 | 4615723899944629797 | False | 713738.296567 | 5.579220e+06 | False | 4615723899944629797 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | LINESTRING (713738.297 5579219.902, 713793.23 ... | 5129584372458662150 | 5332825919690090061 | KMR | DN 999 | 4927972999088213410 | 999 | 994.0 | 1014.0 | 10.0 | 0 | 0 | 1.212 | 0 | 0 | 0 | 1950 | 4689226368751411179 | 4689226368751411179 | False | 0.0 | 64.28724 | 0.0 | 0.0 | 1.0 | 0.0 | 0.0 | -2.983143e-10 | -2.983143e-10 | (-2.983143e-10, -2.983143e-10, -2.983143e-10, ... | 0.0123 | 0.0 | 3.304769 | 3.304770 | 3.59023 | (3.30477, 3.34555, 3.38633, 3.42711, 3.46789, ... | 3.304770 | 3.59023 | (3.30477, 3.34555, 3.38633, 3.42711, 3.46789, ... | 3.304770 | 3.59023 | (3.30477, 3.34555, 3.38633, 3.42711, 3.46789, ... | -0.0 | -0.0 | -0.0 | 1000.3 | 1000.3 | 1000.3000 | 1000.3000 | (1000.3, 1000.3, 1000.3, 1000.3, 1000.3, 1000.... | 0.0 | 64.287240 | (0.0, 9.183891, 18.36778, 27.55167, 36.73557, ... | 9.999994 | 9.999994 | 107.366900 | 43.079700 | (107.3669, 98.18304, 88.99916, 79.81527, 70.63... | 10.0000 | 10.000 | (10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0) | -0.0 | -0.0 | -0.0 | 0.0 | 0.0 | 565.84 | 562.93 | (565.84, 565.4243, 565.0086, 564.5929, 564.177... | ||
| 2 | 4621030304810285220 | Rohr R-K2573S R-K2583S | 5516336706687055417 | 4779752876656844188 | 5644881417512616095 | 3.956838 | 0 | 0.05 | 1 | 0 | 0 | 0 | 0 | 1000 | 0 | 0 | 5029128874972463118 | 5625716875961234775 | OSM: Knoten 476971211 -> Knoten 264607350; Län... | 24386111 | 0 | 2 | 0.005 | 0 | 100 | 107.1 | Rücklauf | 4621030304810285220 | 4621030304810285220 | False | 713650.613400 | 5.578990e+06 | False | 4621030304810285220 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | LINESTRING (713650.613 5578990.488, 713649.498... | 5070795580168283912 | 5725848577942138606 | KMR | DN 100 | 4927972999088213410 | 100 | 107.1 | 114.3 | 3.6 | 0 | 0 | 0.325 | 0 | 0 | 0 | 600 | 5516336706687055417 | 5516336706687055417 | False | 0.0 | 0.002291 | 16.2622 | 0.064347 | 0.0 | 0.0 | 0.211137 | -4.251046e+00 | -4.251046e+00 | (-4.251046, -4.251046) | 0.198023 | 0.000835 | 2.198662 | 2.210370 | 2.19866 | (2.21037, 2.19866) | 2.210370 | 2.19866 | (2.21037, 2.19866) | 2.210370 | 2.19866 | (2.21037, 2.19866) | -15.30376 | -15.30376 | -15.30376 | 983.7663 | 983.7645 | 983.7663 | 983.7645 | (983.7663, 983.7645) | 0.0 | 3.956838 | (0.0, 3.956838) | 59.86739 | 59.871 | 0.055451 | 0.053159 | (0.05545081, 0.05315936) | 59.8674 | 59.871 | (59.8674, 59.871) | -0.479662 | -0.479662 | -0.479662 | 0.0 | 0.0 | 563.01 | 563.14 | (563.01, 563.14) |
We can access for example the heat loss of pipes, that is saved in the nominal diameter table.
[15]:
df_pipes[["tk", "Name", "PipeTable: Table Name", "PipeTable: Kt"]].head(3)
[15]:
| tk | Name | PipeTable: Table Name | PipeTable: Kt | |
|---|---|---|---|---|
| 0 | 4614463970292122863 | Rohr R-K4383S R-K4183S | KMR | 1.212 |
| 1 | 4615723899944629797 | Rohr V-K203S V-K213S | KMR | 1.212 |
| 2 | 4621030304810285220 | Rohr R-K2573S R-K2583S | KMR | 0.325 |