Utils references

Root finding

These methods find the minimum positive root of a linear and quadratic equations for order 1 and 2 respectively. For order 3, similar methods should be added to solve the cubic equation.

QuantizedSystemSolver.minPosRootMethod
minPosRoot(c::Float64,b::Float64, ::Val{1})

Finds the minimum positive root for a linear equation represented by the coefficients.

Returns

  • The minimum positive root of the linear equation.
source
QuantizedSystemSolver.minPosRootMethod
minPosRoot(c::Float64,b::Float64,a::Float64,::Val{2})

Finds the minimum positive root for a quadratic equation represented by the coefficients.

Returns

  • The minimum positive root of the quadratic equation.
source
QuantizedSystemSolver.minPosRootMethod
minPosRoot(coeff::Taylor0, ::Val{1})

Finds the minimum positive root for a linear equation represented by the Taylor series coefficients.

Arguments

  • coeff::Taylor0: The Taylor series coefficients of the linear equation.
  • ::Val{1}: A type parameter indicating the order.

Returns

  • The minimum positive root of the linear equation.
source
QuantizedSystemSolver.minPosRootMethod
minPosRoot(coeff::Taylor0, ::Val{2})

Finds the minimum positive root for a quadratic equation represented by the Taylor series coefficients.

Arguments

  • coeff::Taylor0: The Taylor series coefficients of the quadratic equation.
  • ::Val{2}: A type parameter indicating the order.

Returns

  • The minimum positive root of the quadratic equation.
source

Scheduler

The scheduler component retrieves the next index (a state change or an event) for processing. It determines the next action by comparing three types of timing events: state updates, events, and input updates. It initializes minimum time variables for each action type to infinity and iterates through the provided vectors to find the minimum times and their corresponding indices. Based on these comparisons, it decides whether the next scheduled action is an input update, an event, or a state update. If no valid actions are found (indicated by a zero index), the function assigns a default state indicating the next action is a state update at time infinity. Finally, it returns a tuple containing the index of the next action, its time, and a symbol representing the type of action to take next (:STINPUT, :STEVENT, or :STSTATE). This structure ensures that the simulation progresses accurately and efficiently.

QuantizedSystemSolver.updateSchedulerMethod
updateScheduler(::Val{T}, nextStateTime::Vector{Float64}, nextEventTime::MVector{Z,Float64}, nextInputTime::Vector{Float64}) where {T, Z}

Updates the scheduler by finding the minimum times among state, event, and input transitions.

Arguments

  • ::Val{T}: A type parameter indicating the number of state transitions.
  • nextStateTime::Vector{Float64}: A vector of times for the next state transitions.
  • nextEventTime::MVector{Z,Float64}: A mutable vector of times for the next event transitions.
  • nextInputTime::Vector{Float64}: A vector of times for the next input transitions.

Returns

  • A tuple containing the minimum (state index,state time), (event index, event tim, or (input index, input time).
source