Opened 12 years ago

Closed 12 years ago

#1983 closed defect (fixed)

Parameter has neither value nor start value, and is fixed

Reported by: Christian Schubert Owned by: Adrian Pop
Priority: normal Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: parameter initialization Cc: Lennart Ochel

Description

Hi,

I always wondered about those strange warnings and created a simple testmodel, which reproduces this error (see attachment)
Basically, if you have

model A
  parameter Integer n = 2;
  parameter Real a[n](each fixed = false);
initial equation
  a = fill(1.0, n);
end A;

you'll get the warning although (from my point of view) everything should be fine.
Morover, the warning is misleading.
Yes, the parameter doesn't have value nor start value. But where does it say it is fixed?
I think that case might even be handled correctly by Lennart's new initilization?

Attachments (1)

ParameterBug.mo (626 bytes ) - added by Christian Schubert 12 years ago.

Download all attachments as: .zip

Change History (11)

by Christian Schubert, 12 years ago

Attachment: ParameterBug.mo added

comment:1 by Adrian Pop, 12 years ago

I've seen this too in some cases. Is a bug.
In some cases even if you have a binding it seems it gives the message.
I'll look into this when time permits.

Cheers,
Adrian Pop/

comment:2 by Christian Schubert, 12 years ago

Is it only the warning that is wrong, or is there a chance of something worse caused by that?

comment:3 by Jens Frenkel, 12 years ago

I guess this task should have a higer prioriti. Because of final parameteres with no binding the backend get in trouble. For example if the final parameter is replaced with its default falue index reduktion will fail sometimes.

comment:4 by Adrian Pop, 12 years ago

As far as I've seen only the warning is wrong.
The bindings do appear in the flat Modelica code.
Also, in some cases:

  • we move the bindings from the parameters into the equation section
  • we instantiate the component without the binding just to get its type

and these might trigger the wrong warning.

Cheers,
Adrian Pop/

comment:5 by Jens Frenkel, 12 years ago

Good to know

we move the bindings from the parameters into the equation section 

I am sure this is not handled in the backend if the parameter keeps fixed=true.

Last edited 12 years ago by Jens Frenkel (previous) (diff)

comment:6 by Jens Frenkel, 12 years ago

For example the model Modelica.Electrical.Spice3.Examples.FourInverters has a binding for

mp1.c1
final parameter Mos1.Mos1Calc c1 = Mos.mosCalcInitEquations(

        p,

        C,

        vp,

        m) "Precalculated parameters"; 

but the binding is neither at the parameter (it is a record) nor in the equation section.

comment:7 by Jens Frenkel, 12 years ago

see also Ticket #1917

comment:8 by Lennart Ochel, 12 years ago

Cc: Lennart Ochel added; lennart removed

comment:9 by Adrian Pop, 12 years ago

Ok. This seems a bit serious.
I'll have a look at it asap.

Cheers,
Adrian Pop/

comment:10 by Adrian Pop, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in revision: r14351 [with additional fixes in r14354, r14355, r14357, r14365, r14366 :)]. The model in this ticket is fixed, but I think there are more left.

Note: See TracTickets for help on using tickets.