Skip to content
Merged
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
1 change: 0 additions & 1 deletion src/EnergyPlus/StringUtilities.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#define StringUtilities_hh_INCLUDED

#include <EnergyPlus/FromChars.hh>
#include <ObjexxFCL/src/ObjexxFCL/Array1S.hh>
#include <fast_float/fast_float.h>
#include <sstream>
#include <type_traits>
Expand Down
1 change: 1 addition & 0 deletions tst/EnergyPlus/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set(test_src
AirflowNetworkHVAC.unit.cc
AirflowNetworkConditions.unit.cc
AirflowNetworkComponents.unit.cc
api/datatransfer.unit.cc
Autosizing/All_Simple_Sizing.unit.cc
Autosizing/AutosizingFixture.hh
Autosizing/BaseClassSizing.unit.cc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

// Google Test Headers
#include <EnergyPlus/PhaseChangeModeling/HysteresisModel.hh>
#include <fstream>
#include <gtest/gtest.h>
#include <vector>

Expand Down
99 changes: 0 additions & 99 deletions tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc

This file was deleted.

54 changes: 32 additions & 22 deletions tst/EnergyPlus/unit/api/datatransfer.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
#include <EnergyPlus/PluginManager.hh>
#include <EnergyPlus/api/datatransfer.h>

#include "EnergyPlus/DataEnvironment.hh"

using namespace EnergyPlus;

class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture
Expand Down Expand Up @@ -145,11 +147,10 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture
void SetUp() override
{
EnergyPlusFixture::SetUp();
Real64 timeStep = 1.0;
OutputProcessor::SetupTimePointers(*state, OutputProcessor::SOVTimeStepType::Zone, timeStep);
OutputProcessor::SetupTimePointers(*state, OutputProcessor::SOVTimeStepType::HVAC, timeStep);
*state->dataOutputProcessor->TimeValue.at(OutputProcessor::TimeStepType::Zone).TimeStep = 60;
*state->dataOutputProcessor->TimeValue.at(OutputProcessor::TimeStepType::System).TimeStep = 60;
state->dataGlobal->TimeStepZone = 1.0 / 60.0;
state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone;
OutputProcessor::SetupTimePointers(*state, OutputProcessor::TimeStepType::Zone, state->dataGlobal->TimeStepZone);
OutputProcessor::SetupTimePointers(*state, OutputProcessor::TimeStepType::System, state->dataHVACGlobal->TimeStepSys);
state->dataPluginManager->pluginManager = std::make_unique<EnergyPlus::PluginManagement::PluginManager>(*state);
}

Expand Down Expand Up @@ -180,33 +181,31 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture
if (val.meterType) {
SetupOutputVariable(*state,
val.varName,
OutputProcessor::Unit::kg_s,
Constant::Units::J,
val.value,
OutputProcessor::SOVTimeStepType::Zone,
OutputProcessor::SOVStoreType::Summed,
OutputProcessor::TimeStepType::Zone,
OutputProcessor::StoreType::Sum,
val.varKey,
_,
"ELECTRICITY",
"HEATING",
_,
"System");
Constant::eResource::Electricity,
OutputProcessor::Group::HVAC,
OutputProcessor::EndUseCat::Heating);
} else {
SetupOutputVariable(*state,
val.varName,
OutputProcessor::Unit::kg_s,
Constant::Units::kg_s,
val.value,
OutputProcessor::SOVTimeStepType::Zone,
OutputProcessor::SOVStoreType::Average,
OutputProcessor::TimeStepType::Zone,
OutputProcessor::StoreType::Average,
val.varKey);
}
}
for (auto &val : this->intVariablePlaceholders) {
SetupOutputVariable(*state,
val.varName,
OutputProcessor::Unit::kg_s,
Constant::Units::kg_s,
val.value,
OutputProcessor::SOVTimeStepType::Zone,
OutputProcessor::SOVStoreType::Average,
OutputProcessor::TimeStepType::Zone,
OutputProcessor::StoreType::Average,
val.varKey);
}
}
Expand Down Expand Up @@ -257,19 +256,19 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture
}
}

void addPluginGlobal(EnergyPlus::EnergyPlusData &state, std::string const &varName)
static void addPluginGlobal(EnergyPlus::EnergyPlusData &state, std::string const &varName)
{
state.dataPluginManager->pluginManager->addGlobalVariable(state, varName);
}

void addTrendWithNewGlobal(std::string const &newGlobalVarName, std::string const &trendName, int numTrendValues)
void addTrendWithNewGlobal(std::string const &newGlobalVarName, std::string const &trendName, int numTrendValues) const
{
state->dataPluginManager->pluginManager->addGlobalVariable(*state, newGlobalVarName);
int i = EnergyPlus::PluginManagement::PluginManager::getGlobalVariableHandle(*state, newGlobalVarName, true);
state->dataPluginManager->trends.emplace_back(*state, trendName, numTrendValues, i);
}

void simulateTimeStepAndReport()
void simulateTimeStepAndReport() const
{
UpdateMeterReporting(*state);
UpdateDataandReport(*state, OutputProcessor::TimeStepType::Zone);
Expand Down Expand Up @@ -373,6 +372,11 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetVariableValuesRealTyp
int hChillerHT = getVariableHandle((void *)this->state, "Chiller Heat Transfer", "Chiller 1");
int hZoneTemp = getVariableHandle((void *)this->state, "Zone Mean Temperature", "Zone 1");

this->state->dataGlobal->HourOfDay = 1;
this->state->dataGlobal->MinutesInTimeStep = 1;
this->state->dataEnvrn->Month = 1;
this->state->dataEnvrn->DayOfMonth = 1;

// pretend like E+ ran a time step
this->simulateTimeStepAndReport();

Expand Down Expand Up @@ -408,6 +412,12 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetMeterValues)
this->setupVariablesOnceAllAreRequested();
int hFacilityElectricity = getMeterHandle((void *)this->state, "Electricity:Facility");
EXPECT_GT(hFacilityElectricity, -1);

this->state->dataGlobal->HourOfDay = 1;
this->state->dataGlobal->MinutesInTimeStep = 1;
this->state->dataEnvrn->Month = 1;
this->state->dataEnvrn->DayOfMonth = 1;

// pretend like E+ ran a time step
this->simulateTimeStepAndReport();
// get the value for a valid meter
Expand Down
Loading