boost::optional<IdfObject> ForwardTranslator::translateStandardOpaqueMaterial( StandardOpaqueMaterial & modelObject )
{
  IdfObject idfObject(openstudio::IddObjectType::Material );

  m_idfObjects.push_back(idfObject);

  idfObject.setString(openstudio::MaterialFields::Name, modelObject.name().get());

  idfObject.setString(openstudio::MaterialFields::Roughness, modelObject.roughness());

  idfObject.setDouble(openstudio::MaterialFields::Thickness, modelObject.thickness());

  idfObject.setDouble(openstudio::MaterialFields::Conductivity, modelObject.thermalConductivity());

  idfObject.setDouble( openstudio::MaterialFields::Density, modelObject.density());

  idfObject.setDouble(openstudio::MaterialFields::SpecificHeat, modelObject.specificHeat());

  OptionalDouble d = modelObject.thermalAbsorptance();
  if(d) {
    idfObject.setDouble(openstudio::MaterialFields::ThermalAbsorptance, *d);
  }

  d = modelObject.solarAbsorptance();
  if(d) {
    idfObject.setDouble(openstudio::MaterialFields::SolarAbsorptance, *d);
  }

  d = modelObject.visibleAbsorptance();
  if(d) {
    idfObject.setDouble(openstudio::MaterialFields::VisibleAbsorptance, *d);
  }

  return boost::optional<IdfObject>(idfObject);
}
Exemplo n.º 2
0
TEST_F(ModelFixture, Construction_SetUFactor) {
  Model model = exampleModel();

  OptionalConstruction tempC = model.getModelObjectByName<Construction>("Exterior Wall");
  ASSERT_TRUE(tempC);
  Construction construction(*tempC);
  OptionalOpaqueMaterial tempM = construction.insulation();
  ASSERT_TRUE(tempM);
  StandardOpaqueMaterial insulation = tempM->cast<StandardOpaqueMaterial>();
  // should not be able to make insulation thickness go < 0
  double originalResistance = 1.0 / construction.thermalConductance().get();
  double insulationResistance = insulation.thermalResistance();
  double newResistance = 0.8 * (originalResistance - insulationResistance);
  bool result = construction.setConductance(1.0 / newResistance);
  EXPECT_FALSE(result);
  if (result) {
    EXPECT_TRUE(insulation.thickness() < 0.0);
  }
  else {
    EXPECT_TRUE(insulation.thickness() > 0.0);
  }
  LOG(Trace,"Construction where tried to set thermal conductance too high:" << std::endl
      << construction.createComponent());
}