#5226 closed defect (fixed)
Support conditional equations in tearing
Reported by: | Francesco Casella | Owned by: | Willi Braun |
---|---|---|---|
Priority: | critical | Milestone: | 1.14.0 |
Component: | Backend | Version: | |
Keywords: | Cc: | Karim Adbdelhak |
Description
Consider the following model, already discussed in #5206
model NonSatIntEq Real x; Real y; Real usat; Real u; parameter Real y0(fixed = false, start = 8); parameter Real T = 1; parameter Real k = 10; parameter Real uMin = 0; parameter Real uMax = 1; parameter Real y_ref = 8; initial equation der(x) = 0; if u > usat then u = usat + 1; else y = y_ref; end if; equation T * der(x) = usat - x; y = k * x; usat = homotopy(actual = smooth(0, if u > uMax then uMax else if u < uMin then uMin else u), simplified = u); u = y0 - y; end NonSatIntEq;
The back-end could select u
as a tearing variable to solve the initialization problem. Unfortunately, the following warnings are issued
[1] 00:44:12 Scripting Notification The selection of a new tearing variable failed. [2] 00:44:12 Translation Warning Function Tearing.selectTearingVar failed at least once. Use -d=tearingdump or -d=tearingdumpV for more information. [3] 00:44:12 Translation Warning Iteration variables with default zero start attribute in equation system with analytic Jacobian: usat:VARIABLE() .NonSatIntEq type: Real u:VARIABLE() .NonSatIntEq type: Real y:VARIABLE() .NonSatIntEq type: Real x:VARIABLE() .NonSatIntEq type: Real
The transformational debugger shows a system of four implicit equations, but only shows three residuals. Lots of Matrix Singular
messages are issued, and eventually a wrong initial solution (not in steady-state) is accepted at the beginning of the simulation.
If the conditional equation is manually converted to this equation
(if u > usat then u - (usat + 1) else y - y_ref) = 0;
then the tearing is applied successfully and the initialization problem is solved correctly.
Please fix the back-end to process these conditional equations correctly as far as tearing is concerned.
Change History (7)
comment:1 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 6 years ago
Milestone: | 1.13.0 → 1.14.0 |
---|
comment:3 by , 6 years ago
Cc: | added |
---|
Karim, are you or some of your colleagues interested in looking into this issue?
comment:4 by , 6 years ago
It seems like the simplifyIfEquations
module in BackendDAEOptimize
is only used on the simulation DAE and not the initial system. If applied, it should do exactly the transformation from
if u > usat then u = usat + 1; else y = y_ref; end if;
to
(if u > usat then u - (usat + 1) else y - y_ref) = 0;
I am not quite sure where and at what time during the optimization this step should be called. I tried adding "simplifyIfEquations"
to ConfigFlag INIT_OPT_MODULES
in Flags.mo
, which is a viable flag according to omc --help=optmodules
, but i get following error:
"Error: 'simplifyIfEquations' is not a valid optimization module. Please check the flags carefully.
Any suggestions where this configuration has to be added?
comment:5 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Rescheduled to 1.14.0 after 1.13.0 releasee