Compare commits

..

29 Commits

Author SHA1 Message Date
858189d6da Update get_all_assets.php vanaf tagcode.app 2025-11-21 03:00:01 +00:00
ec42ebcb25 Update get_all_assets.php vanaf tagcode.app 2025-11-20 12:15:55 +00:00
f4629e5fcc Update get_all_assets.php vanaf extern endpoint 2025-11-17 15:57:29 +00:00
dafe4c5336 Delete datasets/tagcodeapp_product_models.json 2025-11-17 15:57:15 +00:00
5439d5111a Delete datasets/tagcodeapp_assets.json 2025-11-17 15:57:08 +00:00
1e5ef47a4d Delete datasets/get_all_assets.php 2025-11-17 15:57:02 +00:00
2b87c67876 Update get_all_assets.php vanaf extern endpoint 2025-11-17 15:00:01 +00:00
0db90c0e4b Delete data/get_all_assets.php 2025-11-17 14:58:33 +00:00
1e07093101 Update get_all_assets.php vanaf extern endpoint 2025-11-17 14:58:01 +00:00
ce25ee930a Add ammonium and NOx quantity sensors to assetData 2025-11-12 10:47:41 +01:00
a293e0286a Merge pull request 'Add addtional and updated configs' (#12) from dev-Pieter into main
Reviewed-on: #12
2025-11-06 14:01:32 +00:00
012b8a7ff6 Merge pull request 'Merging to latest updates' (#10) from dev-Rene into main
Reviewed-on: #10
2025-11-03 14:24:58 +00:00
znetsixe
9610e7138d Added extra pump data
lagged sample in measurement
2025-11-03 15:22:51 +01:00
d5d078413c Add flowNumber configuration to define effluent flow handling 2025-10-31 14:03:54 +01:00
17662ef7cb Add total suspended solids sensor to assetData 2025-10-31 13:53:35 +01:00
9d8da15d0e Merge pull request 'Register multiple parents during child registration' (#9) from dev-Pieter into main
Reviewed-on: #9
2025-10-31 10:36:28 +00:00
d503cf5dc9 Merge pull request 'Added does measurement exist in measurement' (#8) from dev-Rene into main
Reviewed-on: #8
2025-10-24 19:20:31 +00:00
Rene De ren
48a227d519 Merge branch 'main' into dev-Rene 2025-10-24 15:22:08 +02:00
f653a1e98c Refactor child setup to support multiple parents consistently 2025-10-24 13:37:26 +02:00
znetsixe
1725c5b0e9 bug fixes for measurement container lagged retrieval-> unit conversion and sample output 2025-10-23 09:51:27 +02:00
znetsixe
d7cb8e1072 latest version 2025-10-21 12:45:06 +02:00
9b7a8ae2c8 Merge pull request 'dev-Rene added features' (#5) from dev-Rene into main
Reviewed-on: #5
2025-10-16 13:20:04 +00:00
znetsixe
dc50432ee8 accepted conflict 2025-10-16 15:19:17 +02:00
znetsixe
c99d24e4c6 added lagged value functionality for retrieving values further down in memory; Converted position always to lower case strings to avoid problems with caps sensitivity names; added examples for use in examples.js 2025-10-16 14:37:42 +02:00
znetsixe
f9d1348fd0 added pumpingStation config, expanded functionality for difference in measurement container 2025-10-15 14:09:37 +02:00
znetsixe
428c611ec6 added pumping station and commented out console stuf 2025-10-14 13:51:57 +02:00
2fb73e6713 Remove printing of EventData to prevent console spam 2025-10-10 11:12:38 +02:00
3886277616 Fix bug in parent registration code block 2025-09-29 17:13:34 +02:00
83018fabe0 Allow for multiple parents 2025-09-29 16:06:06 +02:00
12 changed files with 1786 additions and 262 deletions

View File

@@ -66,6 +66,33 @@
"units": ["g/m³", "mol/m³"]
}
]
},
{
"name": "Quantity (Ammonium)",
"models": [
{
"name": "VegaAmmoniaSense 10",
"units": ["g/m³", "mol/m³"]
}
]
},
{
"name": "Quantity (NOx)",
"models": [
{
"name": "VegaNOxSense 10",
"units": ["g/m³", "mol/m³"]
}
]
},
{
"name": "Quantity (TSS)",
"models": [
{
"name": "VegaSolidsProbe",
"units": ["g/m³"]
}
]
}
]
}
@@ -83,7 +110,12 @@
{
"id": "hidrostal-pump-001",
"name": "hidrostal-H05K-S03R",
"units": ["m³/h", "gpm", "l/min"]
"units": ["l/s"]
},
{
"id": "hidrostal-pump-002",
"name": "hidrostal-C5-D03R-SHN1",
"units": ["l/s"]
}
]
}

View File

@@ -0,0 +1,838 @@
{
"np": {
"400": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5953611390998625,
1.6935085477165994,
3.801139124304824,
7.367829525776738,
12.081735423116616
]
},
"500": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.8497068236812997,
3.801139124304824,
7.367829525776738,
12.081735423116616
]
},
"600": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.7497197821018213,
3.801139124304824,
7.367829525776738,
12.081735423116616
]
},
"700": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.788320579602724,
3.9982668237045984,
7.367829525776738,
12.081735423116616
]
},
"800": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.7824519364844427,
3.9885060367793064,
7.367829525776738,
12.081735423116616
]
},
"900": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6934482683506376,
3.9879559558537054,
7.367829525776738,
12.081735423116616
]
},
"1000": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6954385513069579,
4.0743508382926795,
7.422392692482345,
12.081735423116616
]
},
"1100": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
4.160745720731654,
7.596626714476177,
12.081735423116616
]
},
"1200": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
4.302551231007837,
7.637247864947884,
12.081735423116616
]
},
"1300": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
4.37557913990704,
7.773442147000839,
12.081735423116616
]
},
"1400": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
4.334434337766139,
7.940911352646818,
12.081735423116616
]
},
"1500": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
4.2327206586037995,
8.005238800611183,
12.254836577088351
]
},
"1600": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
4.195405588464695,
7.991827302945298,
12.423663269044452
]
},
"1700": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
14.255458319309813,
8.096768422220196,
12.584668380908582
]
},
"1800": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
31.54620347513727,
12.637080520201405
]
},
"1900": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
8.148423429611098,
12.74916725120127
]
},
"2000": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
8.146439484120116,
12.905178964345618
]
},
"2100": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
8.149576025637684,
13.006940917309247
]
},
"2200": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
8.126246430368305,
13.107503837410825
]
},
"2300": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
8.104379361635342,
13.223235973280122
]
},
"2400": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
8.135190080423746,
13.36128347785936
]
},
"2500": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
7.981219508598527,
13.473697427231842
]
},
"2600": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
7.863899404441271,
13.50303289156837
]
},
"2700": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
7.658860522528131,
13.485230880073107
]
},
"2800": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
7.44407948309266,
13.446135725634615
]
},
"2900": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
0.5522732775894703,
1.6920721090317592,
3.8742719210788685,
7.44407948309266,
13.413693596332184
]
}
},
"nq": {
"400": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
7.6803204433986965,
25.506609120436963,
35.4,
44.4,
52.5
]
},
"500": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
22.622804921188227,
35.4,
44.4,
52.5
]
},
"600": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
19.966301579194372,
35.4,
44.4,
52.5
]
},
"700": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
17.430763940163832,
33.79508340848005,
44.4,
52.5
]
},
"800": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
14.752921911234477,
31.71885034449889,
44.4,
52.5
]
},
"900": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
11.854693031181021,
29.923046639543475,
44.4,
52.5
]
},
"1000": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.549433913822687,
26.734189128096668,
43.96760750800311,
52.5
]
},
"1100": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
26.26933164936586,
42.23523193272671,
52.5
]
},
"1200": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
24.443114637042832,
40.57167959798151,
52.5
]
},
"1300": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
22.41596168949836,
39.04561852479495,
52.5
]
},
"1400": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
20.276864821170303,
37.557663261443224,
52.252852231224054
]
},
"1500": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
18.252772588147742,
35.9974418607538,
50.68604059588987
]
},
"1600": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
16.31441663648616,
34.51170378091407,
49.20153034100798
]
},
"1700": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
14.255458319309813,
33.043410795291045,
47.820213744181245
]
},
"1800": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
31.54620347513727,
46.51705619739449
]
},
"1900": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
29.986013742375484,
45.29506741639918
]
},
"2000": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
28.432646044605782,
44.107822395271945
]
},
"2100": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
26.892634464336055,
42.758175515158776
]
},
"2200": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
25.270679127870263,
41.467063889795895
]
},
"2300": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
23.531132157718837,
40.293041104955826
]
},
"2400": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
21.815645106750623,
39.03109248860755
]
},
"2500": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
20.34997949463564,
37.71320701654063
]
},
"2600": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
18.81710568651804,
36.35563657017404
]
},
"2700": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
17.259072160217805,
35.02979557646653
]
},
"2800": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
16,
33.74372254979665
]
},
"2900": {
"x": [
0,
25.510204081632654,
51.020408163265309,
76.530612244897952,
100
],
"y": [
6.4,
9.500000000000002,
12.7,
16,
32.54934541379723
]
}
}
}

View File

@@ -0,0 +1 @@
Database connection failed: SQLSTATE[28000] [1045] Access denied for user 'pimmoe1q_rdlab'@'localhost' (using password: YES)

File diff suppressed because one or more lines are too long

View File

@@ -1,229 +0,0 @@
{
"success": true,
"message": "Product modellen succesvol opgehaald.",
"data": [
{
"id": "1",
"name": "Macbook Air 12",
"product_model_subtype_id": "1",
"product_model_description": null,
"vendor_id": "1",
"product_model_status": null,
"vendor_name": "Apple",
"product_subtype_name": "Laptop",
"product_model_meta": []
},
{
"id": "2",
"name": "Macbook Air 13",
"product_model_subtype_id": "1",
"product_model_description": null,
"vendor_id": "1",
"product_model_status": null,
"vendor_name": "Apple",
"product_subtype_name": "Laptop",
"product_model_meta": []
},
{
"id": "3",
"name": "AirMac 1 128 GB White",
"product_model_subtype_id": "2",
"product_model_description": null,
"vendor_id": "1",
"product_model_status": null,
"vendor_name": "Apple",
"product_subtype_name": "Desktop",
"product_model_meta": []
},
{
"id": "4",
"name": "AirMac 2 256 GB Black",
"product_model_subtype_id": "2",
"product_model_description": null,
"vendor_id": "1",
"product_model_status": null,
"vendor_name": "Apple",
"product_subtype_name": "Desktop",
"product_model_meta": []
},
{
"id": "5",
"name": "AirMac 2 256 GB White",
"product_model_subtype_id": "2",
"product_model_description": null,
"vendor_id": "1",
"product_model_status": null,
"vendor_name": "Apple",
"product_subtype_name": "Desktop",
"product_model_meta": []
},
{
"id": "6",
"name": "Vegabar 14",
"product_model_subtype_id": "3",
"product_model_description": "vegabar 14",
"vendor_id": "4",
"product_model_status": "Actief",
"vendor_name": "vega",
"product_subtype_name": "pressure",
"product_model_meta": {
"machineCurve": {
"np": {
"700": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
12.962460720759278,
20.65443723573673,
31.029351002816465,
44.58926412111886,
62.87460150792057
]
},
"800": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
13.035157335397209,
20.74906989186132,
31.029351002816465,
44.58926412111886,
62.87460150792057
]
},
"900": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
13.064663380158798,
20.927197054134297,
31.107126521989933,
44.58926412111886,
62.87460150792057
]
},
"1000": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
13.039271391128953,
21.08680188366637,
31.30899920405947,
44.58926412111886,
62.87460150792057
]
},
"1100": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
12.940075520572446,
21.220547481589954,
31.51468295656385,
44.621326083982,
62.87460150792057
]
}
},
"nq": {
"700": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
119.13938764447377,
150.12178608265387,
178.82698019104356,
202.3699313222398,
227.06382297856618
]
},
"800": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
112.59072109293984,
148.15847460389205,
178.82698019104356,
202.3699313222398,
227.06382297856618
]
},
"900": {
"x": [
0,
24.59,
49.18,
73.77,
100
],
"y": [
105.6217241180404,
144.00502117747064,
177.15212647335034,
202.3699313222398,
227.06382297856618
]
}
}
}
}
},
{
"id": "7",
"name": "Vegabar 10",
"product_model_subtype_id": "3",
"product_model_description": null,
"vendor_id": "4",
"product_model_status": "Actief",
"vendor_name": "vega",
"product_subtype_name": "pressure",
"product_model_meta": []
},
{
"id": "8",
"name": "VegaFlow 10",
"product_model_subtype_id": "4",
"product_model_description": null,
"vendor_id": "4",
"product_model_status": "Actief",
"vendor_name": "vega",
"product_subtype_name": "flow",
"product_model_meta": []
}
]
}

View File

@@ -0,0 +1,694 @@
{
"general": {
"name": {
"default": "Pumping Station",
"rules": {
"type": "string",
"description": "A human-readable name or label for this pumping station configuration."
}
},
"id": {
"default": null,
"rules": {
"type": "string",
"nullable": true,
"description": "A unique identifier for this pumping station configuration. If not provided, defaults to null."
}
},
"unit": {
"default": "m3/h",
"rules": {
"type": "string",
"description": "The default flow unit used for reporting station throughput."
}
},
"logging": {
"logLevel": {
"default": "info",
"rules": {
"type": "enum",
"values": [
{
"value": "debug",
"description": "Log verbose diagnostic messages that aid in troubleshooting the station."
},
{
"value": "info",
"description": "Log general informational messages about station behavior."
},
{
"value": "warn",
"description": "Log warnings when station behavior deviates from expected ranges."
},
{
"value": "error",
"description": "Log only error level messages for critical failures."
}
],
"description": "Defines the minimum severity that will be written to the log."
}
},
"enabled": {
"default": true,
"rules": {
"type": "boolean",
"description": "If true, logging is active for the pumping station node."
}
}
}
},
"functionality": {
"softwareType": {
"default": "pumpingStation",
"rules": {
"type": "string",
"description": "Specified software type used to locate the proper default configuration."
}
},
"role": {
"default": "StationController",
"rules": {
"type": "string",
"description": "Describes the station's function within the EVOLV ecosystem."
}
},
"positionVsParent": {
"default": "atEquipment",
"rules": {
"type": "enum",
"description": "Defines how the station is positioned relative to its parent process or site.",
"values": [
{
"value": "atEquipment",
"description": "The station is controlled at the equipment level and represents the primary pumping asset."
},
{
"value": "upstream",
"description": "The station governs flows entering upstream of the parent asset."
},
{
"value": "downstream",
"description": "The station influences conditions downstream of the parent asset, such as discharge or transfer."
}
]
}
},
"tickIntervalMs": {
"default": 1000,
"rules": {
"type": "number",
"min": 100,
"description": "Interval in milliseconds between internal evaluation cycles and output refreshes."
}
},
"supportsSimulation": {
"default": true,
"rules": {
"type": "boolean",
"description": "Indicates whether the station can operate using simulated inflow and level data."
}
},
"supportedChildSoftwareTypes": {
"default": [
"measurement"
],
"rules": {
"type": "set",
"itemType": "string",
"description": "List of child node software types that may register with the station."
}
}
},
"asset": {
"uuid": {
"default": null,
"rules": {
"type": "string",
"nullable": true,
"description": "Asset tag number which is a universally unique identifier for this pumping station."
}
},
"tagCode": {
"default": null,
"rules": {
"type": "string",
"nullable": true,
"description": "Asset tag code which uniquely identifies the pumping station. May be null if not assigned."
}
},
"category": {
"default": "station",
"rules": {
"type": "enum",
"values": [
{
"value": "station",
"description": "Represents a dedicated pumping station asset."
}
],
"description": "High level classification for asset reporting."
}
},
"type": {
"default": "pumpingStation",
"rules": {
"type": "string",
"description": "Specific asset type used to identify this configuration."
}
},
"model": {
"default": "Unknown",
"rules": {
"type": "string",
"description": "Manufacturer or integrator model designation for the station."
}
},
"supplier": {
"default": "Unknown",
"rules": {
"type": "string",
"description": "Primary supplier or maintainer responsible for the station."
}
},
"geoLocation": {
"default": {
"x": 0,
"y": 0,
"z": 0
},
"rules": {
"type": "object",
"description": "Coordinate reference for locating the pumping station.",
"schema": {
"x": {
"default": 0,
"rules": {
"type": "number",
"description": "X coordinate in meters or site units."
}
},
"y": {
"default": 0,
"rules": {
"type": "number",
"description": "Y coordinate in meters or site units."
}
},
"z": {
"default": 0,
"rules": {
"type": "number",
"description": "Z coordinate in meters or site units."
}
}
}
}
}
},
"basin": {
"volume": {
"default": "1",
"rules": {
"type": "number",
"description": "Total volume of empty basin in m3"
}
},
"height": {
"default": "1",
"rules": {
"type": "number",
"description": "Total height of basin in m"
}
},
"levelUnit": {
"default": "m",
"rules": {
"type": "string",
"description": "Unit used for level related setpoints and thresholds."
}
},
"heightInlet": {
"default": 2,
"rules": {
"type": "number",
"min": 0,
"description": "Height of the inlet pipe measured from the basin floor (m)."
}
},
"heightOutlet": {
"default": 0.2,
"rules": {
"type": "number",
"min": 0,
"description": "Height of the outlet pipe measured from the basin floor (m)."
}
},
"heightOverflow": {
"default": 2.5,
"rules": {
"type": "number",
"min": 0,
"description": "Height of the overflow point measured from the basin floor (m)."
}
},
"inletPipeDiameter": {
"default": 0.4,
"rules": {
"type": "number",
"min": 0,
"description": "Nominal inlet pipe diameter (m)."
}
},
"outletPipeDiameter": {
"default": 0.4,
"rules": {
"type": "number",
"min": 0,
"description": "Nominal outlet pipe diameter (m)."
}
}
},
"hydraulics": {
"maxInflowRate": {
"default": 200,
"rules": {
"type": "number",
"min": 0,
"description": "Maximum expected inflow during peak events (m3/h)."
}
},
"refHeight": {
"default": "NAP",
"rules": {
"type": "enum",
"values": [
{
"value": "NAP",
"description": "NAP (Normaal Amsterdams Peil)"
},
{
"value": "EVRF",
"description": "EVRF (European Vertical Reference Frame)"
},
{
"value": "EGM2008",
"description": "EGM2008 / EGM96 (satellietmetingen) Geopotentieel model earth "
}
],
"description": "Reference height to use to identify the height vs other basins with. This will say something more about the expected pressure loss in m head"
}
},
"staticHead": {
"default": 12,
"rules": {
"type": "number",
"min": 0,
"description": "Static head between station suction and discharge point (m)."
}
},
"maxDischargeHead": {
"default": 24,
"rules": {
"type": "number",
"min": 0,
"description": "Maximum allowable discharge head before calling for alarms (m)."
}
},
"pipelineLength": {
"default": 80,
"rules": {
"type": "number",
"min": 0,
"description": "Length of the discharge pipeline considered in calculations (m)."
}
},
"defaultFluid": {
"default": "wastewater",
"rules": {
"type": "enum",
"values": [
{
"value": "wastewater",
"description": "The wet well is primarily cylindrical."
},
{
"value": "water",
"description": "The wet well is rectangular or box shaped."
}
]
}
},
"temperatureReferenceDegC": {
"default": 15,
"rules": {
"type": "number",
"description": "Reference fluid temperature for property lookups (degC)."
}
}
},
"control": {
"controlStrategy": {
"default": "levelBased",
"rules": {
"type": "enum",
"values": [
{
"value": "levelBased",
"description": "Lead and lag pumps are controlled by basin level thresholds."
},
{
"value": "pressureBased",
"description": "Pumps target a discharge pressure setpoint."
},
{
"value": "flowTracking",
"description": "Pumps modulate to match measured inflow or downstream demand."
},
{
"value": "manual",
"description": "Pumps are operated manually or by an external controller."
}
],
"description": "Primary control philosophy for pump actuation."
}
},
"levelSetpoints": {
"default": {
"startLeadPump": 1.2,
"stopLeadPump": 0.8,
"startLagPump": 1.8,
"stopLagPump": 1.4,
"alarmHigh": 2.3,
"alarmLow": 0.3
},
"rules": {
"type": "object",
"description": "Level thresholds that govern pump staging and alarms (m).",
"schema": {
"startLeadPump": {
"default": 1.2,
"rules": {
"type": "number",
"description": "Level that starts the lead pump."
}
},
"stopLeadPump": {
"default": 0.8,
"rules": {
"type": "number",
"description": "Level that stops the lead pump."
}
},
"startLagPump": {
"default": 1.8,
"rules": {
"type": "number",
"description": "Level that starts the lag pump."
}
},
"stopLagPump": {
"default": 1.4,
"rules": {
"type": "number",
"description": "Level that stops the lag pump."
}
},
"alarmHigh": {
"default": 2.3,
"rules": {
"type": "number",
"description": "High level alarm threshold."
}
},
"alarmLow": {
"default": 0.3,
"rules": {
"type": "number",
"description": "Low level alarm threshold."
}
}
}
}
},
"pressureSetpoint": {
"default": 250,
"rules": {
"type": "number",
"min": 0,
"description": "Target discharge pressure when operating in pressure control (kPa)."
}
},
"alarmDebounceSeconds": {
"default": 10,
"rules": {
"type": "number",
"min": 0,
"description": "Time a condition must persist before raising an alarm (seconds)."
}
},
"equalizationTargetPercent": {
"default": 60,
"rules": {
"type": "number",
"min": 0,
"max": 100,
"description": "Target fill percentage of the basin when operating in equalization mode."
}
},
"autoRestartAfterPowerLoss": {
"default": true,
"rules": {
"type": "boolean",
"description": "If true, pumps resume based on last known state after power restoration."
}
},
"manualOverrideTimeoutMinutes": {
"default": 30,
"rules": {
"type": "number",
"min": 0,
"description": "Duration after which a manual override expires automatically (minutes)."
}
},
"flowBalanceTolerance": {
"default": 5,
"rules": {
"type": "number",
"min": 0,
"description": "Allowable error between inflow and outflow before adjustments are triggered (m3/h)."
}
}
},
"alarms": {
"default": {
"highLevel": {
"enabled": true,
"threshold": 2.3,
"delaySeconds": 30,
"severity": "critical",
"acknowledgmentRequired": true
},
"lowLevel": {
"enabled": true,
"threshold": 0.2,
"delaySeconds": 15,
"severity": "warning",
"acknowledgmentRequired": false
}
},
"rules": {
"type": "object",
"description": "Alarm configuration for the pumping station.",
"schema": {
"highLevel": {
"default": {
"enabled": true,
"threshold": 2.3,
"delaySeconds": 30,
"severity": "critical",
"acknowledgmentRequired": true
},
"rules": {
"type": "object",
"schema": {
"enabled": {
"default": true,
"rules": {
"type": "boolean",
"description": "Enable or disable the high level alarm."
}
},
"threshold": {
"default": 2.3,
"rules": {
"type": "number",
"description": "Level threshold that triggers the high level alarm (m)."
}
},
"delaySeconds": {
"default": 30,
"rules": {
"type": "number",
"min": 0,
"description": "Delay before issuing the high level alarm (seconds)."
}
},
"severity": {
"default": "critical",
"rules": {
"type": "enum",
"values": [
{
"value": "info",
"description": "Informational notification."
},
{
"value": "warning",
"description": "Warning condition requiring attention."
},
{
"value": "critical",
"description": "Critical alarm requiring immediate intervention."
}
],
"description": "Severity associated with the high level alarm."
}
},
"acknowledgmentRequired": {
"default": true,
"rules": {
"type": "boolean",
"description": "If true, this alarm must be acknowledged by an operator."
}
}
}
}
},
"lowLevel": {
"default": {
"enabled": true,
"threshold": 0.2,
"delaySeconds": 15,
"severity": "warning",
"acknowledgmentRequired": false
},
"rules": {
"type": "object",
"schema": {
"enabled": {
"default": true,
"rules": {
"type": "boolean",
"description": "Enable or disable the low level alarm."
}
},
"threshold": {
"default": 0.2,
"rules": {
"type": "number",
"description": "Level threshold that triggers the low level alarm (m)."
}
},
"delaySeconds": {
"default": 15,
"rules": {
"type": "number",
"min": 0,
"description": "Delay before issuing the low level alarm (seconds)."
}
},
"severity": {
"default": "warning",
"rules": {
"type": "enum",
"values": [
{
"value": "info",
"description": "Informational notification."
},
{
"value": "warning",
"description": "Warning condition requiring attention."
},
{
"value": "critical",
"description": "Critical alarm requiring immediate intervention."
}
],
"description": "Severity associated with the low level alarm."
}
},
"acknowledgmentRequired": {
"default": false,
"rules": {
"type": "boolean",
"description": "If true, this alarm must be acknowledged by an operator."
}
}
}
}
}
}
}
},
"simulation": {
"enabled": {
"default": false,
"rules": {
"type": "boolean",
"description": "If true, the station operates in simulation mode using generated inflow and level data."
}
},
"mode": {
"default": "diurnal",
"rules": {
"type": "enum",
"values": [
{
"value": "static",
"description": "Use constant inflow and level conditions."
},
{
"value": "diurnal",
"description": "Use a typical diurnal inflow curve to drive simulation."
},
{
"value": "storm",
"description": "Use an elevated inflow profile representing a storm event."
}
],
"description": "Defines which synthetic profile drives the simulation."
}
},
"seed": {
"default": 42,
"rules": {
"type": "number",
"description": "Seed used for pseudo-random components in simulation."
}
},
"applyRandomNoise": {
"default": true,
"rules": {
"type": "boolean",
"description": "If true, adds small noise to simulated measurements."
}
},
"inflowProfile": {
"default": [
80,
110,
160,
120,
90
],
"rules": {
"type": "array",
"itemType": "number",
"minLength": 1,
"description": "Relative inflow profile used when mode is set to diurnal or storm (percentage of design inflow)."
}
}
}
}

