Compare commits
12 Commits
ae46e0021c
...
dev-Rene
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32ebfd7154 | ||
|
|
38013a86db | ||
|
|
00858eb853 | ||
|
|
6b58dd4bd5 | ||
|
|
ed9409fc29 | ||
|
|
b6e2474a1c | ||
|
|
9708127a20 | ||
|
|
3971b4e328 | ||
| 77adb043b0 | |||
|
|
2576625f0a | ||
|
|
df935b2868 | ||
|
|
4213b18139 |
14
README.md
14
README.md
@@ -1,3 +1,13 @@
|
|||||||
# convert
|
# monster
|
||||||
|
|
||||||
Makes unit conversions
|
Monsternamekast control node for EVOLV.
|
||||||
|
|
||||||
|
Primary responsibilities:
|
||||||
|
- combine measured/manual flow, rain context and schedule context
|
||||||
|
- predict sampling demand and pulse distribution over sampling window
|
||||||
|
- enforce bucket/sampling constraints (volume, weight, cooldown)
|
||||||
|
- emit process fields used by PLC pulse output, report tooling (e.g. Z-Info), and dashboards
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
- `nodes/monster/examples/monster-dashboard.flow.json` (dashboard-ready visualization flow)
|
||||||
|
- `nodes/monster/examples/monster-api-dashboard.flow.json` (full API orchestration template with placeholder credentials)
|
||||||
|
|||||||
@@ -1,870 +0,0 @@
|
|||||||
const inputExample =
|
|
||||||
//tensor 1
|
|
||||||
[
|
|
||||||
// 1 prediction per hour
|
|
||||||
[
|
|
||||||
// 24 window size
|
|
||||||
[
|
|
||||||
//166 features of which the first feature is the hour of the day all the other values are precipation values
|
|
||||||
//These values are meaningless they need to be translated first into the correct format
|
|
||||||
//How do the transformations work?
|
|
||||||
-0.65066296, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-0.50620914, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-0.36175531, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-0.21730149, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-0.07284767, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0.07160615, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0.21605998, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0.3605138, -0.1888816, -0.19213369, -0.19328518, -0.18170043, -0.18223418,
|
|
||||||
-0.18370405, -0.18517574, -0.18551063, -0.18683789, -0.18886069,
|
|
||||||
-0.18927826, -0.18696358, -0.17307445, -0.17702805, -0.17851964,
|
|
||||||
-0.17654074, -0.17762018, -0.1796983, -0.18136519, -0.18139249,
|
|
||||||
-0.18250296, -0.18198996, -0.18138494, -0.18618596, -0.1889744,
|
|
||||||
-0.18739212, -0.17126027, -0.17405689, -0.1762726, -0.18029169,
|
|
||||||
-0.1885969, -0.18849469, -0.19095787, -0.18038477, -0.18214581,
|
|
||||||
-0.18189491, -0.18189534, -0.18381298, -0.18393834, -0.18939162,
|
|
||||||
-0.17176759, -0.17026471, -0.17394295, -0.17903634, -0.19020126,
|
|
||||||
-0.18912097, -0.18823564, -0.17929266, -0.18775292, -0.18869072,
|
|
||||||
-0.18756475, -0.18702924, -0.18671379, -0.17348625, -0.18026013,
|
|
||||||
-0.1814532, -0.18132141, -0.18308498, -0.18331088, -0.18624909,
|
|
||||||
-0.18811531, -0.19032778, -0.18967649, -0.18800643, -0.18892376,
|
|
||||||
-0.18933033, -0.18079819, -0.18595871, -0.18796106, -0.18773453,
|
|
||||||
-0.19043156, -0.1891853, -0.18971276, -0.18899542, -0.18666336,
|
|
||||||
-0.1879662, -0.18708836, -0.1893528, -0.18959058, -0.18611566,
|
|
||||||
-0.19272971, -0.19552121, -0.19478238, -0.19681337, -0.19944471,
|
|
||||||
-0.19903339, -0.19263975, -0.18716142, -0.1877408, -0.18708849,
|
|
||||||
-0.18419774, -0.18278112, -0.18275773, -0.19600511, -0.19538267,
|
|
||||||
-0.19162537, -0.192591, -0.19787251, -0.19998388, -0.19278597,
|
|
||||||
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
|
|
||||||
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
|
|
||||||
-0.19189596, -0.19348373, -0.19015691, -0.1844006, -0.18490676,
|
|
||||||
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
|
|
||||||
-0.19192091, -0.18874464, -0.18849974, -0.1898807, -0.18982206,
|
|
||||||
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
|
|
||||||
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
|
|
||||||
-0.18945748, -0.1898998, -0.18970484, -0.18697297, -0.1889949,
|
|
||||||
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
|
|
||||||
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
|
|
||||||
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
|
|
||||||
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
|
|
||||||
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0.50496762, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0.64942144, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0.79387527, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0.93832909, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542, -0.144808,
|
|
||||||
-0.1452933, -0.14522589, -0.14659725, -0.18959058, -0.18611566,
|
|
||||||
-0.19272971, -0.19552121, -0.19478238, -0.19681337, -0.19944471,
|
|
||||||
-0.19903339, -0.19263975, -0.18716142, -0.1877408, -0.18708849,
|
|
||||||
-0.18419774, -0.18278112, -0.18275773, -0.19600511, -0.19538267,
|
|
||||||
-0.19162537, -0.192591, -0.19787251, -0.19998388, -0.19278597,
|
|
||||||
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
|
|
||||||
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
|
|
||||||
-0.19189596, -0.19348373, -0.19015691, -0.1844006, -0.18490676,
|
|
||||||
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
|
|
||||||
-0.19192091, -0.18874464, -0.18849974, -0.1898807, -0.18982206,
|
|
||||||
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
|
|
||||||
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
|
|
||||||
-0.18945748, -0.1898998, -0.18970484, -0.18697297, -0.1889949,
|
|
||||||
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
|
|
||||||
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
|
|
||||||
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
|
|
||||||
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
|
|
||||||
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1.08278291, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1.22723673, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.15728894, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.16854493, -0.16853073, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.16891474, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1.37169056, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1.51614438, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1.6605982, -0.1888816, -0.19213369, -0.19328518, -0.18170043, -0.18223418,
|
|
||||||
-0.18370405, -0.18517574, -0.18551063, -0.18683789, -0.18886069,
|
|
||||||
-0.18927826, -0.18696358, -0.17307445, -0.17702805, -0.17851964,
|
|
||||||
-0.17654074, -0.17762018, -0.1796983, -0.18136519, -0.18139249,
|
|
||||||
-0.18250296, -0.18198996, -0.18138494, -0.18618596, -0.1889744,
|
|
||||||
-0.18739212, -0.17126027, -0.17405689, -0.1762726, -0.18029169,
|
|
||||||
-0.1885969, -0.18849469, -0.19095787, -0.18038477, -0.18214581,
|
|
||||||
-0.18189491, -0.18189534, -0.18381298, -0.18393834, -0.18939162,
|
|
||||||
-0.17176759, -0.17026471, -0.17394295, -0.17903634, -0.19020126,
|
|
||||||
-0.18912097, -0.18823564, -0.17929266, -0.18775292, -0.18869072,
|
|
||||||
-0.18756475, -0.18702924, -0.18671379, -0.17348625, -0.18026013,
|
|
||||||
-0.1814532, -0.18132141, -0.18308498, -0.18331088, -0.18624909,
|
|
||||||
-0.18811531, -0.19032778, -0.18967649, -0.18800643, -0.18892376,
|
|
||||||
-0.18933033, -0.18079819, -0.18595871, -0.18796106, -0.18773453,
|
|
||||||
-0.19043156, -0.1891853, -0.18971276, -0.18899542, -0.18666336,
|
|
||||||
-0.1879662, -0.18708836, -0.1893528, -0.18959058, -0.18611566,
|
|
||||||
-0.19272971, -0.19552121, -0.19478238, -0.19681337, -0.19944471,
|
|
||||||
-0.19903339, -0.19263975, -0.18716142, -0.1877408, -0.18708849,
|
|
||||||
-0.18419774, -0.18278112, -0.18275773, -0.19600511, -0.19538267,
|
|
||||||
-0.19162537, -0.192591, -0.19787251, -0.19998388, -0.19278597,
|
|
||||||
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
|
|
||||||
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
|
|
||||||
-0.19189596, -0.19348373, -0.19015691, -0.1844006, -0.18490676,
|
|
||||||
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
|
|
||||||
-0.19192091, -0.18874464, -0.18849974, -0.1898807, -0.18982206,
|
|
||||||
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
|
|
||||||
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
|
|
||||||
-0.18945748, -0.1898998, -0.18970484, -0.18697297, -0.1889949,
|
|
||||||
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
|
|
||||||
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
|
|
||||||
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
|
|
||||||
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
|
|
||||||
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-1.66183972, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-1.51738589, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-1.37293207, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.15955445, -0.13803715, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.16164522, -0.14849295, -0.16853073, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.13901581,
|
|
||||||
-0.06342139, -0.18912097, -0.16787941, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.14169274, 0.01964936, -0.08233806,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.16748919, -0.0445072, 0.10122311, -0.08402621, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
0.16237384, -0.00447424, -0.17137192, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, 0.12352589, -0.00387522, -0.15085347,
|
|
||||||
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
|
|
||||||
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
|
|
||||||
-0.06793555, -0.02713845, -0.12841841, -0.1844006, -0.18490676,
|
|
||||||
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
|
|
||||||
-0.19192091, -0.18874464, -0.18849974, -0.10893781, -0.14900896,
|
|
||||||
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
|
|
||||||
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
|
|
||||||
-0.18945748, -0.16930273, -0.16915384, -0.16665951, -0.1889949,
|
|
||||||
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
|
|
||||||
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
|
|
||||||
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
|
|
||||||
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
|
|
||||||
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-1.22847825, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.15955445, -0.13803715, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.16854493, -0.14856677, -0.17007908, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.14870851, -0.14752318, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.16281155, -0.12272718,
|
|
||||||
-0.16566951, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.08546801, -0.08402621, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.07174405, 0.03876113, -0.12883628, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.09073971, 0.03970448, -0.08795472,
|
|
||||||
-0.16710221, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
|
|
||||||
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
|
|
||||||
-0.15057582, -0.08951793, -0.10783891, -0.16435934, -0.18490676,
|
|
||||||
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
|
|
||||||
-0.19192091, -0.18874464, -0.18849974, -0.16964498, -0.12860241,
|
|
||||||
-0.16800538, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
|
|
||||||
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
|
|
||||||
-0.18945748, -0.1898998, -0.16915384, -0.18697297, -0.1889949,
|
|
||||||
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
|
|
||||||
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
|
|
||||||
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
|
|
||||||
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
|
|
||||||
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-1.08402443, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-0.9395706, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
-0.79511678, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
|
|
||||||
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
|
|
||||||
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
|
|
||||||
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
|
|
||||||
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
|
|
||||||
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
|
|
||||||
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
|
|
||||||
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
|
|
||||||
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
|
|
||||||
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
|
|
||||||
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
|
|
||||||
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
|
|
||||||
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
|
|
||||||
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
|
|
||||||
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
|
|
||||||
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
|
|
||||||
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
|
|
||||||
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
|
|
||||||
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
|
|
||||||
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
|
|
||||||
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
|
|
||||||
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
|
|
||||||
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
|
|
||||||
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
|
|
||||||
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
|
|
||||||
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
|
|
||||||
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
|
|
||||||
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
|
|
||||||
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
|
|
||||||
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
|
|
||||||
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
|
|
||||||
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
|
|
||||||
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
|
|
||||||
-0.18577042,
|
|
||||||
],
|
|
||||||
]
|
|
||||||
];
|
|
||||||
122
dependencies/monster/modelLoader.js
vendored
122
dependencies/monster/modelLoader.js
vendored
@@ -1,122 +0,0 @@
|
|||||||
const tf = require('@tensorflow/tfjs');
|
|
||||||
|
|
||||||
class ModelLoader {
|
|
||||||
constructor(logger) {
|
|
||||||
this.logger = logger || console;
|
|
||||||
this.model = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadModel(modelUrl, inputShape = [null, 24, 166]) {
|
|
||||||
try {
|
|
||||||
this.logger.debug(`Fetching model JSON from: ${modelUrl}`);
|
|
||||||
const response = await fetch(modelUrl);
|
|
||||||
const modelJSON = await response.json();
|
|
||||||
|
|
||||||
// Fix input shape
|
|
||||||
this.configureInputLayer(modelJSON, inputShape);
|
|
||||||
|
|
||||||
// Extract base path
|
|
||||||
const baseUrl = this.getBaseUrl(modelUrl);
|
|
||||||
this.fixWeightPaths(modelJSON, baseUrl);
|
|
||||||
|
|
||||||
// Ensure weight specs are there
|
|
||||||
if (
|
|
||||||
!modelJSON.weightsManifest ||
|
|
||||||
!modelJSON.weightsManifest[0].weights ||
|
|
||||||
modelJSON.weightsManifest[0].weights.length === 0
|
|
||||||
) {
|
|
||||||
throw new Error("Model JSON is missing weight specifications.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the binary weight data
|
|
||||||
const weightUrl = modelJSON.weightsManifest[0].paths[0];
|
|
||||||
const weightResponse = await fetch(weightUrl);
|
|
||||||
const weightBuffer = await weightResponse.arrayBuffer();
|
|
||||||
|
|
||||||
console.log('modelJSON.weightsManifest:', JSON.stringify(modelJSON.weightsManifest, null, 2));
|
|
||||||
|
|
||||||
if (
|
|
||||||
!modelJSON.weightsManifest ||
|
|
||||||
!modelJSON.weightsManifest[0].weights ||
|
|
||||||
modelJSON.weightsManifest[0].weights.length === 0
|
|
||||||
) {
|
|
||||||
console.error("❌ modelJSON.weightsManifest is missing weight specs!");
|
|
||||||
} else {
|
|
||||||
console.log("✅ Weight specs found:", modelJSON.weightsManifest[0].weights.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create ModelArtifacts object
|
|
||||||
const artifacts = {
|
|
||||||
modelTopology: modelJSON.modelTopology,
|
|
||||||
weightSpecs: modelJSON.weightsManifest[0].weights, // ✅ CORRECT FIELD NAME
|
|
||||||
weightData: weightBuffer
|
|
||||||
};
|
|
||||||
|
|
||||||
// Load from memory
|
|
||||||
this.model = await tf.loadLayersModel(tf.io.fromMemory(artifacts));
|
|
||||||
|
|
||||||
|
|
||||||
this.logger.debug('Model loaded successfully');
|
|
||||||
return this.model;
|
|
||||||
} catch (error) {
|
|
||||||
this.logger.error(`Failed to load model: ${error.message}`);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
configureInputLayer(modelJSON, inputShape) {
|
|
||||||
const layers = modelJSON.modelTopology.model_config.config.layers;
|
|
||||||
if (layers && layers.length > 0) {
|
|
||||||
const firstLayer = layers[0];
|
|
||||||
if (firstLayer.class_name === 'InputLayer') {
|
|
||||||
if (firstLayer.config.batch_shape) {
|
|
||||||
firstLayer.config.batchInputShape = firstLayer.config.batch_shape;
|
|
||||||
delete firstLayer.config.batch_shape;
|
|
||||||
this.logger.debug('Converted batch_shape to batchInputShape:', firstLayer);
|
|
||||||
} else if (!firstLayer.config.batchInputShape && !firstLayer.config.inputShape) {
|
|
||||||
firstLayer.config.batchInputShape = inputShape;
|
|
||||||
this.logger.debug('Configured input layer:', firstLayer);
|
|
||||||
} else {
|
|
||||||
this.logger.debug('Input shape already set:', firstLayer.config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getBaseUrl(url) {
|
|
||||||
return url.substring(0, url.lastIndexOf('/') + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fixWeightPaths(modelJSON, baseUrl) {
|
|
||||||
for (const group of modelJSON.weightsManifest) {
|
|
||||||
group.paths = group.paths.map(path => {
|
|
||||||
path = path.replace(/^\/+/, '');
|
|
||||||
return path.startsWith('http') ? path : `${baseUrl}${path}`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const modelLoader = new ModelLoader();
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
const localURL = "http://localhost:1880/generalFunctions/datasets/lstmData/tfjs_model/model.json";
|
|
||||||
|
|
||||||
const model = await modelLoader.loadModel(localURL);
|
|
||||||
console.log('Model loaded successfully');
|
|
||||||
|
|
||||||
const denseLayer = model.getLayer('dense_8');
|
|
||||||
const weights = denseLayer.getWeights();
|
|
||||||
const weightArray = await weights[0].array();
|
|
||||||
console.log('Dense layer kernel (sample):', weightArray.slice(0, 5));
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to load model:', error);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = ModelLoader;
|
|
||||||
256
dependencies/monster/monsterConfig.json
vendored
256
dependencies/monster/monsterConfig.json
vendored
@@ -1,256 +0,0 @@
|
|||||||
{
|
|
||||||
"general": {
|
|
||||||
"name": {
|
|
||||||
"default": "Monster Configuration",
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "A human-readable name or label for this configuration."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"default": null,
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true,
|
|
||||||
"description": "A unique identifier for this configuration. If not provided, defaults to null."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"unit": {
|
|
||||||
"default": "unitless",
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The unit for this configuration (e.g., 'meters', 'seconds', 'unitless')."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"logging": {
|
|
||||||
"logLevel": {
|
|
||||||
"default": "info",
|
|
||||||
"rules": {
|
|
||||||
"type": "enum",
|
|
||||||
"values": [
|
|
||||||
{
|
|
||||||
"value": "debug",
|
|
||||||
"description": "Log messages are printed for debugging purposes."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "info",
|
|
||||||
"description": "Informational messages are printed."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "warn",
|
|
||||||
"description": "Warning messages are printed."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "error",
|
|
||||||
"description": "Error messages are printed."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enabled": {
|
|
||||||
"default": true,
|
|
||||||
"rules": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Indicates whether logging is active. If true, log messages will be generated."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"functionality": {
|
|
||||||
"softwareType": {
|
|
||||||
"default": "monster",
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Specified software type for this configuration."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"role": {
|
|
||||||
"default": "samplingCabinet",
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Indicates the role this configuration plays (e.g., sensor, controller, etc.)."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"asset": {
|
|
||||||
"uuid": {
|
|
||||||
"default": null,
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true,
|
|
||||||
"description": "Asset tag number which is a universally unique identifier for this asset. May be null if not assigned."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"geoLocation": {
|
|
||||||
"default": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"type": "object",
|
|
||||||
"description": "An object representing the asset's physical coordinates or location.",
|
|
||||||
"schema": {
|
|
||||||
"x": {
|
|
||||||
"default": 0,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "X coordinate of the asset's location."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"y": {
|
|
||||||
"default": 0,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Y coordinate of the asset's location."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"z": {
|
|
||||||
"default": 0,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Z coordinate of the asset's location."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"supplier": {
|
|
||||||
"default": "Unknown",
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The supplier or manufacturer of the asset."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"default": "sensor",
|
|
||||||
"rules": {
|
|
||||||
"type": "enum",
|
|
||||||
"values": [
|
|
||||||
{
|
|
||||||
"value": "sensor",
|
|
||||||
"description": "A device that detects or measures a physical property and responds to it (e.g. temperature sensor)."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subType": {
|
|
||||||
"default": "pressure",
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "A more specific classification within 'type'. For example, 'pressure' for a pressure sensor."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"model": {
|
|
||||||
"default": "Unknown",
|
|
||||||
"rules": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "A user-defined or manufacturer-defined model identifier for the asset."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"emptyWeightBucket": {
|
|
||||||
"default": 3,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "The weight of the empty bucket in kilograms."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"constraints": {
|
|
||||||
"samplingtime": {
|
|
||||||
"default": 0,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "The time interval between sampling events (in seconds) if not using a flow meter."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"samplingperiod": {
|
|
||||||
"default": 24,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "The fixed period in hours in which a composite sample is collected."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"minVolume": {
|
|
||||||
"default": 5,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"min": 5,
|
|
||||||
"description": "The minimum volume in liters."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"maxWeight": {
|
|
||||||
"default": 23,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"max": 23,
|
|
||||||
"description": "The maximum weight in kilograms."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subSampleVolume": {
|
|
||||||
"default": 50,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"min": 50,
|
|
||||||
"max": 50,
|
|
||||||
"description": "The volume of each sub-sample in milliliters."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"storageTemperature": {
|
|
||||||
"default": {
|
|
||||||
"min": 1,
|
|
||||||
"max": 5
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"type": "object",
|
|
||||||
"description": "Acceptable storage temperature range for samples in degrees Celsius.",
|
|
||||||
"schema": {
|
|
||||||
"min": {
|
|
||||||
"default": 1,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"min": 1,
|
|
||||||
"description": "Minimum acceptable storage temperature in degrees Celsius."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"max": {
|
|
||||||
"default": 5,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"max": 5,
|
|
||||||
"description": "Maximum acceptable storage temperature in degrees Celsius."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flowmeter": {
|
|
||||||
"default": true,
|
|
||||||
"rules": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Indicates whether a flow meter is used for proportional sampling."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"closedSystem": {
|
|
||||||
"default": false,
|
|
||||||
"rules": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Indicates if the sampling system is closed (true) or open (false)."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"intakeSpeed": {
|
|
||||||
"default": 0.3,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Minimum intake speed in meters per second."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"intakeDiameter": {
|
|
||||||
"default": 12,
|
|
||||||
"rules": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Minimum inner diameter of the intake tubing in millimeters."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
746
dependencies/monster/monster_class.js
vendored
746
dependencies/monster/monster_class.js
vendored
File diff suppressed because one or more lines are too long
31
examples/README.md
Normal file
31
examples/README.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Monster Example Flows
|
||||||
|
|
||||||
|
Import-ready Node-RED examples for `monster`.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
- `basic.flow.json`
|
||||||
|
- Purpose: quick-start flow with dashboard charts for key monster outputs.
|
||||||
|
- `integration.flow.json`
|
||||||
|
- Purpose: lightweight integration contract example (`registerChild` path).
|
||||||
|
- `edge.flow.json`
|
||||||
|
- Purpose: unknown-topic/edge handling smoke example.
|
||||||
|
- `monster-dashboard.flow.json`
|
||||||
|
- Purpose: richer dashboard-focused visualization of process output.
|
||||||
|
- Includes:
|
||||||
|
- manual flow input
|
||||||
|
- manual start trigger
|
||||||
|
- seeded `rain_data` and `monsternametijden`
|
||||||
|
- parsed report fields (`m3Total`, `m3PerPuls`, `pulse`, `running`)
|
||||||
|
- `monster-api-dashboard.flow.json`
|
||||||
|
- Purpose: full orchestration template around `monster` with API paths and dashboard output.
|
||||||
|
- Includes:
|
||||||
|
- Open-Meteo weather fetch -> `rain_data`
|
||||||
|
- Aquon SFTP CSV fetch -> `monsternametijden`
|
||||||
|
- Z-Info token + import payload builder for `m3Total`/`m3PerPuls`
|
||||||
|
- dashboard API publish template (Grafana)
|
||||||
|
- placeholder-only credentials/hosts (`__SET_*__`)
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
- `basic.flow.json` and `monster-dashboard.flow.json` are intentionally API-free.
|
||||||
|
- `monster-api-dashboard.flow.json` is the full API template variant and must be hardened with environment-backed secrets before production use.
|
||||||
|
- `ui-chart` uses series by `msg.topic` (`category: "topic"`, `categoryType: "msg"`).
|
||||||
365
examples/basic.flow.json
Normal file
365
examples/basic.flow.json
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "monster_basic_tab",
|
||||||
|
"type": "tab",
|
||||||
|
"label": "monster basic",
|
||||||
|
"disabled": false,
|
||||||
|
"info": "monster basic dashboard example"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_base_monster_basic",
|
||||||
|
"type": "ui-base",
|
||||||
|
"name": "EVOLV Demo",
|
||||||
|
"path": "/dashboard",
|
||||||
|
"appIcon": "",
|
||||||
|
"includeClientData": true,
|
||||||
|
"acceptsClientConfig": [
|
||||||
|
"ui-notification",
|
||||||
|
"ui-control"
|
||||||
|
],
|
||||||
|
"showPathInSidebar": false,
|
||||||
|
"headerContent": "page",
|
||||||
|
"navigationStyle": "default",
|
||||||
|
"titleBarStyle": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_theme_monster_basic",
|
||||||
|
"type": "ui-theme",
|
||||||
|
"name": "Monster Theme",
|
||||||
|
"colors": {
|
||||||
|
"surface": "#ffffff",
|
||||||
|
"primary": "#4f8582",
|
||||||
|
"bgPage": "#efefef",
|
||||||
|
"groupBg": "#ffffff",
|
||||||
|
"groupOutline": "#d8d8d8"
|
||||||
|
},
|
||||||
|
"sizes": {
|
||||||
|
"density": "default",
|
||||||
|
"pagePadding": "14px",
|
||||||
|
"groupGap": "14px",
|
||||||
|
"groupBorderRadius": "6px",
|
||||||
|
"widgetGap": "12px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_page_monster_basic",
|
||||||
|
"type": "ui-page",
|
||||||
|
"name": "Monster Basic",
|
||||||
|
"ui": "ui_base_monster_basic",
|
||||||
|
"path": "/monster-basic",
|
||||||
|
"icon": "science",
|
||||||
|
"layout": "grid",
|
||||||
|
"theme": "ui_theme_monster_basic",
|
||||||
|
"breakpoints": [
|
||||||
|
{
|
||||||
|
"name": "Default",
|
||||||
|
"px": "0",
|
||||||
|
"cols": "12"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"order": 1,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_group_monster_basic_ctrl",
|
||||||
|
"type": "ui-group",
|
||||||
|
"name": "Input",
|
||||||
|
"page": "ui_page_monster_basic",
|
||||||
|
"width": "6",
|
||||||
|
"height": "1",
|
||||||
|
"order": 1,
|
||||||
|
"showTitle": true,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_group_monster_basic_obs",
|
||||||
|
"type": "ui-group",
|
||||||
|
"name": "Output",
|
||||||
|
"page": "ui_page_monster_basic",
|
||||||
|
"width": "12",
|
||||||
|
"height": "1",
|
||||||
|
"order": 2,
|
||||||
|
"showTitle": true,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_node",
|
||||||
|
"type": "monster",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"name": "monster basic",
|
||||||
|
"samplingtime": "24",
|
||||||
|
"minvolume": "5",
|
||||||
|
"maxweight": "23",
|
||||||
|
"nominalFlowMin": "1000",
|
||||||
|
"flowMax": "6000",
|
||||||
|
"maxRainRef": "10",
|
||||||
|
"minSampleIntervalSec": "60",
|
||||||
|
"emptyWeightBucket": "8.3",
|
||||||
|
"aquon_sample_name": "112150",
|
||||||
|
"enableLog": false,
|
||||||
|
"logLevel": "error",
|
||||||
|
"positionVsParent": "atEquipment",
|
||||||
|
"positionIcon": "⊥",
|
||||||
|
"hasDistance": false,
|
||||||
|
"distance": "",
|
||||||
|
"x": 710,
|
||||||
|
"y": 220,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_basic_parse"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_basic_dbg_influx"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_basic_dbg_parent"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_inj_flow",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"group": "ui_group_monster_basic_ctrl",
|
||||||
|
"name": "flow 1800 m3/h",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "5",
|
||||||
|
"crontab": "",
|
||||||
|
"once": true,
|
||||||
|
"onceDelay": "1",
|
||||||
|
"topic": "",
|
||||||
|
"payload": "1800",
|
||||||
|
"payloadType": "num",
|
||||||
|
"x": 170,
|
||||||
|
"y": 180,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_basic_build_flow"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_build_flow",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"name": "build input_q",
|
||||||
|
"func": "msg.topic='input_q';\nmsg.payload={value:Number(msg.payload),unit:'m3/h'};\nreturn Number.isFinite(msg.payload.value)?msg:null;",
|
||||||
|
"outputs": 1,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 390,
|
||||||
|
"y": 180,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_basic_node"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_inj_start",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"group": "ui_group_monster_basic_ctrl",
|
||||||
|
"name": "manual start",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "topic",
|
||||||
|
"vt": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "",
|
||||||
|
"crontab": "",
|
||||||
|
"once": false,
|
||||||
|
"onceDelay": "0.1",
|
||||||
|
"topic": "i_start",
|
||||||
|
"payload": "true",
|
||||||
|
"payloadType": "bool",
|
||||||
|
"x": 160,
|
||||||
|
"y": 240,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_basic_node"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_parse",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"name": "parse output",
|
||||||
|
"func": "const p=(msg&&msg.payload&&typeof msg.payload==='object')?msg.payload:{};\nconst now=Date.now();\nreturn [\n Number.isFinite(Number(p.q))?{topic:'q_m3h',payload:Number(p.q),timestamp:now}:null,\n Number.isFinite(Number(p.m3Total))?{topic:'m3_total',payload:Number(p.m3Total),timestamp:now}:null,\n Number.isFinite(Number(p.bucketVol))?{topic:'bucket_l',payload:Number(p.bucketVol),timestamp:now}:null,\n Number.isFinite(Number(p.m3PerPuls||p.m3PerPulse))?{topic:'m3_per_pulse',payload:Number(p.m3PerPuls||p.m3PerPulse),timestamp:now}:null,\n {topic:'status',payload:`running=${Boolean(p.running)} | pulse=${Boolean(p.pulse)} | remaining=${Number(p.pulsesRemaining||0)}`}\n];",
|
||||||
|
"outputs": 5,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 930,
|
||||||
|
"y": 220,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_basic_chart_q"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_basic_chart_total"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_basic_chart_bucket"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_basic_chart_pulse"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_basic_text_status"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_chart_q",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"group": "ui_group_monster_basic_obs",
|
||||||
|
"name": "q",
|
||||||
|
"label": "Flow q (m3/h)",
|
||||||
|
"order": 1,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "15",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1170,
|
||||||
|
"y": 120,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_chart_total",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"group": "ui_group_monster_basic_obs",
|
||||||
|
"name": "m3Total",
|
||||||
|
"label": "m3Total",
|
||||||
|
"order": 2,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "15",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1180,
|
||||||
|
"y": 180,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_chart_bucket",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"group": "ui_group_monster_basic_obs",
|
||||||
|
"name": "bucket",
|
||||||
|
"label": "Bucket (L)",
|
||||||
|
"order": 3,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "15",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1180,
|
||||||
|
"y": 240,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_chart_pulse",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"group": "ui_group_monster_basic_obs",
|
||||||
|
"name": "m3PerPuls",
|
||||||
|
"label": "m3PerPuls",
|
||||||
|
"order": 4,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "15",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1190,
|
||||||
|
"y": 300,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_text_status",
|
||||||
|
"type": "ui-text",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"group": "ui_group_monster_basic_obs",
|
||||||
|
"name": "status",
|
||||||
|
"label": "Status",
|
||||||
|
"order": 5,
|
||||||
|
"width": 12,
|
||||||
|
"height": 1,
|
||||||
|
"format": "{{msg.payload}}",
|
||||||
|
"layout": "row-spread",
|
||||||
|
"x": 1170,
|
||||||
|
"y": 360,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_dbg_influx",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"name": "influx output",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 930,
|
||||||
|
"y": 300,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_basic_dbg_parent",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_basic_tab",
|
||||||
|
"name": "parent output",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 920,
|
||||||
|
"y": 340,
|
||||||
|
"wires": []
|
||||||
|
}
|
||||||
|
]
|
||||||
6
examples/edge.flow.json
Normal file
6
examples/edge.flow.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{"id":"monster_edge_tab","type":"tab","label":"monster edge","disabled":false,"info":"monster edge example"},
|
||||||
|
{"id":"monster_edge_node","type":"monster","z":"monster_edge_tab","name":"monster edge","x":420,"y":180,"wires":[["monster_edge_dbg"]]},
|
||||||
|
{"id":"monster_edge_inj","type":"inject","z":"monster_edge_tab","name":"unknown topic","props":[{"p":"topic","vt":"str"},{"p":"payload","vt":"str"}],"topic":"doesNotExist","payload":"x","payloadType":"str","x":170,"y":180,"wires":[["monster_edge_node"]]},
|
||||||
|
{"id":"monster_edge_dbg","type":"debug","z":"monster_edge_tab","name":"monster edge debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":660,"y":180,"wires":[]}
|
||||||
|
]
|
||||||
6
examples/integration.flow.json
Normal file
6
examples/integration.flow.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{"id":"monster_int_tab","type":"tab","label":"monster integration","disabled":false,"info":"monster integration example"},
|
||||||
|
{"id":"monster_int_node","type":"monster","z":"monster_int_tab","name":"monster integration","x":420,"y":180,"wires":[["monster_int_dbg"]]},
|
||||||
|
{"id":"monster_int_inj","type":"inject","z":"monster_int_tab","name":"registerChild","props":[{"p":"topic","vt":"str"},{"p":"payload","vt":"str"}],"topic":"registerChild","payload":"example-child-id","payloadType":"str","x":170,"y":180,"wires":[["monster_int_node"]]},
|
||||||
|
{"id":"monster_int_dbg","type":"debug","z":"monster_int_tab","name":"monster integration debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":680,"y":180,"wires":[]}
|
||||||
|
]
|
||||||
743
examples/monster-api-dashboard.flow.json
Normal file
743
examples/monster-api-dashboard.flow.json
Normal file
@@ -0,0 +1,743 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "monster_api_tab",
|
||||||
|
"type": "tab",
|
||||||
|
"label": "Monster API + Dashboard",
|
||||||
|
"disabled": false,
|
||||||
|
"info": "Full monster orchestration example with API integrations. Credentials are placeholders."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_base_monster_api",
|
||||||
|
"type": "ui-base",
|
||||||
|
"name": "EVOLV Demo",
|
||||||
|
"path": "/dashboard",
|
||||||
|
"appIcon": "",
|
||||||
|
"includeClientData": true,
|
||||||
|
"acceptsClientConfig": [
|
||||||
|
"ui-notification",
|
||||||
|
"ui-control"
|
||||||
|
],
|
||||||
|
"showPathInSidebar": false,
|
||||||
|
"headerContent": "page",
|
||||||
|
"navigationStyle": "default",
|
||||||
|
"titleBarStyle": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_theme_monster_api",
|
||||||
|
"type": "ui-theme",
|
||||||
|
"name": "Monster API Theme",
|
||||||
|
"colors": {
|
||||||
|
"surface": "#ffffff",
|
||||||
|
"primary": "#4f8582",
|
||||||
|
"bgPage": "#efefef",
|
||||||
|
"groupBg": "#ffffff",
|
||||||
|
"groupOutline": "#d8d8d8"
|
||||||
|
},
|
||||||
|
"sizes": {
|
||||||
|
"density": "default",
|
||||||
|
"pagePadding": "14px",
|
||||||
|
"groupGap": "14px",
|
||||||
|
"groupBorderRadius": "6px",
|
||||||
|
"widgetGap": "12px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_page_monster_api",
|
||||||
|
"type": "ui-page",
|
||||||
|
"name": "Monster API",
|
||||||
|
"ui": "ui_base_monster_api",
|
||||||
|
"path": "/monster-api",
|
||||||
|
"icon": "science",
|
||||||
|
"layout": "grid",
|
||||||
|
"theme": "ui_theme_monster_api",
|
||||||
|
"breakpoints": [
|
||||||
|
{
|
||||||
|
"name": "Default",
|
||||||
|
"px": "0",
|
||||||
|
"cols": "12"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"order": 1,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_group_monster_api_ctrl",
|
||||||
|
"type": "ui-group",
|
||||||
|
"name": "Input",
|
||||||
|
"page": "ui_page_monster_api",
|
||||||
|
"width": "6",
|
||||||
|
"height": "1",
|
||||||
|
"order": 1,
|
||||||
|
"showTitle": true,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_group_monster_api_obs",
|
||||||
|
"type": "ui-group",
|
||||||
|
"name": "Output",
|
||||||
|
"page": "ui_page_monster_api",
|
||||||
|
"width": "12",
|
||||||
|
"height": "1",
|
||||||
|
"order": 2,
|
||||||
|
"showTitle": true,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_node",
|
||||||
|
"type": "monster",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Monster API",
|
||||||
|
"samplingtime": "24",
|
||||||
|
"minvolume": "5",
|
||||||
|
"maxweight": "23",
|
||||||
|
"nominalFlowMin": "1000",
|
||||||
|
"flowMax": "6000",
|
||||||
|
"maxRainRef": "10",
|
||||||
|
"minSampleIntervalSec": "60",
|
||||||
|
"emptyWeightBucket": "8.3",
|
||||||
|
"aquon_sample_name": "112150",
|
||||||
|
"enableLog": false,
|
||||||
|
"logLevel": "error",
|
||||||
|
"positionVsParent": "atEquipment",
|
||||||
|
"positionIcon": "⊥",
|
||||||
|
"hasDistance": false,
|
||||||
|
"distance": "",
|
||||||
|
"x": 980,
|
||||||
|
"y": 320,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_parse_output",
|
||||||
|
"monster_api_zinfo_prepare"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_api_dbg_influx"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_api_dbg_parent"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_info",
|
||||||
|
"type": "comment",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Template only: set credentials/URLs before production",
|
||||||
|
"info": "All secrets in this flow are placeholders. Replace with env vars or credential nodes.",
|
||||||
|
"x": 260,
|
||||||
|
"y": 80,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_inj_flow",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"group": "ui_group_monster_api_ctrl",
|
||||||
|
"name": "Flow 1800 m3/h",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "5",
|
||||||
|
"crontab": "",
|
||||||
|
"once": true,
|
||||||
|
"onceDelay": "1",
|
||||||
|
"topic": "",
|
||||||
|
"payload": "1800",
|
||||||
|
"payloadType": "num",
|
||||||
|
"x": 170,
|
||||||
|
"y": 180,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_build_flow"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_build_flow",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Build input_q",
|
||||||
|
"func": "msg.topic='input_q';\nmsg.payload={value:Number(msg.payload),unit:'m3/h'};\nreturn Number.isFinite(msg.payload.value)?msg:null;",
|
||||||
|
"outputs": 1,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 390,
|
||||||
|
"y": 180,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_node"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_inj_start",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"group": "ui_group_monster_api_ctrl",
|
||||||
|
"name": "Manual Start",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "topic",
|
||||||
|
"vt": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "",
|
||||||
|
"crontab": "",
|
||||||
|
"once": false,
|
||||||
|
"onceDelay": "0.1",
|
||||||
|
"topic": "i_start",
|
||||||
|
"payload": "true",
|
||||||
|
"payloadType": "bool",
|
||||||
|
"x": 160,
|
||||||
|
"y": 240,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_node"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_weather_trigger",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Weather fetch (daily)",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "",
|
||||||
|
"crontab": "55 07 * * *",
|
||||||
|
"once": false,
|
||||||
|
"onceDelay": "",
|
||||||
|
"topic": "",
|
||||||
|
"payload": "",
|
||||||
|
"payloadType": "date",
|
||||||
|
"x": 190,
|
||||||
|
"y": 420,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_weather_http"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_weather_http",
|
||||||
|
"type": "http request",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Open-Meteo",
|
||||||
|
"method": "GET",
|
||||||
|
"ret": "txt",
|
||||||
|
"paytoqs": "ignore",
|
||||||
|
"url": "https://api.open-meteo.com/v1/forecast?latitude=51.71&longitude=4.81&hourly=precipitation,precipitation_probability&timezone=Europe%2FBerlin&past_days=1&forecast_days=2",
|
||||||
|
"tls": "",
|
||||||
|
"persist": false,
|
||||||
|
"proxy": "",
|
||||||
|
"insecureHTTPParser": false,
|
||||||
|
"authType": "",
|
||||||
|
"senderr": false,
|
||||||
|
"headers": [],
|
||||||
|
"x": 380,
|
||||||
|
"y": 420,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_weather_json"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_weather_json",
|
||||||
|
"type": "json",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "rain_data",
|
||||||
|
"property": "payload",
|
||||||
|
"action": "",
|
||||||
|
"pretty": false,
|
||||||
|
"x": 550,
|
||||||
|
"y": 420,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_weather_topic"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_weather_topic",
|
||||||
|
"type": "change",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "topic rain_data",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"t": "set",
|
||||||
|
"p": "topic",
|
||||||
|
"pt": "msg",
|
||||||
|
"to": "rain_data",
|
||||||
|
"tot": "str"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"x": 720,
|
||||||
|
"y": 420,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_node"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_aquon_trigger",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Aquon fetch (daily)",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "",
|
||||||
|
"crontab": "15 07 * * *",
|
||||||
|
"once": false,
|
||||||
|
"onceDelay": "",
|
||||||
|
"topic": "",
|
||||||
|
"payload": "",
|
||||||
|
"payloadType": "date",
|
||||||
|
"x": 180,
|
||||||
|
"y": 500,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_sftp_get"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_sftp_get",
|
||||||
|
"type": "sftp in",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"sftp": "monster_api_sftp_cfg",
|
||||||
|
"operation": "get",
|
||||||
|
"filename": "wsBD_MONSTERNAMETIJDEN.csv",
|
||||||
|
"localFilename": "./.node-red/node_modules/typicals/monster/config/monsternametijden.csv",
|
||||||
|
"name": "Aquon schedule",
|
||||||
|
"x": 380,
|
||||||
|
"y": 500,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_file_in"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_file_in",
|
||||||
|
"type": "file in",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "read monsternametijden",
|
||||||
|
"filename": "./.node-red/node_modules/typicals/monster/config/monsternametijden.csv",
|
||||||
|
"filenameType": "str",
|
||||||
|
"format": "utf8",
|
||||||
|
"chunk": false,
|
||||||
|
"sendError": false,
|
||||||
|
"encoding": "none",
|
||||||
|
"allProps": false,
|
||||||
|
"x": 590,
|
||||||
|
"y": 500,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_csv"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_csv",
|
||||||
|
"type": "csv",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "monsternametijden",
|
||||||
|
"sep": ",",
|
||||||
|
"hdrin": true,
|
||||||
|
"hdrout": "all",
|
||||||
|
"multi": "mult",
|
||||||
|
"ret": "\\n",
|
||||||
|
"temp": "SAMPLE_NAME,DESCRIPTION,SAMPLED_DATE,START_DATE,END_DATE",
|
||||||
|
"skip": "0",
|
||||||
|
"strings": true,
|
||||||
|
"include_empty_strings": "",
|
||||||
|
"include_null_values": "",
|
||||||
|
"x": 780,
|
||||||
|
"y": 500,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_schedule_topic"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_schedule_topic",
|
||||||
|
"type": "change",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "topic monsternametijden",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"t": "set",
|
||||||
|
"p": "topic",
|
||||||
|
"pt": "msg",
|
||||||
|
"to": "monsternametijden",
|
||||||
|
"tot": "str"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"x": 990,
|
||||||
|
"y": 500,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_node"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_zinfo_prepare",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Z-Info prepare on run stop",
|
||||||
|
"func": "const p=(msg&&msg.payload&&typeof msg.payload==='object')?msg.payload:{};\nconst runningNow=Boolean(p.running);\nconst runningPrev=Boolean(context.get('runningPrev'));\ncontext.set('runningPrev',runningNow);\nif(!(runningPrev && !runningNow)){\n return null;\n}\nconst today=new Date();\nconst day=String(today.getDate()).padStart(2,'0');\nconst month=String(today.getMonth()+1).padStart(2,'0');\nconst year=today.getFullYear();\nconst yesterdayDate=new Date(today.getTime()-24*3600*1000);\nconst yDay=String(yesterdayDate.getDate()).padStart(2,'0');\nconst yMonth=String(yesterdayDate.getMonth()+1).padStart(2,'0');\nconst yYear=yesterdayDate.getFullYear();\nmsg.zinfoDateFrom=`${yYear}-${yMonth}-${yDay}`;\nmsg.zinfoDateUntil=`${year}-${month}-${day}`;\nmsg.zinfoData={\n m3Total:Number(p.m3Total||0),\n pulse:Math.max(0,Math.floor(Number(p.m3PerPuls||p.m3PerPulse||0)))\n};\nmsg.payload='grant_type=password&username=__SET_ZINFO_USERNAME__&password=__SET_ZINFO_PASSWORD__&client_id=__SET_ZINFO_CLIENT_ID__&client_secret=__SET_ZINFO_CLIENT_SECRET__';\nmsg.headers=msg.headers||{};\nmsg.headers['content-type']='application/x-www-form-urlencoded';\nreturn msg;",
|
||||||
|
"outputs": 1,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 1260,
|
||||||
|
"y": 320,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_zinfo_token"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_zinfo_token",
|
||||||
|
"type": "http request",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Z-Info token",
|
||||||
|
"method": "POST",
|
||||||
|
"ret": "txt",
|
||||||
|
"paytoqs": "ignore",
|
||||||
|
"url": "https://__SET_ZINFO_HOST__/WSR/zi_wsr.svc/token",
|
||||||
|
"tls": "",
|
||||||
|
"persist": false,
|
||||||
|
"proxy": "",
|
||||||
|
"insecureHTTPParser": false,
|
||||||
|
"authType": "",
|
||||||
|
"senderr": false,
|
||||||
|
"headers": [],
|
||||||
|
"x": 1450,
|
||||||
|
"y": 320,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_zinfo_token_json"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_zinfo_token_json",
|
||||||
|
"type": "json",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "token json",
|
||||||
|
"property": "payload",
|
||||||
|
"action": "",
|
||||||
|
"pretty": false,
|
||||||
|
"x": 1630,
|
||||||
|
"y": 320,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_zinfo_import_builder"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_zinfo_import_builder",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Build Z-Info import",
|
||||||
|
"func": "const token=msg.payload&&msg.payload.access_token;\nconst z=msg.zinfoData||{};\nconst from=msg.zinfoDateFrom;\nconst until=msg.zinfoDateUntil;\nconst ns='__SET_ZINFO_NAMESPACE__';\nmsg.payload={\n import:{\n algemeen:{\n AanleverendeOrganisatie:'NL.25',\n Versie:'IMm2018',\n Batchid:`ZI_PA_NL.25_${Date.now()}.json`,\n Systeembron:'WBD/NEERSG',\n Systeemdoel:'HWH/Z-info',\n Opmerking:'template'\n },\n data:[{\n Meetwaarden:[\n {mepid:`${ns}.F021.m3`,dbmDtm:from,dbmTijd:'06:00',demDtm:until,demTijd:'06:00',mwdWaarde:`${Number(z.m3Total||0)}`,mwdWaardeAN:'',nMwd:'',mwdOpmerk:'template'},\n {mepid:`${ns}.Q000.PULS`,dbmDtm:from,dbmTijd:'06:00',demDtm:until,demTijd:'06:00',mwdWaarde:`${Number(z.pulse||0)}`,mwdWaardeAN:'',nMwd:'',mwdOpmerk:'template'}\n ]\n }]\n }\n};\nmsg.headers=msg.headers||{};\nif(token){msg.headers.authorization='Bearer '+token;}\nmsg.headers['content-type']='application/json';\nreturn msg;",
|
||||||
|
"outputs": 1,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 1830,
|
||||||
|
"y": 320,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_zinfo_import_put"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_zinfo_import_put",
|
||||||
|
"type": "http request",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Z-Info import PUT",
|
||||||
|
"method": "PUT",
|
||||||
|
"ret": "txt",
|
||||||
|
"paytoqs": "ignore",
|
||||||
|
"url": "https://__SET_ZINFO_HOST__/WSR/zi_wsr.svc/json/NL.25/importmwd/pa/?gebruiker=__SET_ZINFO_USER__",
|
||||||
|
"tls": "",
|
||||||
|
"persist": false,
|
||||||
|
"proxy": "",
|
||||||
|
"insecureHTTPParser": false,
|
||||||
|
"authType": "",
|
||||||
|
"senderr": false,
|
||||||
|
"headers": [],
|
||||||
|
"x": 2040,
|
||||||
|
"y": 320,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_dbg_zinfo"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_dbg_zinfo",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Z-Info response",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "false",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 2250,
|
||||||
|
"y": 320,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_parse_output",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Parse output for dashboard",
|
||||||
|
"func": "const p=(msg&&msg.payload&&typeof msg.payload==='object')?msg.payload:{};\nconst now=Date.now();\nconst m3PerPuls=Number(p.m3PerPuls||p.m3PerPulse);\nreturn [\n Number.isFinite(Number(p.q))?{topic:'q_m3h',payload:Number(p.q),timestamp:now}:null,\n Number.isFinite(Number(p.m3Total))?{topic:'m3_total',payload:Number(p.m3Total),timestamp:now}:null,\n Number.isFinite(Number(p.bucketVol))?{topic:'bucket_l',payload:Number(p.bucketVol),timestamp:now}:null,\n Number.isFinite(m3PerPuls)?{topic:'m3_per_pulse',payload:m3PerPuls,timestamp:now}:null,\n {topic:'status',payload:`running=${Boolean(p.running)} | pulse=${Boolean(p.pulse)} | m3PerPuls=${Number.isFinite(m3PerPuls)?m3PerPuls:'n/a'} | missed=${Number(p.missedSamples||0)}`}\n];",
|
||||||
|
"outputs": 5,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 1240,
|
||||||
|
"y": 220,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_chart_q"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_api_chart_total"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_api_chart_bucket"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_api_chart_pulse"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_api_text_status"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_chart_q",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"group": "ui_group_monster_api_obs",
|
||||||
|
"name": "q",
|
||||||
|
"label": "Flow q (m3/h)",
|
||||||
|
"order": 1,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1470,
|
||||||
|
"y": 120,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_chart_total",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"group": "ui_group_monster_api_obs",
|
||||||
|
"name": "m3Total",
|
||||||
|
"label": "m3Total",
|
||||||
|
"order": 2,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1480,
|
||||||
|
"y": 180,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_chart_bucket",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"group": "ui_group_monster_api_obs",
|
||||||
|
"name": "bucket",
|
||||||
|
"label": "Bucket (L)",
|
||||||
|
"order": 3,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1480,
|
||||||
|
"y": 240,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_chart_pulse",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"group": "ui_group_monster_api_obs",
|
||||||
|
"name": "m3PerPuls",
|
||||||
|
"label": "m3PerPuls",
|
||||||
|
"order": 4,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1490,
|
||||||
|
"y": 300,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_text_status",
|
||||||
|
"type": "ui-text",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"group": "ui_group_monster_api_obs",
|
||||||
|
"name": "status",
|
||||||
|
"label": "Status",
|
||||||
|
"order": 5,
|
||||||
|
"width": 12,
|
||||||
|
"height": 1,
|
||||||
|
"format": "{{msg.payload}}",
|
||||||
|
"layout": "row-spread",
|
||||||
|
"x": 1460,
|
||||||
|
"y": 360,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_dashboardapi",
|
||||||
|
"type": "dashboardapi",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "dashboard template",
|
||||||
|
"x": 1430,
|
||||||
|
"y": 420,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_grafana_post"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_grafana_post",
|
||||||
|
"type": "http request",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "Grafana dashboard API",
|
||||||
|
"method": "POST",
|
||||||
|
"ret": "txt",
|
||||||
|
"paytoqs": "ignore",
|
||||||
|
"url": "https://__SET_GRAFANA_HOST__/api/dashboards/db",
|
||||||
|
"tls": "",
|
||||||
|
"persist": false,
|
||||||
|
"proxy": "",
|
||||||
|
"insecureHTTPParser": false,
|
||||||
|
"authType": "",
|
||||||
|
"senderr": false,
|
||||||
|
"headers": [],
|
||||||
|
"x": 1650,
|
||||||
|
"y": 420,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_api_dbg_dashboard"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_dbg_dashboard",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "dashboard API response",
|
||||||
|
"active": false,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "false",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 1870,
|
||||||
|
"y": 420,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_dbg_influx",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "influx output",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 1240,
|
||||||
|
"y": 460,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_dbg_parent",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_api_tab",
|
||||||
|
"name": "parent output",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 1230,
|
||||||
|
"y": 500,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_api_sftp_cfg",
|
||||||
|
"type": "sftp",
|
||||||
|
"host": "__SET_AQUON_SFTP_HOST__",
|
||||||
|
"port": "22",
|
||||||
|
"username": "__SET_AQUON_SFTP_USERNAME__",
|
||||||
|
"password": "__SET_AQUON_SFTP_PASSWORD__",
|
||||||
|
"hmac": [],
|
||||||
|
"cipher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
483
examples/monster-dashboard.flow.json
Normal file
483
examples/monster-dashboard.flow.json
Normal file
@@ -0,0 +1,483 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "monster_tab_demo",
|
||||||
|
"type": "tab",
|
||||||
|
"label": "Monster Dashboard Demo",
|
||||||
|
"disabled": false,
|
||||||
|
"info": "Dashboard-focused example for monster output visualization"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_base_monster_demo",
|
||||||
|
"type": "ui-base",
|
||||||
|
"name": "EVOLV Demo",
|
||||||
|
"path": "/dashboard",
|
||||||
|
"appIcon": "",
|
||||||
|
"includeClientData": true,
|
||||||
|
"acceptsClientConfig": [
|
||||||
|
"ui-notification",
|
||||||
|
"ui-control"
|
||||||
|
],
|
||||||
|
"showPathInSidebar": false,
|
||||||
|
"headerContent": "page",
|
||||||
|
"navigationStyle": "default",
|
||||||
|
"titleBarStyle": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_theme_monster_demo",
|
||||||
|
"type": "ui-theme",
|
||||||
|
"name": "EVOLV Monster Theme",
|
||||||
|
"colors": {
|
||||||
|
"surface": "#ffffff",
|
||||||
|
"primary": "#4f8582",
|
||||||
|
"bgPage": "#efefef",
|
||||||
|
"groupBg": "#ffffff",
|
||||||
|
"groupOutline": "#d8d8d8"
|
||||||
|
},
|
||||||
|
"sizes": {
|
||||||
|
"density": "default",
|
||||||
|
"pagePadding": "14px",
|
||||||
|
"groupGap": "14px",
|
||||||
|
"groupBorderRadius": "6px",
|
||||||
|
"widgetGap": "12px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_page_monster_demo",
|
||||||
|
"type": "ui-page",
|
||||||
|
"name": "Monster Demo",
|
||||||
|
"ui": "ui_base_monster_demo",
|
||||||
|
"path": "/monster-demo",
|
||||||
|
"icon": "science",
|
||||||
|
"layout": "grid",
|
||||||
|
"theme": "ui_theme_monster_demo",
|
||||||
|
"breakpoints": [
|
||||||
|
{
|
||||||
|
"name": "Default",
|
||||||
|
"px": "0",
|
||||||
|
"cols": "12"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"order": 1,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_group_monster_ctrl",
|
||||||
|
"type": "ui-group",
|
||||||
|
"name": "Monster Inputs",
|
||||||
|
"page": "ui_page_monster_demo",
|
||||||
|
"width": "6",
|
||||||
|
"height": "1",
|
||||||
|
"order": 1,
|
||||||
|
"showTitle": true,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ui_group_monster_obs",
|
||||||
|
"type": "ui-group",
|
||||||
|
"name": "Monster Output",
|
||||||
|
"page": "ui_page_monster_demo",
|
||||||
|
"width": "12",
|
||||||
|
"height": "1",
|
||||||
|
"order": 2,
|
||||||
|
"showTitle": true,
|
||||||
|
"className": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_node_demo",
|
||||||
|
"type": "monster",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"name": "Monster Demo",
|
||||||
|
"samplingtime": "24",
|
||||||
|
"minvolume": "5",
|
||||||
|
"maxweight": "23",
|
||||||
|
"nominalFlowMin": "1000",
|
||||||
|
"flowMax": "6000",
|
||||||
|
"maxRainRef": "10",
|
||||||
|
"minSampleIntervalSec": "60",
|
||||||
|
"emptyWeightBucket": "8.3",
|
||||||
|
"aquon_sample_name": "112150",
|
||||||
|
"uuid": "",
|
||||||
|
"supplier": "monster",
|
||||||
|
"category": "monster",
|
||||||
|
"assetType": "sampling-cabinet",
|
||||||
|
"model": "monster-standard",
|
||||||
|
"unit": "m3/h",
|
||||||
|
"enableLog": false,
|
||||||
|
"logLevel": "error",
|
||||||
|
"positionVsParent": "atEquipment",
|
||||||
|
"positionIcon": "⊥",
|
||||||
|
"hasDistance": false,
|
||||||
|
"distance": "",
|
||||||
|
"x": 900,
|
||||||
|
"y": 260,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_parse_output"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_debug_influx"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_debug_parent"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_flow_inject",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_ctrl",
|
||||||
|
"name": "Flow 1800 m3/h",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "5",
|
||||||
|
"crontab": "",
|
||||||
|
"once": true,
|
||||||
|
"onceDelay": "1",
|
||||||
|
"topic": "",
|
||||||
|
"payload": "1800",
|
||||||
|
"payloadType": "num",
|
||||||
|
"x": 170,
|
||||||
|
"y": 180,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_build_flow"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_build_flow",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"name": "Build input_q",
|
||||||
|
"func": "msg.topic = 'input_q';\nmsg.payload = { value: Number(msg.payload), unit: 'm3/h' };\nreturn Number.isFinite(msg.payload.value) ? msg : null;",
|
||||||
|
"outputs": 1,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 380,
|
||||||
|
"y": 180,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_node_demo"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_start_inject",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_ctrl",
|
||||||
|
"name": "Manual Start",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "topic",
|
||||||
|
"vt": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "",
|
||||||
|
"crontab": "",
|
||||||
|
"once": false,
|
||||||
|
"onceDelay": "0.1",
|
||||||
|
"topic": "i_start",
|
||||||
|
"payload": "true",
|
||||||
|
"payloadType": "bool",
|
||||||
|
"x": 160,
|
||||||
|
"y": 240,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_node_demo"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_rain_inject",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_ctrl",
|
||||||
|
"name": "Seed rain_data",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "",
|
||||||
|
"crontab": "",
|
||||||
|
"once": true,
|
||||||
|
"onceDelay": "2",
|
||||||
|
"topic": "",
|
||||||
|
"payload": "",
|
||||||
|
"payloadType": "date",
|
||||||
|
"x": 160,
|
||||||
|
"y": 300,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_build_rain"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_build_rain",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"name": "Build rain_data",
|
||||||
|
"func": "const now = new Date();\nconst mk = (offset, rain, prob) => {\n const d = new Date(now.getTime() + offset * 3600 * 1000);\n return { t: d.toISOString().slice(0, 13) + ':00', rain, prob };\n};\nconst rows = [mk(-1, 0.2, 20), mk(0, 0.8, 40), mk(1, 1.1, 60), mk(2, 0.5, 30)];\nmsg.topic = 'rain_data';\nmsg.payload = [\n {\n latitude: 51.71,\n longitude: 4.81,\n hourly: {\n time: rows.map(r => r.t),\n precipitation: rows.map(r => r.rain),\n precipitation_probability: rows.map(r => r.prob)\n }\n }\n];\nreturn msg;",
|
||||||
|
"outputs": 1,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 380,
|
||||||
|
"y": 300,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_node_demo"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_schedule_inject",
|
||||||
|
"type": "inject",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_ctrl",
|
||||||
|
"name": "Seed monsternametijden",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"p": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": "",
|
||||||
|
"crontab": "",
|
||||||
|
"once": true,
|
||||||
|
"onceDelay": "3",
|
||||||
|
"topic": "",
|
||||||
|
"payload": "",
|
||||||
|
"payloadType": "date",
|
||||||
|
"x": 190,
|
||||||
|
"y": 360,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_build_schedule"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_build_schedule",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"name": "Build monsternametijden",
|
||||||
|
"func": "const now = new Date();\nconst next = new Date(now.getTime() + 24 * 3600 * 1000);\nconst end = new Date(next.getTime() + 24 * 3600 * 1000);\nmsg.topic = 'monsternametijden';\nmsg.payload = [\n {\n SAMPLE_NAME: '112150',\n DESCRIPTION: 'demo schedule',\n SAMPLED_DATE: next.toISOString().slice(0, 19).replace('T', ' '),\n START_DATE: next.toISOString().slice(0, 19).replace('T', ' '),\n END_DATE: end.toISOString().slice(0, 19).replace('T', ' ')\n }\n];\nreturn msg;",
|
||||||
|
"outputs": 1,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 410,
|
||||||
|
"y": 360,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_node_demo"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_parse_output",
|
||||||
|
"type": "function",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"name": "Parse monster output",
|
||||||
|
"func": "const p = (msg && msg.payload && typeof msg.payload === 'object') ? msg.payload : {};\nconst now = Date.now();\nconst q = Number(p.q);\nconst total = Number(p.m3Total);\nconst bucket = Number(p.bucketVol);\nconst rem = Number(p.pulsesRemaining);\nconst m3PerPulse = Number(p.m3PerPuls || p.m3PerPulse);\nconst status = `running=${Boolean(p.running)} | pulse=${Boolean(p.pulse)} | m3PerPuls=${Number.isFinite(m3PerPulse) ? m3PerPulse : 'n/a'} | missed=${Number(p.missedSamples || 0)}`;\nreturn [\n Number.isFinite(q) ? { topic: 'q_m3h', payload: q, timestamp: now } : null,\n Number.isFinite(total) ? { topic: 'm3_total', payload: total, timestamp: now } : null,\n Number.isFinite(bucket) ? { topic: 'bucket_l', payload: bucket, timestamp: now } : null,\n Number.isFinite(rem) ? { topic: 'pulses_remaining', payload: rem, timestamp: now } : null,\n Number.isFinite(m3PerPulse) ? { topic: 'm3_per_pulse', payload: m3PerPulse, timestamp: now } : null,\n { topic: 'status', payload: status }\n];",
|
||||||
|
"outputs": 6,
|
||||||
|
"noerr": 0,
|
||||||
|
"x": 1130,
|
||||||
|
"y": 260,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"monster_chart_q"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_chart_m3total"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_chart_bucket"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_chart_remaining"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_chart_m3pulse"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"monster_text_status"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_chart_q",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_obs",
|
||||||
|
"name": "Flow q",
|
||||||
|
"label": "Flow q (m3/h)",
|
||||||
|
"order": 1,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1370,
|
||||||
|
"y": 120,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_chart_m3total",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_obs",
|
||||||
|
"name": "m3 Total",
|
||||||
|
"label": "m3Total (m3)",
|
||||||
|
"order": 2,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1380,
|
||||||
|
"y": 180,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_chart_bucket",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_obs",
|
||||||
|
"name": "Bucket Volume",
|
||||||
|
"label": "Bucket (L)",
|
||||||
|
"order": 3,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1380,
|
||||||
|
"y": 240,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_chart_remaining",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_obs",
|
||||||
|
"name": "Pulses Remaining",
|
||||||
|
"label": "Pulses Remaining",
|
||||||
|
"order": 4,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1400,
|
||||||
|
"y": 300,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_chart_m3pulse",
|
||||||
|
"type": "ui-chart",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_obs",
|
||||||
|
"name": "m3 per pulse",
|
||||||
|
"label": "m3PerPuls",
|
||||||
|
"order": 5,
|
||||||
|
"width": 6,
|
||||||
|
"height": 4,
|
||||||
|
"chartType": "line",
|
||||||
|
"category": "topic",
|
||||||
|
"categoryType": "msg",
|
||||||
|
"xAxisType": "time",
|
||||||
|
"xAxisPropertyType": "timestamp",
|
||||||
|
"yAxisPropertyType": "msg",
|
||||||
|
"yAxisProperty": "payload",
|
||||||
|
"removeOlder": "30",
|
||||||
|
"removeOlderUnit": "60",
|
||||||
|
"showLegend": false,
|
||||||
|
"action": "append",
|
||||||
|
"x": 1390,
|
||||||
|
"y": 360,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_text_status",
|
||||||
|
"type": "ui-text",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"group": "ui_group_monster_obs",
|
||||||
|
"name": "Sampling status",
|
||||||
|
"label": "Status",
|
||||||
|
"order": 6,
|
||||||
|
"width": 12,
|
||||||
|
"height": 1,
|
||||||
|
"format": "{{msg.payload}}",
|
||||||
|
"layout": "row-spread",
|
||||||
|
"x": 1380,
|
||||||
|
"y": 420,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_debug_influx",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"name": "Influx output",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 1130,
|
||||||
|
"y": 320,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "monster_debug_parent",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "monster_tab_demo",
|
||||||
|
"name": "Parent output",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 1130,
|
||||||
|
"y": 360,
|
||||||
|
"wires": []
|
||||||
|
}
|
||||||
|
]
|
||||||
421
monster.html
421
monster.html
@@ -1,269 +1,266 @@
|
|||||||
<script type="module">
|
<!-- Load the dynamic menu & config endpoints -->
|
||||||
//import * as menuUtils from "/generalFunctions/helper/menuUtils.js";
|
<script src="/monster/menu.js"></script>
|
||||||
|
<script src="/monster/configData.js"></script>
|
||||||
|
|
||||||
RED.nodes.registerType('monster', {
|
<script>
|
||||||
|
RED.nodes.registerType("monster", {
|
||||||
|
category: "EVOLV",
|
||||||
|
color: "#4f8582",
|
||||||
|
defaults: {
|
||||||
|
|
||||||
category: 'wbd typical',
|
// Define default properties
|
||||||
color: '#4f8582',
|
name: { value: "" },
|
||||||
|
|
||||||
defaults: {
|
// Define specific properties
|
||||||
|
samplingtime: { value: 0 },
|
||||||
|
minvolume: { value: 5 },
|
||||||
|
maxweight: { value: 22 },
|
||||||
|
nominalFlowMin: { value: 0 },
|
||||||
|
flowMax: { value: 0 },
|
||||||
|
maxRainRef: { value: 10 },
|
||||||
|
minSampleIntervalSec: { value: 60 },
|
||||||
|
emptyWeightBucket: { value: 3 },
|
||||||
|
aquon_sample_name: { value: "" },
|
||||||
|
|
||||||
// Define default properties
|
//define asset properties
|
||||||
name: { value: "", required: true },
|
uuid: { value: "" },
|
||||||
enableLog: { value: false },
|
supplier: { value: "" },
|
||||||
logLevel: { value: "error" },
|
category: { value: "" },
|
||||||
|
assetType: { value: "" },
|
||||||
|
model: { value: "" },
|
||||||
|
unit: { value: "" },
|
||||||
|
|
||||||
// Define specific properties
|
//logger properties
|
||||||
samplingtime: { value: 0 },
|
enableLog: { value: false },
|
||||||
minvolume: { value: 5 },
|
logLevel: { value: "error" },
|
||||||
maxweight: { value: 22 },
|
|
||||||
emptyWeightBucket: { value: 3 },
|
|
||||||
aquon_sample_name: { value: "" },
|
|
||||||
|
|
||||||
//define asset properties
|
//physicalAspect
|
||||||
supplier: { value: "" },
|
positionVsParent: { value: "" },
|
||||||
subType: { value: "" },
|
positionIcon: { value: "" },
|
||||||
model: { value: "" },
|
hasDistance: { value: false },
|
||||||
unit: { value: "" },
|
distance: { value: 0 },
|
||||||
|
distanceUnit: { value: "m" },
|
||||||
|
distanceDescription: { value: "" }
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
inputs: 1,
|
inputs: 1,
|
||||||
outputs: 4,
|
outputs: 3,
|
||||||
inputLabels: ["Measurement Input"],
|
inputLabels: ["Input"],
|
||||||
outputLabels: ["process", "dbase", "upstreamParent", "downstreamParent"],
|
outputLabels: ["process", "dbase", "parent"],
|
||||||
icon: "font-awesome/fa-exchange",
|
icon: "font-awesome/fa-tachometer",
|
||||||
|
|
||||||
// Define label function
|
label: function () {
|
||||||
label: function() {
|
return (this.positionIcon || "") + " " + (this.category ? this.category.slice(0, -1) : "Monster");
|
||||||
return this.name || "Monsternamekast";
|
|
||||||
},
|
},
|
||||||
|
|
||||||
oneditprepare: function() {
|
oneditprepare: function() {
|
||||||
const node = this;
|
// wait for the menu scripts to load
|
||||||
|
const waitForMenuData = () => {
|
||||||
|
if (window.EVOLV?.nodes?.monster?.initEditor) {
|
||||||
|
window.EVOLV.nodes.monster.initEditor(this);
|
||||||
|
} else {
|
||||||
|
setTimeout(waitForMenuData, 50);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
waitForMenuData();
|
||||||
|
|
||||||
// Define UI html elements
|
// your existing project‐settings & asset dropdown logic can remain here
|
||||||
const elements = {
|
document.getElementById("node-input-samplingtime");
|
||||||
// Basic fields
|
document.getElementById("node-input-minvolume");
|
||||||
name: document.getElementById("node-input-name"),
|
document.getElementById("node-input-maxweight");
|
||||||
// specific fields
|
document.getElementById("node-input-nominalFlowMin");
|
||||||
samplingtime: document.getElementById("node-input-samplingtime"),
|
document.getElementById("node-input-flowMax");
|
||||||
minvolume: document.getElementById("node-input-minvolume"),
|
document.getElementById("node-input-maxRainRef");
|
||||||
maxweight: document.getElementById("node-input-maxweight"),
|
document.getElementById("node-input-minSampleIntervalSec");
|
||||||
emptyWeightBucket: document.getElementById("node-input-emptyWeightBucket"),
|
document.getElementById("node-input-emptyWeightBucket");
|
||||||
aquon_sample_name: document.getElementById("node-input-aquon_sample_name"),
|
const aquonSelect = document.getElementById("node-input-aquon_sample_name");
|
||||||
// Logging fields
|
|
||||||
logCheckbox: document.getElementById("node-input-enableLog"),
|
|
||||||
logLevelSelect: document.getElementById("node-input-logLevel"),
|
|
||||||
rowLogLevel: document.getElementById("row-logLevel"),
|
|
||||||
// Asset fields
|
|
||||||
supplier: document.getElementById("node-input-supplier"),
|
|
||||||
subType: document.getElementById("node-input-subType"),
|
|
||||||
model: document.getElementById("node-input-model"),
|
|
||||||
unit: document.getElementById("node-input-unit"),
|
|
||||||
|
|
||||||
};
|
if (aquonSelect) {
|
||||||
|
const menuData = window.EVOLV?.nodes?.monster?.menuData?.aquon || {};
|
||||||
|
const options = menuData.samples || [];
|
||||||
|
const specs = menuData.specs || {};
|
||||||
|
const defaultSpec = specs.defaults || {};
|
||||||
|
const specMap = specs.bySample || {};
|
||||||
|
|
||||||
//this needs to live somewhere and for now we add it to every node file for simplicity
|
const setReadOnly = () => {};
|
||||||
const projecSettingstURL = "http://localhost:1880/generalFunctions/settings/projectSettings.json";
|
|
||||||
|
|
||||||
try{
|
const applySpec = (spec) => {
|
||||||
|
const merged = {
|
||||||
|
samplingtime: defaultSpec.samplingtime,
|
||||||
|
minvolume: defaultSpec.minvolume,
|
||||||
|
maxweight: defaultSpec.maxweight,
|
||||||
|
emptyWeightBucket: defaultSpec.emptyWeightBucket,
|
||||||
|
...(spec || {})
|
||||||
|
};
|
||||||
|
|
||||||
// Fetch project settings
|
const samplingTimeEl = document.getElementById("node-input-samplingtime");
|
||||||
menuUtils.fetchProjectData(projecSettingstURL)
|
const minVolumeEl = document.getElementById("node-input-minvolume");
|
||||||
.then((projectSettings) => {
|
const maxWeightEl = document.getElementById("node-input-maxweight");
|
||||||
|
const nominalFlowMinEl = document.getElementById("node-input-nominalFlowMin");
|
||||||
|
const flowMaxEl = document.getElementById("node-input-flowMax");
|
||||||
|
const maxRainEl = document.getElementById("node-input-maxRainRef");
|
||||||
|
const minSampleIntervalEl = document.getElementById("node-input-minSampleIntervalSec");
|
||||||
|
const emptyWeightEl = document.getElementById("node-input-emptyWeightBucket");
|
||||||
|
|
||||||
//assign to node vars
|
if (samplingTimeEl && merged.samplingtime !== undefined) {
|
||||||
node.configUrls = projectSettings.configUrls;
|
samplingTimeEl.value = merged.samplingtime;
|
||||||
|
}
|
||||||
|
if (minVolumeEl && merged.minvolume !== undefined) {
|
||||||
|
minVolumeEl.value = merged.minvolume;
|
||||||
|
}
|
||||||
|
if (maxWeightEl && merged.maxweight !== undefined) {
|
||||||
|
maxWeightEl.value = merged.maxweight;
|
||||||
|
}
|
||||||
|
if (nominalFlowMinEl && merged.nominalFlowMin !== undefined) {
|
||||||
|
nominalFlowMinEl.value = merged.nominalFlowMin;
|
||||||
|
}
|
||||||
|
if (flowMaxEl && merged.flowMax !== undefined) {
|
||||||
|
flowMaxEl.value = merged.flowMax;
|
||||||
|
}
|
||||||
|
if (maxRainEl && merged.maxRainRef !== undefined) {
|
||||||
|
maxRainEl.value = merged.maxRainRef;
|
||||||
|
}
|
||||||
|
if (minSampleIntervalEl && merged.minSampleIntervalSec !== undefined) {
|
||||||
|
minSampleIntervalEl.value = merged.minSampleIntervalSec;
|
||||||
|
}
|
||||||
|
if (emptyWeightEl && merged.emptyWeightBucket !== undefined) {
|
||||||
|
emptyWeightEl.value = merged.emptyWeightBucket;
|
||||||
|
}
|
||||||
|
|
||||||
const { cloudConfigURL, localConfigURL } = menuUtils.getSpecificConfigUrl("monster",node.configUrls.cloud.taggcodeAPI);
|
};
|
||||||
node.configUrls.cloud.config = cloudConfigURL; // first call
|
|
||||||
node.configUrls.local.config = localConfigURL; // backup call
|
|
||||||
|
|
||||||
node.locationId = projectSettings.locationId;
|
aquonSelect.innerHTML = "";
|
||||||
node.uuid = projectSettings.uuid;
|
|
||||||
|
|
||||||
// Gets the ID of the active workspace (Flow)
|
const emptyOption = document.createElement("option");
|
||||||
const activeFlowId = RED.workspaces.active(); //fetches active flow id
|
emptyOption.value = "";
|
||||||
node.processId = activeFlowId;
|
emptyOption.textContent = "Select sample...";
|
||||||
|
aquonSelect.appendChild(emptyOption);
|
||||||
|
|
||||||
// UI elements across all nodes
|
options.forEach((option) => {
|
||||||
menuUtils.fetchAndPopulateDropdowns(node.configUrls, elements, node); // function for all assets
|
const optionElement = document.createElement("option");
|
||||||
menuUtils.initBasicToggles(elements);
|
optionElement.value = option.code;
|
||||||
|
optionElement.textContent = `${option.code} - ${option.description}`;
|
||||||
|
optionElement.title = option.description || option.code;
|
||||||
|
aquonSelect.appendChild(optionElement);
|
||||||
|
});
|
||||||
|
|
||||||
})
|
if (this.aquon_sample_name) {
|
||||||
|
aquonSelect.value = this.aquon_sample_name;
|
||||||
|
}
|
||||||
|
|
||||||
}catch(e){
|
aquonSelect.addEventListener("change", () => {
|
||||||
console.log("Error fetching project settings", e);
|
const selected = aquonSelect.value;
|
||||||
}
|
if (!selected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const selectedSpec = specMap[selected] || {};
|
||||||
|
applySpec(selectedSpec);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
oneditsave: function() {
|
oneditsave: function() {
|
||||||
const node = this;
|
const node = this;
|
||||||
|
|
||||||
console.log(`------------ Saving changes to node ------------`);
|
// save asset fields
|
||||||
console.log(`${node.uuid}`);
|
if (window.EVOLV?.nodes?.monster?.assetMenu?.saveEditor) {
|
||||||
|
window.EVOLV.nodes.monster.assetMenu.saveEditor(this);
|
||||||
// Save basic properties
|
}
|
||||||
[ "name", "supplier", "subType", "model" ,"unit" ].forEach(
|
// save logger fields
|
||||||
(field) => (node[field] = document.getElementById(`node-input-${field}`).value || "")
|
if (window.EVOLV?.nodes?.monster?.loggerMenu?.saveEditor) {
|
||||||
);
|
window.EVOLV.nodes.monster.loggerMenu.saveEditor(this);
|
||||||
|
}
|
||||||
// Save numeric and boolean properties
|
// save position field
|
||||||
["enableLog"].forEach(
|
if (window.EVOLV?.nodes?.monster?.positionMenu?.saveEditor) {
|
||||||
(field) => (node[field] = document.getElementById(`node-input-${field}`).checked)
|
window.EVOLV.nodes.monster.positionMenu.saveEditor(this);
|
||||||
);
|
|
||||||
|
|
||||||
["samplingtime","minvolume","maxweight","emptyWeightBucket","aquon_sample_name"].forEach(
|
|
||||||
(field) => (node[field] = parseFloat(document.getElementById(`node-input-${field}`).value) || 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
node.logLevel = document.getElementById("node-input-logLevel").value || "info";
|
|
||||||
|
|
||||||
// Validation checks
|
|
||||||
if (node.scaling && (isNaN(node.i_min) || isNaN(node.i_max))) {
|
|
||||||
RED.notify("Scaling enabled, but input range is incomplete!", "error");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node.unit) {
|
const normalizeNumber = (value) => {
|
||||||
RED.notify("Unit selection is required.", "error");
|
if (typeof value !== "string") {
|
||||||
}
|
return value;
|
||||||
|
}
|
||||||
|
return value.replace(",", ".");
|
||||||
|
};
|
||||||
|
|
||||||
if (node.subType && !node.unit) {
|
["samplingtime", "minvolume", "maxweight", "nominalFlowMin", "flowMax", "maxRainRef", "minSampleIntervalSec", "emptyWeightBucket"].forEach((field) => {
|
||||||
RED.notify("Unit must be set when specifying a subtype.", "error");
|
const element = document.getElementById(`node-input-${field}`);
|
||||||
}
|
const rawValue = normalizeNumber(element?.value || "");
|
||||||
|
const value = parseFloat(rawValue) || 0;
|
||||||
|
console.log(`----------------> Saving ${field}: ${value}`);
|
||||||
|
node[field] = value;
|
||||||
|
});
|
||||||
|
|
||||||
console.log("stored node modelData", node.modelMetadata);
|
["aquon_sample_name"].forEach((field) => {
|
||||||
console.log("------------ Changes saved to measurement node preparing to save to API ------------");
|
const element = document.getElementById(`node-input-${field}`);
|
||||||
|
const value = element?.value || "";
|
||||||
try{
|
console.log(`----------------> Saving ${field}: ${value}`);
|
||||||
// Fetch project settings
|
node[field] = value;
|
||||||
menuUtils.apiCall(node,node.configUrls)
|
});
|
||||||
.then((response) => {
|
|
||||||
|
|
||||||
//save response to node information
|
|
||||||
node.assetId = response.asset_id;
|
|
||||||
node.assetTagCode = response.asset_tag_number;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log("Error during API call", error);
|
|
||||||
});
|
|
||||||
}catch(e){
|
|
||||||
console.log("Error saving assetID and tagnumber", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Main UI -->
|
<!-- Main UI Template -->
|
||||||
<script type="text/html" data-template-name="monster">
|
<script type="text/html" data-template-name="monster">
|
||||||
|
|
||||||
<!-------------------------------------------INPUT NAME / TYPE ----------------------------------------------->
|
<!-- specific input -->
|
||||||
<!-- Node Name -->
|
<h3>Sampling constraints</h3>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
||||||
<input type="text" id="node-input-name" placeholder="Measurement Name">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Sampling Time -->
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-samplingtime"><i class="fa fa-clock-o"></i> Sampling Time (hours)</label>
|
<label for="node-input-samplingtime"><i class="fa fa-clock-o"></i> Sampling time (h)</label>
|
||||||
<input type="number" id="node-input-samplingtime" placeholder="Enter sampling time in hours" min="0" required>
|
<input type="number" id="node-input-samplingtime" style="width:60%;" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Minimum Volume -->
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-minvolume"><i class="fa fa-tint"></i> Minimum Volume (liters)</label>
|
<label for="node-input-minvolume"><i class="fa fa-clock-o"></i> Min volume (L)</label>
|
||||||
<input type="number" id="node-input-minvolume" placeholder="Enter minimum volume in liters" min="0" required>
|
<input type="number" id="node-input-minvolume" style="width:60%;" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Maximum Weight -->
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-maxweight"><i class="fa fa-balance-scale"></i> Maximum Weight (kg)</label>
|
<label for="node-input-maxweight"><i class="fa fa-clock-o"></i> Max weight (kg)</label>
|
||||||
<input type="number" id="node-input-maxweight" placeholder="Enter maximum weight in kg" min="0" required>
|
<input type="number" id="node-input-maxweight" style="width:60%;" />
|
||||||
</div>
|
</div>
|
||||||
|
<h3>Hydraulic bounds</h3>
|
||||||
<!-- Empty Bucket Weight -->
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-emptyWeightBucket"><i class="fa fa-bucket"></i> Empty Bucket Weight (kg)</label>
|
<label for="node-input-nominalFlowMin"><i class="fa fa-clock-o"></i> Nominal min flow (m3/h)</label>
|
||||||
<input type="number" id="node-input-emptyWeightBucket" placeholder="Enter empty bucket weight in kg" min="0" required>
|
<input type="number" id="node-input-nominalFlowMin" style="width:60%;" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Aquon Sample Name -->
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-aquon_sample_name"><i class="fa fa-flask"></i> Aquon Sample Name</label>
|
<label for="node-input-flowMax"><i class="fa fa-clock-o"></i> Max flow (m3/h)</label>
|
||||||
<input type="text" id="node-input-aquon_sample_name" placeholder="Enter Aquon sample name">
|
<input type="number" id="node-input-flowMax" style="width:60%;" />
|
||||||
|
</div>
|
||||||
|
<h3>Rain scaling</h3>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-maxRainRef"><i class="fa fa-cloud-rain"></i> Max rain reference (mm)</label>
|
||||||
|
<input type="number" id="node-input-maxRainRef" style="width:60%;" />
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-minSampleIntervalSec"><i class="fa fa-hourglass"></i> Min sample interval (s)</label>
|
||||||
|
<input type="number" id="node-input-minSampleIntervalSec" style="width:60%;" />
|
||||||
|
</div>
|
||||||
|
<h3>Bucket</h3>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-emptyWeightBucket"><i class="fa fa-clock-o"></i> Empty weight of bucket (kg)</label>
|
||||||
|
<input type="number" id="node-input-emptyWeightBucket" style="width:60%;" />
|
||||||
|
</div>
|
||||||
|
<h3>Aquon</h3>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-aquon_sample_name"><i class="fa fa-clock-o"></i> Aquon sample name</label>
|
||||||
|
<select id="node-input-aquon_sample_name" style="width:60%;"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Optional Extended Fields: supplier, type, subType, model -->
|
<!-- Asset fields injected here -->
|
||||||
<hr />
|
<div id="asset-fields-placeholder"></div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-supplier"
|
|
||||||
><i class="fa fa-industry"></i> Supplier</label>
|
|
||||||
<select id="node-input-supplier" style="width:60%;">
|
|
||||||
<option value="">(optional)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-subType"
|
|
||||||
><i class="fa fa-puzzle-piece"></i> SubType</label>
|
|
||||||
<select id="node-input-subType" style="width:60%;">
|
|
||||||
<option value="">(optional)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-model"><i class="fa fa-wrench"></i> Model</label>
|
|
||||||
<select id="node-input-model" style="width:60%;">
|
|
||||||
<option value="">(optional)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-unit"><i class="fa fa-balance-scale"></i> Unit</label>
|
|
||||||
<select id="node-input-unit" style="width:60%;"></select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr />
|
<!-- Logger fields injected here -->
|
||||||
|
<div id="logger-fields-placeholder"></div>
|
||||||
|
|
||||||
<!-- loglevel checkbox -->
|
<!-- Position fields injected here -->
|
||||||
<div class="form-row">
|
<div id="position-fields-placeholder"></div>
|
||||||
<label for="node-input-enableLog"
|
|
||||||
><i class="fa fa-cog"></i> Enable Log</label>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
id="node-input-enableLog"
|
|
||||||
style="width:20px; vertical-align:baseline;"
|
|
||||||
/>
|
|
||||||
<span>Enable logging</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-row" id="row-logLevel">
|
|
||||||
<label for="node-input-logLevel"><i class="fa fa-cog"></i> Log Level</label>
|
|
||||||
<select id="node-input-logLevel" style="width:60%;">
|
|
||||||
<option value="info">Info</option>
|
|
||||||
<option value="debug">Debug</option>
|
|
||||||
<option value="warn">Warn</option>
|
|
||||||
<option value="error">Error</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="monster">
|
<script type="text/html" data-help-name="monster">
|
||||||
<p><b>Monster Node</b>: Configures and manages monster measurement data.</p>
|
<p><b>Monster node</b>: Configure a monster asset.</p>
|
||||||
<p>Use this node to configure and manage monster measurement data. The node can be configured to handle various measurement parameters and asset properties.</p>
|
<ul>
|
||||||
<li><b>Supplier:</b> Select a supplier to populate machine options.</li>
|
<li><b>Beta note:</b> values load from specs but remain editable in the editor for testing.</li>
|
||||||
<li><b>SubType:</b> Select a subtype if applicable to further categorize the asset.</li>
|
</ul>
|
||||||
<li><b>Model:</b> Define the specific model for more granular asset configuration.</li>
|
|
||||||
<li><b>Unit:</b> Assign a unit to standardize measurements or operations.</li>
|
|
||||||
<li><b>Sampling Time:</b> Define the sampling time in hours for measurements.</li>
|
|
||||||
<li><b>Minimum Volume:</b> Specify the minimum volume in liters.</li>
|
|
||||||
<li><b>Maximum Weight:</b> Specify the maximum weight in kilograms.</li>
|
|
||||||
<li><b>Empty Bucket Weight:</b> Define the weight of the empty bucket in kilograms.</li>
|
|
||||||
<li><b>Aquon Sample Name:</b> Provide the name for the Aquon sample.</li>
|
|
||||||
<li><b>Enable Log:</b> Enable or disable logging for this node.</li>
|
|
||||||
<li><b>Log Level:</b> Select the log level (Info, Debug, Warn, Error) for logging messages.</li>
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
201
monster.js
201
monster.js
@@ -1,182 +1,35 @@
|
|||||||
module.exports = function (RED) {
|
const nameOfNode = 'monster';
|
||||||
function monster(config) {
|
const nodeClass = require('./src/nodeClass.js');
|
||||||
|
const { MenuManager, configManager } = require('generalFunctions');
|
||||||
|
|
||||||
// create node
|
module.exports = function(RED) {
|
||||||
|
// 1) Register the node type and delegate to your class
|
||||||
|
RED.nodes.registerType(nameOfNode, function(config) {
|
||||||
RED.nodes.createNode(this, config);
|
RED.nodes.createNode(this, config);
|
||||||
|
this.nodeClass = new nodeClass(config, RED, this, nameOfNode);
|
||||||
|
});
|
||||||
|
|
||||||
// call this => node so whenver you want to call a node function type node and the function behind it
|
// 2) Setup the dynamic menu & config endpoints
|
||||||
var node = this;
|
const menuMgr = new MenuManager();
|
||||||
|
const cfgMgr = new configManager();
|
||||||
|
|
||||||
try{
|
// Serve /monster/menu.js
|
||||||
|
RED.httpAdmin.get(`/${nameOfNode}/menu.js`, (req, res) => {
|
||||||
|
try {
|
||||||
// fetch monster object from monster.js
|
const script = menuMgr.createEndpoint(nameOfNode, ['logger', 'position', 'aquon']);
|
||||||
const Monster = require("./dependencies/monster/monster_class");
|
res.type('application/javascript').send(script);
|
||||||
const OutputUtils = require("../generalFunctions/helper/outputUtils");
|
} catch (err) {
|
||||||
|
res.status(500).send(`// Error generating menu: ${err.message}`);
|
||||||
const mConfig={
|
|
||||||
general: {
|
|
||||||
name: config.name,
|
|
||||||
id: node.id,
|
|
||||||
unit: config.unit,
|
|
||||||
logging:{
|
|
||||||
logLevel: config.logLevel,
|
|
||||||
enabled: config.enableLog,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
asset: {
|
|
||||||
supplier: config.supplier,
|
|
||||||
subType: config.subType,
|
|
||||||
model: config.model,
|
|
||||||
emptyWeightBucket: config.emptyWeightBucket,
|
|
||||||
},
|
|
||||||
constraints: {
|
|
||||||
minVolume: config.minVolume,
|
|
||||||
maxWeight: config.maxWeight,
|
|
||||||
samplingtime: config.samplingtime,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// make new monster on creation to work with.
|
// Serve /monster/configData.js
|
||||||
const m = new Monster(mConfig);
|
RED.httpAdmin.get(`/${nameOfNode}/configData.js`, (req, res) => {
|
||||||
|
try {
|
||||||
// put m on node memory as source
|
const script = cfgMgr.createEndpoint(nameOfNode);
|
||||||
node.source = m;
|
res.type('application/javascript').send(script);
|
||||||
|
} catch (err) {
|
||||||
//load output utils
|
res.status(500).send(`// Error generating configData: ${err.message}`);
|
||||||
const output = new OutputUtils();
|
|
||||||
|
|
||||||
//internal vars
|
|
||||||
this.interval_id = null;
|
|
||||||
|
|
||||||
//updating node state
|
|
||||||
function updateNodeStatus() {
|
|
||||||
try{
|
|
||||||
|
|
||||||
const bucketVol = m.bucketVol;
|
|
||||||
const maxVolume = m.maxVolume;
|
|
||||||
const state = m.running;
|
|
||||||
const mode = "AI" ; //m.mode;
|
|
||||||
|
|
||||||
let status;
|
|
||||||
|
|
||||||
switch (state) {
|
|
||||||
case false:
|
|
||||||
status = { fill: "red", shape: "dot", text: `${mode}: OFF` };
|
|
||||||
break;
|
|
||||||
case true:
|
|
||||||
status = { fill: "green", shape: "dot", text: `${mode}: ON => ${bucketVol} | ${maxVolume}` };
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
} catch (error) {
|
|
||||||
node.error("Error in updateNodeStatus: " + error);
|
|
||||||
return { fill: "red", shape: "ring", text: "Status Error" };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
function tick(){
|
|
||||||
try{
|
|
||||||
// load status node
|
|
||||||
const status = updateNodeStatus();
|
|
||||||
// kick time based function in node
|
|
||||||
m.tick();
|
|
||||||
//show node status
|
|
||||||
node.status(status);
|
|
||||||
} catch (error) {
|
|
||||||
node.error("Error in tick function: " + error);
|
|
||||||
node.status({ fill: "red", shape: "ring", text: "Tick Error" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// register child on first output this timeout is needed because of node - red stuff
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
|
|
||||||
/*---execute code on first start----*/
|
|
||||||
let msgs = [];
|
|
||||||
|
|
||||||
msgs[2] = { topic : "registerChild" , payload: node.id, positionVsParent: "upstream" };
|
|
||||||
msgs[3] = { topic : "registerChild" , payload: node.id, positionVsParent: "downstream" };
|
|
||||||
|
|
||||||
//send msg
|
|
||||||
this.send(msgs);
|
|
||||||
},
|
|
||||||
100
|
|
||||||
);
|
|
||||||
|
|
||||||
//declare refresh interval internal node
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
/*---execute code on first start----*/
|
|
||||||
this.interval_id = setInterval(function(){ tick() },1000)
|
|
||||||
},
|
|
||||||
1000
|
|
||||||
);
|
|
||||||
|
|
||||||
node.on('input', function (msg,send,done) {
|
|
||||||
try{
|
|
||||||
switch(msg.topic) {
|
|
||||||
case 'registerChild':
|
|
||||||
const childId = msg.payload;
|
|
||||||
const childObj = RED.nodes.getNode(childId);
|
|
||||||
m.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
|
|
||||||
break;
|
|
||||||
case 'setMode':
|
|
||||||
m.setMode(msg.payload);
|
|
||||||
break;
|
|
||||||
case 'start':
|
|
||||||
m.i_start = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
node.error("Error in input function: " + error);
|
|
||||||
node.status({ fill: "red", shape: "ring", text: "Input Error" });
|
|
||||||
}
|
|
||||||
|
|
||||||
if(msg.topic == "i_flow"){
|
|
||||||
monster.q = parseFloat(msg.payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(msg.topic == "i_start"){
|
|
||||||
monster.i_start = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(msg.topic == "model_prediction"){
|
|
||||||
let var1 = msg.payload.dagvoorheen;
|
|
||||||
let var2 = msg.payload.dagnadien;
|
|
||||||
monster.get_model_prediction(var1, var2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(msg.topic == "aquon_monsternametijden"){
|
|
||||||
monster.monsternametijden = msg.payload;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(msg.topic == "rain_data"){
|
|
||||||
monster.rain_data = msg.payload;
|
|
||||||
}
|
|
||||||
|
|
||||||
//register child classes
|
|
||||||
if(msg.topic == "registerChild"){
|
|
||||||
let child = msg.payload;
|
|
||||||
monster.registerChild(child);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
// tidy up any async code here - shutdown connections and so on.
|
|
||||||
node.on('close', function() {
|
|
||||||
clearTimeout(this.interval_id);
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
node.error("Error in monster function: " + error);
|
|
||||||
node.status({ fill: "red", shape: "ring", text: "Monster Error" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RED.nodes.registerType("monster", monster);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "Control module Monsternamekast",
|
"description": "Control module Monsternamekast",
|
||||||
"main": "monster.js",
|
"main": "monster.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node monster.js"
|
"test": "node --test test/basic/*.test.js test/integration/*.test.js test/edge/*.test.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
284
src/nodeClass.js
Normal file
284
src/nodeClass.js
Normal file
@@ -0,0 +1,284 @@
|
|||||||
|
/**
|
||||||
|
* node class.js
|
||||||
|
*
|
||||||
|
* Encapsulates all node logic in a reusable class. In future updates we can split this into multiple generic classes and use the config to specifiy which ones to use.
|
||||||
|
* This allows us to keep the Node-RED node clean and focused on wiring up the UI and event handlers.
|
||||||
|
*/
|
||||||
|
const { outputUtils, configManager, convert } = require('generalFunctions');
|
||||||
|
const Specific = require("./specificClass");
|
||||||
|
|
||||||
|
class nodeClass {
|
||||||
|
/**
|
||||||
|
* Create a Node.
|
||||||
|
* @param {object} uiConfig - Node-RED node configuration.
|
||||||
|
* @param {object} RED - Node-RED runtime API.
|
||||||
|
*/
|
||||||
|
constructor(uiConfig, RED, nodeInstance, nameOfNode) {
|
||||||
|
|
||||||
|
// Preserve RED reference for HTTP endpoints if needed
|
||||||
|
this.node = nodeInstance; // This is the Node-RED node instance, we can use this to send messages and update status
|
||||||
|
this.RED = RED; // This is the Node-RED runtime API, we can use this to create endpoints if needed
|
||||||
|
this.name = nameOfNode; // This is the name of the node, it should match the file name and the node type in Node-RED
|
||||||
|
this.source = null; // Will hold the specific class instance
|
||||||
|
this.config = null; // Will hold the merged configuration
|
||||||
|
|
||||||
|
// Load default & UI config
|
||||||
|
this._loadConfig(uiConfig,this.node);
|
||||||
|
|
||||||
|
// Instantiate core class
|
||||||
|
this._setupSpecificClass(uiConfig);
|
||||||
|
|
||||||
|
// Wire up event and lifecycle handlers
|
||||||
|
this._bindEvents();
|
||||||
|
this._registerChild();
|
||||||
|
this._startTickLoop();
|
||||||
|
this._attachInputHandler();
|
||||||
|
this._attachCloseHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load and merge default config with user-defined settings.
|
||||||
|
* @param {object} uiConfig - Raw config from Node-RED UI.
|
||||||
|
*/
|
||||||
|
_loadConfig(uiConfig,node) {
|
||||||
|
const cfgMgr = new configManager();
|
||||||
|
this.defaultConfig = cfgMgr.getConfig(this.name);
|
||||||
|
|
||||||
|
// Merge UI config over defaults
|
||||||
|
this.config = {
|
||||||
|
general: {
|
||||||
|
name: uiConfig.name || uiConfig.category || this.name,
|
||||||
|
id: node.id, // node.id is for the child registration process
|
||||||
|
unit: uiConfig.unit, // add converter options later to convert to default units (need like a model that defines this which units we are going to use and then conver to those standards)
|
||||||
|
logging: {
|
||||||
|
enabled: uiConfig.enableLog,
|
||||||
|
logLevel: uiConfig.logLevel
|
||||||
|
}
|
||||||
|
},
|
||||||
|
asset: {
|
||||||
|
uuid: uiConfig.uuid,
|
||||||
|
tagCode: uiConfig.assetTagCode,
|
||||||
|
supplier: uiConfig.supplier,
|
||||||
|
category: uiConfig.category, //add later to define as the software type
|
||||||
|
type: uiConfig.assetType,
|
||||||
|
model: uiConfig.model,
|
||||||
|
unit: uiConfig.unit,
|
||||||
|
emptyWeightBucket: Number(uiConfig.emptyWeightBucket)
|
||||||
|
},
|
||||||
|
constraints: {
|
||||||
|
samplingtime: Number(uiConfig.samplingtime),
|
||||||
|
minVolume: Number(uiConfig.minvolume),
|
||||||
|
maxWeight: Number(uiConfig.maxweight),
|
||||||
|
nominalFlowMin: Number(uiConfig.nominalFlowMin),
|
||||||
|
flowMax: Number(uiConfig.flowMax),
|
||||||
|
maxRainRef: Number(uiConfig.maxRainRef),
|
||||||
|
minSampleIntervalSec: Number(uiConfig.minSampleIntervalSec),
|
||||||
|
},
|
||||||
|
functionality: {
|
||||||
|
positionVsParent: uiConfig.positionVsParent || 'atEquipment',
|
||||||
|
distance: uiConfig.hasDistance ? uiConfig.distance : undefined
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Utility for formatting outputs
|
||||||
|
this._output = new outputUtils();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate the core Measurement logic and store as source.
|
||||||
|
*/
|
||||||
|
_setupSpecificClass(uiConfig) {
|
||||||
|
const monsterConfig = this.config;
|
||||||
|
|
||||||
|
this.source = new Specific(monsterConfig);
|
||||||
|
|
||||||
|
if (uiConfig?.aquon_sample_name) {
|
||||||
|
this.source.aquonSampleName = uiConfig.aquon_sample_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//store in node
|
||||||
|
this.node.source = this.source; // Store the source in the node instance for easy access
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events to Node-RED status updates. Using internal emitter. --> REMOVE LATER WE NEED ONLY COMPLETE CHILDS AND THEN CHECK FOR UPDATES
|
||||||
|
*/
|
||||||
|
_bindEvents() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateNodeStatus() {
|
||||||
|
const m = this.source;
|
||||||
|
try{
|
||||||
|
const bucketVol = m.bucketVol;
|
||||||
|
const maxVolume = m.maxVolume;
|
||||||
|
const state = m.running;
|
||||||
|
const mode = "AI"; //m.mode;
|
||||||
|
const flowMin = m.nominalFlowMin;
|
||||||
|
const flowMax = m.flowMax;
|
||||||
|
|
||||||
|
if (m.invalidFlowBounds) {
|
||||||
|
return {
|
||||||
|
fill: "red",
|
||||||
|
shape: "ring",
|
||||||
|
text: `Config error: nominalFlowMin (${flowMin}) >= flowMax (${flowMax})`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
const levelText = `${bucketVol}/${maxVolume} L`;
|
||||||
|
const cooldownMs = typeof m.getSampleCooldownMs === 'function'
|
||||||
|
? m.getSampleCooldownMs()
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
if (cooldownMs > 0) {
|
||||||
|
const cooldownSec = Math.ceil(cooldownMs / 1000);
|
||||||
|
return { fill: "yellow", shape: "ring", text: `SAMPLING (${cooldownSec}s) ${levelText}` };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { fill: "green", shape: "dot", text: `${mode}: RUNNING ${levelText}` };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { fill: "grey", shape: "ring", text: `${mode}: IDLE` };
|
||||||
|
} catch (error) {
|
||||||
|
this.node.error("Error in updateNodeStatus: " + error);
|
||||||
|
return { fill: "red", shape: "ring", text: "Status Error" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Register this node as a child upstream and downstream.
|
||||||
|
* Delayed to avoid Node-RED startup race conditions.
|
||||||
|
*/
|
||||||
|
_registerChild() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.node.send([
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ topic: 'registerChild', payload: this.config.general.id, positionVsParent: this.config?.functionality?.positionVsParent || 'atEquipment' },
|
||||||
|
]);
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the periodic tick loop.
|
||||||
|
*/
|
||||||
|
_startTickLoop() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this._tickInterval = setInterval(() => this._tick(), 1000);
|
||||||
|
|
||||||
|
// Update node status on nodered screen every second ( this is not the best way to do this, but it works for now)
|
||||||
|
this._statusInterval = setInterval(() => {
|
||||||
|
const status = this._updateNodeStatus();
|
||||||
|
this.node.status(status);
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a single tick: update measurement, format and send outputs.
|
||||||
|
*/
|
||||||
|
_tick() {
|
||||||
|
this.source.tick();
|
||||||
|
|
||||||
|
const raw = this.source.getOutput();
|
||||||
|
const processMsg = this._output.formatMsg(raw, this.source.config, 'process');
|
||||||
|
const influxMsg = this._output.formatMsg(raw, this.source.config, 'influxdb');
|
||||||
|
|
||||||
|
// Send only updated outputs on ports 0 & 1
|
||||||
|
this.node.send([processMsg, influxMsg]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attach the node's input handler, routing control messages to the class.
|
||||||
|
*/
|
||||||
|
_attachInputHandler() {
|
||||||
|
this.node.on('input', (msg, send, done) => {
|
||||||
|
/* Update to complete event based node by putting the tick function after an input event */
|
||||||
|
const m = this.source;
|
||||||
|
try {
|
||||||
|
switch(msg.topic) {
|
||||||
|
case 'input_q': {
|
||||||
|
const value = Number(msg.payload?.value);
|
||||||
|
const unit = msg.payload?.unit;
|
||||||
|
if (!Number.isFinite(value) || !unit) {
|
||||||
|
this.node.warn('input_q payload must include numeric value and unit.');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let converted = value;
|
||||||
|
try {
|
||||||
|
converted = convert(value).from(unit).to('m3/h');
|
||||||
|
} catch (error) {
|
||||||
|
this.node.warn(`input_q unit conversion failed: ${error.message}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m.handleInput('input_q', { value: converted, unit: 'm3/h' });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'i_start':
|
||||||
|
case 'monsternametijden':
|
||||||
|
case 'rain_data':
|
||||||
|
m.handleInput(msg.topic, msg.payload);
|
||||||
|
break;
|
||||||
|
case 'registerChild': {
|
||||||
|
const childId = msg.payload;
|
||||||
|
const childObj = this.RED.nodes.getNode(childId);
|
||||||
|
if (childObj?.source) {
|
||||||
|
m.childRegistrationUtils.registerChild(childObj.source, msg.positionVsParent);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'setMode':
|
||||||
|
m.setMode(msg.payload);
|
||||||
|
break;
|
||||||
|
case 'execSequence': {
|
||||||
|
const { source, action, parameter } = msg.payload || {};
|
||||||
|
m.handleInput(source, action, parameter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'execMovement': {
|
||||||
|
const { source: mvSource, action: mvAction, setpoint } = msg.payload || {};
|
||||||
|
m.handleInput(mvSource, mvAction, Number(setpoint));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'flowMovement': {
|
||||||
|
const { source: fmSource, action: fmAction, setpoint: fmSetpoint } = msg.payload || {};
|
||||||
|
m.handleInput(fmSource, fmAction, Number(fmSetpoint));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'emergencystop': {
|
||||||
|
const { source: esSource, action: esAction } = msg.payload || {};
|
||||||
|
m.handleInput(esSource, esAction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'showWorkingCurves':
|
||||||
|
send({ topic : "Showing curve" , payload: m.showWorkingCurves() });
|
||||||
|
break;
|
||||||
|
case 'CoG':
|
||||||
|
send({ topic : "Showing CoG" , payload: m.showCoG() });
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.node.error(`Error handling input (${msg?.topic}): ${error?.message || error}`);
|
||||||
|
} finally {
|
||||||
|
if (typeof done === 'function') done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up timers and intervals when Node-RED stops the node.
|
||||||
|
*/
|
||||||
|
_attachCloseHandler() {
|
||||||
|
this.node.on('close', (done) => {
|
||||||
|
clearInterval(this._tickInterval);
|
||||||
|
clearInterval(this._statusInterval);
|
||||||
|
if (typeof done === 'function') done();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = nodeClass;
|
||||||
888
src/specificClass.js
Normal file
888
src/specificClass.js
Normal file
@@ -0,0 +1,888 @@
|
|||||||
|
|
||||||
|
const EventEmitter = require('events');
|
||||||
|
const {logger,configUtils,configManager, MeasurementContainer, predict, interpolation, childRegistrationUtils} = require('generalFunctions');
|
||||||
|
|
||||||
|
class Monster{
|
||||||
|
/*------------------- Construct and set vars -------------------*/
|
||||||
|
constructor(config={}) {
|
||||||
|
|
||||||
|
//init
|
||||||
|
this.init = false; // keep track of init
|
||||||
|
|
||||||
|
//basic setup
|
||||||
|
this.emitter = new EventEmitter(); // Own EventEmitter
|
||||||
|
|
||||||
|
this.logger = new logger(config.general.logging.enabled,config.general.logging.logLevel, config.general.name);
|
||||||
|
this.configManager = new configManager();
|
||||||
|
this.defaultConfig = this.configManager.getConfig('monster'); // Load default config for rotating machine ( use software type name ? )
|
||||||
|
this.configUtils = new configUtils(this.defaultConfig);
|
||||||
|
this.config = this.configUtils.initConfig(config);
|
||||||
|
|
||||||
|
// -------------------------------------- fetch dependencies --------------------------
|
||||||
|
//this.math = require('mathjs');
|
||||||
|
|
||||||
|
//measurements
|
||||||
|
this.measurements = new MeasurementContainer({
|
||||||
|
autoConvert: true,
|
||||||
|
windowSize: 50,
|
||||||
|
defaultUnits: {
|
||||||
|
flow: 'm3/h',
|
||||||
|
volume: 'm3'
|
||||||
|
}
|
||||||
|
}, this.logger);
|
||||||
|
|
||||||
|
//child registration
|
||||||
|
this.child = {} ; // register childs
|
||||||
|
this.childRegistrationUtils = new childRegistrationUtils(this);
|
||||||
|
|
||||||
|
//Specific object info
|
||||||
|
this.aquonSampleName = "112100" ; // aquon sample name to start automatic sampling on the basis of the document
|
||||||
|
this.monsternametijden = {} ; // json monsternametijden file?
|
||||||
|
this.rain_data = {} ; // precipitation data
|
||||||
|
this.aggregatedOutput = {} ; // object that does not contain momentary values but a combination of all kinds of data over a fixed period of time
|
||||||
|
this.sumRain = 0 ; // total sum of rain over time window + n hours and - n hours
|
||||||
|
this.avgRain = 0 ; // total divided by number of locations to get average over total time
|
||||||
|
this.daysPerYear = 0 ; // how many days remaining for this year
|
||||||
|
this.lastRainUpdate = 0 ; // timestamp of last rain data update
|
||||||
|
this.rainMaxRef = 10 ; // mm reference for scaling linear prediction
|
||||||
|
this.rainStaleMs = 2 * 60 * 60 * 1000; // 2 hours
|
||||||
|
|
||||||
|
// outputs
|
||||||
|
this.pulse = false; // output pulse to sampling machine
|
||||||
|
this.bucketVol = 0; // how full is the sample?
|
||||||
|
this.sumPuls = 0; // number of pulses so far
|
||||||
|
this.predFlow = 0; // predicted flow over sampling time in hours, expressed in m3
|
||||||
|
this.bucketWeight = 0; // actual weight of bucket
|
||||||
|
|
||||||
|
//inputs
|
||||||
|
this.q = 0; // influent flow in m3/h (effective)
|
||||||
|
this.manualFlow = null; // manual flow override value in m3/h
|
||||||
|
this.i_start = false // when true, the program gets kicked off calculating what it needs to take samples
|
||||||
|
this.sampling_time = config.constraints.samplingtime; // time expressed in hours over which the sampling will run (currently 24)
|
||||||
|
this.emptyWeightBucket = config.asset.emptyWeightBucket; // empty weight of the bucket
|
||||||
|
this.nominalFlowMin = config.constraints.nominalFlowMin; // nominal dry-day flow in m3/h
|
||||||
|
this.flowMax = config.constraints.flowMax; // max inflow in m3/h
|
||||||
|
this.minSampleIntervalSec = config.constraints.minSampleIntervalSec || 60; // min seconds between samples
|
||||||
|
|
||||||
|
// internal vars
|
||||||
|
this.temp_pulse = 0; // each interval pulses send out 1 and then reset
|
||||||
|
this.volume_pulse = 0.05; // define volume pulse expressed in L
|
||||||
|
this.minVolume = config.constraints.minVolume;// define min volume in a sampling cabinet before a sample is declared valid expressed in L
|
||||||
|
this.maxVolume = 0; // calculated maxvolume depending on own weight
|
||||||
|
this.maxWeight = config.constraints.maxWeight;// define max volume in a sampling cabinet before a sample is declared invalid expressed in L
|
||||||
|
this.cap_volume = 55; // abs max capacity of bucket (volume) in liters
|
||||||
|
this.targetVolume = 0; // volume of sampling cabinet that model aims for
|
||||||
|
this.minPuls = 0; // calculates the min pulses depending on min_vol and max_vol
|
||||||
|
this.maxPuls = 0; // calculates the max pulses depending on min_vol and max_vol
|
||||||
|
this.absMaxPuls = 0; // capacity of sampling cabinet (number of pulses)
|
||||||
|
this.targetPuls = 0; // keeps track of the desired amount of pulses (+- 50% tolerance), based on aimed volume
|
||||||
|
this.m3PerPuls = 0; // each pulse is equal to a number of m3
|
||||||
|
this.predM3PerSec = 0; // predicted flow in m3 per second
|
||||||
|
this.m3PerTick = 0; // actual measured flow in m3 per second
|
||||||
|
this.m3Total = 0; // total measured flow over sampling time in m3
|
||||||
|
this.running = false; // define if sampling is running or not
|
||||||
|
this.invalidFlowBounds = false; // whether nominalFlowMin/flowMax are invalid
|
||||||
|
this.lastSampleTime = 0; // last sample (pulse) timestamp
|
||||||
|
this.lastSampleWarnTime = 0; // last warning timestamp for cooldown
|
||||||
|
this.missedSamples = 0; // count blocked samples due to cooldown
|
||||||
|
|
||||||
|
this.qLineRaw = {}; // see example
|
||||||
|
this.minSeen = {}; // keeps track of minimum ever seen so far in a time period for each hour (over totals not every value)
|
||||||
|
this.maxSeen = {}; // keeps track of maximum ever seen so far in a time period for each hour (over totals not every value)
|
||||||
|
this.qLineRefined = {}; // this should be the ( quantiles? ) classified in the datasets
|
||||||
|
this.calcTimeShiftDry = 0; // What is the delay after a dry period of minimum n hours
|
||||||
|
this.calcTimeShiftWet = 0;
|
||||||
|
this.calcCapacitySewer = 0;
|
||||||
|
// how much rain goes to the sewage ? -> calculate surface area of hardend / sewage.
|
||||||
|
|
||||||
|
this.minDryHours = 0; // what is the minimum of dry hours before we can calculate timeshift? spot this with moving average?
|
||||||
|
this.minWetHours = 0; // how long does it take to remove all the rain?
|
||||||
|
this.resolution = 0; // Number of chunks in qLineRaw / define how big the window is to sum all values ( for now we need to take 1 hour or bigger resolutions but in the future smaller is better to see more accurate correlations)
|
||||||
|
this.tmpTotQ = 0; // keep track of sum of q within resolution window
|
||||||
|
|
||||||
|
//old prediction factor
|
||||||
|
this.predFactor = 0.7; // define factor as multiplier for prediction
|
||||||
|
|
||||||
|
//track program start and stop
|
||||||
|
this.start_time = Date.now(); // default start time
|
||||||
|
this.stop_time = Date.now(); // default stop time
|
||||||
|
this.flowTime = 0; //keep track in detail how much time between 2 ticks for more accurate flow measurement
|
||||||
|
this.timePassed = 0; // time in seconds
|
||||||
|
this.timeLeft = 0; // time in seconds
|
||||||
|
this.currHour = new Date().getHours(); // on init define in which hour we are 0 - 23
|
||||||
|
|
||||||
|
if (Number.isFinite(config?.constraints?.maxRainRef)) {
|
||||||
|
this.rainMaxRef = config.constraints.maxRainRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.init = true; // end of constructor
|
||||||
|
|
||||||
|
//set boundries and targets after init based on above settings
|
||||||
|
this.set_boundries_and_targets();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------- INPUT HANDLING -------------------*/
|
||||||
|
handleInput(topic, payload) {
|
||||||
|
switch (topic) {
|
||||||
|
case 'i_start':
|
||||||
|
this.i_start = Boolean(payload);
|
||||||
|
break;
|
||||||
|
case 'monsternametijden':
|
||||||
|
this.updateMonsternametijden(payload);
|
||||||
|
break;
|
||||||
|
case 'rain_data':
|
||||||
|
this.updateRainData(payload);
|
||||||
|
break;
|
||||||
|
case 'input_q':
|
||||||
|
this.updateManualFlow(payload);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateMonsternametijden(value) {
|
||||||
|
if (!this.init || !value || Object.keys(value).length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof value[0]?.SAMPLE_NAME !== 'undefined' &&
|
||||||
|
typeof value[0]?.DESCRIPTION !== 'undefined' &&
|
||||||
|
typeof value[0]?.SAMPLED_DATE !== 'undefined' &&
|
||||||
|
typeof value[0]?.START_DATE !== 'undefined' &&
|
||||||
|
typeof value[0]?.END_DATE !== 'undefined'
|
||||||
|
) {
|
||||||
|
this.monsternametijden = value;
|
||||||
|
this.regNextDate(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateRainData(value) {
|
||||||
|
this.rain_data = value;
|
||||||
|
this.lastRainUpdate = Date.now();
|
||||||
|
|
||||||
|
if (this.init && !this.running) {
|
||||||
|
this.updatePredRain(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateBucketVol(val) {
|
||||||
|
this.bucketVol = val;
|
||||||
|
this.bucketWeight = val + this.emptyWeightBucket;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSampleCooldownMs() {
|
||||||
|
if (!this.lastSampleTime) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const remaining = (this.minSampleIntervalSec * 1000) - (Date.now() - this.lastSampleTime);
|
||||||
|
return Math.max(0, remaining);
|
||||||
|
}
|
||||||
|
|
||||||
|
validateFlowBounds() {
|
||||||
|
const min = Number(this.nominalFlowMin);
|
||||||
|
const max = Number(this.flowMax);
|
||||||
|
const valid = Number.isFinite(min) && Number.isFinite(max) && min >= 0 && max > 0 && min < max;
|
||||||
|
this.invalidFlowBounds = !valid;
|
||||||
|
if (!valid) {
|
||||||
|
this.logger.warn(`Invalid flow bounds. nominalFlowMin=${this.nominalFlowMin}, flowMax=${this.flowMax}`);
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
getRainIndex() {
|
||||||
|
if (!this.lastRainUpdate) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (Date.now() - this.lastRainUpdate > this.rainStaleMs) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Number.isFinite(this.avgRain) ? this.avgRain : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPredictedFlowRate() {
|
||||||
|
const min = Number(this.nominalFlowMin);
|
||||||
|
const max = Number(this.flowMax);
|
||||||
|
if (!Number.isFinite(min) || !Number.isFinite(max) || min < 0 || max <= 0 || min >= max) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const rainIndex = this.getRainIndex();
|
||||||
|
const scale = Math.max(0, Math.min(1, this.rainMaxRef > 0 ? rainIndex / this.rainMaxRef : 0));
|
||||||
|
return min + (max - min) * scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateManualFlow(payload = {}) {
|
||||||
|
const value = Number(payload.value);
|
||||||
|
if (!Number.isFinite(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const unit = payload.unit || 'm3/h';
|
||||||
|
this.manualFlow = value;
|
||||||
|
this.measurements
|
||||||
|
.type('flow')
|
||||||
|
.variant('manual')
|
||||||
|
.position('atequipment')
|
||||||
|
.value(value, Date.now(), unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleMeasuredFlow(eventData) {
|
||||||
|
const value = Number(eventData?.value);
|
||||||
|
if (!Number.isFinite(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const position = String(eventData.position || 'atequipment').toLowerCase();
|
||||||
|
const unit = eventData.unit || 'm3/h';
|
||||||
|
this.measurements
|
||||||
|
.type('flow')
|
||||||
|
.variant('measured')
|
||||||
|
.position(position)
|
||||||
|
.value(value, eventData.timestamp || Date.now(), unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMeasuredFlow() {
|
||||||
|
const positions = ['upstream', 'downstream', 'atequipment'];
|
||||||
|
const values = [];
|
||||||
|
|
||||||
|
positions.forEach((position) => {
|
||||||
|
const measured = this.measurements
|
||||||
|
.type('flow')
|
||||||
|
.variant('measured')
|
||||||
|
.position(position)
|
||||||
|
.getCurrentValue();
|
||||||
|
|
||||||
|
if (Number.isFinite(measured)) {
|
||||||
|
values.push(measured);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!values.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sum = values.reduce((total, curr) => total + curr, 0);
|
||||||
|
return sum / values.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
getManualFlow() {
|
||||||
|
const manual = this.measurements
|
||||||
|
.type('flow')
|
||||||
|
.variant('manual')
|
||||||
|
.position('atequipment')
|
||||||
|
.getCurrentValue();
|
||||||
|
|
||||||
|
return Number.isFinite(manual) ? manual : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
getEffectiveFlow() {
|
||||||
|
const measured = this.getMeasuredFlow();
|
||||||
|
const manual = this.getManualFlow();
|
||||||
|
|
||||||
|
if (measured != null && manual != null) {
|
||||||
|
return (measured + manual) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (measured != null) {
|
||||||
|
return measured;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manual != null) {
|
||||||
|
return manual;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
registerChild(child, softwareType) {
|
||||||
|
if (softwareType !== 'measurement' || !child?.measurements?.emitter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const childType = child?.config?.asset?.type;
|
||||||
|
if (childType && childType !== 'flow') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handler = (eventData) => this.handleMeasuredFlow(eventData);
|
||||||
|
child.measurements.emitter.on('flow.measured.upstream', handler);
|
||||||
|
child.measurements.emitter.on('flow.measured.downstream', handler);
|
||||||
|
child.measurements.emitter.on('flow.measured.atequipment', handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
getOutput() {
|
||||||
|
const output = this.measurements.getFlattenedOutput();
|
||||||
|
const flowRate = Number(this.q) || 0;
|
||||||
|
const m3PerPulse = Number(this.m3PerPuls) || 0;
|
||||||
|
const pulseFraction = Number(this.temp_pulse) || 0;
|
||||||
|
const targetVolumeL = Number(this.targetVolume) > 0 ? this.targetVolume : 0;
|
||||||
|
const targetVolumeM3 = targetVolumeL > 0 ? targetVolumeL / 1000 : 0;
|
||||||
|
const flowToNextPulseM3 = m3PerPulse > 0 ? Math.max(0, (1 - pulseFraction) * m3PerPulse) : 0;
|
||||||
|
const timeToNextPulseSec = flowRate > 0 && flowToNextPulseM3 > 0
|
||||||
|
? Math.round((flowToNextPulseM3 / (flowRate / 3600)) * 100) / 100
|
||||||
|
: 0;
|
||||||
|
const targetProgressPct = targetVolumeL > 0
|
||||||
|
? Math.round((this.bucketVol / targetVolumeL) * 10000) / 100
|
||||||
|
: 0;
|
||||||
|
const targetDeltaL = targetVolumeL > 0
|
||||||
|
? Math.round((this.bucketVol - targetVolumeL) * 100) / 100
|
||||||
|
: 0;
|
||||||
|
const targetDeltaM3 = targetVolumeL > 0
|
||||||
|
? Math.round((targetDeltaL / 1000) * 10000) / 10000
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
output.pulse = this.pulse;
|
||||||
|
output.running = this.running;
|
||||||
|
output.bucketVol = this.bucketVol;
|
||||||
|
output.bucketWeight = this.bucketWeight;
|
||||||
|
output.sumPuls = this.sumPuls;
|
||||||
|
output.predFlow = this.predFlow;
|
||||||
|
output.predM3PerSec = this.predM3PerSec;
|
||||||
|
output.timePassed = this.timePassed;
|
||||||
|
output.timeLeft = this.timeLeft;
|
||||||
|
output.m3Total = this.m3Total;
|
||||||
|
output.q = this.q;
|
||||||
|
output.nominalFlowMin = this.nominalFlowMin;
|
||||||
|
output.flowMax = this.flowMax;
|
||||||
|
output.invalidFlowBounds = this.invalidFlowBounds;
|
||||||
|
output.minSampleIntervalSec = this.minSampleIntervalSec;
|
||||||
|
output.missedSamples = this.missedSamples;
|
||||||
|
output.sampleCooldownMs = this.getSampleCooldownMs();
|
||||||
|
output.maxVolume = this.maxVolume;
|
||||||
|
output.minVolume = this.minVolume;
|
||||||
|
output.nextDate = this.nextDate;
|
||||||
|
output.daysPerYear = this.daysPerYear;
|
||||||
|
output.m3PerPuls = this.m3PerPuls;
|
||||||
|
output.m3PerPulse = this.m3PerPuls;
|
||||||
|
output.pulsesRemaining = Math.max(0, (this.targetPuls || 0) - (this.sumPuls || 0));
|
||||||
|
output.pulseFraction = pulseFraction;
|
||||||
|
output.flowToNextPulseM3 = flowToNextPulseM3;
|
||||||
|
output.timeToNextPulseSec = timeToNextPulseSec;
|
||||||
|
output.targetVolumeM3 = targetVolumeM3;
|
||||||
|
output.targetProgressPct = targetProgressPct;
|
||||||
|
output.targetDeltaL = targetDeltaL;
|
||||||
|
output.targetDeltaM3 = targetDeltaM3;
|
||||||
|
output.predictedRateM3h = this.getPredictedFlowRate();
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------- FUNCTIONS -------------------*/
|
||||||
|
|
||||||
|
set_boundries_and_targets(){
|
||||||
|
|
||||||
|
// define boundries for algorithm
|
||||||
|
this.maxVolume = this.maxWeight - this.emptyWeightBucket ; // substract bucket weight of max volume assuming they are both on a 1 to 1 ratio
|
||||||
|
this.minPuls = Math.round(this.minVolume / this.volume_pulse); // minimum pulses we want before we have a valid sample
|
||||||
|
this.maxPuls = Math.round(this.maxVolume / this.volume_pulse); // maximum pulses we can handle (otherwise sample is too heavy)
|
||||||
|
this.absMaxPuls = Math.round(this.cap_volume / this.volume_pulse); // number of pulses a sample can contain before overflowing
|
||||||
|
// define target values
|
||||||
|
this.targetVolume = this.minVolume * Math.sqrt(this.maxVolume / this.minVolume);
|
||||||
|
//old way
|
||||||
|
//this.targetVolume = Math.round( ( ( (this.maxVolume - this.minVolume) / 2 ) + this.minVolume ) * 100) / 100; // calculate middle between min and max
|
||||||
|
// correct target values
|
||||||
|
this.targetPuls = Math.round(this.targetVolume / this.volume_pulse) ; // define desired amount of pulses (in this case our prediction can deviate 50% up and 50% down without a problem)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updatePredRain(value){
|
||||||
|
//make date objects to define relative time window
|
||||||
|
let now = new Date(Date.now());
|
||||||
|
let past = new Date(Date.now());
|
||||||
|
let future = new Date(Date.now());
|
||||||
|
let totalRaw = {};
|
||||||
|
let totalProb = {};
|
||||||
|
let totalAvg = {};
|
||||||
|
|
||||||
|
//refine object with different values
|
||||||
|
let rain = {};
|
||||||
|
rain.hourly = {}; // an object with timestamps and aggreated over all locations summed precipation in mm
|
||||||
|
rain.hourly.time = [];
|
||||||
|
rain.hourly.precipationRaw = [];
|
||||||
|
rain.hourly.precipationProb = [];
|
||||||
|
|
||||||
|
let numberOfLocations = 0;
|
||||||
|
|
||||||
|
//Make timestamp + 24 hours
|
||||||
|
future.setHours(now.getHours() + 24);
|
||||||
|
|
||||||
|
//Make timestamp - 24hours
|
||||||
|
past.setHours(now.getHours() - 24);
|
||||||
|
|
||||||
|
//go through all locations and sum up the average precipation of each location so we have summed precipation over every hour
|
||||||
|
Object.entries(value).forEach(([locationKey, location],locationindex) => {
|
||||||
|
|
||||||
|
//number of locations
|
||||||
|
numberOfLocations++;
|
||||||
|
|
||||||
|
// make an object to keep track of the dataset we load
|
||||||
|
this.aggregatedOutput[locationKey] = {};
|
||||||
|
this.aggregatedOutput[locationKey].tag = {};
|
||||||
|
this.aggregatedOutput[locationKey].tag.latitude = location.latitude;
|
||||||
|
this.aggregatedOutput[locationKey].tag.longitude = location.longitude;
|
||||||
|
this.aggregatedOutput[locationKey].precipationRaw = {};
|
||||||
|
this.aggregatedOutput[locationKey].precipationProb = {};
|
||||||
|
|
||||||
|
|
||||||
|
//loop through object for each location over all hourlys
|
||||||
|
Object.entries(location.hourly.time).forEach(([key, time], index) => {
|
||||||
|
|
||||||
|
this.aggregatedOutput[locationKey].precipationRaw[key] = {};
|
||||||
|
this.aggregatedOutput[locationKey].precipationProb[key] = {};
|
||||||
|
|
||||||
|
//convert string output to a date object
|
||||||
|
let checkdate = new Date(time);
|
||||||
|
|
||||||
|
//convert date to milliseconds timestamps
|
||||||
|
let currTimestamp = checkdate.getTime();
|
||||||
|
let probability = 100; //default probility unless otherwise defined
|
||||||
|
|
||||||
|
if(typeof location.hourly.precipitation_probability !== 'undefined'){
|
||||||
|
probability = location.hourly.precipitation_probability[key];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(probability > 0){
|
||||||
|
probability /= 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only interested in dates before timeframe and after to make use of
|
||||||
|
// ( currTimestamp >= now && currTimestamp < future) || ( currTimestamp < now && currTimestamp > past )
|
||||||
|
if( true ){
|
||||||
|
|
||||||
|
typeof totalRaw[currTimestamp] === 'undefined' ? totalRaw[currTimestamp] = 0 : null;
|
||||||
|
typeof totalProb[currTimestamp] === 'undefined' ? totalProb[currTimestamp] = 0 : null;
|
||||||
|
|
||||||
|
//placed probability into the equation
|
||||||
|
totalRaw[currTimestamp] += location.hourly.precipitation[key] ;
|
||||||
|
totalProb[currTimestamp] += ( location.hourly.precipitation[key] * probability ) ;
|
||||||
|
|
||||||
|
//keep track of all requested data
|
||||||
|
this.aggregatedOutput[locationKey].precipationRaw[key]["val"] = location.hourly.precipitation[key]; // raw data from open weather data
|
||||||
|
this.aggregatedOutput[locationKey].precipationRaw[key]["time"] = currTimestamp;
|
||||||
|
|
||||||
|
this.aggregatedOutput[locationKey].precipationProb[key]["val"] = probability; // probability of open weather
|
||||||
|
this.aggregatedOutput[locationKey].precipationProb[key]["time"] = currTimestamp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove dead info
|
||||||
|
if(Object.keys(this.aggregatedOutput[locationKey].precipationRaw[key]).length == 0 ){
|
||||||
|
delete this.aggregatedOutput[locationKey].precipationRaw[key];
|
||||||
|
};
|
||||||
|
|
||||||
|
if(Object.keys(this.aggregatedOutput[locationKey].precipationProb[key]).length == 0 ){
|
||||||
|
delete this.aggregatedOutput[locationKey].precipationProb[key];
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//total sum expected over time window (just for ref now not so important anymore)
|
||||||
|
this.sumRain = Object.values(totalProb).reduce((sum, value) => sum + value, 0);
|
||||||
|
this.avgRain = this.sumRain / numberOfLocations;
|
||||||
|
|
||||||
|
//make average over prob
|
||||||
|
Object.entries(totalProb).forEach(([key, sum],index) => {
|
||||||
|
typeof totalAvg[key] === 'undefined' ? totalAvg[key] = 0 : null;
|
||||||
|
totalAvg[key] = sum / numberOfLocations;
|
||||||
|
});
|
||||||
|
|
||||||
|
//make new prediction
|
||||||
|
return this.aggregatedOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for getting the day of the year (0-365)
|
||||||
|
getDayOfYear(ts){
|
||||||
|
const start = new Date(ts.getFullYear(), 0, 1);
|
||||||
|
const diff = ts - start;
|
||||||
|
const oneDay = 1000 * 60 * 60 * 24;
|
||||||
|
return Math.floor(diff / oneDay);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
get_model_prediction(){
|
||||||
|
// Linear predictor based on rain index with flow bounds.
|
||||||
|
const samplingHours = Number(this.sampling_time) || 0;
|
||||||
|
const predictedRate = this.getPredictedFlowRate();
|
||||||
|
const fallbackRate = this.getEffectiveFlow();
|
||||||
|
const flowM3PerHour = predictedRate > 0 ? predictedRate : fallbackRate;
|
||||||
|
const fallback = Math.max(0, flowM3PerHour * samplingHours);
|
||||||
|
|
||||||
|
this.predFlow = fallback;
|
||||||
|
return this.predFlow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legacy/experimental model-based prediction (kept for reference; not used by default).
|
||||||
|
get_model_prediction_from_rain(){
|
||||||
|
|
||||||
|
// combine 24 hourly predictions to make one daily prediction (for the next 24 hours including the current hour)
|
||||||
|
let inputs = [];
|
||||||
|
for (let predHour = 0; predHour <= 23; predHour++) {
|
||||||
|
|
||||||
|
// select 48 timestamps based on hour te be predicted
|
||||||
|
let now = new Date();
|
||||||
|
const lastHour = new Date(now.setHours(now.getHours() + predHour));
|
||||||
|
let timestamps = this.rain_data[0].hourly.time.map(ts => new Date(ts));
|
||||||
|
let timestamps_48 = timestamps.filter(ts => ts <= lastHour).slice(-48)
|
||||||
|
|
||||||
|
// for each relevant hour calculate the mean precipitation across all areas
|
||||||
|
let precipitation = [];
|
||||||
|
for (let i = 0; i < timestamps.length; i++) {
|
||||||
|
|
||||||
|
if(timestamps_48.includes(timestamps[i])) {
|
||||||
|
|
||||||
|
let values = [];
|
||||||
|
for (let j = 0; j < this.rain_data.length; j++) {
|
||||||
|
|
||||||
|
values.push(this.rain_data[j].hourly.precipitation[i]);
|
||||||
|
}
|
||||||
|
let mean = values.reduce((sum, value) => sum + value, 0) / this.rain_data.length;
|
||||||
|
precipitation.push(mean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate seasonal variables for model: hour of day, day of week, day of year (last 2 with sin cos transformation)
|
||||||
|
let hour = timestamps_48.map(ts => ts.getHours());
|
||||||
|
let weekdayJS = timestamps_48.map(ts => ts.getDay()); // Javascript weekday
|
||||||
|
let weekdayPY = weekdayJS.map(weekdayJS => (weekdayJS + 6) % 7); // Python weekday
|
||||||
|
let weekdaySin = weekdayPY.map(weekdayPY => Math.sin(2 * Math.PI * weekdayPY / 7));
|
||||||
|
let weekdayCos = weekdayPY.map(weekdayPY => Math.cos(2 * Math.PI * weekdayPY / 7));
|
||||||
|
let dayOfYear = timestamps_48.map(ts => this.getDayOfYear(ts));
|
||||||
|
let dayOfYearSin = dayOfYear.map(day => Math.sin(2 * Math.PI * day / 365));
|
||||||
|
let dayOfYearCos = dayOfYear.map(day => Math.cos(2 * Math.PI * day / 365));
|
||||||
|
|
||||||
|
// standardize variables for prediction and 'zip' them
|
||||||
|
const scaling = [
|
||||||
|
{
|
||||||
|
"hour mean": 11.504046716524947,
|
||||||
|
"weekdaySin mean": -0.00023422353487966347,
|
||||||
|
"weekdayCos mean": 0.0033714029956787715,
|
||||||
|
"dayOfYearSin mean": 0.06748893577363864,
|
||||||
|
"dayOfYearCos mean": -0.02137433139416939,
|
||||||
|
"precipitation mean": 0.0887225073082283
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hour scale": 6.92182769305216,
|
||||||
|
"weekdaySin scale": 0.7073194528907719,
|
||||||
|
"weekdayCos scale": 0.7068859670013796,
|
||||||
|
"dayOfYearSin scale": 0.701099604274817,
|
||||||
|
"dayOfYearCos scale": 0.7095405037003095,
|
||||||
|
"precipitation scale": 0.4505403578968155
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Flow (m3/h) mean": 1178.7800890533754
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Flow (m3/h) scale": 1025.3973622173557
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const means = scaling[0];
|
||||||
|
const scales = scaling[1];
|
||||||
|
|
||||||
|
let features = [hour, weekdaySin, weekdayCos, dayOfYearSin, dayOfYearCos, precipitation];
|
||||||
|
const names = ["hour", "weekdaySin", "weekdayCos", "dayOfYearSin", "dayOfYearCos", "precipitation"]
|
||||||
|
|
||||||
|
features = features.map((arr, i) =>
|
||||||
|
arr.map(value => (value - means[`${names[i]} mean`]) / scales[`${names[i]} scale`]));
|
||||||
|
[hour, weekdaySin, weekdayCos, dayOfYearSin, dayOfYearCos, precipitation] = features;
|
||||||
|
|
||||||
|
const zipped = this.zip(hour, weekdaySin, weekdayCos, dayOfYearSin, dayOfYearCos, precipitation);
|
||||||
|
|
||||||
|
// collect inputdata for model
|
||||||
|
inputs.push(zipped);
|
||||||
|
|
||||||
|
}
|
||||||
|
const output = this.model_loader(inputs);
|
||||||
|
console.log('Final output: ' + output);
|
||||||
|
}
|
||||||
|
|
||||||
|
async model_loader(inputs){
|
||||||
|
|
||||||
|
let dailyPred = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
// Try loading with default input shape*/
|
||||||
|
const path = 'nodes/generalFunctions/datasets/lstmData/tfjs_model/model.json';
|
||||||
|
const model = await this.modelLoader.loadModelPath(path);
|
||||||
|
console.log('Model loaded successfully!');
|
||||||
|
|
||||||
|
// make predictions
|
||||||
|
for (const input of inputs) {
|
||||||
|
|
||||||
|
const inputTensor = tf.tensor3d([input]);
|
||||||
|
const predict = model.predict(inputTensor);
|
||||||
|
let predictValue = await predict.data();
|
||||||
|
|
||||||
|
// back-transformation because of standardization of the response variable
|
||||||
|
predictValue = predictValue[0] * 1024.1940942 + 1188.0105115;
|
||||||
|
dailyPred += predictValue;
|
||||||
|
}
|
||||||
|
console.log('Daily prediction: ' + dailyPred);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load model:', error);
|
||||||
|
}
|
||||||
|
return dailyPred;
|
||||||
|
}
|
||||||
|
|
||||||
|
sampling_program(){
|
||||||
|
|
||||||
|
// ------------------ Run once on conditions and start sampling
|
||||||
|
if( ( (this.i_start ) || ( Date.now() >= this.nextDate ) ) && !this.running ){
|
||||||
|
|
||||||
|
if (!this.validateFlowBounds()) {
|
||||||
|
this.running = false;
|
||||||
|
this.i_start = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.running = true;
|
||||||
|
|
||||||
|
// reset persistent vars
|
||||||
|
this.temp_pulse = 0;
|
||||||
|
this.pulse = false;
|
||||||
|
this.updateBucketVol(0);
|
||||||
|
this.sumPuls = 0;
|
||||||
|
this.m3Total = 0;
|
||||||
|
this.timePassed = 0; // time in seconds
|
||||||
|
this.timeLeft = 0; // time in seconds
|
||||||
|
this.predM3PerSec = 0;
|
||||||
|
|
||||||
|
//run prediction to ensure its value is filled
|
||||||
|
this.get_model_prediction();
|
||||||
|
|
||||||
|
// define m3 per pulse for this run and round to int !
|
||||||
|
this.m3PerPuls = Math.round(this.predFlow / this.targetPuls);
|
||||||
|
this.predM3PerSec = this.predFlow / this.sampling_time / 60 / 60; // predicted m3 per time
|
||||||
|
|
||||||
|
// define start and stop time based on calender data
|
||||||
|
this.start_time = Date.now();
|
||||||
|
this.stop_time = Date.now() + (this.sampling_time * 60 * 60 * 1000); // convert to milliseconds
|
||||||
|
|
||||||
|
//reset parameters and look for next date
|
||||||
|
this.regNextDate(this.monsternametijden);
|
||||||
|
|
||||||
|
// reset start
|
||||||
|
this.i_start = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------ Run for as long as sampling time is not greater than stop time
|
||||||
|
if(this.stop_time > Date.now()){
|
||||||
|
|
||||||
|
// define time vars
|
||||||
|
this.timePassed = Math.round( ( Date.now() - this.start_time ) / 1000);
|
||||||
|
this.timeLeft = Math.round( ( this.stop_time - Date.now() ) / 1000);
|
||||||
|
|
||||||
|
// calc temp pulse rate
|
||||||
|
let update = this.m3PerTick / this.m3PerPuls;
|
||||||
|
|
||||||
|
// update values
|
||||||
|
this.temp_pulse += update;
|
||||||
|
this.m3Total += this.m3PerTick;
|
||||||
|
|
||||||
|
// check if we need to send out a pulse (stop sending pulses if capacity is reached)
|
||||||
|
if(this.temp_pulse >= 1 && this.sumPuls < this.absMaxPuls){
|
||||||
|
const now = Date.now();
|
||||||
|
const cooldownMs = this.minSampleIntervalSec * 1000;
|
||||||
|
const blocked = this.lastSampleTime && (now - this.lastSampleTime) < cooldownMs;
|
||||||
|
|
||||||
|
if (blocked) {
|
||||||
|
this.missedSamples++;
|
||||||
|
this.pulse = false;
|
||||||
|
this.temp_pulse = Math.min(this.temp_pulse, 1);
|
||||||
|
|
||||||
|
if (!this.lastSampleWarnTime || (now - this.lastSampleWarnTime) > cooldownMs) {
|
||||||
|
this.lastSampleWarnTime = now;
|
||||||
|
this.logger.warn(`Sampling too fast. Cooldown active for ${Math.ceil((cooldownMs - (now - this.lastSampleTime)) / 1000)}s.`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// reset
|
||||||
|
this.temp_pulse += -1;
|
||||||
|
// send out a pulse and add to count
|
||||||
|
this.pulse = true;
|
||||||
|
this.lastSampleTime = now;
|
||||||
|
// count pulses
|
||||||
|
this.sumPuls++;
|
||||||
|
// update bucket volume each pulse
|
||||||
|
this.updateBucketVol(Math.round(this.sumPuls * this.volume_pulse * 100) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
if( this.sumPuls > this.absMaxPuls){
|
||||||
|
|
||||||
|
// find out how to reschedule sample automatically?
|
||||||
|
}
|
||||||
|
|
||||||
|
//update pulse when its true
|
||||||
|
if(this.pulse){
|
||||||
|
this.pulse = false; // continue but don't send out a pulse
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//after setting once dont do it again
|
||||||
|
if(this.running){
|
||||||
|
// Vars can only be 0 if this is not running
|
||||||
|
this.m3PerPuls = 0;
|
||||||
|
this.temp_pulse = 0;
|
||||||
|
this.pulse = false;
|
||||||
|
this.updateBucketVol(0);
|
||||||
|
this.sumPuls = 0;
|
||||||
|
this.timePassed = 0; // time in seconds
|
||||||
|
this.timeLeft = 0; // time in seconds
|
||||||
|
this.predFlow = 0;
|
||||||
|
this.predM3PerSec = 0;
|
||||||
|
this.m3Total = 0;
|
||||||
|
this.running = false; // end of sampling program (stop_time reached)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flowCalc(){
|
||||||
|
//reset timePassed
|
||||||
|
let timePassed = 0;
|
||||||
|
|
||||||
|
// each tick calc flowtimepassed
|
||||||
|
this.flowTime > 0 ? timePassed = ( Date.now() - this.flowTime) / 1000 : timePassed = 0 ;
|
||||||
|
|
||||||
|
//conver to m3 per tick
|
||||||
|
this.m3PerTick = this.q / 60 / 60 * timePassed ;
|
||||||
|
|
||||||
|
// put new timestamp
|
||||||
|
this.flowTime = Date.now();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//goes through time related functions
|
||||||
|
tick(){
|
||||||
|
|
||||||
|
// ------------------ 1.0 Main program loop ------------------
|
||||||
|
this.logger.debug('Monster tick running');
|
||||||
|
|
||||||
|
//resolve effective flow in m3/h
|
||||||
|
this.q = this.getEffectiveFlow();
|
||||||
|
|
||||||
|
//calculate flow based on input
|
||||||
|
this.flowCalc();
|
||||||
|
|
||||||
|
//run sampling program
|
||||||
|
this.sampling_program();
|
||||||
|
|
||||||
|
//logQ for predictions / forecasts
|
||||||
|
this.logQoverTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
regNextDate(monsternametijden){
|
||||||
|
|
||||||
|
let next_date = new Date(new Date().setFullYear(new Date().getFullYear() + 1));
|
||||||
|
let n_days_remaining = 0;
|
||||||
|
|
||||||
|
if(typeof monsternametijden !== 'undefined'){
|
||||||
|
// loop through lines
|
||||||
|
Object.entries(monsternametijden).forEach(([key, line],index) => {
|
||||||
|
|
||||||
|
//console.log(line.START_DATE);
|
||||||
|
//check if date is not null
|
||||||
|
if(line.START_DATE != "NULL"){
|
||||||
|
let curr_date_conv = new Date(line.START_DATE);
|
||||||
|
let curr_date = curr_date_conv.getTime();
|
||||||
|
|
||||||
|
//check if sample name is this sample and if date is bigger than now.
|
||||||
|
if(line.SAMPLE_NAME == this.aquonSampleName && curr_date > Date.now() ){
|
||||||
|
|
||||||
|
//only keep date that is bigger than current but smaller than the ones that follow after it.
|
||||||
|
if(curr_date < next_date){ next_date = curr_date; }
|
||||||
|
|
||||||
|
// check if its within this year only show those days as days remaining
|
||||||
|
if( new Date().getFullYear() == curr_date_conv.getFullYear() ){ n_days_remaining++; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//this.warning.push(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
//store vars remaining
|
||||||
|
this.daysPerYear = n_days_remaining;
|
||||||
|
this.nextDate = next_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
logQoverTime(){
|
||||||
|
|
||||||
|
//store currHour in temp obj for easy ref
|
||||||
|
let h = this.currHour;
|
||||||
|
|
||||||
|
// define rain hour of which the correlation is the biggest this doesnt belong in this section do this afterwards
|
||||||
|
// let rainH = h - this.calcTimeShift ;
|
||||||
|
|
||||||
|
// how much rain fell on rainH (define category)
|
||||||
|
|
||||||
|
// fetch current hour from actual time
|
||||||
|
const currentHour = new Date().getHours();
|
||||||
|
|
||||||
|
//on hour change begin log
|
||||||
|
if(h !== currentHour ){
|
||||||
|
|
||||||
|
//write current total to object
|
||||||
|
this.qLineRaw.h = this.tmpTotQ
|
||||||
|
|
||||||
|
//reset tmpTotQ
|
||||||
|
|
||||||
|
//set this.currHour to currentHour
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//create objects where to push arrays in to keep track of data
|
||||||
|
createMinMaxSeen(){
|
||||||
|
//check which hour it is , then make sum , after sum is complete check which hour it is
|
||||||
|
//loop over sampling time expressed in hours
|
||||||
|
for(let h = 1; h < this.sampling_time ; h++){
|
||||||
|
this.minSeen = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // end of class
|
||||||
|
|
||||||
|
module.exports = Monster;
|
||||||
|
|
||||||
|
|
||||||
|
const mConfig={
|
||||||
|
general: {
|
||||||
|
name: "Monster",
|
||||||
|
logging:{
|
||||||
|
logLevel: "debug",
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
asset: {
|
||||||
|
emptyWeightBucket: 3,
|
||||||
|
},
|
||||||
|
constraints: {
|
||||||
|
minVolume: 4,
|
||||||
|
maxWeight: 23,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
const monster = new Monster(mConfig);
|
||||||
|
(async () => {
|
||||||
|
const intervalId = setInterval(() => {
|
||||||
|
monster.tick();
|
||||||
|
}, 1000);
|
||||||
|
})();
|
||||||
|
}
|
||||||
12
test/README.md
Normal file
12
test/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# monster Test Suite Layout
|
||||||
|
|
||||||
|
Required EVOLV layout:
|
||||||
|
- basic/
|
||||||
|
- integration/
|
||||||
|
- edge/
|
||||||
|
- helpers/
|
||||||
|
|
||||||
|
Baseline structure tests:
|
||||||
|
- basic/structure-module-load.basic.test.js
|
||||||
|
- integration/structure-examples.integration.test.js
|
||||||
|
- edge/structure-examples-node-type.edge.test.js
|
||||||
27
test/basic/constructor.basic.test.js
Normal file
27
test/basic/constructor.basic.test.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
|
||||||
|
const Monster = require('../../src/specificClass');
|
||||||
|
const { makeMonsterConfig } = require('../helpers/factories');
|
||||||
|
|
||||||
|
test('constructor initializes sampling boundaries and target values', () => {
|
||||||
|
const monster = new Monster(makeMonsterConfig());
|
||||||
|
|
||||||
|
assert.equal(monster.maxVolume, 20);
|
||||||
|
assert.equal(monster.minPuls, Math.round(monster.minVolume / monster.volume_pulse));
|
||||||
|
assert.equal(monster.absMaxPuls, Math.round(monster.cap_volume / monster.volume_pulse));
|
||||||
|
assert.ok(monster.targetPuls > 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('output contract contains report tooling fields', () => {
|
||||||
|
const monster = new Monster(makeMonsterConfig());
|
||||||
|
const output = monster.getOutput();
|
||||||
|
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPuls'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPulse'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3Total'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulse'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulsesRemaining'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h'));
|
||||||
|
});
|
||||||
8
test/basic/structure-module-load.basic.test.js
Normal file
8
test/basic/structure-module-load.basic.test.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
|
||||||
|
test('monster module load smoke', () => {
|
||||||
|
assert.doesNotThrow(() => {
|
||||||
|
require('../../monster.js');
|
||||||
|
});
|
||||||
|
});
|
||||||
0
test/edge/.gitkeep
Normal file
0
test/edge/.gitkeep
Normal file
58
test/edge/sampling-guards.edge.test.js
Normal file
58
test/edge/sampling-guards.edge.test.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
|
||||||
|
const Monster = require('../../src/specificClass');
|
||||||
|
const { makeMonsterConfig, withMockedDate } = require('../helpers/factories');
|
||||||
|
|
||||||
|
test('invalid flow bounds prevent sampling start', () => {
|
||||||
|
const monster = new Monster(
|
||||||
|
makeMonsterConfig({
|
||||||
|
constraints: {
|
||||||
|
samplingtime: 1,
|
||||||
|
minVolume: 5,
|
||||||
|
maxWeight: 23,
|
||||||
|
nominalFlowMin: 10,
|
||||||
|
flowMax: 5,
|
||||||
|
minSampleIntervalSec: 60,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
monster.handleInput('i_start', true);
|
||||||
|
monster.sampling_program();
|
||||||
|
|
||||||
|
assert.equal(monster.invalidFlowBounds, true);
|
||||||
|
assert.equal(monster.running, false);
|
||||||
|
assert.equal(monster.i_start, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('cooldown guard blocks pulses when flow implies oversampling', () => {
|
||||||
|
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
|
||||||
|
const monster = new Monster(
|
||||||
|
makeMonsterConfig({
|
||||||
|
constraints: {
|
||||||
|
samplingtime: 1,
|
||||||
|
minVolume: 5,
|
||||||
|
maxWeight: 23,
|
||||||
|
nominalFlowMin: 0,
|
||||||
|
flowMax: 6000,
|
||||||
|
maxRainRef: 10,
|
||||||
|
minSampleIntervalSec: 60,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
monster.handleInput('input_q', { value: 200, unit: 'm3/h' });
|
||||||
|
monster.handleInput('i_start', true);
|
||||||
|
|
||||||
|
for (let i = 0; i < 80; i++) {
|
||||||
|
advance(1000);
|
||||||
|
monster.tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.ok(monster.sumPuls > 0);
|
||||||
|
assert.ok(monster.bucketVol > 0);
|
||||||
|
assert.ok(monster.missedSamples > 0);
|
||||||
|
assert.ok(monster.getSampleCooldownMs() > 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
21
test/edge/structure-examples-node-type.edge.test.js
Normal file
21
test/edge/structure-examples-node-type.edge.test.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
const fs = require('node:fs');
|
||||||
|
const path = require('node:path');
|
||||||
|
|
||||||
|
const dir = path.resolve(__dirname, '../../examples');
|
||||||
|
const exampleFlows = [
|
||||||
|
'basic.flow.json',
|
||||||
|
'integration.flow.json',
|
||||||
|
'edge.flow.json',
|
||||||
|
'monster-dashboard.flow.json',
|
||||||
|
'monster-api-dashboard.flow.json'
|
||||||
|
];
|
||||||
|
|
||||||
|
test('all example flows include node type monster', () => {
|
||||||
|
for (const file of exampleFlows) {
|
||||||
|
const flow = JSON.parse(fs.readFileSync(path.join(dir, file), 'utf8'));
|
||||||
|
const count = flow.filter((n) => n && n.type === 'monster').length;
|
||||||
|
assert.equal(count >= 1, true, file + ' missing monster node');
|
||||||
|
}
|
||||||
|
});
|
||||||
0
test/helpers/.gitkeep
Normal file
0
test/helpers/.gitkeep
Normal file
128
test/helpers/factories.js
Normal file
128
test/helpers/factories.js
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
const fs = require('node:fs');
|
||||||
|
const path = require('node:path');
|
||||||
|
const { MeasurementContainer } = require('generalFunctions');
|
||||||
|
|
||||||
|
function makeMonsterConfig(overrides = {}) {
|
||||||
|
return {
|
||||||
|
general: {
|
||||||
|
name: 'Monster Test',
|
||||||
|
logging: { enabled: false, logLevel: 'error' },
|
||||||
|
},
|
||||||
|
asset: {
|
||||||
|
emptyWeightBucket: 3,
|
||||||
|
},
|
||||||
|
constraints: {
|
||||||
|
samplingtime: 1,
|
||||||
|
minVolume: 5,
|
||||||
|
maxWeight: 23,
|
||||||
|
nominalFlowMin: 1000,
|
||||||
|
flowMax: 6000,
|
||||||
|
maxRainRef: 10,
|
||||||
|
minSampleIntervalSec: 60,
|
||||||
|
},
|
||||||
|
...overrides,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function withMockedDate(iso, fn) {
|
||||||
|
const RealDate = Date;
|
||||||
|
let now = new RealDate(iso).getTime();
|
||||||
|
|
||||||
|
class MockDate extends RealDate {
|
||||||
|
constructor(...args) {
|
||||||
|
if (args.length === 0) {
|
||||||
|
super(now);
|
||||||
|
} else {
|
||||||
|
super(...args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static now() {
|
||||||
|
return now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
global.Date = MockDate;
|
||||||
|
try {
|
||||||
|
return fn({
|
||||||
|
advance(ms) {
|
||||||
|
now += ms;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
global.Date = RealDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseMonsternametijdenCsv(filePath) {
|
||||||
|
const raw = fs.readFileSync(filePath, 'utf8').trim();
|
||||||
|
const lines = raw.split(/\r?\n/);
|
||||||
|
const header = lines.shift();
|
||||||
|
const columns = header.split(',');
|
||||||
|
|
||||||
|
return lines
|
||||||
|
.filter((line) => line && !line.startsWith('-----------'))
|
||||||
|
.map((line) => {
|
||||||
|
const parts = [];
|
||||||
|
let cur = '';
|
||||||
|
let inQ = false;
|
||||||
|
for (let i = 0; i < line.length; i++) {
|
||||||
|
const ch = line[i];
|
||||||
|
if (ch === '"') {
|
||||||
|
inQ = !inQ;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ch === ',' && !inQ) {
|
||||||
|
parts.push(cur);
|
||||||
|
cur = '';
|
||||||
|
} else {
|
||||||
|
cur += ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parts.push(cur);
|
||||||
|
const obj = {};
|
||||||
|
columns.forEach((col, idx) => {
|
||||||
|
obj[col] = parts[idx];
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeFlowMeasurementChild({
|
||||||
|
id = 'flow-child-1',
|
||||||
|
name = 'FlowSensor',
|
||||||
|
positionVsParent = 'downstream',
|
||||||
|
unit = 'm3/h',
|
||||||
|
} = {}) {
|
||||||
|
const measurements = new MeasurementContainer({
|
||||||
|
autoConvert: true,
|
||||||
|
defaultUnits: { flow: 'm3/h' },
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
config: {
|
||||||
|
general: { id, name, unit },
|
||||||
|
functionality: { positionVsParent },
|
||||||
|
asset: { type: 'flow', unit },
|
||||||
|
},
|
||||||
|
measurements,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadRainSeed() {
|
||||||
|
const rainPath = path.join(__dirname, '..', 'seed_data', 'raindataFormat.json');
|
||||||
|
return JSON.parse(fs.readFileSync(rainPath, 'utf8'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadScheduleSeed() {
|
||||||
|
const csvPath = path.join(__dirname, '..', 'seed_data', 'monsternametijden.csv');
|
||||||
|
return parseMonsternametijdenCsv(csvPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
makeMonsterConfig,
|
||||||
|
withMockedDate,
|
||||||
|
makeFlowMeasurementChild,
|
||||||
|
loadRainSeed,
|
||||||
|
loadScheduleSeed,
|
||||||
|
};
|
||||||
0
test/integration/.gitkeep
Normal file
0
test/integration/.gitkeep
Normal file
49
test/integration/flow-and-schedule.integration.test.js
Normal file
49
test/integration/flow-and-schedule.integration.test.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
|
||||||
|
const Monster = require('../../src/specificClass');
|
||||||
|
const {
|
||||||
|
makeMonsterConfig,
|
||||||
|
withMockedDate,
|
||||||
|
makeFlowMeasurementChild,
|
||||||
|
loadRainSeed,
|
||||||
|
loadScheduleSeed,
|
||||||
|
} = require('../helpers/factories');
|
||||||
|
|
||||||
|
test('effective flow uses average of measured and manual flow', () => {
|
||||||
|
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
|
||||||
|
const monster = new Monster(makeMonsterConfig());
|
||||||
|
const child = makeFlowMeasurementChild({ positionVsParent: 'downstream' });
|
||||||
|
monster.registerChild(child, 'measurement');
|
||||||
|
|
||||||
|
child.measurements
|
||||||
|
.type('flow')
|
||||||
|
.variant('measured')
|
||||||
|
.position('downstream')
|
||||||
|
.value(60, Date.now(), 'm3/h');
|
||||||
|
|
||||||
|
monster.handleInput('input_q', { value: 20, unit: 'm3/h' });
|
||||||
|
advance(1000);
|
||||||
|
monster.tick();
|
||||||
|
|
||||||
|
assert.equal(monster.q, 40);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('rain and schedule payloads update prediction context and next date', () => {
|
||||||
|
withMockedDate('2024-10-15T00:00:00Z', () => {
|
||||||
|
const monster = new Monster(makeMonsterConfig());
|
||||||
|
const rain = loadRainSeed();
|
||||||
|
const schedule = loadScheduleSeed();
|
||||||
|
|
||||||
|
monster.aquonSampleName = '112100';
|
||||||
|
monster.handleInput('rain_data', rain);
|
||||||
|
monster.handleInput('monsternametijden', schedule);
|
||||||
|
|
||||||
|
assert.ok(monster.avgRain >= 0);
|
||||||
|
assert.ok(monster.sumRain >= 0);
|
||||||
|
const nextDate = monster.nextDate instanceof Date ? monster.nextDate.getTime() : Number(monster.nextDate);
|
||||||
|
assert.ok(Number.isFinite(nextDate));
|
||||||
|
assert.ok(nextDate > Date.now());
|
||||||
|
});
|
||||||
|
});
|
||||||
32
test/integration/structure-examples.integration.test.js
Normal file
32
test/integration/structure-examples.integration.test.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
const fs = require('node:fs');
|
||||||
|
const path = require('node:path');
|
||||||
|
|
||||||
|
const dir = path.resolve(__dirname, '../../examples');
|
||||||
|
const requiredFiles = [
|
||||||
|
'README.md',
|
||||||
|
'basic.flow.json',
|
||||||
|
'integration.flow.json',
|
||||||
|
'edge.flow.json',
|
||||||
|
'monster-dashboard.flow.json',
|
||||||
|
'monster-api-dashboard.flow.json'
|
||||||
|
];
|
||||||
|
const flowFiles = requiredFiles.filter((file) => file.endsWith('.flow.json'));
|
||||||
|
|
||||||
|
function loadJson(file) {
|
||||||
|
return JSON.parse(fs.readFileSync(path.join(dir, file), 'utf8'));
|
||||||
|
}
|
||||||
|
|
||||||
|
test('examples package exists for monster', () => {
|
||||||
|
for (const file of requiredFiles) {
|
||||||
|
assert.equal(fs.existsSync(path.join(dir, file)), true, file + ' missing');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('example flows are parseable arrays for monster', () => {
|
||||||
|
for (const file of flowFiles) {
|
||||||
|
const parsed = loadJson(file);
|
||||||
|
assert.equal(Array.isArray(parsed), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
257
test/monster.specific.test.js
Normal file
257
test/monster.specific.test.js
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
const assert = require('assert');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const Monster = require('../src/specificClass');
|
||||||
|
const { MeasurementContainer } = require('generalFunctions');
|
||||||
|
|
||||||
|
function test(name, fn) {
|
||||||
|
try {
|
||||||
|
fn();
|
||||||
|
console.log(`ok - ${name}`);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`not ok - ${name}`);
|
||||||
|
console.error(err);
|
||||||
|
process.exitCode = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function withMockedDate(iso, fn) {
|
||||||
|
const RealDate = Date;
|
||||||
|
let now = new RealDate(iso).getTime();
|
||||||
|
|
||||||
|
class MockDate extends RealDate {
|
||||||
|
constructor(...args) {
|
||||||
|
if (args.length === 0) {
|
||||||
|
super(now);
|
||||||
|
} else {
|
||||||
|
super(...args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static now() {
|
||||||
|
return now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
global.Date = MockDate;
|
||||||
|
try {
|
||||||
|
return fn({
|
||||||
|
advance(ms) {
|
||||||
|
now += ms;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
global.Date = RealDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildConfig(overrides = {}) {
|
||||||
|
return {
|
||||||
|
general: {
|
||||||
|
name: 'Monster Test',
|
||||||
|
logging: { enabled: false, logLevel: 'error' }
|
||||||
|
},
|
||||||
|
asset: {
|
||||||
|
emptyWeightBucket: 3
|
||||||
|
},
|
||||||
|
constraints: {
|
||||||
|
samplingtime: 1,
|
||||||
|
minVolume: 5,
|
||||||
|
maxWeight: 23,
|
||||||
|
nominalFlowMin: 1,
|
||||||
|
flowMax: 10
|
||||||
|
},
|
||||||
|
...overrides
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseMonsternametijdenCsv(filePath) {
|
||||||
|
const raw = fs.readFileSync(filePath, 'utf8').trim();
|
||||||
|
const lines = raw.split(/\r?\n/);
|
||||||
|
const header = lines.shift();
|
||||||
|
const columns = header.split(',');
|
||||||
|
|
||||||
|
return lines
|
||||||
|
.filter((line) => line && !line.startsWith('-----------'))
|
||||||
|
.map((line) => {
|
||||||
|
const parts = [];
|
||||||
|
let cur = '';
|
||||||
|
let inQ = false;
|
||||||
|
for (let i = 0; i < line.length; i++) {
|
||||||
|
const ch = line[i];
|
||||||
|
if (ch === '"') {
|
||||||
|
inQ = !inQ;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ch === ',' && !inQ) {
|
||||||
|
parts.push(cur);
|
||||||
|
cur = '';
|
||||||
|
} else {
|
||||||
|
cur += ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parts.push(cur);
|
||||||
|
const obj = {};
|
||||||
|
columns.forEach((col, idx) => {
|
||||||
|
obj[col] = parts[idx];
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
test('measured + manual flow averages into effective flow', () => {
|
||||||
|
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
|
||||||
|
const monster = new Monster(buildConfig());
|
||||||
|
|
||||||
|
const child = {
|
||||||
|
config: {
|
||||||
|
general: { id: 'child-1', name: 'FlowSensor' },
|
||||||
|
asset: { type: 'flow' }
|
||||||
|
},
|
||||||
|
measurements: new MeasurementContainer({
|
||||||
|
autoConvert: true,
|
||||||
|
defaultUnits: { flow: 'm3/h' }
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
monster.registerChild(child, 'measurement');
|
||||||
|
|
||||||
|
child.measurements
|
||||||
|
.type('flow')
|
||||||
|
.variant('measured')
|
||||||
|
.position('downstream')
|
||||||
|
.value(60, Date.now(), 'm3/h');
|
||||||
|
|
||||||
|
monster.handleInput('input_q', { value: 20, unit: 'm3/h' });
|
||||||
|
|
||||||
|
advance(1000);
|
||||||
|
monster.tick();
|
||||||
|
|
||||||
|
assert.strictEqual(monster.q, 40);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('invalid flow bounds prevent sampling start', () => {
|
||||||
|
const monster = new Monster(buildConfig({
|
||||||
|
constraints: {
|
||||||
|
samplingtime: 1,
|
||||||
|
minVolume: 5,
|
||||||
|
maxWeight: 23,
|
||||||
|
nominalFlowMin: 10,
|
||||||
|
flowMax: 5
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
monster.handleInput('i_start', true);
|
||||||
|
monster.sampling_program();
|
||||||
|
|
||||||
|
assert.strictEqual(monster.invalidFlowBounds, true);
|
||||||
|
assert.strictEqual(monster.running, false);
|
||||||
|
assert.strictEqual(monster.i_start, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('flowCalc uses elapsed time to compute m3PerTick', () => {
|
||||||
|
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
|
||||||
|
const monster = new Monster(buildConfig());
|
||||||
|
monster.q = 36; // m3/h
|
||||||
|
|
||||||
|
monster.flowCalc();
|
||||||
|
assert.strictEqual(monster.m3PerTick, 0);
|
||||||
|
|
||||||
|
advance(10000);
|
||||||
|
monster.flowCalc();
|
||||||
|
|
||||||
|
const expected = 0.1; // 36 m3/h -> 0.01 m3/s over 10s
|
||||||
|
assert.ok(Math.abs(monster.m3PerTick - expected) < 1e-6);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('prediction fallback uses nominalFlowMin * sampling_time when rain is stale', () => {
|
||||||
|
const monster = new Monster(buildConfig());
|
||||||
|
monster.nominalFlowMin = 4;
|
||||||
|
monster.flowMax = 10;
|
||||||
|
monster.rainMaxRef = 8;
|
||||||
|
monster.sampling_time = 24;
|
||||||
|
monster.lastRainUpdate = 0;
|
||||||
|
const pred = monster.get_model_prediction();
|
||||||
|
assert.strictEqual(pred, 96);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('pulses increment when running with manual flow and zero nominalFlowMin', () => {
|
||||||
|
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
|
||||||
|
const monster = new Monster(buildConfig({
|
||||||
|
constraints: {
|
||||||
|
samplingtime: 1,
|
||||||
|
minVolume: 5,
|
||||||
|
maxWeight: 23,
|
||||||
|
nominalFlowMin: 0,
|
||||||
|
flowMax: 6000,
|
||||||
|
minSampleIntervalSec: 60,
|
||||||
|
maxRainRef: 10
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
monster.handleInput('input_q', { value: 200, unit: 'm3/h' });
|
||||||
|
monster.handleInput('i_start', true);
|
||||||
|
|
||||||
|
for (let i = 0; i < 80; i++) {
|
||||||
|
advance(1000);
|
||||||
|
monster.tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.ok(monster.sumPuls > 0);
|
||||||
|
assert.ok(monster.bucketVol > 0);
|
||||||
|
assert.ok(monster.missedSamples > 0);
|
||||||
|
assert.ok(monster.getSampleCooldownMs() > 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('rain data aggregation produces totals', () => {
|
||||||
|
const monster = new Monster(buildConfig());
|
||||||
|
const rainPath = path.join(__dirname, 'seed_data', 'raindataFormat.json');
|
||||||
|
const rainData = JSON.parse(fs.readFileSync(rainPath, 'utf8'));
|
||||||
|
|
||||||
|
monster.updateRainData(rainData);
|
||||||
|
|
||||||
|
assert.ok(Object.keys(monster.aggregatedOutput).length > 0);
|
||||||
|
assert.ok(monster.sumRain >= 0);
|
||||||
|
assert.ok(monster.avgRain >= 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('monsternametijden schedule sets next date', () => {
|
||||||
|
withMockedDate('2024-10-15T00:00:00Z', () => {
|
||||||
|
const monster = new Monster(buildConfig());
|
||||||
|
const csvPath = path.join(__dirname, 'seed_data', 'monsternametijden.csv');
|
||||||
|
const rows = parseMonsternametijdenCsv(csvPath);
|
||||||
|
|
||||||
|
monster.aquonSampleName = '112100';
|
||||||
|
monster.updateMonsternametijden(rows);
|
||||||
|
|
||||||
|
const nextDate = monster.nextDate instanceof Date
|
||||||
|
? monster.nextDate.getTime()
|
||||||
|
: Number(monster.nextDate);
|
||||||
|
|
||||||
|
assert.ok(Number.isFinite(nextDate));
|
||||||
|
assert.ok(nextDate > Date.now());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('output includes pulse and flow fields', () => {
|
||||||
|
const monster = new Monster(buildConfig());
|
||||||
|
const output = monster.getOutput();
|
||||||
|
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulse'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'q'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPuls'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPulse'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulsesRemaining'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulseFraction'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'flowToNextPulseM3'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'timeToNextPulseSec'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetVolumeM3'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetProgressPct'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaL'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h'));
|
||||||
|
});
|
||||||
0
test/monster.test.js
Normal file
0
test/monster.test.js
Normal file
9331
test/seed_data/raindataFormat.json
Normal file
9331
test/seed_data/raindataFormat.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user