Opened 12 years ago

Last modified 11 years ago

#2265 closed enhancement

simplify after replace variable — at Version 1

Reported by: Vitalij Ruge Owned by: probably noone
Priority: normal Milestone: 1.9.0
Component: Backend Version: trunk
Keywords: simplify Cc: Jens Frenkel

Description (last modified by Lennart Ochel)

Simplify missing for der(x1) in

model missingSimplify
  Real x1(start = 1, fixed = true);
  Real x1_dummy;
  Real x2(start = 1);
  Real x3(start = 1);
equation
  x1_dummy = x1;
  der(x1) = sin(x1_dummy)/x1 - sin(x1)/x1; /*  != 0 (don't work) */
  der(x2) = sin(x1)/x1 - sin(x1)/x1; /* = 0 */
  der(x3) = x1_dummy - x1; /*  = 0 */
end missingSimplify;

with der(x2) = der(x1) . So simplify should work for der(x1) too.
Here the C code:

/*
 equation index: 3
 type: SIMPLE_ASSIGN
 
 der(x1) = DIVISION(sin(x1), x1, #SHARED_LITERAL_2(String)#) + DIVISION(-sin(x1), x1, #SHARED_LITERAL_3(String)#)
 */
static void eqFunction_3(DATA *data)
{
  modelica_real tmp0;
  modelica_real tmp1;
  modelica_real tmp2;
  modelica_real tmp3;
  tmp0 = sin($Px1);
  tmp1 = DIVISION(tmp0, $Px1, _OMC_LIT2);
  tmp2 = sin($Px1);
  tmp3 = DIVISION((-tmp2), $Px1, _OMC_LIT3);
  $P$DER$Px1 = (tmp1 + tmp3);
}

Change History (1)

comment:1 by Lennart Ochel, 12 years ago

Cc: Jens Frenkel added
Description: modified (diff)

There is probably no simplify after removing the alias variables?!

Note: See TracTickets for help on using tickets.