-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add out-of-place wingrock dynamics * Add wingrock models * Bump a new version * Update READMe * Adding SecondOrderActuator * Fix a test bug * Add SecondOrderActuator * Add logging * Change oop_dynamics to Dynamics * Update README.md * Fix bugs * Fix a test bug * Add MissileLongitudinal * Add MissileLongitudinal * Fix a minor bug * Remove previously developed missiles
- Loading branch information
Showing
20 changed files
with
348 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
struct SecondOrderActuator <: AbstractActuator | ||
ζ | ||
ω | ||
end | ||
|
||
|
||
function State(env::SecondOrderActuator) | ||
return function (δ, δ̇) | ||
ComponentArray(δ=δ, δ̇=δ̇) | ||
end | ||
end | ||
|
||
|
||
function Dynamics!(env::SecondOrderActuator) | ||
(; ζ, ω) = env | ||
@Loggable function dynamics!(dx, x, p, t; δ_cmd) | ||
(; δ, δ̇) = x | ||
@log state = x | ||
@log input = δ_cmd | ||
dx.δ = δ̇ | ||
dx.δ̇ = -2*ζ*ω*δ̇ + ω^2*(δ_cmd-δ) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
abstract type AbstractActuator <: AbstractEnv end | ||
|
||
|
||
include("SecondOrderActuator.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
""" | ||
Wing-rock phenomenon in the roll motion of slendar delta wings [1]. | ||
# Notes | ||
## Nondimensional values | ||
According to [2], the time, state, and control input of this model are nondimensional. | ||
But here, it is used as time [s], state [rad, rad/s]. | ||
## Input constraint | ||
Input constraint in [3] is used. | ||
## Ideal parameters | ||
The default ideal parameters, W_true, are set as the specific model obtained at the angle of attack of 25 degrees in [1]. | ||
Note that the ideal parameters in [2] are (1000 x the ideal parameters in [1]). | ||
# Refs | ||
[1] J. M. Elzebda, A. H. Nayfeh, and D. T. Mook, “Development of an analyt- ical model of wing rock for slender delta wings,” J. Aircr., vol. 26, no. 8, pp. 737–743, 1989. | ||
[2] N. Cho, H.-S. Shin, Y. Kim, and A. Tsourdos, “Composite Model Reference Adaptive Control with Parameter Convergence Under Finite Excitation,” IEEE Trans. Automat. Contr., vol. 63, no. 3, pp. 811–818, Mar. 2018, doi: 10.1109/TAC.2017.2737324. | ||
[3] J. H. Tarn and F. Y. Hsu, “Fuzzy Control of Wing Rock for Slender Delta wings,” in 1993 American Control Conference, San Francisco, CA, USA: IEEE, Jun. 1993, pp. 1159–1161. doi: 10.23919/ACC.1993.4793048. | ||
""" | ||
Base.@kwdef struct ElzebdaWingRock <: AbstractWingRock | ||
W_true = 1e-3 * [-18.59521, 15.162375, -62.45153, 9.54708, 21.45291] | ||
u_min=-1.75 | ||
u_max=+1.75 | ||
end | ||
|
||
|
||
function State(env::ElzebdaWingRock) | ||
return function (x1=0.0, x2=0.0) | ||
ComponentArray(x1=x1, x2=x2) | ||
end | ||
end | ||
|
||
|
||
""" | ||
Out-of-place dynamics | ||
""" | ||
function Dynamics(env::ElzebdaWingRock) | ||
(; W_true) = env | ||
return function (x, p, t; u) | ||
(; x1, x2) = x | ||
basis = [x1, x2, abs(x1)*x2, abs(x2)*x2, x1^3] | ||
Δ = W_true' * basis | ||
dx1 = x2 | ||
dx2 = u + Δ | ||
dx = State(env)(dx1, dx2) | ||
return dx | ||
end | ||
end | ||
|
||
|
||
function Dynamics!(env::ElzebdaWingRock) | ||
(; u_min, u_max) = env | ||
@Loggable function dynamics!(dx, x, p, t; u) | ||
(; x1, x2) = x | ||
u_saturated = clamp.(u, u_min, u_max) | ||
@log state = x | ||
@log input = ComponentArray(u_cmd=u, u_applied=u_saturated) | ||
dx .= Dynamics(env)(x, p, t; u=u_saturated) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
Wing-rock phenomenon in the roll motion of slendar delta wings at AoA=25 deg [1]. | ||
# Notes | ||
x = [x1, x2]^T | ||
x1 = ϕ (roll angle) | ||
x2 = ϕ̇ (roll rate) | ||
# Refs | ||
[1] J. H. Tarn and F. Y. Hsu, “Fuzzy Control of Wing Rock for Slender Delta wings,” in 1993 American Control Conference, San Francisco, CA, USA: IEEE, Jun. 1993, pp. 1159–1161. doi: 10.23919/ACC.1993.4793048. | ||
""" | ||
Base.@kwdef struct TarnWingRock <: AbstractWingRock | ||
a1=-0.05686 | ||
a2=+0.03254 | ||
a3=+0.07334 | ||
a4=-0.35970 | ||
a5=+1.46810 | ||
C1=0.354 | ||
C2=0.001 | ||
u_min=-1.75 | ||
u_max=+1.75 | ||
end | ||
|
||
|
||
function State(env::TarnWingRock) | ||
return function (x1=0.0, x2=0.0) | ||
ComponentArray(x1=x1, x2=x2) | ||
end | ||
end | ||
|
||
|
||
""" | ||
Out-of-place dynamics | ||
""" | ||
function Dynamics(env::TarnWingRock) | ||
(; a1, a2, a3, a4, a5, C1, C2) = env | ||
return function (x, p, t; u) | ||
(; x1, x2) = x | ||
ω_squares = -C1*a1 | ||
μ1 = C1*a2 - C2 | ||
b1 = C1*a3 | ||
μ2 = C1*a4 | ||
b2 = C1*a5 | ||
basis = [x1, x2, x1^2*x2, x1*x2^2, x1^3] | ||
coeff = [-ω_squares, μ1, μ2, b2, b1] | ||
Δ = coeff' * basis | ||
dx1 = x2 | ||
dx2 = u + Δ | ||
dx = State(env)(dx1, dx2) | ||
return dx | ||
end | ||
end | ||
|
||
|
||
function Dynamics!(env::TarnWingRock) | ||
(; u_min, u_max) = env | ||
@Loggable function dynamics!(dx, x, p, t; u) | ||
(; x1, x2) = x | ||
u_saturated = clamp.(u, u_min, u_max) | ||
@log state = x | ||
@log input = ComponentArray(u_cmd=u, u_applied=u_saturated) | ||
dx .= Dynamics(env)(x, p, t; u=u_saturated) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,5 @@ | ||
""" | ||
Wing-rock phenomenon in the roll motion of slendar delta wings [1]. | ||
abstract type AbstractWingRock <: AbstractEnv end | ||
|
||
# Notes | ||
## Nondimensional values | ||
The time, state, and control input of this model are nondimensional [2]. | ||
|
||
## Ideal parameters | ||
The default ideal parameters, W_true, are set as the specific model obtained at the angle of attack of 25 degrees in [1]. | ||
Note that the ideal parameters in [2] are (1000 x the ideal parameters in [1]). | ||
# Refs | ||
[1] J. M. Elzebda, A. H. Nayfeh, and D. T. Mook, “Development of an analyt- ical model of wing rock for slender delta wings,” J. Aircr., vol. 26, no. 8, pp. 737–743, 1989. | ||
[2] N. Cho, H.-S. Shin, Y. Kim, and A. Tsourdos, “Composite Model Reference Adaptive Control with Parameter Convergence Under Finite Excitation,” IEEE Trans. Automat. Contr., vol. 63, no. 3, pp. 811–818, Mar. 2018, doi: 10.1109/TAC.2017.2737324. | ||
""" | ||
Base.@kwdef struct WingRock <: AbstractEnv | ||
W_true = 1e-3 * [-18.59521, 15.162375, -62.45153, 9.54708, 21.45291] | ||
end | ||
|
||
|
||
function State(env::WingRock) | ||
return function (x1=0.0, x2=0.0) | ||
ComponentArray(x1=x1, x2=x2) | ||
end | ||
end | ||
|
||
|
||
function Dynamics!(env::WingRock) | ||
(; W_true) = env | ||
@Loggable function dynamics!(dx, x, p, t; u) | ||
(; x1, x2) = x | ||
@log state = x | ||
@log input = u | ||
ϕ = [x1, x2, abs(x1)*x2, abs(x2)*x2, x1^3] | ||
Δ = W_true' * ϕ | ||
dx.x1 = x2 | ||
dx.x2 = u + Δ | ||
end | ||
end | ||
include("ElzebdaWingRock.jl") | ||
include("TarnWingRock.jl") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
c383ffe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
c383ffe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/83591
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: