Skip to content

Commit

Permalink
Merge branch 'develop' into sco2_dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
tyneises committed Mar 31, 2023
2 parents ac0e17e + a7606d1 commit ca05605
Show file tree
Hide file tree
Showing 67 changed files with 35,919 additions and 35,957 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -76,7 +76,7 @@ jobs:
${{env.SSCDIR}}/build/ssc/ssc.so
build-on-mac:
runs-on: macos-11
runs-on: macos-latest

steps:
- name: Setup cmake
Expand Down
1 change: 1 addition & 0 deletions shared/lib_battery_dispatch_automatic_btm.cpp
Expand Up @@ -36,6 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "lib_shared_inverter.h"

#include <math.h>
#include <memory>

dispatch_automatic_behind_the_meter_t::dispatch_automatic_behind_the_meter_t(
battery_t * Battery,
Expand Down
4 changes: 2 additions & 2 deletions shared/lib_battery_powerflow.cpp
Expand Up @@ -884,7 +884,6 @@ void BatteryPowerFlow::calculateDCConnected()
}

if (m_BatteryPower->isOutageStep) {
P_pv_to_load_ac = P_pv_ac;
if (P_pv_ac >= P_crit_load_ac + P_ac_losses)
{
P_pv_to_load_ac = P_crit_load_ac;
Expand All @@ -895,7 +894,8 @@ void BatteryPowerFlow::calculateDCConnected()
P_interconnection_loss_ac = P_pv_ac - P_pv_to_load_ac - P_ac_losses;
}
else {
P_batt_to_load_ac = std::fmin(P_battery_ac_post_loss, P_crit_load_ac - P_pv_to_load_ac);
P_pv_to_load_ac = std::fmax(0, std::fmin(P_pv_ac, P_crit_load_ac));
P_batt_to_load_ac = std::fmax(0, std::fmin(P_battery_ac_post_loss, P_crit_load_ac - P_pv_to_load_ac));
P_batt_to_grid_ac = P_battery_ac_post_loss - P_batt_to_load_ac;
}

Expand Down
3 changes: 2 additions & 1 deletion shared/lib_geothermal.cpp
Expand Up @@ -1485,7 +1485,8 @@ double CGeothermalAnalyzer::GetPlantBrineEffectiveness(void)
// double dAEMaxPossible = (geothermal::IMITATE_GETEM) ? GetAEBinary() - GetAEBinaryAtTemp(TamphSiO2) : GetAE() - dAE_At_Exit; // watt-hr/lb - [10B.GeoFluid].H54 "maximum possible available energy accounting for the available energy lost due to a silica constraint on outlet temperature"

mp_geo_out->max_secondlaw = (1 - ((geothermal::IMITATE_GETEM) ? GetAEBinaryAtTemp(TamphSiO2) / GetAEBinary() : dAE_At_Exit / GetAE()) - 0.375);
double dMaxBinaryBrineEffectiveness = ((geothermal::IMITATE_GETEM) ? GetAEBinary() : GetAE()) * ((GetTemperaturePlantDesignC() < 150) ? 0.14425 * exp(0.008806 * GetTemperaturePlantDesignC()) : mp_geo_out->max_secondlaw);
//double dMaxBinaryBrineEffectiveness = ((geothermal::IMITATE_GETEM) ? GetAEBinary() : GetAE()) * ((GetTemperaturePlantDesignC() < 150) ? 0.14425 * exp(0.008806 * GetTemperaturePlantDesignC()) : mp_geo_out->max_secondlaw);
double dMaxBinaryBrineEffectiveness = ((geothermal::IMITATE_GETEM) ? GetAEBinary() : GetAE()) * (mp_geo_out->max_secondlaw);

return (mo_geo_in.me_ct == FLASH) ? FlashBrineEffectiveness() : dMaxBinaryBrineEffectiveness * mo_geo_in.md_PlantEfficiency;
}
Expand Down
4 changes: 4 additions & 0 deletions shared/lib_irradproc.cpp
Expand Up @@ -2060,6 +2060,10 @@ void irrad::setup() {

calculatedDirectNormal = directNormal;
calculatedDiffuseHorizontal = 0.0;
poaRearGroundReflected = 0.;
poaRearDirectDiffuse = 0.;
poaRearRowReflections = 0.;
poaRearSelfShaded = 0.;
}

