Open
Description
maybe related to #38, not sure.
if x < 0
y = sqrt(-x)
else
y = sqrt(x)
end
There are a collection of these type branches in my model (including nested). In MATLAB, the solver is able to handle this, but MTK currently cannot and modelingtoolkitize
will fail.
I started working on a macro but I didn't know how to handle the original case all that well. It handles the very most basic case but nothing more.
function _toifelse(ex::Expr)
args = map(_toifelse, ex.args)
ex.head == :if ? Expr(:call, :ifelse, args...) : Expr(ex.head, args...)
end
_toifelse(x) = x
macro ifelse(ex)
_toifelse(ex)
end
Metadata
Metadata
Assignees
Labels
No labels