Exemplo n.º 1
0
def simul_nodes(i,filename):
    '''
    Function to be iterated using parallelisation
    Filename needs to be changed every time that the storm is changed
    
    Input
    -----
    list of subcatchments where GI will be implemented

    Output
    ------
    resilience index pandas dataframe
    '''
    from pyswmm import Simulation
    
    area = 500
    
    LIDsubcat_area(filename,i)

    fin=filename+str(hash(''.join(i)))+f'area_{area}'

    sim=Simulation('Res_files/'+fin+'.inp')
    sim.execute()

    res=resilienceindex_nodes_sys(fin)
    print('Resilience Index Calculated')

    os.remove('Res_files/'+fin+'.inp')
    os.remove('Res_files/'+fin+'.out')
    os.remove('Res_files/'+fin+'.rpt')

    print('Files removed!')

    return res
Exemplo n.º 2
0
def test_lib_5():
    """Testing SWMM Path as argument to Simulation Object.

    On Windows for now."""
    if os.name == 'nt':
        print(WIN_SWMM_LIB_PATH)
        sim = Simulation(MODEL_WEIR_SETTING_PATH,
                         swmm_lib_path=WIN_SWMM_LIB_PATH)
        sim.execute()
        pyswmm.lib.use(WIN_SWMM_LIB_PATH)
Exemplo n.º 3
0
def run(inp_path):
    sim = Simulation(inp_path)
    sim.execute()
    logging.info('run completed: %s' % inp_path)
Exemplo n.º 4
0
# -*- coding: utf-8 -*-
# @Author: Brooke Mason
# @Date:   2020-01-15 09:57:05
# @Last Modified by:   Brooke Mason
# @Last Modified time: 2020-10-21 09:33:07

#Import time module
import time
startTime = time.time()

# Import required modules
from pyswmm import Simulation

#----------------------------------------------------------------------#
# Uncontrolled Simulation

# Setup toolbox simulation
sim = Simulation("./NO.inp")
sim.execute()

executionTime = (time.time() - startTime)
print('Execution time in seconds: ' + str(executionTime))
Exemplo n.º 5
0
def test_simulation_3():
    sim = Simulation(MODEL_WEIR_SETTING_PATH)
    sim.execute()
Exemplo n.º 6
0
def test_quality_error():
    sim = Simulation(MODEL_WEIR_SETTING_PATH)
    sim.execute()
    print(sim.quality_error)
    assert sim.quality_error >= 0.0
Exemplo n.º 7
0
def test_flow_routing_error():
    sim = Simulation(MODEL_WEIR_SETTING_PATH)
    sim.execute()
    print(sim.flow_routing_error)
    assert sim.flow_routing_error >= 0.0
Exemplo n.º 8
0
def runModel(path='D:\SWMMH\Examples\\test2.inp'):
    sim = Simulation(path)
    sim.execute()
Exemplo n.º 9
0
def runModel(path='example2\\Example.inp'):
    sim = Simulation(path)
    sim.execute()