Giter VIP home page Giter VIP logo

pythonfmu3's People

Contributors

fcollonval avatar jrbull avatar markaren avatar msteinsto avatar stephensmith25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pythonfmu3's Issues

Must import as "from pythonfmu3 import ...", i.e. cannot just "import pythonfmu3"

The documentation examples suggest to import pythonfmu3 as, for example:

from pythonfmu3 import Fmi3Causality, Fmi3Slave, Boolean, Int32, Float64, String

However, one may wish to import like this:

import pythonfmu3 as pyfmu3

Then, later in the code, do something like this:

class MyFMU(pyfmu3.Fmi3Slave):
    ...

However, when compiling the FMU, this will fail with the following error message:

  File "E:\Pegasus\sensors\fmu_venv\lib\site-packages\pythonfmu3\builder.py", line 27, in get_class_name
    return re.search(r'class (\w+)\(\s*Fmi3Slave\s*\)\s*:', data).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

So, it appears that the pythonFMU3 code relies on the import style used in the documentation examples, because it searches for class declarations that look like this:

class PythonSlave(Fmi3Slave):
    ....

and not like the MyFMU case above.

Users should be able to import the code either way.

Incidentally, is searching for regular expressions in the code the best way to find classes that extend Fmi3Slave? Would it not be better to instantiate classes, test if they are an instance of Fmi3Slave (which will be True for all subclasses), then get the name via reflection? e.g. type(subclass_instance).__name__

Compile Platform Binary for Darwin

Hello! First of all, thank you for working on this project, is very helpful.

I am trying to replicate the bouncingBall example but I am not able to compile the code to Darwin. I am aware this was an issue with the old pythonfmu but they mention they solved the problem with posterior PR. However, that limitation seems to remain. Do you know how to overcome this limitation ?
Screenshot 2024-05-29 at 17 34 51

Can you confirm if python3.11 is mandatory for using pythonfmu3

I have built a test application with pythonfmu3, it works fine being instantiated with fmpy,

But I need to actually run on a second server that has to run python3.9, redhat 8.

When I rebuild - it runs, when I try and instantiate it fails stating it is missing a python3.11 "so" file.

When I grep the folder, and unzip the FMU file, for python3.11 - I can see

grep -R "python3.11"
Binary file FMUWrapper.fmu matches
Binary file binaries/x86_64-linux/FMUWrapper.so matches

But my python version is

python
Python 3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:50:21) 
[GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

These are two different machines so I don't think I have a polluted environment, I've performed a clean etc. On the second machine I don't have python3.11 installed at all.

Any thoughts? is this a hard coded version of python?

Model description does not end up in the FMU

Documentation shows that the model description should be specified like this:

class PythonSlave(Fmi3Slave):

    author = "John Doe"
    description = "A simple description"
    ...

However, if I then run fmpy.dump(...) on the resultant FMU, it displays the following:

Model Info

  FMI Version        3.0
  FMI Type           Co-Simulation
  Model Name         PythonSlave
  Description        None
  ...

By contrast, if I run fmpy.dump(...) on an FMU generated by another program, then I get, for example:

Model Info

  FMI Version        2.0
  FMI Type           Co-Simulation
  Model Name         160424_V9LCSUT
  Description        Simcenter Flomaster network with FMI for co-simulation interface
  ...

i.e. the problem is not with fmpy.dump(...).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.