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

Visual basic and OM

Visual basic and OM

Hi,

I was hoping to interact with OM compiler from within Excel, via visual basic.

I have a hard time getting interactive with OMC from within VB. (I would like to get compile information interactively).

I tried a few things:
1) Run OMC in interactive (only CORBA still seems to be available) and then communicate:
no joy, I can't find anything useful that allows CORBA use from within VB. The only thing that pops up is VbOrb, but nearly no documentation.

2) Run OMShell and trying to get it's standard output back: have tried to read StdOut directly (via WshShell.Exec.StdOut), redirect it to file, ... . doesn't work.


Is there a way to connect OMC with VB ?
Or alternatively, can I redirect all standard output and errors from OMshell to files?

I know the use of mos files, but OMC terminates when the mos is done, thereby losing all loaded classes. It would be very slow to always have to reload classes if I need some extra info on them.

Any help would be most appreciated.

Regards,

GeertD

Re: Visual basic and OM

You could try using the compiler dll directly the way OMEdit does.
What kind of things do you want the compiler to do? Load models, simulate files?

Re: Visual basic and OM

Yes, basically the client-server command API.
A similar functionality as OMShell but from within Visual Basic.

Can VB connect to an interactive OMC compiler via CORBA ?
Can the old interactive OMC (non CORBA) still be used in latest version of OM? If so, could I connect to this via sockets?

Is there documentation on how to interact directly with the compiler dll ?
Is there a COM wrapper for the compiler?

I found a similar project that connected Excel with Modelica, via Dymola.
I believe Dymola had a COM wrapper, so communication was easier...

Re: Visual basic and OM

I can confirm the interactive (TCP/IP) interface works on Linux. I am not sure about Windows.

Re: Visual basic and OM

I checked out the client-server API in the source code to use the compiler dll as suggested by adrpo.
However, this is way above my head and I guess I would have a hard time getting even a reference to these dll's from within VB.

Are there any easier ways to get interactive with the omc process ?

This thread talks about popen (python ?) and even named pipes:
https://openmodelica.org/forum/default- … -api#p3629

Is this an option to establish a fairly easy communication with the omc process?
How does this works with named pipes?

Could you give any rough example?

There are 0 guests and 0 other users also viewing this topic