Commit 6481930b authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

updates for julia v1.0

parent eac09291
Pipeline #660 failed with stage
in 6 minutes and 9 seconds
## News
2018-12-07: Update to julia v1.0 is ongoing, check branch `julia1`
[![pipeline status](https://gitlab.control.lth.se/processes/LabProcesses.jl/badges/master/pipeline.svg)](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master) [![pipeline status](https://gitlab.control.lth.se/processes/LabProcesses.jl/badges/master/pipeline.svg)](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master)
[![coverage report](https://gitlab.control.lth.se/processes/LabProcesses.jl/badges/master/coverage.svg)](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master) [![coverage report](https://gitlab.control.lth.se/processes/LabProcesses.jl/badges/master/coverage.svg)](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master)
...@@ -37,4 +40,4 @@ och lägga till tre rader som ...@@ -37,4 +40,4 @@ och lägga till tre rader som
När .gitlab-ci.yml uppdateras i master triggas en pipline. Om denna lyckas kommer dokumentationen finnas under När .gitlab-ci.yml uppdateras i master triggas en pipline. Om denna lyckas kommer dokumentationen finnas under
http://processes.gitlab.control.lth.se/documentation/myfoldername/ http://processes.gitlab.control.lth.se/documentation/myfoldername/
\ No newline at end of file
julia 0.6 julia 0.7
ControlSystems ControlSystems
Parameters Parameters
DSP
# __precompile__() # __precompile__()
using Pkg
installed_packages = Pkg.installed() installed_packages = Pkg.installed()
if "LabConnections" keys(installed_packages) if "LabConnections" keys(installed_packages)
Pkg.clone("https://gitlab.control.lth.se/cont-frb/LabConnections.jl") Pkg.clone("https://gitlab.control.lth.se/cont-frb/LabConnections.jl")
...@@ -8,7 +9,7 @@ end ...@@ -8,7 +9,7 @@ end
module LabProcesses module LabProcesses
using ControlSystems, LabConnections.Computer, Parameters using ControlSystems, LabConnections.Computer, Parameters, DSP
include("utilities.jl") include("utilities.jl")
......
using ControlSystems using ControlSystems, DSP
""" """
beammodel, beamcontroller = define_beam_system(;doplot=false) beammodel, beamcontroller = define_beam_system(;doplot=false)
......
...@@ -9,7 +9,7 @@ macro periodically(h, body) ...@@ -9,7 +9,7 @@ macro periodically(h, body)
local start_time = time() local start_time = time()
$(esc(body)) $(esc(body))
local execution_time = time()-start_time local execution_time = time()-start_time
sleep(max(0,$(esc(h))-execution_time)) Libc.systemsleep(max(0,$(esc(h))-execution_time))
end end
end end
...@@ -37,22 +37,22 @@ Create a SysFilter object that can be used to implement control loops and simula ...@@ -37,22 +37,22 @@ Create a SysFilter object that can be used to implement control loops and simula
with LTI systems, i.e., `U(z) = C(z)E(z)`. To filter a signal `u` through the filter, with LTI systems, i.e., `U(z) = C(z)E(z)`. To filter a signal `u` through the filter,
call like `y = Csf(u)`. Calculates the filtered output `y` in `y = Cx+Du, x'=Ax+Bu` call like `y = Csf(u)`. Calculates the filtered output `y` in `y = Cx+Du, x'=Ax+Bu`
""" """
struct SysFilter struct SysFilter{T<:StateSpace}
sys::StateSpace sys::T
state::Vector{Float64} state::Vector{Float64}
function SysFilter(sys::StateSpace, state::AbstractVector) function SysFilter(sys::StateSpace, state::AbstractVector)
@assert !ControlSystems.iscontinuous(sys) "Can not filter using continuous time model." @assert !ControlSystems.iscontinuous(sys) "Can not filter using continuous time model."
@assert length(state) == sys.nx "length(state) != sys.nx" @assert length(state) == sys.nx "length(state) != sys.nx"
new(sys, state) new{typeof(sys)}(sys, state)
end end
function SysFilter(sys::StateSpace) function SysFilter(sys::StateSpace)
@assert !ControlSystems.iscontinuous(sys) "Can not filter using continuous time model. Supply sample time." @assert !ControlSystems.iscontinuous(sys) "Can not filter using continuous time model. Supply sample time."
new(sys, init_sysfilter(sys)) new{typeof(sys)}(sys, init_sysfilter(sys))
end end
function SysFilter(sys::StateSpace, h::Real) function SysFilter(sys::StateSpace, h::Real)
@assert ControlSystems.iscontinuous(sys) "Sample time supplied byt system model is already in discrete time." @assert ControlSystems.iscontinuous(sys) "Sample time supplied byt system model is already in discrete time."
sysd = c2d(sys, h)[1] sysd = c2d(sys, h)[1]
new(sysd, init_sysfilter(sysd)) new{typeof(sysd)}(sysd, init_sysfilter(sysd))
end end
end end
(s::SysFilter)(input) = sysfilter!(s.state, s.sys, input) (s::SysFilter)(input) = sysfilter!(s.state, s.sys, input)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment