- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Derivative of function
Derivative of function
Derivative of function
Hi,
I am trying to find the derivative of the function. I have used the annotation that enables the derivative property of the function. As an example I tried the following code (given to me by the openModelica support)
function my_abs annotation(derivative=my_abs_der);
input Real r;
output Real out = abs(r);
end my_abs;
function my_abs_der
input Real r;
input Real der_r;
output Real out;
algorithm
out := abs(r)*der_r;
end my_abs_der;
class M
Real r = my_abs(15.0*time);
Real der_r = der(r);
end M;
I am getting the following error in SimForge
{"",""}
"Error: The language feature differentiation of function my_abs is not supported. Suggested workaround: no suggestion
Error: Derivative of expression my_abs(15.0 * time) is non-existent
Error: Model is structurally singular, error found sorting equations r = my_abs(15.0 * time); for variables "
Please give some suggestions
Thank you
John
Re: Derivative of function
What version of OpenModelica are you using? The code runs fine in the trunk.
- sjoelund.se
- 1700 Posts
Re: Derivative of function
Ah. RC3 is from April 22. Jens Frenkel fixed derivative annotations after that release.
- sjoelund.se
- 1700 Posts
Re: Derivative of function
There is no Windows binary release after RC3 (the Linux one is from May14 though).
The source in the subversion trunk is always up to date.
- sjoelund.se
- 1700 Posts
Re: Derivative of function
https://openmodelica.org/index.php/deve … ource-code - check out a version and read the instructions on how to compile it (README-OMDev-MINGW.txt). Or wait a few days and hope Adrian has pushed a new OpenModelica release.
- sjoelund.se
- 1700 Posts
Re: Derivative of function
The 1.5.0 release should be once the documentation has been updated, hopefully this week.
- sjoelund.se
- 1700 Posts
Re: Derivative of function
Not much support for Modelica.Media (that is to say: nothing works). This release is more focused on Modelica.Mechanics.MultiBody (which flattens code but can not yet simulate all models).
- sjoelund.se
- 1700 Posts
Re: Derivative of function
The derivative annotations for a function now works.
As far as I know (from Jens Frenkel) some of the MultiBody models (Pendulum, DoublePendulum) now actually simulate.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: Derivative of function
So the support for the function derivatives will be added in the new release or is it already supported in RC3?
When can we expect the new release? I am working on some projects and want to plan the deadlines based on this.
Thank you
John
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Derivative of function