OpenModelica calls using Corba + Cygwin gc++/python + Mico ---------------------------------------------------------- Adrian Pop, adrpo@ida.liu.se, 2006-01-28 OMC calling using MICO-CORBA and Cygwin g++ For an image with the actual happening see: calling-OMC-using-corba-mico-cygwin.JPG - beware that in the image the simulate(BouncingBall) command is missing. Start the OMC server: - NOTE: you can do this by starting the OMC shell which runs OMC in the background - Otherwise you can start OMC server from the command prompt: + start a command prompt in windows Start->Run->cmd.exe + go to OpenModelica131 directory: c:\OpenModelica + type omc +d=interactiveCorba Compile the corbacomm.cpp file: - take the omc-corba-mico-cygwin-python.zip - unpack to someplace (let's say your cygwin home directory) - start your cygwin terminal - cd corbacomm (if you unpacked it in your cygwin /home/your_name/corbacomm) - use this command: adrpo@kafka ~/dev/corbacomm $ g++ corbacomm.cpp -o corbacomm -Imico/include -Lmico/lib omc_communication.o -lmico - now you should have the corbacomm.exe, use it like below. - NOTE: on your computer the URI is different, unless your user name is "adrpo" :) - in general in Cygwin you have /cygdrive/c/ that points to your windows c: drive - use your cygwin shell and type: /cgydrive/c/D and you get your windows Documents and Settings directory. - now instead of "adrpo" you should have your user name, followed by Local Settings/Temp/openmodelica.objid adrpo@kafka ~/dev/corbacomm $ corbacomm.exe file:///cygdrive/c/Documents\ and\ Settings/adrpo/Local\ Settings/Temp/openmodelica.objid "loadFileInteractive(\"c:/OpenModelica131/testmodels/BouncingBall.mo\")" res={BouncingBall} adrpo@kafka ~/dev/corbacomm $ corbacomm.exe file:///cygdrive/c/Documents\ and\ Settings/adrpo/Local\ Settings/Temp/openmodelica.objid "simulate(BouncingBall)" res=record resultFile = "BouncingBall_res.plt" end record adrpo@kafka ~/dev/corbacomm $ corbacomm.exe file:///cygdrive/c/Documents\ and\ Settings/adrpo/Local\ Settings/Temp/openmodelica.objid "plot(h)" res=true Alternatively, you can edit the corbacomm.cpp and give the string file:///cygdrive/c/Documents.... directly there. Also you can make it so that it send commands from cpp rather than command line. I did also a python script for Cygwin Python that runs corbacomm.exe This one also checks if the server is running! Cool! Enjoy and report bugs! Adrian Pop/