Skip to content

Commit 74e8f5b

Browse files
authored
Merge pull request #126 from OpenSourceAWE/makie-sysstate
Add sysstate conversion functions and plotting for the SysLog
2 parents ee81411 + 44dd1d6 commit 74e8f5b

21 files changed

+1688
-208
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
version:
3434
- '1' # Latest stable release
3535
- 'lts' # Long-term support release
36+
- 'pre'
3637
os:
3738
- ubuntu-latest
3839
- windows-latest

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
*.xopp
99
*.so
1010
*.so.bak
11+
.claude
12+
AGENTS.md
13+
CLAUDE.md
1114
Manifest.toml
1215
Manifest*.toml
1316
Manifest*.default

Project.toml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,23 @@ Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
2222
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2323
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
2424
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
25-
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
2625
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
26+
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
2727
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2828
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
2929
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
3030
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
3131
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
32-
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
3332
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
3433
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
3534
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
3635
SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
3736
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
3837
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
3938
SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
40-
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
4139
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
4240
Timers = "21f18d07-b854-4dab-86f0-c15a3821819a"
41+
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
4342
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
4443
VortexStepMethod = "ed3cd733-9f0f-46a9-93e0-89b8d4998dd9"
4544

@@ -52,15 +51,12 @@ SymbolicAWEModelsControlPlotsExt = "ControlPlots"
5251
SymbolicAWEModelsMakieExt = "Makie"
5352

5453
[compat]
55-
Aqua = "0.8.13"
5654
AtmosphericModels = "0.3.2"
57-
BenchmarkTools = "1.6"
5855
CodecZlib = "0.7.8"
5956
ControlPlots = "0.2.4"
6057
ControlSystemsBase = "1.18.1"
6158
DiffEqBase = "6.161.0"
6259
DocStringExtensions = "0.9.4"
63-
Documenter = "1.10.1"
6460
KiteUtils = "0.11.0"
6561
LaTeXStrings = "1.4.0"
6662
LinearAlgebra = "1"
@@ -75,37 +71,23 @@ Parameters = "0.12"
7571
Pkg = "1"
7672
PrecompileTools = "1.2.1"
7773
Printf = "1"
78-
REPL = "1"
7974
RecipesBase = "1.3.4"
75+
Serialization = "1"
8076
Reexport = "1.1, 1.2"
8177
Rotations = "1.7"
8278
SHA = "0.7.0"
8379
SciMLBase = "2.82.1"
8480
SciMLOperators = "0.3.13, 1"
85-
Serialization = "1"
8681
StaticArrays = "1.9.7"
8782
Statistics = "1"
8883
StatsBase = "0.34"
8984
SteadyStateDiffEq = "2.5"
9085
Suppressor = "0.2.8"
9186
SymbolicIndexingInterface = "0.3"
9287
SymbolicUtils = "~3.29"
93-
TOML = "1.0.3"
9488
Tar = "1.10.0"
95-
Test = "1"
9689
Timers = "0.1.5"
90+
TOML = "1"
9791
UnPack = "1.0.2"
9892
VortexStepMethod = "2.3.0"
99-
julia = "1"
100-
101-
[extras]
102-
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
103-
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
104-
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
105-
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
106-
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
107-
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
108-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
109-
110-
[targets]
111-
test = ["Test", "BenchmarkTools", "Documenter", "Makie", "StatsBase", "Aqua", "TOML"]
93+
julia = "1.10"

docs/src/exported_types.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Tether(idx, segment_idxs, winch_idx)
5858
Winch
5959
Winch(idx, set::Settings, tether_idxs; tether_len, tether_vel, brake)
6060
Winch(idx, tether_idxs, gear_ratio, drum_radius, f_coulomb, c_vf, inertia_total; tether_len, tether_vel, brake)
61+
AbstractWing
62+
BaseWing
63+
VSMWing
6164
Wing
6265
Wing(idx, vsm_aero, vsm_wing, vsm_solver, group_idxs, R_b_c, pos_cad; transform_idx)
6366
Transform
@@ -70,5 +73,6 @@ Transform(idx, set, base_point_idx; kwargs...)
7073
```@docs
7174
SysState
7275
update_sys_state!
76+
update_from_sysstate!
7377
```
7478

