Opened 12 years ago

Last modified 6 years ago

#2318 closed defect

Strange tuple in initial equation in Modelica.Blocks.Examples.Filter — at Version 6

Reported by: Peter Aronsson Owned by: Adrian Pop
Priority: normal Milestone: Future
Component: Backend Version: trunk
Keywords: Cc: Willi Braun

Description (last modified by Martin Sjölund)

Modelica.Blocks.Examples.Filter returns this equation in the flat model:

(CriticalDamping.r, {}, {}, {}) = Modelica.Blocks.Continuous.Internal.Filter.roots.lowPass({CriticalDamping.cr[1], CriticalDamping.cr[2], CriticalDamping.cr[3]}, {}, {}, CriticalDamping.f_cut);

Shouldn't this instead be:

(CriticalDamping.r, , , ) = Modelica.Blocks.Continuous.Internal.Filter.roots.lowPass({CriticalDamping.cr[1], CriticalDamping.cr[2], CriticalDamping.cr[3]}, {}, {}, CriticalDamping.f_cut);

Change History (6)

comment:1 by Adrian Pop, 12 years ago

Owner: changed from somebody to Adrian Pop
Status: newassigned

I'll have a look.

comment:2 by Adrian Pop, 12 years ago

Is not strange.
It comes from equation:

        if filterType == Modelica.Blocks.Types.FilterType.LowPass then
          (r, a, b, ku) = Internal.Filter.roots.lowPass(cr, c0, c1, f_cut);

and for component:

        Modelica.Blocks.Continuous.Filter CriticalDamping(
          analogFilter = Modelica.Blocks.Types.AnalogFilter.CriticalDamping, 
          normalized = normalized, 
          init = init, filterType = filterType, 
          order = order, 
          f_cut = f_cut, 
          f_min = 0.8 * f_cut);

filterType is LowPass which means that equation will be selected.

components a, b, ku are arrays of 0 size, which mean they disappear from the DAE.

        parameter Real[na] a(each fixed = false);
        parameter Real[na] b(each fixed = false);
        parameter Real[na] ku(each fixed = false);

I don't know if it would be better to put them as empty instead of {}.

comment:3 by Peter Aronsson, 12 years ago

Priority: highnormal

Yes, I realized that when I wrote the ticket, but wouldn't it be nicer from a backend perspective if those were rewritten to "empty slots" instead, which is standard Modelica? That way, the backend doesn't have to deal with all possible empty arrays that could be in there, e.g.

{}, {{}}, {{{}}}

And the backend still needs to take care of the case


(a,,) = foo(b,c)

, so it would simplify the backend alot.

This is not supercritical for us right now, since I've made a workaround for now, but all attempts at simplifying stuff are good, I think ;-)

Last edited 12 years ago by Peter Aronsson (previous) (diff)

comment:4 by Adrian Pop, 12 years ago

I think that we should actually keep all zero size components and zero size equations/algorithms in the DAE and they can be removed by the back-end.
What do you think about this?

comment:5 by Martin Sjölund, 12 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:6 by Martin Sjölund, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.