Skip to content

Commit

Permalink
modified: CHANGELOG.md
Browse files Browse the repository at this point in the history
	modified:   Project.toml
	modified:   src/AutomationLabsSystems.jl
	modified:   src/main/main_systems.jl
  • Loading branch information
Pierre BLAUD committed Feb 24, 2023
1 parent de66832 commit 1a48df6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# AutomationLabsSystems Changelog

## v0.1.1

* Add system linearization.
* Add model evaluation from a system.
* Improve tests.
## v0.1.0

* Initial public release.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AutomationLabsSystems"
uuid = "6d3dfdf0-e107-48c6-a6ff-eced1a5a9334"
authors = ["Pierre BLAUD <pierre.blaud@ikmail.com> and contributors"]
version = "0.1.0"
version = "0.1.1"

[deps]
AutomationLabsIdentification = "48ff5a6f-d08b-4053-9585-6a9e3e078386"
Expand All @@ -11,6 +11,7 @@ LazySets = "b4f0291d-fe17-52bc-9479-3d1a343d9043"
MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
MLJMultivariateStatsInterface = "1b6a4a23-ba22-4f51-9698-8599985d3728"
MathematicalSystems = "d14a8603-c872-5ed3-9ece-53e0e82e39da"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"

[compat]
AutomationLabsIdentification = "0.2"
Expand All @@ -20,6 +21,7 @@ LazySets = "2"
MLJ = "0.19"
MLJMultivariateStatsInterface = "0.5"
MathematicalSystems = "0.13"
NNlib = "0.8"
julia = "1"

[extras]
Expand Down
4 changes: 4 additions & 0 deletions src/AutomationLabsSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ import MLJMultivariateStatsInterface
import LazySets
import Flux
import ForwardDiff
import NNlib

export proceed_system
export proceed_system_linearization

#export proceed_system_discretization
export proceed_system_model_evaluation

# Load files
include("types/types.jl")
include("sub/design_models.jl")
Expand Down
44 changes: 43 additions & 1 deletion src/main/main_systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function proceed_system_linearization( system::MathematicalSystems.ConstrainedBl
return MathematicalSystems.@system x' = A_sys*x + B_sys*u xsystem.X usystem.U
end

function proceed_system_linearization( system::MathematicalSystems.ConstrainedBlackBoxControlDiscreteSystem,
function proceed_system_linearization(system::MathematicalSystems.ConstrainedBlackBoxControlDiscreteSystem,
state::Vector{Float64},
input::Vector{Float64} )

Expand All @@ -164,5 +164,47 @@ function proceed_system_linearization( system::MathematicalSystems.ConstrainedBl
return MathematicalSystems.@system x⁺ = A_sys*x + B_sys*u xsystem.X usystem.U
end

function proceed_system_linearization(system::MathematicalSystems.ConstrainedLinearControlDiscreteSystem,
state::Vector{Float64},
input::Vector{Float64} )

return system
end

function proceed_system_linearization(system::MathematicalSystems.ConstrainedLinearControlContinuousSystem,
state::Vector{Float64},
input::Vector{Float64} )

return system
end


# to continuous system to discrete system


# Extract model from a system from identification and user function
function proceed_system_model_evaluation(system::MathematicalSystems.ConstrainedBlackBoxControlDiscreteSystem)

if typeof(system.f) == Flux.Chain{Tuple{Flux.Dense{typeof(identity), Matrix{Float32}, Bool}, Flux.Chain{NTuple{4, Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}}}, Flux.Dense{typeof(identity), Matrix{Float32}, Bool}}}
model_type = AutomationLabsIdentification.Fnn()

elseif typeof(system.f) == Flux.Chain{Tuple{AutomationLabsIdentification.DenseIcnn{typeof(identity), Matrix{Float32}, Bool}, Flux.Chain{Tuple{AutomationLabsIdentification.DenseIcnn{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}, AutomationLabsIdentification.DenseIcnn{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}}}, AutomationLabsIdentification.DenseIcnn{typeof(identity), Matrix{Float32}, Bool}}}
model_type = AutomationLabsIdentification.Icnn()

elseif typeof(system.f) == Flux.Chain{Tuple{Flux.Dense{typeof(identity), Matrix{Float32}, Bool}, Flux.Chain{Tuple{Flux.SkipConnection{Flux.Chain{Tuple{Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}}}, typeof(+)}}}, Flux.Dense{typeof(identity), Matrix{Float32}, Bool}}}
model_type = AutomationLabsIdentification.ResNet()

elseif typeof(system.f) == Flux.Chain{Tuple{Flux.Dense{typeof(identity), Matrix{Float32}, Bool}, Flux.Chain{Tuple{Flux.SkipConnection{Flux.Chain{Tuple{Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}}}, typeof(vcat)}}}, Flux.Dense{typeof(identity), Matrix{Float32}, Bool}}}
model_type = AutomationLabsIdentification.DenseNet()

elseif typeof(system.f) == Flux.Chain{Tuple{Flux.Dense{typeof(identity), Matrix{Float32}, Bool}, Flux.Chain{NTuple{4, Flux.SkipConnection{Flux.Parallel{typeof(+), Tuple{Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}, Flux.Chain{Tuple{Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}, Flux.Dense{typeof(NNlib.relu), Matrix{Float32}, Vector{Float32}}}}}}, typeof(+)}}}, Flux.Dense{typeof(identity), Matrix{Float32}, Bool}}}
model_type = AutomationLabsIdentification.PolyNet()

elseif typeof(system.f) == Function
model_type = typeof(system.f)

end


return model_type
end

0 comments on commit 1a48df6

Please sign in to comment.