Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrete-time variables are forced to Float64 #3501

Open
baggepinnen opened this issue Mar 26, 2025 · 0 comments
Open

Discrete-time variables are forced to Float64 #3501

baggepinnen opened this issue Mar 26, 2025 · 0 comments
Labels
bug Something isn't working discrete-time

Comments

@baggepinnen
Copy link
Contributor

The example below creates a discrete-time system with a boolean discrete-time variable, it fails with

julia> prob = DiscreteProblem(sys, [], (0,10))
ERROR: MethodError: no method matching !(::Float64)
function Model(; name)
    @variables begin
        x(t)::Bool = true
    end
    equations = [
        x(k) ~ !x(k-1)
    ]
    DiscreteSystem(equations, t; name)
end

@mtkbuild sys = Model()
prob = DiscreteProblem(sys, [], (0,10))
sol = solve(prob, FunctionMap())
x = sol[sys.x(k+1)]
@test eltype(x) <: Bool
@baggepinnen baggepinnen added bug Something isn't working discrete-time labels Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discrete-time
Projects
None yet
Development

No branches or pull requests

1 participant