51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
from tjnetwork import *
|
|
|
|
p = "demo"
|
|
|
|
if is_project_open(p):
|
|
close_project(p)
|
|
|
|
if have_project(p):
|
|
delete_project(p)
|
|
|
|
create_project(p)
|
|
open_project(p)
|
|
|
|
print(get_junction_schema(p))
|
|
print(get_reservoir_schema(p))
|
|
print(get_tank_schema(p))
|
|
|
|
print(add_junction(p, 'j1', 0.0, 0.0, 0.0).operations)
|
|
print(add_junction(p, 'j2', 0.0, 0.0, 0.0).operations)
|
|
print(add_junction(p, 'j3', 0.0, 0.0, 0.0).operations)
|
|
print(add_junction(p, 'j4', 0.0, 0.0, 0.0).operations)
|
|
|
|
client_op = get_current_operation(p)
|
|
print(client_op)
|
|
print(take_snapshot(p, 'x'))
|
|
|
|
print(execute_undo(p).operations)
|
|
print(execute_undo(p).operations)
|
|
print(add_junction(p, 'j5', 0.0, 0.0, 0.0).operations)
|
|
print(add_junction(p, 'j6', 0.0, 0.0, 0.0).operations)
|
|
|
|
print(take_snapshot(p, 'xx'))
|
|
|
|
print(sync_with_server(p, client_op).operations)
|
|
|
|
print(pick_snapshot(p, 'x').operations)
|
|
|
|
print(get_junction(p, 'j1'))
|
|
print(get_junction(p, 'j2'))
|
|
print(get_junction(p, 'j3'))
|
|
print(get_junction(p, 'j4'))
|
|
print(get_junction(p, 'j5'))
|
|
print(get_junction(p, 'j6'))
|
|
|
|
print(set_junction(p, 'j1', {'elevation': 10.0, 'coord': {'x': 10.0, 'y': 10.0}, 'demand': 10.0}).operations)
|
|
print(get_junction(p, 'j1'))
|
|
print(execute_undo(p).operations)
|
|
print(get_junction(p, 'j1'))
|
|
|
|
close_project(p)
|
|
delete_project(p) |