Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimulationControl choices not translating to E+ #1472

Closed
MatthewSteen opened this issue Feb 17, 2015 · 12 comments · Fixed by #5118
Closed

SimulationControl choices not translating to E+ #1472

MatthewSteen opened this issue Feb 17, 2015 · 12 comments · Fixed by #5118

Comments

@MatthewSteen
Copy link
Member

Looks like the choices from SimulationControl aren't being translated to E+ correctly (ref: UnmetHours).

openstudio_issue1472-1b
openstudio_issue1472-2b

openstudio_issue1p
openstudio_issue2p

@kbenne
Copy link
Contributor

kbenne commented Feb 17, 2015

@MatthewSteen Well there are some overrides in the translator to make sure simulations don't crash. This is a great example of OpenStudio trying to thread a needle between usability and full EnergyPlus power. Did we miss the mark?

https://github.com/NREL/OpenStudio/blob/develop/openstudiocore/src/energyplus/ForwardTranslator/ForwardTranslateSimulationControl.cpp#L59

@kbenne
Copy link
Contributor

kbenne commented Feb 17, 2015

@MatthewSteen maybe I should be more explicit. If you said no to zone sizing (and there are zones and design days) your simulation would fail anyway. It has been a while since I have been in these dark corners, but I'm pretty sure it has to do with how we define ventilation. Maybe other things too.

@kbenne
Copy link
Contributor

kbenne commented Feb 17, 2015

OK. I reviewed the Unmet Hours post. I see LSurf points has a valid scenario where zone sizing could be off and OpenStudio is not allowing it. Seems like a valid complaint. Maybe that override logic should just go away. OS default zone sizing on, allow it to be turned off manually and respect that choice potential E+ failure or not.

@jmarrec
Copy link
Collaborator

jmarrec commented Apr 29, 2021

unsigned numSizingPeriods = modelObject.model().getModelObjects<SizingPeriod>().size();
if (modelObject.doZoneSizingCalculation()) {
simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "Yes");
} else if ((numSizingPeriods > 0) && (modelObject.model().getConcreteModelObjects<ThermalZone>().size() > 0)) {
simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "Yes");
} else {
simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "No");
}
if (modelObject.doSystemSizingCalculation()) {
simCon.setString(openstudio::SimulationControlFields::DoSystemSizingCalculation, "Yes");
} else if ((numSizingPeriods > 0) && (modelObject.model().getConcreteModelObjects<AirLoopHVAC>().size() > 0)) {
simCon.setString(openstudio::SimulationControlFields::DoSystemSizingCalculation, "Yes");
} else {
simCon.setString(openstudio::SimulationControlFields::DoSystemSizingCalculation, "No");
}
if (modelObject.doPlantSizingCalculation()) {
simCon.setString(openstudio::SimulationControlFields::DoPlantSizingCalculation, "Yes");
} else if ((numSizingPeriods > 0) && (modelObject.model().getConcreteModelObjects<PlantLoop>().size() > 0)) {
simCon.setString(openstudio::SimulationControlFields::DoPlantSizingCalculation, "Yes");
} else {
simCon.setString(openstudio::SimulationControlFields::DoPlantSizingCalculation, "No");
}

@kbenne how about:

    if (modelObject.doZoneSizingCalculation()) {
      simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "Yes");
-   } else if ((numSizingPeriods > 0) && (modelObject.model().getConcreteModelObjects<ThermalZone>().size() > 0)) {
+   } else if (modelObject.isDoZoneSizingCalculationDefaulted() &&
                 (numSizingPeriods > 0) && (modelObject.model().getConcreteModelObjects<ThermalZone>().size() > 0)) {
      simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "Yes");
    } else {
      simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "No");
    }

@jmarrec
Copy link
Collaborator

jmarrec commented Apr 29, 2021

Or maybe even better:

    #include <algorithm>

    auto hasZoneEquipment = [](const Model& m) {
      auto zones = m.getConcreteModelObjects<ThermalZone>();
      return std::any_of(zones.cbegin(), zones.cend(), [](const auto& z){ return !z.equipment().empty(); });
    };

    if (modelObject.doZoneSizingCalculation()) {
      simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "Yes");
    } else if ((numSizingPeriods > 0) && hasZoneEquipment(modelObject.model())) {
      if (modelObject.isDoZoneSizingCalculationDefaulted()) {
        LOG(Info, "You have zonal equipment and design days, and SimulationControl::DoZoneSizingCalculation is defaulted: turning on Do Zone Sizing Calculation");
        simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "Yes");
      } else {
        LOG(Info, "You have zonal equipment and design days, it's possible you should enable SimulationControl::DoZoneSizingCalculation");
      }
    } else {
      simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, "No");
    }

@kbenne
Copy link
Contributor

kbenne commented May 18, 2021

@jmarrec What is the value of DoZoneSizingCalculation for a new model. If is isn't "Yes" then won't there always be some logging noise unless the user deliberately sets "Yes"?

@kbenne
Copy link
Contributor

kbenne commented May 18, 2021

Well assuming there is zone equipment...

@jmarrec
Copy link
Collaborator

jmarrec commented May 19, 2021

DoZoneSizingCalculation is useful if you have a zone with zonal equipment that is actually autosized. We don't have a handy way of checking if an equipment is autosized (we have a way to autosize() only), so that's just trying to be more precise.

As far as logging goes, we can remove the case where we default it to Yes. I doubt many people read Info log levels anyways.

@jmarrec
Copy link
Collaborator

jmarrec commented Jun 9, 2021

@kbenne ping.

@jmarrec
Copy link
Collaborator

jmarrec commented Feb 22, 2022

@kbenne pong.

@jmarrec
Copy link
Collaborator

jmarrec commented May 31, 2023

@kbenne sliced ping.

@jmarrec
Copy link
Collaborator

jmarrec commented Mar 22, 2024

@kbenne PONG.

Related to openstudiocoalition/OpenStudioApplication#693 where I realized that it'd be better is that logic would be in the model namespace rather than the ForwardTranslator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants