Skip to content

Commit ea3e8ff

Browse files
authored
Merge pull request #8 from idaholab/develop
Develop
2 parents 0c68e4d + dd9b886 commit ea3e8ff

13 files changed

+130
-50
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ build/
1111
#error files and output files
1212
inputs/*error*
1313
outputs/*.csv
14+
15+
CMakeSettings.json
16+
.vs/

.gitmodules

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[submodule "extern/caldera_charge_icm"]
2-
path = extern/caldera_charge_icm
3-
url = https://hpcgitlab.hpc.inl.gov/caldera_charge/caldera_charge_icm.git
4-
branch = main
1+
[submodule "extern/Caldera_ICM"]
2+
path = extern/Caldera_ICM
3+
url = https://github.com/idaholab/Caldera_ICM.git

CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.5)
22

33
project(Grid)
44

5+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
6+
57
# Check to see PROJECT cmake variable is set
68
if (NOT DEFINED PROJECT)
79
message(WARNING "PROJECT cmake variable not set defaulting to emosiac project")
@@ -13,9 +15,7 @@ if (NOT (${PROJECT} STREQUAL "eMosaic" OR ${PROJECT} STREQUAL "EVs_at_Risk" OR $
1315
message(FATAL_ERROR "PROJECT cmake variable must be equal to eMosaic or EVs_at_Risk or DirectXFC")
1416
endif()
1517

16-
1718
# Find pybind11
18-
1919
find_package(pybind11 CONFIG)
2020

2121
# Update submodules
@@ -33,7 +33,7 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
3333
endif()
3434
endif()
3535

36-
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/caldera_charge_icm/CMakeLists.txt")
36+
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/Caldera_ICM/CMakeLists.txt")
3737
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
3838
endif()
3939

@@ -43,4 +43,4 @@ SET(INSTALL_DIR ${PROJECT_SOURCE_DIR}/libs)
4343

4444
# Add subdirs to compile the necessary binaries
4545
add_subdirectory(source/ES500)
46-
add_subdirectory(extern/caldera_charge_icm)
46+
add_subdirectory(extern/Caldera_ICM)

README.md

+104-31
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,120 @@
1-
# Caldera_Charge_Grid
1+
# Caldera_Grid
22

33
Caldera and OpenDSS co-simulation platform using HELICS
44

55
## Overview
6-
Caldera Grid enables modeling EV charging on the electric grid. Caldera Grid cosimulation platform is built using HELICS (Hierarchical Engine for Large Scale Infrastructure Co-simulation) and cosimulates Caldera ICM with OpenDSS. The platfrom also provides an interface to apply custom control strategies to EV charge events.
6+
Caldera Grid enables modeling EV charging on the electric grid. Caldera Grid co-simulation platform is built using HELICS (Hierarchical Engine for Large Scale Infrastructure Co-simulation) and cosimulates Caldera ICM with OpenDSS. The platfrom also provides an interface to apply custom control strategies to EV charge events.
77

8-
## Prerequisites
9-
10-
Caldera Grid depends on `C++ compiler`, `git`, `cmake`, `python` and `pybind11` to compile.
118

129
## Installation
1310

14-
Get a copy of Caldera ICM.
15-
```
16-
git clone https://hpcgitlab.hpc.inl.gov/caldera_charge/caldera_charge_grid.git
17-
```
18-
If you are interested in the most up to date version of Caldera ICM, the development version is available in the `develop` branch.
19-
```
20-
git switch develop
21-
```
22-
To install Caldera Grid using cmake
23-
```
24-
cd caldera_charge_grid
25-
mkdir build
26-
cmake -DPROJECT=<PROJECT_NAME> -DICM=<ON/OFF> ../
27-
make
28-
make install
29-
```
30-
If cmake cannot find C++ compiler, python or pybind11. They need to be pointed to its installed paths to find them. Refer to [pybind11](https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake) and [cmake](https://cmake.org/cmake/help/latest/guide/tutorial/index.html) documentations.
31-
32-
33-
Caldera Grid compiles the Caldera ICM submodule and installs compiled python libraries in the `libs/` folder.
34-
35-
`-DPROJECT` flag is used to specify the project specific EV-EVSE models to be used. Options are `DirectXFC`, `eMosaic` and `EVs_at_Risk`. `-DICM` flag turns ON/OFF compiling `Caldera_ICM` lib. Please refer to Caldera ICM project for more information with respect to Caldera ICM compilation.
11+
### Windows
12+
13+
The installation approach for windows is only a suggested approach which is well tested
14+
15+
16+
#### Prerequisites
17+
18+
Caldera Grid has the following requirements to be able to compile on windows
19+
20+
1. Install git for windows
21+
2. Install Anaconda
22+
3. Install visual studio with C++ and cmake
23+
24+
#### Anaconda environment setup
25+
26+
1. Open anaconda prompt
27+
2. Create a new conda environment
28+
```
29+
conda create -n Caldera python=3.9 # (recommended version >= 3.7.0)
30+
```
31+
3. Activate the new conda environment
32+
```
33+
conda activate Caldera
34+
```
35+
4. Install required python packages
36+
```
37+
conda install pybind11 # (recommended version >= 2.10)
38+
conda install numpy # (recommended version >= 1.23.5)
39+
conda install pandas # (recommended version >= 1.5.2)
40+
conda install cvxopt # (recommended version >= 1.2.6)
41+
pip install "OpenDSSDirect.py[extras]" # (recommended version >= 0.7.0)
42+
pip install helics # (recommended version >= 3.4.0)
43+
```
44+
45+
#### Download Caldera Grid
46+
47+
1. open git for windows
48+
2. navigate to desired folder where you would like to download Caldera Grid
49+
```
50+
cd <path_to_desired_download_folder>
51+
```
52+
3. clone Caldera Grid from Github
53+
```
54+
git clone https://github.com/idaholab/Caldera_Grid.git
55+
```
56+
4. Swich to develop branch. Develop branch has the most recent updates and bug fixes for Caldera Grid
57+
```
58+
git switch develop
59+
```
60+
61+
#### Compile Caldera Grid
62+
63+
1. Open the downloaded Caldera Grid folder in Visual Studio
64+
```
65+
File -> Open -> Folder -> <path_to_Caldera_Grid>
66+
```
67+
2. Open CMakeSettings.json
68+
```
69+
Project -> CMake Settings
70+
```
71+
3. Set flages for the cmake compilation process in the CMake command arguments test box
72+
```
73+
-DPROJECT=eMosaic -DICM=ON -DPYTHON_EXECUTABLE=<path_to_anaconda3>\envs\<env_name>\python.exe -Dpybind11_DIR=<path_to_anaconda3>\envs\<env_name>\Library\share\cmake\pybind11
74+
```
75+
- PROJECT - options are DirectXFC, eMosaic and EVs_at_Risk
76+
- ICM - needs to be ON, Caldera_Grid needs ICM module
77+
4. Configure CMake
78+
- Saving CMakeSettings.json will kick off the configuration in the output tab
79+
5. Build libraries
80+
```
81+
build -> build all
82+
```
83+
6. Install libraries
84+
```
85+
build -> Install Grid
86+
```
87+
88+
#### Running Caldera Grid
89+
90+
1. Open Anaconda prompt
91+
2. Navigate to project folder
92+
```
93+
cd <path_to_Caldera_Grid>
94+
```
95+
3. Activate Anaconda environment
96+
```
97+
conda activate Caldera
98+
```
99+
4. Run simulation
100+
```
101+
python start_execution.py
102+
```
103+
104+
- `start_execution.py` is set up to run a simple example of EVs charging on the IEEE 34 node test feeder.
105+
106+
107+
__NOTE :__ If the excution takes longer time to run, Try using release mode to build
36108

37109
## Usage
38110
Please refer to [usage documentation](https://hpcgitlab.hpc.inl.gov/caldera_charge/caldera_charge_grid/-/raw/main/docs/Caldera-OpenDSS%20simulation%20platform.pptx) to learn on how to use the tool.
39111

40-
`start_execution.py` is set up to run a simple example of EVs charging on the IEEE 34 node test feeder.
112+
## Citation
113+
If you use Caldera Grid in your research, please cite:
114+
115+
Sundarrajan, Manoj Kumar Cebol, Scoffield, Don R, Rumsey, Paden D, & USDOE Office of Nuclear Energy. (2022, December 13). idaholab/Caldera_Grid [Computer software]. https://www.osti.gov//servlets/purl/1907411. https://doi.org/10.11578/dc.20230103.3
116+
41117

42118
## Authors
43119
1. Don Scoffield, Senior Research Engineer, Idaho National Laboratory
44120
2. Manoj Sundarrajan, Research Software Developer, Idaho National Laboratory
45-
46-
## License
47-
For open source projects, say how it is licensed.

extern/Caldera_ICM

Submodule Caldera_ICM added at d261daa

extern/caldera_charge_icm

-1
This file was deleted.

source/ES500/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(GLOBALS_DIR ${PROJECT_SOURCE_DIR}/extern/caldera_charge_icm/source/charging_models)
1+
set(GLOBALS_DIR ${PROJECT_SOURCE_DIR}/extern/Caldera_ICM/source/charging_models)
22

33
pybind11_add_module(ES500_Aggregator_Helper ${GLOBALS_DIR}/datatypes_global.cpp
44
${GLOBALS_DIR}/${PROJECT}/datatypes_global_SE_EV_definitions.cpp

source/ES500/ES500_aggregator_helper.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ class ES500_aggregator_allocate_energy_to_PEVs
2525
int index;
2626
double charge_progression;
2727

28-
bool operator < (const SE_priority_element& rhs)
28+
bool operator<(const SE_priority_element& rhs) const
29+
{
30+
return this->charge_progression < rhs.charge_progression;
31+
}
32+
33+
bool operator<(SE_priority_element& rhs) const
2934
{
3035
return this->charge_progression < rhs.charge_progression;
3136
}

source/base/load_input_files.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def __get_supply_equipment_data(self, SE_data_file_path):
507507
if len(errors) == 0:
508508
grid_node_id_col_name = elements[4].strip()
509509
location_type_col_name = elements[6].strip()
510-
df = pd.read_csv(SE_data_file_path, sep=',', header=0, dtype={grid_node_id_col_name:np.str, location_type_col_name:np.str})
510+
df = pd.read_csv(SE_data_file_path, sep=',', header=0, dtype={grid_node_id_col_name:str, location_type_col_name:str})
511511

512512
if len(df.columns) != number_of_fields:
513513
errors.append('NA, There must be {} columns in file.'.format(number_of_fields))

source/federates/Caldera_ICM_federate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def caldera_ICM_federate(base_dir, json_config_file_name, simulation_time_constr
1212
config_file_path = base_dir + "/source/helics_config/" + json_config_file_name
1313
fed = h.helicsCreateCombinationFederateFromConfig(config_file_path)
1414

15-
sub_data_loaded = h.helicsFederateGetSubscription(fed, 'Load_Input_Files/data_loaded')
16-
sub_dss_simulation_loaded = h.helicsFederateGetSubscription(fed, 'OpenDSS/dss_simulation_loaded')
15+
sub_data_loaded = h.helicsFederateGetInputByTarget(fed, 'Load_Input_Files/data_loaded')
16+
sub_dss_simulation_loaded = h.helicsFederateGetInputByTarget(fed, 'OpenDSS/dss_simulation_loaded')
1717

1818
input_datasets_endpoint_local = h.helicsFederateGetEndpoint(fed, "input_datasets_endpoint")
1919
input_datasets_endpoint_remote = h.helicsEndpointGetDefaultDestination(input_datasets_endpoint_local)

source/federates/OpenDSS_federate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def open_dss_federate(base_dir, json_config_file_name, simulation_time_constrain
1111
config_file_path = base_dir + "/source/helics_config/" + json_config_file_name
1212
fed = h.helicsCreateCombinationFederateFromConfig(config_file_path)
1313

14-
sub_data_loaded = h.helicsFederateGetSubscription(fed, 'Load_Input_Files/data_loaded')
14+
sub_data_loaded = h.helicsFederateGetInputByTarget(fed, 'Load_Input_Files/data_loaded')
1515
pub_dss_simulation_loaded = h.helicsFederateGetPublication(fed, 'dss_simulation_loaded')
1616

1717
input_datasets_endpoint_local = h.helicsFederateGetEndpoint(fed, "input_datasets_endpoint")

source/federates/typeA_control_federate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def typeA_control_federate(base_dir, json_config_file_name, simulation_time_cons
99
config_file_path = base_dir + "/source/helics_config/" + json_config_file_name
1010
fed = h.helicsCreateCombinationFederateFromConfig(config_file_path)
1111

12-
sub_data_loaded = h.helicsFederateGetSubscription(fed, 'Load_Input_Files/data_loaded')
13-
sub_dss_simulation_loaded = h.helicsFederateGetSubscription(fed, 'OpenDSS/dss_simulation_loaded')
12+
sub_data_loaded = h.helicsFederateGetInputByTarget(fed, 'Load_Input_Files/data_loaded')
13+
sub_dss_simulation_loaded = h.helicsFederateGetInputByTarget(fed, 'OpenDSS/dss_simulation_loaded')
1414

1515
input_datasets_endpoint_local = h.helicsFederateGetEndpoint(fed, "input_datasets_endpoint")
1616
input_datasets_endpoint_remote = h.helicsEndpointGetDefaultDestination(input_datasets_endpoint_local)

source/federates/typeB_control_federate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def typeB_control_federate(base_dir, json_config_file_name, simulation_time_cons
1010
config_file_path = base_dir + "/source/helics_config/" + json_config_file_name
1111
fed = h.helicsCreateCombinationFederateFromConfig(config_file_path)
1212

13-
sub_data_loaded = h.helicsFederateGetSubscription(fed, 'Load_Input_Files/data_loaded')
14-
sub_dss_simulation_loaded = h.helicsFederateGetSubscription(fed, 'OpenDSS/dss_simulation_loaded')
13+
sub_data_loaded = h.helicsFederateGetInputByTarget(fed, 'Load_Input_Files/data_loaded')
14+
sub_dss_simulation_loaded = h.helicsFederateGetInputByTarget(fed, 'OpenDSS/dss_simulation_loaded')
1515

1616
input_datasets_endpoint_local = h.helicsFederateGetEndpoint(fed, "input_datasets_endpoint")
1717
input_datasets_endpoint_remote = h.helicsEndpointGetDefaultDestination(input_datasets_endpoint_local)

0 commit comments

Comments
 (0)