Skip to content

Issue with alias_elimination #963

Closed
Closed
@tshort

Description

@tshort

I suspect there's an issue with alias_elimination in the following example. The reduced set of equations doesn't seem right.

using ModelingToolkit

@parameters t
const D = Differential(t)
@variables v47(t) v57(t) v66(t) v25(t) i74(t) i75(t) i64(t) i71(t) v1(t) v2(t)

eq = [
 v47 ~ v1
 v47 ~ sin(376.99111843077515t)
 v57 ~ v1 - v2
 v57 ~ 10.0i64
 v66 ~ v2
 v66 ~ 5.0i74
 v25 ~ v2
 i75 ~ 0.005 * D(v25)
 0 ~ i74 + i75 - i64
 0 ~ i64 + i71]


sys0 = ODESystem(eq, t)
sys = initialize_system_structure(alias_elimination(sys0))

The equations look right for sys0:

julia> equations(sys0)
10-element Array{Equation,1}:
 v47(t) ~ v1(t)
 v47(t) ~ sin(376.99111843077515t)
 v57(t) ~ v1(t) - v2(t)
 v57(t) ~ 10.0i64(t)
 v66(t) ~ v2(t)
 v66(t) ~ 5.0i74(t)
 v25(t) ~ v2(t)
 i75(t) ~ 0.005Differential(t)(v25(t))
 0 ~ i74(t) + i75(t) - i64(t)
 0 ~ i64(t) + i71(t)

But, after alias_elimination, the system becomes disconnected. In the following equations, v47 is only used in the first equation.

julia> equations(sys)
4-element Array{Equation,1}:
 0 ~ sin(376.99111843077515t) - v47(t)
 0 ~ 5i74(t) - v2(t)
 0 ~ v2(t) - v25(t)
 0 ~ 0.005Differential(t)(v25(t))

To test for a modeling error, I got a version of this to work in TinyModia. (That doesn't fully rule out user error here.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions