Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabProcesses.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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Heyden
LabProcesses.jl
Commits
9b59712d
Commit
9b59712d
authored
6 years ago
by
Fredrik Bagge Carlson
Browse files
Options
Downloads
Patches
Plain Diff
Updates to julia1
parent
af0cb1b5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/LabProcesses.jl
+1
-1
1 addition, 1 deletion
src/LabProcesses.jl
src/controllers.jl
+4
-4
4 additions, 4 deletions
src/controllers.jl
src/interface_implementations/ballandbeam.jl
+3
-3
3 additions, 3 deletions
src/interface_implementations/ballandbeam.jl
with
8 additions
and
8 deletions
src/LabProcesses.jl
+
1
−
1
View file @
9b59712d
...
@@ -9,7 +9,7 @@ end
...
@@ -9,7 +9,7 @@ end
module
LabProcesses
module
LabProcesses
using
ControlSystems
,
LabConnections
.
Computer
,
Parameters
,
DSP
using
ControlSystems
,
LabConnections
.
Computer
,
Parameters
,
DSP
,
LinearAlgebra
include
(
"utilities.jl"
)
include
(
"utilities.jl"
)
...
...
This diff is collapsed.
Click to expand it.
src/controllers.jl
+
4
−
4
View file @
9b59712d
...
@@ -27,16 +27,16 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10
...
@@ -27,16 +27,16 @@ function run_control_2DOF(P::AbstractProcess,sysFB, sysFF=nothing; duration = 10
rf
=
sysFF
==
nothing
?
r
[
:
,
i
]
:
Gff
(
r
[
:
,
i
])
rf
=
sysFF
==
nothing
?
r
[
:
,
i
]
:
Gff
(
r
[
:
,
i
])
e
=
rf
-
y
[
:
,
i
]
e
=
rf
-
y
[
:
,
i
]
ui
=
Gfb
(
e
)
ui
=
Gfb
(
e
)
ui
+
bias
(
P
)
ui
.
+
bias
(
P
)
end
end
simulation
=
isa
(
P
,
SimulatedProcess
)
simulation
=
isa
(
P
,
SimulatedProcess
)
initialize
(
P
)
initialize
(
P
)
for
(
i
,
t
)
=
enumerate
(
0
:
h
:
duration
)
for
(
i
,
t
)
=
enumerate
(
0
:
h
:
duration
)
@periodically
h
simulation
begin
@periodically
h
simulation
begin
y
[
:
,
i
]
=
measure
(
P
)
y
[
:
,
i
]
.
=
measure
(
P
)
r
[
:
,
i
]
=
reference
(
t
)
r
[
:
,
i
]
.
=
reference
(
t
)
u
[
:
,
i
]
=
calc_control
(
i
)
# y,r must be updated before u
u
[
:
,
i
]
.
=
calc_control
(
i
)
# y,r must be updated before u
control
(
P
,
[
clamp
.
(
u
[
j
,
i
],
inputrange
(
P
)[
j
]
...
)
for
j
=
1
:
nu
])
control
(
P
,
[
clamp
.
(
u
[
j
,
i
],
inputrange
(
P
)[
j
]
...
)
for
j
=
1
:
nu
])
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
src/interface_implementations/ballandbeam.jl
+
3
−
3
View file @
9b59712d
...
@@ -48,7 +48,7 @@ const beam_system, nice_beam_controller = define_beam_system()
...
@@ -48,7 +48,7 @@ const beam_system, nice_beam_controller = define_beam_system()
struct
BeamSimulator
<:
SimulatedProcess
struct
BeamSimulator
<:
SimulatedProcess
h
::
Float64
h
::
Float64
s
::
SysFilter
s
::
SysFilter
BeamSimulator
(;
h
::
Real
=
0.01
)
=
new
(
Float64
(
h
),
SysFilter
(
beam_system
,
h
))
BeamSimulator
(;
h
::
Real
=
0.01
,
bias
=
0
)
=
new
(
Float64
(
h
),
SysFilter
(
beam_system
,
h
))
end
end
struct
BallAndBeam
<:
PhysicalProcess
struct
BallAndBeam
<:
PhysicalProcess
...
@@ -96,7 +96,7 @@ bias(p::BallAndBeamSimulator) = 0
...
@@ -96,7 +96,7 @@ bias(p::BallAndBeamSimulator) = 0
function
control
(
p
::
AbstractBeamOrBallAndBeam
,
u
::
AbstractArray
)
function
control
(
p
::
AbstractBeamOrBallAndBeam
,
u
::
AbstractArray
)
length
(
u
)
==
1
||
error
(
"Process
$
(typeof(p)) only accepts one control signal, tried to send u=
$
u."
)
length
(
u
)
==
1
||
error
(
"Process
$
(typeof(p)) only accepts one control signal, tried to send u=
$
u."
)
send
(
p
.
control
,
u
[
1
])
control
(
p
,
u
[
1
])
end
end
control
(
p
::
AbstractBeamOrBallAndBeam
,
u
::
Number
)
=
send
(
p
.
control
,
u
)
control
(
p
::
AbstractBeamOrBallAndBeam
,
u
::
Number
)
=
send
(
p
.
control
,
u
)
control
(
p
::
BeamSimulator
,
u
::
Number
)
=
p
.
s
(
u
)
control
(
p
::
BeamSimulator
,
u
::
Number
)
=
p
.
s
(
u
)
...
@@ -104,7 +104,7 @@ control(p::BallAndBeamSimulator, u::Number) = error("Not yet implemented")
...
@@ -104,7 +104,7 @@ control(p::BallAndBeamSimulator, u::Number) = error("Not yet implemented")
measure
(
p
::
Beam
)
=
read
(
p
.
measure
)
measure
(
p
::
Beam
)
=
read
(
p
.
measure
)
measure
(
p
::
BallAndBeam
)
=
[
read
(
p
.
measure1
),
read
(
p
.
measure2
)]
measure
(
p
::
BallAndBeam
)
=
[
read
(
p
.
measure1
),
read
(
p
.
measure2
)]
measure
(
p
::
BeamSimulator
)
=
vec
dot
(
p
.
s
.
sys
.
C
,
p
.
s
.
state
)
measure
(
p
::
BeamSimulator
)
=
dot
(
p
.
s
.
sys
.
C
,
p
.
s
.
state
)
measure
(
p
::
BallAndBeamSimulator
)
=
error
(
"Not yet implemented"
)
measure
(
p
::
BallAndBeamSimulator
)
=
error
(
"Not yet implemented"
)
...
...
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