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
  • » Roman
  • » Profile

Posts

Posts

If ComputeHeat.c is in the same folder as the containing model you can use:

Code:

modelica://CurrentModelName/ComputeHeat.c

I made a custom Modelica Library the other day wich contains code written in c/c++. That code is being compiled by clang to a .dll and .a (openmodelica 1.17).

The Librarys file tree now looks like this:

Code:

MyLib

│   package.mo

├───SomeFolder
│       SomeModel.mo
│       SomeOtherModel.mo
│       package.mo
│       package.order

└───Resources
    ├───Include
    │       SomeModelHeader.h
    │       SomeOtherModelHeader.h
    │
    └───Library
        └───mingw64
                libSomeLibrary.dll.a
                SomeLibrary.dll

The library functions are accessed via ExternalObject / extern "C"

Code:

within MyLib.SomeFolder;

type SomeModel
  extends ExternalObject;
  function constructor "Instantiate Classes and allocate Memory"
    output SomeModel someModel;
    external "C" someModel = initSomeModel()
    annotation(
      Library = "SomeLibrary",
      Include = "#include \"SomeModelHeader.h\"");
  end constructor;
  function destructor "Release Class instances and Memory"
    input  SomeModel someModel;
    external "C" closeSomeModel(someModel);
  end destructor;
end SomeModel;

When i compile a model using this, the simulation process crashes, because it's not able to find SomeLibrary.dll.
If i manually copy the dll to c:\Users\myUserAppData\Local\Temp\OpenModelica\OMEdit\MyModel simulation works as expected.

Questions:
- Is it possible to add the Resources/Library/mingw64 to the dll search path for the simulation executable
- Is it possible to force openmodellica to do static linking, which would avoid the previous issue.

The Libraries shipped with openmodelica use __iti_dll/__iti_dllNoExport in 'external "C"', but the usage is not documented.

Any hints welcome!

Jan-15-21 07:54:48
Scaling of single variables in plots, eg a Boolean with plot values 0 and 1 e.g. cannot be...

Hello!

Imagine the following SImulation Results

Boolean myBool, with values 0 and 1, e.G. from a switch or thyristor or similar.
Voltage myVoltage, with values 0..400A

On that plot you can hardly see the Boolean. Is there a way to scale boolean values or put them on a second y axis?

Unfortunately uploading images to the forum seems to be broken, gives "0 Class 'JvitalsHelper' not found "

Thanks & Regards,
Roman

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