Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Modelica-Arduino not working in OpenModelica

Modelica-Arduino not working in OpenModelica

Hello everyone,

does anybody has experience with the Arduino Uno model in OpenModelica?
I got the Arduino-library from GitHubArduino-library. Among other things, it states there that Dymola 2017 FD01 (or later) and Visual Studio 2015 is needed. I was hoping that there is some way to make the arduino work in openmodelica too, because for a project i only have openmodelica at my disposal. So i tried to run just the "Blink" of the Arduino library with Visual Studio 2015 as Target Build but it didn't work. The first thing which came up is a question window (see below in attachments).

If I keep using new frontend the simulation stops and I got the following messages in the message browser:

 Spoiler Show Spoiler Hide Spoiler
 [1] 14:24:38 Scripting Notification
Skipped loading package IdealizedContact (0.2.1,default) using MODELICAPATH C:/Program Files/OpenModelica1.16.2-64bit/lib/omlibrary;C:/Users/mhl-gl/AppData/Roaming/.openmodelica/libraries/ (uses-annotation may be wrong).

[2] 14:24:38 Scripting Warning
Requested package PlanarMechanics of version 1.4.2-dev, but this package was already loaded with version 1.5.0. There are no conversion annotations and 1.4.2-dev is older than 1.5.0, so the libraries are probably incompatible.

[3] 14:24:38 Scripting Notification
Lego_Raupe requested package Modelica of version 3.2.2. Modelica 3.2.3 is used instead which states that it is fully compatible without conversion script needed.

[4] 14:24:38 Scripting Notification
Skipped loading package CATIAMultiBody (1.6.2,default) using MODELICAPATH C:/Program Files/OpenModelica1.16.2-64bit/lib/omlibrary;C:/Users/mhl-gl/AppData/Roaming/.openmodelica/libraries/ (uses-annotation may be wrong).

[5] 14:24:38 Scripting Notification
Skipped loading package MultiBodyCutJoints (1.2,default) using MODELICAPATH C:/Program Files/OpenModelica1.16.2-64bit/lib/omlibrary;C:/Users/mhl-gl/AppData/Roaming/.openmodelica/libraries/ (uses-annotation may be wrong).

[6] 14:24:38 Scripting Warning
Requested package Modelica_Synchronous of version 0.92.2, but this package was already loaded with version 0.93.0. There are no conversion annotations and 0.92.2 is older than 0.93.0, so the libraries are probably incompatible.

[7] 14:24:38 Scripting Notification
Arduino requested package Modelica of version 3.2.2. Modelica 3.2.3 is used instead which states that it is fully compatible without conversion script needed.

[8] 14:24:38 Scripting Warning
[Modelica_DeviceDrivers: 10:16-10:38]: Conversion-annotation contains unknown element: nonFromVersion.

[9] 14:24:38 Scripting Warning
[Modelica_DeviceDrivers: 10:40-10:62]: Conversion-annotation contains unknown element: nonFromVersion.

[10] 14:24:38 Scripting Warning
[Modelica_DeviceDrivers: 10:64-10:86]: Conversion-annotation contains unknown element: nonFromVersion.

[11] 14:24:38 Scripting Warning
[Modelica_DeviceDrivers: 10:88-10:110]: Conversion-annotation contains unknown element: nonFromVersion.

[12] 14:24:38 Scripting Warning
[Modelica_DeviceDrivers: 10:112-10:134]: Conversion-annotation contains unknown element: nonFromVersion.

[13] 14:24:38 Scripting Warning
Requested package Modelica_DeviceDrivers of version 1.4.4, but this package was already loaded with version 1.8.2. There are no conversion annotations and 1.4.4 is older than 1.8.2, so the libraries are probably incompatible.

[14] 14:24:38 Scripting Warning
Requested package Modelica of version 4.0.0, but this package was already loaded with version 3.2.3. There are no conversion annotations for this version but 4.0.0 is newer than 3.2.3. There is a possibility that 3.2.3 remains backwards compatible, but it is not loaded so OpenModelica cannot verify this.

[15] 14:24:38 Translation Notification
[Arduino.Components.ArduinoUno: 124:52-124:62]: From here:

[16] 14:24:38 Translation Error
[Arduino.Components.ArduinoUno: 124:5-124:63]: Non-array modification ‘true‘ for array component ‘fixed‘, possibly due to missing ‘each‘.
If I try it with old frontend once the simulation output window opens and ends with this error:
C:/PROGRA~1/OPENMO~1.2-6/tools/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lModelicaArduino
collect2.exe: error: ld returned 1 exit status

Arduino.Examples.Blink.makefile:32: recipe for target 'omc_main_target' failed
mingw32-make: *** [omc_main_target] Error 1
mingw32-make: Leaving directory 'C:/Users/mhl-gl/AppData/Local/Temp/OPENMO~1/OMEdit/ARDUIN~1.BLI'
Compilation process failed. Exited with code 2.

Did anybody has an idea how I can solve this problem or did anybody just found another way to run the Arduino library without erros in OpenModelica?

I am grateful for any advice!

Best,
Gela

Edited by: gela - Mar-04-21 13:42:38

Re: Modelica-Arduino not working in OpenModelica

You'll need to look into that library to see which commands are being run to compile that library automatically in Dymola. If you compile it, I think it might work.

Otherwise, try the Modelica_DeviceDrivers library. It has worked in OpenModelica in the past at least.

Re: Modelica-Arduino not working in OpenModelica

Tank you for your answer sjoelund.se.

Do you mean something like the message [16] from the message browser?
I'll try to complete the code with "each" and see what comes out.

It is important that I can work with the Arduino model, because I need this model to continue working in another model in OpenModelica. In the Modelica_DeviceDrivers library I haven't found an Arduino model yet...

Re: Modelica-Arduino not working in OpenModelica

Modelica_DeviceDrivers.EmbeddedTargets.AVR.Examples.Arduino.UNO.Blink

Re: Modelica-Arduino not working in OpenModelica

Oh, that's what you meant.

I think you have misunderstood my request with the Arduino Uno a little bit or I have expressed myself there probably inaccurately: My goal is to run the Arduino model with different scripts (as one can do that on the real Arduino too). In Dymola I can select the script I want to run on the Arduino in its block parameters.
Soon I have no access to Dymola anymore so I need the same functionality in OpenModelica with the Arduino model there. I had mentioned the "Blink" only as an example, so that I can test the function.

Unfortunately I can't upload a screenshot of my model with the Arduino right now, because an error happens when uploading the image in my post. I hope you can see it here.

In my modelica model I run a script which I created with the Arduino Uno block. For this, the Arduino needs the different analog inputs and digital outputs. Because of this I tried it with the model from Github, since it had worked with this in Dymola everything.

Is there really no chance to simulate a working model in OpenModelica with the library from Github?

Edited by: gela - Mar-12-21 13:30:56

Re: Modelica-Arduino not working in OpenModelica

gela wrote:


Oh, that's what you meant.

I think you have misunderstood my request with the Arduino Uno a little bit or I have expressed myself there probably inaccurately: My goal is to run the Arduino model with different scripts (as one can do that on the real Arduino too). In Dymola I can select the script I want to run on the Arduino in its block parameters.
Soon I have no access to Dymola anymore so I need the same functionality in OpenModelica with the Arduino model there. I had mentioned the "Blink" only as an example, so that I can test the function.

Unfortunately I can't upload a screenshot of my model with the Arduino right now, because an error happens when uploading the image in my post. I hope you can see it here.

In my modelica model I run a script which I created with the Arduino Uno block. For this, the Arduino needs the different analog inputs and digital outputs. Because of this I tried it with the model from Github, since it had worked with this in Dymola everything.

Is there really no chance to simulate a working model in OpenModelica with the library from Github?

In Modelica_DeviceDrivers you can choose which AVR chip to target (but only a few different AVR microcontrollers are available). The Modelica model is what you compile for the Arduino.

As for the CATIA library, it might work. You just need to run some commands manually (look at all the Dymola-specific annotations in the model). Read the documentation and run everything special it is doing manually. For example: When a model that contains the ArduinoUno block is translated the external object is automatically re-built through the preInstantiate=Arduino.Internal.buildSketch(...) directive in its annotation.

There are 0 guests and 0 other users also viewing this topic
You are here: