|
|
General HydroStatics
Ship Stability Software |
|
Command of the Week
(New or interesting aspects of GHS that you may not know about) |
|
Functions are convenient (review)
(Requires GHS version 17.36 or later ) |
| LOAD accepts volumes in cubic length units (either feet or meters). Often users want to enter volumes in different units such as gallons or barrels. MACRO /FUNCTION is a great way to accomplish this. Here are two function that convert gallons or barrels into cubic feet. |
|
macro gal2ft3 /fun `convert gallons to cubic feet
gal2ft3:=%1*0.13368056 / load (hold1.c) vol:{gal2ft3(1260)} macro barrel2ft3 /fun `convert barrels to cubic feet barrel2ft3:=42*{gal2ft3(%1)} / load (hold2.c) vol:{barrel2ft3(30)} |
|
Using a function to convert gallons to cubic feet instead of normal macro allows the resulting LOAD command to be largely unchanged except that the volume specified is an expression with a function inside it. Given the name, there is a good chance future readers will understand the function's purpose without even looking at its contents. The STATUS command already offers options to display tank volumes in any of the following units: GA - gallons; IM - imperial gallons (synonyms: IG, GI); CF - cubic feet; CY - cubic yards (synonym: YD); CM - cubic meters; LI - liters; BB - 42-gallon barrels. For this example, either of the STATUS commands below would be fitting. |
|
STATUS TANKS /ADDVOL:GA STATUS TANKS /ADDVOL:BB |
|
|
Questions, comments, or requests?
Contact Creative Systems, Inc. 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 Click here for an index to this and previous COWs |