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
  • Index
  • » Users
  • » Ricupero
  • » Profile

Posts

Posts

Hi,

I was having some issues trying to use the Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level and Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM components in a custom model.
So I decided to try simulating it with a simpler setup, and I noticed the example MultiPhaseTwoLevel_RL. I can simulate it correctly if I don't change the model parameters.
But if I change the PWM frequency parameter f to 10000 Hz (default is 1000 Hz), simulation gets stuck at time 0.0584.

I'm attaching the simulation log, with the -lv=LOG_EVENTS,LOG_SOLVER,LOG_STATS.
MultiPhaseTwoLevel-RL.log

I'm not sure if it's worth noting that the last simulation step (before it gets stuck) shows a state event at time 0.0584, which should be at same time event 0.0584.

I'm using OpenModelica v1.14.0 (64-bit) on a Windows 10 PC.

Any help or suggestions would be very appreciated.

Regards
Leonardo

Mar-12-18 08:28:28
Calling from default library directory make the simulation fail on start

Yes, definitely it must be something with the PATH. But how to check? I have tried to run the compiled executable from within OMEdit, opening the terminal from there so it could load all the PATH. No output shown in the console (it crashes on startup). On the other hand, if I do the same with the working executable, an output is shown in the console:

Code:


stdout            | info    | The initialization finished successfully without homotopy method.
stdout            | info    | The simulation finished successfully.

Do you have some suggestions on how can I check this?

Mar-11-18 11:02:42
Calling from default library directory make the simulation fail on start

Hi everyone,
this is my first post on this forum! I'm a Modelica newbie, so please forgive me if I hit a very simple issue.
Basically, I tried to compile a simple DLL using mingw64 on my Windows 10 machine, then I created this very basic model:

Code:

model test_dll

  function my_sum
      input Real a;
      input Real b;
      output Real result;
    external "C" annotation(Library="libtest_om");
  end my_sum;
 
  Real result;
  parameter Real a = 1;
  parameter Real b = 2;
equation
  result = my_sum(a, b);
end test_dll;

It calls the my_sum external function from the libtest_om.dll library. The content of the library is just the function my_sum:

Code:


double my_sum(double a, double b)
{
    double res;
    res = a + b;
    return res;
}

And the DLL itself is located in the path <workdir>/Resources/Library folder.
When I launch the simulation like this, it builds ok, but it fails at startup:
https://ibb.co/gH6zhn

Now, after several failed attempts, I tried to follow the examples of the Modelica Guide, and I tried to put my dll in the <workdir> path. I modified the model as follows:

Code:


model test_dll
  function my_sum
      input Real a;
      input Real b;
      output Real result;
    external "C" annotation(Library="libtest_om", LibraryDirectory="modelica://test_dll");
  end my_sum;
 
  Real result;
  parameter Real a = 1;
  parameter Real b = 2;
equation
  result = my_sum(a, b);
end test_dll;

and now it works fine!
https://ibb.co/fS8ta7

So, the question is: do you know if there is something that I'm missing when trying to link my external function in a directory that is different from the working directory?

Thank you

  • Index
  • » Users
  • » Ricupero
  • » Profile
You are here: