Skip to content

Commit

Permalink
inputs chanegd. Ruffed.
Browse files Browse the repository at this point in the history
  • Loading branch information
snaeimi committed Aug 28, 2024
1 parent 36f5f9c commit e114e5c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions modules/performREC/pyrecodes/PyReCode-REWET-preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
class REWETPyReCoDes:
"""Provide the wrapper for REWET API."""

def __init__(self):
def __init__(self, inp_file):
self.wn = None
self._clean_wn = None
self.inp_file_path = None
Expand All @@ -73,8 +73,9 @@ def __init__(self):
self.damage_file_list = {}
self.damage_state = {}
self.hydraulic_time_step = 3600
self.inp_file_path = inp_file

def system_state(self, state, damage, inp_file, damage_time=0):
def system_state(self, state, damage, damage_time=0):
"""
Set the WDN system for PyReCoDes Interface.
Expand All @@ -85,8 +86,6 @@ def system_state(self, state, damage, inp_file, damage_time=0):
style.
damage : dict
The damage state in 2DTool's system_i style.
inp_file : path(str)
the path to the inp file.
Damage_time : int
When initil damages happen in seconds.
Expand All @@ -96,7 +95,7 @@ def system_state(self, state, damage, inp_file, damage_time=0):
"""
# read the inp file
self.read_inp_file(inp_file)
self.read_inp_file(self.inp_file_path)

self.set_asset_data(state)

Expand All @@ -114,8 +113,6 @@ def system_performance(self, state, current_time, next_time):
----------
state : dict.
The _det file content.
damage : dict
_i (realization) file content.
current_time : int
Current time in seconds.
next_time : int
Expand Down Expand Up @@ -780,6 +777,6 @@ def get_rewet_hydraulic_basic_setting():

inp_file = 'waterNetwork.inp'

interface = REWETPyReCoDes()
interface.system_state(state, damage, inp_file)
result = interface.system_performance(state, damage, 0, 24 * 3600)
interface = REWETPyReCoDes(inp_file)
interface.system_state(state, damage)
result = interface.system_performance(state, 0, 24 * 3600)

0 comments on commit e114e5c

Please sign in to comment.