NREL/OpenStudio — pull request #813 by macumber (2014-01-21 17:07:11+00:00)
Title: 60055098 space type standards

This pull request is a small start towards a larger goal of being able to access the standards data in the OpenStudio-standards project directly from OpenStudio. Here is a header of the desired end project, StandardsLibrary. This class would be in a new library and be similar to other translators. Please review this overall design. If it is acceptable I can start implementing pieces of this now, otherwise I am happy to wait. Once we like the overall plan I would like to revisit the design/implementation of the ClimateZone, ConstructionBaseStandardsInformation, and BuildingStandardsInformation classes to make them compatible.

//StandardsLibrary is a class that is modelled after the translators
//It takes an input model and provides an output model
//The StandardsLibrary has several resources compiled into it
//These resources come from the OpenStudio-Resources project, https://github.com/NREL/openstudio-standards
//This class can be used in a measure and can include user defined standards as resources to the measure
class StandardsLibrary{

// gets built with access to default standard libraries
StandardsLibrary();

// this is the path to a directory containing an export of a standards format worksheet using
// the OpenStudio-Resources project, https://github.com/NREL/openstudio-standards
// this directory contains several JSON files as well as osm files with schedules and constructions
bool addStandard(const openstudio::path& standardsDir);

std::vector availableStandards() const;
std::vector availableClimateZones(const std::string& standard) const;
std::vector availableBuildingTypes(const std::string& standard) const;
std::vector availableSpaceTypes(const std::string& standard, const std::string& buildingType) const;

// there would be a lot of this stuff
boost::optional lightingPowerDensity(const std::string& standard, const std::string& climateZone,
const std::string& buildingType, const std::string& spaceType) const;
boost::optional lightingPowerSchedule(const std::string& standard, const std::string& climateZone,
const std::string& buildingType, const std::string& spaceType) const;
// .... more stuff like this

// get a populated space type
boost::optional getSpaceType(const std::string& standard, const std::string& climateZone,
const std::string& buildingType, const std::string& spaceType) const;

// apply the standard to the input model
// building and space types are taken from space type objects in the model
// the overall building type is taken from the building level space type
// the model contains multiple climate zones, this will select the one appropriate for the standard
bool apply(const std::string& standard, openstudio::Model& model) const;

// if the model contains space types that the standard doesn't know about this will result in errors
std::vector info() const;
std::vector warnings() const;
std::vector errors() const;
};

// Workflow to make a template file
1) Loop over desired standards, climate zones, building types, and space types and call getSpaceType

// Workflow to apply a standard to your model
1) Get weather file from BCL, will include ClimateZone object with multiple climate zones labelled
2) Mark all space types in your model with standards building type and standards space type
3) Assign space types to all spaces in your model
4) Assign a building level space type