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

Error when requiring derivative of function mod()

Error when requiring derivative of function mod()

Hi,

I have an equation set where the derivative of a variable is computed which contains a modulo function.

test program:

model modtest
Real f,x,y;

equation
    x = sin(time);
    y = mod(x,3.14);
    f = der(y);

  annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})), Diagram(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})));
end modtest;

I am getting the error message:

Error: Internal error
Differentiate.differentiateEquationTime failed for y = mod(x, 3.14)


I use Openmodelica 1.9.1 beta2.

Is this a known error and can I circumvent it anyhow?

Regards,
Horst

Re: Error when requiring derivative of function mod()

Well, the modulo function is a discrete function that even triggers events when the output changes. Since it is not a continuous function, you can not take the derivative of such a signal. Use der(x) instead - it is continuous and nice.

Re: Error when requiring derivative of function mod()

The complete error message is:

[:0:0-0:0] Error: Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!
[:0:0-0:0] Error: Internal error - IndexReduction.pantelidesIndexReduction failed!
[:0:0-0:0] Error: Internal error - IndexReduction.pantelidesIndexReduction1 failed! Use +d=bltdump to get more information.
[D:\Projects\Modelica\modtest.mo:5:3-5:19] Error: Internal error
Differentiate.differentiateEquationTime failed for y = mod(x, 3.14)

Re: Error when requiring derivative of function mod()

ok, thanks

Horst

There are 0 guests and 0 other users also viewing this topic
You are here: