Filomaphitskay Aleksei
Fri, 15 Jan 2010 15:52:40 -0800
2010/1/15 Peter Fritzson <pe...@ida.liu.se> > See Below, > > Peter F > > ------------------------------ > *From:* owner-openmodelicainter...@ida.liu.se [mailto: > owner-openmodelicainter...@ida.liu.se] *On Behalf Of *Filomaphitskay > Aleksei > *Sent:* den 14 januari 2010 19:51 > *To:* OpenModelicaInterest@ida.liu.se > *Subject:* get modifier names or parameters of component > > Hellow, everyone! > > My English is very bad and i have just started knowing with OpenModelica, > therefore don't beat me ). > > I need to make a program with GUI (like Dymola). and i need to make window > with dialog, where user can change value of parameters of components. > > - Use simForge, which has such capabilities > it will be really good, but i can not download source code. i have a "TortoiseSVN 1.6.3, Build 16613 - 32 Bit , 2009/06/20 09:28:19." i follow the instruction from "https://trac.ws.dei.polimi.it/simforge/": you can checkout the trunk version from the URL: https://svn.ws.dei.polimi.it/simforge/trunk<https://svn.ws.dei.polimi.it/simforge/trunk>, with user *guest* and password *guest*. And i get a errors: *OPTIONS of 'https://svn.ws.dei.polimi.it/simforge/trunk': authorization failed:* *Could not authenticate to server: rejected Basic challenge ( https://svn.ws.dei.polimi.it). *That is all. Can maybe somebody to share this source code? * * > > So, I need to get access to parameters of smth. components. More precisely, > can i get a list of possible parameters (for example, Resistor has min, max, > start, stateSelect) using OMC API? > > - Yes you can. Look in the system documentation and the OpenModelica > directory testmodels, > ModelQueryAPIexamples.onb > Yes, i saw the > Example package test model mymodel Modelica.Electrical.Analog.Basic.Resistor r1; Modelica.Electrical.Analog.Basic.Capacitor c1; end mymodel; end test; Command: getNthComponentModification(test.mymodel, 1) Reply: {Code()} Command: setComponentModifierValue(test.mymodel, r1, Code(=2)) Reply: Ok ... Modelica.Electrical.Analog.Basic.Resistor r1=2; ... Command: getNthComponentModification(test.mymodel, 1) Reply: {Code(=2)} Command: setComponentModifierValue(test.mymodel, r1.start, Code(=2)) Reply: Ok ... Modelica.Electrical.Analog.Basic.Resistor r1(start=2)=2; ... Command: setComponentModifierValue(test.mymodel, r1, Code(=Resistor(R=2))) Reply: Ok ... Modelica.Electrical.Analog.Basic.Resistor r1(start=2)=Resistor(R=2); ... Command: getNthComponentModification(test.mymodel, 1) Reply: {Code((start=2)=Resistor(R=2))} Command: setComponentModifierValue(test.mymodel, r1.min, Code(=10)) Reply: Ok ... Modelica.Electrical.Analog.Basic.Resistor r1(start=2, min=10)=Resistor(R=2); ... Command: getComponentModifierNames(test.mymodel, r1) Reply: {start, min} Command: getNthComponentModification(test.mymodel, 1) Reply: {Code((start=2, min=10)=Resistor(R=2))} 17 Command: getComponentModifierValue(test.mymodel, r1) Reply: Resistor(R=2) Command: getComponentModifierValue(test.mymodel, r1.start) Reply: =2 Command: getComponentModifierValue(test.mymodel, r1.min) Reply: =10 Command: setComponentModifierValue(test.mymodel, r1.min, Code(())) Reply: Ok ... Modelica.Electrical.Analog.Basic.Resistor r1(start=2)=Resistor(R=2); ... Command: setComponentModifierValue(test.mymodel, r1, Code(())) Reply: Ok ... Modelica.Electrical.Analog.Basic.Resistor r1(start=2); ... Command: setComponentModifierValue(test.mymodel, r1.start, Code(())) Reply: Ok ... Modelica.Electrical.Analog.Basic.Resistor r1; ... but i mean the next thing: can i get the names of modifiers (for example, it is min, max, start, quantity, stateSelect for Real) whithout watching to OMC Documentaion or System Documentation? i try to sayed that can i get list of all possible modifiers (for example, if the type Real then modifiers it is min, max, start, stateSelect) of component by using only OMC API or somethings means without reading of Descriptions? in front of me the task is lied of enumerated all possible modifiers of components, if they are don't introduce. That is meaned the next: i start the dialog with properties of component and this dialog must represent all possible modifiers like in description > type Real // Note: Defined with Modelica syntax although predefined RealType value; // Accessed without dot-notation parameter StringType quantity = ""; parameter StringType unit = "" "Unit used in equations"; parameter StringType displayUnit = "" "Default display unit"; parameter RealType min=-Inf, max=+Inf; // Inf denotes a large value parameter RealType start = 0; // Initial value parameter BooleanType fixed = true, // default for parameter/constant; = false; // default for other variables parameter RealType nominal; // Nominal value parameter StateSelect stateSelect = StateSelect.default; equation assert(value >= min and value <= max, "Variable value out of limit"); assert(nominal >= min and nominal <= max, "Nominal value out of limit"); end Real; Or it is impossible?