本文整理汇总了C++中WorkspaceObject::getDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ WorkspaceObject::getDouble方法的具体用法?C++ WorkspaceObject::getDouble怎么用?C++ WorkspaceObject::getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkspaceObject
的用法示例。
在下文中一共展示了WorkspaceObject::getDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translateSizingSystem
OptionalModelObject ReverseTranslator::translateSizingSystem( const WorkspaceObject & workspaceObject )
{
boost::optional<WorkspaceObject> _airLoopHVAC = workspaceObject.getTarget(Sizing_SystemFields::AirLoopName);
boost::optional<AirLoopHVAC> airLoopHVAC;
if( _airLoopHVAC )
{
boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(_airLoopHVAC.get());
if( mo )
{
airLoopHVAC = mo->optionalCast<AirLoopHVAC>();
}
}
if( ! airLoopHVAC )
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't find associated AirLoopHVAC.");
return boost::none;
}
openstudio::model::SizingSystem sizingSystem = airLoopHVAC->sizingSystem();
boost::optional<std::string> s;
boost::optional<double> value;
// TypeofLoadtoSizeOn
s = workspaceObject.getString(Sizing_SystemFields::TypeofLoadtoSizeOn);
if( s )
{
sizingSystem.setTypeofLoadtoSizeOn(s.get());
}
// DesignOutdoorAirFlowRate
s = workspaceObject.getString(Sizing_SystemFields::DesignOutdoorAirFlowRate);
value = workspaceObject.getDouble(Sizing_SystemFields::DesignOutdoorAirFlowRate);
if( value )
{
sizingSystem.setDesignOutdoorAirFlowRate(value.get());
}
else if( s && istringEqual(s.get(),"Autosize") )
{
sizingSystem.autosizeDesignOutdoorAirFlowRate();
}
// MinimumSystemAirFlowRatio
value = workspaceObject.getDouble(Sizing_SystemFields::CentralHeatingMaximumSystemAirFlowRatio);
if( value )
{
sizingSystem.setMinimumSystemAirFlowRatio(value.get());
}
// PreheatDesignTemperature
value = workspaceObject.getDouble(Sizing_SystemFields::PreheatDesignTemperature);
if( value )
{
sizingSystem.setPreheatDesignTemperature(value.get());
}
// PreheatDesignHumidityRatio
value = workspaceObject.getDouble(Sizing_SystemFields::PreheatDesignHumidityRatio);
if( value )
{
sizingSystem.setPreheatDesignHumidityRatio(value.get());
}
// PrecoolDesignTemperature
value = workspaceObject.getDouble(Sizing_SystemFields::PrecoolDesignTemperature);
if( value )
{
sizingSystem.setPrecoolDesignTemperature(value.get());
}
// PrecoolDesignHumidityRatio
value = workspaceObject.getDouble(Sizing_SystemFields::PrecoolDesignHumidityRatio);
if( value )
{
sizingSystem.setPrecoolDesignHumidityRatio(value.get());
}
// CentralCoolingDesignSupplyAirTemperature
value = workspaceObject.getDouble(Sizing_SystemFields::CentralCoolingDesignSupplyAirTemperature);
if( value )
{
sizingSystem.setCentralCoolingDesignSupplyAirTemperature(value.get());
}
// CentralHeatingDesignSupplyAirTemperature
//.........这里部分代码省略.........
示例2: translateSetpointManagerSingleZoneReheat
OptionalModelObject ReverseTranslator::translateSetpointManagerSingleZoneReheat( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::SetpointManager_SingleZone_Reheat )
{
LOG(Error, "WorkspaceObject is not IddObjectType: SetpointManager_SingleZone_Reheat");
return boost::none;
}
bool nodeFound = false;
if( boost::optional<std::string> setpointNodeName = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::SetpointNodeorNodeListName) )
{
boost::optional<Node> setpointNode = m_model.getModelObjectByName<Node>(setpointNodeName.get());
if( setpointNode ) { nodeFound = true; }
}
if( ! nodeFound )
{
LOG(Error, workspaceObject.briefDescription() << " is not attached to a node in the model");
return boost::none;
}
SetpointManagerSingleZoneReheat mo(m_model);
boost::optional<std::string> s = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::Name);
if( s )
{
mo.setName(s.get());
}
boost::optional<double> value = workspaceObject.getDouble(SetpointManager_SingleZone_ReheatFields::MinimumSupplyAirTemperature);
if( value )
{
mo.setMinimumSupplyAirTemperature(value.get());
}
value = workspaceObject.getDouble(SetpointManager_SingleZone_ReheatFields::MaximumSupplyAirTemperature);
if( value )
{
mo.setMaximumSupplyAirTemperature(value.get());
}
s = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::ControlZoneName);
if( s )
{
boost::optional<ModelObject> modelObject;
boost::optional<Space> space;
if( boost::optional<WorkspaceObject> _zone =
workspaceObject.workspace().getObjectByTypeAndName(IddObjectType::Zone,s.get()) )
{
modelObject = translateAndMapWorkspaceObject(_zone.get());
}
if( modelObject )
{
if( (space = modelObject->optionalCast<Space>()) )
{
if( boost::optional<ThermalZone> thermalZone = space->thermalZone() )
{
mo.setControlZone(thermalZone.get());
}
}
}
}
s = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::SetpointNodeorNodeListName);
if( s )
{
if( boost::optional<Node> node = m_model.getModelObjectByName<Node>(s.get()) )
{
mo.addToNode(node.get());
}
}
if( mo.setpointNode() )
{
return mo;
}
else
{
return boost::none;
}
}
示例3: translateEvaporativeFluidCoolerSingleSpeed
OptionalModelObject ReverseTranslator::translateEvaporativeFluidCoolerSingleSpeed( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::EvaporativeFluidCooler_SingleSpeed )
{
LOG(Error, "WorkspaceObject is not IddObjectType: EvaporativeFluidCooler_SingleSpeed");
return boost::none;
}
boost::optional<EvaporativeFluidCoolerSingleSpeed> evapCooler;
evapCooler = EvaporativeFluidCoolerSingleSpeed( m_model );
if( evapCooler )
{
boost::optional<double> value;
boost::optional<std::string> s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::Name);
if( s )
{
evapCooler->setName(s.get());
}
// DesignAirFlowRate
value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignAirFlowRate);
s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::DesignAirFlowRate);
if( value )
{
evapCooler->setDesignAirFlowRate(value.get());
}
else if( s && istringEqual(s.get(),"Autosize") )
{
evapCooler->autosizeDesignAirFlowRate();
}
else if( s && istringEqual(s.get(),"Autocalculate") )
{
evapCooler->autosizeDesignAirFlowRate();
}
// FanPoweratDesignAirFlowRate
value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignAirFlowRateFanPower);
s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::DesignAirFlowRateFanPower);
if( value )
{
evapCooler->setFanPoweratDesignAirFlowRate(value.get());
}
else if( s && istringEqual(s.get(),"Autosize") )
{
evapCooler->autosizeFanPoweratDesignAirFlowRate();
}
else if( s && istringEqual(s.get(),"Autocalculate") )
{
evapCooler->autosizeFanPoweratDesignAirFlowRate();
}
// DesignSprayWaterFlowRate
value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignSprayWaterFlowRate);
if( value )
{
evapCooler->setDesignSprayWaterFlowRate(value.get());
}
// PerformanceInputMethod
s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::PerformanceInputMethod);
if( s )
{
evapCooler->setPerformanceInputMethod(s.get());
}
// StandardDesignCapacity
value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::StandardDesignCapacity);
if( value )
{
evapCooler->setStandardDesignCapacity(value.get());
}
// UfactorTimesAreaValueatDesignAirFlowRate
value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignAirFlowRateUfactorTimesAreaValue);
s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::DesignAirFlowRateUfactorTimesAreaValue);
if( value )
{
evapCooler->setUfactorTimesAreaValueatDesignAirFlowRate(value.get());
}
else if( s && istringEqual(s.get(),"Autosize") )
{
evapCooler->autosizeUfactorTimesAreaValueatDesignAirFlowRate();
}
else if( s && istringEqual(s.get(),"Autocalculate") )
{
evapCooler->autosizeUfactorTimesAreaValueatDesignAirFlowRate();
}
// DesignWaterFlowRate
value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignWaterFlowRate);
s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::DesignWaterFlowRate);
if( value )
{
evapCooler->setDesignWaterFlowRate(value.get());
}
else if( s && istringEqual(s.get(),"Autosize") )
{
//.........这里部分代码省略.........
示例4: translateFanConstantVolume
OptionalModelObject ReverseTranslator::translateFanConstantVolume( const WorkspaceObject & workspaceObject )
{
OptionalModelObject result,temp;
OptionalSchedule schedule;
OptionalWorkspaceObject owo = workspaceObject.getTarget(Fan_ConstantVolumeFields::AvailabilityScheduleName);
if(!owo)
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't find Schedule: ");
return result;
}
temp = translateAndMapWorkspaceObject( *owo);
if(temp)
{
schedule = temp->optionalCast<Schedule>();
}
if( !schedule )
{
LOG(Error, "Error importing object: "
<< workspaceObject.name().get()
<<"Failed to convert iddObjects into model Objects. Maybe they do not exist in model yet");
return result;
}
openstudio::model::FanConstantVolume fan( m_model, *schedule );
OptionalString optS = workspaceObject.name();
if(optS)
{
fan.setName(*optS);
}
//inlet and outlet nodes are set my the HVACAirLoop
OptionalDouble d;
d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::FanTotalEfficiency);
if(d)
{
fan.setFanEfficiency(*d);
}
d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::PressureRise);
if(d)
{
fan.setPressureRise(*d);
}
d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MaximumFlowRate);
if(d)
{
fan.setMaximumFlowRate(*d);
}
d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MotorEfficiency);
if(d)
{
fan.setMotorEfficiency(*d);
}
d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MotorInAirstreamFraction);
if(d)
{
fan.setMotorInAirstreamFraction(*d);
}
optS=workspaceObject.getString(openstudio::Fan_ConstantVolumeFields::EndUseSubcategory);
if(optS)
{
fan.setEndUseSubcategory(*optS);
}
result=fan;
return result;
}
示例5: translateSiteGroundReflectance
OptionalModelObject ReverseTranslator::translateSiteGroundReflectance( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::Site_GroundReflectance )
{
LOG(Error, "WorkspaceObject is not IddObjectType: Site_GroundReflectance");
return boost::none;
}
SiteGroundReflectance mo = m_model.getUniqueModelObject<SiteGroundReflectance>();
boost::optional<double> value = workspaceObject.getDouble(Site_GroundReflectanceFields::JanuaryGroundReflectance);
if( value )
{
mo.setJanuaryGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::FebruaryGroundReflectance);
if( value )
{
mo.setFebruaryGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::MarchGroundReflectance);
if( value )
{
mo.setMarchGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::AprilGroundReflectance);
if( value )
{
mo.setAprilGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::MayGroundReflectance);
if( value )
{
mo.setMayGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::JuneGroundReflectance);
if( value )
{
mo.setJuneGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::JulyGroundReflectance);
if( value )
{
mo.setJulyGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::AugustGroundReflectance);
if( value )
{
mo.setAugustGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::SeptemberGroundReflectance);
if( value )
{
mo.setSeptemberGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::OctoberGroundReflectance);
if( value )
{
mo.setOctoberGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::NovemberGroundReflectance);
if( value )
{
mo.setNovemberGroundReflectance(value.get());
}
value = workspaceObject.getDouble(Site_GroundReflectanceFields::DecemberGroundReflectance);
if( value )
{
mo.setDecemberGroundReflectance(value.get());
}
return mo;
}
示例6: translateAirTerminalSingleDuctConstantVolumeReheat
OptionalModelObject ReverseTranslator::translateAirTerminalSingleDuctConstantVolumeReheat( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::AirTerminal_SingleDuct_ConstantVolume_Reheat )
{
LOG(Error, "WorkspaceObject is not IddObjectType: AirTerminal_SingleDuct_ConstantVolume_Reheat");
return boost::none;
}
boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::AvailabilityScheduleName);
boost::optional<Schedule> schedule;
boost::optional<HVACComponent> coil;
boost::optional<AirTerminalSingleDuctConstantVolumeReheat> airTerminal;
if( wo )
{
boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get());
if( mo )
{
if( ! (schedule = mo->optionalCast<Schedule>()) )
{
LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule");
return boost::none;
}
}
}
wo = workspaceObject.getTarget(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::ReheatCoilName);
if( wo )
{
boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get());
if( mo )
{
if( ! coil )
{
//TODO: Maybe try to cast this to different types depending on ReheatCoilType
coil = mo->optionalCast<CoilHeatingElectric>();
}
}
}
if( schedule && coil )
{
airTerminal = AirTerminalSingleDuctConstantVolumeReheat( m_model,schedule.get(),coil.get() );
}
if( airTerminal )
{
boost::optional<double> value;
boost::optional<std::string> s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::Name);
if( s )
{
airTerminal->setName(s.get());
}
// MaximumAirFlowRate
value = workspaceObject.getDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumAirFlowRate);
if( value )
{
airTerminal->setMaximumAirFlowRate(value.get());
}
else
{
s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumAirFlowRate);
if( s && istringEqual(s.get(),"Autosize") )
{
airTerminal->autosizeMaximumAirFlowRate();
}
else if( s && istringEqual(s.get(),"Autocalculate") )
{
airTerminal->autosizeMaximumAirFlowRate();
}
}
// MaximumHotWaterorSteamFlowRate
value = workspaceObject.getDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumHotWaterorSteamFlowRate);
if( value )
{
airTerminal->setMaximumHotWaterorSteamFlowRate(value.get());
}
else
{
s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumHotWaterorSteamFlowRate);
if( s && istringEqual(s.get(),"Autosize") )
{
airTerminal->autosizeMaximumHotWaterorSteamFlowRate();
}
else if( s && istringEqual(s.get(),"Autocalculate") )
{
airTerminal->autosizeMaximumHotWaterorSteamFlowRate();
}
}
// MinimumHotWaterorSteamFlowRate
value = workspaceObject.getDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MinimumHotWaterorSteamFlowRate);
if( value )
{
airTerminal->setMinimumHotWaterorSteamFlowRate(value.get());
}
//.........这里部分代码省略.........
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateAirTerminalSingleDuctConstantVolumeReheat.cpp
示例7: standardGlazing
boost::optional<ModelObject> ReverseTranslator::translateWindowMaterialGlazing(
const WorkspaceObject& workspaceObject)
{
OptionalModelObject result;
StandardGlazing standardGlazing(m_model);
OptionalString optS = workspaceObject.name();
if(optS) {
standardGlazing.setName(*optS);
}
optS = workspaceObject.getString(WindowMaterial_GlazingFields::OpticalDataType);
if (optS) {
standardGlazing.setOpticalDataType(*optS);
}
optS = workspaceObject.getString(WindowMaterial_GlazingFields::WindowGlassSpectralDataSetName);
if (optS) {
standardGlazing.setWindowGlassSpectralDataSetName(*optS);
}
OptionalDouble d = workspaceObject.getDouble(WindowMaterial_GlazingFields::Thickness);
if (d) {
standardGlazing.setThickness(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::SolarTransmittanceatNormalIncidence);
if (d) {
standardGlazing.setSolarTransmittance(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::FrontSideSolarReflectanceatNormalIncidence);
if (d) {
standardGlazing.setFrontSideSolarReflectanceatNormalIncidence(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::BackSideSolarReflectanceatNormalIncidence);
if (d) {
standardGlazing.setBackSideSolarReflectanceatNormalIncidence(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::VisibleTransmittanceatNormalIncidence);
if (d) {
standardGlazing.setVisibleTransmittance(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::FrontSideVisibleReflectanceatNormalIncidence);
if (d) {
standardGlazing.setFrontSideVisibleReflectanceatNormalIncidence(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::BackSideVisibleReflectanceatNormalIncidence);
if (d) {
standardGlazing.setBackSideVisibleReflectanceatNormalIncidence(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::InfraredTransmittanceatNormalIncidence);
if (d) {
standardGlazing.setInfraredTransmittance(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::FrontSideInfraredHemisphericalEmissivity);
if (d) {
standardGlazing.setFrontSideInfraredHemisphericalEmissivity(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::BackSideInfraredHemisphericalEmissivity);
if (d) {
standardGlazing.setBackSideInfraredHemisphericalEmissivity(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::Conductivity);
if (d) {
standardGlazing.setThermalConductivity(*d);
}
d = workspaceObject.getDouble(WindowMaterial_GlazingFields::DirtCorrectionFactorforSolarandVisibleTransmittance);
if (d) {
standardGlazing.setDirtCorrectionFactorforSolarandVisibleTransmittance(*d);
}
optS = workspaceObject.getString(WindowMaterial_GlazingFields::SolarDiffusing);
if (optS) {
std::string temp=*optS;
boost::to_lower(temp);
if( temp == "no") {
standardGlazing.setSolarDiffusing(false);
}
else {
standardGlazing.setSolarDiffusing(true);
}
}
result = standardGlazing;
return result;
}
示例8: translateCoilCoolingDXSingleSpeed
//.........这里部分代码省略.........
if(!temp)
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't convert workspace curve into a model curve. ");
return result;
}
boost::optional<Curve> plfcc = temp->optionalCast<Curve>();
if( ! plfcc )
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " curve is wrong type. ");
return result;
}
try {
CoilCoolingDXSingleSpeed coil(m_model,
*schedule,
*tccfot,
*tccfoff,
*eirfot,
*eirfoff,
*plfcc);
OptionalString optS = workspaceObject.name();
if( optS )
{
coil.setName( *optS );
}
OptionalDouble d = workspaceObject.getDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedTotalCoolingCapacity);
if(d)
{
coil.setRatedTotalCoolingCapacity(*d);
}
d=workspaceObject.getDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedSensibleHeatRatio);
if(d)
{
coil.setRatedSensibleHeatRatio(*d);
}
d=workspaceObject.getDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedCoolingCOP);
if(d)
{
coil.setRatedCOP(*d);
}
d=workspaceObject.getDouble(Coil_Cooling_DX_SingleSpeedFields::RatedAirFlowRate);
if(d)
{
coil.setRatedAirFlowRate(*d);
}
d=workspaceObject.getDouble(Coil_Cooling_DX_SingleSpeedFields::RatedEvaporatorFanPowerPerVolumeFlowRate);
if(d)
{
coil.setRatedEvaporatorFanPowerPerVolumeFlowRate(*d);
}
d=workspaceObject.getDouble(Coil_Cooling_DX_SingleSpeedFields::NominalTimeforCondensateRemovaltoBegin);
if(d)
{
示例9: translateEvaporativeCoolerDirectResearchSpecial
OptionalModelObject ReverseTranslator::translateEvaporativeCoolerDirectResearchSpecial( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::EvaporativeCooler_Direct_ResearchSpecial )
{
LOG(Error, "WorkspaceObject is not IddObjectType: EvaporativeCooler_Direct_ResearchSpecial");
return boost::none;
}
boost::optional<Schedule> schedule;
boost::optional<EvaporativeCoolerDirectResearchSpecial> mo;
boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(EvaporativeCooler_Direct_ResearchSpecialFields::AvailabilityScheduleName);
if( wo )
{
boost::optional<ModelObject> mo2 = translateAndMapWorkspaceObject(wo.get());
if( mo2 )
{
if( ! (schedule = mo2->optionalCast<Schedule>()) )
{
LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule");
return boost::none;
}
}
}
if( schedule )
{
mo = EvaporativeCoolerDirectResearchSpecial(m_model,schedule.get());
}
if( mo )
{
boost::optional<std::string> s = workspaceObject.getString(EvaporativeCooler_Direct_ResearchSpecialFields::Name);
if( s )
{
mo->setName(s.get());
}
boost::optional<double> value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::CoolerEffectiveness);
if( s )
{
mo->setCoolerEffectiveness(value.get());
}
value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::RecirculatingWaterPumpPowerConsumption);
if( value )
{
mo->setRecirculatingWaterPumpPowerConsumption(value.get());
}
value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::DriftLossFraction);
if( value )
{
mo->setDriftLossFraction(value.get());
}
value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::BlowdownConcentrationRatio);
if( value )
{
mo->setBlowdownConcentrationRatio(value.get());
}
return mo.get();
}
else
{
LOG(Error, "Unknown error translating " << workspaceObject.briefDescription());
return boost::none;
}
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:72,代码来源:ReverseTranslateEvaporativeCoolerDirectResearchSpecial.cpp
示例10: translateSizingZone
OptionalModelObject ReverseTranslator::translateSizingZone( const WorkspaceObject & workspaceObject )
{
boost::optional<WorkspaceObject> target = workspaceObject.getTarget(Sizing_ZoneFields::ZoneorZoneListName);
std::vector<ThermalZone> thermalZones;
if( target ) {
// just one thermal zone
boost::optional<ModelObject> mo;
if (target->iddObject().type() == IddObjectType::Zone) {
mo = translateAndMapWorkspaceObject(target.get());
if( mo ) {
if( boost::optional<Space> space = mo->optionalCast<Space>() ) {
boost::optional<ThermalZone> thermalZone = space->thermalZone();
if (thermalZone) {
thermalZones.push_back(*thermalZone);
}
}
}
} else if (target->iddObject().type() == IddObjectType::ZoneList) {
// get all thermal zones in zone list
for (const IdfExtensibleGroup& idfGroup : target->extensibleGroups()) {
WorkspaceExtensibleGroup workspaceGroup = idfGroup.cast<WorkspaceExtensibleGroup>();
OptionalWorkspaceObject owo = workspaceGroup.getTarget(0);
if (owo) {
mo = translateAndMapWorkspaceObject(owo.get());
if( mo ) {
if( boost::optional<Space> space = mo->optionalCast<Space>() ) {
boost::optional<ThermalZone> thermalZone = space->thermalZone();
if (thermalZone) {
thermalZones.push_back(*thermalZone);
}
}
}
}
}
}
}
if(thermalZones.empty())
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't find associated ThermalZone(s).");
return boost::none;
}
boost::optional<ModelObject> result;
for (ThermalZone thermalZone : thermalZones) {
// sizing zone is constructed in thermal zone ctor
openstudio::model::SizingZone sizingZone = thermalZone.sizingZone();
// return first sizing zone
if (!result) {
result = sizingZone;
}
boost::optional<std::string> s;
boost::optional<double> value;
// ZoneCoolingDesignSupplyAirTemperature
value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneCoolingDesignSupplyAirTemperature);
if( value )
{
sizingZone.setZoneCoolingDesignSupplyAirTemperature(value.get());
}
// ZoneHeatingDesignSupplyAirTemperature
value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneHeatingDesignSupplyAirTemperature);
if( value )
{
sizingZone.setZoneHeatingDesignSupplyAirTemperature(value.get());
}
// ZoneCoolingDesignSupplyAirHumidityRatio
value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneHeatingDesignSupplyAirHumidityRatio);
if( value )
{
sizingZone.setZoneHeatingDesignSupplyAirHumidityRatio(value.get());
}
// ZoneHeatingDesignSupplyAirHumidityRatio
value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneHeatingDesignSupplyAirHumidityRatio);
if( value )
{
sizingZone.setZoneHeatingDesignSupplyAirHumidityRatio(value.get());
}
// DesignSpecificationOutdoorAirObjectName
target = workspaceObject.getTarget(Sizing_ZoneFields::DesignSpecificationOutdoorAirObjectName);
if (target) {
//.........这里部分代码省略.........
示例11: translateZoneInfiltrationDesignFlowRate
OptionalModelObject ReverseTranslator::translateZoneInfiltrationDesignFlowRate( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::ZoneInfiltration_DesignFlowRate ){
LOG(Error, "WorkspaceObject is not IddObjectType: ZoneInfiltration:DesignFlowRate");
return boost::none;
}
openstudio::model::SpaceInfiltrationDesignFlowRate infiltration(m_model);
OptionalString s = workspaceObject.name();
if(s){
infiltration.setName(*s);
}
OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::ZoneInfiltration_DesignFlowRateFields::ZoneorZoneListName);
if (target){
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if (modelObject){
if (modelObject->optionalCast<Space>()){
infiltration.setSpace(modelObject->cast<Space>());
}else if (modelObject->optionalCast<SpaceType>()){
infiltration.setSpaceType(modelObject->cast<SpaceType>());
}
}
}
target = workspaceObject.getTarget(openstudio::ZoneInfiltration_DesignFlowRateFields::ScheduleName);
if (target){
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if (modelObject){
if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()){
Schedule schedule(*intermediate);
infiltration.setSchedule(schedule);
}
}
}
s = workspaceObject.getString(openstudio::ZoneInfiltration_DesignFlowRateFields::DesignFlowRateCalculationMethod, true);
OS_ASSERT(s);
OptionalDouble d;
if (istringEqual("Flow/Zone", *s)){
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::DesignFlowRate);
if (d){
infiltration.setDesignFlowRate(*d);
}else{
LOG(Error, "Flow/Zone value not found for workspace object " << workspaceObject);
}
}else if(istringEqual("Flow/Area", *s)){
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::FlowperZoneFloorArea);
if (d){
infiltration.setFlowperSpaceFloorArea(*d);
}else{
LOG(Error, "Flow/Area value not found for workspace object " << workspaceObject);
}
}else if(istringEqual("Flow/ExteriorArea", *s)){
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::FlowperExteriorSurfaceArea);
if (d){
infiltration.setFlowperExteriorSurfaceArea(*d);
}else{
LOG(Error, "Flow/ExteriorArea value not found for workspace object " << workspaceObject);
}
}else if(istringEqual("Flow/ExteriorWallArea", *s)){
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::FlowperExteriorSurfaceArea);
if (d){
infiltration.setFlowperExteriorWallArea(*d);
}else{
LOG(Error, "Flow/ExteriorWallArea value not found for workspace object " << workspaceObject);
}
}else if(istringEqual("AirChanges/Hour", *s)){
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::AirChangesperHour);
if (d){
infiltration.setAirChangesperHour(*d);
}else{
LOG(Error, "AirChanges/Hour value not found for workspace object " << workspaceObject);
}
}else{
LOG(Error, "Unknown DesignLevelCalculationMethod value for workspace object" << workspaceObject);
}
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::ConstantTermCoefficient);
if (d){
infiltration.setConstantTermCoefficient(*d);
}
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::TemperatureTermCoefficient);
if (d){
infiltration.setTemperatureTermCoefficient(*d);
}
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::VelocityTermCoefficient);
if (d){
infiltration.setVelocityTermCoefficient(*d);
}
d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::VelocitySquaredTermCoefficient);
if (d){
infiltration.setVelocitySquaredTermCoefficient(*d);
}
//.........这里部分代码省略.........
示例12: translateRefrigerationCompressor
OptionalModelObject ReverseTranslator::translateRefrigerationCompressor( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::Refrigeration_Compressor )
{
LOG(Error, "WorkspaceObject is not IddObjectType: Refrigeration_Compressor");
return boost::none;
}
boost::optional<RefrigerationCompressor> refrigerationCompressor = RefrigerationCompressor( m_model );
boost::optional<WorkspaceObject> wo;
if( refrigerationCompressor )
{
boost::optional<double> value;
boost::optional<std::string> s = workspaceObject.getString(Refrigeration_CompressorFields::Name);
// Name
if( s )
{
refrigerationCompressor->setName(s.get());
}
// RefrigerationCompressorPowerCurveName
if( (wo = workspaceObject.getTarget(Refrigeration_CompressorFields::RefrigerationCompressorPowerCurveName)) )
{
if( boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()) )
{
if( boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>() )
{
refrigerationCompressor->setRefrigerationCompressorPowerCurve(curve.get());
}
}
}
// RefrigerationCompressorCapacityCurveName
if( (wo = workspaceObject.getTarget(Refrigeration_CompressorFields::RefrigerationCompressorCapacityCurveName)) )
{
if( boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()) )
{
if( boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>() )
{
refrigerationCompressor->setRefrigerationCompressorCapacityCurve(curve.get());
}
}
}
// RatedSuperheat
value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedSuperheat);
if( value )
{
refrigerationCompressor->setRatedSuperheat(value.get());
}
// RatedReturnGasTemperature
value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedReturnGasTemperature);
if( value )
{
refrigerationCompressor->setRatedReturnGasTemperature(value.get());
}
// RatedLiquidTemperature
value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedLiquidTemperature);
if( value )
{
refrigerationCompressor->setRatedLiquidTemperature(value.get());
}
// RatedSubcooling
value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedSubcooling);
if( value )
{
refrigerationCompressor->setRatedSubcooling(value.get());
}
// EndUseSubcategory
s = workspaceObject.getString(Refrigeration_CompressorFields::EndUseSubcategory);
if( s )
{
refrigerationCompressor->setEndUseSubcategory(s.get());
}
// ModeofOperation
// TranscriticalCompressorPowerCurveName
if( (wo = workspaceObject.getTarget(Refrigeration_CompressorFields::TranscriticalCompressorPowerCurveName)) )
{
if( boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()) )
{
if( boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>() )
{
refrigerationCompressor->setTranscriticalCompressorPowerCurve(curve.get());
}
}
}
// TranscriticalCompressorCapacityCurveName
if( (wo = workspaceObject.getTarget(Refrigeration_CompressorFields::TranscriticalCompressorCapacityCurveName)) )
{
if( boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()) )
{
if( boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>() )
{
refrigerationCompressor->setTranscriticalCompressorCapacityCurve(curve.get());
}
}
}
return refrigerationCompressor.get();
}
//.........这里部分代码省略.........
示例13: curve
boost::optional<ModelObject> ReverseTranslator::translateCurveTriquadratic(
const WorkspaceObject& workspaceObject)
{
CurveTriquadratic curve(m_model);
OptionalString s;
OptionalDouble d;
if ((s = workspaceObject.name())) {
curve.setName(*s);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient1Constant))) {
curve.setCoefficient1Constant(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient2x_POW_2))) {
curve.setCoefficient2xPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient3x))) {
curve.setCoefficient3x(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient4y_POW_2))) {
curve.setCoefficient4yPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient5y))) {
curve.setCoefficient5y(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient6z_POW_2))) {
curve.setCoefficient6zPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient7z))) {
curve.setCoefficient7z(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient8x_POW_2_TIMES_y_POW_2))) {
curve.setCoefficient8xPOW2TIMESYPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient9x_TIMES_y))) {
curve.setCoefficient9xTIMESY(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient10x_TIMES_y_POW_2))) {
curve.setCoefficient10xTIMESYPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient11x_POW_2_TIMES_y))) {
curve.setCoefficient11xPOW2TIMESY(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient12x_POW_2_TIMES_z_POW_2))) {
curve.setCoefficient12xPOW2TIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient13x_TIMES_z))) {
curve.setCoefficient13xTIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient14x_TIMES_z_POW_2))) {
curve.setCoefficient14xTIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient15x_POW_2_TIMES_z))) {
curve.setCoefficient15xPOW2TIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient16y_POW_2_TIMES_z_POW_2))) {
curve.setCoefficient16yPOW2TIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient17y_TIMES_z))) {
curve.setCoefficient17yTIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient18y_TIMES_z_POW_2))) {
curve.setCoefficient18yTIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient19y_POW_2_TIMES_z))) {
curve.setCoefficient19yPOW2TIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient20x_POW_2_TIMES_y_POW_2_TIMES_z_POW_2))) {
curve.setCoefficient20xPOW2TIMESYPOW2TIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient21x_POW_2_TIMES_y_POW_2_TIMES_z))) {
curve.setCoefficient21xPOW2TIMESYPOW2TIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient22x_POW_2_TIMES_y_TIMES_z_POW_2))) {
curve.setCoefficient22xPOW2TIMESYTIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient23x_TIMES_y_POW_2_TIMES_z_POW_2))) {
curve.setCoefficient23xTIMESYPOW2TIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient24x_POW_2_TIMES_y_TIMES_z))) {
curve.setCoefficient24xPOW2TIMESYTIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient25x_TIMES_y_POW_2_TIMES_z))) {
curve.setCoefficient25xTIMESYPOW2TIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient26x_TIMES_y_TIMES_z_POW_2))) {
curve.setCoefficient26xTIMESYTIMESZPOW2(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::Coefficient27x_TIMES_y_TIMES_z))) {
curve.setCoefficient27xTIMESYTIMESZ(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::MinimumValueofx))) {
curve.setMinimumValueofx(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::MaximumValueofx))) {
curve.setMaximumValueofx(*d);
}
if ((d = workspaceObject.getDouble(Curve_TriquadraticFields::MinimumValueofy))) {
//.........这里部分代码省略.........
示例14: translateScheduleTypeLimits
OptionalModelObject ReverseTranslator::translateScheduleTypeLimits( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::ScheduleTypeLimits )
{
LOG(Error, "WorkspaceObject is not IddObjectType: ScheduleTypeLimits");
return boost::none;
}
openstudio::model::ScheduleTypeLimits scheduleTypeLimits( m_model );
OptionalString s = workspaceObject.name();
if (s) {
if ((workspaceObject.numFields() == 1u) &&
(istringEqual(*s,"Any Number") || istringEqual(*s,"Number")))
{
// Do not translate ScheduleTypeLimits called "Any Number" or "Number" and
// with no other fields specified. Instead, let ModelObjects assign more
// meaningful limits.
LOG(Info,"The energyplus::ReverseTranslator throws out all 'Any Number' ScheduleTypeLimits "
<< "to leave the OpenStudio model free to apply the appropriate units and limits.");
return boost::none;
}
scheduleTypeLimits.setName(*s);
}
OptionalDouble d = workspaceObject.getDouble(ScheduleTypeLimitsFields::LowerLimitValue);
if (d) {
scheduleTypeLimits.setLowerLimitValue(*d);
}
d = workspaceObject.getDouble(ScheduleTypeLimitsFields::UpperLimitValue);
if (d) {
scheduleTypeLimits.setUpperLimitValue(*d);
}
s = workspaceObject.getString(ScheduleTypeLimitsFields::NumericType);
if (s) {
scheduleTypeLimits.setNumericType(*s);
}
s = workspaceObject.getString(ScheduleTypeLimitsFields::UnitType);
if (s) {
scheduleTypeLimits.setUnitType(*s);
}
else {
bool test;
// Attempt to default based on name (many EnergyPlus files do not have this field filled out).
std::string name = scheduleTypeLimits.name().get();
if (boost::regex_search(name,boost::regex("[Tt][Ee][Mm][Pp]"))) {
if (boost::regex_search(name,boost::regex("[Dd][Ee][Ll][Tt][Aa]"))) {
test = scheduleTypeLimits.setUnitType("DeltaTemperature");
BOOST_ASSERT(test);
}
else {
test = scheduleTypeLimits.setUnitType("Temperature");
BOOST_ASSERT(test);
}
}
else if (boost::regex_search(name,boost::regex("[Oo][Nn]")) &&
boost::regex_search(name,boost::regex("[Oo][Ff][Ff]")))
{
test = scheduleTypeLimits.setUnitType("Availability");
BOOST_ASSERT(test);
}
else if (boost::regex_search(name,boost::regex("[Cc][Oo][Nn][Tt][Rr][Oo][Ll]"))) {
test = scheduleTypeLimits.setUnitType("ControlMode");
BOOST_ASSERT(test);
}
}
return scheduleTypeLimits;
}
示例15: definition
boost::optional<model::ModelObject> ReverseTranslator::translateExteriorLights(
const WorkspaceObject& workspaceObject)
{
if (workspaceObject.iddObject().type() != IddObjectType::Exterior_Lights) {
LOG(Error,"WorkspaceObject " << workspaceObject.briefDescription()
<< " is not of IddObjectType::Exterior_Lights.");
return boost::none;
}
model::ExteriorLightsDefinition definition(m_model);
OptionalString s;
OptionalDouble d;
if ((s = workspaceObject.name())) {
definition.setName(*s + " Definition");
}
if ((d = workspaceObject.getDouble(Exterior_LightsFields::DesignLevel))){
definition.setDesignLevel(*d);
}
model::OptionalExteriorLights exteriorLights;
model::OptionalSchedule schedule;
if (OptionalWorkspaceObject target = workspaceObject.getTarget(Exterior_LightsFields::ScheduleName))
{
if (model::OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target)) {
schedule = modelObject->optionalCast<model::Schedule>();
}
}
if (schedule) {
try {
exteriorLights = model::ExteriorLights(definition,*schedule);
}
catch (std::exception& e) {
LOG(Warn,"Could not reverse translate " << workspaceObject.briefDescription()
<< " in full, because " << e.what() << ".");
}
}
if (!exteriorLights) {
exteriorLights = model::ExteriorLights(definition);
}
OS_ASSERT(exteriorLights);
if ((s = workspaceObject.name())) {
exteriorLights->setName(*s);
}
if ((s = workspaceObject.getString(Exterior_LightsFields::ControlOption,false,true))) {
exteriorLights->setControlOption(*s);
}
if ((s = workspaceObject.getString(Exterior_LightsFields::EndUseSubcategory,false,true))) {
exteriorLights->setEndUseSubcategory(*s);
}
return *exteriorLights;
}