marinlauber / Python-VPP

3-DOF Velocity Prediction Program
MIT License
44 stars 26 forks source link

Crash without kite #28

Closed MG-ng closed 7 months ago

MG-ng commented 8 months ago

I would like to calculate the values for a setup without a kite (to keep it simple).

However, at the end of the run it throws an error:

Optimization successful.
Traceback (most recent call last):
  File "/workspaces/Python-VPP/runVPP.py", line 38, in <module>
    vpp.polar(3, True)
  File "/workspaces/Python-VPP/src/VPPMod.py", line 324, in polar
    polar_plot([self], n, save, "Figure.png")
  File "/workspaces/Python-VPP/src/UtilsMod.py", line 107, in polar_plot
    vmg, ids = _get_vmg(VPP.store[i, :, :, :], VPP.twa_range)
    ^^^^^^^^
ValueError: too many values to unpack (expected 2)

You can reproduce this by simply commenting out the following two lines: https://github.com/marinlauber/Python-VPP/blob/2fd978da46cfe58fb412ba127ea20e551d08a17a/runVPP.py#L27-L28 and moving the ] in the next line.

Or is this intentional?

MG-ng commented 8 months ago

Okay, so I found a workaround which is to have a Kite called "NOT_USED" and assign it an area of 0. Somehow, the algorithm will still use it at TWAs over ~120 or 130 degrees and the boat speed drops to about half but at least it calculates the other set of sails in TWAs below 120° :)

TAJD commented 7 months ago

Thanks for finding this out @MG-ng. I think this is worth a patch to fix so I'll have a think about what to do here, even if it's to alert that no spinnaker has been selected.