Opened 7 years ago

Closed 6 years ago

#4758 closed defect (fixed)

Issues with equation count in NF

Reported by: Francesco Casella Owned by: Willi Braun
Priority: high Milestone: 2.0.0
Component: Backend Version:
Keywords: Cc:

Description

Please check the FilterWithDifferentiation model with the NF. When checking the model, I get

Modelica.Blocks.Examples.FilterWithDifferentiation has
15 equation(s) and 15 variable(s).

and I can also count 15 equations if I flatten the model. However, when compiling the model the following error is obtained:

Error: Too many equations, over-determined system.
The model has 13 equation(s) and 11 variable(s).
Error: Internal error Transformation Module 
PFPlusExt index Reduction Method Pantelides failed!

As there are some equations involving complex functions, I suspect there is something wrong in how the DAE structure is built in that case.

Change History (4)

comment:1 by Willi Braun, 7 years ago

Component: New InstantiationBackend
Owner: changed from Per Östlund to Willi Braun
Status: newassigned

This seems to be an issue in removeSimpleEquation, since the model is balanced when we enter the Backend. Output dumpdaelow:

Variables (15)
========================================
1: der3.y:VARIABLE(flow=false )  "Connector of Real output signal" type: Real 
2: der3.u:VARIABLE(flow=false )  "Connector of Real input signal" type: Real 
3: der2.y:VARIABLE(flow=false )  "Connector of Real output signal" type: Real 
4: der2.u:VARIABLE(flow=false )  "Connector of Real input signal" type: Real 
5: der1.y:VARIABLE(flow=false )  "Connector of Real output signal" type: Real 
6: der1.u:VARIABLE(flow=false )  "Connector of Real input signal" type: Real 
7: Bessel.uu[3]:VARIABLE(flow=false protected = true )  type: Real  [3]
8: Bessel.uu[2]:VARIABLE(flow=false protected = true )  type: Real  [3]
9: Bessel.uu[1]:VARIABLE(flow=false protected = true )  type: Real  [3]
10: Bessel.x[3]:VARIABLE(flow=false )  "Filter states" type: Real  [3]
11: Bessel.x[2]:VARIABLE(flow=false )  "Filter states" type: Real  [3]
12: Bessel.x[1]:VARIABLE(flow=false )  "Filter states" type: Real  [3]
13: Bessel.y:VARIABLE(flow=false )  "Connector of Real output signal" type: Real 
14: Bessel.u:VARIABLE(flow=false )  "Connector of Real input signal" type: Real 
15: step.y:VARIABLE(flow=false )  "Connector of Real output signal" type: Real 


Equations (15, 15)
========================================
1/1 (1): step.y = Bessel.u   [dynamic]
2/2 (1): Bessel.y = der1.u   [dynamic]
3/3 (1): der1.y = der2.u   [dynamic]
4/4 (1): der2.y = der3.u   [dynamic]
5/5 (1): step.y = step.offset + (if time < step.startTime then 0.0 else step.height)   [dynamic]
6/6 (1): Bessel.uu[1] = Bessel.u / Bessel.u_nominal   [dynamic]
7/7 (1): der(Bessel.x[1]) = Bessel.r[1] * (Bessel.x[1] - Bessel.uu[1])   [dynamic]
8/8 (1): der(Bessel.x[Bessel.nr + 2 - 1]) = Bessel.a[1] * Bessel.x[Bessel.nr + 2 - 1] + Bessel.ku[1] * Bessel.uu[Bessel.nr + 1] -
 Bessel.b[1] * Bessel.x[Bessel.nr + 2]   [dynamic]
9/9 (1): der(Bessel.x[Bessel.nr + 2]) = Bessel.b[1] * Bessel.x[Bessel.nr + 2 - 1] + Bessel.a[1] * Bessel.x[Bessel.nr + 2]   [dyna
mic]
10/10 (1): Bessel.uu[2] = Bessel.x[1]   [dynamic]
11/11 (1): Bessel.uu[Bessel.nr + 1 + 1] = Bessel.x[Bessel.nr + 2]   [dynamic]
12/12 (1): Bessel.y = Bessel.gain * Bessel.u_nominal * Bessel.uu[Bessel.nr + Bessel.na + 1]   [dynamic]
13/13 (1): der1.y = der(der1.u)   [dynamic]
14/14 (1): der2.y = der(der2.u)   [dynamic]
15/15 (1): der3.y = der(der3.u)   [dynamic]

