@@ -581,33 +581,36 @@ function setmodel!(
581581 nu, ny, Hp, Hc, nϵ = model. nu, model. ny, mpc. Hp, mpc. Hc, mpc. nϵ
582582 setmodel! (mpc. estim, model; kwargs... )
583583 if isnothing (M_Hp) && ! isnothing (Mwt)
584- size (Mwt) == (ny,) || throw (ArgumentError (" Mwt should be a vector of length ny" ))
584+ size (Mwt) == (ny,) || throw (ArgumentError (" Mwt should be a vector of length $ ny" ))
585585 any (x -> x < 0 , Mwt) && throw (ArgumentError (" Mwt values should be nonnegative" ))
586586 for i= 1 : ny* Hp
587587 mpc. M_Hp[i, i] = Mwt[(i- 1 ) % ny + 1 ]
588588 end
589589 elseif ! isnothing (M_Hp)
590- size (M_Hp) == (ny* Hp, ny* Hp) || throw (ArgumentError (" M_Hp size should be (ny*Hp, ny*Hp)" ))
590+ nŶ = ny* Hp
591+ size (M_Hp) == (nŶ, nŶ) || throw (ArgumentError (" M_Hp size should be ($nŶ , $nŶ )" ))
591592 mpc. M_Hp .= to_hermitian (M_Hp)
592593 end
593594 if isnothing (Ñ_Hc) && ! isnothing (Nwt)
594- size (Nwt) == (nu,) || throw (ArgumentError (" Nwt should be a vector of length nu" ))
595+ size (Nwt) == (nu,) || throw (ArgumentError (" Nwt should be a vector of length $ nu" ))
595596 any (x -> x < 0 , Nwt) && throw (ArgumentError (" Nwt values should be nonnegative" ))
596597 for i= 1 : nu* Hc
597598 mpc. Ñ_Hc[i, i] = Nwt[(i- 1 ) % nu + 1 ]
598599 end
599600 elseif ! isnothing (Ñ_Hc)
600- size (Ñ_Hc) == (nu* Hc+ nϵ, nu* Hc+ nϵ) || throw (ArgumentError (" Ñ_Hc size should be (nu*Hc+nϵ, nu*Hc+nϵ)" ))
601+ nΔŨ = nu* Hc+ nϵ
602+ size (Ñ_Hc) == (nΔŨ, nΔŨ) || throw (ArgumentError (" Ñ_Hc size should be ($nΔŨ , $nΔŨ )" ))
601603 mpc. Ñ_Hc .= to_hermitian (Ñ_Hc)
602604 end
603605 if isnothing (L_Hp) && ! isnothing (Lwt)
604- size (Lwt) == (nu,) || throw (ArgumentError (" Lwt should be a vector of length nu" ))
606+ size (Lwt) == (nu,) || throw (ArgumentError (" Lwt should be a vector of length $ nu" ))
605607 any (x -> x < 0 , Lwt) && throw (ArgumentError (" Lwt values should be nonnegative" ))
606608 for i= 1 : nu* Hp
607609 mpc. L_Hp[i, i] = Lwt[(i- 1 ) % nu + 1 ]
608610 end
609611 elseif ! isnothing (L_Hp)
610- size (L_Hp) == (nu* Hp, nu* Hp) || throw (ArgumentError (" L_Hp size should be (nu*Hp, nu*Hp)" ))
612+ nU = nu* Hp
613+ size (L_Hp) == (nU, nU) || throw (ArgumentError (" L_Hp size should be ($nU , $nU )" ))
611614 mpc. L_Hp .= to_hermitian (L_Hp)
612615 end
613616 setmodel_controller! (mpc, x̂op_old, M_Hp, Ñ_Hc, L_Hp)
0 commit comments