epyt-flow 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS +28 -0
  2. epyt_flow/EPANET/EPANET/SRC_engines/LICENSE +21 -0
  3. epyt_flow/EPANET/EPANET/SRC_engines/Readme_SRC_Engines.txt +18 -0
  4. epyt_flow/EPANET/EPANET/SRC_engines/enumstxt.h +134 -0
  5. epyt_flow/EPANET/EPANET/SRC_engines/epanet.c +5578 -0
  6. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.c +865 -0
  7. epyt_flow/EPANET/EPANET/SRC_engines/epanet2.def +131 -0
  8. epyt_flow/EPANET/EPANET/SRC_engines/errors.dat +73 -0
  9. epyt_flow/EPANET/EPANET/SRC_engines/funcs.h +193 -0
  10. epyt_flow/EPANET/EPANET/SRC_engines/genmmd.c +1000 -0
  11. epyt_flow/EPANET/EPANET/SRC_engines/hash.c +177 -0
  12. epyt_flow/EPANET/EPANET/SRC_engines/hash.h +28 -0
  13. epyt_flow/EPANET/EPANET/SRC_engines/hydcoeffs.c +1151 -0
  14. epyt_flow/EPANET/EPANET/SRC_engines/hydraul.c +1117 -0
  15. epyt_flow/EPANET/EPANET/SRC_engines/hydsolver.c +720 -0
  16. epyt_flow/EPANET/EPANET/SRC_engines/hydstatus.c +476 -0
  17. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2.h +431 -0
  18. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_2.h +1786 -0
  19. epyt_flow/EPANET/EPANET/SRC_engines/include/epanet2_enums.h +468 -0
  20. epyt_flow/EPANET/EPANET/SRC_engines/inpfile.c +810 -0
  21. epyt_flow/EPANET/EPANET/SRC_engines/input1.c +707 -0
  22. epyt_flow/EPANET/EPANET/SRC_engines/input2.c +864 -0
  23. epyt_flow/EPANET/EPANET/SRC_engines/input3.c +2170 -0
  24. epyt_flow/EPANET/EPANET/SRC_engines/main.c +93 -0
  25. epyt_flow/EPANET/EPANET/SRC_engines/mempool.c +142 -0
  26. epyt_flow/EPANET/EPANET/SRC_engines/mempool.h +24 -0
  27. epyt_flow/EPANET/EPANET/SRC_engines/output.c +852 -0
  28. epyt_flow/EPANET/EPANET/SRC_engines/project.c +1359 -0
  29. epyt_flow/EPANET/EPANET/SRC_engines/quality.c +685 -0
  30. epyt_flow/EPANET/EPANET/SRC_engines/qualreact.c +743 -0
  31. epyt_flow/EPANET/EPANET/SRC_engines/qualroute.c +694 -0
  32. epyt_flow/EPANET/EPANET/SRC_engines/report.c +1489 -0
  33. epyt_flow/EPANET/EPANET/SRC_engines/rules.c +1362 -0
  34. epyt_flow/EPANET/EPANET/SRC_engines/smatrix.c +871 -0
  35. epyt_flow/EPANET/EPANET/SRC_engines/text.h +497 -0
  36. epyt_flow/EPANET/EPANET/SRC_engines/types.h +874 -0
  37. epyt_flow/EPANET/EPANET-MSX/MSX_Updates.txt +53 -0
  38. epyt_flow/EPANET/EPANET-MSX/Src/dispersion.h +27 -0
  39. epyt_flow/EPANET/EPANET-MSX/Src/hash.c +107 -0
  40. epyt_flow/EPANET/EPANET-MSX/Src/hash.h +28 -0
  41. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx.h +102 -0
  42. epyt_flow/EPANET/EPANET-MSX/Src/include/epanetmsx_export.h +42 -0
  43. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.c +937 -0
  44. epyt_flow/EPANET/EPANET-MSX/Src/mathexpr.h +39 -0
  45. epyt_flow/EPANET/EPANET-MSX/Src/mempool.c +204 -0
  46. epyt_flow/EPANET/EPANET-MSX/Src/mempool.h +24 -0
  47. epyt_flow/EPANET/EPANET-MSX/Src/msxchem.c +1285 -0
  48. epyt_flow/EPANET/EPANET-MSX/Src/msxcompiler.c +368 -0
  49. epyt_flow/EPANET/EPANET-MSX/Src/msxdict.h +42 -0
  50. epyt_flow/EPANET/EPANET-MSX/Src/msxdispersion.c +586 -0
  51. epyt_flow/EPANET/EPANET-MSX/Src/msxerr.c +116 -0
  52. epyt_flow/EPANET/EPANET-MSX/Src/msxfile.c +260 -0
  53. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.c +175 -0
  54. epyt_flow/EPANET/EPANET-MSX/Src/msxfuncs.h +35 -0
  55. epyt_flow/EPANET/EPANET-MSX/Src/msxinp.c +1504 -0
  56. epyt_flow/EPANET/EPANET-MSX/Src/msxout.c +401 -0
  57. epyt_flow/EPANET/EPANET-MSX/Src/msxproj.c +791 -0
  58. epyt_flow/EPANET/EPANET-MSX/Src/msxqual.c +2010 -0
  59. epyt_flow/EPANET/EPANET-MSX/Src/msxrpt.c +400 -0
  60. epyt_flow/EPANET/EPANET-MSX/Src/msxtank.c +422 -0
  61. epyt_flow/EPANET/EPANET-MSX/Src/msxtoolkit.c +1164 -0
  62. epyt_flow/EPANET/EPANET-MSX/Src/msxtypes.h +551 -0
  63. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.c +524 -0
  64. epyt_flow/EPANET/EPANET-MSX/Src/msxutils.h +56 -0
  65. epyt_flow/EPANET/EPANET-MSX/Src/newton.c +158 -0
  66. epyt_flow/EPANET/EPANET-MSX/Src/newton.h +34 -0
  67. epyt_flow/EPANET/EPANET-MSX/Src/rk5.c +287 -0
  68. epyt_flow/EPANET/EPANET-MSX/Src/rk5.h +39 -0
  69. epyt_flow/EPANET/EPANET-MSX/Src/ros2.c +293 -0
  70. epyt_flow/EPANET/EPANET-MSX/Src/ros2.h +35 -0
  71. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.c +816 -0
  72. epyt_flow/EPANET/EPANET-MSX/Src/smatrix.h +29 -0
  73. epyt_flow/EPANET/EPANET-MSX/readme.txt +14 -0
  74. epyt_flow/EPANET/compile.sh +4 -0
  75. epyt_flow/VERSION +1 -0
  76. epyt_flow/__init__.py +24 -0
  77. epyt_flow/data/__init__.py +0 -0
  78. epyt_flow/data/benchmarks/__init__.py +11 -0
  79. epyt_flow/data/benchmarks/batadal.py +257 -0
  80. epyt_flow/data/benchmarks/batadal_data.py +28 -0
  81. epyt_flow/data/benchmarks/battledim.py +473 -0
  82. epyt_flow/data/benchmarks/battledim_data.py +51 -0
  83. epyt_flow/data/benchmarks/gecco_water_quality.py +267 -0
  84. epyt_flow/data/benchmarks/leakdb.py +592 -0
  85. epyt_flow/data/benchmarks/leakdb_data.py +18923 -0
  86. epyt_flow/data/benchmarks/water_usage.py +123 -0
  87. epyt_flow/data/networks.py +650 -0
  88. epyt_flow/gym/__init__.py +4 -0
  89. epyt_flow/gym/control_gyms.py +47 -0
  90. epyt_flow/gym/scenario_control_env.py +101 -0
  91. epyt_flow/metrics.py +404 -0
  92. epyt_flow/models/__init__.py +2 -0
  93. epyt_flow/models/event_detector.py +31 -0
  94. epyt_flow/models/sensor_interpolation_detector.py +118 -0
  95. epyt_flow/rest_api/__init__.py +4 -0
  96. epyt_flow/rest_api/base_handler.py +70 -0
  97. epyt_flow/rest_api/res_manager.py +95 -0
  98. epyt_flow/rest_api/scada_data_handler.py +476 -0
  99. epyt_flow/rest_api/scenario_handler.py +352 -0
  100. epyt_flow/rest_api/server.py +106 -0
  101. epyt_flow/serialization.py +438 -0
  102. epyt_flow/simulation/__init__.py +5 -0
  103. epyt_flow/simulation/events/__init__.py +6 -0
  104. epyt_flow/simulation/events/actuator_events.py +259 -0
  105. epyt_flow/simulation/events/event.py +81 -0
  106. epyt_flow/simulation/events/leakages.py +404 -0
  107. epyt_flow/simulation/events/sensor_faults.py +267 -0
  108. epyt_flow/simulation/events/sensor_reading_attack.py +185 -0
  109. epyt_flow/simulation/events/sensor_reading_event.py +170 -0
  110. epyt_flow/simulation/events/system_event.py +88 -0
  111. epyt_flow/simulation/parallel_simulation.py +147 -0
  112. epyt_flow/simulation/scada/__init__.py +3 -0
  113. epyt_flow/simulation/scada/advanced_control.py +134 -0
  114. epyt_flow/simulation/scada/scada_data.py +1589 -0
  115. epyt_flow/simulation/scada/scada_data_export.py +255 -0
  116. epyt_flow/simulation/scenario_config.py +608 -0
  117. epyt_flow/simulation/scenario_simulator.py +1897 -0
  118. epyt_flow/simulation/scenario_visualizer.py +61 -0
  119. epyt_flow/simulation/sensor_config.py +1289 -0
  120. epyt_flow/topology.py +290 -0
  121. epyt_flow/uncertainty/__init__.py +3 -0
  122. epyt_flow/uncertainty/model_uncertainty.py +302 -0
  123. epyt_flow/uncertainty/sensor_noise.py +73 -0
  124. epyt_flow/uncertainty/uncertainties.py +555 -0
  125. epyt_flow/uncertainty/utils.py +206 -0
  126. epyt_flow/utils.py +306 -0
  127. epyt_flow-0.1.0.dist-info/LICENSE +21 -0
  128. epyt_flow-0.1.0.dist-info/METADATA +139 -0
  129. epyt_flow-0.1.0.dist-info/RECORD +131 -0
  130. epyt_flow-0.1.0.dist-info/WHEEL +5 -0
  131. epyt_flow-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,177 @@
