Skip to content

Commit

Permalink
WIP: Refactor variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kbenne committed Jul 31, 2024
1 parent 650edbd commit 7eae7e5
Show file tree
Hide file tree
Showing 4 changed files with 549 additions and 11 deletions.
28 changes: 28 additions & 0 deletions energyplus_coroutine/energyplus_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <DataGlobals.hh>
#include <DataHeatBalSurface.hh>
#include <DataHeatBalance.hh>
#include <DataSizing.hh>
#include <EnergyPlusData.hh>
#include <api/datatransfer.h>
#include <string_view>
Expand Down Expand Up @@ -84,6 +85,28 @@ int ZoneNum(const EnergyPlus::EnergyPlusData &energyplus_data, const std::string
return energyplus_data.dataZoneTempPredictorCorrector->zoneHeatBalance(zone_num).MRT;
}

[[nodiscard]] double ZoneDesignCoolingLoad(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num)
{
return energyplus_data.dataSize->FinalZoneSizing[zone_num].DesCoolLoad;
}

[[nodiscard]] double ZoneDesignCoolingLatentLoad(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num)
{
return energyplus_data.dataSize->FinalZoneSizing[zone_num].DesLatentCoolLoad;
}

[[nodiscard]] double ZoneOutdoorTempAtPeakCool(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num)
{
return energyplus_data.dataSize->FinalZoneSizing[zone_num].OutTempAtCoolPeak;
}

[[nodiscard]] double ZoneOutdoorHumidityRatioAtPeakCool(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num)
{
return energyplus_data.dataSize->FinalZoneSizing[zone_num].OutHumRatAtCoolPeak;
}

// const auto value = sim_state.dataSize->FinalZoneSizing[zone_num].OutHumRatAtLatentCoolPeak;

void SetZoneTemperature(EnergyPlus::EnergyPlusData &energyplus_data, const int zone_num, const double &temp)
{
auto &zone_heat_balance = energyplus_data.dataZoneTempPredictorCorrector->zoneHeatBalance(zone_num);
Expand Down Expand Up @@ -142,6 +165,11 @@ int ActuatorHandle(EnergyPlus::EnergyPlusData &energyplus_data,
return h;
}

void SetActuatorValue(EnergyPlus::EnergyPlusData &energyplus_data, int handle, const double &value)
{
::setActuatorValue(static_cast<EnergyPlusState>(&energyplus_data), handle, value);
}

[[nodiscard]] int SurfaceNum(EnergyPlus::EnergyPlusData &energyplus_data, std::string_view surface_name)
{
std::string upper_name(surface_name);
Expand Down
11 changes: 11 additions & 0 deletions energyplus_coroutine/energyplus_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ class ZoneSums

[[nodiscard]] double ZoneMeanRadiantTemp(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num);

[[nodiscard]] double ZoneDesignCoolingLoad(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num);

[[nodiscard]] double ZoneDesignCoolingLatentLoad(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num);

[[nodiscard]] double ZoneOutdoorTempAtPeakCool(const EnergyPlus::EnergyPlusData &energyplus_data, int zone_num);

[[nodiscard]] double ZoneOutdoorHumidityRatioAtPeakCool(const EnergyPlus::EnergyPlusData &energyplus_data,
int zone_num);

void SetZoneTemperature(EnergyPlus::EnergyPlusData &energyplus_data, const int zone_num, const double &temp);

void SetZoneHumidityRatio(EnergyPlus::EnergyPlusData &energyplus_data, const int zone_num, const double &ratio);
Expand All @@ -46,6 +55,8 @@ VariableHandle(EnergyPlus::EnergyPlusData &energyplus_data, const std::string_vi
const std::string &control_type,
const std::string &component_name);

void SetActuatorValue(EnergyPlus::EnergyPlusData &energyplus_data, int handle, const double &value);

[[nodiscard]] int SurfaceNum(EnergyPlus::EnergyPlusData &energyplus_data, std::string_view surface_name);

[[nodiscard]] double SurfaceArea(EnergyPlus::EnergyPlusData &energyplus_data, int surface_num);
Expand Down
Loading

0 comments on commit 7eae7e5

Please sign in to comment.