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
processes
LabProcesses.jl
Commits
0aaeecc3
Commit
0aaeecc3
authored
7 years ago
by
Fredrik Bagge Carlson
Browse files
Options
Downloads
Patches
Plain Diff
add reference generator
parent
5fdd4935
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
src/LabProcesses.jl
+1
-0
1 addition, 0 deletions
src/LabProcesses.jl
src/reference_generators.jl
+19
-0
19 additions, 0 deletions
src/reference_generators.jl
test/runtests.jl
+5
-2
5 additions, 2 deletions
test/runtests.jl
with
26 additions
and
2 deletions
README.md
+
1
−
0
View file @
0aaeecc3
...
...
@@ -61,6 +61,7 @@ for (i,t) = enumerate(0:h:duration)
end
```
Often one finds the need to implement a stateful controller, i.e., a function
that has a memory or state. To this end, the function
[
`sysfilter`
](
@ref
)
is
provided. This function is used to implement control loops where a signal is
...
...
This diff is collapsed.
Click to expand it.
src/LabProcesses.jl
+
1
−
0
View file @
0aaeecc3
...
...
@@ -9,6 +9,7 @@ include("interface_documentation.jl")
include
(
"interface_implementations/ballandbeam.jl"
)
include
(
"utilities.jl"
)
include
(
"reference_generators.jl"
)
include
(
"controllers.jl"
)
end
# module
This diff is collapsed.
Click to expand it.
src/reference_generators.jl
0 → 100644
+
19
−
0
View file @
0aaeecc3
export
PRBSGenerator
#PRBS
"""
r = PRBSGenerator(state = 1)
Generates a pseudo-random binary sequence. Call like `random_input = r()`.
"""
mutable struct
PRBSGenerator
state
::
Int
end
PRBSGenerator
()
=
PRBSGenerator
(
Int
(
1
))
function
(
r
::
PRBSGenerator
)(
args
...
)
state
=
r
.
state
bit
=
((
state
>>
0
)
⊻
(
state
>>
2
)
⊻
(
state
>>
3
)
⊻
(
state
>>
5
)
)
&
1
r
.
state
=
(
state
>>
1
)
|
(
bit
<<
15
)
bit
end
This diff is collapsed.
Click to expand it.
test/runtests.jl
+
5
−
2
View file @
0aaeecc3
using
LabProcesses
using
Base
.
Test
# write your own tests here
@test
1
==
2
# Reference generators
r
=
PRBSGenerator
(
Int
(
1
))
seq
=
[
r
()
for
i
=
1
:
10
]
@test
all
(
seq
.==
[
0
,
0
,
1
,
0
,
0
,
1
,
1
,
0
,
0
,
1
])
foreach
(
r
,
1
:
10_000
)
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