@@ -139,15 +139,19 @@ where ``\mathbf{K}`` encompasses all the intermediate stages of the deterministi
139139(the first `nx` elements of ``\m athbf{x̂}``):
140140```math
141141\m athbf{K} = \b egin{bmatrix}
142- \m athbf{k}(k+0) \\
143- \m athbf{k}(k+1) \\
142+ \m athbf{k}_{1} (k+0) \\
143+ \m athbf{k}_{2} (k+0) \\
144144 \v dots \\
145- \m athbf{k}(k+H_p-1) \e nd{bmatrix}
145+ \m athbf{k}_{n_o}(k+0) \\
146+ \m athbf{k}_{1}(k+1) \\
147+ \m athbf{k}_{2}(k+1) \\
148+ \v dots \\
149+ \m athbf{k}_{n_o}(k+H_p) \e nd{bmatrix}
146150```
147- and ``\m athbf{k}(k+j)`` includes the deterministic state predictions for the ``n_o``
148- collocation points at the ``j``th stage/interval/finite element (details in Extended Help).
149- The `roots` keyword argument is either `:gaussradau` or `:gausslegendre`, for the roots of
150- the Gauss-Radau or Gauss-Legendre quadrature, respectively.
151+ and ``\m athbf{k}_o (k+j)`` is the deterministic state prediction for the ``o``th collocation
152+ point at the ``j``th stage/interval/finite element (details in Extended Help). The `roots`
153+ keyword argument is either `:gaussradau` or `:gausslegendre`, for the roots of the
154+ Gauss-Radau or Gauss-Legendre quadrature, respectively.
151155
152156This transcription computes the predictions by enforcing the collocation and continuity
153157constraints at the collocation points. It is efficient for highly stiff systems, but
@@ -164,8 +168,9 @@ this transcription method (sparser formulation than [`MultipleShooting`](@ref)).
164168
165169# Extended Help
166170!!! details "Extended Help"
167- See the Extended Help of [`TrapezoidalCollocation`](@ref) to understand why the
168- stochastic states are left out of the ``\m athbf{K}`` vector.
171+ As explained in the Extended Help of [`TrapezoidalCollocation`](@ref), the stochastic
172+ states are left out of the ``\m athbf{K}`` vector since collocation methods required
173+ continuous-time dynamics and the stochastic model is discrete.
169174
170175 The collocation points are located at the roots of orthogonal polynomials, which is
171176 "optimal" for approximating the state trajectories with polynomials of degree ``n_o``.
@@ -1422,7 +1427,7 @@ the deterministic state derivative at the ``n_o`` collocation points and the mod
14221427are computed by:
14231428```math
14241429\b egin{aligned}
1425- \m athbf{s_k}(k+j+1 ) &
1430+ \m athbf{s_k}(k+j) &
14261431 = \m athbf{M_o} \b egin{bmatrix}
14271432 \m athbf{k}_1(k+j) - \m athbf{x_0}(k+j) \\
14281433 \m athbf{k}_2(k+j) - \m athbf{x_0}(k+j) \\
@@ -1435,7 +1440,7 @@ are computed by:
14351440 \m athbf{f}\B ig(\m athbf{k}_{n_o}(k+j), \m athbf{û_0}(k+j), \m athbf{d̂_0}(k+j), \m athbf{p}\B ig) \e nd{bmatrix}
14361441\e nd{aligned}
14371442```
1438- for ``j = 0, 1, ... , H_p-1``, and knowing that the ``\m athbf{k}_i (k+j)`` vectors are
1443+ for ``j = 0, 1, ... , H_p-1``, and knowing that the ``\m athbf{k}_o (k+j)`` vectors are
14391444extracted from the decision variable `Z̃`. The vectors ``\m athbf{x_0}(k+j)`` are the
14401445deterministic state for time ``k+j``, also extracted from `Z̃`. The disturbed input
14411446``\m athbf{û_0}(k+j)`` is defined in [`f̂_input!`](@ref). The defects for the stochastic
@@ -1478,7 +1483,7 @@ function con_nonlinprogeq!(
14781483 x̂0next_Z̃ = @views X̂0_Z̃[(1 + nx̂* (j- 1 )): (nx̂* j)]
14791484 scnext = @views geq[(1 + nx̂_nk* (j- 1 ) ): (nx̂_nk* (j- 1 ) + nx)]
14801485 ssnext = @views geq[(1 + nx̂_nk* (j- 1 ) + nx): (nx̂_nk* (j- 1 ) + nx̂)]
1481- sknext = @views geq[(1 + nx̂_nk* (j- 1 ) + nx̂): (nx̂_nk* j )]
1486+ sk = @views geq[(1 + nx̂_nk* (j- 1 ) + nx̂): (nx̂_nk* j )]
14821487 x0 = @views x̂0[1 : nx]
14831488 x0next_Z̃ = @views x̂0next_Z̃[1 : nx]
14841489 xsnext = @views x̂0next[nx+ 1 : end ]
@@ -1501,7 +1506,7 @@ function con_nonlinprogeq!(
15011506 end
15021507 # TODO : remove the following allocations
15031508 k̇_Z̃ = Mo* Δk
1504- sknext .= @. k̇_Z̃ - k̇
1509+ sk .= @. k̇_Z̃ - k̇
15051510 # ----------------- continuity constraint defects ------------------------------
15061511 scnext .= λo* x0 + Co* k_Z̃ - x0next_Z̃
15071512 end
0 commit comments