Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions src/EnergyPlus/HeatBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2612,6 +2612,11 @@ namespace HeatBalanceManager {
using OutAirNodeManager::SetOutAirNodes;
using WindowEquivalentLayer::InitEquivalentLayerWindowCalculations;

if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
HeatBalanceSurfaceManager::InitEMSControlledConstructions(state);
HeatBalanceSurfaceManager::InitEMSControlledSurfaceProperties(state);
}
Comment on lines +2615 to +2618
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moves this up in the calling order so the EMS overrides get picked up before the surfaces are initialized.


if (state.dataGlobal->BeginSimFlag) {
AllocateHeatBalArrays(state); // Allocate the Module Arrays
if (state.dataHeatBal->AnyCTF || state.dataHeatBal->AnyEMPD) {
Expand Down Expand Up @@ -2656,11 +2661,6 @@ namespace HeatBalanceManager {
}
}

if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
HeatBalanceSurfaceManager::InitEMSControlledConstructions(state);
HeatBalanceSurfaceManager::InitEMSControlledSurfaceProperties(state);
}

// Init storm window pointers
if (state.dataSurface->TotStormWin > 0) {
if (state.dataGlobal->BeginDayFlag) {
Expand Down
2 changes: 1 addition & 1 deletion testfiles/HeatPumpWaterToAirWithHumControlDewPoint.idf
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
! Environmental Emissions: None
! Utility Tariffs: None

Version,26.1;
Version,26.2;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not relevant to current issue, but these are out of date and it's not worth another PR.


Building,
Building, !- Name
Expand Down
2 changes: 1 addition & 1 deletion testfiles/PythonPluginCondFD_Enet.idf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
! Python plugin test for CondFD sky LW radiation override.
! Based on 1ZoneCondFD_Enet_Test.idf with PythonPlugin setting Enet = -200 W/m2.

Version,26.1;
Version,26.2;

!- =========== ALL OBJECTS IN CLASS: SIMULATIONCONTROL ===========

Expand Down
27 changes: 27 additions & 0 deletions testfiles/PythonPluginCondFD_Enet.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,41 @@
# === Configuration ===
SURFACE_NAME = "Zn001:Roof001"
ENET_VALUE = -200.0 # W/m2
MATERIAL_NAME = "C5 - 4 IN HW CONCRETE"
THERMAL_ABSORPTANCE_VALUE = 0.75


class EnetSkyOverride(EnergyPlusPlugin):

def __init__(self):
super().__init__()
self.need_to_get_handles = True
self.need_to_get_material_handle = True
self.enet_handle = None
self.thermal_absorptance_handle = None

def on_begin_zone_timestep_before_init_heat_balance(self, state) -> int:
if self.need_to_get_material_handle:
self.thermal_absorptance_handle = self.api.exchange.get_actuator_handle(
state,
"Material",
"Surface Property Thermal Absorptance",
MATERIAL_NAME,
)
if self.thermal_absorptance_handle == -1:
self.api.runtime.issue_severe(
state,
f"EnetSkyOverride: no thermal absorptance actuator for material '{MATERIAL_NAME}'.",
)
return 1
self.need_to_get_material_handle = False

self.api.exchange.set_actuator_value(
state,
self.thermal_absorptance_handle,
THERMAL_ABSORPTANCE_VALUE,
)
return 0

def on_begin_timestep_before_predictor(self, state) -> int:
if self.need_to_get_handles:
Expand Down
33 changes: 33 additions & 0 deletions tst/EnergyPlus/unit/HeatBalanceManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include <EnergyPlus/HVACSystemRootFindingAlgorithm.hh>
#include <EnergyPlus/HeatBalanceAirManager.hh>
#include <EnergyPlus/HeatBalanceManager.hh>
#include <EnergyPlus/HeatBalanceSurfaceManager.hh>
#include <EnergyPlus/IOFiles.hh>
#include <EnergyPlus/InputProcessing/InputProcessor.hh>
#include <EnergyPlus/Material.hh>
Expand Down Expand Up @@ -2400,6 +2401,38 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_EMSConstructionSwitchTestCondFD)
EXPECT_TRUE(state->dataSurface->SurfEMSConstructionOverrideON(surfNum));
}

TEST_F(EnergyPlusFixture, HeatBalanceManager_EMSMaterialThermalAbsorptanceUpdatesConstructionProperties)
{
constexpr Real64 initialThermalAbsorptance = 0.9;
constexpr Real64 emsThermalAbsorptance = 0.35;

state->dataMaterial->materials.allocate(1);
auto *mat = new Material::MaterialBase;
mat->Name = "ROOF MATERIAL";
mat->group = Material::Group::Regular;
mat->AbsorpThermal = initialThermalAbsorptance;
mat->AbsorpThermalInput = initialThermalAbsorptance;
mat->AbsorpThermalEMSOverrideOn = true;
mat->AbsorpThermalEMSOverride = emsThermalAbsorptance;
state->dataMaterial->materials(1) = mat;

state->dataHeatBal->TotConstructs = 1;
state->dataConstruction->Construct.allocate(1);
auto &construction = state->dataConstruction->Construct(1);
construction.Name = "ROOF CONSTRUCTION";
construction.TotLayers = 1;
construction.LayerPoint.allocate(1);
construction.LayerPoint(1) = 1;
construction.InsideAbsorpThermal = initialThermalAbsorptance;
construction.OutsideAbsorpThermal = initialThermalAbsorptance;

HeatBalanceSurfaceManager::InitEMSControlledSurfaceProperties(*state);

EXPECT_EQ(mat->AbsorpThermal, emsThermalAbsorptance);
EXPECT_EQ(construction.InsideAbsorpThermal, emsThermalAbsorptance);
EXPECT_EQ(construction.OutsideAbsorpThermal, emsThermalAbsorptance);
}

TEST_F(EnergyPlusFixture, HeatBalanceManager_GetSpaceData)
{
// Test input processing of Space object
Expand Down
Loading