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

integrate ModelicaRes into BuildingsPy #4

Open
mwetter opened this issue May 1, 2014 · 10 comments
Open

integrate ModelicaRes into BuildingsPy #4

mwetter opened this issue May 1, 2014 · 10 comments
Assignees

Comments

@mwetter
Copy link

mwetter commented May 1, 2014

No description provided.

@mwetter mwetter self-assigned this May 1, 2014
@mwetter
Copy link
Author

mwetter commented May 1, 2014

Merge pull request #3 to the branch issue4_modelicaRes as some further development is needed before merging it to the master.

@kdavies4
Copy link

kdavies4 commented May 2, 2014

Let me know if I need to close that pull request on master and reopen on issue4_modelicaRes.

@mwetter
Copy link
Author

mwetter commented May 2, 2014

That would be great; otherwise I can do it next week.

@kdavies4
Copy link

kdavies4 commented May 5, 2014

It's now pull request #5.

@mwetter
Copy link
Author

mwetter commented May 9, 2014

@kdavies4
I merged the pull request, but the doctests now fail on the branch issue4_modelicaRes. I run

sudo pip install modelicares
mwetter@srg-mw:BuildingsPy$ make doctest
python -m doctest \
    buildingspy/io/*.py \
    buildingspy/examples/*.py \
    buildingspy/examples/dymola/*.py \
    buildingspy/simulate/*.py \
        buildingspy/development/*.py
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/doctest.py", line 2783, in <module>
    sys.exit(_test())
  File "/usr/lib/python2.7/doctest.py", line 2772, in _test
    m = __import__(filename[:-3])
  File "buildingspy/io/outputfile.py", line 4, in <module>
    from modelicares import SimRes
  File "/usr/local/lib/python2.7/dist-packages/modelicares/__init__.py", line 63, in <module>
    from modelicares.linres import LinRes
  File "/usr/local/lib/python2.7/dist-packages/modelicares/linres.py", line 24, in <module>
    from control.matlab import ss
ImportError: No module named control.matlab
make: *** [doctest] Error 255

@kdavies4
Copy link

I'm sorry. I meant to respond to this. It should work to do pip install control. In the next version of ModelicaRes (0.11.0), I'll try to get that to install automatically. It seems that I should use setuptools instead of distutils and include an install_requires list).

mwetter added a commit that referenced this issue May 12, 2014
This is for #4. We like to keep the simulator argument, as Modelica does not standardize the output file format. Also, other non-Modelica simulators are likely to be added in the future. This commit also makes a small change needed for the doctests.
@mwetter
Copy link
Author

mwetter commented May 12, 2014

Using pip install control works with the commit b14bf0b

There is still one test failing:

FAIL: test_addMethods (test_simulate_Simulator.Test_simulate_Simulator)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mwetter/proj/ldrd/bie/modeling/github/iea-annex60/BuildingsPy/buildingspy/tests/test_simulate_Simulator.py", line 83, in test_addMethods
    np.testing.assert_allclose(0.725, r.mean('source.y'))
  File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 1168, in assert_allclose
    verbose=verbose, header=header)
  File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 636, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(mismatch 100.0%)
 x: array(0.725)
 y: array(0.7250000834465027, dtype=float32)

----------------------------------------------------------------------
Ran 18 tests in 32.801s

FAILED (failures=1)

I want to understand first why there is such large a rounding error before accepting the new result.

@kdavies4
Copy link

Is this a test that passed with DyMat before? I'm not sure why there would be rounding error, but I can look into the test case further if necessary.

@mwetter
Copy link
Author

mwetter commented May 19, 2014

Yes, this test passed prior to the ModelicaRes integration. Maybe ModelicaRes computes the integral differently, which it then uses to compute the mean?

@kdavies4
Copy link

Yes, I suspect that it could be different. ModelicaRes is using scipy.integrate.trapz whereas I think it was a custom routine before.

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

2 participants