Skip to content

Commit aed9d2b

Browse files
authored
Merge dev into main for v3.1.1
v3.1.1
2 parents 7ebad71 + 32c597f commit aed9d2b

File tree

13 files changed

+309
-249
lines changed

13 files changed

+309
-249
lines changed

docs/source/references.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ General resources
99
* `Incorporating empirical nonlinear efficiency into control co-optimization of a real world heaving point absorber using WECOPTTOOL <https://github.com/dtgaebe/OMAE_2023_103899>`_ (:cite:t:`Gaebele:2023wf`:)
1010
* `Control co-design and uncertainty analysis of the LUPA's PTO using WecOptTool <https://github.com/cmichelenstrofer/EWTEC_2023>`_ (:cite:t:`Strofer:2023vw`:)
1111
* Webinar recordings:
12+
* `June, 2025 <https://www.youtube.com/watch?v=uThGhTGYzwY>`_
1213
* `October, 2022 <https://digitalops.sandia.gov/Mediasite/Play/b3a653193c1a4da4a4d71d9908c3ac031d?enablejsapi=1>`_
1314
* `February, 2022 <https://digitalops.sandia.gov/Mediasite/Play/fde6b77d82f944319dc19d9c7d11d8a51d?enablejsapi=1>`_
1415

examples/tutorial_1_WaveBot.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@
370370
"f_max = 750.0\n",
371371
"nsubsteps = 4\n",
372372
"\n",
373-
"def const_f_pto(wec, x_wec, x_opt, waves): # Format for scipy.optimize.minimize\n",
374-
" f = pto.force(wec, x_wec, x_opt, waves, nsubsteps)\n",
373+
"def const_f_pto(wec, x_wec, x_opt, wave): # Format for scipy.optimize.minimize\n",
374+
" f = pto.force(wec, x_wec, x_opt, wave, nsubsteps)\n",
375375
" return f_max - np.abs(f.flatten())\n",
376376
"\n",
377377
"ineq_cons = {'type': 'ineq',\n",
@@ -704,8 +704,8 @@
704704
"pto_2 = wot.pto.PTO(ndof, kinematics, controller, pto_impedance_2, loss, name_2)\n",
705705
"\n",
706706
"## Update PTO constraints and forcing\n",
707-
"def const_f_pto_2(wec, x_wec, x_opt, waves):\n",
708-
" f = pto_2.force_on_wec(wec, x_wec, x_opt, waves, nsubsteps)\n",
707+
"def const_f_pto_2(wec, x_wec, x_opt, wave):\n",
708+
" f = pto_2.force_on_wec(wec, x_wec, x_opt, wave, nsubsteps)\n",
709709
" return f_max - np.abs(f.flatten())\n",
710710
"ineq_cons_2 = {'type': 'ineq', 'fun': const_f_pto_2}\n",
711711
"constraints_2 = [ineq_cons_2]\n",
@@ -987,8 +987,8 @@
987987
" nsubsteps = 4\n",
988988
" f_max = 750.0\n",
989989
"\n",
990-
" def const_f_pto(wec, x_wec, x_opt, waves):\n",
991-
" f = pto.force(wec, x_wec, x_opt, waves, nsubsteps)\n",
990+
" def const_f_pto(wec, x_wec, x_opt, wave):\n",
991+
" f = pto.force(wec, x_wec, x_opt, wave, nsubsteps)\n",
992992
" return f_max - np.abs(f.flatten())\n",
993993
"\n",
994994
" ineq_cons = {'type': 'ineq', 'fun': const_f_pto}\n",

