本文整理汇总了C++中OptionalSpace类的典型用法代码示例。如果您正苦于以下问题:C++ OptionalSpace类的具体用法?C++ OptionalSpace怎么用?C++ OptionalSpace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OptionalSpace类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hardSize
bool SteamEquipment_Impl::hardSize() {
OptionalSpace space = this->space();
if (!space) {
return false;
}
makeUnique();
SteamEquipmentDefinition definition = steamEquipmentDefinition();
for (LifeCycleCost cost : definition.lifeCycleCosts()) {
cost.convertToCostPerEach();
}
if (definition.designLevel()) {
return true;
}
if (OptionalDouble areaDensity = definition.wattsperSpaceFloorArea()) {
return definition.setDesignLevel(*areaDensity * space->floorArea());
}
if (OptionalDouble peopleDensity = definition.wattsperPerson()) {
return definition.setDesignLevel(*peopleDensity * space->numberOfPeople());
}
OS_ASSERT(false);
return false;
}
示例2: result
double Building_Impl::exteriorSurfaceArea() const {
double result(0.0);
for (const Surface& surface : model().getModelObjects<Surface>()) {
OptionalSpace space = surface.space();
std::string outsideBoundaryCondition = surface.outsideBoundaryCondition();
if (space && openstudio::istringEqual(outsideBoundaryCondition, "Outdoors")) {
result += surface.grossArea() * space->multiplier();
}
}
return result;
}
示例3: TEST_F
TEST_F(ModelFixture, ShadingSurfaceGroup_Space_Hierarchy)
{
Model model;
// add a space
Space space(model);
// add a shading surface group
ShadingSurfaceGroup group(model);
EXPECT_EQ("Building", group.shadingSurfaceType());
EXPECT_TRUE(group.setSpace(space));
EXPECT_EQ("Space", group.shadingSurfaceType());
ASSERT_TRUE(group.space());
EXPECT_EQ(space.handle(), group.space()->handle());
// make a new shading surface
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
ShadingSurface surface(points, model);
EXPECT_TRUE(surface.setShadingSurfaceGroup(group));
ASSERT_TRUE(surface.shadingSurfaceGroup());
EXPECT_EQ(group.handle(), surface.shadingSurfaceGroup()->handle());
// check children from group
ASSERT_EQ(static_cast<unsigned>(1), group.children().size());
EXPECT_EQ(surface.handle(), group.children()[0].handle());
// now check children from space
ASSERT_EQ(static_cast<unsigned>(1), space.children().size());
EXPECT_EQ(group.handle(), space.children()[0].handle());
// check parent from group
ASSERT_TRUE(group.parent());
EXPECT_EQ(space.handle(), group.parent()->handle());
// check parent from surface
ASSERT_TRUE(surface.parent());
EXPECT_EQ(group.handle(), surface.parent()->handle());
// clone the space
ModelObject clone = space.clone(model);
OptionalSpace spaceClone = clone.optionalCast<Space>();
ASSERT_TRUE(spaceClone);
ASSERT_EQ(static_cast<unsigned>(1), spaceClone->children().size());
EXPECT_NE(group.handle(), spaceClone->children()[0].handle());
OptionalShadingSurfaceGroup cloneChild = spaceClone->children()[0].optionalCast<ShadingSurfaceGroup>();
ASSERT_TRUE(cloneChild);
ASSERT_EQ(static_cast<unsigned>(1), cloneChild->children().size());
EXPECT_NE(surface.handle(), cloneChild->children()[0].handle());
}
示例4: if
boost::optional<Schedule> SteamEquipment_Impl::schedule() const {
OptionalSchedule result = getObject<SteamEquipment>().getModelObjectTarget<Schedule>(OS_SteamEquipmentFields::ScheduleName);
if (!result) {
// search upwards
OptionalSpace space = this->space();
OptionalSpaceType spaceType = this->spaceType();
if (space) {
result = space->getDefaultSchedule(DefaultScheduleType::SteamEquipmentSchedule);
} else if (spaceType) {
result = spaceType->getDefaultSchedule(DefaultScheduleType::SteamEquipmentSchedule);
}
}
return result;
}
示例5: if
boost::optional<Schedule> SpaceInfiltrationEffectiveLeakageArea_Impl::schedule() const
{
boost::optional<Schedule> result = getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SpaceInfiltration_EffectiveLeakageAreaFields::ScheduleName);
if (!result){
// search upwards
OptionalSpace space = this->space();
OptionalSpaceType spaceType = this->spaceType();
if (space){
result = space->getDefaultSchedule(DefaultScheduleType::InfiltrationSchedule);
}else if (spaceType){
result = spaceType->getDefaultSchedule(DefaultScheduleType::InfiltrationSchedule);
}
}
return result;
}
示例6: if
boost::optional<Schedule> Lights_Impl::schedule() const
{
boost::optional<Schedule> result = getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_LightsFields::ScheduleName);
if (!result){
// search upwards
OptionalSpace space = this->space();
OptionalSpaceType spaceType = this->spaceType();
if (space){
result = space->getDefaultSchedule(DefaultScheduleType::LightingSchedule);
}else if (spaceType){
result = spaceType->getDefaultSchedule(DefaultScheduleType::LightingSchedule);
}
}
return result;
}
示例7: TEST_F
TEST_F(ModelFixture, InteriorPartitionSurface_Hierarchy)
{
Model model;
Space space(model);
// add a interior partition surface group
InteriorPartitionSurfaceGroup group(model);
EXPECT_FALSE(group.space());
EXPECT_TRUE(group.setSpace(space));
ASSERT_TRUE(group.space());
EXPECT_EQ(space.handle(), group.space()->handle());
// make a new interior partition surface
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
InteriorPartitionSurface surface(points, model);
EXPECT_FALSE(surface.interiorPartitionSurfaceGroup());
EXPECT_TRUE(surface.setInteriorPartitionSurfaceGroup(group));
ASSERT_TRUE(surface.interiorPartitionSurfaceGroup());
EXPECT_EQ(group.handle(), surface.interiorPartitionSurfaceGroup()->handle());
// check children from group
ASSERT_EQ(static_cast<unsigned>(1), group.children().size());
EXPECT_EQ(surface.handle(), group.children()[0].handle());
// now check children from space
ASSERT_EQ(static_cast<unsigned>(1), space.children().size());
EXPECT_EQ(group.handle(), space.children()[0].handle());
// check parent from group
ASSERT_TRUE(group.parent());
EXPECT_EQ(space.handle(), group.parent()->handle());
// check parent from surface
ASSERT_TRUE(surface.parent());
EXPECT_EQ(group.handle(), surface.parent()->handle());
// clone the space
ModelObject clone = space.clone(model);
OptionalSpace spaceClone = clone.optionalCast<Space>();
ASSERT_TRUE(spaceClone);
ASSERT_EQ(static_cast<unsigned>(1), spaceClone->children().size());
EXPECT_NE(group.handle(), spaceClone->children()[0].handle());
}
示例8: 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);
//.........这里部分代码省略.........
示例9: LOG
//.........这里部分代码省略.........
// ZoneHVAC:Baseboard:RadiantConvective:Electric
// ZoneHVAC:Baseboard:RadiantConvective:Water
// ZoneHVAC:Baseboard:RadiantConvective:Steam
// ZoneHVAC:Baseboard:Convective:Electric
// ZoneHVAC:Baseboard:Convective:Water
// ZoneHVAC:HighTemperatureRadiant
// ZoneHVAC:LowTemperatureRadiant:VariableFlow
// ZoneHVAC:LowTemperatureRadiant:ConstantFlow
// ZoneHVAC:LowTemperatureRadiant:Electric
// ZoneHVAC:Dehumidifier:DX
// ZoneHVAC:IdealLoadsAirSystem
// Fan:ZoneExhaust
// WaterHeater:HeatPump
//
if( zoneEquipmentName )
{
if( istringEqual(optionalString.get(),"AirTerminal:SingleDuct:Uncontrolled") )
{
_airTerminal = _workspace.getObjectByTypeAndName(IddObjectType::AirTerminal_SingleDuct_Uncontrolled,zoneEquipmentName.get());
break;
}
else if( istringEqual(optionalString.get(),"ZoneHVAC:AirDistributionUnit") )
{
boost::optional<WorkspaceObject> _airDistributionUnit =
_workspace.getObjectByTypeAndName(IddObjectType::ZoneHVAC_AirDistributionUnit,zoneEquipmentName.get());
if( _airDistributionUnit )
{
boost::optional<std::string> airUnitName;
boost::optional<std::string> airUnitType;
airUnitType = _airDistributionUnit->getString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType);
airUnitName = _airDistributionUnit->getString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName);
if( airUnitName && airUnitType )
{
_airTerminal = _workspace.getObjectByTypeAndName(IddObjectType(airUnitType.get()),airUnitName.get());
}
}
break;
}
}
}
OptionalModelObject airTerminalModelObject;
OptionalSpace space;
OptionalStraightComponent straightComponent;
OptionalThermalZone thermalZone;
if( _airTerminal )
{
airTerminalModelObject = translateAndMapWorkspaceObject( _airTerminal.get() );
}
if( _zone )
{
if( OptionalModelObject mo = translateAndMapWorkspaceObject( _zone.get() ) )
{
space = mo->optionalCast<Space>();
}
}
if( space )
{
thermalZone = space->thermalZone();
}
if( airTerminalModelObject )
{
straightComponent = airTerminalModelObject->optionalCast<StraightComponent>();
}
bool success = false;
if( straightComponent && thermalZone )
{
success = airLoopHVAC.addBranchForZone(thermalZone.get(),straightComponent.get());
}
else if( thermalZone )
{
Model m;
success = airLoopHVAC.addBranchForZone(thermalZone.get(),boost::none);
}
if( success )
{
if( inletAirNodeName ) { thermalZone->inletPortList().airLoopHVACModelObject()->cast<Node>().setName(inletAirNodeName.get()); }
if( returnAirNodeName ) { thermalZone->returnAirModelObject()->cast<Node>().setName(returnAirNodeName.get()); }
}
}
}
}
}
}
return airLoopHVAC;
}