docs/src/tutorial_system_structure.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ transforms = [Transform(1, deg2rad(-80), 0.0, 0.0;
6464
rot_point_idx=points[end].idx)]
6565
```
6666

67-
From the points, segments and transform we create a [`SystemStructure(name, set)`](@ref), which can be plotted in 2d to quickly investigate if the model is correct.
67+
From the points, segments and transform we create a [`SystemStructure(name, set)`](@ref), which can be plotted in 3D to quickly investigate if the model is correct.
6868
```julia
6969
sys_struct = SystemStructure("tether", set; points, segments, transforms)
7070
plot(sys_struct, 0.0)
@@ -76,9 +76,10 @@ If the system looks good, we can easily model it, by first creating a [`Symbolic
7676
sam = SymbolicAWEModel(set, sys_struct)
7777

7878
init!(sam; remake=false)
79+
plot(sys_struct, 0.0) # Create initial plot
7980
for i in 1:80
80-
plot(sam, i/set.sample_freq)
8181
next_step!(sam)
82+
plot(sys_struct, i/set.sample_freq) # Update plot
8283
end
8384
```
8485
![Tether during simulation](assets/tether_during_sim.png)
@@ -99,18 +100,19 @@ using WinchModels
99100
winches = [Winch(1, set, [1])]
100101
```
101102

102-
The 2d plot of the [`SystemStructure`](@ref) should still look the same, so we don't have to plot that. We can just create the system, and simulate it. We just need to be sure that we call plot with `t=0.0` to reset the plot.
103+
The plot of the [`SystemStructure`](@ref) should still look the same, so we don't have to plot that. We can just create the system, and simulate it. We call `plot(sys_struct, 0.0)` to create a new plot.
103104

104105
```julia
105106
sys_struct = SystemStructure("winch", set; points, segments, tethers, winches, transforms)
106107
sam = SymbolicAWEModel(set, sys_struct)
107108
init!(sam; remake=false)
108109
ss = SysState(sam)
109110

111+
plot(sys_struct, 0.0) # Create initial plot
110112
for i in 1:80
111-
plot(sam, (i-1)/set.sample_freq)
112113
next_step!(sam; set_values=[-20.0])
113114
update_sys_state!(ss, sam)
115+
plot(sys_struct, i/set.sample_freq) # Update plot
114116
end
115117
```
116118

@@ -157,17 +159,18 @@ We can then use a [`Transform`](@ref) to describe the orientation of the initial
157159
```julia
158160
transforms = [Transform(1, -deg2rad(0.0), 0.0, 0.0; base_pos=[1.0, 0.0, 4.0], base_point_idx=1, rot_point_idx=2)]
159161
sys_struct = SymbolicAWEModels.SystemStructure("pulley", set; points, segments, pulleys, transforms)
160-
plot(sys_struct, 0.0; zoom=false, l_tether=set.l_tether)
162+
plot(sys_struct, 0.0)
161163
```
162164

163165
If the plot of the [`SystemStructure`](@ref) looks good, we can continue by creating a [`SymbolicAWEModel`](@ref) and simulating through time.
164166

165167
```julia
166168
sam = SymbolicAWEModel(set, sys_struct)
167169
init!(sam; remake=false)
170+
plot(sys_struct, 0.0) # Create initial plot
168171
for i in 1:100
169-
plot(sam, i/set.sample_freq; zoom=false)
170172
next_step!(sam)
173+
plot(sys_struct, i/set.sample_freq) # Update plot
171174
end
172175
```
173176

examples/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
33
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
44
KiteUtils = "90980105-b163-44e5-ba9f-8b1c83bb0533"
5+
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
56
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
67
SymbolicAWEModels = "9c9a347c-5289-41db-a9b9-25ccc76c3360"
8+
VortexStepMethod = "ed3cd733-9f0f-46a9-93e0-89b8d4998dd9"

examples/ram_air_kite.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ end
3434

3535
sl, _ = sim_oscillate!(sam; dt, total_time, vsm_interval, steering_freq, steering_magnitude,
3636
bias, prn=true)
37-
display(plot(sam.sys_struct, sl))
37+
# display(plot(sam.sys_struct, sl))
38+
replay(sl, sam.sys_struct)

0 commit comments

Comments
 (0)