Opto 22

43044 Business Park Drive, Temecula, CA 92590 USA
Local & outside the USA:(951) 695-3000
Toll-Free within the USA:(800) 321-6786
Fax: (951) 695-3095
Email: sales@opto22.com

Hot Tips from Product Support: Tables and Hard-coded Values in PAC Control

Waterford Township DPW - New Video Case Study

Upcoming SNAP PAC System Class in Massachusetts

Is This the Last FactoryFloor Training Class?

Hot Tips from Product Support: Tables and Hard-coded Values in PAC Control

PAC ControlOpto 22's Product Support Group (PSG) develops some helpful tips as they work with customers who contact them for free product support.

Here's a tip that applies when programming many PAC Control strategies: Make tables expandable; don't hard-code the length. In fact, hard-coding anything is a bad idea for maintainability.

For example, if you have a string table named s120Minutes with 120 elements, what if you decide later you want 240 minutes instead?

With the number in the table name, you'd have to change several items in the strategy. They're hard to find, and if you miss one, it's not a fun bug to troubleshoot.

Here's a way to make this table and the strategy it's in easier to maintain and expand in the future:

  1. Create a new Numeric Variable (like an Integer 32) to hold the length of the table. Call it something descriptive like nMinutesInTable.
  2. Change the name of the table (currently s120Minutes) so it does NOT include that hard-coded 120 value. Maybe name it stOneMinutePerElement and add a comment such as "Number of minutes to log is based on the number of elements in this table, which is stored in the variable nMinutesInTable."
  3. Initialize nMinutesInTable in block 0 of the Powerup chart using the "Get Length of Table" command. Since it's a value that can't change on the fly, it may as well be initialized immediately.
  4. Remove all the hard-coded references to 120 and replace them with nMinutesInTable.

In general, it's not a good idea to have a number in the code like 120 or 15 or 10 (whether the logic is in regular blocks or OptoScript blocks), since you can't search for those numbers if you want to change them later. But you can search for variables named, for example, nPointsToLog, nMinutesInTable, and nMSecsToWaitInLogLoop.

Using variables makes the strategy easier to understand for the next person--or for yourself next week or next year. And if you do want to change values later, you only need to do it in one place rather than all over the strategy.

Waterford Township DPW - New Video Case Study

Waterford video case studyThe Waterford Township Department of Public Works in Michigan receives visitors from all over the U.S. and Canada. Why? It's their reputation for operating a high-technology, highly efficient water/wastewater system.

Our new video case study shows how the aptly named Waterford integrates SCADA, monitoring and automation, maintenance and document management, GIS, and customer service all in the same system to provide safe, clean water—cost effectively.

Watch the Waterford Township case study.

Or read the printed case study.

Upcoming SNAP PAC System Class in Massachusetts

Martindale Associates logoIf you're near Bradford, Massachusetts, here's a four-day, hands-on SNAP PAC System class offered by OptoPartner Martindale Associates.

Martindale is an Opto 22 Certified Trainer. If you can't come to free training at our headquarters office in California, a Certified Trainer near you can provide the training you need.

Class details: August 11-14, 2008, 8:30 a.m. to 4:30 p.m. Lunch is included.
Cost: $600 per person ($1000 if hardware is not purchased through Martindale Associates)
Limited to six (6) people
Description: Complete hands-on introduction to PAC Project automation software, SNAP PAC controllers, and SNAP I/O.

To register, contact Martindale Associates:
Phone: 978-372-2120 or toll-free (in the U.S.): 1-800-447-1191
Email: training@martindaleassoc.com
Location: 65 Avco Road, Unit M, Ward Hill Industrial Park, Bradford, MA 01835

Is This the Last FactoryFloor Training Class?

For those of you who are still using our legacy FactoryFloor software suite, here's a rare opportunity—maybe even your last chance!—to receive training.

Since our SNAP PAC System not only provides Ethernet networking but also can encompass mistic serial I/O units, many customers have begun moving their systems in that direction.

But if your system still depends on FactoryFloor, here's the class for you:

FactoryFloor class dates: June 2-5, 2008
Location: Opto 22 headquarters in Temecula, CA
Cost: $1195 ($995 for three or more students from the same company)

This class is not listed on our website. To register or find out more, please email our Training Department or call us at 800-321-6786 or 951-695-3000.


All Opto22

Request Information
  • FREE Product Brochure
  • Product Demonstration
  • PreSales Engineering Assistance

Opto 22 Product Support

Opto 22 Product Support is FREE Monday through Friday 7 a.m. to 5 p.m. Pacific Time

Product Support Numbers:

Local: (951) 695-3080
Toll-Free: (800) 835-6786
Fax: (951) 695-3017