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

Provide simple example #36

Open
weberscode opened this issue Nov 17, 2023 · 4 comments
Open

Provide simple example #36

weberscode opened this issue Nov 17, 2023 · 4 comments

Comments

@weberscode
Copy link

Hi all,

is it possible to provide a simple example of a julia generated model exchange fmu that i could include to my Modelica model.

The input should be u and the output y = asin(bu). The values a and b are constant parameters.

kind regards
Simon

@ThummeTo
Copy link
Owner

ThummeTo commented Nov 17, 2023

Hey @weberscode;
did you check out e.g. the BouncingBall Example here? It's not as easy as the system that you provided, but still really really easy.

You basically can remove all continuous and discrete states. To be honest, I never tested a non-dynamic simulation model with pure I/O-behavior, but this should work, too. Otherwise feel free to report.

Other tutorial are WIP BTW.
Best regards!

@larschrj
Copy link

larschrj commented Jan 17, 2024

I might add that the bouncing ball example code in the docs seems to be broken at the moment. Seems to be a case of updating the docs.

FMU_FCT_INIT only returns a tuple with 5 values rather than 6 which is what fmi2CreateSimple seems to expect.

Seems to be xd that is missing in the return (no of discrete events as far as I can discern from the source). By extension, FMU_FCT_OUTPUT and FMU_FCT_EVENT need to accept xd as an argument (FMU_FCT_OUTPUT = function(t, x, ẋ, xd, u, p)...)

The jl file in the example folder has corrected this. It seems to be broken in some other way at least when I (perhaps incorrectly) do an include on it to try and run it on an Apple M1 (which I know is not officially supported) or WSL Ubuntu.

@ThummeTo
Copy link
Owner

ThummeTo commented Jan 17, 2024

Ok, we check this. There will be a little patch (v0.3.2) anyway within the next two weeks.
I also triggered a test run on the server (which is Windows only):
Test run

@larschrj
Copy link

Got the example working in v1.10 on Windows 11.

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

3 participants