Skip to content
Snippets Groups Projects
Commit 69d653bf authored by Jacob Wikmark's avatar Jacob Wikmark
Browse files

cleaning up

parent 54dcc8ee
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment