Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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.

Re: Derivative of function

I am using the OpenModelica 1.5.0 RC3

Re: Derivative of function

Ah. RC3 is from April 22. Jens Frenkel fixed derivative annotations after that release.

Re: Derivative of function

Is there a release after that?

I tried running them from shell and am still getting the same errors. I have been on this for sometime

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.

Re: Derivative of function

So how do I check if it is updated?

Can you suggest a way to get this one working?

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.

Re: Derivative of function

So does that mean I cant run it on this version of OpenModelica??

When is the next release scheduled?

Thank you very much for the continuous support and prompt replies

Re: Derivative of function

The 1.5.0 release should be once the documentation has been updated, hopefully this week.

Re: Derivative of function

Any update on the release of the latest version of OpenModelica? Will it be supporting the media library?

We are waiting..........:-)

Thank you

John

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).

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/

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

There are 0 guests and 0 other users also viewing this topic