Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global OutputReportTabular, OutputReportTabularAnnual, DXFEarClipping, PVWatts #8629

Merged
merged 10 commits into from
Mar 19, 2021
12 changes: 1 addition & 11 deletions src/EnergyPlus/DXFEarClipping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,6 @@ namespace DXFEarClipping {
// Methodology employed:
// Ear clipping has turned out to be the simplest, most robust technique.

// Using/Aliasing
using namespace DataVectorTypes;

bool trackit(false);
// Subroutine specifications for module <module_name>:

// rest of routines are private.

// Functions

bool InPolygon(Vector const &point, Array1D<Vector> &poly, int const nsides)
{
// this routine is not used in the current scheme
Expand Down Expand Up @@ -578,7 +568,7 @@ namespace DXFEarClipping {
earvert(2) = mvert;
earvert(3) = evert;
}
if (trackit) {
if (state.dataDXFEarClipping->trackit) {
print(state.files.debug, "ear={} triangle={:12}{:12}{:12}\n", nears, svert, mvert, evert);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/EnergyPlus/DXFEarClipping.hh
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ namespace DXFEarClipping {

struct DXFEarClippingData : BaseGlobalStruct {

bool trackit = false;

void clear_state() override
{

this->trackit = false;
}
};

Expand Down
7 changes: 2 additions & 5 deletions src/EnergyPlus/EarthTube.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,10 @@ namespace EnergyPlus::EarthTube {
// Using/Aliasing
using namespace DataEnvironment;
using namespace DataHeatBalFanSys;
using namespace DataHeatBalance; // This is the heat balance super block data module
using namespace DataHeatBalance;
using namespace DataSurfaces;
using namespace Psychrometrics;

// MODULE VARIABLES DECLARATIONS:
static std::string const BlankString;

void ManageEarthTube(EnergyPlusData &state)
{

Expand Down Expand Up @@ -231,7 +228,7 @@ namespace EnergyPlus::EarthTube {
state.dataEarthTube->EarthTubeSys(Loop).FanType = EarthTubeVentilation::Exhaust;
} else if (SELECT_CASE_var == "INTAKE") {
state.dataEarthTube->EarthTubeSys(Loop).FanType = EarthTubeVentilation::Intake;
} else if ((SELECT_CASE_var == "NATURAL") || (SELECT_CASE_var == "NONE") || (SELECT_CASE_var == BlankString)) {
} else if ((SELECT_CASE_var == "NATURAL") || (SELECT_CASE_var == "NONE") || (SELECT_CASE_var.empty())) {
state.dataEarthTube->EarthTubeSys(Loop).FanType = EarthTubeVentilation::Natural;
} else {
ShowSevereError(state, cCurrentModuleObject + ": " + cAlphaFieldNames(1) + '=' + cAlphaArgs(1) + ", " + cAlphaFieldNames(3) +
Expand Down
10 changes: 2 additions & 8 deletions src/EnergyPlus/OutputReportTabular.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,6 @@ namespace EnergyPlus::OutputReportTabular {
using namespace DataHeatBalance;
using namespace HybridModel;

// Functions
void clear_state(EnergyPlusData &state)
{
OutputReportTabular::ResetTabularReports(state);
}

std::ofstream & open_tbl_stream(EnergyPlusData &state, int const iStyle, std::string const & filename, bool output_to_file)
{
std::ofstream &tbl_stream(*state.dataOutRptTab->TabularOutputFile(iStyle));
Expand Down Expand Up @@ -3316,7 +3310,7 @@ namespace EnergyPlus::OutputReportTabular {
}
}
}
OutputReportTabularAnnual::AddAnnualTableOfContents(tbl_stream);
OutputReportTabularAnnual::AddAnnualTableOfContents(state, tbl_stream);
}
// add entries specifically added using AddTOCEntry
for (iEntry = 1; iEntry <= ort->TOCEntriesCount; ++iEntry) {
Expand Down Expand Up @@ -15594,7 +15588,7 @@ namespace EnergyPlus::OutputReportTabular {
// so that only last year is reported in tabular reports
state.dataOutRptTab->gatherElapsedTimeBEPS = 0.0;
ResetMonthlyGathering(state);
OutputReportTabularAnnual::ResetAnnualGathering();
OutputReportTabularAnnual::ResetAnnualGathering(state);
ResetBinGathering(state);
ResetBEPSGathering(state);
ResetSourceEnergyEndUseGathering(state);
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/OutputReportTabular.hh
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ namespace OutputReportTabular {
};

// Functions
void clear_state(EnergyPlusData &state);

std::ofstream & open_tbl_stream(EnergyPlusData &state, int const iStyle, std::string const & filename, bool output_to_file = true);

Expand Down
30 changes: 11 additions & 19 deletions src/EnergyPlus/OutputReportTabularAnnual.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@
#include <EnergyPlus/ScheduleManager.hh>
#include <EnergyPlus/UtilityRoutines.hh>

namespace EnergyPlus {

namespace OutputReportTabularAnnual {

std::vector<AnnualTable> annualTables;
namespace EnergyPlus::OutputReportTabularAnnual {

void GetInputTabularAnnual(EnergyPlusData &state)
{
Expand Down Expand Up @@ -107,6 +103,8 @@ namespace OutputReportTabularAnnual {
int curNumDgts(2);
AnnualFieldSet::AggregationKind curAgg(AnnualFieldSet::AggregationKind::sumOrAvg);

auto &annualTables(state.dataOutputReportTabularAnnual->annualTables);

objCount = inputProcessor->getNumObjectsFound(state, currentModuleObject);
if (objCount > 0) {
// if not a run period using weather do not create reports
Expand Down Expand Up @@ -246,6 +244,7 @@ namespace OutputReportTabularAnnual {
{
std::vector<AnnualTable>::iterator annualTableIt;
bool invalidAggregationOrderFound = false;
auto &annualTables(state.dataOutputReportTabularAnnual->annualTables);
if (!state.dataGlobal->DoWeathSim) { // if no weather simulation than no reading of MonthlyInput array
return;
}
Expand Down Expand Up @@ -309,6 +308,7 @@ namespace OutputReportTabularAnnual {
// This function is not part of the class but acts as an interface between procedural code and the class by
// gathering data for each of the AnnualTable objects
std::vector<AnnualTable>::iterator annualTableIt;
auto &annualTables(state.dataOutputReportTabularAnnual->annualTables);
for (annualTableIt = annualTables.begin(); annualTableIt != annualTables.end(); ++annualTableIt) {
annualTableIt->gatherForTimestep(state, kindOfTimeStep);
}
Expand Down Expand Up @@ -566,12 +566,13 @@ namespace OutputReportTabularAnnual {
}
}

void ResetAnnualGathering()
void ResetAnnualGathering(EnergyPlusData &state)
{
// Jason Glazer, October 2015
// This function is not part of the class but acts as an interface between procedural code and the class by
// reseting data for each of the AnnualTable objects
// resetting data for each of the AnnualTable objects
std::vector<AnnualTable>::iterator annualTableIt;
auto &annualTables(state.dataOutputReportTabularAnnual->annualTables);
for (annualTableIt = annualTables.begin(); annualTableIt != annualTables.end(); ++annualTableIt) {
annualTableIt->resetGathering();
}
Expand Down Expand Up @@ -624,6 +625,7 @@ namespace OutputReportTabularAnnual {

void WriteAnnualTables(EnergyPlusData &state)
{
auto &annualTables(state.dataOutputReportTabularAnnual->annualTables);
for (int iUnitSystem = 0; iUnitSystem <= 1; iUnitSystem++) {
OutputReportTabular::iUnitsStyle unitsStyle_cur = state.dataOutRptTab->unitsStyle;
bool produceTabular = true;
Expand Down Expand Up @@ -1170,12 +1172,13 @@ namespace OutputReportTabularAnnual {
return str.substr(strBegin, strRange);
}

void AddAnnualTableOfContents(std::ostream &nameOfStream)
void AddAnnualTableOfContents(EnergyPlusData &state, std::ostream &nameOfStream)
{
// Jason Glazer, August 2015
// This function is not part of the class but acts as an interface between procedural code and the class by
// invoking the writeTable member function for each of the AnnualTable objects
std::vector<AnnualTable>::iterator annualTableIt;
auto &annualTables(state.dataOutputReportTabularAnnual->annualTables);
for (annualTableIt = annualTables.begin(); annualTableIt != annualTables.end(); ++annualTableIt) {
annualTableIt->addTableOfContents(nameOfStream);
}
Expand Down Expand Up @@ -1374,15 +1377,6 @@ namespace OutputReportTabularAnnual {
}
}

void clear_state()
{ // for unit tests
std::vector<AnnualTable>::iterator annualTableIt;
for (annualTableIt = annualTables.begin(); annualTableIt != annualTables.end(); ++annualTableIt) {
annualTableIt->clearTable();
}
annualTables.clear();
}

void AnnualTable::clearTable()
{
m_name = "";
Expand Down Expand Up @@ -1444,6 +1438,4 @@ namespace OutputReportTabularAnnual {
return ret;
}

} // namespace OutputReportTabularAnnual

} // namespace EnergyPlus
12 changes: 5 additions & 7 deletions src/EnergyPlus/OutputReportTabularAnnual.hh
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,14 @@ namespace OutputReportTabularAnnual {

void GatherAnnualResultsForTimeStep(EnergyPlusData &state, OutputProcessor::TimeStepType kindOfTypeStep);

void ResetAnnualGathering();
void ResetAnnualGathering(EnergyPlusData &state);

void WriteAnnualTables(EnergyPlusData &state);

void AddAnnualTableOfContents(std::ostream &);
void AddAnnualTableOfContents(EnergyPlusData &state, std::ostream &);

AnnualFieldSet::AggregationKind stringToAggKind(EnergyPlusData &state, std::string inString);

void clear_state(); // for unit tests

class AnnualTable
{
public:
Expand Down Expand Up @@ -177,15 +175,15 @@ namespace OutputReportTabularAnnual {

}; // class AnnualTable

extern std::vector<AnnualTable> annualTables;

} // namespace OutputReportTabularAnnual

struct OutputReportTabularAnnualData : BaseGlobalStruct {

std::vector<OutputReportTabularAnnual::AnnualTable> annualTables;

void clear_state() override
{

this->annualTables.clear();
}
};

Expand Down
12 changes: 4 additions & 8 deletions src/EnergyPlus/PVWatts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ namespace EnergyPlus {

namespace PVWatts {

std::map<int, PVWattsGenerator> PVWattsGenerators;

PVWattsGenerator::PVWattsGenerator(EnergyPlusData &state,
const std::string &name,
const Real64 dcSystemCapacity,
Expand Down Expand Up @@ -339,7 +337,7 @@ namespace PVWatts {
return m_groundCoverageRatio;
}

Real64 PVWattsGenerator::getCellTempearture()
Real64 PVWattsGenerator::getCellTemperature()
{
return m_cellTemperature;
}
Expand Down Expand Up @@ -458,6 +456,9 @@ namespace PVWatts {
if (ObjNum == 0) {
ShowFatalError(state, "Cannot find Generator:PVWatts " + GeneratorName);
}

auto & PVWattsGenerators(state.dataPVWatts->PVWattsGenerators);

auto it = PVWattsGenerators.find(ObjNum);
if (it == PVWattsGenerators.end()) {
// It's not in the map, add it.
Expand All @@ -470,11 +471,6 @@ namespace PVWatts {
}
}

void clear_state()
{
PVWattsGenerators.clear();
}

} // namespace PVWatts

} // namespace EnergyPlus
10 changes: 4 additions & 6 deletions src/EnergyPlus/PVWatts.hh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace PVWatts {
DataSurfaces::SurfaceData &getSurface(EnergyPlusData &state);
Real64 getGroundCoverageRatio();

Real64 getCellTempearture();
Real64 getCellTemperature();
Real64 getPlaneOfArrayIrradiance();
void setCellTemperature(Real64 cellTemp);
void setPlaneOfArrayIrradiance(Real64 poa);
Expand All @@ -209,19 +209,17 @@ namespace PVWatts {
void getResults(Real64 &GeneratorPower, Real64 &GeneratorEnergy, Real64 &ThermalPower, Real64 &ThermalEnergy);
};

extern std::map<int, PVWattsGenerator> PVWattsGenerators;

PVWattsGenerator &GetOrCreatePVWattsGenerator(EnergyPlusData &state, std::string const &GeneratorName);

void clear_state();

} // namespace PVWatts

struct PVWattsData : BaseGlobalStruct {

std::map<int, PVWatts::PVWattsGenerator> PVWattsGenerators;

void clear_state() override
{

this->PVWattsGenerators.clear();
}
};

Expand Down
9 changes: 0 additions & 9 deletions src/EnergyPlus/StateManagement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
#include <EnergyPlus/DesiccantDehumidifiers.hh>
#include <EnergyPlus/DualDuct.hh>
#include <EnergyPlus/ElectricBaseboardRadiator.hh>
#include <EnergyPlus/ElectricPowerServiceManager.hh>
#include <EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp>
#include <EnergyPlus/EvaporativeFluidCoolers.hh>
#include <EnergyPlus/FluidProperties.hh>
#include <EnergyPlus/GeneralRoutines.hh>
Expand All @@ -84,16 +82,12 @@
#include <EnergyPlus/HybridModel.hh>
#include <EnergyPlus/IntegratedHeatPump.hh>
#include <EnergyPlus/OutAirNodeManager.hh>
#include <EnergyPlus/OutputReportTabular.hh>
#include <EnergyPlus/OutputReportTabularAnnual.hh>
#include <EnergyPlus/OutsideEnergySources.hh>
#include <EnergyPlus/PVWatts.hh>
#include <EnergyPlus/PackagedThermalStorageCoil.hh>
#include <EnergyPlus/PhaseChangeModeling/HysteresisModel.hh>
#include <EnergyPlus/PhotovoltaicThermalCollectors.hh>
#include <EnergyPlus/Photovoltaics.hh>
#include <EnergyPlus/Psychrometrics.hh>
#include <EnergyPlus/ReportCoilSelection.hh>
#include <EnergyPlus/RoomAirModelAirflowNetwork.hh>
#include <EnergyPlus/RoomAirModelUserTempPattern.hh>

Expand Down Expand Up @@ -132,13 +126,10 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state)
HVACSingleDuctInduc::clear_state();
HybridModel::clear_state();
HysteresisPhaseChange::clear_state();
OutputReportTabular::clear_state(state);
OutputReportTabularAnnual::clear_state();
PackagedThermalStorageCoil::clear_state();
Photovoltaics::clear_state();
PhotovoltaicThermalCollectors::clear_state();
Psychrometrics::clear_state();
PVWatts::clear_state();
RoomAirModelAirflowNetwork::clear_state();
RoomAirModelUserTempPattern::clear_state();
}
1 change: 0 additions & 1 deletion tst/EnergyPlus/unit/OutputReportTabular.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8294,7 +8294,6 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConversionFactors)

TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatGainReport)
{
OutputReportTabular::clear_state(*state);
state->dataGlobal->DoWeathSim = true;

state->dataOutRptPredefined->pdrSensibleGain = 1;
Expand Down
Loading