Skip to content

Commit

Permalink
Fix tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mforets committed Feb 7, 2019
1 parent 126f436 commit 8ebfd78
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docs/src/lib/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ VaryingInput
```@docs
AbstractMap
IdentityMap
ConstrainedIdentityMap
LinearMap
ConstrainedLinearMap
AffineMap
ConstrainedAffineMap
LinearControlMap
ConstrainedLinearControlMap
AffineControlMap
Expand Down
2 changes: 1 addition & 1 deletion src/maps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ struct AffineControlMap{T, MTA <: AbstractMatrix{T}, MTB <: AbstractMatrix{T}, V
end
statedim(m::AffineControlMap) = size(m.A, 2)
outputdim(m::AffineControlMap) = size(m.A, 1)
inputdim(m::LinearControlMap) = size(m.B, 1)
inputdim(m::AffineControlMap) = size(m.B, 1)
islinear(::AffineControlMap) = false
isaffine(::AffineControlMap) = true
apply(m::AffineControlMap, x, u) = m.A * x + m.B * u + m.c
Expand Down
2 changes: 1 addition & 1 deletion src/outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ continuous system and the output map is a constrained linear control map.
"""
function LinearTimeInvariantSystem(A, B, C, D, X, U)
system = ConstrainedLinearControlContinuousSystem(A, B, X, U)
outputmap = ConstrainedLinearControlMap(C, D, U)
outputmap = ConstrainedLinearControlMap(C, D, X, U)
return SystemWithOutput(system, outputmap)
end

Expand Down
10 changes: 6 additions & 4 deletions test/maps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ end
@testset "Constrained linear control map" begin
A = [1. 1; 1 -1]
B = Matrix([0.5 1.5]')
X = Line([1., -1], 0.)
U = Interval(-1, 1)
m = ConstrainedLinearControlMap(A, B, U)
m = ConstrainedLinearControlMap(A, B, X, U)
@test outputdim(m) == 2
@test islinear(m) && isaffine(m)

# applying the affine map on a vector
x = ones(2)
u = [1/2]
x = ones(2) # (it is not checked that x ∈ X in this library)
u = [1/2] # same for u ∈ U
@test apply(m, x, u) == A*x + B*u
end

Expand All @@ -82,9 +83,10 @@ end
@testset "Constrained affine control map" begin
A = [1. 1; 1 -1]
B = Matrix([0.5 1.5]')
X = Line([1., -1], 0.) # line x = y
c = [0.5, 0.5]
U = Interval(-1, 1)
m = ConstrainedAffineControlMap(A, B, c, U)
m = ConstrainedAffineControlMap(A, B, c, X, U)
@test outputdim(m) == 2
@test !islinear(m) && isaffine(m)

Expand Down

0 comments on commit 8ebfd78

Please sign in to comment.