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

Posts

Posts

Feb-22-17 00:18:32
OMC is attempting to use dladdr but that call is not available on Windows

That work around seems to work fine on 32-bit Windows 7. Thanks!

I think I'm missing something obvious, but I don't seem to be able to use types from packages I've imported:

Code:


model ImportExample
  import SI = Modelica.SIunits;

  SI.Temperature T;
  initial equation
    T=2;
  equation
    der(T) = 1-T;
end ImportExample;

Results in:

Code:


omc -s ../ModelExample.mo
Error processing file: ../ModelExample.mo
[/path/to/ModelExample.mo:4:3-4:19:writable] Error: Class SI.Temperature not found in scope ImportExample.
Error: Error occurred while flattening model ImportExample

# Error encountered! Exiting...
# Please check the error message and the flags.

Execution failed!

Feb-17-17 17:48:18
OMC is attempting to use dladdr but that call is not available on Windows

Yeah--we're only allowed to run 32-bit Windows at my work, so I have to use the 32-bit version of OM. I've done a little tracing:

1) The dladdr call is available on *NIX systems (Linux, OS X) but not Windows. The Windows way of performing the same task is GetModuleFilename(). The LibGW32C for Windows project also provides a compatibility layer.
2) OMCompilter/Compiler/runtime/systemimpl.c provides SystemImpl__dladdr(). On MINGW32, it returns two strings: "dladdr failed" and "not available on Windows".
3) OMCompiler/Compiler/Util/System.mo has _dladdr() which calls the function above. dladdr() calls _dladdr().
4) dladdr() is called many places, but in my case, the call appears to be in OMCompiler/Compiler/SimCode/SimCodeMain.mo:runCodegenFunc(). I think the dladdr() function is called when the return value of the passed in func() is not defined.

So now I have a few questions:
1) Why is the conditional compile in #2 only checking MINGW32? Is dladdr available on MINGW64 but not MINGW32?
3) If dladdr isn't available on some platforms, why do we use it as if it's always available (such as in #4)?

Feb-17-17 17:11:13
OMC is attempting to use dladdr but that call is not available on Windows

I'm attempting to use OMC with the C language target on Windows 7 32-bit with OpenModelica1.11.0-32bit. I've also attempted the same procedure with OpenModelica1.12.0-dev-32bit with the same results. When I run omc -s path/to/MyModel.mo, I get the following error:

Code:


dladdr failed: not available on Windows failed
Error processing file: path/to/MyModel.mo
Error: Failed to write to file (not open)
Error: Template error: A template call failed (a call with 0 parameters: dladdr
failed: not available on Windows). One possible reason could be that a template
imported function call failed (which should not happen for functions called from
within template code; templates preserve pure 'match'/non-failing semantics).

# Error encountered! Exiting...
# Please check the error message and the flags.

I'm not sure why OMC is trying to use dladdr on Windows. There is a bug report that also contains this error, but was two months ago--long before the two releases I'm using were released. Anyone else having an issue targeting C on Windows?

Feb-16-17 21:54:22
Looking for OPC documentation that isn't out of date

I was using the C++ as my target code. I didn't realize this generates an executable with entirely different capabilities and command-line options. I tried again using C instead. I didn't have to modify my makefile in any way--it appears that the official documentation is still out of date. I can run my simulation with the -embeddedServer=opc-ua option. Then I can connect with FreeOpcUa Client, subscribe to my variables, and write "true" to the step object to step the simulation along.

Now my problem is that I can't set the command-line option rt=1 or set the realTimeScalingFactor object via OPC since my simulation is running on a Mac. I get a "rt_ext_tp_sync_nanosec not implemented for OSX" error.

I haven't tried non time derivatives but here's a Stack Overflow post with some options.

Feb-14-17 18:51:32
Getting an error saying "initial conditions are not fully specified" for an unknown reason

OK. The parameter keyword didn't matter (still probably, not a bad idea though).

Using initial equations instead of start values fixes the problem, though. Perhaps someone else can explain why this is:

Code:


model SMP
    Real y;
    Real y_dot;
    Real omega_0=5.0;
    Real delta=0.2;
initial equation
    y = 5;
    y_dot = 0;
equation
    y_dot = der(y);
    der(y_dot) + 2.0*delta*omega_0*der(y) + omega_0^2*y = 0;
end SMP;

Feb-14-17 18:45:20
Getting an error saying "initial conditions are not fully specified" for an unknown reason

Are omega_0 and delta actually variables? They kinda look like parameters. What happens when you add the parameter keyword?

I think that you can do this either using OPC-UA or Functional Mock-up Interface (FMI). But there are a few problems:
1) OPC-UA might have two high of latency to use with a sound input. Maybe someone else can can confirm this. Also, the OPC documentation seems to be out of date.
2) If you use FMI, it looks like you have to incorporate the exported code into some other program.

Maybe someone else can list more options.

Feb-14-17 18:36:22
OpenModelica MDT reports OPENMODELICAHOME environment variable is null

Sorry to revive and old thread, but restarting fixed the problem. Thanks.

Feb-14-17 17:58:45
Looking for OPC documentation that isn't out of date

I'm attempting to learn how to use OPC with OM (specifically OPC-UA). From the forums, I've gleaned:

1) Compile with omc, not OMEdit because OMEdit doesn't support OPC yet.
2) When running the compiled simulation, use `-embeddedServer=opc-ua -rt=1`
3) Perhaps you should also use the option, `-clock=RT`

From the official documentation (OpenModelicaSystem.pdf section 6.3.3) I've learned that:
1) OPC isn't supported in the official release of OM and needs to be manually merged in, "To utilize either of the OPC interfaces, the OPC branch needs to be merged to c_runtime."
2) You must modify the generated makefile to include the OPC libraries, "UA Server is linked to the simulation executable by adding -lOPCregistry -lua_server at the end of the compiling script."

From my own experimentation, I've found that:
1) The compiled simulation will give you no errors if you get these options wrong, i.e. a typo such as `-embleddedSerber=opc-uae` won't give an error
2) The instructions in OpenModelicaSystem.pdf section 6.3.3 are wrong. There are no OPCregistry and ua_server libraries. The only library available to be linked in is omopcua (libomopcua.dll in C:\OpenModelica1.11.0-32bit\lib\omc)

I'm guessing that the section on OPC in the official system documentation (under Users->User Documentation) on the OpenModelica web site is out of date (since it references a version built 3 years ago). Is the up-to-date system documentation in another location?

Oct-01-12 22:58:54
OpenModelica MDT reports OPENMODELICAHOME environment variable is null

I'm trying to use OpenModelica MDT in Eclipse. I've noticed the following messages in the console:
OMCSTATUS: Will look for OMC object reference in 'C:\DOCUME~1\watkinsp\LOCALS~1\Temp\\openmodelica.objid.mdt'.
OMCSTATUS: No OMC object reference found, starting server.
OMCSTATUS: Using OPENMODELICAHOME environment variable to find omc-binary
OMCSTATUS: OPENMODELICAHOME environment variable is NULL, trying the PATH variable
OMCSTATUS: Environment variable OPENMODELICAHOME is not set and we could not find: omc.exe in the PATH
OMCSTATUS: Will look for OMC object reference in 'C:\DOCUME~1\watkinsp\LOCALS~1\Temp\\openmodelica.objid.mdt'.
Unable to parse list: Empty list: []

The OPENMODELICAHOME environment variable is reported as NULL, but when I look in Start->Control Panels->System->Advanced->Environment Variables, OPENMODELICAHOME is set to C:\OpenModelica1.9.0\

I'm using Windows XP SP3 (the only OS allowed at my work). Any idea why MDT isn't seeing my environment variable?

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