﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2022	calculate constant values before first pivoting of dynamic states	Jens Frenkel	Jens Frenkel	"The example PlanarMechanicsForTesting.Examples.SingleTrackWithEngine.mos fails with the following error message

{{{
 0.00000e+000  0.00000e+000  0.00000e+000 

 0.00000e+000 -9.00000e-001  0.00000e+000 

idealWheelRear.v_long

idealWheelFront.v_long

bodyRear.w

assert            | assert  | Error, singular Jacobian for dynamic state selection at time 0.000000
}}}

The selected states are equivalent to dymola and the problem is after analyzing the jacobian for pivoting that the constant parts of the initial system are not calculated before pivoting.

In detail the start value revolute.phi_start of revolute is not propagedet to bodyRear.frame_a.phi and as an result the jacobimatrix is numerical singular in the fist row

{{{
bodyFront.w.DERStateSetJac1.dummyVarStateSetJac1  = 0,0,1
6/6 (1): bodyFront.w.DERStateSetJac1.dummyVarStateSetJac1 = bodyRear.w.DERStateSetJac1.bodyRear.w
$DER.trail.R[2,1].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,-1
8/8 (1): -$DER.trail.R[2,1].DERStateSetJac1.dummyVarStateSetJac1 = bodyFront.w.DERStateSetJac1.dummyVarStateSetJac1 * cos(bodyFront.frame_a.phi)
$DER.trail.R[2,2].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,0
7/7 (1): $DER.trail.R[2,2].DERStateSetJac1.dummyVarStateSetJac1 = (-bodyFront.w.DERStateSetJac1.dummyVarStateSetJac1) * sin(bodyFront.frame_a.phi)
$DER.trail.r0[1].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,0.1
10/10 (1): $DER.trail.r0[1].DERStateSetJac1.dummyVarStateSetJac1 = $DER.trail.R[2,2].DERStateSetJac1.dummyVarStateSetJac1 * trail.r[1] + (-$DER.trail.R[2,1].DERStateSetJac1.dummyVarStateSetJac1) * trail.r[2]
$DER.chassis.R[2,1].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,1
4/4 (1): -$DER.chassis.R[2,1].DERStateSetJac1.dummyVarStateSetJac1 = bodyRear.w.DERStateSetJac1.bodyRear.w * cos(bodyRear.frame_a.phi)
idealWheelFront.v[1].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,0
2/2 (1): idealWheelFront.v[1].DERStateSetJac1.dummyVarStateSetJac1 = idealWheelFront.e0[1] * idealWheelFront.v_long.DERStateSetJac1.idealWheelFront.v_long
$DER.revolute.cylinder.rvisobj[1].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,0.1
11/11 (1): $DER.revolute.cylinder.rvisobj[1].DERStateSetJac1.dummyVarStateSetJac1 + $DER.trail.r0[1].DERStateSetJac1.dummyVarStateSetJac1 = idealWheelFront.v[1].DERStateSetJac1.dummyVarStateSetJac1
$DER.chassis.R[2,2].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,0
1/1 (1): $DER.chassis.R[2,2].DERStateSetJac1.dummyVarStateSetJac1 = (-bodyRear.w.DERStateSetJac1.bodyRear.w) * sin(bodyRear.frame_a.phi)
$DER.chassis.r0[1].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,1
5/5 (1): $DER.chassis.r0[1].DERStateSetJac1.dummyVarStateSetJac1 = $DER.chassis.R[2,2].DERStateSetJac1.dummyVarStateSetJac1 * chassis.r[1] + (-$DER.chassis.R[2,1].DERStateSetJac1.dummyVarStateSetJac1) * chassis.r[2]
bodyRear.v[1].DERStateSetJac1.dummyVarStateSetJac1 = 0,0,0
12/12 (1): bodyRear.v[1].DERStateSetJac1.dummyVarStateSetJac1 + $DER.chassis.r0[1].DERStateSetJac1.dummyVarStateSetJac1 = $DER.revolute.cylinder.rvisobj[1].DERStateSetJac1.dummyVarStateSetJac1
$STATESET1.J[1].DERStateSetJac1.dummyVarStateSetJac1 
13/13 (1): $STATESET1.J[1].DERStateSetJac1.dummyVarStateSetJac1 = bodyRear.v[1].DERStateSetJac1.dummyVarStateSetJac1 - idealWheelRear.e0[1] * idealWheelRear.v_long.DERStateSetJac1.idealWheelRear.v_long
}}}

A simple solution coult be to calculate all constants (for example simplify the initial system and use the simplified parts) before the first pivoting is done. This would also increase the initialization process because actually all bound parameters are calculated twice. Once in boundparameter function and the second one in initialEquations."	enhancement	closed	normal	1.9.2	Backend	trunk	fixed	initialization, pivoting	Lennart Ochel Christian Schubert
