Skip to content

Commit

Permalink
deploy: ec4efd4
Browse files Browse the repository at this point in the history
  • Loading branch information
snaeimi committed Jul 23, 2024
0 parents commit 49ae70d
Show file tree
Hide file tree
Showing 68 changed files with 7,118 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: c93810aff5aa5f6d574debbbb0e61663
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/docs/Future.doctree
Binary file not shown.
Binary file added .doctrees/docs/Inputs.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/docs/WorkflowDescription.doctree
Binary file not shown.
Binary file added .doctrees/docs/cite.doctree
Binary file not shown.
Binary file added .doctrees/docs/install.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
Empty file added .nojekyll
Empty file.
15 changes: 15 additions & 0 deletions _sources/docs/Future.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Future Development
##################

API Development
***************
REWET is planned to be used in in NHERI SimCenter's R2D General Recovery; thus, it must provide APIs to be seamlessly
get connected to the R2D's planned general recovery module. There are goring to be a module providing API. The following
APIs are to be developed in the next development cycle:

* init: this API is the conceptual init function to load the inputs and settings required pertaining to the restoration simulation tasks.
* runTillNextTime: Runs the simulation until the next specified time. Returns exception if the time is less or the same time as the current_stop_time.
* runTillNextEvent: Runs until the next events.
* getNextEventTime: Gets the next event time.
* setEventTime: sets an event time.
181 changes: 181 additions & 0 deletions _sources/docs/Inputs.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
Inputs
#######

.. Warning:: REWET is under continuous development, which means that:
1. The names of the input parameters may change.
2. New methods of inputting data may be provided in the future.
3. Some input data may be added or removed.

Therefore, please refer to the documentation for the specific version you are using.

There are many inputs in REWET that you need to provide for it to run properly. In this section, we will go through them. However, an example project is set as the default values. As a result, you can browse the input values and learn what each variable does after reading this document.

Overview
========

To run REWET, you need to define:

1. **Scenario Data**: Scenario data mostly consist of damage data. In other words, users usually have different damage data for each scenario than other data such as hydraulic solver parameters. These data are defined in the scenario table. Each row in the scenario table defines:
1. Scenario name,
2. Pipe damage data name,
3. Node-level damage data name,
4. Pump damage data name,
5. Tank damage data name,
6. Probability (Optional. Required if you want to post-process a set of probabilistic scenarios using REWET).

Each row can also have other scenario parameter data through parameter override. For more information on scenario table, :ref:`Click Here<Scenario Table>`.

2. **Water Distribution Network**: REWET needs to know the specifications of the water distribution network. Thus, an INP file must be provided.

3. **Restoration Plan**: The restoration plan defines the crews, jobs, priorities, and set of effects on the network after the effect.

4. **Pipe and Node-level Damage Modeling**.

5. **Pipe, Node-level, Pump, Tank, General-node, and Reservoir Damage Discovery Model**.

The data required to run REWET's simulation enables the user to control all parts of the hydraulic, damage, and restoration simulation. While the amount of data required for running REWET may seem excessive, the simplicity and intuitiveness of the data help the user to learn how to use it proficiently. If you are not sure about parameters that require technical skills, in most cases, you can simply leave the data to their default values provided in REWET.

Input Settings
==============

Input settings are the main data input point in REWET. All input data are either defined in the input settings data or in files whose locations are given in the input settings. There are two kinds of inputs:

1. **Process Settings**: These are parameters that apply to all simulation scenarios. For instance, the time of the whole simulation for all scenarios is deemed to be the same. So, it is a process setting.

2. **Scenario Settings**: These are parameters that are specific to each scenario. You can define them for all scenarios as well. However, if you want to change the scenario-setting values, you can override those values in the scenarios table. In this way, you can easily change scenario-setting inputs.

The list of process and scenario settings parameters are as follows:

.. csv-table:: REWET Process Setting Inputs
:file: /docs/tables/REWET_Process_Settings.csv
:header-rows: 1
:widths: auto
:align: center

.. csv-table:: REWET Scenario Setting Inputs
:file: /docs/tables/REWET_Scenario_Settings.csv
:header-rows: 1
:widths: auto
:align: center

.. tip:: Please make sure to check the :ref:`Units and Tips<Units and Tips>` about input.

How to provide input
--------------------

You can create a REWET input settings using a JSON formatted file. For example, if you want to change the runtime of the simulation, all you need to do is set `RUN_TIME` to your desired time.

.. code-block:: JSON
{
"RUN_TIME": 36000
}
After saving the file in a proper location, you can pass the path to the file's location to REWET by running:

