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

Copy weather file to project for increased portability of projects #566

Closed
marcusfuchs opened this issue Feb 11, 2019 · 6 comments
Closed

Comments

@marcusfuchs
Copy link
Contributor

marcusfuchs commented Feb 11, 2019

As I understand the current code, it stores an absolute path to the weather file in the exported building model. We have the use case where we generate models on one machine, but simulate on another machine. Making sure to set the correct absolute path for the weather file over multiple machines has proven to be relatively cumbersome and error-prone in our experience.

Therefore I suggest the following alternative approach:

  • Generate a folder Resources within the project export file structure
  • Copy a weather file from the given path (or TEASER's default weather file location) to this Resources folder
  • Use Modelica.Utilities.Files.loadResource("modelica://... to load the weather file from the relative project path

For our applications, this would be the preferred standard way of handling weather files in the TEASER exported models. If others agree, I can propose an implementation. An if others prefer the current way, maybe we could add the suggested approach as an option?

@MichaMans
Copy link
Contributor

@marcusfuchs thanks for this issue! I like this enhancement. Maybe we should include the boundary condition tables like T_set in the Resource folder as well.

@marcusfuchs
Copy link
Contributor Author

I started looking into this, during which I noticed the following:

The Project class documents its weather_file_path attribute as follows:

"""
weather_file_path : str
        Absolute path to weather file used for Modelica simulation. Default
        weather file can be find in inputdata/weatherdata.
"""

Yet, the Project.set_default() function seems to set the default from

self.weather_file_path = utilities.get_full_path(
            os.path.join(
                "data",
                "input",
                "inputdata",
                "weatherdata",
                "DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR.mos"))

to

self.weather_file_path = "modelica://AixLib/Resources/WeatherData/" \
                                 "TRY2010_12_Jahr_Modelica-Library.txt"

Even though I suspect from the TRY2010_12 in both filenames that the contents of the two files should be the same, I think it may be a bit risky to reference two different files here instead of one. As a result of this, the tests in TEASER/tests/test_data.py are executed with the second reference via the MODELICAPATH.

To avoid parsing the MODELICAPATH in TEASER to copy files, I would propose the following implementation:

  • Project.weather_file_path accepts both modelica://...-paths and absolute paths
  • If an absolute path is given, we copy the file to the Resources folder, and reference the file in the model via modelica://...
  • Else the original modelica://...-path is used directly in the model without copying

Let me know if you have ideas for a better implementation!

And I would suggest to consider changing the set_default method to not switch to a different weather file, maybe in a separate issue?

@MichaMans MichaMans added the bug label Jun 12, 2019
@MichaMans
Copy link
Contributor

The currently shipped weather file leads to error in the simulation. I think we should change it to a working one

@MartinRaetz
Copy link
Contributor

I would like to pick up this topic.

Is there any information about the reason, why the last implementation did not work?

Was the shipped file faulty? Was the implementation faulty?

@marcusfuchs
Copy link
Contributor Author

Sorry, I have no further information after my last post above.

@MartinRaetz MartinRaetz mentioned this issue Nov 24, 2020
1 task
MichaMans added a commit that referenced this issue Dec 3, 2020
MartinRaetz added a commit that referenced this issue Dec 3, 2020
* first changes

* weird things happening in git

* Revert "weird things happening in git"

This reverts commit 923747b.

* implement working version of weather file export

* delete trial results

* convert everything to: saving weather file at "project" level and not at building level

* Revert "Merge branch 'issue566weatherfile' into development"

This reverts commit 9e772fbff69fbce8711cf3629f0aec4eea0363c3.

* Revert "Revert "Merge branch 'issue566weatherfile' into development""

This reverts commit e376eec.

* blank lines (ci)

* run Black on project.py

* update unitTest.json -> previous weatherfile is outdated (doesnt work for AixLib Version) -> set to None(null) to use default weatherfile of Teaser

* naming

* naming

* Weather file line is to long resulting in error

* First try of IBPSA Weather file export

* fixing

* blank line end of file

* #566 fixed tab stop at end of file

* 566 raised aixlib version number to actual dev number

Co-authored-by: MichaMans <[email protected]>
@MartinRaetz
Copy link
Contributor

solved in: #664

MartinRaetz added a commit that referenced this issue Jun 16, 2021
* #543 changed shading g total to 1 for the use for the sunblind shading factor, added shading_max_irr and shading_g_total to record export, attention hardcode

* #543 changed sunblind parameters to be usecondition parameters

* boundary conditions are not needed any longer

* just black

* untested proposal for shading gvalue

* fix calculation of shading

* #635 should revise the setters

* Update doc strings and mark todos

* Add value for max power of ideal cooler

* Typo in doc string

* Improvements excel import

* Update air density typo

* added info to doc string conv_rad

* Improvements excel import

* revert part of a commit that accidently had these changes

* run black on exvel import

* add info

* delete blank line

* restart ci

* Revert "restart ci"

This reverts commit 6253f74.

* add document suggestions made by @MartinRaetz

* defaults to 1.0 if now windows

* More doc strings extensions

* More doc strings extensions 2

* WithProfile commit

* schedules is private attribute (doc string)

* Format

* Correct and reformulate withProfile docstrings

* Correct and reformulate withProfile docstrings

* correct "nan-dealing" and update pandas df.at to df.loc and typing error

* update pandas df.at to df.loc

* update parameter names based on MBL

* add moisture and nports to RC models

* add 0 time step to internal gains

* set columns in gains file to 4

* set humidification to false if central_ahu

* change shading default

* remove hacked moisure and nports

* Adds UseCondition for classrooms

* update aixlib model to CO2 multizone

* propagate use_c_flow and set medium with c

* make example import use co2 and moisture balance

* update thermal zone name

* delete probable clutter

* E261 at least two spaces before inline comment

* update for aixlib PR1052

* update buildings version

* Issue566weatherfile (#664)

* first changes

* weird things happening in git

* Revert "weird things happening in git"

This reverts commit 923747b.

* implement working version of weather file export

* delete trial results

* convert everything to: saving weather file at "project" level and not at building level

* Revert "Merge branch 'issue566weatherfile' into development"

This reverts commit 9e772fbff69fbce8711cf3629f0aec4eea0363c3.

* Revert "Revert "Merge branch 'issue566weatherfile' into development""

This reverts commit e376eec.

* blank lines (ci)

* run Black on project.py

* update unitTest.json -> previous weatherfile is outdated (doesnt work for AixLib Version) -> set to None(null) to use default weatherfile of Teaser

* naming

* naming

* Weather file line is to long resulting in error

* First try of IBPSA Weather file export

* fixing

* blank line end of file

* #566 fixed tab stop at end of file

* 566 raised aixlib version number to actual dev number

Co-authored-by: MichaMans <[email protected]>

* Add annotation

For #669

* Write test scripts

For #669

* Add script to run unit tests

For #669

* Option to export reference results

For #669

* Remove test line

For #669

* Use runUnitTests from IBPSA

For #669

* Replace very old version

For #669

* Adjust model path in test script

For #669

* Add missing comma

For #669

* Add missing tolerance

For #669

* Fix decoding errors

For #669

* Deactivate pedantic mode

For #669

* Adjust annotation

For #669

* Change script location

* Delete stray bracket

* Add missing quotes

* Increase count

* revised project name of e3, revised and reformatted runUnitTests.py, added pytest simulaiton export

* revised formatting of aixlib_ouput.py

* added reference results for e2 and added them to the ref path of that example

* Add missing file to setup

For #669

* Adjusted the profiles to a uniform 24h-Format

* solve export problem

* #688 raised version number for master merge

* #688 raise AixLib version number + sort import section following pep8

Co-authored-by: MichaMans <[email protected]>
Co-authored-by: Peter Remmen <[email protected]>
Co-authored-by: Peter Remmen <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Martin Kremer <[email protected]>
Co-authored-by: Michael Mans <[email protected]>
Co-authored-by: Martin Kremer <[email protected]>
Co-authored-by: Marcus Fuchs <[email protected]>
Co-authored-by: Wackerbauer <[email protected]>
Co-authored-by: David Wackerbauer <[email protected]>
Co-authored-by: David <[email protected]>
Co-authored-by: David Jansen <[email protected]>
pseiwert pushed a commit that referenced this issue Feb 3, 2023
* #543 changed shading g total to 1 for the use for the sunblind shading factor, added shading_max_irr and shading_g_total to record export, attention hardcode

* #543 changed sunblind parameters to be usecondition parameters

* boundary conditions are not needed any longer

* just black

* untested proposal for shading gvalue

* fix calculation of shading

* #635 should revise the setters

* Update doc strings and mark todos

* Add value for max power of ideal cooler

* Typo in doc string

* Improvements excel import

* Update air density typo

* added info to doc string conv_rad

* Improvements excel import

* revert part of a commit that accidently had these changes

* run black on exvel import

* add info

* delete blank line

* restart ci

* Revert "restart ci"

This reverts commit 6253f74.

* add document suggestions made by @MartinRaetz

* defaults to 1.0 if now windows

* More doc strings extensions

* More doc strings extensions 2

* WithProfile commit

* schedules is private attribute (doc string)

* Format

* Correct and reformulate withProfile docstrings

* Correct and reformulate withProfile docstrings

* correct "nan-dealing" and update pandas df.at to df.loc and typing error

* update pandas df.at to df.loc

* update parameter names based on MBL

* add moisture and nports to RC models

* add 0 time step to internal gains

* set columns in gains file to 4

* set humidification to false if central_ahu

* change shading default

* remove hacked moisure and nports

* Adds UseCondition for classrooms

* update aixlib model to CO2 multizone

* propagate use_c_flow and set medium with c

* make example import use co2 and moisture balance

* update thermal zone name

* delete probable clutter

* E261 at least two spaces before inline comment

* update for aixlib PR1052

* update buildings version

* Issue566weatherfile (#664)

* first changes

* weird things happening in git

* Revert "weird things happening in git"

This reverts commit 923747b.

* implement working version of weather file export

* delete trial results

* convert everything to: saving weather file at "project" level and not at building level

* Revert "Merge branch 'issue566weatherfile' into development"

This reverts commit 9e772fbff69fbce8711cf3629f0aec4eea0363c3.

* Revert "Revert "Merge branch 'issue566weatherfile' into development""

This reverts commit e376eec.

* blank lines (ci)

* run Black on project.py

* update unitTest.json -> previous weatherfile is outdated (doesnt work for AixLib Version) -> set to None(null) to use default weatherfile of Teaser

* naming

* naming

* Weather file line is to long resulting in error

* First try of IBPSA Weather file export

* fixing

* blank line end of file

* #566 fixed tab stop at end of file

* 566 raised aixlib version number to actual dev number

Co-authored-by: MichaMans <[email protected]>

* Add annotation

For #669

* Write test scripts

For #669

* Add script to run unit tests

For #669

* Option to export reference results

For #669

* Remove test line

For #669

* Use runUnitTests from IBPSA

For #669

* Replace very old version

For #669

* Adjust model path in test script

For #669

* Add missing comma

For #669

* Add missing tolerance

For #669

* Fix decoding errors

For #669

* Deactivate pedantic mode

For #669

* Adjust annotation

For #669

* Change script location

* Delete stray bracket

* Add missing quotes

* Increase count

* revised project name of e3, revised and reformatted runUnitTests.py, added pytest simulaiton export

* revised formatting of aixlib_ouput.py

* added reference results for e2 and added them to the ref path of that example

* Add missing file to setup

For #669

* Adjusted the profiles to a uniform 24h-Format

* solve export problem

* #688 raised version number for master merge

* #688 raise AixLib version number + sort import section following pep8

Co-authored-by: MichaMans <[email protected]>
Co-authored-by: Peter Remmen <[email protected]>
Co-authored-by: Peter Remmen <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Martin Kremer <[email protected]>
Co-authored-by: Michael Mans <[email protected]>
Co-authored-by: Martin Kremer <[email protected]>
Co-authored-by: Marcus Fuchs <[email protected]>
Co-authored-by: Wackerbauer <[email protected]>
Co-authored-by: David Wackerbauer <[email protected]>
Co-authored-by: David <[email protected]>
Co-authored-by: David Jansen <[email protected]>
pseiwert pushed a commit that referenced this issue Feb 3, 2023
* #543 changed shading g total to 1 for the use for the sunblind shading factor, added shading_max_irr and shading_g_total to record export, attention hardcode

* #543 changed sunblind parameters to be usecondition parameters

* boundary conditions are not needed any longer

* just black

* untested proposal for shading gvalue

* fix calculation of shading

* #635 should revise the setters

* Update doc strings and mark todos

* Add value for max power of ideal cooler

* Typo in doc string

* Improvements excel import

* Update air density typo

* added info to doc string conv_rad

* Improvements excel import

* revert part of a commit that accidently had these changes

* run black on exvel import

* add info

* delete blank line

* restart ci

* Revert "restart ci"

This reverts commit 6253f74.

* add document suggestions made by @MartinRaetz

* defaults to 1.0 if now windows

* More doc strings extensions

* More doc strings extensions 2

* WithProfile commit

* schedules is private attribute (doc string)

* Format

* Correct and reformulate withProfile docstrings

* Correct and reformulate withProfile docstrings

* correct "nan-dealing" and update pandas df.at to df.loc and typing error

* update pandas df.at to df.loc

* update parameter names based on MBL

* add moisture and nports to RC models

* add 0 time step to internal gains

* set columns in gains file to 4

* set humidification to false if central_ahu

* change shading default

* remove hacked moisure and nports

* Adds UseCondition for classrooms

* update aixlib model to CO2 multizone

* propagate use_c_flow and set medium with c

* make example import use co2 and moisture balance

* update thermal zone name

* delete probable clutter

* E261 at least two spaces before inline comment

* update for aixlib PR1052

* update buildings version

* Issue566weatherfile (#664)

* first changes

* weird things happening in git

* Revert "weird things happening in git"

This reverts commit 923747b.

* implement working version of weather file export

* delete trial results

* convert everything to: saving weather file at "project" level and not at building level

* Revert "Merge branch 'issue566weatherfile' into development"

This reverts commit 9e772fbff69fbce8711cf3629f0aec4eea0363c3.

* Revert "Revert "Merge branch 'issue566weatherfile' into development""

This reverts commit e376eec.

* blank lines (ci)

* run Black on project.py

* update unitTest.json -> previous weatherfile is outdated (doesnt work for AixLib Version) -> set to None(null) to use default weatherfile of Teaser

* naming

* naming

* Weather file line is to long resulting in error

* First try of IBPSA Weather file export

* fixing

* blank line end of file

* #566 fixed tab stop at end of file

* 566 raised aixlib version number to actual dev number

Co-authored-by: MichaMans <[email protected]>

* Add annotation

For #669

* Write test scripts

For #669

* Add script to run unit tests

For #669

* Option to export reference results

For #669

* Remove test line

For #669

* Use runUnitTests from IBPSA

For #669

* Replace very old version

For #669

* Adjust model path in test script

For #669

* Add missing comma

For #669

* Add missing tolerance

For #669

* Fix decoding errors

For #669

* Deactivate pedantic mode

For #669

* Adjust annotation

For #669

* Change script location

* Delete stray bracket

* Add missing quotes

* Increase count

* revised project name of e3, revised and reformatted runUnitTests.py, added pytest simulaiton export

* revised formatting of aixlib_ouput.py

* added reference results for e2 and added them to the ref path of that example

* Add missing file to setup

For #669

* Adjusted the profiles to a uniform 24h-Format

* solve export problem

* #688 raised version number for master merge

* #688 raise AixLib version number + sort import section following pep8

Co-authored-by: MichaMans <[email protected]>
Co-authored-by: Peter Remmen <[email protected]>
Co-authored-by: Peter Remmen <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Martin Kremer <[email protected]>
Co-authored-by: Michael Mans <[email protected]>
Co-authored-by: Martin Kremer <[email protected]>
Co-authored-by: Marcus Fuchs <[email protected]>
Co-authored-by: Wackerbauer <[email protected]>
Co-authored-by: David Wackerbauer <[email protected]>
Co-authored-by: David <[email protected]>
Co-authored-by: David Jansen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants