Skip to content

Commit 09cbf93

Browse files
rgcoemichaelcdevin
authored andcommitted
Use class for controllers (sandialabs#406)
1 parent 8c9bd0e commit 09cbf93

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

examples/tutorial_1_WaveBot.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@
548548
"outputs": [],
549549
"source": [
550550
"plt.figure()\n",
551-
"pto_tdom.sel(realization=0)['power'].loc['mech',:,:].plot()"
551+
"pto_tdom['power'].sel(realization=0, type='mech').squeeze().plot()"
552552
]
553553
},
554554
{

examples/tutorial_2_AquaHarmonics.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@
623623
"\n",
624624
"# Excitation and velocity\n",
625625
"ax1 = ax[0].twinx()\n",
626-
"force_excitation = wec_tdom.sel(realization=0).force.sel(type=['Froude_Krylov', 'diffraction'])\n",
626+
"force_excitation = wec_tdom.force.sel(realization=0, type=['Froude_Krylov', 'diffraction'])\n",
627627
"force_excitation = force_excitation.sum('type')/1e3\n",
628628
"force_excitation.plot(ax=ax[0], color='k')\n",
629629
"wec_tdom.sel(realization=0).vel.plot(ax=ax1, color='orange')\n",
@@ -634,7 +634,7 @@
634634
"ax[0].set_ylabel('Excitation force [kN]')\n",
635635
"\n",
636636
"# Forces\n",
637-
"(wec_tdom.sel(realization=0).force.sel(type='PTO')/1e3).plot(\n",
637+
"(wec_tdom.force.sel(realization=0,type='PTO')/1e3).plot(\n",
638638
" ax=ax[1], \n",
639639
" label='PTO force in WEC frame',\n",
640640
")\n",
@@ -679,8 +679,8 @@
679679
"ax[2].legend(loc='upper right',)\n",
680680
"\n",
681681
"# Power\n",
682-
"(pto_tdom.sel(realization=0)['power'].sel(type='mech')/1e3).plot(ax=ax[3], label='Mech. power')\n",
683-
"(pto_tdom.sel(realization=0)['power'].sel(type='elec')/1e3).plot(ax=ax[3], linestyle='dashed', \n",
682+
"(pto_tdom['power'].sel(realization=0, type='mech')/1e3).plot(ax=ax[3], label='Mech. power')\n",
683+
"(pto_tdom['power'].sel(realization=0, type='elec')/1e3).plot(ax=ax[3], linestyle='dashed', \n",
684684
" label=\"Elec. power\")\n",
685685
"ax[3].grid(color='0.75', linestyle='-', linewidth=0.5, axis='x')\n",
686686
"ax[3].legend(loc='upper right')\n",

examples/tutorial_3_LUPA.ipynb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,11 @@
14601460
"nbconvert_exporter": "python",
14611461
"pygments_lexer": "ipython3",
14621462
"version": "3.11.8"
1463+
},
1464+
"vscode": {
1465+
"interpreter": {
1466+
"hash": "a3e13d9eb6391ec8c830b5b864d7e2cac256aef786c5e95ba02dc5258710976f"
1467+
}
14631468
}
14641469
},
14651470
"nbformat": 4,

examples/tutorial_4_Pioneer.ipynb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,12 @@
506506
"pto_impedance = np.array([[pto_impedance_11, pto_impedance_12],\n",
507507
" [pto_impedance_21, pto_impedance_22]])\n",
508508
"\n",
509-
"pto = wot.pto.PTO(ndof, kinematics=[1], controller=None, impedance=pto_impedance, loss=None, names=None)\n"
509+
"pto = wot.pto.PTO(ndof, \n",
510+
" kinematics=[1], \n",
511+
" controller=wot.controllers.unstructured_controller(), \n",
512+
" impedance=pto_impedance, \n",
513+
" loss=None, \n",
514+
" names=None)\n"
510515
]
511516
},
512517
{
@@ -1041,7 +1046,12 @@
10411046
"pto_impedance = np.array([[pto_impedance_11, pto_impedance_12],\n",
10421047
" [pto_impedance_21, pto_impedance_22]])\n",
10431048
"\n",
1044-
"pto = wot.pto.PTO(ndof, kinematics=[1], controller=None, impedance=pto_impedance, loss=None, names=None)\n",
1049+
"pto = wot.pto.PTO(ndof, \n",
1050+
" kinematics=[1], \n",
1051+
" controller=wot.controllers.unstructured_controller(), \n",
1052+
" impedance=pto_impedance, \n",
1053+
" loss=None, \n",
1054+
" names=None)\n",
10451055
"\n",
10461056
"wec_lin = wot.WEC.from_impedance(freq_irreg, \n",
10471057
" Zi_intrp_irreg,\n",

0 commit comments

Comments
 (0)