diff --git a/src/DoubleTank.jl b/src/DoubleTank.jl index 5c6799a011679f935ee933b24e3feb3fb381190b..c664c6cdcbe0561b9089decb5627d81641c95edb 100644 --- a/src/DoubleTank.jl +++ b/src/DoubleTank.jl @@ -1,4 +1,4 @@ -export DoubleTankSimulator +export DoubleTankSimulator, DoubleTank, using LabConnections.Computer #for LabStream @@ -11,15 +11,8 @@ const venturimax = 14.0 using Parameters -#struct BC -#ar::Array{Float64, 1} -#end - -#bc = BC([]) - -#Change later +#This should be changed in LabConnections in some reasonably manner ############################################################ -using LabConnections.Computer function LabConnections.Computer.getwritecommand(stream::ComediStream, input::AnalogOutput10V, val::Float64) abs(val) <= 10 || error("Volatage $val not in range [-10,10]") return (Int32(0),Int32(3),input.i,val) @@ -29,7 +22,7 @@ function LabConnections.Computer.getreadcommand(stream::ComediStream, input::Ana end ############################################################ - +# This allows calibration without having to toggle the pump controller function LabConnections.Computer.send(n::Void, a::Number) nothing end @@ -103,7 +96,6 @@ mutable struct Pump <: PhysicalProcess v::Float64 pid::PID venturirange::Array{Float64, 1} - #venturimax::Float64 measure::AnalogInput10V control::Union{AnalogOutput10V, Void} end @@ -121,7 +113,6 @@ outputrange(p::Pump) = [0.,10.] inputrange(p::Pump) = [(0.,1.)] function control(p::Pump, yref) - #In the java program this controller runs 5 times faster than the regular one, how do we accomplish this? Do we need to? p.u = yref end @@ -129,7 +120,6 @@ function initialize(p::Pump) @async while true @periodically p.h begin #normalized venturi - #push!(bc.ar, time()) venturi = (read(p.measure)-p.venturirange[1])/(p.venturirange[2]-p.venturirange[1]) flow = sqrt(max(venturi,0.0)) p.v = p.pid(p.u, flow, (1,1,0)) @@ -280,6 +270,6 @@ measure(p::DoubleTankSimulator) = p.x + p.σ*p.scale*randn(2) LabProcesses.initialize(p::DoubleTankSimulator) = nothing LabProcesses.finalize(p::DoubleTankSimulator) = nothing -LabProcesses.initialize(p::DoubleTank) = nothing #change later +LabProcesses.initialize(p::DoubleTank) = nothing LabProcesses.finalize(p::DoubleTank) = nothing