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

Problem with FMU generated from PythonFMU to run with openmcx #17

Open
levanthanh3005 opened this issue Dec 7, 2023 · 0 comments
Open

Comments

@levanthanh3005
Copy link

Hi,
I build a new simple FMU from PythonFMU.
My code is just very simple

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

In my python code, I has "import ctype", and it crashed

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

This generated FMU run perfectly with fmpy
But I dont know why it crash with openmcx, when I remove the import ctypes, it can work fine.
Any idea to fix it,
Thank you,
T

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