Add inps
This commit is contained in:
@@ -8,13 +8,6 @@ from .s5_pipes import *
|
||||
from .s6_pumps import *
|
||||
from .s7_valves import *
|
||||
|
||||
junctions : dict[str, dict[str, Any]] = {}
|
||||
reservoirs : dict[str, dict[str, Any]] = {}
|
||||
tanks : dict[str, dict[str, Any]] = {}
|
||||
pipes : dict[str, dict[str, Any]] = {}
|
||||
pumps : dict[str, dict[str, Any]] = {}
|
||||
valves : dict[str, dict[str, Any]] = {}
|
||||
|
||||
def read_inp(name: str, inp: str):
|
||||
if is_project_open(name):
|
||||
close_project(name)
|
||||
@@ -25,6 +18,12 @@ def read_inp(name: str, inp: str):
|
||||
create_project(name)
|
||||
open_project(name)
|
||||
|
||||
junctions : dict[str, dict[str, Any]] = {}
|
||||
reservoirs : dict[str, dict[str, Any]] = {}
|
||||
tanks : dict[str, dict[str, Any]] = {}
|
||||
pipes : dict[str, dict[str, Any]] = {}
|
||||
pumps : dict[str, dict[str, Any]] = {}
|
||||
valves : dict[str, dict[str, Any]] = {}
|
||||
section = ''
|
||||
|
||||
for line in open(inp):
|
||||
@@ -84,13 +83,15 @@ def read_inp(name: str, inp: str):
|
||||
tanks[tokens[0]] = {'id': tokens[0], 'elevation': tokens[1], 'init_level': tokens[2], 'min_level': tokens[3], 'max_level': tokens[4], 'diameter': tokens[5], 'min_vol': tokens[6]}
|
||||
continue
|
||||
elif section == PIPE:
|
||||
if len(tokens) == 7:
|
||||
tokens.append(PIPE_STATUS_OPEN)
|
||||
pipes[tokens[0]] = {'id': tokens[0], 'node1': tokens[1], 'node2': tokens[2], 'length': tokens[3], 'diameter': tokens[4], 'roughness': tokens[5], 'minor_loss': tokens[6], 'status': tokens[7].lower()}
|
||||
continue
|
||||
elif section == PUMP:
|
||||
pumps[tokens[0]] = {'id': tokens[0], 'node1': tokens[1], 'node2': tokens[2]}
|
||||
continue
|
||||
elif section == VALVE:
|
||||
valves[tokens[0]] = {'id': tokens[0], 'node1': tokens[1], 'node2': tokens[2], 'diameter': tokens[3], 'v_type': tokens[4], 'setting': tokens[5], 'minor_loss': tokens[6]}
|
||||
valves[tokens[0]] = {'id': tokens[0], 'node1': tokens[1], 'node2': tokens[2], 'diameter': tokens[3], 'v_type': tokens[4].lower(), 'setting': tokens[5], 'minor_loss': tokens[6]}
|
||||
continue
|
||||
elif section == 'coordinate':
|
||||
if tokens[0] in junctions:
|
||||
|
||||
Reference in New Issue
Block a user