View File

@@ -412,6 +412,14 @@
],
"description": "The frequency at which calculations are performed."
}
},
"flowNumber": {
"default": 1,
"rules": {
"type": "number",
"nullable": false,
"description": "Defines which effluent flow of the parent node to handle."
}
}
}

View File

@@ -11,8 +11,12 @@ class ChildRegistrationUtils {
this.logger.debug(`Registering child: ${name} (${id}) as ${softwareType} at ${positionVsParent}`);
// Enhanced child setup
child.parent = this.mainClass;
// Enhanced child setup - multiple parents
if (Array.isArray(child.parent)) {
child.parent.push(this.mainClass);
} else {
child.parent = [this.mainClass];
}
child.positionVsParent = positionVsParent;
// Enhanced measurement container with rich context

View File

@@ -68,6 +68,23 @@ class Measurement {
return this.values[this.values.length - 1];
}
getLaggedValue(lag){
if(this.values.length <= lag) return null;
return this.values[this.values.length - lag];
}
getLaggedSample(lag){
if (lag < 0) throw new Error('lag must be >= 0');
const index = this.values.length - 1 - lag;
if (index < 0) return null;
return {
value: this.values[index],
timestamp: this.timestamps[index],
unit: this.unit,
};
}
getAverage() {
if (this.values.length === 0) return null;
const sum = this.values.reduce((acc, val) => acc + val, 0);

View File

@@ -94,7 +94,8 @@ class MeasurementContainer {
throw new Error('Variant must be specified before position');
}
this._currentPosition = positionValue;
this._currentPosition = positionValue.toString().toLowerCase();;
return this;
}
@@ -163,11 +164,55 @@ class MeasurementContainer {
// Emit the exact event your parent expects
this.emitter.emit(`${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
console.log(`Emitted event: ${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
//console.log(`Emitted event: ${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
return this;
}
/**
* Check whether a measurement series exists.
*
* You can rely on the current chain (type/variant/position already set via
* type().variant().position()), or pass them explicitly via the options.
*
* @param {object} options
* @param {string} [options.type] Override the current type
* @param {string} [options.variant] Override the current variant
* @param {string} [options.position] Override the current position
* @param {boolean} [options.requireValues=false]
* When true, the series must contain at least one stored value.
*
* @returns {boolean}
*/
exists({ type, variant, position, requireValues = false } = {}) {
const typeKey = type ?? this._currentType;
if (!typeKey) return false;
const variantKey = variant ?? this._currentVariant;
if (!variantKey) return false;
const positionKey = position ?? this._currentPosition;
const typeBucket = this.measurements[typeKey];
if (!typeBucket) return false;
const variantBucket = typeBucket[variantKey];
if (!variantBucket) return false;
if (!positionKey) {
// No specific position requested just check the variant bucket.
return requireValues
? Object.values(variantBucket).some(m => m?.values?.length > 0)
: Object.keys(variantBucket).length > 0;
}
const measurement = variantBucket[positionKey];
if (!measurement) return false;
return requireValues ? measurement.values?.length > 0 : true;
}
unit(unitName) {
if (!this._ensureChainIsValid()) return this;
@@ -247,35 +292,100 @@ class MeasurementContainer {
return measurement ? measurement.getAllValues() : null;
}
getLaggedValue(lag = 1,requestedUnit = null ){
const measurement = this.get();
if (!measurement) return null;
let sample = measurement.getLaggedSample(lag);
if (sample === null) return null;
const value = sample.value;
// Return as-is if no unit conversion requested
if (!requestedUnit) {
return value;
}
// Convert if needed
if (measurement.unit && requestedUnit !== measurement.unit) {
try {
const convertedValue = convertModule(value).from(measurement.unit).to(requestedUnit);
//replace old value in sample and return obj
sample.value = convertedValue ;
sample.unit = requestedUnit;
return sample;
} catch (error) {
if (this.logger) {
this.logger.error(`Unit conversion failed: ${error.message}`);
}
return sample; // Return original value if conversion fails
}
}
return value;
}
getLaggedSample(lag = 1,requestedUnit = null ){
const measurement = this.get();
if (!measurement) return null;
let sample = measurement.getLaggedSample(lag);
if (sample === null) return null;
// Return as-is if no unit conversion requested
if (!requestedUnit) {
return sample;
}
// Convert if needed
if (measurement.unit && requestedUnit !== measurement.unit) {
try {
const convertedValue = convertModule(value).from(measurement.unit).to(requestedUnit);
//replace old value in sample and return obj
sample.value = convertedValue ;
sample.unit = requestedUnit;
return sample;
} catch (error) {
if (this.logger) {
this.logger.error(`Unit conversion failed: ${error.message}`);
}
return sample; // Return original value if conversion fails
}
}
return sample;
}
// Difference calculations between positions
difference(requestedUnit = null) {
difference({ from = "downstream", to = "upstream", unit: requestedUnit } = {}) {
if (!this._currentType || !this._currentVariant) {
throw new Error('Type and variant must be specified for difference calculation');
throw new Error("Type and variant must be specified for difference calculation");
}
const upstream = this.measurements?.[this._currentType]?.[this._currentVariant]?.['upstream'] || null;
const downstream = this.measurements?.[this._currentType]?.[this._currentVariant]?.['downstream'] || null;
if (!upstream || !downstream || upstream.values.length === 0 || downstream.values.length === 0) {
const get = pos =>
this.measurements?.[this._currentType]?.[this._currentVariant]?.[pos] || null;
const a = get(from);
const b = get(to);
if (!a || !b || a.values.length === 0 || b.values.length === 0) {
return null;
}
// Get target unit for conversion
const targetUnit = requestedUnit || upstream.unit || downstream.unit;
const targetUnit = requestedUnit || a.unit || b.unit;
const aVal = this._convertValueToUnit(a.getCurrentValue(), a.unit, targetUnit);
const bVal = this._convertValueToUnit(b.getCurrentValue(), b.unit, targetUnit);
// Get values in the same unit
const upstreamValue = this._convertValueToUnit(upstream.getCurrentValue(), upstream.unit, targetUnit);
const downstreamValue = this._convertValueToUnit(downstream.getCurrentValue(), downstream.unit, targetUnit);
const upstreamAvg = this._convertValueToUnit(upstream.getAverage(), upstream.unit, targetUnit);
const downstreamAvg = this._convertValueToUnit(downstream.getAverage(), downstream.unit, targetUnit);
const aAvg = this._convertValueToUnit(a.getAverage(), a.unit, targetUnit);
const bAvg = this._convertValueToUnit(b.getAverage(), b.unit, targetUnit);
return {
value: downstreamValue - upstreamValue,
avgDiff: downstreamAvg - upstreamAvg,
unit: targetUnit
value: aVal - bVal,
avgDiff: aAvg - bAvg,
unit: targetUnit,
from,
to,
};
}

View File

@@ -87,6 +87,7 @@ autoContainer
.distance(0.5)
.value(1.5, Date.now(), 'bar'); // Input: 1.5 bar → Auto-stored as ~21.76 psi
const converted = autoContainer
.type('pressure')
.variant('measured')
@@ -175,6 +176,25 @@ const downstreamData = basicContainer
.position('downstream')
.get();
//check wether a serie exists
const hasSeries = measurements
.type("flow")
.variant("measured")
.exists(); // true if any position exists
const hasUpstreamValues = measurements
.type("flow")
.variant("measured")
.exists({ position: "upstream", requireValues: true });
// Passing everything explicitly
const hasPercent = measurements.exists({
type: "volume",
variant: "percent",
position: "atEquipment",
});
console.log(`Downstream: ${downstreamVal} ${downstreamData.unit} at ${downstreamData.distance}m\n`);
// ====================================
@@ -213,6 +233,10 @@ const pressureDiff = basicContainer
console.log(`Pressure difference: ${pressureDiff.value} ${pressureDiff.unit}\n`);
//reversable difference
const deltaP = basicContainer.type("pressure").variant("measured").difference(); // defaults to downstream - upstream
const netFlow = basicContainer.type("flow").variant("measured").difference({ from: "upstream", to: "downstream" });
// ====================================
// ADVANCED STATISTICS & HISTORY
// ====================================
@@ -248,6 +272,28 @@ const allValues = stats.getAllValues();
console.log(` Samples: ${allValues.values.length}`);
console.log(` History: [${allValues.values.join(', ')}]\n`);
console.log('--- Lagged sample comparison ---');
const latest = stats.getCurrentValue(); // existing helper
const prevSample = stats.getLaggedValue(1); // new helper
const prevPrevSample = stats.getLaggedValue(2); // optional
if (prevSample) {
const delta = latest - prevSample.value;
console.log(
`Current vs previous: ${latest} ${statsData.unit} (t=${stats.get().getLatestTimestamp()}) vs ` +
`${prevSample.value} ${prevSample.unit} (t=${prevSample.timestamp})`
);
console.log(`Δ = ${delta.toFixed(2)} ${statsData.unit}`);
}
if (prevPrevSample) {
console.log(
`Previous vs 2-steps-back timestamps: ${new Date(prevSample.timestamp).toISOString()} vs ` +
`${new Date(prevPrevSample.timestamp).toISOString()}`
);
}
// ====================================
// DYNAMIC UNIT MANAGEMENT
// ====================================
@@ -299,8 +345,11 @@ basicContainer.getTypes().forEach(type => {
}
});
console.log('\n✅ All examples complete!\n');
// ====================================
// BEST PRACTICES
// ====================================

View File

@@ -350,6 +350,7 @@ class Predict {
}
buildAllFxyCurves(curve) {
let globalMinY = Infinity;
let globalMaxY = -Infinity;