examples/tutorial_2_AquaHarmonics.ipynb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -374,20 +374,20 @@
374374
"metadata": {},
375375
"outputs": [],
376376
"source": [
377-
"def f_buoyancy(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
377+
"def f_buoyancy(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
378378
" \"\"\"Only the zeroth order component (doesn't include linear stiffness)\"\"\"\n",
379379
" return displacement * rho * g * np.ones([wec.ncomponents*nsubsteps, wec.ndof])\n",
380380
"\n",
381-
"def f_gravity(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
381+
"def f_gravity(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
382382
" return -1 * wec.inertia_matrix.item() * g * np.ones([wec.ncomponents*nsubsteps, wec.ndof])\n",
383383
"\n",
384-
"def f_pretension_wec(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
384+
"def f_pretension_wec(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
385385
" \"\"\"Pretension force as it acts on the WEC\"\"\"\n",
386-
" f_b = f_buoyancy(wec, x_wec, x_opt, waves, nsubsteps) \n",
387-
" f_g = f_gravity(wec, x_wec, x_opt, waves, nsubsteps)\n",
386+
" f_b = f_buoyancy(wec, x_wec, x_opt, wave, nsubsteps) \n",
387+
" f_g = f_gravity(wec, x_wec, x_opt, wave, nsubsteps)\n",
388388
" return -1*(f_b+f_g)\n",
389389
"\n",
390-
"def f_pto_passive(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
390+
"def f_pto_passive(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
391391
" pos = wec.vec_to_dofmat(x_wec)\n",
392392
" vel = np.dot(wec.derivative_mat,pos)\n",
393393
" acc = np.dot(wec.derivative_mat, vel)\n",
@@ -403,9 +403,9 @@
403403
" f_inertia = np.dot(time_matrix,inertia)\n",
404404
" return f_spring + f_fric + f_inertia\n",
405405
"\n",
406-
"def f_pto_line(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
407-
" f_pto = pto.force_on_wec(wec, x_wec, x_opt, waves, nsubsteps)\n",
408-
" f_pre = f_pretension_wec(wec, x_wec, x_opt, waves, nsubsteps)\n",
406+
"def f_pto_line(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
407+
" f_pto = pto.force_on_wec(wec, x_wec, x_opt, wave, nsubsteps)\n",
408+
" f_pre = f_pretension_wec(wec, x_wec, x_opt, wave, nsubsteps)\n",
409409
" return f_pto + f_pre\n",
410410
"\n",
411411
"f_add = {'PTO': f_pto_line,\n",
@@ -450,26 +450,26 @@
450450
"\n",
451451
"nsubsteps = 2\n",
452452
"\n",
453-
"def const_peak_torque_pto(wec, x_wec, x_opt, waves):\n",
454-
" torque = pto.force(wec, x_wec, x_opt, waves, nsubsteps)\n",
453+
"def const_peak_torque_pto(wec, x_wec, x_opt, wave):\n",
454+
" torque = pto.force(wec, x_wec, x_opt, wave, nsubsteps)\n",
455455
" return torque_peak_max - np.abs(torque.flatten())\n",
456456
"\n",
457-
"def const_speed_pto(wec, x_wec, x_opt, waves):\n",
458-
" rot_vel = pto.velocity(wec, x_wec, x_opt, waves, nsubsteps)\n",
457+
"def const_speed_pto(wec, x_wec, x_opt, wave):\n",
458+
" rot_vel = pto.velocity(wec, x_wec, x_opt, wave, nsubsteps)\n",
459459
" return rot_speed_max - np.abs(rot_vel.flatten())\n",
460460
"\n",
461-
"def const_power_pto(wec, x_wec, x_opt, waves):\n",
461+
"def const_power_pto(wec, x_wec, x_opt, wave):\n",
462462
" power_mech = (\n",
463-
" pto.velocity(wec, x_wec, x_opt, waves, nsubsteps) *\n",
464-
" pto.force(wec, x_wec, x_opt, waves, nsubsteps)\n",
463+
" pto.velocity(wec, x_wec, x_opt, wave, nsubsteps) *\n",
464+
" pto.force(wec, x_wec, x_opt, wave, nsubsteps)\n",
465465
" )\n",
466466
" return power_max - np.abs(power_mech.flatten())\n",
467467
"\n",
468-
"def constrain_min_tension(wec, x_wec, x_opt, waves):\n",
469-
" total_tension = -1*f_pto_line(wec, x_wec, x_opt, waves, nsubsteps)\n",
468+
"def constrain_min_tension(wec, x_wec, x_opt, wave):\n",
469+
" total_tension = -1*f_pto_line(wec, x_wec, x_opt, wave, nsubsteps)\n",
470470
" return total_tension.flatten() + min_line_tension\n",
471471
"\n",
472-
"def zero_mean_pos(wec, x_wec, x_opt, waves):\n",
472+
"def zero_mean_pos(wec, x_wec, x_opt, wave):\n",
473473
" return x_wec[0]\n",
474474
"\n",
475475
"constraints = [\n",
@@ -641,7 +641,7 @@
641641
"x_wec, x_opt = wot.decompose_state(results[0].x, ndof=ndof, nfreq=nfreq)\n",
642642
"ax[1].plot(\n",
643643
" wec.time_nsubsteps(nsubsteps),\n",
644-
" f_pto_line(wec, x_wec, x_opt, waves, nsubsteps)/1e3,\n",
644+
" f_pto_line(wec, x_wec, x_opt, waves.sel(realization=0), nsubsteps)/1e3,\n",
645645
" linestyle='dashed', \n",
646646
" label='Mooring line tension',\n",
647647
")\n",

examples/tutorial_3_LUPA.ipynb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -765,30 +765,30 @@
765765
"## Displacements\n",
766766
"# maximum stroke\n",
767767
"stroke_max = 0.5 # m\n",
768-
"def const_stroke_pto(wec, x_wec, x_opt, waves): \n",
769-
" pos = pto.position(wec, x_wec, x_opt, waves, nsubsteps)\n",
768+
"def const_stroke_pto(wec, x_wec, x_opt, wave): \n",
769+
" pos = pto.position(wec, x_wec, x_opt, wave, nsubsteps)\n",
770770
" return stroke_max - np.abs(pos.flatten())\n",
771771
"\n",
772772
"## GENERATOR\n",
773773
"# peak torque\n",
774774
"default_radius = sprockets[default_sprocket]['diameter'] / 2\n",
775-
"def const_peak_torque_pto(wec, x_wec, x_opt, waves, radius=default_radius): \n",
775+
"def const_peak_torque_pto(wec, x_wec, x_opt, wave, radius=default_radius): \n",
776776
" \"\"\"Instantaneous torque must not exceed max torque Tmax - |T| >=0 \n",
777777
" \"\"\"\n",
778-
" torque = pto.force(wec, x_wec, x_opt, waves, nsubsteps) / gear_ratio(radius)\n",
778+
" torque = pto.force(wec, x_wec, x_opt, wave, nsubsteps) / gear_ratio(radius)\n",
779779
" return generator['max_torque'] - np.abs(torque.flatten())\n",
780780
"\n",
781781
"# continuous torque\n",
782-
"def const_torque_pto(wec, x_wec, x_opt, waves, radius=default_radius): \n",
782+
"def const_torque_pto(wec, x_wec, x_opt, wave, radius=default_radius): \n",
783783
" \"\"\"RMS torque must not exceed max continous torque \n",
784784
" Tmax_conti - Trms >=0 \"\"\"\n",
785-
" torque = pto.force(wec, x_wec, x_opt, waves, nsubsteps) / gear_ratio(radius)\n",
785+
" torque = pto.force(wec, x_wec, x_opt, wave, nsubsteps) / gear_ratio(radius)\n",
786786
" torque_rms = np.sqrt(np.mean(torque.flatten()**2))\n",
787787
" return generator['continuous_torque'] - torque_rms\n",
788788
"\n",
789789
"# max speed\n",
790-
"def const_speed_pto(wec, x_wec, x_opt, waves, radius=default_radius): \n",
791-
" rot_vel = pto.velocity(wec, x_wec, x_opt, waves, nsubsteps) * gear_ratio(radius)\n",
790+
"def const_speed_pto(wec, x_wec, x_opt, wave, radius=default_radius): \n",
791+
" rot_vel = pto.velocity(wec, x_wec, x_opt, wave, nsubsteps) * gear_ratio(radius)\n",
792792
" return generator['max_speed'] - np.abs(rot_vel.flatten())\n",
793793
"\n",
794794
"## Constraints\n",
@@ -1261,30 +1261,30 @@
12611261
" ## Constraints\n",
12621262
" # Maximum stroke\n",
12631263
" stroke_max = 0.5 # m\n",
1264-
" def const_stroke_pto(wec, x_wec, x_opt, waves): \n",
1265-
" pos = pto.position(wec, x_wec, x_opt, waves, nsubsteps)\n",
1264+
" def const_stroke_pto(wec, x_wec, x_opt, wave): \n",
1265+
" pos = pto.position(wec, x_wec, x_opt, wave, nsubsteps)\n",
12661266
" return stroke_max - np.abs(pos.flatten())\n",
12671267
"\n",
12681268
" ## GENERATOR\n",
12691269
" # peak torque\n",
12701270
" radius = sprockets[sprocket]['diameter'] / 2\n",
1271-
" def const_peak_torque_pto(wec, x_wec, x_opt, waves): \n",
1271+
" def const_peak_torque_pto(wec, x_wec, x_opt, wave): \n",
12721272
" \"\"\"Instantaneous torque must not exceed max torque Tmax - |T| >=0 \n",
12731273
" \"\"\"\n",
1274-
" torque = pto.force(wec, x_wec, x_opt, waves, nsubsteps) / gear_ratio(radius)\n",
1274+
" torque = pto.force(wec, x_wec, x_opt, wave, nsubsteps) / gear_ratio(radius)\n",
12751275
" return generator['max_torque'] - np.abs(torque.flatten())\n",
12761276
"\n",
12771277
" # continuous torque\n",
1278-
" def const_torque_pto(wec, x_wec, x_opt, waves): \n",
1278+
" def const_torque_pto(wec, x_wec, x_opt, wave): \n",
12791279
" \"\"\"RMS torque must not exceed max continous torque \n",
12801280
" Tmax_conti - Trms >=0 \"\"\"\n",
1281-
" torque = pto.force(wec, x_wec, x_opt, waves, nsubsteps) / gear_ratio(radius)\n",
1281+
" torque = pto.force(wec, x_wec, x_opt, wave, nsubsteps) / gear_ratio(radius)\n",
12821282
" torque_rms = np.sqrt(np.mean(torque.flatten()**2))\n",
12831283
" return generator['continuous_torque'] - torque_rms\n",
12841284
"\n",
12851285
" # max speed\n",
1286-
" def const_speed_pto(wec, x_wec, x_opt, waves): \n",
1287-
" rot_vel = pto.velocity(wec, x_wec, x_opt, waves, nsubsteps) * gear_ratio(radius)\n",
1286+
" def const_speed_pto(wec, x_wec, x_opt, wave): \n",
1287+
" rot_vel = pto.velocity(wec, x_wec, x_opt, wave, nsubsteps) * gear_ratio(radius)\n",
12881288
" return generator['max_speed'] - np.abs(rot_vel.flatten())\n",
12891289
"\n",
12901290
" ## Constraints\n",

examples/tutorial_4_Pioneer.ipynb

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,12 @@
442442
" pos_fw = wec.vec_to_dofmat(x_opt[nstate_pto:])\n",
443443
" return pos_wec - pos_fw\n",
444444
"\n",
445-
"def rel_position(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
445+
"def rel_position(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
446446
" pos_rel = x_rel(wec, x_wec, x_opt)\n",
447447
" time_matrix = wec.time_mat_nsubsteps(nsubsteps)\n",
448448
" return np.dot(time_matrix, pos_rel)\n",
449449
"\n",
450-
"def rel_velocity(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
450+
"def rel_velocity(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
451451
" pos_rel = x_rel(wec, x_wec, x_opt)\n",
452452
" vel_rel = np.dot(wec.derivative_mat, pos_rel)\n",
453453
" time_matrix = wec.time_mat_nsubsteps(nsubsteps)\n",
@@ -468,7 +468,7 @@
468468
"metadata": {},
469469
"outputs": [],
470470
"source": [
471-
"def force_from_generator(wec, x_wec, x_opt, waves=None, nsubsteps=1):\n",
471+
"def force_from_generator(wec, x_wec, x_opt, wave=None, nsubsteps=1):\n",
472472
" f_fd = np.reshape(x_opt[:nstate_pto], (-1, ndof), order='F')\n",
473473
" time_matrix = wec.time_mat_nsubsteps(nsubsteps)\n",
474474
" torque = np.dot(time_matrix, f_fd) * flywheel_properties['motor_gear_ratio']\n",
@@ -525,14 +525,14 @@
525525
"metadata": {},
526526
"outputs": [],
527527
"source": [
528-
"def mechanical_power(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
529-
" force_td = force_from_generator(wec, x_wec, x_opt, waves, nsubsteps)\n",
530-
" vel_td = rel_velocity(wec, x_wec, x_opt, waves, nsubsteps)\n",
528+
"def mechanical_power(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
529+
" force_td = force_from_generator(wec, x_wec, x_opt, wave, nsubsteps)\n",
530+
" vel_td = rel_velocity(wec, x_wec, x_opt, wave, nsubsteps)\n",
531531
" return vel_td * force_td\n",
532532
"\n",
533-
"def electrical_power(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
534-
" q1_td = rel_velocity(wec, x_wec, x_opt, waves)\n",
535-
" e1_td = force_from_generator(wec, x_wec, x_opt, waves)\n",
533+
"def electrical_power(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
534+
" q1_td = rel_velocity(wec, x_wec, x_opt, wave)\n",
535+
" e1_td = force_from_generator(wec, x_wec, x_opt, wave)\n",
536536
" q1 = wot.complex_to_real(wec.td_to_fd(q1_td, False))\n",
537537
" e1 = wot.complex_to_real(wec.td_to_fd(e1_td, False))\n",
538538
" vars_1 = np.hstack([q1, e1])\n",
@@ -546,12 +546,12 @@
546546
" e2_td = np.dot(time_mat, e2)\n",
547547
" return q2_td * e2_td\n",
548548
"\n",
549-
"def energy(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
550-
" power_td = electrical_power(wec, x_wec, x_opt, waves, nsubsteps)\n",
549+
"def energy(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
550+
" power_td = electrical_power(wec, x_wec, x_opt, wave, nsubsteps)\n",
551551
" return np.sum(power_td) * wec.dt/nsubsteps\n",
552552
"\n",
553-
"def average_electrical_power(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
554-
" e = energy(wec, x_wec, x_opt, waves, nsubsteps)\n",
553+
"def average_electrical_power(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
554+
" e = energy(wec, x_wec, x_opt, wave, nsubsteps)\n",
555555
" return e / wec.tf"
556556
]
557557
},
@@ -575,8 +575,8 @@
575575
"max_generator_torque = 25.8 # N*m\n",
576576
"nsubsteps_constraints = 5\n",
577577
"\n",
578-
"def constraint_max_generator_torque(wec, x_wec, x_opt, waves, nsubsteps=nsubsteps_constraints):\n",
579-
" torque = force_from_generator(wec, x_wec, x_opt, waves, nsubsteps)\n",
578+
"def constraint_max_generator_torque(wec, x_wec, x_opt, wave, nsubsteps=nsubsteps_constraints):\n",
579+
" torque = force_from_generator(wec, x_wec, x_opt, wave, nsubsteps)\n",
580580
" return max_generator_torque - np.abs(torque.flatten())"
581581
]
582582
},
@@ -607,8 +607,8 @@
607607
"metadata": {},
608608
"outputs": [],
609609
"source": [
610-
"def force_from_friction(wec, x_wec, x_opt, waves = None, nsubsteps = 1):\n",
611-
" rel_vel = rel_velocity(wec, x_wec, x_opt, waves, nsubsteps) * flywheel_properties['motor_gear_ratio']\n",
610+
"def force_from_friction(wec, x_wec, x_opt, wave = None, nsubsteps = 1):\n",
611+
" rel_vel = rel_velocity(wec, x_wec, x_opt, wave, nsubsteps) * flywheel_properties['motor_gear_ratio']\n",
612612
" fric = -1*(\n",
613613
" np.tanh(rel_vel)*flywheel_properties['coulomb_friction'] +\n",
614614
" rel_vel*flywheel_properties['viscous_friction']\n",
@@ -618,8 +618,8 @@
618618
"def linear_spring(pos):\n",
619619
" return spring_properties['gear_ratio'] * -spring_properties['stiffness'] * pos\n",
620620
"\n",
621-
"def force_from_lin_spring(wec, x_wec, x_opt, waves = None, nsubsteps = 1):\n",
622-
" pos = rel_position(wec, x_wec, x_opt, waves, nsubsteps) * spring_properties['gear_ratio']\n",
621+
"def force_from_lin_spring(wec, x_wec, x_opt, wave = None, nsubsteps = 1):\n",
622+
" pos = rel_position(wec, x_wec, x_opt, wave, nsubsteps) * spring_properties['gear_ratio']\n",
623623
" return linear_spring(pos)\n",
624624
"\n",
625625
"def nonlinear_spring(pos):\n",
@@ -635,8 +635,8 @@
635635
" new_pos = new_pos - coeffs*np.sin(k*spring_eq_pos_td)\n",
636636
" return spring_properties['gear_ratio'] * -spring_properties['stiffness'] * scale * new_pos\n",
637637
"\n",
638-
"def force_from_nl_spring(wec, x_wec, x_opt, waves = None, nsubsteps = 1):\n",
639-
" pos = rel_position(wec, x_wec, x_opt, waves, nsubsteps) * spring_properties['gear_ratio']\n",
638+
"def force_from_nl_spring(wec, x_wec, x_opt, wave = None, nsubsteps = 1):\n",
639+
" pos = rel_position(wec, x_wec, x_opt, wave, nsubsteps) * spring_properties['gear_ratio']\n",
640640
" return nonlinear_spring(pos)\n",
641641
"\n",
642642
"spring_angle_rad = np.arange(-2*np.pi, 2*np.pi, np.pi/200)\n",
@@ -674,28 +674,28 @@
674674
"metadata": {},
675675
"outputs": [],
676676
"source": [
677-
"def flywheel_inertia(wec, x_wec, x_opt, waves = None, nsubsteps = 1):\n",
677+
"def flywheel_inertia(wec, x_wec, x_opt, wave = None, nsubsteps = 1):\n",
678678
" pos_fw = wec.vec_to_dofmat(x_opt[nstate_pto:])\n",
679679
" acc_fw = np.dot(wec.derivative2_mat, pos_fw)\n",
680680
" time_matrix = wec.time_mat_nsubsteps(nsubsteps)\n",
681681
" acc_fw = np.dot(time_matrix, acc_fw)\n",
682682
" return flywheel_properties['MOI'] * acc_fw\n",
683683
"\n",
684-
"def flywheel_residual_lin_spring(wec, x_wec, x_opt, waves = None, nsubsteps = 1):\n",
684+
"def flywheel_residual_lin_spring(wec, x_wec, x_opt, wave = None, nsubsteps = 1):\n",
685685
" resid = (\n",
686-
" flywheel_inertia(wec, x_wec, x_opt, waves, nsubsteps) +\n",
687-
" force_from_lin_spring(wec, x_wec, x_opt, waves, nsubsteps) +\n",
688-
" force_from_friction(wec, x_wec, x_opt, waves, nsubsteps) +\n",
689-
" force_from_generator(wec, x_wec, x_opt, waves, nsubsteps)\n",
686+
" flywheel_inertia(wec, x_wec, x_opt, wave, nsubsteps) +\n",
687+
" force_from_lin_spring(wec, x_wec, x_opt, wave, nsubsteps) +\n",
688+
" force_from_friction(wec, x_wec, x_opt, wave, nsubsteps) +\n",
689+
" force_from_generator(wec, x_wec, x_opt, wave, nsubsteps)\n",
690690
" )\n",
691691
" return resid.flatten()\n",
692692
"\n",
693-
"def flywheel_residual_nl_spring(wec, x_wec, x_opt, waves = None, nsubsteps = 1):\n",
693+
"def flywheel_residual_nl_spring(wec, x_wec, x_opt, wave = None, nsubsteps = 1):\n",
694694
" resid = (\n",
695-
" flywheel_inertia(wec, x_wec, x_opt, waves, nsubsteps) +\n",
696-
" force_from_nl_spring(wec, x_wec, x_opt, waves, nsubsteps) +\n",
697-
" force_from_friction(wec, x_wec, x_opt, waves, nsubsteps) +\n",
698-
" force_from_generator(wec, x_wec, x_opt, waves, nsubsteps)\n",
695+
" flywheel_inertia(wec, x_wec, x_opt, wave, nsubsteps) +\n",
696+
" force_from_nl_spring(wec, x_wec, x_opt, wave, nsubsteps) +\n",
697+
" force_from_friction(wec, x_wec, x_opt, wave, nsubsteps) +\n",
698+
" force_from_generator(wec, x_wec, x_opt, wave, nsubsteps)\n",
699699
" )\n",
700700
" return resid.flatten()"
701701
]
@@ -967,18 +967,18 @@
967967
"outputs": [],
968968
"source": [
969969
"\n",
970-
"def fw_velocity(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
970+
"def fw_velocity(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
971971
" pos_fw = wec.vec_to_dofmat(x_opt[nstate_pto:])\n",
972972
" vel_fw = np.dot(wec.derivative_mat, pos_fw)\n",
973973
" time_matrix = wec.time_mat_nsubsteps(nsubsteps)\n",
974974
" return np.dot(time_matrix, vel_fw)\n",
975975
"\n",
976-
"def fw_friction_power(wec, x_wec, x_opt, waves, nsubsteps=1):\n",
977-
" force_td = force_from_friction(wec, x_wec, x_opt, waves, nsubsteps)\n",
978-
" vel_td = fw_velocity(wec, x_wec, x_opt, waves, nsubsteps)\n",
976+
"def fw_friction_power(wec, x_wec, x_opt, wave, nsubsteps=1):\n",
977+
" force_td = force_from_friction(wec, x_wec, x_opt, wave, nsubsteps)\n",
978+
" vel_td = fw_velocity(wec, x_wec, x_opt, wave, nsubsteps)\n",
979979
" return vel_td * force_td\n",
980980
"\n",
981-
"fw_fric_power = fw_friction_power(wec_nl, x_wec, x_opt, waves_regular, nsubsteps)\n",
981+
"fw_fric_power = fw_friction_power(wec_nl, x_wec, x_opt, waves_regular.sel(realization=0), nsubsteps)\n",
982982
"avg_fw_fric_power = np.mean(fw_fric_power)"
983983
]
984984
},

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies = [
3232
[project.optional-dependencies]
3333
dev = [
3434
"pytest",
35-
"sphinx<8.2.0",
35+
"sphinx",
3636
"sphinxcontrib-bibtex",
3737
"sphinx_rtd_theme",
3838
"jupyter",

0 commit comments

Comments
 (0)