1
+ /*
2
+ ******************************************************************************
3
+ Project: OWA EPANET
4
+ Version: 2.2
5
+ Module: hash.c
6
+ Description: implementation of a simple hash table
7
+ Authors: see AUTHORS
8
+ Copyright: see AUTHORS
9
+ License: see LICENSE
10
+ Last Updated: 05/15/2019
11
+ ******************************************************************************
12
+ */
13
+
14
+ #include <stdlib.h>
15
+ #include <string.h>
16
+ #include "hash.h"
17
+
18
+ #define HASHTABLEMAXSIZE 128000
19
+
20
+ // An entry in the hash table
21
+ typedef struct DataEntryStruct
22
+ {
23
+ char *key;
24
+ int data;
25
+ struct DataEntryStruct *next;
26
+ } DataEntry;
27
+
28
+ // Hash a string to an integer
29
+ unsigned int gethash(char *str)
30
+ {
31
+ unsigned int hash = 5381;
32
+ unsigned int retHash;
33
+ int c;
34
+ while ((c = *str++))
35
+ {
36
+ hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
37
+ }
38
+ retHash = hash % HASHTABLEMAXSIZE;
39
+ return retHash;
40
+ }
41
+
42
+ // Produce a duplicate string
43
+ char *dupstr(const char *s)
44
+ {
45
+ size_t size = strlen(s) + 1;
46
+ char *p = malloc(size);
47
+ if (p) memcpy(p, s, size);
48
+ return p;
49
+ }
50
+
51
+ // Create a hash table
52
+ HashTable *hashtable_create()
53
+ {
54
+ int i;
55
+ HashTable *ht = (HashTable *) calloc(HASHTABLEMAXSIZE, sizeof(HashTable));
56
+ if (ht != NULL)
57
+ {
58
+ for (i = 0; i < HASHTABLEMAXSIZE; i++) ht[i] = NULL;
59
+ }
60
+ return ht;
61
+ }
62
+
63
+ // Insert an entry into the hash table
64
+ int hashtable_insert(HashTable *ht, char *key, int data)
65
+ {
66
+ unsigned int i = gethash(key);
67
+ DataEntry *entry;
68
+ if ( i >= HASHTABLEMAXSIZE ) return 0;
69
+ entry = (DataEntry *) malloc(sizeof(DataEntry));
70
+ if (entry == NULL) return(0);
71
+ entry->key = dupstr(key);
72
+ entry->data = data;
73
+ entry->next = ht[i];
74
+ ht[i] = entry;
75
+ return 1;
76
+ }
77
+
78
+ // Change the hash table's data entry for a particular key
79
+ int hashtable_update(HashTable *ht, char *key, int new_data)
80
+ {
81
+ unsigned int i = gethash(key);
82
+ DataEntry *entry;
83
+
84
+ if ( i >= HASHTABLEMAXSIZE ) return NOTFOUND;
85
+ entry = ht[i];
86
+ while (entry != NULL)
87
+ {
88
+ if ( strcmp(entry->key, key) == 0 )
89
+ {
90
+ entry->data = new_data;
91
+ return 1;
92
+ }
93
+ entry = entry->next;
94
+ }
95
+ return NOTFOUND;
96
+ }
97
+
98
+ // Delete an entry in the hash table
99
+ int hashtable_delete(HashTable *ht, char *key)
100
+ {
101
+ unsigned int i = gethash(key);
102
+ DataEntry *entry, *preventry;
103
+
104
+ if ( i >= HASHTABLEMAXSIZE ) return NOTFOUND;
105
+
106
+ preventry = NULL;
107
+ entry = ht[i];
108
+ while (entry != NULL)
109
+ {
110
+ if (strcmp(entry->key, key) == 0)
111
+ {
112
+ if (preventry == NULL) ht[i] = entry->next;
113
+ else preventry->next = entry->next;
114
+ free(entry->key);
115
+ free(entry);
116
+ return 1;
117
+ }
118
+ preventry = entry;
119
+ entry = entry->next;
120
+ }
121
+ return NOTFOUND;
122
+ }
123
+
124
+ // Find the data for a particular key
125
+ int hashtable_find(HashTable *ht, char *key)
126
+ {
127
+ unsigned int i = gethash(key);
128
+ DataEntry *entry;
129
+
130
+ if ( i >= HASHTABLEMAXSIZE ) return NOTFOUND;
131
+ entry = ht[i];
132
+ while (entry != NULL)
133
+ {
134
+ if ( strcmp(entry->key, key) == 0 )
135
+ {
136
+ return entry->data;
137
+ }
138
+ entry = entry->next;
139
+ }
140
+ return NOTFOUND;
141
+ }
142
+
143
+ // Find a particular key in the hash table
144
+ char *hashtable_findkey(HashTable *ht, char *key)
145
+ {
146
+ unsigned int i = gethash(key);
147
+ DataEntry *entry;
148
+ if ( i >= HASHTABLEMAXSIZE ) return NULL;
149
+ entry = ht[i];
150
+ while (entry != NULL)
151
+ {
152
+ if ( strcmp(entry->key, key) == 0 ) return entry->key;
153
+ entry = entry->next;
154
+ }
155
+ return NULL;
156
+ }
157
+
158
+ // Delete a hash table and free all of its memory
159
+ void hashtable_free(HashTable *ht)
160
+ {
161
+ DataEntry *entry, *nextentry;
162
+ int i;
163
+
164
+ for (i = 0; i < HASHTABLEMAXSIZE; i++)
165
+ {
166
+ entry = ht[i];
167
+ while (entry != NULL)
168
+ {
169
+ nextentry = entry->next;
170
+ free(entry->key);
171
+ free(entry);
172
+ entry = nextentry;
173
+ }
174
+ ht[i] = NULL;
175
+ }
176
+ free(ht);
177
+ }
@@ -0,0 +1,28 @@
1
+ /*
2
+ ******************************************************************************
3
+ Project: OWA EPANET
4
+ Version: 2.2
5
+ Module: hash.h
6
+ Description: header for a simple hash table
7
+ Authors: see AUTHORS
8
+ Copyright: see AUTHORS
9
+ License: see LICENSE
10
+ Last Updated: 11/27/2018
11
+ ******************************************************************************
12
+ */
13
+ #ifndef HASH_H
14
+ #define HASH_H
15
+
16
+ #define NOTFOUND 0
17
+
18
+ typedef struct DataEntryStruct *HashTable;
19
+
20
+ HashTable *hashtable_create(void);
21
+ int hashtable_insert(HashTable *, char *, int);
22
+ int hashtable_find(HashTable *, char *);
23
+ char *hashtable_findkey(HashTable *, char *);
24
+ void hashtable_free(HashTable *);
25
+ int hashtable_update(HashTable *ht, char *key, int new_data);
26
+ int hashtable_delete(HashTable *ht, char *key);
27
+
28
+ #endif