- Index
- » Users
- » cadourian
- » Profile
Posts
Posts
Hello,
I am trying to use the OMC to generate Modelica code. I am very familiar with the OMC and its API. However, the only way I have found of adding a parameter under a given model or package is to use the following Command string:
"package x parameter Real a; parameter Real b; end x;"
However, this method is very problematic as it requires that all the code listing be inserted.
Is there a better way? Something like addParameter(ParentClass, parameterName)?
Thanks
C. Adourian
Hello,
I am trying to compile all the OpenModelica files on Windows, not just the OMC.
I have already:
1) compiled all of OpenModelica on Linux including all the QT clients
2) Compiled the OMC on Windows using OMDev.
Am I missing some file somewhere in the OpenModelica folders that explains how to complile all the QtClients on Windows or is it not available? If not available, what's the best way to proceed?
Regards
Chahé
If i uncheck the "Group items by Category" I get:
unable to connect to repository http://www.ida.liu.se/~pelab/modelica/O … ontent.xml
Unable to connect to repository http://www.ida.liu.se/~pelab/modelica/O … ontent.xml
Connection refused: connect
I cannot access the file from the browser either. I get "The webpage cannot be found, HTTP 404 not found"
Its possible however that our Proxy is causing the problem. Personnally, I have installed MDT using the ZIp file so I'm ok. I taught there was a problem with the Eclipse link.
Thanks
Hello,
I am trying to install the MDT for eclipse using the following provided URL
LINK #1: http://www.ida.liu.se/~pelab/modelica/O … lica/MDT/.
from page
LINK #2: https://www.openmodelica.org/index.php/ … /tools/133
However, Link #1 redirects me back to Link #2 and eclipse doesn't seem to accept it either.
Is this a broken link?
regards
Chahé
MDT installation URL for Eclipse redirects link back to original page
Hello,
I am using the OMC API to create Modelica code but I am having problems adding annotations that have more than one element.
For example, if I use the updateComponent function like this:
updateComponent(X,Y,Z, annotate=(Dialog(a=2)))
then I will see in the code the following addition to the component: annotation(Dialog(a=2))
However, if I try:
updateComponent(X,Y,Z, annotate=(Dialog(a=2), TEST(a=3)))
then no annotation is added.
Any suggestion as to what the correct syntax is? of another way to update the annotation properly?
Kind regards
Chahé
Hi Adeel,
sorry I missed your post while replying to Adrian.
Here's an example custom annotation:
String a1x annotation(__myTag(Data(name = "<String1>",values= {"<SString1>","<SString2>"})));
Technically, I could get by by storing the same information at the parent class level but then I would have to store information for each parameter all lumped into one big annotation attached to the class itself.
I have modified some of the functions in Interactive.mo to give me the String for component. I'm not sure I have a very robust implementation but its working for now. So this new function together with the updateComponent function gives me both read and write access to custom annotations.
Best Regards
Chahé
Ok. Thanks. I will look into the references you provided.
I am also working on letting OMEdit optionally connect to a remote OMC. Actually, it was very easy to implement given the current OMEdit design.
Are there any others out there working on client/server versions of OMEdit for collaborative design? All these things on annotations I'm asking relate to the same purpose which is to annotate ownership/subscription information to the components and from there enable the client/server OmEdit to work + other custom clients.
Cheers
Chahé
BTW, I suppose you're in Europe and its 3am??
Hi Adrian,
thanks indeed I was using the wrong syntax: annotation= instead of annotate=
its all working perfectly.
Do you know if there is a built in way to get any annotations properly. using getComponentAnnotations and getNthComponentAnnotation I was getting Error where I was expecting the modifications on my custom annotation. Right now I added some functions to the OMC .mo files to get the unparsed annotation but I'll be happier if I knew there is a solution that already works.
BTW, what is the process of contributing our changes back to the OMC? Hopefully them being integrated of course if suitable?
Chahé
Hello,
I've been experimenting with the omc.updatComponent, omc.addComponent functions and trying to set custom annotations on the components. This is not working or I am not using the proper syntax.
so, two questions:
1) is there a way to set custom annotations on a component using the omc API. I'm wondering how OpenModelica sets such information
2) If not, what is the best way to modify the omc to fix this problem?
Kind regards
Chahé
Is there a way to have this printed once the OMC compiles and runs?
Or can I access this buffer from within MetaModelica with a specific command?
Possibly the Print.getString command? Looks like the right command. will try.
Hi,
I am trying to modify the OMC to add some features and I would like to understand how to use the Print.mo set of functions. Specifically, where does the command
Print.printBuf("xz") print its output.
Its not coming out on the console, or the OMShell interface.
anybody have an idea?
Regards
Chahé
Status update:
- the OpenModelica System documentation version 2011-11-25 sections A.5 and B.5 provide the starting point for my problem: how to add a new API to the OMC and what files to modify
Hello,
I am trying to include extra annotations in my Modelica models and trying to query and modify this information using OMC. However, as of the latest OpenModelica relase 1.8, the functions that return annotations like getComponentAnnotations and others do no do so completely.
For example, an annotation containing "Dialog(xyz) " when queried returns "Dialog(error)". The contents are not parsed or understood so they are skipped.
Anyway, what I want to do is the following and I would be grateful for any help as this feature is important for my project and I need to have it working ASAP.
What I want to do is modify the OMC Metamodelica code. Probably create a new function called getComponents2 that acts like the old getComponents function but adds one more item to its returnn list and that is the annotation string. Or better, create a functoin getNthComponentAnnotations2 that returns the full annotation without trying to parse its contents. I have written a parser in Python that handles annotations. So, I just need the annotation string in full.
So, simple question, how to I modify the OMC so as to get the full Annotation string of a component?
Which files should I be modifying, etc.
Also, I am currently getting familiar with the OMC developer documentation available of course.
Best regards
Chahé
Hello,
an update for those that may have the same problem/question:
My initial assumption that the IOR in openmodelica.objid should work was correct. The problem in my case was that the remote machine running the OMC server had two ethernet cards. After some reading, I found out that the IP of one of them ends up encoded in the IOR string. Unfortunately for me, from the client, this IP was not visible hence the failed connections.
So, bottom line. the IOR string in the openmodelica.objid, if it is somehow shared with the client, can be used to establish a corba link with the remote OMC.There are apparently mechanisms in Corba just for that, but for now I have implemented my own Socket based method to share the IOR with all clients.
Cheers
Hello,
I'm experimenting with multiple clients connecting to the OMC for querying and modifying the model. I am running the omc in Corba interactive mode with
"omc +d=interactiveCorba". I was able to establish a connection between the omc server and two local clients using some of the example python code found on this site.
What I want to do is establish a remote connection to the omc server and I'm struggling with the Corba InitRef syntax. Now, before I go on trying to figure this out, I wanted to make sure that the OMC server will support it.
My guess is that it should, but a confirmation would be appreciated.
Also, if somebody knows the right CORBA syntax + code snipped to establish a remote corba interface I would appreciate that. The Corba documentation is rather cryptic and I'm running out of time at this point to figure this out.
Here's what I have as my function to establish the local corba connection (this is a modification of OMC example code). It assumes that the omc server is running and has created an IOR file in a local temporary file at (tempdir + "\\" + "openmodelica.objid").
def initiateCorbaOMCConnection():
"""Establish a local connection to the OMC Corba interface.
Outputs:
omc = omc connection object
"""
host='localhost'
port ='0'
corbaString = "mico-local-orb=corbaloc::%s:%s/" % (host, port)
#print corbaString
orb = CORBA.ORB_init(["-ORBInitRef",corbaString], CORBA.ORB_ID)
# getting the TEMP variable
tempdir = os.environ['TEMP']
omc_objid_file = tempdir + "\\" + "openmodelica.objid"
omc_corba_uri= "file:///" + omc_objid_file
# See if the omc server is running
if os.path.isfile(omc_objid_file):
print "OMC Server is up and running at " + omc_corba_uri + "\n"
else:
raise Exception("OMC Server is down. Please start it! Exiting")
#print "OMC Server is down. Please start it! Exiting \n"
#sys.exit(2)
objid_file=open(omc_objid_file)
ior = objid_file.readline()
objid_file.close()
mico_obj = orb.resolve_initial_references("RootPOA")
# Calling string_to_object
print "URI of the OMC server: " + ior
obj = orb.string_to_object(ior)
omc = obj._narrow(_GlobalIDL.OmcCommunication)
if omc is None:
raise Exception("Failed to connect to OMC Server. Object reference is not an OmcCommunication")
#sys.exit(1)
return omc
Kind regards
Chahé
you're correct. Was this added recently unless I always missed it for some reason.
Ok, I just looked at it. Can't really see parameter values, description, etc.
I wanted a way to navigate the parameter values and change them
Tx
Hi
anybody working on this feature? Ie. provide a tree view of the components of the selected model. i.e. See the instances contained in the model
Thanks
Anybody working on this feature.
We are currently looking into spending some effort adding UI features to OpenModelica for our needs and this is one of them.
How about exporting the AST maybe in XML instead of java objects?
BTW, this is what the python parser looks like, its very concise using pyparsing library. For example to parse the result of getElementsInfo, the parser is just these few lines:
elementRecord = lCurly.suppress() + Suppress("rec(") + delimitedList(eqStatement) + Suppress(")") + rCurly.suppress()
elementRecordList = lCurly.suppress() + ZeroOrMore(delimitedList(elementRecord)) + rCurly.suppress()
This will parse something like the following and create a nested list which is already a step forward
{ rec(elementvisibility=public, elementfile="C:/Work/OpenModelica-Python/MSL32/Modelica/../Modelica/Blocks/package.mo", elementreadonly="writable", elementStartLine=16, elementStartColumn=5, elementEndLine=16, elementEndColumn=35, final=false, replaceable=false, inout="none", elementtype=extends, path=Modelica.Icons.Example) }',
'{ rec(elementvisibility=public, elementfile="C:/Work/OpenModelica-Python/MSL32/Modelica/../Modelica/Blocks/package.mo", elementreadonly="writable", elementStartLine=17, elementStartColumn=5, elementEndLine=18, elementEndColumn=35, final=false, replaceable=false, inout="none", elementtype=component, typename=Modelica.SIunits.Angle, names={driveAngle,"Reference distance to move"}, flow=false, stream=false, variability="parameter", direction="unspecified") }',
'{ rec(elementvisibility=public, elementfile="C:/Work/OpenModelica-Python/MSL32/Modelica/../Modelica/Blocks/package.mo", elementreadonly="writable", elementStartLine=19, elementStartColumn=5, elementEndLine=29, elementEndColumn=18, final=false, replaceable=false, inout="none", elementtype=component, typename=Modelica.Blocks.Continuous.LimPID, names={PI,""}, flow=false, stream=false, variability="unspecified", direction="unspecified") }']
Hello,
I am currently creating python functions to simplify the use of the OMC - Corba - Python interface by
1) Adding parsers to parse function return strings
2) Create more complex functions to manipulate the modelica code
3) etc.
(Side comment: the parsing could probably be done better directly within the OMC source code but I don't want to go there at this point)
Are there other interested users who have developed such functionality, I would be willing to share the code I have and eventually publish this back to OpenModelica users.
Thanks
Chahé
It seems the documentation in OMC-API.pdf is outdated to some extent. The information in the OpenModelica System guide is better and I found the functions I was looking for called:
getExtendsModifierNames
getExtendsModifierValue
However, currently the latest nightly-build Windows version is 9917 and it doesn't yet support this.
On Ubuntu, version 993x seems to have it.
Hello,
I have a model such as the one below with an extends which contains modifiers. How do I get the modifier name.value pairs for it using the OMC API?
I know how to get the name of the inherited class using getNthInheritedClass, but then I need to access its modifiers but the existing modifier access functions don't seem to be dealing with this situation. Am I missing something?
Thanks
Chahe
model A
extends Interfaces.SISO(y(start=y_start));
end A;
Thanks Adeel. I will look into it.
Hello,
I am running Omedit on a ubuntu server. The first user that used OMedit caused the creation of files under:
/tmp/OMEdit/ (example: output.log)
Now, if other users try to run OMEdit, they get an error such that OMEdit cannot write the output.log file which is normal.
Is there an environment variable I can use per user to specify where their temporary folders should be?
Thanks
Chahe
In Omedit 1.7.0, dragging and dropping a model from a custom library into another model produces nothing.
However, if we drag and drop from the Modelica library, everything works fine.
After checking the bug list, I see that this was already addressed in: Requirements [# 1479] OMEdit: allow drag&drop for custom models
Any ideas when this will be implemented?
- Index
- » Users
- » cadourian
- » Profile