@model-create/epanet-engine 0.7.0 → 0.7.1-alpha.1
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.
- package/Dockerfile +1 -1
- package/build.sh +5 -1
- package/dist/index.js +1 -16
- package/package.json +1 -1
- package/dist/index.d.ts +0 -691
- package/dist/index.es6.js +0 -18
- package/dist/index.html +0 -319
package/dist/index.html
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
Open the console to see the output from the wasm module.
|
|
3
|
-
<script type="module">
|
|
4
|
-
import Module from "./index.js";
|
|
5
|
-
|
|
6
|
-
console.log(Module);
|
|
7
|
-
|
|
8
|
-
// const net1 = `[TITLE]
|
|
9
|
-
// EPANET Example Network 1
|
|
10
|
-
// A simple example of modeling chlorine decay. Both bulk and
|
|
11
|
-
// wall reactions are included.
|
|
12
|
-
//
|
|
13
|
-
// [JUNCTIONS]
|
|
14
|
-
// ;ID Elev Demand Pattern
|
|
15
|
-
// 10 710 0 ;
|
|
16
|
-
// 11 710 150 ;
|
|
17
|
-
// 12 700 150 ;
|
|
18
|
-
// 13 695 100 ;
|
|
19
|
-
// 21 700 150 ;
|
|
20
|
-
// 22 695 200 ;
|
|
21
|
-
// 23 690 150 ;
|
|
22
|
-
// 31 700 100 ;
|
|
23
|
-
// 32 710 100 ;
|
|
24
|
-
//
|
|
25
|
-
// [RESERVOIRS]
|
|
26
|
-
// ;ID Head Pattern
|
|
27
|
-
// 9 800 ;
|
|
28
|
-
//
|
|
29
|
-
// [TANKS]
|
|
30
|
-
// ;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
|
|
31
|
-
// 2 850 120 100 150 50.5 0 ;
|
|
32
|
-
//
|
|
33
|
-
// [PIPES]
|
|
34
|
-
// ;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
|
|
35
|
-
// 10 10 11 10530 18 100 0 Open ;
|
|
36
|
-
// 11 11 12 5280 14 100 0 Open ;
|
|
37
|
-
// 12 12 13 5280 10 100 0 Open ;
|
|
38
|
-
// 21 21 22 5280 10 100 0 Open ;
|
|
39
|
-
// 22 22 23 5280 12 100 0 Open ;
|
|
40
|
-
// 31 31 32 5280 6 100 0 Open ;
|
|
41
|
-
// 110 2 12 200 18 100 0 Open ;
|
|
42
|
-
// 111 11 21 5280 10 100 0 Open ;
|
|
43
|
-
// 112 12 22 5280 12 100 0 Open ;
|
|
44
|
-
// 113 13 23 5280 8 100 0 Open ;
|
|
45
|
-
// 121 21 31 5280 8 100 0 Open ;
|
|
46
|
-
// 122 22 32 5280 6 100 0 Open ;
|
|
47
|
-
//
|
|
48
|
-
// [PUMPS]
|
|
49
|
-
// ;ID Node1 Node2 Parameters
|
|
50
|
-
// 9 9 10 HEAD 1 ;
|
|
51
|
-
//
|
|
52
|
-
// [VALVES]
|
|
53
|
-
// ;ID Node1 Node2 Diameter Type Setting MinorLoss
|
|
54
|
-
//
|
|
55
|
-
// [TAGS]
|
|
56
|
-
//
|
|
57
|
-
// [DEMANDS]
|
|
58
|
-
// ;Junction Demand Pattern Category
|
|
59
|
-
//
|
|
60
|
-
// [STATUS]
|
|
61
|
-
// ;ID Status/Setting
|
|
62
|
-
//
|
|
63
|
-
// [PATTERNS]
|
|
64
|
-
// ;ID Multipliers
|
|
65
|
-
// ;Demand Pattern
|
|
66
|
-
// 1 1.0 1.2 1.4 1.6 1.4 1.2
|
|
67
|
-
// 1 1.0 0.8 0.6 0.4 0.6 0.8
|
|
68
|
-
//
|
|
69
|
-
// [CURVES]
|
|
70
|
-
// ;ID X-Value Y-Value
|
|
71
|
-
// ;PUMP: Pump Curve for Pump 9
|
|
72
|
-
// 1 1500 250
|
|
73
|
-
//
|
|
74
|
-
// [CONTROLS]
|
|
75
|
-
// LINK 9 OPEN IF NODE 2 BELOW 110
|
|
76
|
-
// LINK 9 CLOSED IF NODE 2 ABOVE 140
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
// [RULES]
|
|
80
|
-
//
|
|
81
|
-
// [ENERGY]
|
|
82
|
-
// Global Efficiency 75
|
|
83
|
-
// Global Price 0.0
|
|
84
|
-
// Demand Charge 0.0
|
|
85
|
-
//
|
|
86
|
-
// [EMITTERS]
|
|
87
|
-
// ;Junction Coefficient
|
|
88
|
-
//
|
|
89
|
-
// [QUALITY]
|
|
90
|
-
// ;Node InitQual
|
|
91
|
-
// 10 0.5
|
|
92
|
-
// 11 0.5
|
|
93
|
-
// 12 0.5
|
|
94
|
-
// 13 0.5
|
|
95
|
-
// 21 0.5
|
|
96
|
-
// 22 0.5
|
|
97
|
-
// 23 0.5
|
|
98
|
-
// 31 0.5
|
|
99
|
-
// 32 0.5
|
|
100
|
-
// 9 1.0
|
|
101
|
-
// 2 1.0
|
|
102
|
-
//
|
|
103
|
-
// [SOURCES]
|
|
104
|
-
// ;Node Type Quality Pattern
|
|
105
|
-
//
|
|
106
|
-
// [REACTIONS]
|
|
107
|
-
// ;Type Pipe/Tank Coefficient
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
// [REACTIONS]
|
|
111
|
-
// Order Bulk 1
|
|
112
|
-
// Order Tank 1
|
|
113
|
-
// Order Wall 1
|
|
114
|
-
// Global Bulk -.5
|
|
115
|
-
// Global Wall -1
|
|
116
|
-
// Limiting Potential 0.0
|
|
117
|
-
// Roughness Correlation 0.0
|
|
118
|
-
//
|
|
119
|
-
// [MIXING]
|
|
120
|
-
// ;Tank Model
|
|
121
|
-
//
|
|
122
|
-
// [TIMES]
|
|
123
|
-
// Duration 24:00
|
|
124
|
-
// Hydraulic Timestep 1:00
|
|
125
|
-
// Quality Timestep 0:05
|
|
126
|
-
// Pattern Timestep 2:00
|
|
127
|
-
// Pattern Start 0:00
|
|
128
|
-
// Report Timestep 1:00
|
|
129
|
-
// Report Start 0:00
|
|
130
|
-
// Start ClockTime 12 am
|
|
131
|
-
// Statistic None
|
|
132
|
-
//
|
|
133
|
-
// [REPORT]
|
|
134
|
-
// Status Yes
|
|
135
|
-
// Summary No
|
|
136
|
-
// Page 0
|
|
137
|
-
//
|
|
138
|
-
// [OPTIONS]
|
|
139
|
-
// Units GPM
|
|
140
|
-
// Headloss H-W
|
|
141
|
-
// Specific Gravity 1.0
|
|
142
|
-
// Viscosity 1.0
|
|
143
|
-
// Trials 40
|
|
144
|
-
// Accuracy 0.001
|
|
145
|
-
// CHECKFREQ 2
|
|
146
|
-
// MAXCHECK 10
|
|
147
|
-
// DAMPLIMIT 0
|
|
148
|
-
// Unbalanced Continue 10
|
|
149
|
-
// Pattern 1
|
|
150
|
-
// Demand Multiplier 1.0
|
|
151
|
-
// Emitter Exponent 0.5
|
|
152
|
-
// Quality Chlorine mg/L
|
|
153
|
-
// Diffusivity 1.0
|
|
154
|
-
// Tolerance 0.01
|
|
155
|
-
//
|
|
156
|
-
// [COORDINATES]
|
|
157
|
-
// ;Node X-Coord Y-Coord
|
|
158
|
-
// 10 20.00 70.00
|
|
159
|
-
// 11 30.00 70.00
|
|
160
|
-
// 12 50.00 70.00
|
|
161
|
-
// 13 70.00 70.00
|
|
162
|
-
// 21 30.00 40.00
|
|
163
|
-
// 22 50.00 40.00
|
|
164
|
-
// 23 70.00 40.00
|
|
165
|
-
// 31 30.00 10.00
|
|
166
|
-
// 32 50.00 10.00
|
|
167
|
-
// 9 10.00 70.00
|
|
168
|
-
// 2 50.00 90.00
|
|
169
|
-
//
|
|
170
|
-
// [VERTICES]
|
|
171
|
-
// ;Link X-Coord Y-Coord
|
|
172
|
-
//
|
|
173
|
-
// [LABELS]
|
|
174
|
-
// ;X-Coord Y-Coord Label & Anchor Node
|
|
175
|
-
// 6.99 73.63 "Source"
|
|
176
|
-
// 13.48 68.13 "Pump"
|
|
177
|
-
// 43.85 91.21 "Tank"
|
|
178
|
-
//
|
|
179
|
-
// [BACKDROP]
|
|
180
|
-
// DIMENSIONS 7.00 6.00 73.00 94.00
|
|
181
|
-
// UNITS None
|
|
182
|
-
// FILE
|
|
183
|
-
// OFFSET 0.00 0.00
|
|
184
|
-
//
|
|
185
|
-
// [END]`;
|
|
186
|
-
//
|
|
187
|
-
// class OwaEpanetWorkspace {
|
|
188
|
-
// constructor() {
|
|
189
|
-
// this._instance = Module();
|
|
190
|
-
// this._FS = this._instance.FS;
|
|
191
|
-
// this._FS.writeFile("/net1.inp", net1);
|
|
192
|
-
// }
|
|
193
|
-
//
|
|
194
|
-
// get version() {
|
|
195
|
-
// const intPointer = this._instance._malloc(4);
|
|
196
|
-
// var result = this._instance.getversion(intPointer);
|
|
197
|
-
// const returnValue = this._instance.getValue(intPointer, "i32");
|
|
198
|
-
//
|
|
199
|
-
// this._instance._free(intPointer);
|
|
200
|
-
//
|
|
201
|
-
// return returnValue;
|
|
202
|
-
// }
|
|
203
|
-
//
|
|
204
|
-
// getError(code) {
|
|
205
|
-
// const title1Ptr = this._instance._malloc(1);
|
|
206
|
-
// const result = this._instance.geterror(code, title1Ptr);
|
|
207
|
-
// const errMessage = this._instance.UTF8ToString(title1Ptr);
|
|
208
|
-
// this._instance._free(title1Ptr);
|
|
209
|
-
// return errMessage;
|
|
210
|
-
// }
|
|
211
|
-
//
|
|
212
|
-
// readFile(file) {
|
|
213
|
-
// return this._instance.intArrayToString(this._FS.readFile(file));
|
|
214
|
-
// }
|
|
215
|
-
// }
|
|
216
|
-
//
|
|
217
|
-
// class OwaEpanetProject {
|
|
218
|
-
// constructor(workspace) {
|
|
219
|
-
// this._ws = workspace._instance;
|
|
220
|
-
// this._EN = new this._ws.Epanet();
|
|
221
|
-
// }
|
|
222
|
-
// init(rptFile, outFile, unitType, headLosstype) {
|
|
223
|
-
// const result = this._EN.init(rptFile, outFile, unitType, headLosstype);
|
|
224
|
-
// return result;
|
|
225
|
-
// }
|
|
226
|
-
//
|
|
227
|
-
// addnode(id, nodeType) {
|
|
228
|
-
// const intPointer = this._ws._malloc(4);
|
|
229
|
-
// var result = this._EN.addnode(id, nodeType, intPointer);
|
|
230
|
-
// const returnValue = this._ws.getValue(intPointer, "i32");
|
|
231
|
-
//
|
|
232
|
-
// this._ws._free(intPointer);
|
|
233
|
-
//
|
|
234
|
-
// return returnValue;
|
|
235
|
-
// }
|
|
236
|
-
//
|
|
237
|
-
// setjuncdata(index, elev, dmnd, dmndpat) {
|
|
238
|
-
// const result = this._EN.setjuncdata(index, elev, dmnd, dmndpat);
|
|
239
|
-
// return result;
|
|
240
|
-
// }
|
|
241
|
-
//
|
|
242
|
-
// saveinpfile(filename) {
|
|
243
|
-
// const result = this._EN.saveinpfile(filename);
|
|
244
|
-
// return result;
|
|
245
|
-
// }
|
|
246
|
-
// }
|
|
247
|
-
// const EN_JUNCTION = 0;
|
|
248
|
-
//
|
|
249
|
-
// const workspace = new OwaEpanetWorkspace();
|
|
250
|
-
// const model = new OwaEpanetProject(workspace);
|
|
251
|
-
//
|
|
252
|
-
// console.log(workspace.version);
|
|
253
|
-
// model.init("", "", 0, 0);
|
|
254
|
-
// const nodeId = model.addnode("J1", EN_JUNCTION);
|
|
255
|
-
// model.setjuncdata(nodeId, 700, 0, "");
|
|
256
|
-
// model.saveinpfile("example2.inp");
|
|
257
|
-
//
|
|
258
|
-
// console.log(workspace.readFile("example2.inp"));
|
|
259
|
-
|
|
260
|
-
// import wasmModule from "./my-module.js";
|
|
261
|
-
|
|
262
|
-
// const instance = wasmModule();
|
|
263
|
-
//
|
|
264
|
-
// const intPointer = instance._malloc(4);
|
|
265
|
-
//
|
|
266
|
-
// ////onRuntimeInitialized() {
|
|
267
|
-
|
|
268
|
-
// //console.log(instance.add(1, 2.3));
|
|
269
|
-
// var result = instance.getversion(intPointer);
|
|
270
|
-
// //console.log(instance.exclaim("hello world"));
|
|
271
|
-
// //
|
|
272
|
-
// //var result = instance.ccall(
|
|
273
|
-
// // "getversion2", // name of C function
|
|
274
|
-
// // "number", // return type
|
|
275
|
-
// // ["number"], // argument types
|
|
276
|
-
// // [intPointer]
|
|
277
|
-
// //);
|
|
278
|
-
// //
|
|
279
|
-
// console.log(result);
|
|
280
|
-
// const returnValue = instance.getValue(intPointer, "i32");
|
|
281
|
-
// console.log(returnValue);
|
|
282
|
-
//
|
|
283
|
-
// const FS = instance.FS;
|
|
284
|
-
// FS.writeFile("/net1.inp", net1);
|
|
285
|
-
// const EN = new instance.Epanet();
|
|
286
|
-
//
|
|
287
|
-
// const runError = EN.runproject("net1.inp", "net1.rpt", "net1.hyd");
|
|
288
|
-
// console.log(`Open Error: ${runError}`);
|
|
289
|
-
//
|
|
290
|
-
// console.log(instance.intArrayToString(FS.readFile("net1.rpt")));
|
|
291
|
-
//
|
|
292
|
-
// //const title1Ptr = instance._malloc(1);
|
|
293
|
-
// //const title2Ptr = instance._malloc(1);
|
|
294
|
-
// //const title3Ptr = instance._malloc(1);
|
|
295
|
-
// //
|
|
296
|
-
// //const openError = EN.open("net1.inp", "", "");
|
|
297
|
-
// //console.log(`Open Error: ${openError}`);
|
|
298
|
-
// //
|
|
299
|
-
// //var result = EN.gettitle(title1Ptr, title2Ptr, title3Ptr);
|
|
300
|
-
// //console.log(instance.UTF8ToString(title1Ptr));
|
|
301
|
-
// //console.log(instance.UTF8ToString(title2Ptr));
|
|
302
|
-
// //console.log(instance.UTF8ToString(title3Ptr));
|
|
303
|
-
// //
|
|
304
|
-
// //EN.gettitle(title1Ptr, title2Ptr, title3Ptr);
|
|
305
|
-
// //EN.gettitle(title1Ptr, title2Ptr, title3Ptr);
|
|
306
|
-
//
|
|
307
|
-
// //console.log(instance.intArrayToString(FS.readFile("/net1.rpt")));
|
|
308
|
-
// //console.log(result);
|
|
309
|
-
// //console.log(instance);
|
|
310
|
-
// //const c = new instance.Epanet(22, 2);
|
|
311
|
-
// //console.log(c.getProject());
|
|
312
|
-
// //console.log(c.getcount(0, intPointer));
|
|
313
|
-
//
|
|
314
|
-
// //const nodeLength = instance.getValue(intPointer, "i32");
|
|
315
|
-
// //console.log(nodeLength);
|
|
316
|
-
//
|
|
317
|
-
// //}
|
|
318
|
-
// //});
|
|
319
|
-
</script>
|