本文整理汇总了C++中OSOptionalQuantity类的典型用法代码示例。如果您正苦于以下问题:C++ OSOptionalQuantity类的具体用法?C++ OSOptionalQuantity怎么用?C++ OSOptionalQuantity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OSOptionalQuantity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(ModelFixture,ZoneHVACFourPipeFanCoil_MaximumSupplyAirFlowRate_Quantity) {
Model model;
EXPECT_EQ(0u,model.objects().size());
EXPECT_TRUE(model.versionObject());
// need schedule
ScheduleConstant sched(model);
EXPECT_EQ(1u,model.objects().size());
sched.setValue(1.0); // Always on
// need fan
FanConstantVolume fan(model,sched);
// need cooling and heating coils
CoilCoolingWater coolingCoil(model,sched);
CoilHeatingWater heatingCoil(model,sched);
// construct object
ZoneHVACFourPipeFanCoil zoneHVACFourPipeFanCoil(model,sched,fan,coolingCoil,heatingCoil);
EXPECT_EQ(6u,model.objects().size());
Unit units = zoneHVACFourPipeFanCoil.getMaximumSupplyAirFlowRate(true).units(); // Get IP units.
double value(1.0);
Quantity testQ(value,units);
EXPECT_TRUE(zoneHVACFourPipeFanCoil.setMaximumSupplyAirFlowRate(testQ));
OSOptionalQuantity q = zoneHVACFourPipeFanCoil.getMaximumSupplyAirFlowRate(true);
ASSERT_TRUE(q.isSet());
EXPECT_NEAR(value,q.get().value(),1.0E-8);
EXPECT_EQ(units.standardString(),q.units().standardString());
}
示例2: TEST_F
TEST_F(UnitsFixture,IddUnits_DefaultValue) {
IdfObject idfObject(IddObjectType::OS_Building);
// IdfObject::getQuantity(unsigned index, bool returnDefault=false, bool returnIP=false) const;
// this field is empty but has a default value of 3 m
EXPECT_TRUE(idfObject.getQuantity(OS_BuildingFields::NominalFloortoFloorHeight, false).empty());
OSOptionalQuantity siQ = idfObject.getQuantity(OS_BuildingFields::NominalFloortoFloorHeight, true, false);
ASSERT_FALSE(siQ.empty());
OptionalUnit mUnit = createUnit("m");
ASSERT_TRUE(mUnit);
EXPECT_EQ(*mUnit, siQ.get().units());
EXPECT_EQ(3.0, siQ.get().value());
OSOptionalQuantity ipQ = idfObject.getQuantity(OS_BuildingFields::NominalFloortoFloorHeight, true, true);
ASSERT_FALSE(ipQ.empty());
OptionalUnit ftUnit = createUnit("ft");
ASSERT_TRUE(ftUnit);
EXPECT_EQ(*ftUnit, ipQ.get().units());
EXPECT_NE(3.0, ipQ.get().value());
OptionalQuantity q = QuantityConverter::instance().convert(ipQ.get(), *mUnit);
ASSERT_TRUE(q);
EXPECT_DOUBLE_EQ(3.0, q->value());
}
示例3: TEST_F
TEST_F(ModelFixture,ThermalZone_Volume_Quantity) {
Model model;
ThermalZone thermalZone(model);
Unit units = thermalZone.getVolume(true).units(); // Get IP units.
double value(1.0);
Quantity testQ(value,units);
EXPECT_TRUE(thermalZone.setVolume(testQ));
OSOptionalQuantity q = thermalZone.getVolume(true);
ASSERT_TRUE(q.isSet());
EXPECT_NEAR(value,q.get().value(),1.0E-8);
EXPECT_EQ(units.standardString(),q.get().units().standardString());
}
示例4: TEST_F
TEST_F(ModelFixture,HeatExchangerAirToAirSensibleAndLatent_RateofDefrostTimeFractionIncrease_Quantity) {
Model model;
HeatExchangerAirToAirSensibleAndLatent heatExchangerAirToAirSensibleAndLatent(model);
Unit units = heatExchangerAirToAirSensibleAndLatent.getRateofDefrostTimeFractionIncrease(true).units(); // Get IP units.
double value(1.0);
Quantity testQ(value,units);
EXPECT_TRUE(heatExchangerAirToAirSensibleAndLatent.setRateofDefrostTimeFractionIncrease(testQ));
OSOptionalQuantity q = heatExchangerAirToAirSensibleAndLatent.getRateofDefrostTimeFractionIncrease(true);
ASSERT_TRUE(q.isSet());
EXPECT_NEAR(value,q.get().value(),1.0E-8);
EXPECT_EQ(units.standardString(),q.units().standardString());
}
示例5: TEST_F
TEST_F(ModelFixture,PeopleDefinition_SensibleHeatFraction_Quantity) {
Model model;
PeopleDefinition peopleDefinition(model);
Unit units = peopleDefinition.getSensibleHeatFraction(true).units(); // Get IP units.
double value(0.5);
Quantity testQ(value,units);
EXPECT_TRUE(peopleDefinition.setSensibleHeatFraction(testQ));
OSOptionalQuantity q = peopleDefinition.getSensibleHeatFraction(true);
ASSERT_TRUE(q.isSet());
EXPECT_NEAR(value,q.get().value(),1.0E-8);
EXPECT_EQ(units.standardString(),q.units().standardString());
}
示例6: setThermalResistance
bool AirGap_Impl::setThermalResistance(const OSOptionalQuantity& thermalResistance) {
bool result(false);
OptionalDouble value;
if (thermalResistance.isSet()) {
value = getDoubleFromQuantity(OS_Material_AirGapFields::ThermalResistance,thermalResistance.get());
if (value) {
result = setThermalResistance(value);
}
}
else {
result = setThermalResistance(value);
}
return result;
}
示例7: result
bool GasMixture_Impl::setGas4Fraction(const OSOptionalQuantity& gas4Fraction) {
bool result(false);
OptionalDouble value;
if (gas4Fraction.isSet()) {
value = getDoubleFromQuantity(OS_WindowMaterial_GasMixtureFields::Gas4Fraction,gas4Fraction.get());
if (value) {
result = setGas4Fraction(value);
}
}
else {
result = setGas4Fraction(value);
}
return result;
}
示例8: setSpecificHeatRatio
bool Gas_Impl::setSpecificHeatRatio(const OSOptionalQuantity& specificHeatRatio) {
bool result(false);
OptionalDouble value;
if (specificHeatRatio.isSet()) {
value = getDoubleFromQuantity(OS_WindowMaterial_GasFields::SpecificHeatRatio,specificHeatRatio.get());
if (value) {
result = setSpecificHeatRatio(value);
}
}
else {
result = setSpecificHeatRatio(value);
}
return result;
}
示例9: setMolecularWeight
bool Gas_Impl::setMolecularWeight(const OSOptionalQuantity& molecularWeight) {
bool result(false);
OptionalDouble value;
if (molecularWeight.isSet()) {
value = getDoubleFromQuantity(OS_WindowMaterial_GasFields::MolecularWeight,molecularWeight.get());
if (value) {
result = setMolecularWeight(value);
}
}
else {
result = setMolecularWeight(value);
}
return result;
}
示例10: setMaximumFlowRate
bool FanConstantVolume_Impl::setMaximumFlowRate(const OSOptionalQuantity& maximumFlowRate) {
bool result(false);
OptionalDouble value;
if (maximumFlowRate.isSet()) {
value = getDoubleFromQuantity(OS_Fan_ConstantVolumeFields::MaximumFlowRate,maximumFlowRate.get());
if (value) {
result = setMaximumFlowRate(value);
}
}
else {
result = setMaximumFlowRate(value);
}
return result;
}
示例11: setOptimumPartLoadRatio
bool BoilerSteam_Impl::setOptimumPartLoadRatio(const OSOptionalQuantity& optimumPartLoadRatio) {
bool result(false);
OptionalDouble value;
if (optimumPartLoadRatio.isSet()) {
value = getDoubleFromQuantity(OS_Boiler_SteamFields::OptimumPartLoadRatio,optimumPartLoadRatio.get());
if (value) {
result = setOptimumPartLoadRatio(value);
}
}
else {
result = setOptimumPartLoadRatio(value);
}
return result;
}
示例12: setTheoreticalEfficiency
bool BoilerSteam_Impl::setTheoreticalEfficiency(const OSOptionalQuantity& theoreticalEfficiency) {
bool result(false);
OptionalDouble value;
if (theoreticalEfficiency.isSet()) {
value = getDoubleFromQuantity(OS_Boiler_SteamFields::TheoreticalEfficiency,theoreticalEfficiency.get());
if (value) {
result = setTheoreticalEfficiency(value);
}
}
else {
result = setTheoreticalEfficiency(value);
}
return result;
}
示例13: TEST_F
TEST_F(ModelFixture,ZoneHVACIdealLoadsAirSystem_MaximumHeatingAirFlowRate_Quantity) {
Model model;
// TODO: Check constructor.
ZoneHVACIdealLoadsAirSystem zoneHVACIdealLoadsAirSystem(model);
Unit units = zoneHVACIdealLoadsAirSystem.getMaximumHeatingAirFlowRate(true).units(); // Get IP units.
// TODO: Check that value is appropriate (within bounds)
double value(1.0);
Quantity testQ(value,units);
EXPECT_TRUE(zoneHVACIdealLoadsAirSystem.setMaximumHeatingAirFlowRate(testQ));
OSOptionalQuantity q = zoneHVACIdealLoadsAirSystem.getMaximumHeatingAirFlowRate(true);
ASSERT_TRUE(q.isSet());
EXPECT_NEAR(value,q.get().value(),1.0E-8);
EXPECT_EQ(units.standardString(),q.units().standardString());
}
示例14: TEST_F
TEST_F(ModelFixture,AirGap_ThermalResistance_Quantity) {
Model model;
// TODO: Check constructor.
AirGap airGap(model);
Unit units = airGap.getThermalResistance(true).units(); // Get IP units.
// TODO: Check that value is appropriate (within bounds)
double value(1.0);
Quantity testQ(value,units);
EXPECT_TRUE(airGap.setThermalResistance(testQ));
OSOptionalQuantity q = airGap.getThermalResistance(true);
ASSERT_TRUE(q.isSet());
EXPECT_NEAR(value,q.get().value(),1.0E-8);
EXPECT_EQ(units.standardString(),q.units().standardString());
}
示例15: TEST_F
TEST_F(ModelFixture,StandardGlazing_VisibleTransmittanceatNormalIncidence_Quantity) {
Model model;
// TODO: Check constructor.
StandardGlazing standardGlazing(model);
Unit units = standardGlazing.getVisibleTransmittanceatNormalIncidence(true).units(); // Get IP units.
// TODO: Check that value is appropriate (within bounds)
double value(1.0);
Quantity testQ(value,units);
EXPECT_TRUE(standardGlazing.setVisibleTransmittanceatNormalIncidence(testQ));
OSOptionalQuantity q = standardGlazing.getVisibleTransmittanceatNormalIncidence(true);
ASSERT_TRUE(q.isSet());
EXPECT_NEAR(value,q.get().value(),1.0E-8);
EXPECT_EQ(units.standardString(),q.units().standardString());
}