Monday, February 15, 2021

Optimum Weather Routing with OpenCPN

This note on OpenCPN routing is part of our sequence of articles on the Applications of Weather Data in Grib Format. We have similar demos of routing with other applications.

Optimum vessel routing across forecasted wind, seas, and currents patterns based on the known vessel performance in various conditions is the primary goal of modern marine weather technology. We can do this manually with graphic weather maps we obtain at sea by radiofax or email, and we can do it semi-manually using numerical weather model forecasts we receive in grib format by satcom or HF-radio. 

We can also now do this fully automatically using dedicated software that perform the optimum routing computations for us. In principle, if all input is correct, this would yield the best result and indeed be the optimum route. Experienced mariners know, however, that the wind forecasts are rarely right in all details, and that special conditions such as relative angles of wind and swells can notably affect the performance of the vessel relative to what is expected in its polar diagram of vessel speeds for various wind speeds and angles. Correcting for waves is even more problematic, and ocean currents remain elusive, even with the best ocean models to guide us. In short, the process is not going to be plug and play. Success will still depend on individual's knowledge of weather and their ability to evaluate not just the quality of the forecast, but also the quality of the computed solution.

All optimum routing apps require several inputs to be set correctly or the computation will not work. The various apps differ in how easy it is to insure this is done right and in the detail of the error messages given to help. In any event, for every app that does these computations, it is helpful to have a cheat sheet to follow until the process is mastered in your favorite app.

Furthermore, beyond the basic requirements to compute the route, there is a large layer of adjustments and scaling factors available to optimize the route. Although the apps have some overlap in the most basic corrections available, they do differ notably in the full range of such corrections.

But before we tackle these in future articles, we look at the basics of running a route computation in several apps, as in this example with OpenCPN. We also  have a couple videos showing the process, but these assume we have the basic details in place beforehand. Here is a summary of the basic steps followed by a video illustration.

OpenCPN Weather Routing Plugin
Mac and PC versions seem to behave the same.

(1) Polar diagram files can be any of three file types (.csv, .pol, or .txt), but they must all be in the same basic structure, shown below. (Note: sometimes Windows hides file extensions. If so, open File Explorer and under "View" turn on file extensions.)

Above is the CSV (comma separated values) format. You can use semicolons as well as commas for this. These would be in neat columns when viewed in a spreadsheet, which is one way to create the file, although the WeatherRouting plugin has a very convenient creator and editor for polar files—we do not need the separate plugin called Polar_pi.

If you replace the commas with tab you get the POL format. Example below.


Replace the comma in the CSV with a space and you get the TXT format.


These three are all really the same. True Wind Angles down the first column; True Wind Speed headers along the first row; then subsequent rows are the vessel speeds at the indicated TWA and TWS. The first element of row 1 is sometimes just "twa,"  but this does not matter. Sometimes the polar includes an inserted first line being the name of the sailboat model.

(2) Polars must be stored in the right place.

Mac:  HD\Users\username\Library\Preferences\opencpn\plugins\weather_routing\polars

PC:    C:\ProgramData\opencpn\plugins\weather_routing\polars

(3) Save only one polar per boat for now.  Later you can mix polars for various conditions (high wind, low wind, upwind, downwind, big seas, crossing seas).

(4) Be sure the polar covers all wind speeds along the route. If wind picks up to 25 and highest polar wind is 20, it might not run. Right click any place along the general route area on the grib file and choose "Weather Table" to get a digital meteogram of wind vs time at that location.

(5) Be sure the starting and destination points are within the wind field. Setting up all digitally within the plugin, these points are not shown on the chart as you set them, so typos may not be apparent. Recall S Lat and W Lon are negative values. See notes below on better ways to set up the route.

(6) Be sure the forecast duration is long enough to get to destination with the given polar. Else it might just fail and not say why. Try a quick test with shorter route. There are ways to fake this with extending last winds or using climatic winds, but you then get fake results.

If you get the message "polar failed" and it does not compute, then the cause is most likely in the list above.


Set up procedure
after weather route plugin is installed and enabled.

Step 1.  Drop a mark at the desired start point, then right click to properties, and give it a name; likewise with the end point.

Step 2. Open the WeatherRouting plugin, and with this open, right click the start point (be sure it highlights) and choose Weather Route Position. This will add it to the positions side of routing window. (You can do this at any point on the chart, it does not have to be a mark, but in that case you will not get a graphic confirmation of the location.)  Do the same thing with the end point, to get it into the positions list.

Step 3.  Check the positions list to make sure they are both there. If needed, edit the configuration window and the positions window from the main menu bar controls. Click anywhere in the routing window to show the menu. Note: you might have to try both right and left clicks to get an item highlighted.

Step 4.  Load a wind grib file that covers both start and end points, and be sure it extends far enough in time to get the boat to the end with the polar(s) chosen. You can also load waves and currents, as covered later. 

Step 5.  Set the forecast to the first of the sequence for now. This can be changed later.

Step 6. Viewing the routing panel (Positions and Configurations), use the position dropdown to load your start and end points. These must be in the positions panel to show up in the dropdown. 

Step 7. In the Start panel click Grib Time, and check is consistent with grib forecast showing.

Step 8.  In the Boat panel click Edit. You will initially see samples provided with the program. Do a select all and remove them, then press Add, and navigate to your polar file, which must be stored in the proper place explained below—it should default to that folder. Then "Save as Boat" and give it a name. You might also open the polar to confirm the maximum wind speed included, because the computation cannot proceed through higher winds.

Step 9.  Check in the Data Source Panel that we are using Grib data. Close the polar window and check the path in the Boat Panel to be sure you are using the one you saved. If not, click the three dot menu beside it to assign the right boat. Then close the configuration window. We can leave the rest of the settings on default to get started.

Step 10.  Leave Last Valid unchecked and Climatology disabled.  We will treat inadequate forecast duration another way.  Close config window.  Return to the main Weather Routing window, select the route we are working on, say two Hail Marys, and press Compute.

________

Once a route is computed, the parameters showing in the configuration window are chosen in the menu View/Settings. You must click the weather routing window to show the menu.

The menu View/Plot offers an insightful way to look over the route, both as computed (Current Route) or as you look over alternatives (Cursor Route).

Completed weather routes are not automatically saved when closing the program. The Export button at the bottom of the config window copies the route to the Routes Manager list. It arrives there as a track, but can be converted to a route. Either can be exported as a GPX file.

Here is a video illustration of the creation of an optimum route:


___________

Side Note: If you make a route on the chart, say C to D, then right click the route and choose Weather Analysis, it will both load these two points into the positions panel, and it will create what looks like a normal configuration in the configurations panel, but when you open it, you will see the start and end are filled in but grayed out. 

When you then compute that one, it will look at the course C to D, then look at the wind speed and direction at the start time from the grib, figure the true wind angle from that, then look into the polar to find the expected boat speed, and use that as the average speed for the whole course and give you that speed and the time it takes at that speed. That is not an optimum route; no isochrones were computed.  It is just a rough estimate of the time assuming the wind does not change. This result is roughly what qtVlm calls the VBVMG (very best VMG) route, but it uses only one step to get there.

To go from that set up to a real optimum route computation, just delete that configuration, make a new one, add C and D to it, and run as above. Then it will crank out the isochrones.

§







No comments:

Post a Comment