﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3556	pseudo loops with function	Vitalij Ruge	somebody	"In the following example
{{{#!modelica
  model A
    function f2
      input Real dx1;
      input Real dx2;
      input Real x1;
      input Real x2;
      output Real y1;
      output Real y2;
    protected 
      Real[2] c = {dx1 + dx2, x1 + x2};
    algorithm 
      y1 := c[1] + c[2];
      y2 := c[2];
    end f2;

    Real x,z,y;
    Real dx = (x-y)/exp(z), dz(start=1) = der(z), dy(start=1.5) = der(y);
  equation 
    (x, z) = f2(dx, dy, x, y);
    dz = x - z;
  end A;
}}}
we have loops of the size 2.
By replace 
{{{#!modelica
Real[2] c = {dx1 + dx2, x1 + x2}; 
}}}
with 
{{{#!modelica
Real c1 = dx1 + dx2, c2 = x1 + x2;
}}}
we get 
{{{#!modelica
	model A2
	  function f2
		input Real dx1;
		input Real dx2;
		input Real x1;
		input Real x2;
		output Real y1;
		output Real y2;
protected 
		Real c1 = dx1 + dx2, c2 = x1 + x2;
	  algorithm 
		y1 := c1 + c2;
		y2 := c2;
	  end f2;

	  Real x,z,y;
	  Real dx = (x-y)/exp(z), dz(start=1) = der(z), dy(start=1.5) = der(y);
	equation 
	  (x, z) = f2(dx, dy, x, y);
	  dz = x - z;
	end A2;
}}}
without loops.
"	defect	new	normal	Future	*unknown*				Willi Braun
