Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
toolbox
WindEnergyToolbox
Commits
b859b427
Commit
b859b427
authored
8 years ago
by
tlbl
Browse files
Options
Downloads
Patches
Plain Diff
fixed one problem and added test
parent
7762eede
No related branches found
No related tags found
1 merge request
!14
Controller functions
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/control/control.py
+7
-8
7 additions, 8 deletions
wetb/control/control.py
wetb/control/tests/test_control.py
+4
-4
4 additions, 4 deletions
wetb/control/tests/test_control.py
with
11 additions
and
12 deletions
wetb/control/control.py
+
7
−
8
View file @
b859b427
...
@@ -42,7 +42,6 @@ class Control(object):
...
@@ -42,7 +42,6 @@ class Control(object):
Returns
Returns
-------
-------
kp: float
kp: float
Proportional gain [rad/(rad/s)]
Proportional gain [rad/(rad/s)]
ki: float
ki: float
...
@@ -54,11 +53,11 @@ class Control(object):
...
@@ -54,11 +53,11 @@ class Control(object):
"""
"""
pitch
*
=
np
.
pi
/
180.
pitch
=
pitch
*
np
.
pi
/
180.
I
*
=
1e-3
I
=
I
*
1e-3
dQdt
*
=
180.
/
np
.
pi
dQdt
=
dQdt
*
180.
/
np
.
pi
Omr
*
=
np
.
pi
/
30.
Omr
=
Omr
*
np
.
pi
/
30.
om
*
=
2.
*
np
.
pi
om
=
om
*
2.
*
np
.
pi
# Quadratic fitting of dQdt
# Quadratic fitting of dQdt
A
=
np
.
ones
([
dQdt
.
shape
[
0
],
3
])
A
=
np
.
ones
([
dQdt
.
shape
[
0
],
3
])
...
@@ -73,8 +72,8 @@ class Control(object):
...
@@ -73,8 +72,8 @@ class Control(object):
kp
=
-
(
2
*
csi
*
om
*
I
[
0
]
-
P
/
(
Omr
**
2
))
/
x
[
2
]
kp
=
-
(
2
*
csi
*
om
*
I
[
0
]
-
P
/
(
Omr
**
2
))
/
x
[
2
]
ki
=
-
(
om
**
2
*
I
[
0
])
/
x
[
2
]
ki
=
-
(
om
**
2
*
I
[
0
])
/
x
[
2
]
K1
=
x
[
2
]
/
x
[
0
]
*
(
180.
/
np
.
pi
)
K1
=
x
[
2
]
/
x
[
1
]
*
(
180.
/
np
.
pi
)
K2
=
x
[
2
]
/
x
[
1
]
*
(
180.
/
np
.
pi
)
**
2
K2
=
x
[
2
]
/
x
[
0
]
*
(
180.
/
np
.
pi
)
**
2
return
kp
,
ki
,
K1
,
K2
return
kp
,
ki
,
K1
,
K2
...
...
This diff is collapsed.
Click to expand it.
wetb/control/tests/test_control.py
+
4
−
4
View file @
b859b427
...
@@ -61,10 +61,10 @@ class TestControl(unittest.TestCase):
...
@@ -61,10 +61,10 @@ class TestControl(unittest.TestCase):
self
.
dQdt
[
i
:],
self
.
dQdt
[
i
:],
P
,
Omr
,
om
,
csi
)
P
,
Omr
,
om
,
csi
)
self
.
assertEqual
(
kp
,
1.59609024364443
13
)
self
.
assertEqual
(
kp
,
1.59609024364443
2
)
self
.
assertEqual
(
ki
,
0.716323626271384
0
2
)
self
.
assertEqual
(
ki
,
0.7163236262713842
4
)
self
.
assertEqual
(
K1
,
10.
463887621856747
)
self
.
assertEqual
(
K1
,
10.
01111637532056
)
self
.
assertEqual
(
K2
,
5
73.59471652017498
)
self
.
assertEqual
(
K2
,
5
99.53659803157643
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
...
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