NatLabRockies / NatLabRockies/EnergyPlus

Make the multiple SetupOutputVariable function signatures more consistant

Open
#7,699 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.6k
Forks
490
Avg merge
6d 21h
Merged PRs (30d)
22

Description

SetupOutputVariable is multiple functions with multiple function signatures (the types of arguments) because it can be used for setting up the output of real or integer values. But the indexGroupKey is not the 8th argument in each of these functions. Couldn't these be reduced to a single function?

We need a sweep to clean these up and get of the optional argument stuff. And we should probably have two distinct function names, something like SetupOutputVariable and SetupMeteredVariable.

void SetupOutputVariable(std::string const &VariableName,           // String Name of variable (with units)
                         OutputProcessor::Unit const &VariableUnit, // Actual units corresponding to the actual variable
                         Real64 &ActualVariable,                    // Actual Variable, used to set up pointer
                         std::string const &IndexTypeKey,           // Zone, HeatBalance=1, HVAC, System, Plant=2
                         std::string const &VariableTypeKey,        // State, Average=1, NonState, Sum=2
                         std::string const &KeyedValue,             // Associated Key for this variable
                         Optional_string_const ReportFreq = _,      // Internal use -- causes reporting at this freqency
                         Optional_string_const ResourceTypeKey = _, // Meter Resource Type (Electricity, Gas, etc)
                         Optional_string_const EndUseKey = _,       // Meter End Use Key (Lights, Heating, Cooling, etc)
                         Optional_string_const EndUseSubKey = _,    // Meter End Use Sub Key (General Lights, Task Lights, etc)
                         Optional_string_const GroupKey = _,        // Meter Super Group Key (Building, System, Plant)
                         Optional_string_const ZoneKey = _,         // Meter Zone Key (zone name)
                         Optional_int_const ZoneMult = _,           // Zone Multiplier, defaults to 1
                         Optional_int_const ZoneListMult = _,       // Zone List Multiplier, defaults to 1
                         Optional_int_const indexGroupKey = _,      // Group identifier for SQL output
                         Optional_string_const customUnitName = _   // the custom name for the units from EMS definition of units
);

void SetupOutputVariable(std::string const &VariableName,           // String Name of variable
                         OutputProcessor::Unit const &VariableUnit, // Actual units corresponding to the actual variable
                         int &ActualVariable,                       // Actual Variable, used to set up pointer
                         std::string const &IndexTypeKey,           // Zone, HeatBalance=1, HVAC, System, Plant=2
                         std::string const &VariableTypeKey,        // State, Average=1, NonState, Sum=2
                         std::string const &KeyedValue,             // Associated Key for this variable
                         Optional_string_const ReportFreq = _,      // Internal use -- causes reporting at this freqency
                         Optional_int_const indexGroupKey = _       // Group identifier for SQL output
);

void SetupOutputVariable(std::string const &VariableName,           // String Name of variable
                         OutputProcessor::Unit const &VariableUnit, // Actual units corresponding to the actual variable
                         Real64 &ActualVariable,                    // Actual Variable, used to set up pointer
                         std::string const &IndexTypeKey,           // Zone, HeatBalance=1, HVAC, System, Plant=2
                         std::string const &VariableTypeKey,        // State, Average=1, NonState, Sum=2
                         int const KeyedValue,                      // Associated Key for this variable
                         Optional_string_const ReportFreq = _,      // Internal use -- causes reporting at this freqency
                         Optional_string_const ResourceTypeKey = _, // Meter Resource Type (Electricity, Gas, etc)
                         Optional_string_const EndUseKey = _,       // Meter End Use Key (Lights, Heating, Cooling, etc)
                         Optional_string_const EndUseSubKey = _,    // Meter End Use Sub Key (General Lights, Task Lights, etc)
                         Optional_string_const GroupKey = _,        // Meter Super Group Key (Building, System, Plant)
                         Optional_string_const ZoneKey = _,         // Meter Zone Key (zone name)
                         Optional_int_const ZoneMult = _,           // Zone Multiplier, defaults to 1
                         Optional_int_const ZoneListMult = _,       // Zone List Multiplier, defaults to 1
                         Optional_int_const indexGroupKey = _       // Group identifier for SQL output
);

This issue was first discussed in #7556.

Checklist

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Defect file added (list location of defect file here)
  • Ticket added to Pivotal for defect (development team task)
  • Pull request created (the pull request will have additional tasks related to reviewing changes that fix this defect)

@mjwitte and @rraustad Please add to this description.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the SetupOutputVariable signatures shown in this issue and the earlier discussion in #7556. Determine the intended consistent argument order, how optional arguments should be removed, and whether output and metered variables need distinct names. Done means the agreed API cleanup is applied across the sweep, but the issue does not name files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.