本文整理汇总了C++中IdfExtensibleGroup::setDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ IdfExtensibleGroup::setDouble方法的具体用法?C++ IdfExtensibleGroup::setDouble怎么用?C++ IdfExtensibleGroup::setDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IdfExtensibleGroup
的用法示例。
在下文中一共展示了IdfExtensibleGroup::setDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setYearEscalation
bool LifeCycleCostUsePriceEscalation_Impl::setYearEscalation(unsigned index, double num) {
IdfExtensibleGroup eg = getExtensibleGroup(index);
if (!eg.empty()) {
return eg.setDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation,num);
}
else {
StringVector values(1u);
eg = insertExtensibleGroup(index,values);
if (!eg.empty()) {
return eg.setDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation,num);
}
}
return false;
}
示例2: idfObject
boost::optional<IdfObject> ForwardTranslator::translateMaterialPropertyGlazingSpectralData( MaterialPropertyGlazingSpectralData & modelObject )
{
IdfObject idfObject(openstudio::IddObjectType::MaterialProperty_GlazingSpectralData);
m_idfObjects.push_back(idfObject);
idfObject.setString(openstudio::MaterialProperty_GlazingSpectralDataFields::Name, modelObject.name().get());
idfObject.clearExtensibleGroups();
for (const auto& spectralDataField : modelObject.spectralDataFields()){
IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
OS_ASSERT(group.numFields() == 4);
group.setDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::Wavelength, spectralDataField.wavelength());
group.setDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::transmittance, spectralDataField.transmittance());
group.setDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::frontreflectance, spectralDataField.frontReflectance());
group.setDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::backreflectance, spectralDataField.backReflectance());
}
return boost::optional<IdfObject>(idfObject);
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:20,代码来源:ForwardTranslateMaterialPropertyGlazingSpectralData.cpp
示例3: createRegisterAndNameIdfObject
boost::optional<IdfObject> ForwardTranslator::translateScheduleDay( ScheduleDay & modelObject )
{
IdfObject scheduleDay = createRegisterAndNameIdfObject(openstudio::IddObjectType::Schedule_Day_Interval,
modelObject);
boost::optional<ScheduleTypeLimits> scheduleTypeLimits = modelObject.scheduleTypeLimits();
if (scheduleTypeLimits){
boost::optional<IdfObject> idfScheduleTypeLimits = translateAndMapModelObject(*scheduleTypeLimits);
if (idfScheduleTypeLimits){
scheduleDay.setString(Schedule_Day_IntervalFields::ScheduleTypeLimitsName, idfScheduleTypeLimits->name().get());
}
}
if (modelObject.interpolatetoTimestep()){
scheduleDay.setString(Schedule_Day_IntervalFields::InterpolatetoTimestep, "Yes");
}else{
scheduleDay.setString(Schedule_Day_IntervalFields::InterpolatetoTimestep, "No");
}
std::vector<double> values = modelObject.values();
std::vector<openstudio::Time> times = modelObject.times();
unsigned N = values.size();
OS_ASSERT(N == times.size());
scheduleDay.clearExtensibleGroups();
for (unsigned i = 0; i < N; ++i){
IdfExtensibleGroup group = scheduleDay.pushExtensibleGroup();
std::string hourPrefix;
std::string minutePrefix;
int hours = times[i].hours() + 24*times[i].days();
if (hours < 10){
hourPrefix = "0";
}
int minutes = times[i].minutes() + floor((times[i].seconds()/60.0) + 0.5);
if (minutes < 10){
minutePrefix = "0";
}
std::stringstream ss;
ss << hourPrefix << hours << ":" << minutePrefix << minutes;
group.setString(Schedule_Day_IntervalExtensibleFields::Time, ss.str());
group.setDouble(Schedule_Day_IntervalExtensibleFields::ValueUntilTime, values[i]);
}
return scheduleDay;
}
示例4: addValue
bool ScheduleDay_Impl::addValue(const openstudio::Time& untilTime, double value) {
if (untilTime.totalMinutes() <= 0.5 || untilTime.totalDays() > 1.0) {
return false;
}
int untilHours = untilTime.hours() + 24*untilTime.days();
int untilMinutes = untilTime.minutes() + floor((untilTime.seconds()/60.0) + 0.5);
if (untilMinutes >= 60){
untilHours += 1;
untilMinutes += -60;
}
// use set to determine whether to overwrite or insert, and where
std::set<openstudio::Time> times;
std::pair<std::set<openstudio::Time>::const_iterator,bool> insertResult;
for (const openstudio::Time& time : this->times()) {
insertResult = times.insert(time);
OS_ASSERT(insertResult.second);
}
insertResult = times.insert(untilTime);
unsigned index = std::distance<std::set<openstudio::Time>::const_iterator>(times.begin(),insertResult.first);
OS_ASSERT(index <= numExtensibleGroups());
bool result(true);
if (insertResult.second) {
// new time--insert an extensible group
std::vector<std::string> groupValues;
groupValues.push_back(boost::lexical_cast<std::string>(untilHours));
groupValues.push_back(boost::lexical_cast<std::string>(untilMinutes));
groupValues.push_back(toString(value));
IdfExtensibleGroup group = insertExtensibleGroup(index, groupValues);
OS_ASSERT(!group.empty());
}
else {
// time already exists, overwrite value
IdfExtensibleGroup group = getExtensibleGroup(index);
result = group.setDouble(OS_Schedule_DayExtensibleFields::ValueUntilTime,value);
}
return result;
}
示例5: makeUsePriceEscalation
void makeUsePriceEscalation(boost::optional<double> rate, const std::string& fuelName, const std::string& baseDateMonth, int baseDateYear, int lengthOfStudyPeriodInYears, std::vector<IdfObject>& idfObjects)
{
if (!rate || rate.get() == 0){
return;
}
IdfObject idfObject(IddObjectType::LifeCycleCost_UsePriceEscalation);
idfObject.setName(fuelName + " Use Price Escalation");
idfObject.setString(LifeCycleCost_UsePriceEscalationFields::Resource, fuelName);
idfObject.setInt(LifeCycleCost_UsePriceEscalationFields::EscalationStartYear, baseDateYear);
idfObject.setString(LifeCycleCost_UsePriceEscalationFields::EscalationStartMonth, baseDateMonth);
for (int i = 0; i < lengthOfStudyPeriodInYears; ++i){
IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
double value = pow(1.0+rate.get(), i);
group.setDouble(LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation, value);
}
idfObjects.push_back(idfObject);
}
示例6: operationSchemes
boost::optional<IdfObject> ForwardTranslator::translatePlantEquipmentOperationSchemes( PlantLoop & plantLoop )
{
IdfObject operationSchemes(IddObjectType::PlantEquipmentOperationSchemes);
m_idfObjects.push_back(operationSchemes);
operationSchemes.setName(plantLoop.name().get() + " Operation Schemes");
// Lambda does what the name suggests, create setpoint operation schemes.
// This is for any component that has a setpoint manager on its outlet node
auto createSetpointOperationScheme = [&](PlantLoop & plantLoop) {
const auto & t_setpointComponents = setpointComponents(plantLoop);
if( ! t_setpointComponents.empty() ) {
Schedule alwaysOn = plantLoop.model().alwaysOnDiscreteSchedule();
IdfObject setpointOperation(IddObjectType::PlantEquipmentOperation_ComponentSetpoint);
setpointOperation.setName(plantLoop.name().get() + " Setpoint Operation Scheme");
m_idfObjects.push_back(setpointOperation);
setpointOperation.clearExtensibleGroups();
IdfExtensibleGroup eg = operationSchemes.pushExtensibleGroup();
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType,setpointOperation.iddObject().name());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName,setpointOperation.name().get());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName,alwaysOn.name().get());
for( auto setpointComponent : t_setpointComponents )
{
boost::optional<IdfObject> _idfObject = translateAndMapModelObject(setpointComponent);
OS_ASSERT(_idfObject);
IdfExtensibleGroup eg = setpointOperation.pushExtensibleGroup();
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::EquipmentObjectType,_idfObject->iddObject().name());
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::EquipmentName,_idfObject->name().get());
if( const auto & t_inletNode = inletNode(plantLoop,setpointComponent) ) {
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::DemandCalculationNodeName,t_inletNode->name().get());
}
if( const auto & t_outletNode = outletNode(plantLoop,setpointComponent) ) {
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::SetpointNodeName,t_outletNode->name().get());
}
if( auto value = flowrate(setpointComponent) ) {
eg.setDouble(PlantEquipmentOperation_ComponentSetpointExtensibleFields::ComponentFlowRate,value.get());
} else {
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::ComponentFlowRate,"Autosize");
}
auto t_componentType = componentType(setpointComponent);
switch(t_componentType)
{
case ComponentType::HEATING :
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::OperationType,"Heating");
break;
case ComponentType::COOLING :
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::OperationType,"Cooling");
break;
default :
eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::OperationType,"Dual");
break;
}
}
}
};
Schedule alwaysOn = plantLoop.model().alwaysOnDiscreteSchedule();
bool applyDefault = true;
// If any operation schemes are defined in the model then don't apply default operation schemes
if( auto coolingLoadScheme = plantLoop.plantEquipmentOperationCoolingLoad() ) {
auto _scheme = translateAndMapModelObject(coolingLoadScheme.get());
OS_ASSERT(_scheme);
auto eg = operationSchemes.pushExtensibleGroup();
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType,_scheme->iddObject().name());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName,_scheme->name().get());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName,alwaysOn.name().get());
applyDefault = false;
}
if( auto heatingLoadScheme = plantLoop.plantEquipmentOperationHeatingLoad() ) {
auto _scheme = translateAndMapModelObject(heatingLoadScheme.get());
OS_ASSERT(_scheme);
auto eg = operationSchemes.pushExtensibleGroup();
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType,_scheme->iddObject().name());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName,_scheme->name().get());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName,alwaysOn.name().get());
applyDefault = false;
}
if( auto primaryScheme = plantLoop.primaryPlantEquipmentOperationScheme() ) {
auto _scheme = translateAndMapModelObject(primaryScheme.get());
OS_ASSERT(_scheme);
auto eg = operationSchemes.pushExtensibleGroup();
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType,_scheme->iddObject().name());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName,_scheme->name().get());
eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName,alwaysOn.name().get());
createSetpointOperationScheme(plantLoop);
applyDefault = false;
}
if( applyDefault ) {
//.........这里部分代码省略.........
示例7: createRegisterAndNameIdfObject
boost::optional<IdfObject> ForwardTranslator::translateZoneHVACBaseboardRadiantConvectiveElectric(ZoneHVACBaseboardRadiantConvectiveElectric& modelObject)
{
boost::optional<std::string> s;
boost::optional<double> value;
boost::optional<ModelObject> temp;
// Name
IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneHVAC_Baseboard_RadiantConvective_Electric, modelObject);
// AvailabilityScheduleName
{
auto schedule = modelObject.availabilitySchedule();
if( auto _schedule = translateAndMapModelObject(schedule) ) {
idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::AvailabilityScheduleName,_schedule->name().get());
}
}
// HeatingDesignCapacityMethod
if( (s = modelObject.heatingDesignCapacityMethod()) ) {
idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacityMethod,s.get());
}
// HeatingDesignCapacity
if( modelObject.isHeatingDesignCapacityAutosized() ) {
idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacity,"AutoSize");
} else if( (value = modelObject.heatingDesignCapacity()) ) {
idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacity,value.get());
}
// HeatingDesignCapacityPerFloorArea
if( (value = modelObject.heatingDesignCapacityPerFloorArea()) ) {
idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacityPerFloorArea,value.get());
}
// FractionofAutosizedHeatingDesignCapacity
if( (value = modelObject.fractionofAutosizedHeatingDesignCapacity()) ) {
idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::FractionofAutosizedHeatingDesignCapacity,value.get());
}
// Efficiency
if( (value = modelObject.efficiency()) ) {
idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::Efficiency,value.get());
}
// FractionRadiant
if( (value = modelObject.fractionRadiant()) ) {
idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::FractionRadiant,value.get());
}
// FractionofRadiantEnergyIncidentonPeople
double fractionofRadiantEnergyIncidentonPeople = modelObject.fractionofRadiantEnergyIncidentonPeople();
{
idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::FractionofRadiantEnergyIncidentonPeople,fractionofRadiantEnergyIncidentonPeople);
}
//get rid of any existing surface (just to be safe)
idfObject.clearExtensibleGroups();
//aggregator for total area; will be used to create weighted area
double totalAreaOfWallSurfaces = 0;
double totalAreaOfCeilingSurfaces = 0;
double totalAreaOfFloorSurfaces = 0;
//loop through all surfaces, adding up their area
auto const& surfaces = modelObject.getImpl<model::detail::ZoneHVACBaseboardRadiantConvectiveElectric_Impl>()->surfaces();
for ( auto const& surface : surfaces ) {
if( istringEqual(surface.surfaceType(),"Floor") ) {
totalAreaOfFloorSurfaces += surface.grossArea();
} else if( istringEqual(surface.surfaceType(),"RoofCeiling") ) {
totalAreaOfCeilingSurfaces += surface.grossArea();
} else {
totalAreaOfWallSurfaces += surface.grossArea();
}
}
// Assume that 5% of what is not on people is on the floor
double fractionOnFloor = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.05;
// Assume that 55% of what is not on people is on the walls
double fractionOnWall = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.55;
// Assume that 40% of what is not on people is on the ceiling
double fractionOnCeiling = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.40;
//loop through all the surfaces, adding them and their flow fractions (weighted per-area)
for ( auto const& surface : surfaces ) {
IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
group.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::SurfaceName, surface.name().get());
if( istringEqual(surface.surfaceType(),"Floor") ) {
group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::FractionofRadiantEnergytoSurface, (surface.grossArea()/totalAreaOfFloorSurfaces * fractionOnFloor) );
} else if( istringEqual(surface.surfaceType(),"RoofCeiling") ) {
group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::FractionofRadiantEnergytoSurface, (surface.grossArea()/totalAreaOfCeilingSurfaces * fractionOnCeiling) );
} else {
group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::FractionofRadiantEnergytoSurface, (surface.grossArea()/totalAreaOfWallSurfaces * fractionOnWall) );
}
}
return idfObject;
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:97,代码来源:ForwardTranslateZoneHVACBaseboardRadiantConvectiveElectric.cpp
示例8: defrostEndTime
boost::optional<IdfObject> ForwardTranslator::translateRefrigerationWalkIn( RefrigerationWalkIn & modelObject )
{
OptionalModelObject temp;
boost::optional<std::string> s;
boost::optional<double> d;
// Name
IdfObject refrigerationWalkIn = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_WalkIn,
modelObject);
//AvailabilityScheduleName
boost::optional<Schedule> availabilitySchedule = modelObject.availabilitySchedule();
if( availabilitySchedule )
{
boost::optional<IdfObject> _availabilitySchedule = translateAndMapModelObject(availabilitySchedule.get());
if( _availabilitySchedule && _availabilitySchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::AvailabilityScheduleName,_availabilitySchedule->name().get());
}
}
//RatedCoilCoolingCapacity
d = modelObject.ratedCoilCoolingCapacity();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoilCoolingCapacity,d.get());
}
//OperatingTemperature
d = modelObject.operatingTemperature();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::OperatingTemperature,d.get());
}
//RatedCoolingSourceTemperature
d = modelObject.ratedCoolingSourceTemperature();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoolingSourceTemperature,d.get());
}
//RatedTotalHeatingPower
d = modelObject.ratedTotalHeatingPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedTotalHeatingPower,d.get());
}
//HeatingPowerScheduleName
boost::optional<Schedule> heatingPowerSchedule = modelObject.heatingPowerSchedule();
if( heatingPowerSchedule )
{
boost::optional<IdfObject> _heatingPowerSchedule = translateAndMapModelObject(heatingPowerSchedule.get());
if( _heatingPowerSchedule && _heatingPowerSchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::HeatingPowerScheduleName,_heatingPowerSchedule->name().get());
}
}
//RatedCoolingCoilFanPower
d = modelObject.ratedCoolingCoilFanPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoolingCoilFanPower,d.get());
}
//RatedCirculationFanPower
d = modelObject.ratedCirculationFanPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCirculationFanPower,d.get());
}
//RatedTotalLightingPower
d = modelObject.ratedTotalLightingPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedTotalLightingPower,d.get());
}
//LightingScheduleName
boost::optional<Schedule> lightingSchedule = modelObject.lightingSchedule();
if( lightingSchedule )
{
boost::optional<IdfObject> _lightingSchedule = translateAndMapModelObject(lightingSchedule.get());
if( _lightingSchedule && _lightingSchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::LightingScheduleName,_lightingSchedule->name().get());
}
}
//DefrostType
s = modelObject.defrostType();
if (s) {
refrigerationWalkIn.setString(Refrigeration_WalkInFields::DefrostType,s.get());
}
//DefrostControlType
s = modelObject.defrostControlType();
if (s) {
//.........这里部分代码省略.........
示例9: createRegisterAndNameIdfObject
boost::optional<IdfObject> ForwardTranslator::translateGroundHeatExchangerVertical( GroundHeatExchangerVertical & modelObject )
{
boost::optional<std::string> s;
boost::optional<double> value;
boost::optional<ModelObject> temp;
// Name
IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::GroundHeatExchanger_Vertical, modelObject);
// Inlet Node Name
if( (temp = modelObject.inletModelObject()) )
{
idfObject.setString(GroundHeatExchanger_VerticalFields::InletNodeName,temp->name().get());
}
// Outlet Node Name
if( (temp = modelObject.outletModelObject()) )
{
idfObject.setString(GroundHeatExchanger_VerticalFields::OutletNodeName,temp->name().get());
}
// Maximum Flow Rate
if( (value = modelObject.maximumFlowRate()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::DesignFlowRate,value.get());
}
// Number of Bore Holes
if( (value = modelObject.numberofBoreHoles()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::NumberofBoreHoles,value.get());
}
// Bore Hole Length
if( (value = modelObject.boreHoleLength()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::BoreHoleLength,value.get());
}
// Bore Hole Radius
if( (value = modelObject.boreHoleRadius()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::BoreHoleRadius,value.get());
}
// Ground Thermal Conductivity
if( (value = modelObject.groundThermalConductivity()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::GroundThermalConductivity,value.get());
}
// Ground Thermal Heat Capacity
if( (value = modelObject.groundThermalHeatCapacity()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::GroundThermalHeatCapacity,value.get());
}
// Ground Temperature
if( (value = modelObject.groundTemperature()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::GroundTemperature,value.get());
}
// Design Flow Rate
if( (value = modelObject.designFlowRate()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::DesignFlowRate,value.get());
}
// Grout Thermal Conductivity
if( (value = modelObject.groutThermalConductivity()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::GroutThermalConductivity,value.get());
}
// Pipe Thermal Conductivity
if( (value = modelObject.pipeThermalConductivity()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::PipeThermalConductivity,value.get());
}
// Pipe Out Diameter
if( (value = modelObject.pipeOutDiameter()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::PipeOutDiameter,value.get());
}
// U-Tube Distance
if( (value = modelObject.uTubeDistance()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::UTubeDistance,value.get());
}
// Pipe Thickness
if( (value = modelObject.pipeThickness()) )
{
idfObject.setDouble(GroundHeatExchanger_VerticalFields::PipeThickness,value.get());
}
// Maximum Length of Simulation
//.........这里部分代码省略.........
示例10: idfObject
boost::optional<IdfObject> ForwardTranslator::translateZoneHVACLowTempRadiantConstFlow(ZoneHVACLowTempRadiantConstFlow& modelObject)
{
boost::optional<std::string> s;
boost::optional<double> value;
boost::optional<ModelObject> temp;
IdfObject idfObject(IddObjectType::ZoneHVAC_LowTemperatureRadiant_ConstantFlow);
m_idfObjects.push_back(idfObject);
//Name
std::string baseName = modelObject.name().get();
idfObject.setName(baseName);
// AvailabilityScheduleName
if( boost::optional<Schedule> schedule = modelObject.availabilitySchedule() )
{
if( boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get()) )
{
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::AvailabilityScheduleName,_schedule->name().get());
}
}
//field Zone Name
boost::optional<std::string> thermalZoneName;
if( boost::optional<ThermalZone> zone = modelObject.thermalZone() )
{
if( (s = zone->name()) )
{
thermalZoneName = s;
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::ZoneName,thermalZoneName.get());
}
}
//field Surface Name or Radiant Surface Type
//create a new surface group object
IdfObject _surfaceGroup(IddObjectType::ZoneHVAC_LowTemperatureRadiant_SurfaceGroup);
//create a name for the surface group
std::string sname = baseName + "" + modelObject.radiantSurfaceType().get();
_surfaceGroup.setName(sname);
//attach the surface group to the zone low temp radiant object
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::SurfaceNameorRadiantSurfaceGroupName,sname);
//get rid of any existing surface (just to be safe)
idfObject.clearExtensibleGroups();
//aggregator for total area; will be used to create weighted area
double totalAreaOfSurfaces = 0;
//loop through all surfaces, adding up their area
for (const Surface& surface : modelObject.surfaces()){
totalAreaOfSurfaces = totalAreaOfSurfaces + surface.grossArea();
}
//loop through all the surfaces, adding them and their flow fractions (weighted per-area)
for (const Surface& surface : modelObject.surfaces()){
IdfExtensibleGroup group = _surfaceGroup.pushExtensibleGroup();
OS_ASSERT(group.numFields() == 2);
group.setString(0, surface.name().get());
group.setDouble(1, (surface.grossArea()/totalAreaOfSurfaces) );
}
//add the surface group to the list of idf objects
m_idfObjects.push_back(_surfaceGroup);
//field Hydronic Tubing Inside Diameter
if( (value = modelObject.hydronicTubingInsideDiameter()) )
{
idfObject.setDouble(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::HydronicTubingInsideDiameter,value.get());
}
//field Hydronic Tubing Length
if( (value = modelObject.hydronicTubingLength()) )
{
idfObject.setDouble(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::HydronicTubingLength,value.get());
}
//field Temperature Control Type
if(boost::optional<std::string> tempCtrlType= modelObject.temperatureControlType() )
{
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::TemperatureControlType,tempCtrlType.get());
}
//field Rated Flow Rate
if( (value = modelObject.ratedFlowRate()) )
{
idfObject.setDouble(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::RatedFlowRate,value.get());
}
//field Pump Flow Rate Schedule Name
if( boost::optional<Schedule> schedule = modelObject.pumpFlowRateSchedule() )
{
if( boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get()) )
{
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ConstantFlowFields::PumpFlowRateScheduleName,_schedule->name().get());
}
}
//.........这里部分代码省略.........
示例11: idfObject
boost::optional<IdfObject> ForwardTranslator::translateSubSurface( model::SubSurface & modelObject )
{
IdfObject idfObject(openstudio::IddObjectType::FenestrationSurface_Detailed);
idfObject.setString(FenestrationSurface_DetailedFields::Name, modelObject.name().get());
std::string subSurfaceType = modelObject.subSurfaceType();
if (istringEqual("FixedWindow", subSurfaceType)){
subSurfaceType = "Window";
}else if (istringEqual("OperableWindow", subSurfaceType)){
subSurfaceType = "Window";
}else if (istringEqual("OverheadDoor", subSurfaceType)){
subSurfaceType = "Door";
}else if (istringEqual("Skylight", subSurfaceType)){
subSurfaceType = "Window";
}
boost::optional<ConstructionBase> construction = modelObject.construction();
if (construction){
idfObject.setString(FenestrationSurface_DetailedFields::ConstructionName, construction->name().get());
if (subSurfaceType == "Door" && construction->isFenestration()){
LOG(Warn, "SubSurface '" << modelObject.name().get() << "' uses fenestration construction, changing SubSurfaceType to Door");
subSurfaceType = "GlassDoor";
} else if (subSurfaceType == "GlassDoor" && !construction->isFenestration()){
LOG(Warn, "SubSurface '" << modelObject.name().get() << "' uses non-fenestration construction, changing SubSurfaceType to GlassDoor");
subSurfaceType = "Door";
}
}
idfObject.setString(FenestrationSurface_DetailedFields::SurfaceType, subSurfaceType);
boost::optional<Surface> surface = modelObject.surface();
if (surface){
idfObject.setString(FenestrationSurface_DetailedFields::BuildingSurfaceName, surface->name().get());
}
boost::optional<SubSurface> adjacentSubSurface = modelObject.adjacentSubSurface();
if (adjacentSubSurface){
idfObject.setString(FenestrationSurface_DetailedFields::OutsideBoundaryConditionObject, adjacentSubSurface->name().get());
}
boost::optional<double> viewFactortoGround = modelObject.viewFactortoGround();
if (viewFactortoGround){
idfObject.setDouble(FenestrationSurface_DetailedFields::ViewFactortoGround, *viewFactortoGround);
}
boost::optional<ShadingControl> shadingControl = modelObject.shadingControl();
if (shadingControl){
idfObject.setString(FenestrationSurface_DetailedFields::ShadingControlName, shadingControl->name().get());
}
boost::optional<WindowPropertyFrameAndDivider> frameAndDivider = modelObject.windowPropertyFrameAndDivider();
openstudio::Vector3d offset(0, 0, 0);
if (frameAndDivider){
if (!frameAndDivider->isOutsideRevealDepthDefaulted()){
offset = -frameAndDivider->outsideRevealDepth() * modelObject.outwardNormal();
}
idfObject.setString(FenestrationSurface_DetailedFields::FrameandDividerName, frameAndDivider->name().get());
}
if(!modelObject.isMultiplierDefaulted()){
idfObject.setDouble(FenestrationSurface_DetailedFields::Multiplier, modelObject.multiplier());
}
idfObject.clearExtensibleGroups();
for (const Point3d& point : modelObject.vertices()){
IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
if (group.empty()) {
LOG(Error,"Currently unable to translate " << modelObject.briefDescription()
<< ", because it has more vertices than allowed by EnergyPlus.");
return boost::none;
}
Point3d newPoint = point + offset;
group.setDouble(0, newPoint.x());
group.setDouble(1, newPoint.y());
group.setDouble(2, newPoint.z());
}
m_idfObjects.push_back(idfObject);
return idfObject;
}
示例12: createRegisterAndNameIdfObject
boost::optional<IdfObject> ForwardTranslator::translateRefrigerationWalkIn( RefrigerationWalkIn & modelObject )
{
OptionalModelObject temp;
boost::optional<std::string> s;
boost::optional<double> d;
// Name
IdfObject refrigerationWalkIn = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_WalkIn,
modelObject);
//AvailabilityScheduleName
boost::optional<Schedule> availabilitySchedule = modelObject.availabilitySchedule();
if( availabilitySchedule )
{
boost::optional<IdfObject> _availabilitySchedule = translateAndMapModelObject(availabilitySchedule.get());
if( _availabilitySchedule && _availabilitySchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::AvailabilityScheduleName,_availabilitySchedule->name().get());
}
}
//RatedCoilCoolingCapacity
d = modelObject.ratedCoilCoolingCapacity();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoilCoolingCapacity,d.get());
}
//OperatingTemperature
d = modelObject.operatingTemperature();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::OperatingTemperature,d.get());
}
//RatedCoolingSourceTemperature
d = modelObject.ratedCoolingSourceTemperature();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoolingSourceTemperature,d.get());
}
//RatedTotalHeatingPower
d = modelObject.ratedTotalHeatingPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedTotalHeatingPower,d.get());
}
//HeatingPowerScheduleName
boost::optional<Schedule> heatingPowerSchedule = modelObject.heatingPowerSchedule();
if( heatingPowerSchedule )
{
boost::optional<IdfObject> _heatingPowerSchedule = translateAndMapModelObject(heatingPowerSchedule.get());
if( _heatingPowerSchedule && _heatingPowerSchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::HeatingPowerScheduleName,_heatingPowerSchedule->name().get());
}
}
//RatedCoolingCoilFanPower
d = modelObject.ratedCoolingCoilFanPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoolingCoilFanPower,d.get());
}
//RatedCirculationFanPower
d = modelObject.ratedCirculationFanPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCirculationFanPower,d.get());
}
//RatedTotalLightingPower
d = modelObject.ratedTotalLightingPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedTotalLightingPower,d.get());
}
//LightingScheduleName
boost::optional<Schedule> lightingSchedule = modelObject.lightingSchedule();
if( lightingSchedule )
{
boost::optional<IdfObject> _lightingSchedule = translateAndMapModelObject(lightingSchedule.get());
if( _lightingSchedule && _lightingSchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::LightingScheduleName,_lightingSchedule->name().get());
}
}
//DefrostType
s = modelObject.defrostType();
if (s) {
refrigerationWalkIn.setString(Refrigeration_WalkInFields::DefrostType,s.get());
}
//DefrostControlType
s = modelObject.defrostControlType();
if (s) {
//.........这里部分代码省略.........
示例13: IdfObject
boost::optional<IdfObject> ForwardTranslator::translateShadingSurface( model::ShadingSurface & modelObject )
{
boost::optional<IdfObject> idfObject;
boost::optional<Schedule> transmittanceSchedule = modelObject.transmittanceSchedule();
Transformation transformation;
Point3dVector points;
boost::optional<ShadingSurfaceGroup> shadingSurfaceGroup = modelObject.shadingSurfaceGroup();
if (shadingSurfaceGroup){
transformation = shadingSurfaceGroup->transformation();
points = transformation * modelObject.vertices();
if (istringEqual("Space", shadingSurfaceGroup->shadingSurfaceType())){
idfObject = IdfObject(openstudio::IddObjectType::Shading_Zone_Detailed);
idfObject->setString(Shading_Zone_DetailedFields::Name, modelObject.name().get());
boost::optional<Space> space = shadingSurfaceGroup->space();
if (space){
boost::optional<Surface> baseSurface;
double minDistance = std::numeric_limits<double>::max();
// at this point zone has one space and internal surfaces have already been combined
for (const Surface& surface : space->surfaces()){
if (istringEqual(surface.outsideBoundaryCondition(), "Outdoors")){
Point3dVector surfaceVertices = surface.vertices();
for (const Point3d& point : points){
for (const Point3d& surfaceVertex : surfaceVertices){
double distance = getDistance(point, surfaceVertex);
if (distance < minDistance){
baseSurface = surface;
minDistance = distance;
}
}
}
}
}
if (!baseSurface){
LOG(Error, "Cannot find appropriate base surface for shading surface '" << modelObject.name().get() <<
"', the shading surface will not be translated");
return boost::none;
}
idfObject->setString(Shading_Zone_DetailedFields::BaseSurfaceName, baseSurface->name().get());
}
if (transmittanceSchedule){
idfObject->setString(Shading_Zone_DetailedFields::TransmittanceScheduleName, transmittanceSchedule->name().get());
}
}else if (istringEqual("Site", shadingSurfaceGroup->shadingSurfaceType())){
idfObject = IdfObject(openstudio::IddObjectType::Shading_Site_Detailed);
idfObject->setString(Shading_Site_DetailedFields::Name, modelObject.name().get());
if (transmittanceSchedule){
idfObject->setString(Shading_Site_DetailedFields::TransmittanceScheduleName, transmittanceSchedule->name().get());
}
}else{
boost::optional<Building> building = modelObject.model().getUniqueModelObject<Building>();
if (building){
transformation = building->transformation().inverse()*transformation;
}
idfObject = IdfObject(openstudio::IddObjectType::Shading_Building_Detailed);
idfObject->setString(Shading_Building_DetailedFields::Name, modelObject.name().get());
if (transmittanceSchedule){
idfObject->setString(Shading_Building_DetailedFields::TransmittanceScheduleName, transmittanceSchedule->name().get());
}
}
}else{
idfObject = IdfObject(openstudio::IddObjectType::Shading_Building_Detailed);
idfObject->setString(Shading_Building_DetailedFields::Name, modelObject.name().get());
if (transmittanceSchedule){
idfObject->setString(Shading_Building_DetailedFields::TransmittanceScheduleName, transmittanceSchedule->name().get());
}
}
m_idfObjects.push_back(*idfObject);
idfObject->clearExtensibleGroups();
for (const Point3d& point : points){
IdfExtensibleGroup group = idfObject->pushExtensibleGroup();
OS_ASSERT(group.numFields() == 3);
group.setDouble(0, point.x());
group.setDouble(1, point.y());
group.setDouble(2, point.z());
}
// get reflectance properties from construction if possible
bool addShadingPropertyObject = false;
//.........这里部分代码省略.........
示例14: idfObject
boost::optional<IdfObject> ForwardTranslator::translateZoneHVACLowTempRadiantVarFlow(ZoneHVACLowTempRadiantVarFlow& modelObject)
{
boost::optional<std::string> s;
boost::optional<double> value;
boost::optional<ModelObject> temp;
IdfObject idfObject(IddObjectType::ZoneHVAC_LowTemperatureRadiant_VariableFlow);
m_idfObjects.push_back(idfObject);
//Name
std::string baseName = modelObject.name().get();
idfObject.setName(baseName);
// AvailabilityScheduleName
if( boost::optional<Schedule> schedule = modelObject.availabilitySchedule() )
{
if( boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get()) )
{
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::AvailabilityScheduleName,_schedule->name().get());
}
}
//field Zone Name
boost::optional<std::string> thermalZoneName;
if( boost::optional<ThermalZone> zone = modelObject.thermalZone() )
{
if( (s = zone->name()) )
{
thermalZoneName = s;
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::ZoneName,thermalZoneName.get());
}
}
//field Surface Name or Radiant Surface Type
//create a new surface group object
IdfObject _surfaceGroup(IddObjectType::ZoneHVAC_LowTemperatureRadiant_SurfaceGroup);
//create a name for the surface group
std::string sname = baseName + "" + modelObject.radiantSurfaceType().get();
_surfaceGroup.setName(sname);
//attach the surface group to the zone low temp radiant object
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::SurfaceNameorRadiantSurfaceGroupName,sname);
//get rid of any existing surface (just to be safe)
idfObject.clearExtensibleGroups();
//aggregator for total area; will be used to create weighted area
double totalAreaOfSurfaces = 0;
//loop through all surfaces, adding up their area
for (const Surface& surface : modelObject.surfaces()){
totalAreaOfSurfaces = totalAreaOfSurfaces + surface.grossArea();
}
//loop through all the surfaces, adding them and their flow fractions (weighted per-area)
for (const Surface& surface : modelObject.surfaces()){
IdfExtensibleGroup group = _surfaceGroup.pushExtensibleGroup();
OS_ASSERT(group.numFields() == 2);
group.setString(0, surface.name().get());
group.setDouble(1, (surface.grossArea()/totalAreaOfSurfaces) );
}
//add the surface group to the list of idf objects
m_idfObjects.push_back(_surfaceGroup);
//field Hydronic Tubing Inside Diameter
if( (value = modelObject.hydronicTubingInsideDiameter()) )
{
idfObject.setDouble(ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::HydronicTubingInsideDiameter,value.get());
}
//field Hydronic Tubing Length
if( modelObject.isHydronicTubingLengthAutosized() )
{
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::HydronicTubingLength,"Autosize");
}
else if( (value = modelObject.hydronicTubingLength()) )
{
idfObject.setDouble(ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::HydronicTubingLength,value.get());
}
//field Temperature Control Type
if(boost::optional<std::string> tempCtrlType= modelObject.temperatureControlType() )
{
idfObject.setString(ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::TemperatureControlType,tempCtrlType.get());
}
// Heating Coil
HVACComponent heatingCoil = modelObject.heatingCoil();
boost::optional<CoilHeatingLowTempRadiantVarFlow> coilOptionalHeating = heatingCoil.optionalCast<CoilHeatingLowTempRadiantVarFlow>();
if (coilOptionalHeating)
{
CoilHeatingLowTempRadiantVarFlow coilHeat = *coilOptionalHeating;
// Heating Design Capacity Method - introduced in 8.2.0 and not yet supported in OS
//.........这里部分代码省略.........
示例15: object
TEST_F(IdfFixture,WorkspaceObjectWatcher_RelationshipFieldChanges)
{
IdfObject object(IddObjectType::DaylightingDevice_Tubular);
Workspace workspace(StrictnessLevel::Draft, IddFileType::EnergyPlus);
OptionalWorkspaceObject owo = workspace.addObject(object);
ASSERT_TRUE(owo);
WorkspaceObject tdd = *owo;
WorkspaceObjectWatcher watcher(tdd);
EXPECT_FALSE(watcher.dirty());
// add zone objects
object = IdfObject(IddObjectType::Zone);
owo = workspace.addObject(object);
ASSERT_TRUE(owo);
EXPECT_EQ("Zone 1",owo->name().get());
owo = workspace.addObject(object);
ASSERT_TRUE(owo);
EXPECT_EQ("Zone 2",owo->name().get());
owo = workspace.addObject(object);
ASSERT_TRUE(owo);
EXPECT_EQ("Zone 3",owo->name().get());
EXPECT_FALSE(watcher.dirty());
vector<string> vals;
vals.push_back("Zone 1");
vals.push_back("1.0");
IdfExtensibleGroup eg = tdd.pushExtensibleGroup(vals);
ASSERT_FALSE(eg.empty());
EXPECT_TRUE(watcher.dirty());
EXPECT_TRUE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_TRUE(watcher.relationshipChanged());
watcher.clearState();
EXPECT_FALSE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
EXPECT_TRUE(eg.setString(0,"Zone 2"));
EXPECT_TRUE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_TRUE(watcher.relationshipChanged());
watcher.clearState();
EXPECT_FALSE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
EXPECT_TRUE(eg.setDouble(1,2.0));
EXPECT_TRUE(watcher.dirty());
EXPECT_TRUE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
watcher.clearState();
EXPECT_FALSE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
}