Skip to content

Commit b221b9b

Browse files
ufechner71-Bart-1
andauthored
Init interface (#242)
* Set the integrator * Add tests for KPS3 and KPS4 * Allow param stiffness and delta * more tests * More changes, tests fail * Fix tests * Rename init_sim! to init! * Update changelog * Update CHANGELOG.md * Fix typo * Fix test * Next try * Next try * Add comment * Update section initial * Cleanup * Longer dt * Increase abstol * next try * Next try * Add Build PyCall * Disable Steering Response Using SysState --------- Co-authored-by: Uwe Fechner <[email protected]> Co-authored-by: 1-Bart-1 <[email protected]>
1 parent 72a9b56 commit b221b9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+174
-127
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ jobs:
133133
shell: bash
134134
- uses: actions/checkout@v4
135135
- uses: julia-actions/setup-julia@v2
136+
- name: Build PyCall
137+
run: julia --project=docs/ -e 'ENV["PYTHON"]=""; using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.build("PyCall")'
138+
shell: bash
136139
- uses: julia-actions/cache@v2
137140
- uses: julia-actions/julia-buildpkg@v1
138141
- uses: julia-actions/julia-docdeploy@v1

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22
SPDX-FileCopyrightText: 2025 Uwe Fechner, Bart van de Lint
33
SPDX-License-Identifier: MIT
44
-->
5+
### Unreleased
6+
#### Changed
7+
- rename `init_sim!` to `init!`
8+
- removed the parameter `upwind_dir!` from `init!`; use set.upwind_dir instead. Careful: This is in degrees.
9+
- the function `init!` accepts (and ignores) the parameters `delta` and `stiffness_factor` if applied to a
10+
SymbolicAWEModel
11+
### Added
12+
- add the test script test_interface.jl
13+
- add the field `integrator` to KPS4 and KPS3 structs
514

615
### KiteModels v0.8.1 2025-06-20
7-
#### CHANGED
16+
#### Changed
817
- renamed POWER to POWER_LINE and STEERING to STEERING_LINE
918
- improved documentation, fixed example
1019

data/settings.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ system:
1111
fixed_font: "" # name or filepath+filename of alternative fixed pitch font, e.g. Liberation Mono
1212

1313
initial:
14-
l_tethers: [150.0, 0, 0] # initial tether length [m]
15-
elevation: [70.8] # initial elevation angle [deg]
16-
v_reel_outs: [0.0, 0 ,0] # initial reel out speed [m/s]
17-
depower: [25.0] # initial depower settings [%]
14+
elevations: [70.8] # initial elevation angle [deg]
15+
elevation_rates: [0.0] # initial elevation rate [deg/s]
16+
azimuths: [0.0] # initial azimuth angle [deg]
17+
azimuth_rates: [0.0] # initial azimuth rate [deg/s]
18+
headings: [0.0] # initial heading angle [deg]
19+
heading_rates: [0.0] # initial heading rate [deg/s]
20+
# three values are only needed for RamAirKite, for KPS3 and KPS4 use only the first value
21+
l_tethers: [150.0] # initial tether lengths [m]
22+
kite_distances: [51.0] # initial kite distances [m]
23+
v_reel_outs: [0.0] # initial reel out speeds [m/s]
24+
depowers: [25.0] # initial depower settings [%]
25+
steerings: [0.0] # initial steering settings [%]
1826

1927
solver:
2028
abs_tol: 0.0006 # absolute tolerance of the DAE solver [m, m/s]

docs/src/examples_4p.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Then we call the function `find_steady_state` which uses a non-linear solver to
3030
find_steady_state!(kps, prn=true)
3131
```
3232
Finding the steady state of the 4-point model is difficult and it only works when we artificially reduce the stiffness by a factor
33-
of 0.035. In the function [`init_sim!`](@ref) this factor is slowly increased to 1.0.
33+
of 0.035. In the function [`init!`](@ref) this factor is slowly increased to 1.0.
3434

3535
To plot the result in 2D we extract the vectors of the x and z coordinates of the tether particles with a for loop:
3636
```julia

docs/src/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ SysState
5555

5656
## High level simulation interface
5757
```@docs
58-
init_sim!
58+
init!
5959
next_step!
6060
```
6161

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ times faster.
8383
- the documentation was improved
8484

8585
## Provides
86-
The types [`KPS3`](@ref), [`KPS4`](@ref) and [`SymbolicAWEModel`](@ref), representing the one point, the four point kite model and the ram air kite model, together with the high level simulation interface consisting of the functions [`init_sim!`](@ref) and [`next_step!`](@ref). Other kite models can be added inside or outside of this package by implementing the non-generic methods required for an AbstractKiteModel.
86+
The types [`KPS3`](@ref), [`KPS4`](@ref) and [`SymbolicAWEModel`](@ref), representing the one point, the four point kite model and the ram air kite model, together with the high level simulation interface consisting of the functions [`init!`](@ref) and [`next_step!`](@ref). Other kite models can be added inside or outside of this package by implementing the non-generic methods required for an AbstractKiteModel.
8787

8888
Additional functions to provide inputs and outputs of the model on each time step. In particular the constructor [`SysState`](@ref) can be called once per time step to create a SysState struct for
8989
logging or for displaying the state in a viewer. For the KPS3 and KPS4 model, once per time step the [`residual!`](@ref) function is called as many times as needed to find the solution at the end

docs/src/tutorial_system_structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ If the system looks good, we can easily model it, by first creating a [`Symbolic
6969
```julia
7070
sam = SymbolicAWEModel(set, sys_struct)
7171

72-
init_sim!(sam; remake=false)
72+
init!(sam; remake=false)
7373
for i in 1:80
7474
plot(sam, i/set.sample_freq)
7575
next_step!(sam)

examples/bench.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function simulate(integrator, steps)
3434
iter / steps
3535
end
3636

37-
integrator = KiteModels.init_sim!(kps4; delta=0, stiffness_factor=0.5, prn=STATISTIC)
37+
integrator = KiteModels.init!(kps4; delta=0, stiffness_factor=0.5, prn=STATISTIC)
3838

3939
println("\nStarting simulation...")
4040
simulate(integrator, 100)

examples/bench_4p.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function simulate(integrator, steps, offset=0)
5252
iter / steps
5353
end
5454

55-
integrator = KiteModels.init_sim!(kps4, delta=0, stiffness_factor=0.5, prn=STATISTIC)
55+
integrator = KiteModels.init!(kps4, delta=0, stiffness_factor=0.5, prn=STATISTIC)
5656

5757
println("\nStarting simulation...")
5858
simulate(integrator, 100, 100)

examples/calc_spectrum.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function sim_and_plot(set; depower=DEPOWER, f_ex)
100100
set.elevation = 67.0
101101
kcu::KCU = KCU(set)
102102
kps4::KPS4 = KPS4(kcu)
103-
integrator = KiteModels.init_sim!(kps4; delta=0.001*0, stiffness_factor=1, prn=STATISTIC)
103+
integrator = KiteModels.init!(kps4; delta=0.001*0, stiffness_factor=1, prn=STATISTIC)
104104
set_depower_steering(kps4.kcu, depower, 0.0)
105105
simulate(kps4, integrator, logger, STEPS, f_ex)
106106
save_log(logger, "tmp")

0 commit comments

Comments
 (0)