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,93 @@
1
+ /*
2
+ ******************************************************************************
3
+ Project: OWA EPANET
4
+ Version: 2.2
5
+ Module: main.c
6
+ Description: main stub for a command line executable version of EPANET
7
+ Authors: see AUTHORS
8
+ Copyright: see AUTHORS
9
+ License: see LICENSE
10
+ Last Updated: 12/07/2018
11
+ ******************************************************************************
12
+ */
13
+
14
+ #include <stdio.h>
15
+ #include "epanet2.h"
16
+
17
+ void writeConsole(char *s)
18
+ {
19
+ fprintf(stdout, "\r%s", s);
20
+ fflush(stdout);
21
+ }
22
+
23
+ int main(int argc, char *argv[])
24
+ /*--------------------------------------------------------------
25
+ ** Input: argc = number of command line arguments
26
+ ** *argv[] = array of command line arguments
27
+ ** Output: none
28
+ ** Purpose: main program stub for command line EPANET
29
+ **
30
+ ** Command line for stand-alone operation is:
31
+ ** progname f1 f2 f3
32
+ ** where progname = name of executable this code was compiled to,
33
+ ** f1 = name of input file,
34
+ ** f2 = name of report file
35
+ ** f3 = name of binary output file (optional).
36
+ **--------------------------------------------------------------
37
+ */
38
+ {
39
+ char *f1,*f2,*f3;
40
+ char blank[] = "";
41
+ char errmsg[256] = "";
42
+ int errcode;
43
+ int version;
44
+ int major;
45
+ int minor;
46
+ int patch;
47
+
48
+ // Check for proper number of command line arguments
49
+ if (argc < 3)
50
+ {
51
+ printf(
52
+ "\nUsage:\n %s <input_filename> <report_filename> [<binary_filename>]\n",
53
+ argv[0]);
54
+ return 0;
55
+ }
56
+
57
+ // Get version number and display in Major.Minor.Patch format
58
+ ENgetversion(&version);
59
+ major = version/10000;
60
+ minor = (version%10000)/100;
61
+ patch = version%100;
62
+ printf("\n... Running EPANET Version %d.%d.%d\n", major, minor, patch);
63
+
64
+ // Assign pointers to file names
65
+ f1 = argv[1];
66
+ f2 = argv[2];
67
+ if (argc > 3) f3 = argv[3];
68
+ else f3 = blank;
69
+
70
+ // Run EPANET
71
+ errcode = ENepanet(f1, f2, f3, &writeConsole);
72
+
73
+ // Blank out the last progress message
74
+ printf("\r ");
75
+
76
+ // Check for errors/warnings and report accordingly
77
+ if (errcode == 0)
78
+ {
79
+ printf("\n... EPANET ran successfully.\n");
80
+ return 0;
81
+ }
82
+ else if (errcode < 100)
83
+ {
84
+ printf("\n... EPANET ran with warnings - check the Status Report.\n");
85
+ return 0;
86
+ }
87
+ else
88
+ {
89
+ ENgeterror(errcode, errmsg, 255);
90
+ printf("\n... EPANET failed with %s.\n", errmsg);
91
+ return 100;
92
+ }
93
+ }
@@ -0,0 +1,142 @@
1
+ /*
2
+ ******************************************************************************
3
+ Project: OWA EPANET
4
+ Version: 2.2
5
+ Module: mempool.c
6
+ Description: a simple fast poooled memory allocation package
7
+ Authors: see AUTHORS
8
+ Copyright: see AUTHORS
9
+ License: see LICENSE
10
+ Last Updated: 05/15/2019
11
+
12
+ This module is based code by Steve Hill in Graphics Gems III,
13
+ David Kirk (ed.), Academic Press, Boston, MA, 1992
14
+ ******************************************************************************
15
+ */
16
+
17
+ #include <stdlib.h>
18
+
19
+ #include "mempool.h"
20
+
21
+ /*
22
+ ** ALLOC_BLOCK_SIZE - adjust this size to suit your installation - it
23
+ ** should be reasonably large otherwise you will be mallocing a lot.
24
+ */
25
+
26
+ #define ALLOC_BLOCK_SIZE 64000 /*(62*1024)*/
27
+
28
+ struct MemBlock
29
+ {
30
+ struct MemBlock *next; // Next block
31
+ char *block, // Start of block
32
+ *free, // Next free position in block
33
+ *end; // block + block size
34
+ };
35
+
36
+ struct Mempool
37
+ {
38
+ struct MemBlock *first;
39
+ struct MemBlock *current;
40
+ };
41
+
42
+ static struct MemBlock* createMemBlock()
43
+ {
44
+ struct MemBlock* memBlock = malloc(sizeof(struct MemBlock));
45
+ if (memBlock)
46
+ {
47
+ memBlock->block = malloc(ALLOC_BLOCK_SIZE * sizeof(char));
48
+ if (memBlock->block == NULL)
49
+ {
50
+ free(memBlock);
51
+ return NULL;
52
+ }
53
+ memBlock->free = memBlock->block;
54
+ memBlock->next = NULL;
55
+ memBlock->end = memBlock->block + ALLOC_BLOCK_SIZE;
56
+ }
57
+ return memBlock;
58
+ }
59
+
60
+
61
+ static void deleteMemBlock(struct MemBlock* memBlock)
62
+ {
63
+ free(memBlock->block);
64
+ free(memBlock);
65
+ }
66
+
67
+
68
+ struct Mempool * mempool_create()
69
+ {
70
+ struct Mempool *mempool;
71
+ mempool = (struct Mempool *)malloc(sizeof(struct Mempool));
72
+ if (mempool == NULL) return NULL;
73
+ mempool->first = createMemBlock();
74
+ mempool->current = mempool->first;
75
+ if (mempool->first == NULL) return NULL;
76
+ return mempool;
77
+ }
78
+
79
+ void mempool_delete(struct Mempool *mempool)
80
+ {
81
+ if (mempool == NULL) return;
82
+ while (mempool->first)
83
+ {
84
+ mempool->current = mempool->first->next;
85
+ deleteMemBlock(mempool->first);
86
+ mempool->first = mempool->current;
87
+ }
88
+ free(mempool);
89
+ mempool = NULL;
90
+ }
91
+
92
+ void mempool_reset(struct Mempool *mempool)
93
+ {
94
+ mempool->current = mempool->first;
95
+ mempool->current->free = mempool->current->block;
96
+ }
97
+
98
+
99
+ char * mempool_alloc(struct Mempool *mempool, size_t size)
100
+ {
101
+ char* ptr;
102
+
103
+ /*
104
+ ** Align to 4 byte boundary - should be ok for most machines.
105
+ ** Change this if your machine has weird alignment requirements.
106
+ */
107
+ size = (size + 3) & 0xfffffffc;
108
+
109
+ if (!mempool->current) return NULL;
110
+ ptr = mempool->current->free;
111
+ mempool->current->free += size;
112
+
113
+ // Check if the current block is exhausted
114
+
115
+ if (mempool->current->free >= mempool->current->end)
116
+ {
117
+ // Is the next block already allocated?
118
+
119
+ if (mempool->current->next)
120
+ {
121
+ // re-use block
122
+ mempool->current->next->free = mempool->current->next->block;
123
+ mempool->current = mempool->current->next;
124
+ }
125
+ else
126
+ {
127
+ // extend the pool with a new block
128
+ mempool->current->next = createMemBlock();
129
+ if (!mempool->current->next) return NULL;
130
+ mempool->current = mempool->current->next;
131
+ }
132
+
133
+ // set ptr to the first location in the next block
134
+
135
+ ptr = mempool->current->free;
136
+ mempool->current->free += size;
137
+ }
138
+
139
+ // Return pointer to allocated memory
140
+
141
+ return ptr;
142
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ ******************************************************************************
3
+ Project: OWA EPANET
4
+ Version: 2.2
5
+ Module: mempool.h
6
+ Description: header for a simple pooled memory allocator
7
+ Authors: see AUTHORS
8
+ Copyright: see AUTHORS
9
+ License: see LICENSE
10
+ Last Updated: 11/27/2018
11
+ ******************************************************************************
12
+ */
13
+
14
+ #ifndef MEMPOOL_H
15
+ #define MEMPOOL_H
16
+
17
+ struct Mempool;
18
+
19
+ struct Mempool * mempool_create();
20
+ void mempool_delete(struct Mempool *mempool);
21
+ void mempool_reset(struct Mempool *mempool);
22
+ char * mempool_alloc(struct Mempool *mempool, size_t size);
23
+
24
+ #endif