Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

Getters follow the convention of being called get<ClassName>s().

The class is called FuelFactors. Note the existing s.

So logically, the getter is getFuelFactorss() (double s).

The same goes for getLightss().

TL;DR: Getters follow the convention of being called get<ClassName>s().

The class is called FuelFactors. Note the existing s.

So logically, the getter is getFuelFactorss() (double s).

The same goes for getLightss().


If you want an explanation you didn't ask for, this is because we're using a C++ template: https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model.hpp#L469-L470

template <typename T>
std::vector<T> getModelObjects(bool sorted = false);

This exposed to the target language via SWIG bindings, and we transform that to a method called get<T>s() automatically.

  • https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model_Common_Include.i#L407-L413
  • https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model_Common_Include.i#L75C1-L75C139

The same is true for the ruby IdfObject.to_ClassName(). The C++ equivalent is template<typename T> boost::optional<T> IdfObject::cast()

TL;DR: Getters follow the convention of being called get<ClassName>s().

The class is called FuelFactors. Note the existing s.

So logically, the getter is getFuelFactorss() (double s).

The same goes for getLightss().


If you want an explanation you didn't ask for, this is because we're using a C++ template: https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model.hpp#L469-L470

template <typename T>
std::vector<T> getModelObjects(bool sorted = false);

This exposed to the target language via SWIG bindings, and we transform that to a method called get<T>s() automatically.

  • https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model_Common_Include.i#L407-L413
  • https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model_Common_Include.i#L75C1-L75C139

The same is true for the ruby IdfObject.to_ClassName(). The C++ equivalent is template<typename T> boost::optional<T> IdfObject::cast()


Here are all of the similar std::vector<T> get<T>s() that end with at least a double s, from python

import openstudio
import re
import inspect


RE_GET = re.compile(r'^get.+ss$')
getters = []
model = openstudio.model.Model()

for method_name in dir(model):
    method = getattr(model, method_name)
    if not inspect.ismethod(method):
        continue
    if not RE_GET.match(method_name):
        continue
    if not len(inspect.signature(method).parameters) == 0:
        continue
    getters.append(method_name)



['getAdditionalPropertiess',
 'getAirLoopHVACUnitaryHeatCoolVAVChangeoverBypasss',
 'getAirflowNetworkDuctViewFactorss',
 'getAirflowNetworkReferenceCrackConditionss',
 'getCoilHeatingGass',
 'getCoolingTowerPerformanceCoolToolss',
 'getDefaultSubSurfaceConstructionss',
 'getDefaultSurfaceConstructionss',
 'getElectricLoadCenterInverterPVWattss',
 'getExteriorLightss',
 'getFuelFactorss',
 'getGass',
 'getGeneratorPVWattss',
 'getHumidifierSteamGass',
 'getInternalMasss',
 'getLightss',
 'getMaterialPropertyMoisturePenetrationDepthSettingss',
 'getMaterialPropertyPhaseChangeHysteresiss',
 'getOutputEnvironmentalImpactFactorss',
 'getRefrigerationDefrostCycleParameterss',
 'getRunPeriodControlSpecialDayss',
 'getScheduleTypeLimitss',
 'getSurfacePropertyConvectionCoefficientss',
 'getSurfacePropertyGroundSurfacess',
 'getSurfacePropertyOtherSideCoefficientss',
 'getSurfacePropertySurroundingSurfacess',
 'getWaterUseConnectionss',
 'getWeatherFileDayss'

TL;DR: Getters follow the convention of being called get<ClassName>s().

The class is called FuelFactors. Note the existing s.

So logically, the getter is getFuelFactorss() (double s).

The same goes for getLightss().


If you want an explanation you didn't ask for, this is because we're using a C++ template: https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model.hpp#L469-L470

template <typename T>
std::vector<T> getModelObjects(bool sorted = false);

This exposed to the target language via SWIG bindings, and we transform that to a method called get<T>s() automatically.

  • https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model_Common_Include.i#L407-L413
  • https://github.com/NREL/OpenStudio/blob/09472be58fa387840d7e07f93e41f4da97294478/src/model/Model_Common_Include.i#L75C1-L75C139

The same is true for the ruby IdfObject.to_ClassName(). The C++ equivalent is template<typename T> boost::optional<T> IdfObject::cast()


Here are all of the similar std::vector<T> get<T>s() that end with at least a double s, from python

import openstudio
import re
import inspect


RE_GET = re.compile(r'^get.+ss$')
getters = []
model = openstudio.model.Model()

for method_name in dir(model):
    method = getattr(model, method_name)
    if not inspect.ismethod(method):
        continue
    if not RE_GET.match(method_name):
        continue

    # Keep only those that take zero params
    if not len(inspect.signature(method).parameters) == != 0:
        continue
    getters.append(method_name)



['getAdditionalPropertiess',
 'getAirLoopHVACUnitaryHeatCoolVAVChangeoverBypasss',
 'getAirflowNetworkDuctViewFactorss',
 'getAirflowNetworkReferenceCrackConditionss',
 'getCoilHeatingGass',
 'getCoolingTowerPerformanceCoolToolss',
 'getDefaultSubSurfaceConstructionss',
 'getDefaultSurfaceConstructionss',
 'getElectricLoadCenterInverterPVWattss',
 'getExteriorLightss',
 'getFuelFactorss',
 'getGass',
 'getGeneratorPVWattss',
 'getHumidifierSteamGass',
 'getInternalMasss',
 'getLightss',
 'getMaterialPropertyMoisturePenetrationDepthSettingss',
 'getMaterialPropertyPhaseChangeHysteresiss',
 'getOutputEnvironmentalImpactFactorss',
 'getRefrigerationDefrostCycleParameterss',
 'getRunPeriodControlSpecialDayss',
 'getScheduleTypeLimitss',
 'getSurfacePropertyConvectionCoefficientss',
 'getSurfacePropertyGroundSurfacess',
 'getSurfacePropertyOtherSideCoefficientss',
 'getSurfacePropertySurroundingSurfacess',
 'getWaterUseConnectionss',
 'getWeatherFileDayss'