.. code-block:: python
from rewet.initial import Starter
json_file_location = "./input.json"
starter = Starter()
starter.run(json_file_location)
REWET reads and overrides the values that are provided in the JSON file. In this way, when you are not sure about parameters (let's say hydraulic damage model), you can safely ignore those parameters.

Scenario Table
--------------

The scenario table is an Excel file (or Pandas DataFrame pickled into a binary file). The table is as follows:

.. csv-table:: An Example of Scenario Table
:file: /docs/tables/example_scenario_table.csv
:header-rows: 1
:widths: auto
:align: center

Scenario name is the scenario name. Pipe, node-level, pump, and tank damage data are the respective file names for the element type damages.

.. important:: All damage files must be in one directory! However, there is no necessity to keep the scenario table location in the same place as the damage files. For example, let's say we have input data in the following structure:

- input_data
- scenario_table.xlsx
- damage_files
- Net3-pipe-damage.xlsx
- Net3-node-damage.xlsx
- Net3-Pump-Damage.xlsx
- Net3-tank-damage.xlsx

Then by setting ``pipe_damage_file_list`` to ``./input_data/scenario_table.xlsx`` and
``pipe_damage_file_directory`` to ``./input_data/damage_files``, REWET will look at the right places for the scenario table and damage files, whose names have been defined in the scenario table.

Pipe Damage Data
----------------

Pipe damage data is a table in which each row defines a single damage location. There can be mutiple damage in mutiple locations. The tables are saved in excel or Pandas DataFrame pickled into a binary file. An example of such table is as follows:

.. csv-table:: Pipe Damage Data
:file: /docs/tables/pipe_damage_data.csv
:header-rows: 1
:widths: auto
:align: center

In the table above, `time` defines the time when the pipe damage occurs, `pipe_id` is the damaged pipe ID in the **.inp** file which you provide in the input settings. `Damage_loc` is a number between 0 and 1 (not 0 or 1), showing the relative location of the damage to the beginning of the pipe. The beginning of the pipe is the first node with which the pipe is defined in the **.inp** file. The type of damage can be either **leak** or **break**. `Material` shows the pipe material. The material defines which pipe damage model is used.

Node-level Damage Data
----------------------

Node-level damage data is a table in which each row definss a damage location (a damaged demand node). An example of such table is as follows:

.. csv-table:: Node-level Damage Data
:file: /docs/tables/node_damage_data.csv
:header-rows: 1
:widths: auto
:align: center

In the table above, `time` defines the time when the node-level damage occurs, `node_id` is thw damaged demand ndoes ID in the **.inp** file which you provide in the input settings. `Number_of_damages` shows how many damages happened in the node-level damage location and
`node_Pipe_Length` defiens what is teh total length of pipes in the damage location.

Pump Damage Data
----------------

Pipe damage data is a table in which a each row defiens a damaged pump. The tables are saved in excel or Pandas DataFrame pickled into a binary file. An example of such table is as follows:

.. csv-table:: Pump Damage Data
:file: /docs/tables/Net3-pump-damage.csv
:header-rows: 1
:widths: auto
:align: center

In the table above, `time` defines the time when the pump damage occurs, `pump_id` is teh dmaged pump ID in the **.inp** file which you provide in the input settings, and `Restore_time` is the time when the pump is restored.

tank Damage Data
----------------

Tank damage data is a table in which a each row defiens a damaged tank. The tables are saved in excel or Pandas DataFrame pickled into a binary file. An example of such table is as follows:

.. csv-table:: Pump Damage Data
:file: /docs/tables/Net3_tank_damage.csv
:header-rows: 1
:widths: auto
:align: center

In the table above, `time` defines the time when the tank damage occurs, `tank_id` is teh dmaged pump ID in the **.inp** file which you provide in the input settings, and `Restore_time` is the time when the pump is restored.

Units and Tips
==============

Units
-----

Units used in REWET are SI units. Even units such as time are in seconds. This may lead to big and unintuitive numbers, especially when you are working with the results, but for a Python programmer, converting units should not be a difficult task, so we left that to the users.

Paths
-----

It's best practice to provide paths as absolute values. Absolute paths are such as ``"C:Users/[username]/Desktop/bluh_bluh.ext"`` in Windows and ``/user/bluh_bluh.ext`` in Linux/MacOS systems. You are absolutely free to use relative paths as well. Relative paths are such as ``"./my_project/bluh_bluh.ext"``. If you are using a relative path, please make sure that the path is relative to the current Python working directory.

Power Users
===========

The Settings module is the interface between the Input and Registry modules. One of the data that the Input module creates is an object of Settings, and then it is passed to the Registry module. Users who feel comfortable coding in Python may find it easier to modify the `setting.py` file directly instead of providing the input through REWET's input mechanism.
130 changes: 130 additions & 0 deletions _sources/docs/Restoration_Plan_Config_File.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
=================
Restoration Plan
=================


The restoration plan may be defined using sectiosn and directives. Sections includes:

* **[Files]** Files that are in tabulaetd data in it are storedin it.
* **[Sequences]** Defiens sequence of `Actions` that must be done for a damage of an element type, so that damage type is cosnidered restored.
* **[Damaege_Group]** Defiens damages groups made from elements and tehir damage types.
* **[Crews]** Crew data is defiend in this section.
* **[POINTS]** geographical point groups can be created in thsi sections.
* **[PRIORITIES]** restration pririties are defined here.
* **[JOBS]** Jobs definition are made in this section.
* **[DEFINE]** Job Effect definition is defined here.
* **[Group]** Groups are defien in thsi section.

Files
*****

Files are usedin other sections. Each file is defiend by its name and path. The structure of teh files are as follows
.. code-block::
<File handle> <File path>
in which `<file handle>` is the handle used in other sections and the `<file path>` is the relational or absolute path
of the file. The relative path is relative to teh restoration plan config file.

Sequences
*********

Each element is water distribution network (e.g., pipe, node, tanks, and pump) needs to have a series of `Action` so that
teh damage location is considerd restored. Each `Action` is a arbitary Action which later used in defining the restioration
`Priority`.

The format of the Sequence is as follows:::

<Element Type> <Action 1> ... <Action n>
.. note::
ELement types include:

* `PIPE`,
* `TANK`,
* `PUMP`, and
* `NODE`.

Please note that the element types are used in capital form.

An Example of a sequnce list of actions is as follows:::

PIPE drain repair repressurize

On this exampel you can define drain, repair and repressurize according to your network's and utilities capacity,
requirements and starndard operation proceddures.

Damage Groups
*************

teh user may create oen or more `damage groups`. A damage group is a group damage location of the same `element type` with
or without other attribute of the element the damage happens on. For instance, a damage group can be damage locations that
happen on a pipe (i.e., `element type==PIPE`) in which pipe has a diameter equal or bigger than 0.5 m (i.e., diameter>=0.5).
The user can create such damage groups according to their network's and utilities capacity, requirements and
starndard operation proceddures. Such damage groups are later used on `Priorities` definition alonside `Actions`.

The structure format of the damage groups are as follows:::
<Damaeg Group Name> <Element Type> <Attribute> <CONDITION 1>
.
.
.
<Damaeg Group Name> <Element Type> <Attribute> <CONDITION N>

.. note::

each line of adde condition connotes logical `AND`.

Conditon
---------

In REWET a condition is created with three values each sepearetd with one colon (i.e., "`:`"). The values are follows:::
<Attribute>:<Condition>:<Condition Value>

Attributes are as in the following table:

.. table:: Attributes in Damage Group
:widths: auto
:align: center

+------------+-----------------+-------------------------------------------------+
|Element Type| Attributes | Description |
+============+=================+=================================================+
|PIPE |DIAMETER | Diameter of teh pipe |
| | | |
| |FILE | Names of the element specified in ths file. |
| | | |
| |NOT_IN_FILE | Names of the element not specified in the file. |
+------------+-----------------+-------------------------------------------------+
| |Number_of_damages| Numebr of damages |
| | | |
|NODE |FILE | Names of the element specified in ths file. |
| | | |
| |NOT_IN_FILE | Names of the element not specified in the file. |
+------------+-----------------+-------------------------------------------------+
|TANK |FILE | Names of the element specified in ths file. |
| | | |
| |NOT_IN_FILE | Names of the element not specified in the file. |
+------------+-----------------+-------------------------------------------------+
|PUMP |FILE | Names of the element specified in ths file. |
| | | |
| |NOT_IN_FILE | Names of the element not specified in the file. |
+------------+-----------------+-------------------------------------------------+

Applicable Conditons are:
* EQ: equal,
* BT: bigger than,
* LT: less than,
* BE: bigger than or equal to,
* LE: less than or equal to,

.. note::

When File and NOT_IN_FILE are teh attributes, teh conditions can only be EQ, NE amnd teh values can be a file handle.

For the excamples above the Conditon will be:::
a_name PIPE DIAMETER:BE:0.5


2 changes: 2 additions & 0 deletions _sources/docs/WorkflowDescription.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Workflow Description
####################
5 changes: 5 additions & 0 deletions _sources/docs/cite.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
How To Cite
###########

For citation, pelase use the following::
``REWET: A Tool to Model System Functioning and Restoration of Damaged Water Supply Systems``, Sina Naeimi, Rachel Davidson, ASCE Journal of Infrastructure [In publihsing]
Loading

0 comments on commit 49ae70d

Please sign in to comment.