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

ModelicaSystem does not return from call #103

Open
alidaf opened this issue Oct 2, 2019 · 7 comments
Open

ModelicaSystem does not return from call #103

alidaf opened this issue Oct 2, 2019 · 7 comments

Comments

@alidaf
Copy link

alidaf commented Oct 2, 2019

Running the bouncingBall script on a Docker container with Debian and OMModelica installed appears to set up the OMC server but the ModelicaSystem call isn't returned:

omc = OMCSessionZMQ()
2019-10-02 14:56:49,581 - OMPython - INFO - OMC Server is up and running at file:////tmp/openmodelica.darren.port.b1050fd2bee2410895097c0fdfd303a7 pid=294
mod = ModelicaSystem("BouncingBall.mo", "BouncingBall", ["Modelica"])
2019-10-02 14:57:03,275 - OMPython - INFO - OMC Server is up and running at file:////tmp/openmodelica.darren.port.9edb9d062daf471dbefac6523603800c pid=315

But there is no return to the prompt. Ctrl-C gives the following traceback:

^CTraceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/dist-packages/OMPython/init.py", line 688, in init
self.__loadingModel()
File "/usr/local/lib/python3.7/dist-packages/OMPython/init.py", line 738, in __loadingModel
self.buildModel()
File "/usr/local/lib/python3.7/dist-packages/OMPython/init.py", line 742, in buildModel
buildModelResult = self.requestApi("buildModel", self.modelName)
File "/usr/local/lib/python3.7/dist-packages/OMPython/init.py", line 765, in requestApi
res = self.getconn.sendExpression(exp)
File "/usr/local/lib/python3.7/dist-packages/OMPython/init.py", line 612, in sendExpression
result = self._omc.recv_string()
File "/usr/local/lib/python3.7/dist-packages/zmq/sugar/socket.py", line 592, in recv_string
msg = self.recv(flags=flags)
File "zmq/backend/cython/socket.pyx", line 791, in zmq.backend.cython.socket.Socket.recv
File "zmq/backend/cython/socket.pyx", line 827, in zmq.backend.cython.socket.Socket.recv
File "zmq/backend/cython/socket.pyx", line 186, in zmq.backend.cython.socket._recv_copy
File "zmq/backend/cython/checkrc.pxd", line 12, in zmq.backend.cython.checkrc._check_rc
KeyboardInterrupt

Thanks

@arun3688
Copy link
Collaborator

arun3688 commented Oct 2, 2019

@alidaf I think you have not import ModelicaSystem class, OMCSessionZMQ and ModelicaSystem are two different classes

>>> from OMPython import OMCSessionZMQ
>>> omc =OMCSessionZMQ()
>>> omc.sendExpression("getClassNames()")

To use ModelicaSystem you need to import like this

>>> from OMPython import ModelicaSystem
>>> mod = ModelicaSystem("BouncingBall.mo", "BouncingBall", ["Modelica"])
>>> mod.sendExpression("getClassNames()")

@alidaf
Copy link
Author

alidaf commented Oct 3, 2019

HI,
That's not it. I have run the script on a host system with no problems.

@alidaf
Copy link
Author

alidaf commented Oct 8, 2019

I've traced the problem to here (line 742):

def buildModel(self):
    # buildModelResult=self.getconn.sendExpression("buildModel("+ mName +")")
    buildModelResult = self.requestApi("buildModel", self.modelName)

@arun3688
Copy link
Collaborator

arun3688 commented Oct 8, 2019

@alidaf But you are not getting any errors when running from normal host systems, with the same line

@alidaf
Copy link
Author

alidaf commented Oct 8, 2019

None. I can give you the dockerfile if you want to create one to try.

@arun3688
Copy link
Collaborator

arun3688 commented Oct 8, 2019

yes you can give me the docker file and i see if i can find something

@alidaf
Copy link
Author

alidaf commented Oct 8, 2019

Dockerfile.txt

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