Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DoubleTankLab.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
processes
DoubleTankLab.jl
Commits
69d653bf
Commit
69d653bf
authored
7 years ago
by
Jacob Wikmark
Browse files
Options
Downloads
Patches
Plain Diff
cleaning up
parent
54dcc8ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/DoubleTank.jl
+4
-14
4 additions, 14 deletions
src/DoubleTank.jl
with
4 additions
and
14 deletions
src/DoubleTank.jl
+
4
−
14
View file @
69d653bf
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment