- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Obtaining the ODE formulation
Obtaining the ODE formulation
Obtaining the ODE formulation
Hi
We are working on an optimization problem and we need to get the ODE form of the equations to be used in the optimization package. I believe that OMC converts the DAE from to ODE for passing it to the inbuilt solver.
Is there any way we can get the ODE form which the OMC passes to its inbuilt solver, 'dassl'? I have read an article which says Dymola can do it. So was wondering if that option is there for OMC
Thank you
John
Re: Obtaining the ODE formulation
Yes. After calling simulate(myModel) or buildModel(myModel), you can open myModel.cpp and see all the source code yourself. The function passed to the DASSL solver is "int functionODE()".
- sjoelund.se
- 1700 Posts
Re: Obtaining the ODE formulation
You could also try dumpXMLDAE(Model) function. This will dump the result of flattening to an xml file.
As far as I know, depending on some flags you can also get the ODE, but I'm not 100% sure.
I don't know if all the info about this function is present in the documentation, but if not let me
know and I'll ask the developer which implemented this functionality.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: Obtaining the ODE formulation
Adrian, We tried
dumpXMLDAE(Final_code)
and we were getting the following error
{"Xml dump error.",""}
but then we tried the
exportDAEtoMatlab(Final_code)
and it worked, but we are not able to get the ODE format...........in the documentation they have not mentioned the parameters for obtaining that. We are able to do DAE to DAE. We need to extract the intermediate ODE/state space before it is fed to the solver
Thank you
John
Re: Obtaining the ODE formulation
adrpo,
Hi adrpo,
I have 2 differential equations and I want to initialize them, can you help me, please
Code:
der(T1) = (q_punto_r_g_sky + q_r_g_gr * (Ta - T1) + q_conv_g * (Ta - T1) - q_cd_g_pv * (T1 - T2) + alfa_fg * G * Ag) * (1 / Cg);
der(T2) = (q_cd_g_pv * (T1 - T2) - q_cd_pv_ted * (T2 - T3) + (tau_fg * alfa_pv - eta) * G * Apv + tau_fg * alfa_eva * G * (Ag - Apv)) * (1 / Cpv);
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Obtaining the ODE formulation