Skip to content

Commit

Permalink
Restore yearly tests; format.
Browse files Browse the repository at this point in the history
  • Loading branch information
spahrenk committed Nov 7, 2024
1 parent 43575f3 commit 2be4504
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 100 deletions.
13 changes: 6 additions & 7 deletions src/Condenser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ HPWH::Condenser& HPWH::Condenser::operator=(const HPWH::Condenser& cond_in)

void HPWH::Condenser::from(const std::unique_ptr<HeatSourceTemplate>& rshs_ptr)
{
auto cond_ptr =
reinterpret_cast<hpwh_data_model::rscondenserwaterheatsource_ns::RSCONDENSERWATERHEATSOURCE*>(
rshs_ptr.get());
auto cond_ptr = reinterpret_cast<
hpwh_data_model::rscondenserwaterheatsource_ns::RSCONDENSERWATERHEATSOURCE*>(
rshs_ptr.get());

auto& perf = cond_ptr->performance;
switch (perf.coil_configuration)
Expand Down Expand Up @@ -97,7 +97,6 @@ void HPWH::Condenser::from(const std::unique_ptr<HeatSourceTemplate>& rshs_ptr)
perf.compressor_lockout_temperature_hysteresis,
0.);


// uses btwxt performance-grid interpolation
if (perf.performance_map_is_set)
{
Expand Down Expand Up @@ -157,9 +156,9 @@ void HPWH::Condenser::from(const std::unique_ptr<HeatSourceTemplate>& rshs_ptr)

void HPWH::Condenser::to(std::unique_ptr<HeatSourceTemplate>& rshs_ptr) const
{
auto cond_ptr =
reinterpret_cast<hpwh_data_model::rscondenserwaterheatsource_ns::RSCONDENSERWATERHEATSOURCE*>(
rshs_ptr.get());
auto cond_ptr = reinterpret_cast<
hpwh_data_model::rscondenserwaterheatsource_ns::RSCONDENSERWATERHEATSOURCE*>(
rshs_ptr.get());

auto& metadata = cond_ptr->metadata;
checkTo(hpwh_data_model::ashrae205_ns::SchemaType::RSCONDENSERWATERHEATSOURCE,
Expand Down
141 changes: 68 additions & 73 deletions src/HPWH.cc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/HPWHHeatSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ HPWH::HeatSource& HPWH::HeatSource::operator=(const HeatSource& hSource)
}

void HPWH::HeatSource::from(
const hpwh_data_model::rsintegratedwaterheater_ns::HeatSourceConfiguration& heatsourceconfiguration)
const hpwh_data_model::rsintegratedwaterheater_ns::HeatSourceConfiguration&
heatsourceconfiguration)
{
auto& config = heatsourceconfiguration;
checkFrom(name, config.id_is_set, config.id, std::string("heatsource"));
Expand Down Expand Up @@ -179,7 +180,6 @@ void HPWH::HeatSource::to(hpwh_data_model::rsintegratedwaterheater_ns::HeatSourc
checkTo(companionHeatSource->name,
heatsourceconfiguration.companion_heat_source_id_is_set,
heatsourceconfiguration.companion_heat_source_id);

}

void HPWH::HeatSource::setCondensity(const std::vector<double>& condensity_in)
Expand Down
1 change: 0 additions & 1 deletion src/HPWHHeatSource.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class HPWH::HeatSource : public Sender
/**< returns if the heat source uses a compressor or not */
bool isAResistance() const { return typeOfHeatSource() == TYPE_resistance; }


bool isEngaged() const;
/**< return whether or not the heat source is engaged */
void engageHeatSource(DRMODES DRstatus = DR_ALLOW);
Expand Down
4 changes: 2 additions & 2 deletions src/HPWHHeatingLogic.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ struct HPWH::HeatingLogic
static std::shared_ptr<HeatingLogic>
make(const hpwh_data_model::rsintegratedwaterheater_ns::HeatingLogic& logic, HPWH* hpwh);

virtual void to(hpwh_data_model::rsintegratedwaterheater_ns::HeatingLogic& heatingLogic) const = 0;
virtual void
to(hpwh_data_model::rsintegratedwaterheater_ns::HeatingLogic& heatingLogic) const = 0;

protected:
double decisionPoint;
Expand Down Expand Up @@ -117,7 +118,6 @@ struct HPWH::TempBasedHeatingLogic : HPWH::HeatingLogic

private:
bool areNodeWeightsValid();

};

#endif
18 changes: 9 additions & 9 deletions src/HPWHUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -845,11 +845,10 @@ void HPWH::to_json(const hpwh_data_model::rsintegratedwaterheater_ns::HeatingLog
if (heating_logic.heating_logic_is_set)
{
nlohmann::json j_logic;
to_json(
*reinterpret_cast<
hpwh_data_model::rsintegratedwaterheater_ns::StateOfChargeBasedHeatingLogic*>(
heating_logic.heating_logic.get()),
j_logic);
to_json(*reinterpret_cast<hpwh_data_model::rsintegratedwaterheater_ns::
StateOfChargeBasedHeatingLogic*>(
heating_logic.heating_logic.get()),
j_logic);
j["heating_logic"] = j_logic;
}
break;
Expand All @@ -860,10 +859,11 @@ void HPWH::to_json(const hpwh_data_model::rsintegratedwaterheater_ns::HeatingLog
if (heating_logic.heating_logic_is_set)
{
nlohmann::json j_logic;
to_json(*reinterpret_cast<
hpwh_data_model::rsintegratedwaterheater_ns::TemperatureBasedHeatingLogic*>(
heating_logic.heating_logic.get()),
j_logic);
to_json(
*reinterpret_cast<
hpwh_data_model::rsintegratedwaterheater_ns::TemperatureBasedHeatingLogic*>(
heating_logic.heating_logic.get()),
j_logic);
j["heating_logic"] = j_logic;
}
break;
Expand Down
12 changes: 6 additions & 6 deletions src/Resistance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ HPWH::Resistance& HPWH::Resistance::operator=(const HPWH::Resistance& r_in)

void HPWH::Resistance::from(const std::unique_ptr<HeatSourceTemplate>& rshs_ptr)
{
auto res_ptr =
reinterpret_cast<hpwh_data_model::rsresistancewaterheatsource_ns::RSRESISTANCEWATERHEATSOURCE*>(
rshs_ptr.get());
auto res_ptr = reinterpret_cast<
hpwh_data_model::rsresistancewaterheatsource_ns::RSRESISTANCEWATERHEATSOURCE*>(
rshs_ptr.get());

auto& perf = res_ptr->performance;
power_kW = perf.input_power / 1000.;
}

void HPWH::Resistance::to(std::unique_ptr<HeatSourceTemplate>& rshs_ptr) const
{
auto res_ptr =
reinterpret_cast<hpwh_data_model::rsresistancewaterheatsource_ns::RSRESISTANCEWATERHEATSOURCE*>(
rshs_ptr.get());
auto res_ptr = reinterpret_cast<
hpwh_data_model::rsresistancewaterheatsource_ns::RSRESISTANCEWATERHEATSOURCE*>(
rshs_ptr.get());

auto& metadata = res_ptr->metadata;
checkTo(hpwh_data_model::ashrae205_ns::SchemaType::RSRESISTANCEWATERHEATSOURCE,
Expand Down
14 changes: 14 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,20 @@ foreach (test ${stateOfChargeTests})
endforeach (model)
endforeach (test)

#Add small compressor yearly tests to the list
foreach (test ${yearTests})
foreach (model ${yearTestsModels})
add_model_test(TEST_NAME "${test}" MODEL_NAME "${model}" SPEC_TYPE "Preset")
endforeach (model)
endforeach (test)

#Add LARGE compressor yearly tests to the list
foreach (test ${yearLargeTests})
foreach (model ${yearLargeTestsModels})
add_model_test(TEST_NAME "${test}" MODEL_NAME "${model}" SPEC_TYPE "Preset")
endforeach (model)
endforeach (test)

#Add regression test for yearly file
add_test(NAME "RegressionTest.YearRuns" COMMAND ${CMAKE_COMMAND} -E compare_files "${CMAKE_CURRENT_BINARY_DIR}/output/DHW_YRLY.csv" "${CMAKE_CURRENT_SOURCE_DIR}/ref/DHW_YRLY.csv")

Expand Down

0 comments on commit 2be4504

Please sign in to comment.