Skip to content

Commit

Permalink
Address lag in reporting output variables
Browse files Browse the repository at this point in the history
This change adopts the new data exchange api provided natively by
energyplus to read output variables. This change at least partially
addresses a lag issue related to updating outputs. Still, the output
variables will only be updated when the simulation crosses a zone
timestep. For some use cases this might be an issue that will have to be
further addressed.
  • Loading branch information
kbenne committed Mar 5, 2020
1 parent 4890cf1 commit a61f2b3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions epfmi/EPComponent.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "EPComponent.hpp"
#include "EnergyPlus/api/EnergyPlusPgm.hh"
#include "EnergyPlus/api/runtime.h"
#include "EnergyPlus/api/datatransfer.h"
#include "EnergyPlus/CommandLineInterface.hh"
#include "EnergyPlus/DataGlobals.hh"
#include "EnergyPlus/DataHeatBalance.hh"
Expand Down Expand Up @@ -174,11 +175,8 @@ void EPComponent::exchange()
};

auto getSensorValue = [&](Variable & var) {
int varType;
int varIndex;

EnergyPlus::EMSManager::GetVariableTypeAndIndex(var.epname, var.epkey, varType, varIndex);
return EnergyPlus::GetInternalVariableValue(varType, varIndex);
const auto & h = getVariableHandle(var.epname.c_str(), var.epkey.c_str());
return getVariableValue(h);
};

auto setActuatorValue = [](std::string & actuatorName, const Real64 & value) {
Expand Down

0 comments on commit a61f2b3

Please sign in to comment.