diff --git a/src/LabProcesses.jl b/src/LabProcesses.jl index e7cc583025c3fc871b1f54e90860fa1242b7ff4a..83713b7af8818368573498b3afe911264840ba8c 100644 --- a/src/LabProcesses.jl +++ b/src/LabProcesses.jl @@ -1,4 +1,4 @@ -__precompile__() +#__precompile__() module LabProcesses diff --git a/src/controllers.jl b/src/controllers.jl index 80b00daacc24e6af7e12dcd95e633f0a79d25ed8..eef0983b58c77d56057a7d3a632732fe5685ef77 100644 --- a/src/controllers.jl +++ b/src/controllers.jl @@ -15,10 +15,8 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10 u = zeros(0:h:duration) r = zeros(0:h:duration) - sysFB = minreal(sysFB) stateFB = init_sysfilter(sysFB) if sysFF != nothing - sysFF = minreal(sysFF) stateFF = init_sysfilter(sysFF) end @@ -33,7 +31,7 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10 @periodically h begin y[i] = measure(P) r[i] = reference(t) - u[i] = control(i) # y,r must be updated before u + u[i] .= control(i) # y,r must be updated before u control(P, u[i]) end end diff --git a/src/interface_implementations/ballandbeam.jl b/src/interface_implementations/ballandbeam.jl index e06bda518d12b580ca890f97fd658b725d78a3ec..76d3d75dcb44c6e2ca71a9a19dfe7bf8732c198f 100644 --- a/src/interface_implementations/ballandbeam.jl +++ b/src/interface_implementations/ballandbeam.jl @@ -29,12 +29,12 @@ measure(p::BallAndBeam) = io2num(ccall((:comedi_read,comedipath), Int32, control(p::BallAndBeamSimulator, u) = error("Not yet implemented") measure(p::BallAndBeamSimulator) = error("Not yet implemented") -const comedipath = "../c/comedi_bridge.so" +const comedipath = Pkg.dir("LabProcesses","c","comedi_bridge.so") const conversion = 65535/20 io2num(x) = x/conversion -10 # Converts from io to float num2io(x) = round(Int32,x*100 + 2050) # Converts from regular number to io initialize(p::BallAndBeam) = ccall((:comedi_start, comedipath),Int32,(Int32,), 0) -finalize(p::BallAndBeam) = (control(P,0);ccall((:comedi_stop, "../c/comedi_bridge.so"),Int32,(Int32,), 0)) +finalize(p::BallAndBeam) = (control(p,0);ccall((:comedi_stop, comedipath),Int32,(Int32,), 0)) initialize(p::BallAndBeamSimulator) = nothing finalize(p::BallAndBeamSimulator) = nothing diff --git a/src/utilities.jl b/src/utilities.jl index 8be25e8df3a7edb707ae26f388072d4744cfd8cf..14373fc50dee800968b666643ecb3e7508a64870 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -9,7 +9,7 @@ macro periodically(h, body) local start_time = time() $(esc(body)) local execution_time = time()-start_time - sleep(max(0,$h-execution_time)) + sleep(max(0,$(esc(h))-execution_time)) end end