After removeSimpleEquations: optdaedump

########################################
pre-optimization module removeSimpleEquations (simulation)
########################################


unspecified partition
========================================

Variables (11)
========================================
1: der3.y:VARIABLE(flow=false )  "Connector of Real output signal" type: Real
2: der3.u:STATE(1,der3.y)(flow=false )  "Connector of Real input signal" type: Real
3: der2.u:STATE(1,der3.u)(flow=false )  "Connector of Real input signal" type: Real
4: der1.u:STATE(1,der2.u)(flow=false )  "Connector of Real input signal" type: Real
5: Bessel.uu[3]:VARIABLE(flow=false protected = true )  type: Real  [3]
6: Bessel.uu[2]:VARIABLE(flow=false protected = true )  type: Real  [3]
7: Bessel.uu[1]:VARIABLE(flow=false protected = true )  type: Real  [3]
8: Bessel.x[3]:STATE(1)(flow=false )  "Filter states" type: Real  [3]
9: Bessel.x[2]:STATE(1)(flow=false )  "Filter states" type: Real  [3]
10: Bessel.x[1]:STATE(1)(flow=false )  "Filter states" type: Real  [3]
11: step.y:VARIABLE(flow=false )  "Connector of Real output signal" type: Real


Equations (13, 13)
========================================
1/1 (1): der3.y = der(der3.u)   [dynamic]
2/2 (1): der3.u = der(der2.u)   [dynamic]
3/3 (1): der2.u = der(der1.u)   [dynamic]
4/4 (1): der1.u = Bessel.gain * Bessel.u_nominal * Bessel.uu[Bessel.nr + Bessel.na + 1]   [dynamic]
5/5 (1): der(Bessel.x[Bessel.nr + 2]) = Bessel.b[1] * Bessel.x[Bessel.nr + 2 - 1] + Bessel.a[1] * Bessel.x[Bessel.nr + 2]   [dynamic]
6/6 (1): der(Bessel.x[Bessel.nr + 2 - 1]) = Bessel.a[1] * Bessel.x[Bessel.nr + 2 - 1] + Bessel.ku[1] * Bessel.uu[Bessel.nr + 1] - Bessel.b[1] * Bessel.x[Bessel.nr + 2]   [dynamic]
7/7 (1): der(Bessel.x[1]) = Bessel.r[1] * (Bessel.x[1] - Bessel.uu[1])   [dynamic]
8/8 (1): Bessel.uu[1] = step.y / Bessel.u_nominal   [dynamic]
9/9 (1): step.y = step.offset + (if time < step.startTime then 0.0 else step.height)   [dynamic]
10/10 (1): Bessel.uu[1] = Bessel.x[1]   [dynamic]
11/11 (1): Bessel.uu[2] = Bessel.x[1]   [dynamic]
12/12 (1): Bessel.x[2] = Bessel.x[1]   [dynamic]
13/13 (1): Bessel.uu[3] = Bessel.x[3]   [dynamic]

comment:2 by Willi Braun, 7 years ago

When we pass removeSimpleEquations, which can be achieved with --removeSimpleEquations=new | --removeSimpleEquations=none the model fails in the index reduction with some differentiation issue for the equation:

Bessel.y = Bessel.gain * Bessel.u_nominal * Bessel.uu[Bessel.nr + Bessel.na + 1]

this equation looks in the old instantiation:

Bessel.y = Bessel.gain * Bessel.u_nominal * Bessel.uu[3]

The final parameters are also replaced in the old Frontend.

I guess the old removeSimpleEquation module acts also wrong, because it assumes all ASUB expressions have been replaced.

comment:3 by Francesco Casella, 7 years ago

I guess the back-end is currently built on the assumption that all structural parameters are evaluated, right?

Should the NF do that, or should the BE be extended to take care of that?

comment:4 by Francesco Casella, 6 years ago

Resolution: fixed
Status: assignedclosed

The model now simulates and verifies correctly.

Note: See TracTickets for help on using tickets.