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

Error after generating FMU #194

Open
levanthanh3005 opened this issue Dec 1, 2023 · 5 comments
Open

Error after generating FMU #194

levanthanh3005 opened this issue Dec 1, 2023 · 5 comments

Comments

@levanthanh3005
Copy link

levanthanh3005 commented Dec 1, 2023

Hi,
In my python code, I has "import ctype",
I use ubuntu20.04, python3.9,
I run fmu file with openmcx
It can generate fmu file, but when I test the file, it shows:

Current thread 0x00007fe341b77740 (most recent call first):
<no Python frame>
ERROR: The element FMU caused an unrecoverable error. Shutting down.

Any ideas to fix it,
Regards,
T

@markaren
Copy link
Member

markaren commented Dec 1, 2023

I really can't say.. Perhaps the script can't find the shared library?

@levanthanh3005
Copy link
Author

levanthanh3005 commented Dec 1, 2023

My code is super simple, I just import ctype and its crash.
I test it with fmpy but with openmcx, it crashes, I have no idea why.
I think it can find the library because it can work with fmpy, but somehow, with other systems, ctype has problem.
Do you know anyway to debug it and fix it.
Or is there anyway to pack all of the shared library so I can bring it to other environment

from pythonfmu import Fmi2Causality, Fmi2Slave, Boolean, Integer, Real, String

import ctypes

class PythonSlave(Fmi2Slave):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.intOut = 1
        self.realOut = 3.0
        self.realIn = 3.0
        self.booleanVariable = True
        self.stringVariable = "Hello World!"
                
        self.register_variable(Real("realIn", causality=Fmi2Causality.input))
        self.register_variable(Real("realOut", causality=Fmi2Causality.output))        

    def do_step(self, current_time, step_size):
        return True

@markaren
Copy link
Member

markaren commented Dec 6, 2023

So it works with FMPy?
Are you getting the same issue using say Ecos, which is also a C++ framework?

@levanthanh3005
Copy link
Author

Hi @markaren
Thank you a lot for your support, also in the Ecos repo.
image
The problem is still the same, as you can see in the image.
If I remove import ctypes it can work, but I need it, could you try from your side,
Regards,
T

@markaren
Copy link
Member

Sorry, it would be too time consuming for me to look into this at the moment.

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

No branches or pull requests

2 participants