-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified: Project.toml modified: src/AutomationLabsSystems.jl modified: src/main/main_systems.jl modified: test/runtests.jl new file: test/system_discretization_test.jl
- Loading branch information
Pierre BLAUD
committed
Mar 2, 2023
1 parent
1a48df6
commit 8704d99
Showing
6 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (c) 2022: Pierre Blaud and contributors | ||
######################################################## | ||
# This Source Code Form is subject to the terms of the # | ||
# Mozilla Public License, v. 2.0. If a copy of the MPL # | ||
# was not distributed with this file, # | ||
# You can obtain one at https://mozilla.org/MPL/2.0/. # | ||
######################################################## | ||
module SystemsLinearizationTest | ||
|
||
using Test | ||
using AutomationLabsSystems | ||
using AutomationLabsIdentification | ||
using MathematicalSystems | ||
using LazySets | ||
using MLJ | ||
using Flux | ||
|
||
@testset "Discretize a linear continuous system" begin | ||
|
||
model_origin = "user" | ||
A = [1 1; 0 0.9] | ||
B = [1; 0.5] | ||
nbr_state = 2 | ||
nbr_input = 1 | ||
|
||
x_cons = [-5.0 5.0; | ||
-5.0 5.0] | ||
|
||
u_cons = [-1.0 1.0] | ||
|
||
sys_c = proceed_system("continuous", model_origin; | ||
A = A, | ||
B = B, | ||
input_constraint = u_cons, | ||
state_constraint = x_cons) | ||
|
||
sample_time = 5.0 | ||
sys_d = proceed_system_discretization(sys_c, sample_time) | ||
|
||
@test typeof(sys_c) == ConstrainedLinearControlContinuousSystem{Float64, Matrix{Float64}, Matrix{Float64}, Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}} | ||
@test typeof(sys_d) == ConstrainedLinearControlDiscreteSystem{Float64, Matrix{Float64}, Matrix{Float64}, Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}} | ||
|
||
@test sys_c.A != sys_d.A | ||
@test sys_c.B != sys_d.B | ||
@test sys_c.X == sys_d.X | ||
@test sys_c.U == sys_d.U | ||
|
||
end | ||
|
||
end |