General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

MESSAGE PLOTSTART
MESSAGE PLOTEND

GHS provides all the common graphs and tables for making ship stability reports, but there may be an occasion when you need to graph something else.

There is a way, and it is not difficult, but the tool for making your custom plot is tucked away in the MESSAGE command, so you may have missed it.

The basic procedure is illustrated very simply:



Here is what you get:



To make it useful for real data, you will want to have numbers appear in those MESSAGE plot lines without resorting to any hand work. Because a series of numbers must be output via the MESSAGE command on one line, you will accumulate the numbers in a string variable and then have the variable evaluated in the MESSAGE command.

The following example harvests a bunch of righting arm numbers for a range of heel angles and drafts and repeats it for a series of VCG increments relative to the draft. Not that this is necessarily something you would want to do. It just serves as an illustration of how you would go about making plots and tables of anything.



If you are not proficient with macros, this is a good example of how even small macros can automate a task.

The macro that does most of the work is shown below.



Note that the string variable s accumulates the righting arms for the plot. To make the table look good, a slightly different format is needed, so string variables s1, s2, etc. are set up for later use when it is time to write out the table.

Now we need a something to feed drafts and heel angles to macro ravdr. Below is a macro that does it. (By the way, macro names are arbitrary, and what goes into the macro body is simply a series of GHS commands that you put together to accomplish some task. When %1 is encountered during execution of the macro, the %1 gets replaced by the first parameter that appears on the execute command, .ravdr in this case.)

Note that ravdr gets executed repeatedly, thanks to the construct in parentheses, which gives the number of executions followed by the increment that is to be applied to the first parameter after each execution.



The final piece for this task is the macro that includes the MESSAGE PLOTSTART and MESSAGE PLOTEND commands:



If you studied those examples, you noticed that two macros are missing. They are auxiliary in nature. Here they are along with the command that executes the whole thing to get the three plots.



And here is one of the tables that came out:


Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs