Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
49951ec
Formatting and 'const' clean up in Caldera_ICM (more of this to come)
steven-schmidt-inl Jan 11, 2024
9ec71c9
Clean up to replace vec[i] with vec.at(i) in ICM_interface.cpp
steven-schmidt-inl Jan 12, 2024
90ceb5a
Another round of 'const' clean-up in Caldera_ICM
steven-schmidt-inl Jan 22, 2024
8167929
Clean-up in a few more files.
steven-schmidt-inl Jan 24, 2024
c9a9d1a
Fixed initialization bugs in 'datatypes_global.h' and other clean-ups.
steven-schmidt-inl Feb 1, 2024
ebb2282
More clean-ups. Also throwing an exception in one spot if it's bad i…
steven-schmidt-inl Feb 5, 2024
bd21329
Small change -- a few more curly brackets added.
steven-schmidt-inl Feb 6, 2024
af31faf
Fixing const bug/issue after rebase in 'supply_equipment_load.h' and …
steven-schmidt-inl Feb 7, 2024
0f99b59
Fixing bug preventing correct charge-event-id from being printed
steven-schmidt-inl Feb 7, 2024
dba8d5c
HPC compilation fix
manoj1511 Mar 28, 2024
c541966
changes to timeseries
manoj1511 Apr 1, 2024
5c4f07e
Saving EV peak power in EV_characteristics
manoj1511 Apr 3, 2024
ab695fc
Adding utility function 'get_val_from_time_with_default' to timeseres…
steven-schmidt-inl Apr 4, 2024
9566fca
Created templated data type object 'time_series_v2' which will eventu…
steven-schmidt-inl Apr 10, 2024
5ed3d39
Forgot an #include in unittests/test_datatypes/test_datatypes.cpp
steven-schmidt-inl Apr 10, 2024
80d1075
updated process doc
manoj1511 May 15, 2024
8e4deee
install a test executable in test folder instead of main folder
manoj1511 May 15, 2024
25327dd
brought a test in source dir to running state
manoj1511 May 15, 2024
5b6ea68
delete some junk from python bind file
manoj1511 May 15, 2024
1cf9a69
a new folder with example script for next gen profile project
manoj1511 May 15, 2024
7f75a88
Update .gitignore
skallajeINL May 15, 2024
59b0020
Remove test folder
manoj1511 Jun 3, 2024
7cd3f1d
create examples to use ICM for Next gen project
manoj1511 Jun 4, 2024
a378a1a
Minor bug
manoj1511 Jun 4, 2024
7ca8b43
Another minor bug
manoj1511 Jun 4, 2024
a4d07a4
Making sure output file name matches executable name (same capitaliza…
steven-schmidt-inl Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ find_package(pybind11 CONFIG)

add_subdirectory(source)
add_subdirectory(unittests)
add_subdirectory(test)
add_subdirectory(misc)
Binary file added docs/charging_model_process.pptx
Binary file not shown.
Binary file removed docs/new_interface.pptx
Binary file not shown.
1 change: 1 addition & 0 deletions misc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(next_gen_prof_testing)
2 changes: 2 additions & 0 deletions misc/next_gen_prof_testing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.csv
*.exe
22 changes: 22 additions & 0 deletions misc/next_gen_prof_testing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
add_executable(ICM_Full ICM_Full.cpp)
target_link_libraries(ICM_Full Charging_models Load_inputs factory Base)
target_compile_features(ICM_Full PUBLIC cxx_std_17)
target_include_directories(ICM_Full PUBLIC ${PROJECT_SOURCE_DIR}/source/base)
target_include_directories(ICM_Full PUBLIC ${PROJECT_SOURCE_DIR}/source/charging_models)
target_include_directories(ICM_Full PUBLIC ${PROJECT_SOURCE_DIR}/source/factory)
target_include_directories(ICM_Full PUBLIC ${PROJECT_SOURCE_DIR}/source/load_inputs)

install(TARGETS ICM_Full
DESTINATION ${PROJECT_SOURCE_DIR}/misc/next_gen_prof_testing)

add_executable(ICM_Aux ICM_Aux.cpp )
target_link_libraries(ICM_Aux Charging_models Load_inputs factory Base_aux)
target_compile_features(ICM_Aux PUBLIC cxx_std_17)
target_include_directories(ICM_Aux PUBLIC ${PROJECT_SOURCE_DIR}/source/base)
target_include_directories(ICM_Aux PUBLIC ${PROJECT_SOURCE_DIR}/source/charging_models)
target_include_directories(ICM_Aux PUBLIC ${PROJECT_SOURCE_DIR}/source/factory)
target_include_directories(ICM_Aux PUBLIC ${PROJECT_SOURCE_DIR}/source/load_inputs)

install(TARGETS ICM_Aux
DESTINATION ${PROJECT_SOURCE_DIR}/misc/next_gen_prof_testing)

161 changes: 161 additions & 0 deletions misc/next_gen_prof_testing/ICM_Aux.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#include "Aux_interface.h"
#include <filesystem>


int build_entire_charge_profile_using_ICM()
{

std::string path_to_inputs = "./inputs";

//######################################################
//# Build Charge Profile Given Start and End SOC
//######################################################

double L1_timestep_sec = 1; // Timestep for Level 1 charger
double L2_timestep_sec = 1; // Timestep for Level 2 charger
double HPC_timestep_sec = 1; // Timestep for High Power charger
EV_ramping_map ramping_by_pevType_only{}; // Custom Ramping
EV_EVSE_ramping_map ramping_by_pevType_seType{}; // Custom Ramping

CP_interface_v2 ICM_v2{
path_to_inputs,
L1_timestep_sec,
L2_timestep_sec,
HPC_timestep_sec,
ramping_by_pevType_only,
ramping_by_pevType_seType
};

std::string pev_type = "bev250_350kW";
std::string SE_type = "xfc_350";
double start_soc = 10;
double end_soc = 90;

all_charge_profile_data all_profile_data = ICM_v2.get_all_charge_profile_data(start_soc, end_soc, pev_type, SE_type);

double start_time_sec = 0;

// Write output
// build the files header
std::string header = "time | hrs,SOC | ,P1 | kW, P2 | kW, P3 | kW, Q3 | kVAR\n";

std::string data = "";

for (int i = 0; i < all_profile_data.soc.size(); i++)
{
data += std::to_string((start_time_sec + i* all_profile_data.timestep_sec)/3600.0) + ",";
data += std::to_string(all_profile_data.soc[i]) + ",";
data += std::to_string(all_profile_data.P1_kW[i]) + ",";
data += std::to_string(all_profile_data.P2_kW[i]) + ",";
data += std::to_string(all_profile_data.P3_kW[i]) + ",";
data += std::to_string(all_profile_data.Q3_kVAR[i]) + "\n";

}

std::ofstream f_out;
f_out.open("./outputs/ICM_Aux_output.csv");
f_out << header << data;
f_out.close();

return 0;
}

int estimate_charging_parameters_using_ICM()
{
std::string path_to_inputs = "./inputs";
CP_interface ICM_v1{ path_to_inputs, false };

double setpoint_P3kW = 1000;
std::string pev_type = "bev250_350kW";
std::string SE_type = "xfc_350";


double startSOC, endSOC, charge_time_hrs;
std::vector<double> endSOC_vec, charge_time_hrs_vec;
//----------------------------------------
// find_result_given_startSOC_and_endSOC
//----------------------------------------

startSOC = 20;
endSOC = 85;
pev_charge_profile_result X0 = ICM_v1.find_result_given_startSOC_and_endSOC(pev_type, SE_type, setpoint_P3kW, startSOC, endSOC);

std::cout << "-----------------------------------" << "\n";
std::cout << "find_result_given_startSOC_and_endSOC" << "\n";
std::cout << "------------------------------------" << "\n";
std::cout << "startSOC: " << startSOC << " endSOC: " << endSOC << "\n";
std::cout << "soc_increase: " << X0.soc_increase << " total_time_hrs: " << X0.total_charge_time_hrs << " incr_time_hrs : " << X0.incremental_chage_time_hrs << "\n";
std::cout << "\n" << "\n";


//-------------------------------------------
// find_result_given_startSOC_and_chargeTime
//-------------------------------------------
startSOC = 20;
charge_time_hrs = 15.0 / 60.0;
pev_charge_profile_result X1 = ICM_v1.find_result_given_startSOC_and_chargeTime(pev_type, SE_type, setpoint_P3kW, startSOC, charge_time_hrs);

std::cout << "-----------------------------------" << "\n";
std::cout << "find_result_given_startSOC_and_chargeTime" << "\n";
std::cout << "------------------------------------" << "\n";
std::cout << "startSOC: " << startSOC << " charge_time_hrs: " << charge_time_hrs << "\n";
std::cout << "soc_increase: " << X1.soc_increase << " total_time_hrs: " << X1.total_charge_time_hrs << " incr_time_hrs : " << X1.incremental_chage_time_hrs << "\n";
std::cout << "\n" << "\n";


//------------------------------------------------
// find_chargeProfile_given_startSOC_and_endSOCs
//------------------------------------------------
startSOC = 20;
endSOC_vec = { 30, 40, 50, 60, 70, 80, 90, 100 };
std::vector<pev_charge_profile_result> X2 = ICM_v1.find_chargeProfile_given_startSOC_and_endSOCs(pev_type, SE_type, setpoint_P3kW, startSOC, endSOC_vec);

std::cout << "-----------------------------------" << "\n";
std::cout << "find_chargeProfile_given_startSOC_and_endSOCs" << "\n";
std::cout << "------------------------------------" << "\n";
std::cout << "startSOC: " << startSOC << " endSOCs: ";
for ( double endSOC : endSOC_vec )
{
std::cout << endSOC << " ";
}
std::cout << "\n";
for (pev_charge_profile_result x : X2)
{
std::cout << "soc_increase: " << x.soc_increase << " total_time_hrs: " << x.total_charge_time_hrs << " incr_time_hrs : " << x.incremental_chage_time_hrs << "\n";
}
std::cout << "\n" << "\n";


//------------------------------------------------
// find_chargeProfile_given_startSOC_and_chargeTimes
//------------------------------------------------
startSOC = 20;
charge_time_hrs_vec = { 5.0 / 60.0, 10.0 / 60.0, 15.0 / 60.0, 20.0 / 60.0, 25.0 / 60.0, 30.0 / 60.0, 35.0 / 60.0, 40.0 / 60.0, 45.0 / 60.0, 50.0 / 60.0, 60.0 / 60.0 };
std::vector<pev_charge_profile_result> X3 = ICM_v1.find_chargeProfile_given_startSOC_and_chargeTimes(pev_type, SE_type, setpoint_P3kW, startSOC, charge_time_hrs_vec);

std::cout << "-----------------------------------" << "\n";
std::cout << "find_chargeProfile_given_startSOC_and_chargeTimes" << "\n";
std::cout << "------------------------------------" << "\n";
std::cout << "startSOC: " << startSOC << " charge_time_hrs: ";
for (double charge_time_hrs : charge_time_hrs_vec)
{
std::cout << charge_time_hrs << " ";
}
std::cout << "\n";
for (pev_charge_profile_result x : X3)
{
std::cout << "soc_increase: " << x.soc_increase << " total_time_hrs: " << x.total_charge_time_hrs << " incr_time_hrs : " << x.incremental_chage_time_hrs << "\n";
}
std::cout << "\n" << "\n";

return 0;
}

int main()
{
int return_code = 0;
return_code += build_entire_charge_profile_using_ICM();
return_code += estimate_charging_parameters_using_ICM();

return 0;
}
49 changes: 49 additions & 0 deletions misc/next_gen_prof_testing/ICM_Aux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
import os
import sys
import pandas as pd
import numpy as np

path_to_here = os.path.abspath(os.path.dirname(sys.argv[0]))
path_to_libs = os.path.join(path_to_here, "..", "..", "libs")
path_to_inputs = os.path.join(path_to_here, "inputs")

index = 1
sys.path.insert( index+0, path_to_libs )

from Caldera_ICM_Aux import CP_interface_v2
from Caldera_globals import all_charge_profile_data


######################################################
# Build Charge Profile Given Start and End SOC
######################################################

L1_timestep_sec = 1
L2_timestep_sec = 1
HPC_timestep_sec = 1
ramping_by_pevType_only = {}
ramping_by_pevType_seType = {}

ICM = CP_interface_v2(path_to_inputs, L1_timestep_sec, L2_timestep_sec, HPC_timestep_sec, ramping_by_pevType_only, ramping_by_pevType_seType)

pev_type = "bev250_350kW"
SE_type = "xfc_350"
start_soc = 10
end_soc = 90

all_profile_data = ICM.get_all_charge_profile_data(start_soc, end_soc, pev_type, SE_type)

start_time = 0
end_time = len(all_profile_data.P1_kW) * all_profile_data.timestep_sec

df = pd.DataFrame()
df["time | sec"] = np.arange(start_time, end_time, all_profile_data.timestep_sec)
df["SOC | "] = all_profile_data.soc
df["P1 | kW"] = all_profile_data.P1_kW
df["P2 | kW"] = all_profile_data.P2_kW
df["P3 | kW"] = all_profile_data.P3_kW
df["Q3 | kVAR"] = all_profile_data.Q3_kVAR

df.to_csv("{}_{}_{}_{}.csv".format(pev_type, SE_type, start_soc, end_soc), index = False)

Loading