Skip to content
Snippets Groups Projects

Julia1

Merged Fredrik Bagge Carlson requested to merge julia1 into master
3 files
+ 8
8
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -48,7 +48,7 @@ const beam_system, nice_beam_controller = define_beam_system()
@@ -48,7 +48,7 @@ const beam_system, nice_beam_controller = define_beam_system()
struct BeamSimulator <: SimulatedProcess
struct BeamSimulator <: SimulatedProcess
h::Float64
h::Float64
s::SysFilter
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
end
struct BallAndBeam <: PhysicalProcess
struct BallAndBeam <: PhysicalProcess
@@ -96,7 +96,7 @@ bias(p::BallAndBeamSimulator) = 0
@@ -96,7 +96,7 @@ bias(p::BallAndBeamSimulator) = 0
function control(p::AbstractBeamOrBallAndBeam, u::AbstractArray)
function control(p::AbstractBeamOrBallAndBeam, u::AbstractArray)
length(u) == 1 || error("Process $(typeof(p)) only accepts one control signal, tried to send u=$u.")
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
end
control(p::AbstractBeamOrBallAndBeam, u::Number) = send(p.control,u)
control(p::AbstractBeamOrBallAndBeam, u::Number) = send(p.control,u)
control(p::BeamSimulator, u::Number) = p.s(u)
control(p::BeamSimulator, u::Number) = p.s(u)
@@ -104,7 +104,7 @@ control(p::BallAndBeamSimulator, u::Number) = error("Not yet implemented")
@@ -104,7 +104,7 @@ control(p::BallAndBeamSimulator, u::Number) = error("Not yet implemented")
measure(p::Beam) = read(p.measure)
measure(p::Beam) = read(p.measure)
measure(p::BallAndBeam) = [read(p.measure1), read(p.measure2)]
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")
measure(p::BallAndBeamSimulator) = error("Not yet implemented")
Loading