diff --git a/resources/config/nodetypes.json b/resources/config/nodetypes.json
new file mode 100644
index 0000000..b94ff68
--- /dev/null
+++ b/resources/config/nodetypes.json
@@ -0,0 +1,162 @@
+{
+ "relations": [
+ { "id": "water", "name": "Water", "color": "#1c78c0", "darkColor": "#4aa3e8" },
+ { "id": "power", "name": "Power", "color": "#d99000", "darkColor": "#f0b429" }
+ ],
+ "catalogues": [
+ {
+ "id": "pipe_series",
+ "name": "Pipe series",
+ "items": [
+ { "id": "dn50", "name": "DN50 Steel", "attributes": { "diameter": 50, "material": "steel" } },
+ { "id": "dn80", "name": "DN80 Steel", "attributes": { "diameter": 80, "material": "steel" } },
+ { "id": "dn100", "name": "DN100 Steel", "attributes": { "diameter": 100, "material": "steel" } },
+ { "id": "dn150", "name": "DN150 Steel", "attributes": { "diameter": 150, "material": "steel" } },
+ { "id": "pe63", "name": "PE63 Plastic", "attributes": { "diameter": 63, "material": "PE" } },
+ { "id": "pe110", "name": "PE110 Plastic","attributes": { "diameter": 110, "material": "PE" } }
+ ]
+ },
+ {
+ "id": "insulation",
+ "name": "Insulation options",
+ "items": [
+ { "id": "foam", "name": "PU foam shell" },
+ { "id": "wool", "name": "Mineral wool" },
+ { "id": "heating", "name": "Heat tracing" },
+ { "id": "coating", "name": "Anticorrosive coating" }
+ ]
+ },
+ {
+ "id": "cable_series",
+ "name": "Cable series",
+ "items": [
+ { "id": "cu16", "name": "Cu 16 mm²", "attributes": { "section": 16 } },
+ { "id": "cu35", "name": "Cu 35 mm²", "attributes": { "section": 35 } },
+ { "id": "al50", "name": "Al 50 mm²", "attributes": { "section": 50 } }
+ ]
+ }
+ ],
+ "edgeProperties": {
+ "water": [
+ { "id": "length", "name": "Length", "group": "Physics", "type": "float", "default": 10.0, "unit": "m", "min": 0.1, "max": 100000 },
+ { "id": "diameter", "name": "Diameter", "group": "Physics", "type": "float", "default": 100.0, "unit": "mm", "min": 10, "max": 2000 },
+ { "id": "flowRate", "name": "Flow rate", "group": "Physics", "type": "float", "default": 0.0, "unit": "m³/h", "readOnly": true },
+ { "id": "flowType", "name": "Flow type", "group": "Physics", "type": "enum", "values": ["Laminar", "Transitional", "Turbulent"], "default": "Laminar" },
+ { "id": "series", "name": "Pipe series", "group": "Physics", "type": "catalogueItem", "catalogue": "pipe_series" },
+ { "id": "extras", "name": "Extras", "group": "Physics", "type": "catalogueItems", "catalogue": "insulation", "default": [] }
+ ],
+ "power": [
+ { "id": "length", "name": "Length", "group": "Physics", "type": "float", "default": 10.0, "unit": "m", "min": 0.1, "max": 100000 },
+ { "id": "series", "name": "Cable", "group": "Physics", "type": "catalogueItem", "catalogue": "cable_series" },
+ { "id": "voltage", "name": "Voltage", "group": "Physics", "type": "enum", "values": ["0.4 kV", "6 kV", "10 kV"], "default": "0.4 kV" },
+ { "id": "flowRate","name": "Load", "group": "Physics", "type": "float", "default": 0.0, "unit": "kW", "readOnly": true }
+ ]
+ },
+ "nodeTypes": [
+ {
+ "id": "water_source", "name": "Source", "group": "Water supply",
+ "svg": ":/svg/water_source.svg", "size": [60, 60],
+ "ports": [
+ { "id": "out", "relation": "water", "direction": "out", "pos": [1.0, 0.5], "side": "right", "maxConnections": 0 }
+ ],
+ "properties": [
+ { "id": "supply", "name": "Supply", "group": "Physics", "type": "float", "default": 10.0, "unit": "m³/h", "min": 0, "max": 100000 },
+ { "id": "elevation", "name": "Elevation", "group": "Physics", "type": "float", "default": 0.0, "unit": "m" }
+ ]
+ },
+ {
+ "id": "tank", "name": "Tank", "group": "Water supply",
+ "svg": ":/svg/tank.svg", "size": [60, 60],
+ "ports": [
+ { "id": "in", "relation": "water", "direction": "in", "pos": [0.0, 0.5], "side": "left" },
+ { "id": "out", "relation": "water", "direction": "out", "pos": [1.0, 0.5], "side": "right" }
+ ],
+ "properties": [
+ { "id": "volume", "name": "Volume", "group": "Physics", "type": "float", "default": 50.0, "unit": "m³", "min": 0, "max": 100000 }
+ ]
+ },
+ {
+ "id": "pump", "name": "Pump", "group": "Water supply",
+ "svg": ":/svg/pump.svg", "size": [60, 60],
+ "ports": [
+ { "id": "in", "relation": "water", "direction": "in", "pos": [0.0, 0.5], "side": "left" },
+ { "id": "out", "relation": "water", "direction": "out", "pos": [1.0, 0.5], "side": "right" },
+ { "id": "pwr", "relation": "power", "direction": "in", "pos": [0.5, 0.0], "side": "top" }
+ ],
+ "properties": [
+ { "id": "head", "name": "Head", "group": "Physics", "type": "float", "default": 20.0, "unit": "m", "min": 0, "max": 2000 },
+ { "id": "power", "name": "Rated power","group": "Physics", "type": "float", "default": 5.5, "unit": "kW", "min": 0, "max": 10000 }
+ ]
+ },
+ {
+ "id": "valve", "name": "Valve", "group": "Water supply",
+ "svg": ":/svg/valve.svg", "size": [50, 50],
+ "ports": [
+ { "id": "in", "relation": "water", "direction": "inout", "pos": [0.0, 0.5], "side": "left" },
+ { "id": "out", "relation": "water", "direction": "inout", "pos": [1.0, 0.5], "side": "right" }
+ ],
+ "properties": [
+ { "id": "state", "name": "State", "group": "Physics", "type": "enum", "values": ["Open", "Closed", "Throttled"], "default": "Open" }
+ ]
+ },
+ {
+ "id": "junction", "name": "Junction", "group": "Water supply",
+ "svg": ":/svg/junction.svg", "size": [40, 40],
+ "ports": [
+ { "id": "w", "relation": "water", "direction": "inout", "pos": [0.0, 0.5], "side": "left", "maxConnections": 0 },
+ { "id": "e", "relation": "water", "direction": "inout", "pos": [1.0, 0.5], "side": "right", "maxConnections": 0 },
+ { "id": "n", "relation": "water", "direction": "inout", "pos": [0.5, 0.0], "side": "top", "maxConnections": 0 },
+ { "id": "s", "relation": "water", "direction": "inout", "pos": [0.5, 1.0], "side": "bottom", "maxConnections": 0 }
+ ]
+ },
+ {
+ "id": "consumer", "name": "Consumer", "group": "Water supply",
+ "svg": ":/svg/consumer.svg", "size": [60, 60],
+ "ports": [
+ { "id": "in", "relation": "water", "direction": "in", "pos": [0.0, 0.5], "side": "left" }
+ ],
+ "properties": [
+ { "id": "demand", "name": "Demand", "group": "Physics", "type": "float", "default": 10.0, "unit": "m³/h", "min": 0, "max": 100000 }
+ ]
+ },
+ {
+ "id": "generator", "name": "Generator", "group": "Power",
+ "svg": ":/svg/generator.svg", "size": [60, 60],
+ "ports": [
+ { "id": "out", "relation": "power", "direction": "out", "pos": [1.0, 0.5], "side": "right", "maxConnections": 0 }
+ ],
+ "properties": [
+ { "id": "supply", "name": "Output power", "group": "Physics", "type": "float", "default": 100.0, "unit": "kW", "min": 0, "max": 1000000 }
+ ]
+ },
+ {
+ "id": "transformer", "name": "Transformer", "group": "Power",
+ "svg": ":/svg/transformer.svg", "size": [60, 60],
+ "ports": [
+ { "id": "in", "relation": "power", "direction": "in", "pos": [0.0, 0.5], "side": "left" },
+ { "id": "out", "relation": "power", "direction": "out", "pos": [1.0, 0.5], "side": "right", "maxConnections": 0 }
+ ]
+ },
+ {
+ "id": "switch", "name": "Switch", "group": "Power",
+ "svg": ":/svg/switch.svg", "size": [50, 50],
+ "ports": [
+ { "id": "a", "relation": "power", "direction": "inout", "pos": [0.0, 0.5], "side": "left" },
+ { "id": "b", "relation": "power", "direction": "inout", "pos": [1.0, 0.5], "side": "right" }
+ ],
+ "properties": [
+ { "id": "state", "name": "State", "group": "Physics", "type": "enum", "values": ["Closed", "Open"], "default": "Closed" }
+ ]
+ },
+ {
+ "id": "load", "name": "Load", "group": "Power",
+ "svg": ":/svg/consumer.svg", "size": [60, 60],
+ "ports": [
+ { "id": "in", "relation": "power", "direction": "in", "pos": [0.0, 0.5], "side": "left" }
+ ],
+ "properties": [
+ { "id": "demand", "name": "Power demand", "group": "Physics", "type": "float", "default": 15.0, "unit": "kW", "min": 0, "max": 1000000 }
+ ]
+ }
+ ]
+}
diff --git a/resources/resources.qrc b/resources/resources.qrc
new file mode 100644
index 0000000..631b79b
--- /dev/null
+++ b/resources/resources.qrc
@@ -0,0 +1,15 @@
+
+
+ svg/water_source.svg
+ svg/tank.svg
+ svg/pump.svg
+ svg/valve.svg
+ svg/consumer.svg
+ svg/junction.svg
+ svg/generator.svg
+ svg/transformer.svg
+ svg/switch.svg
+ config/nodetypes.json
+ samples/waterworks.json
+
+
diff --git a/resources/samples/waterworks.json b/resources/samples/waterworks.json
new file mode 100644
index 0000000..fce468c
--- /dev/null
+++ b/resources/samples/waterworks.json
@@ -0,0 +1,51 @@
+{
+ "format": "pipediagram",
+ "version": 1,
+ "nodes": [
+ { "id": "11111111-0000-0000-0000-000000000001", "type": "water_source", "pos": [-400, 0],
+ "props": { "title": "Intake", "supply": 24.0 } },
+ { "id": "11111111-0000-0000-0000-000000000002", "type": "pump", "pos": [-240, 0],
+ "props": { "title": "P-101" } },
+ { "id": "11111111-0000-0000-0000-000000000003", "type": "junction", "pos": [-70, 10] },
+ { "id": "11111111-0000-0000-0000-000000000004", "type": "tank", "pos": [60, -160],
+ "props": { "title": "T-1" } },
+ { "id": "11111111-0000-0000-0000-000000000005", "type": "consumer", "pos": [120, 0],
+ "props": { "title": "District A", "demand": 15.0 } },
+ { "id": "11111111-0000-0000-0000-000000000006", "type": "consumer", "pos": [60, 160],
+ "props": { "title": "District B", "demand": 9.0 } },
+ { "id": "11111111-0000-0000-0000-000000000007", "type": "generator", "pos": [-400, -200],
+ "props": { "title": "G-1" } },
+ { "id": "11111111-0000-0000-0000-000000000008", "type": "load", "pos": [-60, -300],
+ "props": { "title": "Aux load", "demand": 20.0 } }
+ ],
+ "edges": [
+ { "id": "22222222-0000-0000-0000-000000000001",
+ "from": "11111111-0000-0000-0000-000000000001", "fromPort": "out",
+ "to": "11111111-0000-0000-0000-000000000002", "toPort": "in",
+ "props": { "diameter": 150, "length": 25 } },
+ { "id": "22222222-0000-0000-0000-000000000002",
+ "from": "11111111-0000-0000-0000-000000000002", "fromPort": "out",
+ "to": "11111111-0000-0000-0000-000000000003", "toPort": "w",
+ "props": { "diameter": 150, "length": 40 } },
+ { "id": "22222222-0000-0000-0000-000000000003",
+ "from": "11111111-0000-0000-0000-000000000003", "fromPort": "n",
+ "to": "11111111-0000-0000-0000-000000000004", "toPort": "in",
+ "props": { "diameter": 100, "length": 30, "title": "to tank" } },
+ { "id": "22222222-0000-0000-0000-000000000004",
+ "from": "11111111-0000-0000-0000-000000000003", "fromPort": "e",
+ "to": "11111111-0000-0000-0000-000000000005", "toPort": "in",
+ "props": { "diameter": 100, "length": 60 } },
+ { "id": "22222222-0000-0000-0000-000000000005",
+ "from": "11111111-0000-0000-0000-000000000003", "fromPort": "s",
+ "to": "11111111-0000-0000-0000-000000000006", "toPort": "in",
+ "props": { "diameter": 80, "length": 45 } },
+ { "id": "22222222-0000-0000-0000-000000000006",
+ "from": "11111111-0000-0000-0000-000000000007", "fromPort": "out",
+ "to": "11111111-0000-0000-0000-000000000002", "toPort": "pwr",
+ "props": {} },
+ { "id": "22222222-0000-0000-0000-000000000007",
+ "from": "11111111-0000-0000-0000-000000000007", "fromPort": "out",
+ "to": "11111111-0000-0000-0000-000000000008", "toPort": "in",
+ "props": { "title": "aux feeder" } }
+ ]
+}
diff --git a/resources/svg/consumer.svg b/resources/svg/consumer.svg
new file mode 100644
index 0000000..286bcee
--- /dev/null
+++ b/resources/svg/consumer.svg
@@ -0,0 +1,5 @@
+
diff --git a/resources/svg/generator.svg b/resources/svg/generator.svg
new file mode 100644
index 0000000..3fa6607
--- /dev/null
+++ b/resources/svg/generator.svg
@@ -0,0 +1,4 @@
+
diff --git a/resources/svg/junction.svg b/resources/svg/junction.svg
new file mode 100644
index 0000000..662fbcb
--- /dev/null
+++ b/resources/svg/junction.svg
@@ -0,0 +1,5 @@
+
diff --git a/resources/svg/pump.svg b/resources/svg/pump.svg
new file mode 100644
index 0000000..985ae03
--- /dev/null
+++ b/resources/svg/pump.svg
@@ -0,0 +1,5 @@
+
diff --git a/resources/svg/switch.svg b/resources/svg/switch.svg
new file mode 100644
index 0000000..687361b
--- /dev/null
+++ b/resources/svg/switch.svg
@@ -0,0 +1,5 @@
+
diff --git a/resources/svg/tank.svg b/resources/svg/tank.svg
new file mode 100644
index 0000000..14db690
--- /dev/null
+++ b/resources/svg/tank.svg
@@ -0,0 +1,6 @@
+
diff --git a/resources/svg/transformer.svg b/resources/svg/transformer.svg
new file mode 100644
index 0000000..e9b3169
--- /dev/null
+++ b/resources/svg/transformer.svg
@@ -0,0 +1,4 @@
+
diff --git a/resources/svg/valve.svg b/resources/svg/valve.svg
new file mode 100644
index 0000000..c2217f6
--- /dev/null
+++ b/resources/svg/valve.svg
@@ -0,0 +1,6 @@
+
diff --git a/resources/svg/water_source.svg b/resources/svg/water_source.svg
new file mode 100644
index 0000000..b132590
--- /dev/null
+++ b/resources/svg/water_source.svg
@@ -0,0 +1,5 @@
+