Skip to content

Commit 30f6b8c

Browse files
authored
Merge branch 'develop' into PhilipFackler/psse-parser
2 parents e88ab8f + 0d96a91 commit 30f6b8c

File tree

7 files changed

+183363
-112
lines changed

7 files changed

+183363
-112
lines changed

include/utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ extern "C" PetscErrorCode ExaGOInitialize(MPI_Comm, int *argc, char ***argv,
217217
* @note this takes care of Petsc finalization, so don't this function in
218218
* conjunction with `PetscFinalize`.
219219
*/
220-
extern "C" PetscErrorCode ExaGOFinalize();
220+
extern "C" void ExaGOFinalize();
221221

222222
/** Returns 1 if files exists, else 0 */
223223
bool DoesFileExist(const char *);

src/utils/utils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ static MPI_Comm ExaGOLogComm = MPI_COMM_SELF;
174174
PetscErrorCode ExaGOLogIsUsingLogFile(bool *flg) {
175175
#ifdef EXAGO_ENABLE_LOGGING
176176
*flg = ExaGOLogUseFile;
177+
#else
178+
*flg = false;
177179
#endif
178180
return 0;
179181
}
@@ -581,8 +583,7 @@ PetscErrorCode ExaGOInitialize(MPI_Comm comm, int *argc, char ***argv,
581583
return 0;
582584
}
583585

584-
PetscErrorCode ExaGOFinalize() {
585-
PetscFunctionBegin;
586+
void ExaGOFinalize() {
586587
ExaGOLog(EXAGO_LOG_INFO, "Finalizing {} application.", ExaGOCurrentAppName);
587588
MPI_Comm comm = MPI_COMM_WORLD;
588589
int my_rank;
@@ -602,7 +603,6 @@ PetscErrorCode ExaGOFinalize() {
602603
if (!initialized) {
603604
MPI_Finalize();
604605
}
605-
PetscFunctionReturn(0);
606606
}
607607

608608
#undef EXAGO_LOG_ENSURE_INITIALIZED

viz/README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ For example, with Texas 2000 bus synthetic data, executing the following `opflow
4646
opflow -netfile case_ACTIVSg2000.m -save_output -opflow_output_format JSON -gicfile ACTIVSg2000_GIC_data.gic
4747
```
4848

49-
Copy over the newly generated `opflowout.json` file to the `viz/data` subdirectory. Next, run the python script `geninputfile.py` from `viz` folder to load the JSON file in the visualization script. Note, the python script only takes the name of the file `opflowout.json` as an argument but does not open the file so the full file path need not be provided. The visualization tool will expect the file (`opflowout.json`) to be present in `viz/data` forlder. The following code will create/overwrite a file named `viz/src/module_casedata.js`. The `module_casedata.js` file is an application source file to load the data file `opflowout.json`.
49+
Next, go to the `viz` folder and run the following python script `geninputfile.py` from the `viz` folder to load the JSON file (`path/to/opflowout/opflowout.json`) in the visualization script. It will copy the `json` file to the `viz/data` subdirectory and create/overwrite a file named `viz/src/module_casedata.js`. The `module_casedata.js` file is an application source file to load the data file `opflowout.json`. Note, the visualization tool expects the file (`opflowout.json`) to be present in `viz/data` forlder, so it is copied by this script.
5050

5151
```
52-
python geninputfile.py opflowout.json
52+
python geninputfile.py path/to/opflowout/opflowout.json
5353
```
5454

55-
Now this creates the `viz/src/module_casedata.js` file. You are ready to launch the visualization now.
55+
Now you are ready to launch the visualization now.
5656

57-
Note: If you have created the JSON file externally then simply copy it over in the `viz/data` subdirectory and run the `geninputfile.py` script using the above command.
57+
Note: If you have already created or have the JSON file externally without running the `opflow` command as instructed above, simply run the `geninputfile.py` script using the above command.
5858

5959
## Launch visualization
6060
To launch the visualization, run
@@ -63,7 +63,7 @@ To launch the visualization, run
6363
yarn start
6464
```
6565

66-
This will open a webpage with the visualization of the given network. If the network is large, it may take a while to load the visualization. The browser may show option to terminate or Wait and you should click on Wait button.
66+
This will open a webpage (e.g. `http://localhost:5173/`) on the default browser with the visualization of the given network. If the network is large, it may take a while to load the visualization. The browser may show option to terminate or Wait and you should click on Wait button.
6767

6868

6969
The figures show the visualization of the synthetic electric grid. The data for developing this visualization was created by merging the synthetic dataset for the [Eastern](https://electricgrids.engr.tamu.edu/electric-grid-test-cases/activsg70k/), [Western](https://electricgrids.engr.tamu.edu/electric-grid-test-cases/activsg10k/), and [Texas](https://electricgrids.engr.tamu.edu/electric-grid-test-cases/activsg2000/) interconnects from the [Electric Grid Test Case Repository](https://electricgrids.engr.tamu.edu/)
@@ -107,9 +107,10 @@ Behind the scenes, LLM translates natural language queries into SQL queries to r
107107
* Go to the `viz/backend` subdirectory and use the `pip install -r requirements.txt` command to install all the Python dependencies if already not done in previous steps. (Note: These steps are tested with Python 3.13.)
108108

109109

110-
To use the provided script, first copy the ExaGO output `.json` file to the `viz/data` subdirectory (if not already performed) and simply run the following script in the `viz/backend` subdirectory (replace the example filename with your json filename). This will create three CSV files: `generation.csv`, `bus.csv`, and `tranmission_line.csv`. We are assuming `opflowout.json` is the data json file present in `viz/data` folder.
110+
To use the provided script, ensure that the ExaGO output `.json` file is in the `viz/data` subdirectory (if not already performed in the previous steps) and run the following script in the `viz/backend` subdirectory (replace the example filename with your json filename). This will create three CSV files: `generation.csv`, `bus.csv`, and `tranmission_line.csv`. We are assuming `opflowout.json` is the data json file present in `viz/data` folder.
111111

112112
```
113+
cd viz/backend
113114
python ../data/jsontocsv.py ../data/opflowout.json
114115
```
115116
@@ -125,9 +126,11 @@ Behind the scenes, LLM translates natural language queries into SQL queries to r
125126
2. Download PostgreSQL database from this [link](https://www.postgresql.org/download/) and install it.
126127
127128
* For MAC using brew you can install postgresql 14 using: `brew install postgresql@14`
128-
* Start the postgressql service: `rew services start postgresql@14`
129+
* Start the postgressql service: `brew services start postgresql@14`
129130
* Create a role: `psql -U "$USER" -d postgres`
131+
* If your username (`$USER`) starts with numbers `psql` will show error. In this case replace `$USER` to some other username.
130132
* Execute the create role query: `CREATE ROLE postgres WITH LOGIN SUPERUSER PASSWORD 'ExaGO.2025';` Here `ExaGO.2025` is a password. Change to your preference.
133+
* If you forget the password, you can update it by running `ALTER USER user_name WITH PASSWORD 'new_password';` (replace `user_name` and `new_password`)
131134
* Exit to shell by entering `quit` and hitting Enter.
132135
* From command prompt type: `psql -U postgres -d postgres` If it works and you are in `psql` shell you are done. Exit from the shell using `quit`.
133136
@@ -144,7 +147,9 @@ Behind the scenes, LLM translates natural language queries into SQL queries to r
144147
145148
c. Include US state and county information in your database to support spatial queries that related to state or county.
146149
147-
d. To enter the CSV files into database using command prompt do: `PGPASSWORD=ExaGO.2025 ./create_db.sh --db exago_db --schema-sql ./schema.sql --drop --truncate`. Here `exago_70k` is the database name. Use it in the configuration `config.py` file.
150+
d. To enter the CSV files into database using command prompt do: `PGPASSWORD=ExaGO.2025 ./create_db.sh --db exago_db --schema-sql ./schema.sql --drop --truncate`. Here `exago_db` is the database name. Use it in the configuration `config.py` file.
151+
152+
* If you used different user name than `$USER` then use the following command: `PGUSER=user_name PGPASSWORD=ExaGO.2025 ./create_db.sh --db exago_db --schema-sql ./schema.sql --drop --truncate` (replace `user_name` with your user name.)
148153
149154
e. This will create a database named `exago_db` with password `ExaGO.2025`. This information will be used to update the `config.py` file.
150155

0 commit comments

Comments
 (0)