bool Lights_Impl::isAbsolute() const { LightsDefinition definition = lightsDefinition(); if (definition.lightingLevel()) { return true; } return false; }
bool Lights_Impl::hardSize() { boost::optional<Space> space = this->space(); if (!space){ return false; } this->makeUnique(); LightsDefinition lightsDefinition = this->lightsDefinition(); for (LifeCycleCost cost : lightsDefinition.lifeCycleCosts()){ cost.convertToCostPerEach(); } boost::optional<double> lightingLevel = lightsDefinition.lightingLevel(); if (lightingLevel){ return true; } boost::optional<double> wattsperSpaceFloorArea = lightsDefinition.wattsperSpaceFloorArea(); if (wattsperSpaceFloorArea){ return lightsDefinition.setLightingLevel(*wattsperSpaceFloorArea * space->floorArea()); } boost::optional<double> wattsperPerson = lightsDefinition.wattsperPerson(); if (wattsperPerson){ return lightsDefinition.setLightingLevel(*wattsperPerson * space->numberOfPeople()); } return false; }
boost::optional<IdfObject> ForwardTranslator::translateLights( Lights & modelObject ) { // create, register, and name object IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Lights, modelObject); for (LifeCycleCost lifeCycleCost : modelObject.lifeCycleCosts()){ translateAndMapModelObject(lifeCycleCost); } LightsDefinition definition = modelObject.lightsDefinition(); OptionalIdfObject relatedIdfObject; boost::optional<Space> space = modelObject.space(); boost::optional<SpaceType> spaceType = modelObject.spaceType(); if (space){ boost::optional<ThermalZone> thermalZone = space->thermalZone(); if (thermalZone){ relatedIdfObject = translateAndMapModelObject(*thermalZone); OS_ASSERT(relatedIdfObject); idfObject.setString(LightsFields::ZoneorZoneListName, relatedIdfObject->name().get()); } }else if(spaceType){ relatedIdfObject = translateAndMapModelObject(*spaceType); OS_ASSERT(relatedIdfObject); idfObject.setString(LightsFields::ZoneorZoneListName, relatedIdfObject->name().get()); } boost::optional<Schedule> schedule = modelObject.schedule(); if (schedule){ relatedIdfObject = translateAndMapModelObject(*schedule); OS_ASSERT(relatedIdfObject); idfObject.setString(LightsFields::ScheduleName, relatedIdfObject->name().get()); } idfObject.setString(LightsFields::DesignLevelCalculationMethod, definition.designLevelCalculationMethod()); double multiplier = modelObject.multiplier(); boost::optional<double> d = definition.lightingLevel(); if (d){ idfObject.setDouble(LightsFields::LightingLevel, (*d)*multiplier); } d = definition.wattsperSpaceFloorArea(); if (d){ idfObject.setDouble(LightsFields::WattsperZoneFloorArea, (*d)*multiplier); } d = definition.wattsperPerson(); if (d){ idfObject.setDouble(LightsFields::WattsperPerson, (*d)*multiplier); } if (!definition.isReturnAirFractionDefaulted()){ idfObject.setDouble(LightsFields::ReturnAirFraction, definition.returnAirFraction()); } if (!definition.isFractionRadiantDefaulted()){ idfObject.setDouble(LightsFields::FractionRadiant, definition.fractionRadiant()); } if (!definition.isFractionVisibleDefaulted()){ idfObject.setDouble(LightsFields::FractionVisible, definition.fractionVisible()); } if (!modelObject.isFractionReplaceableDefaulted()){ idfObject.setDouble(LightsFields::FractionReplaceable, modelObject.fractionReplaceable()); } if (!modelObject.isEndUseSubcategoryDefaulted()){ idfObject.setString(LightsFields::EndUseSubcategory, modelObject.endUseSubcategory()); } if (!definition.isReturnAirFractionCalculatedfromPlenumTemperatureDefaulted()){ if (definition.returnAirFractionCalculatedfromPlenumTemperature()){ idfObject.setString(LightsFields::ReturnAirFractionCalculatedfromPlenumTemperature,"Yes"); }else{ idfObject.setString(LightsFields::ReturnAirFractionCalculatedfromPlenumTemperature,"No"); } } if (!definition.isReturnAirFractionFunctionofPlenumTemperatureCoefficient1Defaulted()){ idfObject.setDouble(LightsFields::ReturnAirFractionFunctionofPlenumTemperatureCoefficient1, definition.returnAirFractionFunctionofPlenumTemperatureCoefficient1()); } if (!definition.isReturnAirFractionFunctionofPlenumTemperatureCoefficient2Defaulted()){ idfObject.setDouble(LightsFields::ReturnAirFractionFunctionofPlenumTemperatureCoefficient2, definition.returnAirFractionFunctionofPlenumTemperatureCoefficient2()); } return idfObject; }
bool Lights_Impl::setLightsDefinition(const LightsDefinition& definition) { return this->setPointer(this->definitionIndex(), definition.handle()); }