本文整理汇总了C++中WorkspaceObject类的典型用法代码示例。如果您正苦于以下问题:C++ WorkspaceObject类的具体用法?C++ WorkspaceObject怎么用?C++ WorkspaceObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorkspaceObject类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LOG
OptionalModelObject ReverseTranslator::translateSizingPeriodDesignDay( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::SizingPeriod_DesignDay )
{
LOG(Error, "WorkspaceObject is not IddObjectType: SizingPeriod_DesignDay");
return boost::none;
}
DesignDay designDay(m_model);
// Name
boost::optional<std::string> s = workspaceObject.getString(SizingPeriod_DesignDayFields::Name);
if( s ){
designDay.setName(s.get());
}else{
LOG(Error, "SizingPeriod:DesignDay missing required field Name");
}
// Month
boost::optional<int> i = workspaceObject.getInt(SizingPeriod_DesignDayFields::Month);
if( i ){
designDay.setMonth( i.get() );
}else{
LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Month");
}
// Day of Month
i = workspaceObject.getInt(SizingPeriod_DesignDayFields::DayofMonth);
if( i ){
designDay.setDayOfMonth(i.get());
}else{
LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Day of Month");
}
// Day Type
s = workspaceObject.getString(SizingPeriod_DesignDayFields::DayType);
if( s ){
designDay.setDayType(s.get());
}else{
LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Day Type");
}
// Maximum Dry-Bulb Temperature
boost::optional<double> value = workspaceObject.getDouble(SizingPeriod_DesignDayFields::MaximumDryBulbTemperature);
if( value ){
designDay.setMaximumDryBulbTemperature(value.get());
}else{
LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Maximum Dry Bulb Temperature");
}
// Dry-Bulb Temperature Range Modifier Type
s = workspaceObject.getString(SizingPeriod_DesignDayFields::DryBulbTemperatureRangeModifierType);
if( s ){
designDay.setDryBulbTemperatureRangeModifierType(s.get());
}
std::string dryBulbTemperatureRangeModifierType = designDay.dryBulbTemperatureRangeModifierType();
// Daily Dry-Bulb Temperature Range
if (!istringEqual(dryBulbTemperatureRangeModifierType, "DifferenceSchedule")){
value = workspaceObject.getDouble(SizingPeriod_DesignDayFields::DailyDryBulbTemperatureRange);
if( value ){
designDay.setDailyDryBulbTemperatureRange(value.get());
}
}
// Dry-Bulb Temperature Range Modifier Schedule Name
if (istringEqual(dryBulbTemperatureRangeModifierType, "MultiplierSchedule") || istringEqual(dryBulbTemperatureRangeModifierType, "DifferenceSchedule")){
boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(SizingPeriod_DesignDayFields::DryBulbTemperatureRangeModifierDayScheduleName);
if( wo ){
boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get());
if( mo ){
if(boost::optional<ScheduleDay> schedule = mo->optionalCast<ScheduleDay>()){
designDay.setDryBulbTemperatureRangeModifierSchedule(*schedule);
}
}
}
if (!designDay.dryBulbTemperatureRangeModifierSchedule()){
LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Maximum Dry Bulb Temperature");
}
}
// Humidity Condition Type
s = workspaceObject.getString(SizingPeriod_DesignDayFields::HumidityConditionType);
if( s ){
if (istringEqual(*s, "RelativeHumiditySchedule")){
s = "Schedule";
}
designDay.setHumidityIndicatingType(s.get());
}
std::string humidityIndicatingType = designDay.humidityIndicatingType();
// Wetbulb or DewPoint at Maximum Dry-Bulb
if (istringEqual(humidityIndicatingType, "Wetbulb") ||
istringEqual(humidityIndicatingType, "Dewpoint") ||
istringEqual(humidityIndicatingType, "WetBulbProfileMultiplierSchedule") ||
istringEqual(humidityIndicatingType, "WetBulbProfileDifferenceSchedule") ||
istringEqual(humidityIndicatingType, "WetBulbProfileDefaultMultipliers")){
value = workspaceObject.getDouble(SizingPeriod_DesignDayFields::WetbulborDewPointatMaximumDryBulb);
if( value ){
//.........这里部分代码省略.........
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateSizingPeriodDesignDay.cpp
示例2: LOG
OptionalModelObject ReverseTranslator::translateAirLoopHVAC( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::AirLoopHVAC )
{
LOG(Error, "WorkspaceObject is not IddObjectType: AirLoopHVAC");
return boost::none;
}
OptionalModelObject result;
boost::optional<double> val;
boost::optional<std::string> optionalString;
Workspace _workspace = workspaceObject.workspace();
openstudio::model::AirLoopHVAC airLoopHVAC( m_model );
boost::optional<std::string> supplyInletNodeName = workspaceObject.getString(AirLoopHVACFields::SupplySideInletNodeName);
boost::optional<std::string> supplyOutletNodeName = workspaceObject.getString(AirLoopHVACFields::SupplySideOutletNodeNames);
boost::optional<std::string> demandInletNodeName = workspaceObject.getString(AirLoopHVACFields::DemandSideInletNodeNames);
boost::optional<std::string> demandOutletNodeName = workspaceObject.getString(AirLoopHVACFields::DemandSideOutletNodeName);
Node supplyInletNode = airLoopHVAC.supplyInletNode();
Node supplyOutletNode = airLoopHVAC.supplyOutletNode();
Node demandInletNode = airLoopHVAC.demandInletNode();
Node demandOutletNode = airLoopHVAC.demandOutletNode();
if( supplyInletNodeName ) { supplyInletNode.setName(supplyInletNodeName.get()); }
if( supplyOutletNodeName ) { supplyOutletNode.setName(supplyOutletNodeName.get()); }
if( demandInletNodeName ) { demandInletNode.setName(demandInletNodeName.get()); }
if( demandOutletNodeName ) { demandOutletNode.setName(demandOutletNodeName.get()); }
optionalString = workspaceObject.getString(AirLoopHVACFields::Name);
if( optionalString )
{
airLoopHVAC.setName(optionalString.get());
}
optionalString = workspaceObject.getString(AirLoopHVACFields::DesignSupplyAirFlowRate);
if( optionalString && istringEqual(optionalString.get(),"AutoSize") )
{
airLoopHVAC.autosizeDesignSupplyAirFlowRate();
}
else if( (val = workspaceObject.getDouble(AirLoopHVACFields::DesignSupplyAirFlowRate)) )
{
airLoopHVAC.setDesignSupplyAirFlowRate(val.get());
}
// Go find the supply branch.
// Currently only supporting one supply branch.
// Dual ducts are not supported.
OptionalWorkspaceObject _supplyBranchList;
OptionalWorkspaceObject _supplyBranch;
_supplyBranchList = workspaceObject.getTarget(AirLoopHVACFields::BranchListName);
if( _supplyBranchList )
{
_supplyBranch = _supplyBranchList->getExtensibleGroup(0).cast<WorkspaceExtensibleGroup>().getTarget(BranchListExtensibleFields::BranchName);
if( ! _supplyBranch )
{
LOG(Error, _supplyBranchList->briefDescription() << ": Missing supply branch");
}
else
{
// March through the equipment on the supply branch and convert them.
for( unsigned i = 0; ! _supplyBranch->getExtensibleGroup(i).empty(); i++ )
{
WorkspaceExtensibleGroup eg = _supplyBranch->getExtensibleGroup(i).cast<WorkspaceExtensibleGroup>();
boost::optional<std::string> componentName = eg.getString(BranchExtensibleFields::ComponentName);
boost::optional<std::string> componentType = eg.getString(BranchExtensibleFields::ComponentObjectType);
boost::optional<std::string> componentInletNodeName = eg.getString(BranchExtensibleFields::ComponentInletNodeName);
boost::optional<std::string> componentOutletNodeName = eg.getString(BranchExtensibleFields::ComponentOutletNodeName);
boost::optional<WorkspaceObject> wo;
OptionalNode node;
OptionalModelObject targetModelObject;
if( componentName && (componentName.get() != "") && componentType && (componentType.get() != "") )
{
IddObjectType iddType(componentType.get());
wo = _workspace.getObjectByTypeAndName(iddType,componentName.get());
}
if( wo )
{
targetModelObject = translateAndMapWorkspaceObject( wo.get() );
if( !targetModelObject)
{
LOG(Error, "Error importing object: " << wo->briefDescription() );
continue;
}
if( OptionalHVACComponent hvacComponent = targetModelObject->optionalCast<HVACComponent>() )
{
Node node = airLoopHVAC.supplyOutletNode();
if( hvacComponent->addToNode(node) )
{
if( boost::optional<StraightComponent> straightComponent = hvacComponent->optionalCast<StraightComponent>() )
{
Node outletNode = straightComponent->outletModelObject()->cast<Node>();
Node inletNode = straightComponent->inletModelObject()->cast<Node>();
if( componentOutletNodeName )
{
//.........这里部分代码省略.........
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateAirLoopHVAC.cpp
示例3: LOG
OptionalModelObject ReverseTranslator::translateOtherEquipment(
const WorkspaceObject & workspaceObject)
{
if( workspaceObject.iddObject().type() != IddObjectType::OtherEquipment ){
LOG(Error, "WorkspaceObject is not IddObjectType::OtherEquipment");
return boost::none;
}
LOG(Info,"OtherEquipment is an internal load separate from any other system, and not "
<< "associated with an end use subcategory. Use with caution.");
// create the definition
openstudio::model::OtherEquipmentDefinition definition(m_model);
OptionalString s = workspaceObject.name();
if(s){
definition.setName(*s + " Definition");
}
s = workspaceObject.getString(openstudio::OtherEquipmentFields::DesignLevelCalculationMethod, true);
OS_ASSERT(s);
OptionalDouble d;
if (istringEqual("EquipmentLevel", *s)){
d = workspaceObject.getDouble(openstudio::OtherEquipmentFields::DesignLevel);
if (d){
if (d.get() < 0.0) {
LOG(Warn,"OtherEquipment has negative energy use. Advanced feature--use with caution.");
}
definition.setDesignLevel(*d);
}else{
LOG(Error, "EquipmentLevel value not found for workspace object " << workspaceObject);
}
}else if(istringEqual("Watts/Area", *s)){
d = workspaceObject.getDouble(openstudio::OtherEquipmentFields::PowerperZoneFloorArea);
if (d){
if (d.get() < 0.0) {
LOG(Warn,"OtherEquipment has negative energy use. Advanced feature--use with caution.");
}
definition.setWattsperSpaceFloorArea(*d);
}else{
LOG(Error, "Watts/Area value not found for workspace object " << workspaceObject);
}
}else if(istringEqual("Watts/Person", *s)){
d = workspaceObject.getDouble(openstudio::OtherEquipmentFields::PowerperPerson);
if (d){
if (d.get() < 0.0) {
LOG(Warn,"OtherEquipment has negative energy use. Advanced feature--use with caution.");
}
definition.setWattsperPerson(*d);
}else{
LOG(Error, "Watts/Person value not found for workspace object " << workspaceObject);
}
}else{
LOG(Error, "Unknown DesignLevelCalculationMethod value for workspace object" << workspaceObject);
}
d = workspaceObject.getDouble(openstudio::OtherEquipmentFields::FractionLatent);
if (d){
definition.setFractionLatent(*d);
}
d = workspaceObject.getDouble(openstudio::OtherEquipmentFields::FractionRadiant);
if (d){
definition.setFractionRadiant(*d);
}
d = workspaceObject.getDouble(openstudio::OtherEquipmentFields::FractionLost);
if (d){
definition.setFractionLost(*d);
}
// create the instance
OtherEquipment otherEquipment(definition);
s = workspaceObject.name();
if(s){
otherEquipment.setName(*s);
}
OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::OtherEquipmentFields::ZoneorZoneListName);
if (target){
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if (modelObject){
if (modelObject->optionalCast<Space>()){
otherEquipment.setSpace(modelObject->cast<Space>());
}else if (modelObject->optionalCast<SpaceType>()){
otherEquipment.setSpaceType(modelObject->cast<SpaceType>());
}
}
}
target = workspaceObject.getTarget(openstudio::OtherEquipmentFields::ScheduleName);
if (target){
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if (modelObject){
if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()){
Schedule schedule(*intermediate);
otherEquipment.setSchedule(schedule);
}
//.........这里部分代码省略.........
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateOtherEquipment.cpp
示例4: LOG
OptionalModelObject ReverseTranslator::translateZoneHVACEquipmentList( const WorkspaceObject & workspaceObject )
{
if(workspaceObject.iddObject().type() != IddObjectType::ZoneHVAC_EquipmentList){
LOG(Error, "WorkspaceObject is not IddObjectType: ZoneHVAC:EquipmentList");
return boost::none;
}
boost::optional<openstudio::model::ThermalZone> thermalZone;
std::vector<WorkspaceObject> zoneHVACEquipmentConnections = workspaceObject.getSources(IddObjectType::ZoneHVAC_EquipmentConnections);
if (zoneHVACEquipmentConnections.size() == 0){
LOG(Error,"No ZoneHVAC:EquipmentConnections object associated with a zone. Check that IDF file is correct.");
return boost::none;
}else if (zoneHVACEquipmentConnections.size() > 1){
LOG(Error,"More than 1 ZoneHVAC:EquipmentConnections objects associated with a zone. Check that IDF file is correct.");
return boost::none;
}
for( const auto & zoneHVACEquipmentConnection : zoneHVACEquipmentConnections )
{
if( boost::optional<std::string> name = zoneHVACEquipmentConnection.getString(ZoneHVAC_EquipmentConnectionsFields::ZoneName) )
{
boost::optional<model::Space> space = m_model.getModelObjectByName<model::Space>(name.get());
if( space )
{
thermalZone = space->thermalZone();
}
}
}
// get extensible groups for zone HVAC equipment list
std::vector<IdfExtensibleGroup> extensibleGroups = workspaceObject.extensibleGroups();
// loop over extensible groups
unsigned n = extensibleGroups.size();
for (unsigned i = 0; i < n; ++i){
// define variables
boost::optional<openstudio::model::ZoneHVACComponent> zoneHVACComponent;
// get zone equipment object type and zone equipment object name from extensible group
boost::optional<std::string> zoneEquipmentObjectType = extensibleGroups[i].getString(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentObjectType);
boost::optional<std::string> zoneEquipmentName = extensibleGroups[i].getString(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentName);
// get zone equipment workspace object by type and name
if (zoneEquipmentObjectType && zoneEquipmentName){
OptionalWorkspaceObject zoneEquipmentWorkspaceObject = workspaceObject.workspace().getObjectByTypeAndName(IddObjectType(*zoneEquipmentObjectType),*zoneEquipmentName);
// translate zone equipment workspace object
if (zoneEquipmentWorkspaceObject){
OptionalModelObject zoneEquipmentModelObject = translateAndMapWorkspaceObject(*zoneEquipmentWorkspaceObject);
// cast zone equipment model object to zone HVAC component
if (zoneEquipmentModelObject){
zoneHVACComponent = zoneEquipmentModelObject->optionalCast<ZoneHVACComponent>();
}
}
}
// add to thermal zone
if (zoneHVACComponent && thermalZone){
zoneHVACComponent->addToThermalZone(*thermalZone);
}
}
return boost::none;
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:62,代码来源:ReverseTranslateZoneHVACEquipmentList.cpp
示例5: LOG
OptionalModelObject ReverseTranslator::translateDaylightingControls( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::Daylighting_Controls ){
LOG(Error, "WorkspaceObject is not IddObjectType: Daylighting:Controls");
return boost::none;
}
DaylightingControl daylightingControl(m_model);
OptionalThermalZone thermalZone;
OptionalSpace space;
OptionalWorkspaceObject target = workspaceObject.getTarget(Daylighting_ControlsFields::ZoneName);
if (target){
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if (modelObject){
if (modelObject->optionalCast<Space>()){
space = modelObject->cast<Space>();
thermalZone = space->thermalZone();
}
}
}
if (space){
daylightingControl.setSpace(*space);
}
if (thermalZone){
thermalZone->setPrimaryDaylightingControl(daylightingControl);
}
OptionalDouble d = workspaceObject.getDouble(Daylighting_ControlsFields::XCoordinateofFirstReferencePoint);
if (d){
daylightingControl.setPositionXCoordinate(*d);
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::YCoordinateofFirstReferencePoint);
if (d){
daylightingControl.setPositionYCoordinate(*d);
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::ZCoordinateofFirstReferencePoint);
if (d){
daylightingControl.setPositionZCoordinate(*d);
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::FractionofZoneControlledbyFirstReferencePoint);
if (d && thermalZone){
thermalZone->setFractionofZoneControlledbyPrimaryDaylightingControl(*d);
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::IlluminanceSetpointatFirstReferencePoint);
if (d){
daylightingControl.setIlluminanceSetpoint(*d);
}
OptionalInt i = workspaceObject.getInt(Daylighting_ControlsFields::LightingControlType);
if (i){
switch (*i){
case 1:
daylightingControl.setLightingControlType("Continuous");
break;
case 2:
daylightingControl.setLightingControlType("Stepped");
break;
case 3:
daylightingControl.setLightingControlType("Continuous/Off");
break;
default:
;
}
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::GlareCalculationAzimuthAngleofViewDirectionClockwisefromZoneyAxis);
if (d){
daylightingControl.setThetaRotationAroundYAxis( -degToRad(*d) );
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::MaximumAllowableDiscomfortGlareIndex);
if (d){
daylightingControl.setMaximumAllowableDiscomfortGlareIndex(*d);
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::MinimumInputPowerFractionforContinuousDimmingControl);
if (d){
daylightingControl.setMinimumInputPowerFractionforContinuousDimmingControl(*d);
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::MinimumLightOutputFractionforContinuousDimmingControl);
if (d){
daylightingControl.setMinimumLightOutputFractionforContinuousDimmingControl(*d);
}
i = workspaceObject.getInt(Daylighting_ControlsFields::NumberofSteppedControlSteps);
if (i){
daylightingControl.setNumberofSteppedControlSteps(*i);
}
d = workspaceObject.getDouble(Daylighting_ControlsFields::ProbabilityLightingwillbeResetWhenNeededinManualSteppedControl);
if (d){
daylightingControl.setProbabilityLightingwillbeResetWhenNeededinManualSteppedControl(*d);
//.........这里部分代码省略.........
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateDaylightingControls.cpp
示例6: LOG
OptionalModelObject ReverseTranslator::translateSiteGroundTemperatureBuildingSurface( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::Site_GroundTemperature_BuildingSurface )
{
LOG(Error, "WorkspaceObject is not IddObjectType: Site_GroundTemperature_BuildingSurface");
return boost::none;
}
SiteGroundTemperatureBuildingSurface mo = m_model.getUniqueModelObject<SiteGroundTemperatureBuildingSurface>();
boost::optional<double> value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::JanuaryGroundTemperature);
if( value )
{
mo.setJanuaryGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::FebruaryGroundTemperature);
if( value )
{
mo.setFebruaryGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::MarchGroundTemperature);
if( value )
{
mo.setMarchGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::AprilGroundTemperature);
if( value )
{
mo.setAprilGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::MayGroundTemperature);
if( value )
{
mo.setMayGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::JuneGroundTemperature);
if( value )
{
mo.setJuneGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::JulyGroundTemperature);
if( value )
{
mo.setJulyGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::AugustGroundTemperature);
if( value )
{
mo.setAugustGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::SeptemberGroundTemperature);
if( value )
{
mo.setSeptemberGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::OctoberGroundTemperature);
if( value )
{
mo.setOctoberGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::NovemberGroundTemperature);
if( value )
{
mo.setNovemberGroundTemperature(value.get());
}
value = workspaceObject.getDouble(Site_GroundTemperature_BuildingSurfaceFields::DecemberGroundTemperature);
if( value )
{
mo.setDecemberGroundTemperature(value.get());
}
return mo;
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:85,代码来源:ReverseTranslateSiteGroundTemperatureBuildingSurface.cpp
示例7: LOG
OptionalModelObject ReverseTranslator::translateCoilCoolingDXSingleSpeed( const WorkspaceObject & workspaceObject )
{
OptionalModelObject result,temp;
OptionalSchedule schedule;
//get the Schedule
OptionalWorkspaceObject owo = workspaceObject.getTarget(Coil_Cooling_DX_SingleSpeedFields::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.briefDescription()
<<"Failed to convert iddObject (schedule) into ModelObject. Maybe it does not exist in model yet");
return result;
}
//collect the curves
owo = workspaceObject.getTarget(Coil_Cooling_DX_SingleSpeedFields::TotalCoolingCapacityFunctionofTemperatureCurveName);
if(!owo)
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't find TotalCoolingCapacityFunctionOfTemperatureCurve.");
return result;
}
if( owo->numSources() > 1 )
{
owo = owo->workspace().addObject(owo.get());
}
temp= translateAndMapWorkspaceObject( *owo );
if(!temp)
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't convert workspace curve into a model curve. ");
return result;
}
boost::optional<Curve> tccfot = temp->optionalCast<Curve>();
if( ! tccfot )
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " curve is wrong type. ");
return result;
}
owo = workspaceObject.getTarget(Coil_Cooling_DX_SingleSpeedFields::EnergyInputRatioFunctionofTemperatureCurveName);
if(!owo)
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't find EnergyInputRatioFunctionofTemperatureCurveName.");
return result;
}
if( owo->numSources() > 1 )
{
owo = owo->workspace().addObject(owo.get());
}
temp = translateAndMapWorkspaceObject( *owo );
if(!temp)
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't convert workspace curve into a model curve. ");
return result;
}
boost::optional<Curve> eirfot = temp->optionalCast<Curve>();
if( ! eirfot )
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " curve is wrong type. ");
return result;
}
owo = workspaceObject.getTarget(Coil_Cooling_DX_SingleSpeedFields::TotalCoolingCapacityFunctionofFlowFractionCurveName);
if(!owo)
{
LOG(Error, "Error importing object: "
<< workspaceObject.briefDescription()
<< " Can't find TotalCoolingCapacityFunctionofFlowFractionCurveName.");
return result;
}
if( owo->numSources() > 1 )
{
//.........这里部分代码省略.........
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateCoilCoolingDXSingleSpeed.cpp
示例8: curve
boost::optional<ModelObject> ReverseTranslator::translateCurveDoubleExponentialDecay(
const WorkspaceObject& workspaceObject )
{
CurveDoubleExponentialDecay curve(m_model);
OptionalString s;
OptionalDouble d;
if ((s = workspaceObject.name())) {
curve.setName(*s);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::Coefficient1C1))) {
curve.setCoefficient1C1(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::Coefficient2C2))) {
curve.setCoefficient2C2(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::Coefficient3C3))) {
curve.setCoefficient3C3(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::Coefficient3C4))) {
curve.setCoefficient3C4(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::Coefficient3C5))) {
curve.setCoefficient3C5(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::MinimumValueofx))) {
curve.setMinimumValueofx(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::MaximumValueofx))) {
curve.setMaximumValueofx(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::MinimumCurveOutput))) {
curve.setMinimumCurveOutput(*d);
}
if ((d = workspaceObject.getDouble(Curve_DoubleExponentialDecayFields::MaximumCurveOutput))) {
curve.setMaximumCurveOutput(*d);
}
if ((s = workspaceObject.getString(Curve_DoubleExponentialDecayFields::InputUnitTypeforx,false,true))) {
curve.setInputUnitTypeforx(*s);
}
if ((s = workspaceObject.getString(Curve_DoubleExponentialDecayFields::OutputUnitType,false,true))) {
curve.setOutputUnitType(*s);
}
return curve;
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:48,代码来源:ReverseTranslateCurveDoubleExponentialDecay.cpp
示例9: onObjectRemove
void WorkspaceWatcher::onObjectRemove(const WorkspaceObject& removedObject)
{
OS_ASSERT(removedObject.initialized());
OS_ASSERT(removedObject.workspace().isMember(removedObject.handle()));
}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:5,代码来源:WorkspaceWatcher.cpp
示例10: onObjectAdd
void WorkspaceWatcher::onObjectAdd(const WorkspaceObject& addedObject)
{
OS_ASSERT(addedObject.initialized());
OS_ASSERT(addedObject.workspace().isMember(addedObject.handle()));
}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:5,代码来源:WorkspaceWatcher.cpp
示例11: translateAndMapWorkspaceObject
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::MinimumSystemAirFlowRatio);
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
//.........这里部分代码省略.........
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateSizingSystem.cpp
注:本文中的WorkspaceObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论