irrad::irrad() {
Expand Down
9 changes: 7 additions & 2 deletions shared/lib_pv_io_manager.cpp
Expand Up @@ -211,6 +211,7 @@ Irradiance_IO::Irradiance_IO(compute_module* cm, std::string cmName)

void Irradiance_IO::checkWeatherFile(compute_module* cm, std::string cmName)
{
size_t num_alb_errors = 0;
for (size_t idx = 0; idx < numberOfWeatherFileRecords; idx++)
{
if (!weatherDataProvider->read(&weatherRecord))
Expand Down Expand Up @@ -275,11 +276,13 @@ void Irradiance_IO::checkWeatherFile(compute_module* cm, std::string cmName)
}
if (useWeatherFileAlbedo && (weatherRecord.alb <= 0 || weatherRecord.alb >= 1))
{
cm->log(util::format("Out of range albedo %lg at time [y:%d m:%d d:%d h:%d minute:%lg], using monthly value",
weatherRecord.alb, weatherRecord.year, weatherRecord.month, weatherRecord.day, weatherRecord.hour, weatherRecord.minute), SSC_WARNING, (float)idx);
num_alb_errors++;
weatherRecord.alb = 0;
}
}
if (num_alb_errors > 0)
cm->log(util::format("Weather file albedo has %d invalid values, using monthly value", (int)num_alb_errors), SSC_WARNING);

weatherDataProvider->rewind();
}

Expand Down Expand Up @@ -1201,6 +1204,8 @@ Module_IO::Module_IO(compute_module* cm, std::string cmName, double dcLoss)
selfShadingFillFactor = sandiaModel.Vmp0 * sandiaModel.Imp0 / sandiaModel.Voc0 / sandiaModel.Isc0;
voltageMaxPower = sandiaModel.Vmp0;

groundClearanceHeight = 1.0; //No input as there is no bifacial option for Sandia module model

if (sandiaModel.fd == 0) {
isConcentratingPV = true;
}
Expand Down
31 changes: 16 additions & 15 deletions shared/lib_utility_rate.cpp
Expand Up @@ -173,7 +173,7 @@ UtilityRateForecast::UtilityRateForecast(rate_data* util_rate, size_t stepsPerHo
dt_hour = 1.0f / stepsPerHour;
last_step = 0;
last_month_init = -1;
rate = std::shared_ptr<rate_data>(new rate_data(*util_rate));
rate = std::unique_ptr<rate_data>(new rate_data(*util_rate));
m_monthly_load_forecast = monthly_load_forecast;
m_monthly_gen_forecast = monthly_gen_forecast;
m_monthly_avg_load_forecast = monthly_avg_load_forecast;
Expand All @@ -182,21 +182,22 @@ UtilityRateForecast::UtilityRateForecast(rate_data* util_rate, size_t stepsPerHo
}

UtilityRateForecast::UtilityRateForecast(UtilityRateForecast& tmp) :
steps_per_hour(tmp.steps_per_hour),
dt_hour(tmp.dt_hour),
last_step(tmp.last_step),
m_monthly_load_forecast(tmp.m_monthly_load_forecast),
m_monthly_gen_forecast(tmp.m_monthly_gen_forecast),
m_monthly_avg_load_forecast(tmp.m_monthly_avg_load_forecast),
m_peaks_forecast(tmp.m_peaks_forecast),
current_composite_buy_rates(tmp.current_composite_buy_rates),
current_composite_sell_rates(tmp.current_composite_sell_rates),
next_composite_buy_rates(tmp.next_composite_buy_rates),
next_composite_sell_rates(tmp.next_composite_sell_rates),
last_month_init(tmp.last_month_init),
nyears(tmp.nyears)
current_composite_sell_rates(tmp.current_composite_sell_rates),
current_composite_buy_rates(tmp.current_composite_buy_rates),
next_composite_sell_rates(tmp.next_composite_sell_rates),
next_composite_buy_rates(tmp.next_composite_buy_rates),
steps_per_hour(tmp.steps_per_hour),
dt_hour(tmp.dt_hour),
last_step(tmp.last_step),
last_month_init(tmp.last_month_init),
nyears(tmp.nyears),
m_monthly_load_forecast(tmp.m_monthly_load_forecast),
m_monthly_gen_forecast(tmp.m_monthly_gen_forecast),
m_monthly_avg_load_forecast(tmp.m_monthly_avg_load_forecast),
m_peaks_forecast(tmp.m_peaks_forecast)
{
rate = std::shared_ptr<rate_data>(new rate_data(*tmp.rate));
// rate = std::shared_ptr<rate_data>(new rate_data(*tmp.rate));
rate = std::make_shared<rate_data>(*tmp.rate);
}

UtilityRateForecast::~UtilityRateForecast() {}
Expand Down

0 comments on commit ca05605

Please sign in to comment.