Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2088 closed defect (fixed)

Mat results get corrupted with variable filters

Reported by: Teemu Lempinen Owned by: Lennart Ochel
Priority: high Milestone: 1.9.0
Component: Run-time Version: trunk
Keywords: Cc:

Description (last modified by Lennart Ochel)

Mat file is corrupted with "A = B" equations, if B is filtered out.

To reproduce the problem, simulate the example model below with

variableFilter=".*[^X]"
model Model
    Real Var3;
    parameter Real Var1 = 1;
    Real Var2X( start=0,  fixed=true);
equation
    Var3 = Var2X;
    der(Var2X) =
        + Var1;
end Model;

The resulting mat file dataInfo block becomes as follows:

int dataInfo(4,4)
2 1 0 -1
2 2 0 -1
1 2 0 0
0 0 0 0

If there are more "A=B" equations, there are more "0 0 0 0" lines.

What I would like is as follows, but I do not know if it is possible:

If there are equations "A=C" and "B=C" and the variable C is filtered out, A or B should become the "primary" variable for .mat file, store the values of C and the other should refer to those values.

The easy way would be to filter A and B out too. At least that way the results would not be distorted. It took me quite a few hours to realize why my relatively large model was giving wrong results for certain parameter variables.

Change History (15)

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

Component: BackendRun-time
Owner: changed from probably noone to Lennart Ochel
Status: newassigned

comment:2 by Lennart Ochel, 12 years ago

Description: modified (diff)

comment:3 by Lennart Ochel, 12 years ago

testsuite/simulation/modelica/others/filterTest.mos (r15337)

in reply to:  description ; comment:4 by Lennart Ochel, 12 years ago

Replying to lempinen:

The easy way would be to filter A and B out too. At least that way the results would not be distorted. It took me quite a few hours to realize why my relatively large model was giving wrong results for certain parameter variables.

I would prefer to not filter C if there are corresponding not-filtered primary variables. I have already implemented it locally. That works for your test model fine but it seems that we have some trouble with alias-indices. I have to check this a bit more.

comment:5 by Lennart Ochel, 12 years ago

Status: assignedaccepted

in reply to:  4 comment:6 by Teemu Lempinen, 12 years ago

Replying to lochel:

Replying to lempinen:

The easy way would be to filter A and B out too. At least that way the results would not be distorted. It took me quite a few hours to realize why my relatively large model was giving wrong results for certain parameter variables.

I would prefer to not filter C if there are corresponding not-filtered primary variables. I have already implemented it locally. That works for your test model fine but it seems that we have some trouble with alias-indices. I have to check this a bit more.

That sounds like a good compromise.

The idea of filtering for me is to reduce the size of results. The size of results does not rise when C is included if the same time series would be stored anyway for A or B. Only name and location information are added.

Thanks for working on this issue so quickly. Hopefully you can solve the issues with alias-indices.

comment:7 by Lennart Ochel, 12 years ago

Resolution: fixed
Status: acceptedclosed

fixed in r15355

comment:8 by Lennart Ochel, 12 years ago

Currently we do not filter parameters at all. Should we filter them also?

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

There's no point in filtering parameters. They take up so little space in the file anyway.

comment:10 by Lennart Ochel, 12 years ago

Yes, for sure. But maybe someone wants to use that filter-feature to reduce the amount of variables inside his constricted plotting-tool.

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

That's not really a valid concern though. If the functionality is requested and motivated you should just add another simflag to also filter parameters.

comment:12 by Lennart Ochel, 12 years ago

Well, then this ticket is done. :-)

comment:13 by Teemu Lempinen, 12 years ago

Last minute note from a user! :)

I'd like to see this behavior documented. Current OpenModelica user documentation states that variable filter filters variables by their names. It does not state that parameters are not filtered.

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

Oh, it's a variable filter. No-where does it say it filters parameters ;)

comment:15 by Teemu Lempinen, 12 years ago

True! How silly of me. Maybe just a small and explicit reminder for people like me, who do not understand what they are reading? :P

Note: See TracTickets for help on using tickets.