Skip to content
Snippets Groups Projects
Commit f79bf746 authored by Johan Grönqvist's avatar Johan Grönqvist
Browse files

Enable passing rng to random test

parent c163c996
No related branches found
No related tags found
No related merge requests found
......@@ -62,30 +62,34 @@ z = CS.tf("z", dt)
# # Main Test function
# %%
function test(; nx_p = 2, nx_c = 2, ny = 1, nu = 1, margins = [ 1e-4 ], dt = nothing, use_ss = false, use_parameters = false, sznaier_process = false, sznaier_controller = false, n_margins_reltol = n_margins_reltol, n_margins_abstol = n_margins_abstol, assert_margins = [])
function test(; nx_p = 2, nx_c = 2, ny = 1, nu = 1, margins = [ 1e-4 ], dt = nothing, use_ss = false, use_parameters = false, sznaier_process = false, sznaier_controller = false, n_margins_reltol = n_margins_reltol, n_margins_abstol = n_margins_abstol, assert_margins = [], rng = nothing)
if isnothing(rng)
rng = default_rng()
end
if nx_p == 2 && ny == 1 && nu == 1 && sznaier_process
A_p = [0.0 1.0; -1.0689391057472464 2.0689391057472464]
B_p = [0.0; 0.25;;]
C_p = [-0.1402017127970634 0.13560577241391236]
else
A_p = randn(nx_p, nx_p)
B_p = randn(nx_p, nu)
C_p = randn(ny, nx_p)
A_p = randn(rng, nx_p, nx_p)
B_p = randn(rng, nx_p, nu)
C_p = randn(rng, ny, nx_p)
end
if isnothing(nx_c)
K_c = randn(nu, ny)
K_c = randn(rng, nu, ny)
elseif nx_c == 2 && ny == 1 && nu == 1 && sznaier_controller
A_c = [-94.67272273545973 -141.87516089498396; 67.09364298153022 101.22237023851974]
B_c = [876.0675156656737; -548.318385917107;;]
C_c = [553.6177701648987 879.0336573401709]
D_c = [201.22797605005874;;]
else
A_c = randn(nx_c, nx_c)
B_c = randn(nx_c, ny)
C_c = randn(nu, nx_c)
D_c = randn(nu, ny)
A_c = randn(rng, nx_c, nx_c)
B_c = randn(rng, nx_c, ny)
C_c = randn(rng, nu, nx_c)
D_c = randn(rng, nu, ny)
end
if isnothing(nx_c)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment