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

Weather file does not load into FMU #1373

Closed
dhblum opened this issue Jun 8, 2020 · 1 comment
Closed

Weather file does not load into FMU #1373

dhblum opened this issue Jun 8, 2020 · 1 comment
Assignees

Comments

@dhblum
Copy link
Contributor

dhblum commented Jun 8, 2020

There is an issue where, if a model is using one of:

  1. IDEAS.BoundaryConditions.SimInfoManager to specify a weather file
  2. Buildings.ThermalZones.Detailed.MixedAir with the parameter lat defined by Buildings.BoundaryConditions.WeatherData.ReaderTMY3.lat AND there is an overhang specified

Then, when compiling the model using the latest trunk of JModelica.org, the weather file is not copied into the resources directory of the resulting FMU. In this case, simulating the FMU depends on the weather file being in the location as specified in the model. While this works for the developer who compiles the FMU and runs it on the same machine, this precludes the FMU from being simulated on a different machine where the weather file is not present. This reduces the portability of such an FMU.

The issue seems to stem from the specification of the weather file location string parameter as a structural parameter by JModelica. The issue has been traced to the model IBPSA.BoundaryConditions.SolarGeometry.BaseClasses.SolarAzimuth (used in both Buildings and IDEAS) line 27:

  final parameter Boolean outsidePolarCircle = lat < polarCircle and lat > -polarCircle

and lines 37-53:

  if outsidePolarCircle then
    // Outside the polar circle, the only non-differentiability is at night when the sun is set.
    // Hence, we use noEvent.
    if noEvent(solTim - integer(solTim/day)*day < 43200) then
      solAzi =-solAziTem;
    else
      solAzi = solAziTem;
    end if;
  else
    // Inside the polar circle, there is a jump at (solar-)midnight when the sun can
    // be above the horizon. Hence, we do not use noEvent(...)
    if solTim - integer(solTim/day)*day < 43200 then
      solAzi =-solAziTem;
    else
      solAzi = solAziTem;
    end if;
  end if;

This issue looks to be fixed if the if/then clause using outsidePolarCircle is reformulated into a one-line notation. I will make a PR. Thanks to @Mathadon and @JavierArroyoBastida for helping to diagnose and find a fix that could work.

@dhblum dhblum self-assigned this Jun 8, 2020
@dhblum
Copy link
Contributor Author

dhblum commented Jun 10, 2020

Closed by #1374.

@dhblum dhblum closed this as completed Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant