4 files + 9 − 9 Inline Compare changes Side-by-side Inline Show whitespace changes Files 4 README.md +1 −1 Original line number Diff line number Diff line ## News 2018-12-07: Update to julia v1.0 is ongoing, check branch `julia1` 2018-12-07: Updated to julia v1.0, see commit eac09291 for last julia v0.6 version [](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master) [](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master) Loading src/LabProcesses.jl +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ end module LabProcesses using ControlSystems, LabConnections.Computer, Parameters, DSP using ControlSystems, LabConnections.Computer, Parameters, DSP, LinearAlgebra include("utilities.jl") Loading src/controllers.jl +4 −4 Original line number Diff line number Diff line Loading @@ -27,16 +27,16 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10 rf = sysFF == nothing ? r[:,i] : Gff(r[:,i]) e = rf-y[:,i] ui = Gfb(e) ui + bias(P) ui .+ bias(P) end simulation = isa(P, SimulatedProcess) initialize(P) for (i,t) = enumerate(0:h:duration) @periodically h simulation begin y[:,i] = measure(P) r[:,i] = reference(t) u[:,i] = calc_control(i) # y,r must be updated before u y[:,i] .= measure(P) r[:,i] .= reference(t) u[:,i] .= calc_control(i) # y,r must be updated before u control(P, [clamp.(u[j,i], inputrange(P)[j]...) for j=1:nu]) end end Loading src/interface_implementations/ballandbeam.jl +3 −3 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ const beam_system, nice_beam_controller = define_beam_system() struct BeamSimulator <: SimulatedProcess h::Float64 s::SysFilter BeamSimulator(;h::Real = 0.01) = new(Float64(h), SysFilter(beam_system, h)) BeamSimulator(;h::Real = 0.01, bias=0) = new(Float64(h), SysFilter(beam_system, h)) end struct BallAndBeam <: PhysicalProcess Loading Loading @@ -96,7 +96,7 @@ bias(p::BallAndBeamSimulator) = 0 function control(p::AbstractBeamOrBallAndBeam, u::AbstractArray) length(u) == 1 || error("Process $(typeof(p)) only accepts one control signal, tried to send u=$u.") send(p.control,u[1]) control(p,u[1]) end control(p::AbstractBeamOrBallAndBeam, u::Number) = send(p.control,u) control(p::BeamSimulator, u::Number) = p.s(u) Loading @@ -104,7 +104,7 @@ control(p::BallAndBeamSimulator, u::Number) = error("Not yet implemented") measure(p::Beam) = read(p.measure) measure(p::BallAndBeam) = [read(p.measure1), read(p.measure2)] measure(p::BeamSimulator) = vecdot(p.s.sys.C,p.s.state) measure(p::BeamSimulator) = dot(p.s.sys.C,p.s.state) measure(p::BallAndBeamSimulator) = error("Not yet implemented") Loading
README.md +1 −1 Original line number Diff line number Diff line ## News 2018-12-07: Update to julia v1.0 is ongoing, check branch `julia1` 2018-12-07: Updated to julia v1.0, see commit eac09291 for last julia v0.6 version [](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master) [](https://gitlab.control.lth.se/processes/LabProcesses.jl/commits/master) Loading
src/LabProcesses.jl +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ end module LabProcesses using ControlSystems, LabConnections.Computer, Parameters, DSP using ControlSystems, LabConnections.Computer, Parameters, DSP, LinearAlgebra include("utilities.jl") Loading
src/controllers.jl +4 −4 Original line number Diff line number Diff line Loading @@ -27,16 +27,16 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10 rf = sysFF == nothing ? r[:,i] : Gff(r[:,i]) e = rf-y[:,i] ui = Gfb(e) ui + bias(P) ui .+ bias(P) end simulation = isa(P, SimulatedProcess) initialize(P) for (i,t) = enumerate(0:h:duration) @periodically h simulation begin y[:,i] = measure(P) r[:,i] = reference(t) u[:,i] = calc_control(i) # y,r must be updated before u y[:,i] .= measure(P) r[:,i] .= reference(t) u[:,i] .= calc_control(i) # y,r must be updated before u control(P, [clamp.(u[j,i], inputrange(P)[j]...) for j=1:nu]) end end Loading
src/interface_implementations/ballandbeam.jl +3 −3 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ const beam_system, nice_beam_controller = define_beam_system() struct BeamSimulator <: SimulatedProcess h::Float64 s::SysFilter BeamSimulator(;h::Real = 0.01) = new(Float64(h), SysFilter(beam_system, h)) BeamSimulator(;h::Real = 0.01, bias=0) = new(Float64(h), SysFilter(beam_system, h)) end struct BallAndBeam <: PhysicalProcess Loading Loading @@ -96,7 +96,7 @@ bias(p::BallAndBeamSimulator) = 0 function control(p::AbstractBeamOrBallAndBeam, u::AbstractArray) length(u) == 1 || error("Process $(typeof(p)) only accepts one control signal, tried to send u=$u.") send(p.control,u[1]) control(p,u[1]) end control(p::AbstractBeamOrBallAndBeam, u::Number) = send(p.control,u) control(p::BeamSimulator, u::Number) = p.s(u) Loading @@ -104,7 +104,7 @@ control(p::BallAndBeamSimulator, u::Number) = error("Not yet implemented") measure(p::Beam) = read(p.measure) measure(p::BallAndBeam) = [read(p.measure1), read(p.measure2)] measure(p::BeamSimulator) = vecdot(p.s.sys.C,p.s.state) measure(p::BeamSimulator) = dot(p.s.sys.C,p.s.state) measure(p::BallAndBeamSimulator) = error("Not yet implemented") Loading