Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
processes
LabProcesses.jl
Commits
b1bbe807
Commit
b1bbe807
authored
Aug 21, 2017
by
Fredrik Bagge Carlson
Browse files
lab now working
parent
23c78b4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/controllers.jl
View file @
b1bbe807
...
...
@@ -20,10 +20,10 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10
stateFF
=
init_sysfilter
(
sysFF
)
end
function
control
(
i
)
function
calc_
control
(
i
)
rf
=
sysFF
==
nothing
?
r
[
i
]
:
sysfilter!
(
stateFF
,
sysFF
,
r
[
i
])
e
=
rf
-
y
[
i
]
ui
=
sysfilter!
(
stateFB
,
sysFB
,
e
)
ui
=
sysfilter!
(
stateFB
,
sysFB
,
e
)
[
1
]
end
initialize
(
P
)
...
...
@@ -31,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
]
=
calc_
control
(
i
)
# y,r must be updated before u
control
(
P
,
u
[
i
])
end
end
...
...
src/interface_implementations/ballandbeam.jl
View file @
b1bbe807
...
...
@@ -32,7 +32,7 @@ measure(p::BallAndBeamSimulator) = error("Not yet implemented")
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
+
20
50
)
# Converts from regular number to io
num2io
(
x
)
=
round
(
Int32
,
x
*
100
+
20
48
)
# 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
,
comedipath
),
Int32
,(
Int32
,),
0
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment