Canal Calculator © Steve Turner 2003


CLICK ME TO DOWNLOAD

I use hire canal boats and needed to ensure that I could get to the locations I 
desired and return the boat on time. I also wanted to try and stop at 
interesting locations for lunch and for the night (i.e. by a pub!). So I sat 
down with the appropriate Nicholson guide and tried to work out an itinerary. 
If, like me, you have tried that you will know how hard this simple task is. How 
far is it? How fast do I travel? How long to do a lock? With a little experience 
you soon learn this but it takes ages working out distances and times.
After a couple of hours work you find your half a day short. What if I start 
half an hour earlier each morning you think? Oh No! I'm not working all that out 
again!

Well as you've already guessed this is the answer to your prayers. I first wrote 
this program in 'C' on a 1.3 version Amiga. When I upgraded to V2.04 it didn't 
seem to work correctly and whilst the source code was well documented, finding 
this bug was almost impossible. In addition, after using the program a few times 
I found I wanted a few more facilities. About the same time I got a cheap 
version of Blitz Basic. Within days I had registered for the full version and 
had decided to rewrite the canal calculator as my introduction.

By 1998 my increasing dissatisfaction with the user interface was finally 
brought to a head when Erwan Fouret introduced his MUI Library for Blitz. So 
late into the night over June, July and August I converted 'Canal_Calc' into an 
MUI version and dropped the old one. I also took this opportunity to improve the 
program and increase it's useability.

In 2003 my wife bought a new PC and I was given the old one. I discovered that 
BlitzPlus was available for the PC and being very similar to the Amiga Blitz 
Basic it was not to difficult a task to convert the program for the PC.

I recommend you read through this text once before using the program.

Whilst BlitzPlus runs very fast the extremely complicated search algorithm is a 
bit slow. However, I'm getting ahead of myself. Here is a full description of 
the program using the menus as the headings. The menus are described as they 
appear and not in the order you would use them. Note therefore that you need to 
have a map loaded or created before most of the menu items can be used. One 
other point is that the program will not complain if you load an unmatched map 
and route but it may get confused. I take no responsibility for the outcome if 
you do this.

I have included a manual method of deciding the route. I now find this is 
actually the best way to do it!

PROJECT MENU
============
NEW
---
This is straight forward. As you would expect, any Maps or Routes are dumped 
from memory and you are ready to start a new project. 

LOAD > MAP
----------
Again, no surprises, load a previously saved map. I've included a map in the 
archive. I may not be complete or have the places you need so you'll just have 
to amend them or start your own! 

LOAD > ROUTE
------------
No route has been included on the disk so you need to create one. Then you can 
use this menu item to reload it. 

SAVE > MAP
----------
Very simple again. Use this to save to any device a map from memory. This is 
disabled in none registered version. 

SAVE > ROUTE
------------
Yes. Save a route from memory to any device. This is disabled in none registered 
version. 

CALCULATE
---------
This is the heart of the program and must be used to create a 'route' before any 
useful work can be done. 
For a route to be calculated a map must exist in memory. If you use automatic 
the program will attempt to find the shortest route between the start and end 
points you specify. In addition, it will go via up to 10 locations given. Why 
have Via locations? Well to allow you to force the program to follow a certain 
path. 
Now you may ask why have the program to find the shortest route and then force 
it to go another way?  The answer to that is that you may want to go round a 
ring in a certain direction. Alternatively, you may want to take the longest 
route or detour up a branch. In any event the 10 via locations allow you more 
control over the selected route. I have never used or needed more than 2 via 
locations but I hope 10 will cover anyone's needs. I can alter it for more if 
necessary just let me know.
Also you can decide to tell the program the list of locations from the start to 
end location.
When you select this option, the following events occur;
1) A request is made for a start location.
2) A request is made for an end location.
3) Up to 10 requests are made for via locations and any cancelled request aborts 
any further requests.
4) A requester asks if you want to do it manually or automatically.
5a) AUTOMATIC
You now sit and wait for the route to be found. It's progress can be monitored 
but in V1.0 it can not be aborted. I will add an abort option in the next 
release. Be warned this can take some time to run.
5b) MANUAL
A new window will pop up and show you the start location and either the end 
location or the first via location. The window will keep popping up until all 
the via locations are done. The window will go away on it's own when you find 
the end location but if you go wrong you can close the window but you loose all 
the work up to that point.
In the centre of the window is the location you are currently 'at' below are the 
locations in the various directions. This will mostly only be two unless your at 
a junction. Decide the correct direction to travel and only then press the 
appropriate direction button. This will cause the window to update and now show 
this new location as the location you are 'at' and the whole process repeats 
until you reach the end location. Whilst this May be a fair amount of work for a 
long trip, it will probably be quicker than the automatic system that searches 
every possible route and or direction. 

PRINT
-----
You can not output to printer or file in the none registered version.
Now to the interesting bit. Print, outputs the details of your 'trip' to the 
screen and/or printer. The output firstly prints out the settings; pick-up time; 
start time; stop time; lunch length; lock time; speed.
Now, starting 30mins. from boat pick-up time the program calculates how long to 
get to the next location on your route. If the location is a lock, this time is 
also added to the time to travel between locations.
This process is repeated for the next location and so on until the end location 
is reached. (You will of course normally be starting and ending at the same 
location.)
If it is lunch time and you are at a 'preferred stop' the program will add in 
the time for lunch and indicate the time to cast off. Similarly, if the location 
is a preferred stop and it is your night stop time or later you will be told 
that this is your night stop and the morning start time will be used as the cast 
off time the next day.
If, within certain limits, no suitable 'preferred stop' is found for lunch or 
night time a forced stop will be made at any location.
If a location is indicated as a 'stop over' then time is allowed at that 
location for the time stated in the setting and cast off time is indicated.
'Stop over' locations once visited are flagged and not stopped at again if you 
travel past or through a second time.
You will find that you will want to print this to screen, inspect the stopping 
places and the time taken. Then 'tweak' the parameters, reprint and repeat until 
everything is just right. To help with this the print out to screen is put into 
a lister so you can scroll back and forward inspecting the route. Finally, 
commit it to paper to take with you.
At this point I must admit to the poor printing facilities provided within 
BlitzPlus. The printing is done to the selected printer in a standard mono-
spaced font. It is possible from BlitzPlus to call the system libraries and I 
may improve printer output later if I get enough requests. Ensure your window is 
wide enough to see all the information because stops are added to the right of 
the text. 

ABOUT
-----
Fairly simply a copyright notice and registration details. 

QUIT
----
No surprises here. The program will quit out warning you if you have an unsaved 
map or route in memory.

EDIT MENU
=========
EXTEND MAP
----------
This is used to start a new map or to extend a previously loaded map. Please 
note that this will not allow you to add locations into an existing map, only 
extend it, (That is add locations in previously unused directions).
On selection a requester will open for you to select the point from which the 
map is to be extended. If it is a new map you will not get the requester and the 
extend map window will open at location one.
The extend map window at first looks complicated but it is very simple. A brief 
description will help. First, the information. At the top of the window is the 
location number. You have no control of this number that is used internally and 
allocated by the system as needed. If you have two or more locations with the 
same name only the one with the lowest location number is found in a search so 
beware!
At the bottom of the window the locations in the four directions adjacent to 
this location are shown to help you move about the map. Note that with limited 
space for the name it may be truncated.
Now to the business part of the window. Near the top is a string requester for 
the location name. Any alpha-numeric string may be used but avoid using the name 
of another location. 
If no name is entered the system will allocate a default name.
Under the name are two check mark buttons. One for preferred stops and one for 
locks.
A preferred stop will be used as a stopping point for lunch or night time 
whenever possible. A non-preferred stop will only be used if unavoidable. So 
select the location as a preferred stop if it's near a pub or shops or in a town 
or village worth seeing.
The 'lock' button is fairly obvious in use but for the system to be accurate 
every lock must be included with this button set so that travelling times can be 
calculated.
You will see below that a distance must be set between every location but 
sometimes locks are so close together that they effectively have no distance 
between them. To allow the system to cope, just show one tenth of a mile between 
each lock regardless of how close they are. If they are more than this then show 
the correct distance. For example, Foxton is two sets of 5 locks in a staircase. 
This would be shown as 10 locations spanning a total of one mile. In truth, the 
distance is probably less than a quarter mile but if you've been up or down 
Foxton locks you will know the extra time created by the distance is needed 
anyway.
In the centre-ish are four direction buttons. Once you have entered the name of 
the location and set the 'lock' and 'stop' buttons according to need it is time 
to move on to the next location.
As the map is not a detailed record of the canal system only four directions are 
used so pick the most appropriate. It actual fact, the direction has no 
relevance whatsoever. It is used simply to help in use and creation of the map.
If you click on a direction that already has a location in that direction then 
you will be moved to that location. If however you click in an empty direction a 
small requester will appear to ask you the distance to the new location. Enter 
the distance in miles (or more appropriately tenths of a mile) to the next 
location and press return. Note that the minimum distance is 0.1 miles and the 
maximum is 10 miles. A distance of nil is no connection and can not be accepted 
as an entry. After a valid distance has been entered a new location is created 
and the process is repeated.
You have two ways to end the map entry. 'Dump and exit' or 'save and exit'. It 
should be obvious that dump will delete the current entry and it's connections 
before exiting and save will exit and keep the current location.
Dump will remove the location even if it had previously been saved. This is the 
only way to scrap a location from the map.
If you are looking for a 'delete location' menu item then you are out of luck. 
Select 'extend map', pick the location to scrap and then do a 'dump and exit'.
You will have to confirm your selection in this case. The system will try to re-
connect the adjoining locations if at all possible but if it is unable to do so 
a warning will be given and you will have to re-select 'extend map' and connect 
up the gap.
That brings us nicely to the last button in the window 'Connect To'. This is 
used in place of a direction button when you want to connect this location to a 
location already existing in the map. For example to close up a circular route.
On clicking this button you will be asked which direction to connect in and the 
distance to the location and then the location to connect to. You must select a 
valid direction. i.e. If you select north then this location must have no 
existing north connection and the new location must have no existing south 
connection. The map provided with the program will help you to see how all this 
works.

LOCATION NAME
-------------
Simple option to select a location and change it's name. As stated above, avoid 
using the same location name for more than one location. Should you give it no 
name at all, a default name will be created.
 
LOCATION DISTANCE
-----------------
Same again, select a location and change the distance to another location.

INSERT LOCATION
---------------
Again not very complicated. First you are asked for a location to insert next 
to. Then the direction in which it is to be inserted and finally, the name for 
the new location. The new location is inserted mid-way between the two old 
locations. Use Edit>Location distance if you need to change the distances and 
Edit>Extend map to make it a lock or preferred stop.

SET STOPS
---------
There are places along your trip that you may want to stop at for a look around.
By setting the location as a stop the system will stop at this location 
regardless of the time of day for the period given. You select each location 
required and are asked for the length of time (in minutes) to stay there. If a 
selected location is arrived at during lunch, the stop time will be added to the 
lunch time (Is this a bug or a feature?). The stops are stored in the map but 
are not saved as part of the map. The stops are saved as part of the route.
If you start a new route the stops will remain in the map and be used 
accordingly. 
It may be necessary therefore to delete the stops when a new route is made on an 
existing map (Or just re-load the map!). The stop window will allow you to amend 
or delete them. The location will only be `stopped at' the first time you pass 
through it. If you pass through the same location later, it will not produce a 
stop.

DEFAULTS MENU
-------------
All the defaults are saved as part of the route. All the defaults except two use 
the time requester. That is a window with 2 sliders in it to represent a 24hr. 
clock.
 
PICK UP TIME
------------
A time requester will appear for you to set the time you will pick up the boat.
Your trip will start 30mins. after this time.

MORNING START TIME
------------------
This is the time used for casting off each morning.

EVENING STOP TIME
-----------------
If a preferred stop is found after this time it is used as the night stop 
location. If a preferred stop is not found 30mins. beyond this time the next 
location is used as the night stop regardless.
 
LENGTH OF LUNCH
---------------
Simply the length of lunch time required. If you do not intend to stop for lunch 
set this to zero.

SPEED ON WATER
--------------
This simple requester allows setting your speed along open canal up and down. I 
find that 2.5 m.p.h. is a good average. On canals with few locks the average 
goes up and with many locks or difficult flows it can come down.
 
TIME TO DO LOCK
---------------
Again simply the time taken to do a lock. Many factors affect the time to work 
up or down a lock. Size (physical and quantity) of the crew, size of lock and 
rate of fill/empty, amount of other boats using the lock etc. I tend to use 10 
mins. per lock. On big flights like Hatton you often share the work and can pass 
other boats without trouble. On smaller flights you have quicker time for 
emptying and filling and less hold ups. I have been up to an hour out it the 
time to do a flight of locks due to waiting but you can make it up without too 
much trouble. If you have a crew of one + captain then use longer lock times but 
otherwise 10 to 12 minutes shouldn't be far out. Keeping a log of your trips 
will help to indicate your average times. 

START DAY > SAT.
................
..........> FRI.
----------------
I'll let you guess what this does.

Well that's it. I hope the above details are informative and the program is 
useful. I couldn't take the Guides on holiday without it, particularly as we 
have to arrive at change over points within an hour of the time given to the 
parents. Arriving early is O.K. but being late makes them anxious.

SEP. 2003
Version 1.0 : Initial release
	  

STEVE TURNER
e-mail: stevet2@ntlworld.com

BlitzPlus is a cross between a standard basic language and 'C'.
I strongly recommend anyone with programming experience to have a look at it.
BlitzPlus is copyright 2003 by Blitz Research Ltd and was developed by Mark Sibly.

Home