Skip to content

Commit

Permalink
Merge pull request #3278 from NREL/julien_prs
Browse files Browse the repository at this point in the history
Julien prs
  • Loading branch information
macumber authored Sep 20, 2018
2 parents 7de20dd + 50c64f2 commit 9885686
Show file tree
Hide file tree
Showing 36 changed files with 390 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ boost::optional<IdfObject> ForwardTranslator::translateThermalZone( ThermalZone
}

// Spaces

// Note, when you reach this point of the forward translator thermalZone.combineSpaces() has already been called,
// This happens in ForwardTranslator::translateModelPrivate. As a result, each zone has 0 or 1 space only
std::vector<Space> spaces = modelObject.spaces();
if (spaces.empty()){
LOG(Warn, "ThermalZone " << modelObject.name().get() << " does not have any geometry or loads associated with it.");
Expand Down Expand Up @@ -704,7 +705,7 @@ boost::optional<IdfObject> ForwardTranslator::translateThermalZone( ThermalZone
if ( returnPlenum ) {
auto allIdealHVAC = returnPlenum->getImpl<model::detail::AirLoopHVACReturnPlenum_Impl>()->zoneHVACIdealLoadsAirSystems();
if ( ! allIdealHVAC.empty() ) {
zoneHVACIdealWorkaround = true;
zoneHVACIdealWorkaround = true;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions openstudiocore/src/model/FileOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ QString longPathName(const QString& path)
}

// Copy all files from existing resources dir into temp dir when opening
openstudio::path sourceDir = osmPath.parent_path() / osmPath.stem();
openstudio::path sourceDir = getCompanionFolder(osmPath);
openstudio::path destDir = modelTempDir / toPath("resources");
if (openstudio::filesystem::exists(sourceDir)){
LOG_FREE(Debug, "initializeModelTempDir", "Copying '" << toString(sourceDir) << "' to '" << toString(destDir) << "'");
Expand Down Expand Up @@ -504,7 +504,8 @@ QString longPathName(const QString& path)

// copy resources
openstudio::path srcDir = modelTempDir / toPath("resources");
openstudio::path dstDir = osmPath.parent_path() / osmPath.stem();
// Get the companion directory
openstudio::path dstDir = getCompanionFolder(osmPath);

LOG_FREE(Debug, "saveModelTempDir", "Copying " << toString(srcDir) << " to " << toString(dstDir));

Expand Down
11 changes: 6 additions & 5 deletions openstudiocore/src/model/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,9 +1123,9 @@ Model::Model(const openstudio::Workspace& workspace)
getImpl<detail::Model_Impl>()->createComponentWatchers();
}

boost::optional<Model> Model::load(const path& p) {
boost::optional<Model> Model::load(const path& osmPath) {
OptionalModel result;
OptionalIdfFile oIdfFile = IdfFile::load(p,IddFileType::OpenStudio);
OptionalIdfFile oIdfFile = IdfFile::load(osmPath,IddFileType::OpenStudio);
if (oIdfFile) {
try {
result = Model(*oIdfFile);
Expand All @@ -1134,7 +1134,8 @@ boost::optional<Model> Model::load(const path& p) {
}

if (result){
path workflowJSONPath = p.parent_path() / p.stem() / toPath("workflow.osw");
// Load the workflow.osw in the model's companion folder
path workflowJSONPath = getCompanionFolder(osmPath) / toPath("workflow.osw");
if (exists(workflowJSONPath)){
boost::optional<WorkflowJSON> workflowJSON = WorkflowJSON::load(workflowJSONPath);
if (workflowJSON){
Expand Down Expand Up @@ -2563,7 +2564,7 @@ void Model::applySizingValues() {

std::shared_ptr<openstudio::detail::WorkspaceObject_Impl> detail::Model_Impl::ModelObjectCreator::getNew(
Model_Impl * model,
const IdfObject& obj,
const IdfObject& obj,
bool keepHandle) const
{
auto typeToCreate = obj.iddObject().type();
Expand All @@ -2576,7 +2577,7 @@ std::shared_ptr<openstudio::detail::WorkspaceObject_Impl> detail::Model_Impl::Mo
}

std::shared_ptr<openstudio::detail::WorkspaceObject_Impl> detail::Model_Impl::ModelObjectCreator::getCopy(
Model_Impl * model,
Model_Impl * model,
const std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>& obj,
bool keepHandle) const
{
Expand Down
2 changes: 1 addition & 1 deletion openstudiocore/src/model/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace detail{
// The following node variable is also available for system nodes that are for “air”:
// TODO: implement check? If no, make result non static and remove the result.empty() check
"System Node Current Density Volume Flow Rate",
"Average, System Node Current Density"
"System Node Current Density"

// The following node variables are “advanced” and normally used for debugging unusual cases:
//"System Node Minimum Temperature",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace detail {
const std::vector<std::string>& SurfacePropertyOtherSideCoefficients_Impl::outputVariableNames() const
{
static std::vector<std::string> result{
"Average, Surface Other Side Coefficients Exterior Air Drybulb Temperature"
"Surface Other Side Coefficients Exterior Air Drybulb Temperature"
};
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ namespace detail {
const std::vector<std::string>& SurfacePropertyOtherSideConditionsModel_Impl::outputVariableNames() const
{
static std::vector<std::string> result{
"Average, Surface Other Side Conditions Modeled Convection Air Temperature",
"Average, Surface Other Side Conditions Modeled Convection Heat Transfer Coefficient",
"Average, Surface Other Side Conditions Modeled Radiation Temperature",
"Average, Surface Other Side Conditions Modeled Radiation Heat Transfer Coefficient"
"Surface Other Side Conditions Modeled Convection Air Temperature",
"Surface Other Side Conditions Modeled Convection Heat Transfer Coefficient",
"Surface Other Side Conditions Modeled Radiation Temperature",
"Surface Other Side Conditions Modeled Radiation Heat Transfer Coefficient"
};
return result;
}
Expand Down
5 changes: 3 additions & 2 deletions openstudiocore/src/model/TableMultiVariableLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ namespace detail {

double TableMultiVariableLookup_Impl::evaluate(const std::vector<double>& x) const
{
return 1.0;
LOG(Warn, "Curve evaluation isn't implemented for TableMultiVariableLookup");
return -9999.0;
}

bool TableMultiVariableLookup_Impl::addPoint(const std::vector<double> & t_xValues, double t_yValue)
Expand Down Expand Up @@ -1278,4 +1279,4 @@ TableMultiVariableLookup::TableMultiVariableLookup(std::shared_ptr<detail::Table
/// @endcond

} // model
} // openstudio
} // openstudio
5 changes: 5 additions & 0 deletions openstudiocore/src/model/ThermalZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,12 @@ namespace detail {

// don't override if user provided zone floor area
if (isEmpty(OS_ThermalZoneFields::FloorArea)){
LOG(Info, "ThermalZone '" << this->name().get() << "' has spaces with mis-matched 'Part of Total Floor Area' flags. "
<< "Setting set the flag to 'Yes', but hard-coding the total floor area to only take into account the spaces "
<< "that are part of total Floor Area");
this->setDouble(OS_ThermalZoneFields::FloorArea, totalFloorArea);
} else {
LOG(Info, "ThermalZone " << this->name().get() << " has a user-specified Floor Area, using this number");
}
}

Expand Down
6 changes: 4 additions & 2 deletions openstudiocore/src/openstudio_lib/ApplyMeasureNowDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ void ApplyMeasureNowDialog::displayMeasure()
m_tempWorkflowJSON.resetMeasurePaths();
m_tempWorkflowJSON.addMeasurePath(m_bclMeasure->directory().parent_path());

MeasureStep step(toString(m_bclMeasure->directory().stem()));
// Since we set the measure_paths, we only neeed to reference the name of the directory (=last level directory name)
// eg: /path/to/measure_folder => measure_folder
MeasureStep step(toString( getLastLevelDirectoryName( m_bclMeasure->directory() ) ));
std::vector<WorkflowStep> steps;
steps.push_back(step);
m_tempWorkflowJSON.setWorkflowSteps(steps);
Expand Down Expand Up @@ -715,7 +717,7 @@ void DataPointJobItemView::update(const BCLMeasure & bclMeasure, const boost::op
}

std::vector<std::string> infos = result->stepInfo();
m_dataPointJobHeaderView->setNumWarnings(infos.size());
// m_dataPointJobHeaderView->setNumInfos(infos.size());
for (const std::string& info : infos){
m_dataPointJobContentView->addInfoMessage(info);
}
Expand Down
9 changes: 6 additions & 3 deletions openstudiocore/src/openstudio_lib/DesignDayGridView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,21 +286,24 @@ void DesignDayGridController::addColumns(const QString &/*category*/, std::vecto
for (const QString& field : fields) {
// Evan note: addCheckBoxColumn does not yet handle reset and default
if (field == DAYLIGHTSAVINGTIMEINDICATOR) {
addCheckBoxColumn(Heading(QString(DAYLIGHTSAVINGTIMEINDICATOR), true, false),
// We add the "Apply Selected" button to this column by passing 3rd arg, t_showColumnButton=true
addCheckBoxColumn(Heading(QString(DAYLIGHTSAVINGTIMEINDICATOR), true, true),
std::string("Check to enable daylight saving time indicator."),
NullAdapter(&model::DesignDay::daylightSavingTimeIndicator),
NullAdapter(&model::DesignDay::setDaylightSavingTimeIndicator)
);
}
else if (field == RAININDICATOR) {
addCheckBoxColumn(Heading(QString(RAININDICATOR), true, false),
// We add the "Apply Selected" button to this column by passing 3rd arg, t_showColumnButton=true
addCheckBoxColumn(Heading(QString(RAININDICATOR), true, true),
std::string("Check to enable rain indicator."),
NullAdapter(&model::DesignDay::rainIndicator),
NullAdapter(&model::DesignDay::setRainIndicator)
);
}
else if (field == SNOWINDICATOR) {
addCheckBoxColumn(Heading(QString(SNOWINDICATOR), true, false),
// We add the "Apply Selected" button to this column by passing 3rd arg, t_showColumnButton=true
addCheckBoxColumn(Heading(QString(SNOWINDICATOR), true, true),
std::string("Check to enable snow indicator."),
NullAdapter(&model::DesignDay::snowIndicator),
NullAdapter(&model::DesignDay::setSnowIndicator)
Expand Down
16 changes: 8 additions & 8 deletions openstudiocore/src/openstudio_lib/EMSInspectorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class EMSInspectorActuator : public QWidget {

public:

EMSInspectorActuator(const model::EMSActuatorNames & names, const model::ModelObject & modelObject) :
EMSInspectorActuator(const model::EMSActuatorNames & names, const model::ModelObject & modelObject) :
QWidget(),
m_names(names),
m_modelObject(modelObject)
Expand Down Expand Up @@ -115,12 +115,12 @@ class EMSInspectorActuator : public QWidget {
}
} else {
for( auto & actuator : actuators ) {
std::cout << "m_names.controlTypeName: " << m_names.controlTypeName() << std::endl;
std::cout << "m_names.componentTypeName: " << m_names.componentTypeName() << std::endl;
std::cout << "actuator.actuatedComponentControlType: " << actuator.actuatedComponentControlType() << std::endl;
std::cout << "actuator.actuatedComponentType: " << actuator.actuatedComponentType() << std::endl;
// std::cout << "m_names.controlTypeName: " << m_names.controlTypeName() << std::endl;
// std::cout << "m_names.componentTypeName: " << m_names.componentTypeName() << std::endl;
// std::cout << "actuator.actuatedComponentControlType: " << actuator.actuatedComponentControlType() << std::endl;
// std::cout << "actuator.actuatedComponentType: " << actuator.actuatedComponentType() << std::endl;
if( m_isMatchingActuator(actuator) ) {
std::cout << "removing" << std::endl;
// std::cout << "removing" << std::endl;
actuator.remove();
}
}
Expand All @@ -138,7 +138,7 @@ class EMSInspectorSensor : public QWidget {

public:

EMSInspectorSensor(const std::string & name, const model::ModelObject & modelObject) :
EMSInspectorSensor(const std::string & name, const model::ModelObject & modelObject) :
QWidget(),
m_name(name),
m_modelObject(modelObject)
Expand Down Expand Up @@ -199,7 +199,7 @@ class EMSInspectorSensor : public QWidget {
model::ModelObject m_modelObject;
};

EMSInspectorView::EMSInspectorView(QWidget* parent, EMSInspectorView::Type type) :
EMSInspectorView::EMSInspectorView(QWidget* parent, EMSInspectorView::Type type) :
QWidget(parent),
m_type(type)
{
Expand Down
30 changes: 26 additions & 4 deletions openstudiocore/src/openstudio_lib/FacilityShadingGridView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ namespace openstudio {
FacilityShadingGridView::FacilityShadingGridView(bool isIP, const model::Model & model, QWidget * parent)
: GridViewSubTab(isIP, model, parent)
{
auto modelObjects = subsetCastVector<model::ModelObject>(model.getConcreteModelObjects<model::ShadingSurfaceGroup>());
std::vector<model::ShadingSurfaceGroup> shadingGroups = model.getConcreteModelObjects<model::ShadingSurfaceGroup>();
// Filter out the 'Space' shadingSurfaceTypes
// These are displayed on the Space's "Shading" subtab
shadingGroups.erase(
std::remove_if(shadingGroups.begin(), shadingGroups.end(),
[](const model::ShadingSurfaceGroup & sg) { return sg.shadingSurfaceType() == "Space"; }),
shadingGroups.end());

auto modelObjects = subsetCastVector<model::ModelObject>(shadingGroups);
std::sort(modelObjects.begin(), modelObjects.end(), ModelObjectNameSorter());

m_gridController = new FacilityShadingGridController(isIP, "Shading Surface Group", IddObjectType::OS_ShadingSurfaceGroup, model, modelObjects);
Expand Down Expand Up @@ -153,7 +161,8 @@ namespace openstudio {
m_typeFilter = new QComboBox();
m_typeFilter->addItem("Site");
m_typeFilter->addItem("Building");
m_typeFilter->addItem("Space");
// Space-level shading is on the Space's "Shading" subtab
//m_typeFilter->addItem("Space");
m_typeFilter->setFixedWidth(OSItem::ITEM_WIDTH);
connect(m_typeFilter, &QComboBox::currentTextChanged, this, &openstudio::FacilityShadingGridView::typeFilterChanged);

Expand Down Expand Up @@ -487,7 +496,7 @@ namespace openstudio {
else if (field == TYPE) {
std::function<std::vector<std::string>()> choices(
[]() {
std::vector<std::string> choices{ "Site", "Building", "Space" };
std::vector<std::string> choices{ "Site", "Building", }; // "Space" };
return choices;
}
);
Expand All @@ -506,8 +515,11 @@ namespace openstudio {
std::function<std::vector<model::ModelObject>(const model::ShadingSurfaceGroup &)> allShadingSurfaces(
[](const model::ShadingSurfaceGroup &t_shadingSurfaceGroup) {
std::vector<model::ModelObject> allModelObjects;
// Only keep shadingSurfaces that are not of the 'Space' shadingSurfaceType
//if( t_shadingSurfaceGroup.shadingSurfaceType() != "Space" ) {
auto shadingSurfaces = t_shadingSurfaceGroup.shadingSurfaces();
allModelObjects.insert(allModelObjects.end(), shadingSurfaces.begin(), shadingSurfaces.end());
// }
return allModelObjects;
}
);
Expand Down Expand Up @@ -601,7 +613,17 @@ namespace openstudio {

void FacilityShadingGridController::refreshModelObjects()
{
m_modelObjects = subsetCastVector<model::ModelObject>(m_model.getConcreteModelObjects<model::ShadingSurfaceGroup>());
std::vector<model::ShadingSurfaceGroup> shadingGroups = m_model.getConcreteModelObjects<model::ShadingSurfaceGroup>();
// Filter out the 'Space' shadingSurfaceTypes
// These are displayed on the Space's "Shading" subtab
shadingGroups.erase(
std::remove_if(shadingGroups.begin(), shadingGroups.end(),
[](const model::ShadingSurfaceGroup & sg) { return sg.shadingSurfaceType() == "Space"; }),
shadingGroups.end());

m_modelObjects = subsetCastVector<model::ModelObject>(shadingGroups);

// Sort them
std::sort(m_modelObjects.begin(), m_modelObjects.end(), ModelObjectNameSorter());
}

Expand Down
13 changes: 9 additions & 4 deletions openstudiocore/src/openstudio_lib/MainRightColumnController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@ void MainRightColumnController::configureForConstructionsSubTab(int subTabID)
myModelList->setItemsType(OSItemType::LibraryItem);
myModelList->setShowFilterLayout(true);

myModelList->addModelObjectType(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials");
// TODO: commented out until ThermochromicGlazing is properly wrapped
// myModelList->addModelObjectType(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials");

myModelList->addModelObjectType(IddObjectType::OS_WindowMaterial_Glazing_RefractionExtinctionMethod, "Refraction Extinction Method Glazing Window Materials");
myModelList->addModelObjectType(IddObjectType::OS_WindowMaterial_Shade, "Shade Window Materials");
myModelList->addModelObjectType(IddObjectType::OS_WindowMaterial_Screen, "Screen Window Materials");
Expand All @@ -451,7 +453,8 @@ void MainRightColumnController::configureForConstructionsSubTab(int subTabID)
myLibraryList->setItemsType(OSItemType::LibraryItem);
myLibraryList->setShowFilterLayout(true);

myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials");
// TODO: commented out until ThermochromicGlazing is properly wrapped
// myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials");
myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_Glazing_RefractionExtinctionMethod, "Refraction Extinction Method Glazing Window Materials");
myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_Shade, "Shade Window Materials");
myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_Screen, "Screen Window Materials");
Expand Down Expand Up @@ -500,7 +503,9 @@ void MainRightColumnController::configureForConstructionsSubTab(int subTabID)
myLibraryList->setItemsType(OSItemType::LibraryItem);
myLibraryList->setShowFilterLayout(true);

myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials");
// TODO: commented out until ThermochromicGlazing is properly wrapped
// myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials");

myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_Glazing_RefractionExtinctionMethod, "Refraction Extinction Method Glazing Window Materials");
myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_Shade, "Shade Window Materials");
myLibraryList->addModelObjectType(IddObjectType::OS_WindowMaterial_Screen, "Screen Window Materials");
Expand Down Expand Up @@ -1095,7 +1100,7 @@ void MainRightColumnController::configureForHVACSystemsSubTab(int subTabID)
libraryWidget->addModelObjectType(IddObjectType::OS_Pump_VariableSpeed,"Pump Variable Speed");
libraryWidget->addModelObjectType(IddObjectType::OS_HeaderedPumps_VariableSpeed,"Pump Variable Speed Headered");
libraryWidget->addModelObjectType(IddObjectType::OS_PlantComponent_TemperatureSource, "Plant Component - Temp Source");
libraryWidget->addModelObjectType(IddObjectType::OS_PlantComponent_UserDefined, "Plant Component - User Defined");
libraryWidget->addModelObjectType(IddObjectType::OS_PlantComponent_UserDefined, "Plant Component - User Defined");
libraryWidget->addModelObjectType(IddObjectType::OS_Pipe_Outdoor, "Pipe - Outdoor");
libraryWidget->addModelObjectType(IddObjectType::OS_Pipe_Indoor, "Pipe - Indoor");
libraryWidget->addModelObjectType(IddObjectType::OS_Pipe_Adiabatic, "Pipe - Adiabatic");
Expand Down
4 changes: 3 additions & 1 deletion openstudiocore/src/openstudio_lib/MaterialsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ std::vector<std::pair<IddObjectType, std::string> > MaterialsView::modelObjectTy
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_Material_InfraredTransparent, "Infrared Transparent Materials"));
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_Material_RoofVegetation, "Roof Vegetation Materials"));
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_WindowMaterial_Glazing_RefractionExtinctionMethod, "Refraction Extinction Method Glazing Window Materials"));
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials"));

// TODO: commented out until ThermochromicGlazing is properly wrapped
// result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, "Glazing Group Thermochromic Window Materials"));

return result;
}
Expand Down
Loading

0 comments on commit 9885686

Please sign in to comment.