From 1afed50dc1144776a085ee6c2dce2467817754a1 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Tue, 2 Jul 2024 12:45:28 +0530 Subject: [PATCH] feat: add clock phase Co-authored-by: Fredrik Bagge Carlson --- src/clock.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/clock.jl b/src/clock.jl index ba0b59278..7f391164b 100644 --- a/src/clock.jl +++ b/src/clock.jl @@ -8,6 +8,7 @@ using Expronicon.ADT: @adt, @match Continuous struct PeriodicClock dt::Union{Nothing, Float64, Rational{Int}} + phase::Float64 = 0.0 end SolverStepClock end @@ -25,9 +26,9 @@ using .Clocks The default periodic clock with tick interval `dt`. If `dt` is left unspecified, it will be inferred (if possible). """ -Clock(dt::Union{<:Rational, Float64}) = PeriodicClock(dt) -Clock(dt) = PeriodicClock(convert(Float64, dt)) -Clock() = PeriodicClock(nothing) +Clock(dt::Union{<:Rational, Float64}; phase = 0.0) = PeriodicClock(dt, phase) +Clock(dt; phase = 0.0) = PeriodicClock(convert(Float64, dt), phase) +Clock(; phase = 0.0) = PeriodicClock(nothing, phase) @doc """ SolverStepClock