Skip to content

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

@levanthanh3005

Description

@levanthanh3005

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions