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
1b5a03c8
Commit
1b5a03c8
authored
Aug 21, 2017
by
Fredrik Bagge Carlson
Browse files
Add a bias term to interface spec.
parent
d5e320c6
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/LabProcesses.jl
View file @
1b5a03c8
#
__precompile__()
__precompile__
()
module
LabProcesses
...
...
src/controllers.jl
View file @
1b5a03c8
...
...
@@ -24,6 +24,7 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10
rf
=
sysFF
==
nothing
?
r
[
i
]
:
sysfilter!
(
stateFF
,
sysFF
,
r
[
i
])
e
=
rf
-
y
[
i
]
ui
=
sysfilter!
(
stateFB
,
sysFB
,
e
)[
1
]
ui
+
bias
(
P
)
end
initialize
(
P
)
...
...
src/interface.jl
View file @
1b5a03c8
...
...
@@ -24,6 +24,7 @@ inputrange(p::AbstractProcess) = error("Function not implemented for $(typeof(p
isstable
(
p
::
AbstractProcess
)
=
error
(
"Function not implemented for
$
(typeof(p))"
)
isasstable
(
p
::
AbstractProcess
)
=
error
(
"Function not implemented for
$
(typeof(p))"
)
sampletime
(
p
::
AbstractProcess
)
=
error
(
"Function not implemented for
$
(typeof(p))"
)
bias
(
p
::
AbstractProcess
)
=
error
(
"Function not implemented for
$
(typeof(p))"
)
control
(
p
::
AbstractProcess
,
u
)
=
error
(
"Function not implemented for
$
(typeof(p))"
)
measure
(
p
::
AbstractProcess
)
=
error
(
"Function not implemented for
$
(typeof(p))"
)
...
...
src/interface_documentation.jl
View file @
1b5a03c8
...
...
@@ -62,6 +62,14 @@ Return the sample time of the process in seconds.
"""
sampletime
"""
b = bias(P::AbstractProcess)
Return an input bias for the process. This could be, i.e., the constant input u₀ around which
a nonlinear system is linearized, or whatever other bias might exist on the input.
`length(b) = num_inputs(P)`
"""
bias
"""
control(P::AbstractProcess, u)
Send a control signal to the process. `u` must have dimension equal to `num_inputs(P)`
...
...
src/interface_implementations/ballandbeam.jl
View file @
1b5a03c8
...
...
@@ -22,6 +22,9 @@ inputrange(p::BallAndBeamType) = [(-10,10)]
isstable
(
p
::
BallAndBeamType
)
=
false
isasstable
(
p
::
BallAndBeamType
)
=
false
sampletime
(
p
::
BallAndBeamType
)
=
p
.
h
bias
(
p
::
BallAndBeam
)
=
p
.
bias
bias
(
p
::
BallAndBeamSimulator
)
=
0
control
(
p
::
BallAndBeam
,
u
)
=
ccall
((
:
comedi_write
,
comedipath
),
Int32
,
(
Int32
,
Int32
,
Int32
,
Int32
),
0
,
1
,
1
,
num2io
(
u
[
1
]
+
p
.
bias
))
...
...
src/interface_implementations/eth_helicopter.jl
View file @
1b5a03c8
...
...
@@ -4,11 +4,13 @@ export ETHHelicopter, ETHHelicopterSimulator, ETHHelicopterType
struct
ETHHelicopter
<:
PhysicalProcess
h
::
Float64
bias
::
Float64
end
ETHHelicopter
()
=
ETHHelicopter
(
0.050
)
struct
ETHHelicopterSimulator
<:
SimulatedProcess
h
::
Float64
bias
::
Float64
state
::
Vector
{
Float64
}
end
ETHHelicopterSimulator
()
=
ETHHelicopterSimulator
(
0.01
,
zeros
(
4
))
...
...
@@ -21,6 +23,8 @@ inputrange(p::ETHHelicopterType) = [(-10,10)]
isstable
(
p
::
ETHHelicopterType
)
=
false
isasstable
(
p
::
ETHHelicopterType
)
=
false
sampletime
(
p
::
ETHHelicopterType
)
=
p
.
h
bias
(
p
::
ETHHelicopterType
)
=
p
.
bias
function
control
(
p
::
ETHHelicopter
,
u
)
ccall
((
:
comedi_write
,
comedipath
),
Int32
,(
Int32
,
Int32
,
Int32
,
Int32
),
0
,
1
,
0
,
num2io
(
u
[
1
]))
...
...
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