Commit ffba76e2 authored by Jacob Wikmark's avatar Jacob Wikmark
Browse files

cosmetic edits

parent 45af3490
......@@ -28,7 +28,7 @@ function LabConnections.Computer.send(n::Void, a::Number)
nothing
end
@with_kw mutable struct PID#{T<:AbstractProcess}
@with_kw mutable struct PID
b::Float64 = 1.0
K::Float64 = 1.0
h::Float64 = 0.05
......@@ -36,21 +36,15 @@ end
Td::Float64 = 1.0
y_old::Float64 = 0.51
N::Int64 = 10
#process::T
P::Float64 = 0
I::Float64 = 0
D::Float64 = 0
Tot::Float64 = 0
end
#function PID(b, K, h, Ti, Td, y_old, N, process)
#PID(b, K, h, Ti, Td, y_old, N, process, 0.0, 0.0, 0.0, 0.0)
function PID(b, K, h, Ti, Td, y_old, N)
PID(b, K, h, Ti, Td, y_old, N, 0.0, 0.0, 0.0, 0.0)
end
#function PID()
#PID(process = process)
#end
function (p::PID)(r, y, onv=(1,1,1))
#The PID should operate entirely on normalized values
......@@ -214,6 +208,9 @@ function calibrate(p::DoubleTank)
nothing
end
function calibrate(p::DoubleTankSimulator)
print("Simulator can't be calibrated!\n")
end
function measure(p::DoubleTank)
#This should give an array of two values in the range [0,1]
......
......@@ -46,4 +46,4 @@ end
g1, r1, tp = makegui(R)
webio_serve(page("/", r1), 8011)
webio_serve(page("/", r1), 8013)
......@@ -5,9 +5,9 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
boundslower = (-2,2)
maxplotlength = 800
gui = GUI()
ptfr = 3.8 #the accuracy here isn't very important
ptfr = 3.8 #pump to flow ratio, approximate
#This allows external access to the r value
#This allows external access to the r value, the rbox string is parsed into this value
rcont, dummygraphic1 = @construct for
r in slider(0.0:0.01:1.0)
Node(:div)
......@@ -17,15 +17,18 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
w0, dummygraphic2 = @construct for
u in slider(0:0.01:1, label=" um"),
run in button("Run"), #This should only exist in the simulated version
K in slider(0:50, label="K"),
Ti in slider(0:50, label="Ti"),
Td in slider(0:50, label="Td"),
cali in button("Calibrate"),
K in slider(0:0.1:50, label="K"),
Ti in slider(0:0.1:50, label="Ti"),
Td in slider(0:0.1:50, label="Td"),
mode in togglebuttons(["Manual", "Automatic"], label=""),
tankno in togglebuttons(["Upper", "Lower"], label=""),
pOn in togglebuttons(["On", "Off"], label="P"),
iOn in togglebuttons(["On", "Off"], label="I"),
dOn in togglebuttons(["On", "Off"], label="D"),
rbox in textbox(" r ")
rbox in textbox(" r "),
expcsv in button("Export Data")
if !endswith(rbox, ".") && rbox != "0"
try
obs(r).val = parse(Float64, rbox)
......@@ -76,7 +79,12 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
end
end
#-----------------------------------------------#
# And this should only exist in the real version#
on(obs(cali)) do val
calibrate(P)
end
#-----------------------------------------------#
LabGUI.set!(gui, widgets)
add!(gui, rcont)
add!(gui, w0)
......@@ -89,22 +97,27 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
p_element = make_grid(2,1)
p_element = setindex_(p_element, dom"div"(widgets[:pOn]), 1, 1)
p_element = setindex_(p_element, dom"div"(widgets[:K]), 2, 1)
p_element = setindex_(p_element, dom"div"(gui.widgets[:pOn]), 1, 1)
p_element = setindex_(p_element, dom"div"(gui.widgets[:K]), 2, 1)
i_element = make_grid(2,1)
i_element = setindex_(i_element, dom"div"(widgets[:iOn]), 1, 1)
i_element = setindex_(i_element, dom"div"(gui.widgets[:iOn]), 1, 1)
i_element = setindex_(i_element, dom"div"(widgets[:Ti]), 2, 1)
d_element = make_grid(2,1)
d_element = setindex_(d_element, dom"div"(widgets[:dOn]), 1, 1)
d_element = setindex_(d_element, dom"div"(widgets[:Td]), 2, 1)
settings_element = setindex_(settings_element, dom"div"(widgets[:run]), 1, 1)
settings_element = setindex_(settings_element, dom"div"(widgets[:tankno]), 2, 1)
settings_element = setindex_(settings_element, dom"div"(widgets[:mode]), 3, 1)
settings_element = setindex_(settings_element, dom"div"(widgets[:rbox]), 4, 1)
settings_element = setindex_(settings_element, dom"div"(widgets[:u]), 5, 1)
d_element = setindex_(d_element, dom"div"(gui.widgets[:dOn]), 1, 1)
d_element = setindex_(d_element, dom"div"(gui.widgets[:Td]), 2, 1)
settings_element = setindex_(settings_element, dom"div"(gui.widgets[:run]), 1, 1)
settings_element = setindex_(settings_element, dom"div"(gui.widgets[:tankno]), 2, 1)
settings_element = setindex_(settings_element, dom"div"(gui.widgets[:mode]), 3, 1)
settings_element = setindex_(settings_element, dom"div"(gui.widgets[:rbox]), 4, 1)
settings_element = setindex_(settings_element, dom"div"(gui.widgets[:u]), 5, 1)
io_element = Node(:div, attributes=Dict("display"=>"inlineBlock"),
gui.widgets[:run],
gui.widgets[:cali],
gui.widgets[:expcsv])
corner_element = setindex_(corner_element, settings_element, 1, 1)
corner_element = setindex_(corner_element, p_element, 1, 2)
......@@ -114,7 +127,7 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
left_element = setindex_(left_element, corner_element, 1, 1)
left_element = setindex_(left_element, graphic2, 2, 1)
layout = setindex_(layout, left_element, 1, 1)
layout = setindex_(layout, Node(:div, graphic1, dummygraphic1, dummygraphic2), 1, 2)
layout = setindex_(layout, Node(:div, graphic1, dummygraphic1, dummygraphic2, io_element), 1, 2)
LabGUI.set!(gui, layout)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment