Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChebyshevI initializes array in a weird way #797

Closed
modelica-trac-importer opened this issue Jan 14, 2017 · 1 comment
Closed

ChebyshevI initializes array in a weird way #797

modelica-trac-importer opened this issue Jan 14, 2017 · 1 comment
Assignees
Labels
enhancement New feature or enhancement L: Blocks Issue addresses Modelica.Blocks P: lowest Lowest priority issue
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by sjoelund.se on 29 Aug 2012 11:13 UTC
Modelica.Blocks.Continuous.Internal.Filter.base.ChebyshevI has the variable den1, which through some magic gets dimension sizes 0 or 1 and is allocated fine.
It then checks dimension size 0 and if it is, skips initializing the array, in itself fine. But there is one branch that looks like it never gets initialized, and the array is then used.

To make analysis of the function easier, both for human and machine, fill() is better used before the if-statement, i.e.

den1 := fill(1/sinh(fac),size(cr,1));

Maybe then I would not spend 10 minutes trying to figure out why the code actually works...

I also like

den1 := den1*alpha;

more than

if size(cr,1) == 1 then
  den1[1] := den1[1]*alpha;
end if;

Migrated-From: https://trac.modelica.org/Modelica/ticket/797

@modelica-trac-importer modelica-trac-importer added this to the MSL3.2.1 milestone Jan 14, 2017
@modelica-trac-importer modelica-trac-importer added enhancement New feature or enhancement L: Blocks Issue addresses Modelica.Blocks P: lowest Lowest priority issue labels Jan 14, 2017
@modelica-trac-importer
Copy link
Author

Comment by sjoelund.se on 6 Dec 2012 14:07 UTC
Fixed in 4609b00.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement L: Blocks Issue addresses Modelica.Blocks P: lowest Lowest priority issue
Projects
None yet
Development

No branches or pull requests

2 participants