Home
        form 1700, the PAC Control User`s Guide
         Contents
1.                   It Counter dialog box in the  If Greater Than 4   Previous Counter trat  Then Enter Text String Variable Warning Notice strategy    Put Status In Integer 32 VaridN      Count  Status       T Add Instruction  Subroutine  file name        Instruction       Variable Increase Notifics          Comment        Prompt and Type  parameters from the  subroutine define  the instruction in the  strategy            ype   Integer 32 Variable                 If   Counter v    If Greater Than     i nteger 32 Variable   Previous_Counter v     Then Enter Test  String Variable  Warming N otice v              Then Enter Test  Integer 32 Variable v     Count Status v                Adding Commands and Local Variables    Adding commands  instructions  to subroutines is exactly like adding instructions to charts  For  help  see  Adding Commands  on page 235  If you are using OptoScript code within a subroutine   see Chapter 11 for help on creating code  You can copy and paste instructions from one block to  another within the same subroutine  if you have trouble copying and pasting instructions from one  chart or subroutine into another  simply paste the entire block and then modify it     You may also need to add local items to be used in the subroutine only and discarded when the  subroutine is finished  Adding variables to subroutines is also like adding variables to charts  For  help  see  Adding Variables  on page 221     Remember that the subroutine is separate from any str
2.              Requests directory listing  nStatus   SendCommunicationHandleCommand  chFTP   dir       returns number of listings    Makes sure    dir    if  nStatus  gt   0  then   worked   firmware must nFileCount   nStatus    be version 7 1 or greater    Reads in listings to stList     Set the EOM character to 00  SetEndOfMessageTerminator  chFTP  0x00      NOTE  Each listing from an nStatus   ReceiveStrTable  nStatus  0  stList  chFTP      Opto 22 device server ends   with these hex bytes  OD vo  dotab  scer po celis   OA and is delineated from   the next by a 00    Optional  parses each for nlIndex   0 to  nFileCount   1  step 1   listing into separated GetSubstring  stList nIndex   0  17  stDateTimeStamps  nIndex       tables for  GetSubstring  stList nIndex   18  21  sTemp       1  date time stamp  first 17  characters  2  file size  next 21  characters  3  filename  remaining   characters  and removes                ntSizes nIndex    StringToInt32  sTemp     GetSubstring  stList nIndex   39  1000        nLength   GetStringLength  stFilenames nIndex      GetSubstring  stFilenames nIndex   0  nLength   2   stFilenames nIndex        stFilenames nIndex           next  the OD OA left over on the  end of the filename   Further parsing could be endif  done on the date time endif    stamps  depending on  how those values will be  used           endif    CloseCommunication  chFTP          Using Serial Communication Handles to Communicate with    266    Serial Devices    Serial c
3.             PAC Control User s Guide    311    STRING COMMANDS       312    Convert to String Commands    The five convert to string commands are typically used when printing a number to a port  The ASCII    table on  the followi    Som    ng           the following page shows how various parameters affect the string as it is converted  Note    e commands add leading spaces to achieve the specified length  These spaces are  indicated with underscores  _                                                                      e Floats  if used  are automatically rounded to integers before conversion except when using the  command Convert Number to Formatted Hex String   Command Convert to String Commands  Parameters  E e2 ke   3 28g LES   S S S  58  55 BG5_  f Bp 23 2  o  o xov   o0   o   gt  gt  E      Eoos uc 55 5L ss  ot os a Sr o rs zo zo zu  58 59    F202 9 tX r   Loa  o oo Ss fos  amp   gt  o2 os o  Eo 2  orbe Eg  gt I  gt  0  gt  2  532 Eo  gt a Or o E o        zo 2r SES o s  ge 8   3 ood      S  16 0 1 4 41800000 16 0 10 1 6e 01 1 6e 01  16 0 2 4 41800000 eee 10 1 6e 01 1 6e 01  a  16 0 1 4 C1800000 ges FFFFFFFO    1 6e 01  1 6e 01  G  o  i 1 23 1 4 3F9D70A4 1 2 1 1 23e 00 1 23e 00  12 3 1 4   4144CCCD 12 3 C 1 23e 01 1 23e 01  0 0 1 4 00000000 _0 0 0 0 0e 00 0 0e 00  16 1 4 0010 16 0 10 __16 16    16 2 4 0010 anes 10 __16 16  EJ  16 1 4 FFFO s FFFFFFFO _ 16  16     T 0 1 4 0000 0 0 0 ___0 0  1000 1 2 s s 3E8 1000 1000       Indicates an overflow  The whole number portion 
4.            To search for blocks that are not connected to other blocks  click Missing Connections         To search for condition blocks that have no instructions  click Empty Cond  Blocks   4  Click Find     The dialog box expands and the search results appear at the bottom     Search Scope     Global  O Local    Search For  OOperand   Instruction    Missing Connections     Empty Cond  Blocks   Acton    Condition    l Instruction   Delay  mSec        Chart Block Name  Flag_Example_Chart Delay 1 msec 5 Delay  mSec   Simple Error Handling C    Delay 100 msec 3 Delay  mSec      Se arc h  2 occurrence s  found     results    Block ID Command          For more information on any item in the search results  try double clicking the item     5  To save the search results to a file or to print them  click Print  In the window that opens  click  the Disk button to save or the Print button to print your search results     6  When you have finished your search  close the Find dialog box     Replacing    You can also replace any operand  instruction  or tag with a similar item  As in searching  you can  replace items in a strategy or one of its charts  or you can replace items in a subroutine     1  Open the strategy or subroutine  and select Edit  gt  Replace   The Find and Replace dialog box appears     PAC Control User   s Guide    CHAPTER 7  WORKING WITH STRATEGIES       1 Find and Replace    Search Scope        O Loca  Alarms    Search For       Operand  O Instruction    OTag    Typ
5.         Operation performed successfully              Close       See also     A  Troubleshooting    on page 361 for additional help in resolving errors     Types of Errors    As you work in PAC Control  you may see three types of errors   e     PAC Control Errors appear in dialog boxes on the computer screen     e   Queue Messages  both errors and other messages  appear in the control engine s message  queue     e Status Codes appear in variables or as returned values in OptoScript     PAC Control Errors    PAC Control errors indicate a problem within PAC Control that may have been reported by the  control engine or may have occurred before control engine communication     PAC Control User s Guide 371    TYPES OF ERRORS       PAC Control errors appear in dialog boxes on the computer running PAC Control  Some of these  errors appear as numbers  some as text  and some show both numbers and text  An example of a  PAC Control error is    Timeout  No response from device     Another example is    TCP IP  Cannot error   with an error code of  412     Queue Messages    Queue messages indicate an error or other message during strategy operation  and they appear in  the PAC Control message queue   For information on viewing the queue  see    Viewing the Message  Queue  on page 103   Here s an example of a message queue     View Message Queue for    Cookie Controller    DER     Refresh  Copy All    Pop Top Message    gt  lt  Clear All Messages      Code   Severity   Description Chart 
6.         To sort by block number instead  click the Block Id column label     Center On Block       Action  SpeedOK  Condition  Drop Dough Action  Drop Chips   Action  Start Conv    OptoScript  Back to     Continue               To sortin the opposite order  descending numbers instead of ascending numbers   click the  Block Id column label again     Some dialog boxes don t allow custom sorting  If you click a column label in these dialog boxes   nothing happens     PAC Control User   s Guide    CHAPTER 3  WHAT IS PAC CONTROL        Customizing PAC Control for Your Needs    Setting Decimal  Binary  or Hex Display Mode    You can set up PAC Control to show the values of all integers and integer tables in decimal  the  default   binary  or hexadecimal  hex  format  Binary and hex formats help you use masks  Hex view  is available in all modes  Configure  Debug  and Online     The default view is in decimal notation  as shown in the following figure     3 4    nCookie_Counter     scanning     Decimal Name  nCookie_Counted  view    Maeno       To view integers and integer tables in binary view  choose View  gt  Binary Integer Display  or click the  DEC button and choose Binary  The integers appear as shown below          nCookie  Counter   scanning     Name  nCookie_Counter    Binary view  All the bits    Value   00000000 o0o000000 00001110 00001000  l cannot be shown at once      Maeiio F       To view integers and integer tables in hex view  click BIN in the dialog box  and then 
7.         ssssssssssssssssssssssssee 249  Opening and Closing TCP IP Communication Handles n    asaue 252   TCP Communication Handle Examples                 000 c cece cece cece e eee eens 253   Using Flowcharts to Control TCP IP Communication                 eee eee e eee 254  Ethernet CONNeCLIONS arid  POMS ics see Ue dete  ations Hebden arr Pedes 256   Using the Control Engine   s File System    cesses eere teme e ee eme 257    PAC Control User s Guide       Using a File On amicroSD Card  estere repr er Pte e teme detects 258       Working with Files in Your Strategy          ssssssssssssss eens 259   Moving Elles VialE TP   2 toc cats ebore tob Ut UD tabbiadereuniam ade iaaehegetns 263  FTP Communication Handle Examples              s sss 263   Using FTP Communication Handles in Your Strategy              00    cece eee eee 264  hetrieving a Directory LISTING    eode date e PRU HER ERREUR bees 265   Using Serial Communication Handles to Communicate with Serial Devices              266  Serial Communication Handle Examples                 sss 267   Using Serial Communication Handles in Your Strategy            0 0 0    cece eee 269  Senidirig ahErtiall  Sec  cin seien ciet erroe posee Meas eh epe aah 269  Obtaining a Root Certificate for Gmail or Yahoo  Mail                        0208  270  Registering a Root Certificate on a SNAP PAC Controller           s c cece cece 270   Send Email with Attachments Example          lisse 271   Setting Timeouts for the Send Email Comman
8.        3    diDoughLevelSwitch   scanning     Mame  diDoughLevelS witch  Type  Digitallnput     G  More Info    On Latch   Wig  Off Latch   agg       Counter  0       Communication       120 Unit  E Open Parent     wach  Fo F    Scanning stops whenever you click a changeable field  It resumes once you click Apply  another  button  or an unchangeable field  If scanning resumes before you click Apply  any changes you  made are lost  Use the Clear button to immediately clear the field     Asterisks in a field indicate an out of range value  Dashes in an XVAL field indicate a  communication error     Change the fields as necessary    A    State The point s current internal value  Switch between On and Off  then click Apply   B   XVAL  The point s current external value  Switch between On and Off  then click Apply   C   On Latch Off Latch The state of the point s on and off latches     D   cCounter Internal and external feature values if the point has been configured with any  special features  such as a counter     E   Enable comm Current point status  Yes on a green background means enabled  No on a red  background means disabled  To change the status  click one of the arrows  then click Apply   To add the point to a watch window  click Watch and see page 157    To view configuration information for the variable  click More Info    To inspection I O unit s configuration  click Open Parent     Pro only  To add a plot control  click Plot     PAC Control User s Guide 143    INSPECT
9.        beam  the digital I O module tells the control engine it is off  and the control engine responds  as programmed to stamp the sheet     The pump is an example of a digital output device  Based on information from the tank level  input  the control engine turns the pump on or off as programmed     Analog points have a range of possible values  Temperature and pressure are examples of  analog information  Temperature might be any number in a range   2 or 31 65 or 70 1 or many  other possible numbers     In the Control System Example on page 44  the tank level sensor is an analog input device  It  registers the changing level of water in the tank and reports the level to the control engine   which responds by turning the pump on or off     The fuel pump is an example of an analog output device  Based on information about the  temperature in the furnace  the control engine adjusts the pressure of fuel through the pump  as programmed     SNAP Special Purpose I O Modules    In the PAC Control system  some I O modules do not contain standard analog or digital  input output points  but are used for special purposes     SNAP serial communication modules provide two channels of serial data  Through these  channels  data can be sent to and received from a serial device  In the Control System Example on  page 44  the barcode reader is an example of a serial device     SNAP high density digital  HDD  modules provide 32 channels of digital input or 32 channels of  digital output in o
10.       0 60 ccc cece teen eet eee 239  Commenting Out a COMMANG in  2a s tidcewndiis dalee RI Ee ed data dasa Re RIA teas QS 240  CUEING  OF Copyihg a  COITimlanQos vus oreet rete pese UI guns UL nete re d reds 240  Pastinc  a COMMANG xy eco qe cote evitar e Dates exti toe reb qur qi viagra 241  Configuring a Continue Blocks is Loop tbe vu S dU etta dut qoe Vanda eds dotes 241  Viewing and Printing Chart Instructions          ssssssssssssssssss nnrir rreren 241  Chapter 10  Programming with Commands                cee eee cece eee eeeeeees 243  HIM OCUIC OM ies eters E E MORTCM 243  Imtis Chapter veis ta brc deme dase dope Ue dbase tae dak ddddadsg Tb OPOd e Pedo s 243  Analog Point Commands          6  cece eee e ens 244  Offset and Gain Commands        0 00  cece cece cece ttt tennis 244  Minimuim Maximum Values sereis ei wees bene MESUCHRUONIT E PUR P ads 245  Analog Points and OptoScript Code   iss eere m eb tete OR I b ee 245  headitig or Writing Analog Poirts       oos prr eer er RERO Hed 245  Chart Command Sarnen ranee naai dU rude E bud uU e e AU M 246  About the Task Quelle  is iii csse os ette e dM eo aiid ead aided tendons 246  Communication Commands       isssssssssssssssssssssssssss e e eee nen 247  COMMUNICATION HANES 5505 erede tus sere ehe a e oot de Gured TA Ense Q3 247  Adding Communication Handles          0 0    0c cc cece cece cece eee e 248   Using TCP Communication Handles  1 ote tbt e RPoR uos Dee ene dems ee 249  Incoming and Outgoing Communication    
11.       Delete    1 0 Points       PID Loops                   116 PAC Control User s Guide    CHAPTER 6  WORKING WITH I O       2  To configure a new   O unit  click Add or double click anywhere in the box below any listed  units     The Add I O Unit dialog box appears                          tAdd 1 0 Unit  Information  A Name   B Description   Type  C Type  SNAP PAC AI  Addressing  D Primary Address  0 0 80  C  Local  loopback   E Secondary Address   F Ethemet Pott  2000        Communication from control engine  G Enable communications from control engine  H Timeout and disable communications after 3   tries of     second s  each   Device Options  l For temperature points  use degrees   Fahrenheit    Celsius             J C  Watchdog timeout after second  s  of no communications          3  Complete the fields as described in    Add I O Unit Dialog Box  below     Add I O Unit Dialog Box    Use this dialog box to add a new I O unit to the strategy or edit an existing unit     For information on saving the I O Unit Configuration  see    Inspecting I O Units and Saving Settings  to Flash    on page 140     A   Name  Enter a name for the I O unit  The name must start with a letter and may contain  letters  numbers  and underscores   Spaces are converted to underscores      B   Description   Optional  Enter a description of the unit     C   Type  When adding an 1 0 unit  select the type of I O unit from the drop down list  When  upgrading an older I O unit to a SNAP PAC brain  po
12.       Move String  From  To        Append String to String  Append  To        Append String to String  Append  To    Convert Humber to String  Convert  Put Result in    Append String to String  Append  To        Append String to String  Append    TU              lt  M     ae Jf er   lt      3  Shortcuts  ISDN Chart                  plane   sVehicle     What type of    Request          sVehicle  Request          is in stall   Request        nStall       I Instructions   String Hzndler   Parse response       i                          Building a string using  standard PAC Control can  require several commands     If substrings or individual  characters within a string  must be handled  a  standard PAC Control block  can become quite large           x              Get Substring   From String  Start at Index  Hum  Characters  Put Result in    Get Substring  From String  Start at Index  Hum  Characters  Put Result in    Convert String to Integer 32  Convert  Put Result in                Response   1   1  Classification    Response  2   2   Model    Model  Model Humber         Add               Nest Block  Previous Block                        The OptoScript version of the String  Handler flowchart is more compact  The string request can be  built more easily  and parsing the response takes up much less space  If you handle more complex  serial data than in the String  Handler example  you will find OptoScript code even more useful     320 PAC Control User s Guide    CHAPTER 11  US
13.      Resolving TCP IP Cannot Connect Errors   412     Many problems with Ethernet connections return a TCP IP Cannot Connect error  Cannot connect  errors are probably the most common communication problem with control engines  They indicate  that a TCP IP connection could not be made to the control engine within the specified time interval     If you receive this error  first check the following   e   Make sure the control engine has been turned on   e Verify that the correct IP address appears for the control engine     e Make sure your control engine has been assigned a valid IP address  These controllers and  brains come from the factory with a default IP address of 0 0 0 0  which is invalid  For help in  assigning an IP address  see the PAC Manager User Guide     e Make sure you have up to date drivers installed on your computer s Network Interface Card   NIC   Contact your system administrator or the manufacturer of the card for help     e If problems persist  you can increase the length of time before a timeout occurs  Choose  Configure  gt  Control Engines and change the Timeout  mSec  field to a larger number     Pinging the Control Engine  If you still cannot communicate with the control engine after you have checked these items  try to  reach it using the PING protocol   Choose Start  gt  Programs  gt  MS DOS Prompt  At the prompt  type   ping  control engine s IP address    For example  type ping 10 192 54 40    If data is returned from the control engine  it can 
14.      STEPS TO DESIGN           Breakdown the larger process task into sub process tasks       Breakdown the sub process tasks into detailed steps   e   estthe steps   Next  build the strategy   e     Configure hardware       Control Engines      Ounits      O points    Determine necessary variables and configure them   e Create charts  one for each sub process  and add instructions       Compile and debug each chart   e   Compile and debug the whole strategy   Finally  use and improve the strategy     Now let s take a look at each of these steps in order     Solving the Problem    You can avoid a lot of extra time and rework if you define and solve your problem before you ever  start building a flowchart in PAC Control     Defining the Problem    Suppose  for example  you want to automate a simple lawn sprinkler system  Start by asking yourself   or others  questions about the control process you re trying to do     What are you trying to do  Start with the big picture and work down to the smaller details   e     Big picture  l m trying to control this sprinkler system     Smaller details      The sprinklers should turn on every Sunday and every Wednesday               They should not turn on if it s raining     hey should start at six o clock in the morning    They need to run for 15 minutes     What inputs and data do you have to work with  List all the inputs  Describe the data they  provide  Check for any inputs or data you need but don t have                          Inp
15.     Changing the Control Engine that Receives the Downloaded  Strategy    on page 100     Once you have changed the address  when you enter Debug mode  you are communicating  through the address you chose  Downloading the strategy to a SNAP PAC controller through one of  its Ethernet interfaces replaces any strategy that was downloaded earlier through its other interface     Using Redundant Controllers    The SNAP PAC Redundancy Option allows you to configure two redundant SNAP PAC S controllers  that use the same PAC Control strategy  By utilizing sync blocks in the strategy and  persistent redundant variables  critical data is synchronized in both controllers so that the inactive  controller can take over at any time and become the active controller  To learn more about the SNAP  PAC Redundancy Option and how to set up a strategy using sync blocks and persistent redundant  variables  see form 1831  the SNAP PAC Redundancy Option User s Guide     NOTE  If your system has redundant controllers  you cannot use link redundancy between PAC Display Pro  and the controller     Changing or Deleting a Control Engine    See the following topics to change or delete a control engine    e      Changing a Control Engine5 Definition     below    e      Changing the Control Engine that Receives the Downloaded Strategy  on page 100  e      Removing a Control Engines Association with a Strategy  on page 100   e  Deleting a Control Engine from Your PC  on page 100    Changing a Control Engine
16.     Counter    Digital Output  Analog Input   Deg     Chart    OFF   272 9154    PAC Control User s Guide 159    USING WATCH WINDOWS FOR MONITORING       160    To rearrange elements in the watch window list  click the item you want to move and drag it  to a new location  or right click it and choose Move Up or Move Down from the pop up menu     You can also sort elements in the window by clicking on the column label  For example  to sort  by Type  click the label Type in the column heading  Click again to change the order from  ascending  A Z  to descending  Z A      To move an element from one watch window to another  open both windows and drag the  element where you want it  To copy an element to another watch window  so it will appear in  both windows   hold down the CTRL key while you drag it     To delete an element  right click it and choose Delete from the pop up menu   To inspect an element  double click it     The inspect dialog box opens  For information on using it  see  Inspecting Control Engines and  the Queue  on page 101     PAC Control User s Guide       7  Working with Strategies    Introduction    A strategy is the software program you create in PAC Control  A strategy is similar to a file in any  Microsoft Windows program  You use standard Windows menu items to create a new strategy  to  open an existing strategy  or to save a strategy  The strategy includes all the definitions and  instructions necessary to control your process  This chapter is a step by 
17.     Declared Name  String  1  e     Declared Width  22  e   Maximum Possible Width  1024  e Bytes of Memory Required  Declared Width   4   22   4   26   lt  Width is  gt              String_1                                                                         Length is 0          A string is referred to by its name  Initially the previous string is empty  giving it a length of zero   Later  during program execution  seven characters are added to String_1  increasing its length to  seven         lt  Width is    s  String 1  OJ P T O 2 2                                                                                            Lengthis        gt     Sample String Table   e     Declared Name  Promo  Messages   e     Declared Width  26   e   Maximum Possible Width  1024   e     Declared Length  Number of indexes  or items  in table   5  e   Maximum Possible Length  Size   1 000 000    308 PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       e     Bytes of Memory Required   Declared Width   4  x Declared Length    26   4  x 5   150                                                                                                              lt  Width is  gt   Index 0 OIPI T 2 2 S N A P PAC   S YISITIEMS  Index 1   n njo vja ijvije II O  Index 2 Die lji v eir s cloinitirio l    Index 3 pirioigiraimim a iylyiftty   a njd  Index 4 ein tleir pirjii sje cjo ninyjejc tyijvyjiljtyy    A string table is a collection of strings  Each string is referred to by the name o
18.     Note that file is all lowercase  Open modes are     r Opens a file for reading  If the file does not exist or cannot be found   the open call fails        Ww Creates a new file and opens it for writing  If the file already exists  its  contents are destroyed        a Opens a file for writing at the end of the file  appending   If the file  doesn   t exist  it is created                 Here are some examples of file communication handle values        Creates the file myfile txt and opens it    for writing  file w myfile txt       Opens the existing file myfile txt so data    can be appended to it  file a myfile txt       Creates the file Temperature data  txt in  the directory Data_files and opens it for  writing  If the directory doesn   t exist  it is  created        file w  Data_files Temperature data txt          Opens the file Temperature data txt in    the directory Data  files for reading  file r  Data files Temperature data txt                To add a communication handle  see the steps starting on page 248  In the Add Variable dialog box   enter the communication handle value in the Initial Value field     PAC Control User s Guide 257    COMMUNICATION COMMANDS       258    Add Variable  Name   Comm H andle File    Description          Ippe    Communication Handle v  Initialization  O Initialize on strategy download     Initialize on strategy run     Persistent       Communication          Initial Value   file w myfile txt          handle value    Keep the followi
19.     Now we re going to add the integer 32 variable to increment  which will be called  nCookie Counter     PAC Control User s Guide    ADDING A COMMAND       10  Click the arrow in the Name field  which currently reads bStartFlag   The drop down list shows all variables currently configured as integer 32 variables     Add Instruction    Instruction     Increment Variable       Comment      Increment a counter of cookies produced    Type Name   Integer 32 Variable  mu  nChartStatus hs  nCookieCounter    nCookieMotionPreset  nLoopCounter       nCookie  Counter is not in the list  because we never needed it before  so we never created it   We ll create it now using what we call on the fly configuration     11  Highlight bStartFlag and type the new variable name  nCookie Counter  right over it     As soon as you try to do something else  such as click OK to close the dialog box  the following  message appears     PAC Control Professional    The object you have specified does not exist   Do you wish to add it now     Yes No Cancel          12  Click Yes     Add Variable       Name    nCookie_Counter          Description          Type    Integer 32  Initialization  O Initialize on strategy download     Initialize on strategy run     Persistent Redundant    Initial Value   0          Notice that the name  nCookie_Counter  and type  Integer 32  have already been filled in     13  Add a description  if you wish  Leave the initial value at zero  which is the default  Then click OK  to 
20.     OPE pha Meout this parameter out to use the default of 30 seconds              Here are two examples of FTP communication handle values        ftp 10 22 55 35 21 jsmith 2towers 60  timeout increased to 60 seconds   ftp 10 192 54 195 21 m m  no timeout specified     To add a communication handle  see the steps starting on page 248  In the Add Variable dialog box   enter the communication handle value in the Initial Value field     PAC Control User s Guide 263    COMMUNICATION COMMANDS       Add Variable       Name  Comm Handle FTP       Description   Type  Communication Handle w  Initialization  O Initialize on strategy download       Initialize on strategy run     Persistent       Communication    Initial Value   ftp 10 22 55 35 21 jsmith 2towers 60  handle value                  Cancel Help       Using FTP Communication Handles in Your Strategy    Suppose you have data you need to send via FTP to a device on the network whose IP address is  10 192 56 45  Your username on this device is JoeG and your password is hello  You expect the  default timeout of 30 seconds to be adequate     There are two ways you can send the data  all at once  or in pieces over time  If your data file is less  than 1 MB in size  you can send it all at once  If it is larger  or if you want to append additional data to  a file that already exists  you send it in pieces     Sending or Retrieving the Data All At Once  This method is better for small data files  files  larger than 1MB may take a long
21.     cece cece eee teen ences 365  PINGING THE Control Engllte    cierres tere Raed woe pO E Lane oun eres 365   Other Troubleshooting TOIS  ii vies 229 Seiad Can a deas Woh Gian b ee eaters 366  Checking Detailed Communication Information Using PAC Message Viewer            366  Checking File Versions for Opto 22 Software was acia da cca i bane daa Qao dades d 368  Problems with Permissions in Windows         ics 369  Appendix B  Errors and Messages                   esee 371  IMU OCUCTION ECCE 371  jd  MCCC HET 371  PAC CORBLUOLEITOIS  i acdvnsingsid Pret Reb UID dare eta M re deeds 371  Queue MESSAGES POET 372  Using  QUEUE Messages    eem neret rer Ep epe n reete bcr e Pn eda 373   Status C Odes    cseteris mere r  ntebhes vetas tdaneetest datei be verbe de egenis 373  Naming MIN erm e MEDIEN E EEUU 373  SET COMMIS SACS Las agio VR Ra eto Roa Bone OK ah eles on nd 373  Appendix C  PAC Control Files  lt cs sasneises cede VERA EYE ET E ERES VER 381  IAL OCUCTION prr 381  niles  Related toa Strategy  cic cme cna ver tece daere verte Paper qe veio Pads the Hee 381  PIES ASSOCIATE witha SUDIOULING  i    carne EIER OPERE DISSR A PPS Yi eeke EES 382  Files in the PAC Control Directory         sssssssssssss e eee eeeeeeeeeeeees 382    PAC Control User s Guide       Appendix D  Sample Strategy              cece cece e cece cece cece enne 383    W e tate ether Rei he oe ian Peete tii te width aa AC at  383  Factory Sene maian a e co p oed gei red artius eir 383  D  scription ot the 
22.     eee 67    About PAC Control    PAC Control is a programming language based on flowcharts  Whether you have PAC Control Basic  or PAC Control Professional  you use PAC Control to develop software that monitors and controls all  kinds of equipment and sensors  from a simple heating system to a complex factory  The software  you develop controls the Opto 22 hardware that runs your heating system or factory     The diagram below shows how PAC Control on your PC can work with the hardware in your control  system  This example shows a small system  yours may be even smaller or considerably larger and  more complex  The diagram uses a SNAP PAC S1 as the control engine  Input output  I O  points on  the subordinate SNAP PAC I O units monitor and control the analog  digital  and serial devices  connected to them  All these terms are defined in the following pages     PAC Control User s Guide    ABOUT PAC CONTROL       Control System Example          PAC Display  Viewing  Trending   Alarming    PAC Control  Programming   Debugging          SNAP PAC S series  if controller   if   Runs strategy    i  controls all 1 0    SNAP PAC A  1 0 unit   lt A            Fuel Pump  alog output     Furnace  Temperature SNAP PAC   Thermocouple  1 0 unit            Analog input        Pump  On or Off    Digital output           SNAP PAC  1 0 unit    PAC Control User   s Guide    CHAPTER 3  WHAT IS PAC CONTROL        General Control Concepts    Automation    Automation is a way of adding intelligence
23.     ie          Ethernet switch   network  2    Ethernet switch   network  1    SNAP PAC S series controller  controls all I O units       x           gu  and actuators   location  3    Sensorsandactuators   location  2    Sensorsandactuators   location  1          Configuring Ethernet Link Redundancy    Ethernet link redundancy from PAC Display Pro to a control engine is easy to configure  First  make  sure the secondary IP address has been assigned to the controller in PAC Manager  Then in PAC  Control  just enter both the primary and secondary IP addresses when you configure the control  engine  see page 89   Once you have set up link redundancy for the control engine you are using in  your PAC Control strategy  it works automatically in PAC Display     To configure link redundancy from the control engine to I O units  enter both the primary and  secondary IP addresses when you configure the I O unit  see  Adding an I O Unit  on page 116      EJ PAC Control User s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES          Using Strategies with Link Redundancy    Although PAC Display and OptoOPCServer  as the PAC Display Pro scanner  automatically shift to the  secondary address when the primary address is not available  the PAC Control debugger does not  In  PAC Control  you control which address receives communication  so you know exactly how  communication is occurring during debugging  To change between primary and secondary control  engine addresses  follow the steps in
24.     lt strategy gt   lt control engine gt  cdf     lt chart name gt  cht   lt chart name gt  ccd   lt chart name gt  con   lt chart name gt  cxf   lt filename gt  wth     lt filename gt  otg     lt strategy date time gt  zip    PAC Control strategy database   Controller Run File  compiled file that is sent to the control engine   Intermediate run file  compiled file that is sent to the control engine   Intermediate run file  component of the run file    Intermediate run file  component of the run file    Intermediate run file  component of the run file     Initialization data for variables with  Init on Download  option  com   ponent of the run file     Strategy configuration information   Temporary PAC Control strategy database file  PAC Control strategy database lock file  Persistent variable definitions    Control engine download file for special circumstances   see page 172     Chart   Compiled chart code  component of the run file   Online compiled chart code   Exported chart file   Watch window file  you name the file    Exported I O configuration file  you name the file     Strategy archive file  automatically named  see    Archiving Strate   gies on the Computer    on page 166 for file name formats     PAC Control User s Guide 381    FILES ASSOCIATED WITH A SUBROUTINE       Files Associated with a Subroutine     lt subroutine name gt  isb Subroutine   lt subroutine name gt   ini   lt subroutine name gt  isc     lt subroutine name gt  lisb Subroutine lock file    Files
25.     oh L   0          oh     g  uU  g zu     u  gzu jueuuuBisse oueuinu  Il Il i Il jueuiuJo9 aui      Ie al e qejie e JON Ie d JUBLULUOD 490 q  V  i e qejeAe JON ia JojoeJeuo  01194  4Oll9u    Ol 9U    Oll9u  Buys  Ly 3v   7L LV 3v  2 V 8L43v   2  L LVe3v    ZL  9ynueros  yeoy  vec vez vez vez  pyepuejs  eoj  OAVETL PILDAVETLXO Jo TIOGVETLXO e qeireAe JON PIIOAVETLXO  jeuoepexeu  9 1e6ejut    cl POIETL Jo VIEZLI e qejie e JON votez  ieuuroep  v9 1e5e1ul  oO8VEcL OAVETLXO O8VECLH OAVETLXO  jewloepexey  ze 1e6ejut  EZL EZL EZL EZL  ewp  ze 1963                  uosueduio    uon  unj       ie   ES      OO  2A   D  e      pe  i     o  CJ  UO   e       APPENDIX E  OPTOSCRIPT LANGUAGE REFERENCE        e x    YS X          444400009 pue x          Z    gt  gt X     444340000X0 9 X       e qeje e ON  44440000H  puy x         Zl   gt  gt X       44440000X0 pueyg x        suoisseJdxe esiwiq                      A Jus x     lt  lt  X 9 qe IeAe JON     lt  lt  X juBu yys   s  myq     us x       X aiqeyiene ON       X Y   PYS esiwiq  K 10X X   yX K 10X X    10X q X YOX esimyiq     pue x ARX    puy x A pueilq x QNV esq    JO X K x KJO X    JOjq X      30N 88S  YO BsSIM IG  X Jou X  X JON X Jou  q LON 95IAulq         g  lt  gt  A   40  0  lt  x   ou   g   A  pue  0   lt  x           i A  Il  0  lt  x  i     g    A  99  0   lt  Xx            lt  gt  A  10  0  lt  X 19N        A  puy  0   lt  x       g  A Jou s0 Q lt x   Jou          A  pue  0   lt  x     suoissaJdxo  e2180         Ajuo suee
26.     sGreeting    Hello        sGreeting 5           sGreeting 6           sGreeting  7  sGreeting  6      A character element of a string variable may be treated like  an Integer 32 value     nNumber   sString2 1    sString2 2      The   operator is used to paste strings together  There is no limit to the number of   operators you can use ona  line  The   operator must be used in an assignment statement     sStringl    Hello     sString2    world    sString3    I      After the three lines above   same result     the following two lines would produce the    sString4   sStringl   sString2   sString3   sString4   sStringl    world    sString3     PAC Control User   s Guide    CHAPTER 11  USING OPTOSCRIPT       Use the    operator to append one string to another and change the value of one of them into the result  In the  following example  the value of sName would change to    Smith  John     sName    Smith       sFirstName    John     sName     sFirstName     The Chr   keyword can be used to convert a numeric value into a one element string     sString5   sStringl   sString2   Chr        sString5   sStringl   sString2   Chr 33      Working with Pointers    The use of pointers is an advanced programming technique that is very powerful  For more  information on using pointers  see    Pointer Commands    on page 303     NOTE  Except for the equal operator       the comparison operators  see page 334  can be used only with  anumeric expression  They cannot be used with a null whic
27.    Description                Iype    Communication Hande         Initialization  O Initialize on strategy download     Initialize on strategy run     Persistent       Initial Value    ser 0 115200 n 8 1 Communication  handle value                   Method 2  Using keywords  this method offers more flexibility  For example  use this method if  you want to specify RTS   CTS on a serial port on a SNAP S series or R series controller  Keywords  may be used in any order  Each keyword must be lowercase and followed by an equal sign and a  value  with no spaces  even after commas   as shown in the following examples     ser port 0  baud 115200  data 8 parity n  stop 1 rts cts 0          ser  baud 115200  data 8 parity n rts cts 1 stop 1 port 0 timeout 1 5    In the Add Variable dialog box  enter the communication handle value in the Initial Value field   Due  to the long value  part of the value is hidden      Add Variable  Name   Comm H andle FTP             Description             Type    Communication Handle v       Initialization   O Initialize on strategy download      Initialize on strategy run   O Persistent  Communication  handle value       Initial Value   serport 0 baud l 15200 data 8 parityzn s               NOTE  You must include at minimum the port number and at least one parameter  Otherwise  it will not  Work     The keywords and possible values are     The ports available depends on the controller type  For a list of  port 0 1 2 3 available ports  see the documentat
28.    Err  TermP   Err    TermI   TuneI   ScanTime   Integral   TermD    TuneD   ScanTime      PV   PV1        Ideal    or ISA Algorithm   Output   Span   Gain     TermP   TermI   TermD         Parallel    Algorithm     Output   Span     Gain   TermP   TermI   TermD         Interacting    Algorithm   Output   Span   Gain     TermP   TermI       1   TermD         302 PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Pointer Commands  The following commands are used with pointers   Clear Pointer Move to Pointer  Clear Pointer Table Element Move to Pointer Table  Get Pointer From Name Pointer Equal to NULL     Move from Pointer Table Element Pointer Table Element Equal to NULL     See also       Understanding Pointers    on page 303     Advantages of Using Pointers    on page 304     Referencing Objects with Pointers    on page 304    Understanding Pointers    Like integer and float variables  a pointer variable stores a specific number  However  the number is  not data   it is the memory location  address  of data  The pointer    points    to data rather than  containing the data     A pointer in PAC Control can point to many different types of objects   e     Another variable   e A digital point or object   e An analog point or object      Anl Ounit   e Achart     Pointers cannot point to other pointers  however  If you try to move a pointer to a pointer  PAC  Control just duplicates the existing pointer     The following table lists the objects that point
29.    munication handle you are using     Unable to lock a resource  such as a variable  for exclusive   37 Timeout on lock  i iS      writing within the timeout period    38 Timeout on send  Unable to send communication in the timeout period    39 Timeout on receive  Unable to receive communication in the timeout period   Invalid limit  on string index  task state  prior  A character number greater than the length of the string was   42 ity  etc   used  or the string had a zero length   or an invalid value  Deep was passed when setting the state of a chart  running  etc    String less than 8 characters used to read time   44 String too short    hh mm ss    or not 8 or 10 characters for a date  or zero  length on a string function    45 Null string  Attempted to use an uninitialized string   String not 8 characters long when setting time  or invalid for    46 Invalid string  mat when setting date  or invalid communication handle  string or comm handle command  such as a missing colon     47 Invalid connection  Devige drivers might be Attempted to open an already open connection   missing or not loaded running    49 No more connections aa available  Maxi No more sessions available for Ethernet   mum number of connections already in use   Open connection timeout  Could not estab  aai   50      ZA   i Unable to open a connection in time   lish connection within the timeout period   Attempted to close a connection that wasn   t opened  Com    52 Invalid connection   not opened  muni
30.    system    INIT      NZA N A   aiven    15 02 03     08 05 07   700 Warming PID Loop 0 has been configured outside of      system  _INIT_    N A N      Mixed L   15 02 03 09 05 07   13 Error Overflow error  Dough Chip Co    17 N     null  15 02 21 09 05 07   13 Error Overflow error  Dough_Chip_Co    17 N A  nul  15 02 21 09 05 07    Number of messages  12       2  To see all the information in the column  drag the edge of a column heading  See  Message  Queue Information  below     3  To see all of the information for one message  double click the message     PAC Control User s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES             View Message Queue for    Cookie Controller          Refresh    3 Copy all    Pop Top Message    gt  lt  Clear All Messages                     Code Severity Description Block Line   Object   Time  Device has powered up   Power    JN A            N A  Local 1     16 20 26  1  700 Warning PID Loop 0 has been confiaured ok     N A N A Local l   16 20 26        539 Info 140 error  pey   539 Info 120 error  pe   58 Error No data reca             Message Details                moe wh       534 Info Attempt s  to CODE   4   93 Info 120 Unit not SEVERITY  Info  DESCRIPTION  Device has powered up    Powerup clear expected  message  received    Number of messages  7 CHART    system  INIT I0   L  BLOCK  N     LINE  N       OBJECT  Local IO I 70 Unit  127 0 0 1   TIME  16 20 26  DATE  09 25 07       4  To refresh the display with the latest messages  
31.   961 ABC  965 would expand to something like aaABC_473   Click OK    In the Configure I O Points dialog box  click the plus sign next to the new module to expand it     PAC Control User s Guide 123    ADDING 1 0 POINTS       Notice that the module icon is color coded to reflect the type of module being configured   white for digital DC input  red for digital DC output  yellow for digital AC input  and black for  digital AC output     Configure I O Points          1 0 Unit  Sprinkler Control   Type   SNAP PACRT       Module icon    Expand or collapse points  on the module by clicking  the   or   sign in the box        Points  Copy To  gt     Expand All    Collapse All       10  Highlight the point you want to configure and click Add   11  Complete the fields as described in    Add Digital Point Dialog Box    below   12  When you have completed the fields  click OK   The new point appears in the list  Here is an example of how it might look on a SNAP I O unit     1 Configure 1 0 Points                120 Unit    Sprinkler Control SNAP PAC R1    Modules and Points Features   Subty       E Lt  00  SNAP IDC5D  2 5   28 VDC Digital Input    re Switch DO ENENENNLCUTNNESNO C0  ru Not ed      Delete             I        lot Used  J    ed Move To       CopyTo  gt     Expand All    Collapse All       NOTE  If you need to add several similar points  see  Copying a Configured I O Point  on page 131     PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       Add Digital Point Dial
32.   Block 1  If the conditions in Block 1 are true  Block 2 is executed next  If the conditions in  Block 1 are false  Block 0 is executed next     PAC Control User s Guide    CHAPTER 8  WORKING WITH FLOWCHARTS       New_Chart    G  Shortcuts   100  v          Adding Text    One of the best places to put comments about a strategy is directly on its flowcharts  Start with the  chart open and the strategy in Configure or Online mode        1  To add text to a chart  click the Text tool   4    When you move the mouse onto the chart  a rectangle representing the text area appears    2  Click the mouse button and type your comments   If you type in more text than the text frame holds  it expands in length    3  When you have finished typing  click anywhere on the chart outside the text frame   The frame becomes invisible  and only the text appears  To change the size or shape of the text  block  see  Resizing Blocks or Text Blocks  on page 212    4  Click in another location to create another text frame  or release the tool by right clicking in the  chart or choosing another tool from the toolbar    Editing Text   1  With the chart open and the strategy in Configure or Online mode  click the Select tool L     2  Double click the text block you want to change   A blinking cursor appears at the beginning of the text    3  Change the text as needed   You can use any standard Windows CTRL key combinations when editing  including CTRL arrow  keys and CTRL  HOME or END for navigation  You
33.   Close the  dialog box    Click inside the Oven  Inspection  Control chart to make it the active chart  and then click the  Auto Step Chart button     You see three blocks being processed  Speed OK   Oven On  and Reject Cookie  The strategy  doesn t move into the Blow Off block  That s because an inspector has to flag bad cookies  but  we don t have an inspector right now  So we ll simulate what would happen by tripping the  digital input that flags a bad cookie     In the Oven Inspection  Control chart  click the Auto Step Chart button again to stop auto  stepping    Step Auto changes to Step Off in the status bar    Click the Pause Chart button    Step Off changes to Step On    Click the Breakpoint tool     and click once on the Blow Off block    A breakpoint hand appears on the block     Click the right mouse button or press ESC to release the tool  Notice that Break On now appears  in the chart status bar          Click the Breakpoint tool and click once on the Blow Off block     A red box appears around the Blow Off block  and Break On now appears in the chart status bar     The Powerup chart starts  this chart     While conveyor speed  is out of spec  set oven  temperature to 200  degrees     Set oven temperature to  450 degrees     If inspection station sees  a bad cookie  open reject  valve for 0 5 second                             G Shortcuts  100  v                pip  Chart      a a    ee Dough Chip Control ba   ven Inspection Control       Click the Dough  Chip 
34.   Each block has only one exit point  It is not possible to use return to jump out of the current  block     More About Syntax with Commands    As noted in the previous sample  arguments for a command are listed in the parentheses following  the command  Arguments are listed in order beginning with argument 1  To find out the arguments  for any command  see the PAC Control Command Reference or online command help     SetDownTimerPresetValue  60 0  Minute Timer     command  argument 1  argument 2   EnableIOUnitCausingCurrentError     command  no arguments     There are two types of OptoScript commands  procedure commands and function commands     Procedure commands accomplish an action and return no value  Here are some examples   RemoveCurrentError        ClampInt32TableElement  10  0  5  x1     Function commands return a value from their action  so the value can be placed somewhere  In  the following examples  the value is placed in the variable at the beginning of the statement   nMonth   GetMonth       fSquare Root   SquareRoot  99      nPosition   FindCharacterInString  S   0  sName      When you compare these examples to the identical commands in standard PAC Control  you ll  notice that the returned value for the standard PAC Control command is an argument  In OptoScript  the returned value is not an argument  thus reducing the number of arguments by one  In the first  example  the standard command Get Month has one argument  which is where the result is placed   The Op
35.   I O Unit   Memory Map Commands           22 6  e tenet en ee es 290  I O Unit   Scratch Pad Commands          isse 291  Logical COMMANS   use tie e Ee tO pet etx PRO Pep U prete georted eset 293  Understanding Logical Commands           0 00 nsus 00 cece ccc eee ee 293  Logical True and Logical False           eee ete et ens 294  Mathematical Commands osten ta UR edt aestu du ues d eamus d dd dita unti 295  WSU Ite ges eie atre te repite a rte t oe ue etie are e etit rede 295  Controlling ROUnNdiINg s  25  cori uper dede So bnt et Feed ded ue emus 295   Using FLOATS TT  IDA 295  Float Issues and Examples              00 ccc cece eect teen nett EN eee 296   Helpful Links for More Information             sss 297   Mixing and Converting Integers and Floats 2 2 0    00  ccc cece eee c cee cee neces 297  Miscellaheo  s Comards     seen iees rene tav tee Reeve reset un tbe Deut to ke 299    PAC Control User s Guide       Comment Commands            cc cece cece eee eras 299             PID   Etlierri  E COMMANGS   eei rie E aa nites PEERU IRE pis ecole 300  Whatisa PID  RERUM 300  PID Loops on VO Unlts z   3 ie REED OPERE HORE 301  Algorithm Choices  PID  pe 1 ote tte hire a e ph bte ead 301   Pointer Command Se   asso ees p ee iet Coe eroi A o botadee ex Dane dd 303  Understanding Poltitels   avoue x eei deem ue epar px e TRAMA et did Ud 303  Advantages of Using Pointers           0 0    ccc ccc eee eee eee 304  Referencing Objects with Pointers       isis 304   Simulation COMMA
36.   If the devices communicating with each other are all SNAP R series  be careful not to have one of  them send information to another faster than the receiving system can pull it out of its receive  buffer  When a control engine receives data from the Ethernet network  it holds the data in memory   the buffer  until the PAC Control flowchart removes it with a Receive command  If the data is not  removed fast enough  the receive buffer will fill up  You can prevent this problem by transmitting  the information less frequently  If the same chart is transmitting and receiving  you can alter the  chart so that it receives more often than it transmits     Ethernet Connections and Ports    The number of Ethernet connections available varies by hardware  type  and in some cases firmware  version  such as 80 on current SNAP R series I O systems     The host connection is on port 22000 or 22001 and is used to communicate with the PC that runs  PAC Control  These port numbers are reserved for this purpose  but they can be configured  For  information see Opto 22 form 1704  the PAC Manager User s Guide     Peer to peer connections can be on any other port number that is not already used on the network   these connections are used to communicate with other control engines or other devices on the  network  When you assign port numbers for peer to peer connections  make sure you do not assign  port numbers that devices on your network may use for specific purposes  For a list of standard  
37.   PAC Control User s Guide 103    INSPECTING CONTROL ENGINES AND THE QUEUE       PAC Control Professional    Counter    E File Edit Control Engine Debug Chart Subroutine Mode Tools View Watch Window Help    EETEITTENENE 89 0m 05 03525    Cookies          1 z  ga Previous_Count    ga Status    ga Total_Count        String Variables      Pointer Variables      Communication Handles       Numeric Tables      String Tables      Pointer Tables  E    10 units       AAR A        C3 Points  DO_Switch  Sprinkler_Switch       Alarm  LED_DS  PID_Output  Refrigeration    PID_Input    Tamnnvak wn Ten    a                     SRE 28 T8 Te                JL Next 4r Prev    C  Program Files Opto22 PAC Project 8 1 Control Pro Examples ioCookies Cookies Er                   Messages have been placed in the queue     To see the message queue   1  Click the INFO  WARNING  or ERROR box     View Message Queue for    Cookie Controller       P Refresh   3 Copy all    z Pop Top Message    lt i Clear All Messages      Code   Severity   Description _     thm Block Line   Object   Time   Date         4 Info Device has powered up    Powerup clear e      system    INIT      NAA N    Mixed      15 02 03     09 05 07   35 Warming 1 0 point mismatch  a configured point doe      system  _INIT_    N    N A aoOven    15 02 03 09 05 07        35 Warning 1 0 point mismatch  a configured point doe      system  _INIT_    NZA N A   aoConv   15 02 03 09 05 07   35 Warning 1 0 point mismatch  a configured point doe   
38.   Pointer Variables   E Communication Handle       Numeric Tables      String Tables   C3 Pointer Tables   amp   c 1 0 Units                           gt  Jychart                            JL Next 4  Prev gx   Pwu   E  PAC Control  Ready  P vV   H  White tabs show where you ar   Gray tabs show open windows  Click a  when stepping through a chart tab to bring its window into view     or subroutine     The upper layer of tabs appears when you are stepping through your strategy in Debug mode  It  acts as a kind of call stack to let you see how you got to the current block or command     PAC Control User s Guide    CHAPTER 3  WHAT IS PAC CONTROL         i File Edit Control Engine Debug Chart Subroutine Mode Tools View    Watch Window Help    Sl x    Pi Conic SY debuo 8 0m s 507  5              C3 Sprinker Control         Control Engines  u Sprinkler Controller     Subroutines Included        Charts        Variables      Ej Numeric Variables      String Variables      Pointer Variables      Communication Handles   Cj Numeric Tables      String Tables      Pointer Tables        Yo units    GA Mixed IO Unit     E Points    amp  PIDs              lt   gt     ES  ereak on oe w v    Chart Action Block      increment Counter    Id  7 ubroutine  Variable Increase Notification                G Shortcuts                   4  41  gt  IP             v  Jb Next       4r Pr        e Messages  k   S Variable Increa       o Count Watch    ee Counter Powerup       PAC Control  Ready    Click the
39.   Put Status In Integer 32 Varia        Not Available       1  2  3  4  5  5   lt           In this dialog box you determine the way the subroutine is called from the strategy    2  From the Group drop down list  choose the command group you want the subroutine to  appear in   For example  if you create a subroutine to find the average value of several variables  you could  choose Mathematical as the command group  The default group is Subroutines    3   Optional  Enter a comment to explain the purpose of the subroutine    4  Notice that one parameter  Put Status In  has been automatically entered for you   This parameter is used to return status information on the subroutine  and it always appears at  the bottom of the parameter list  A subroutine essentially becomes a command within a chart   subroutines are similar to function commands that return a status  Since the system itself    returns this status parameter  the name of the status parameter is not available in the  subroutine  When you add the subroutine to a strategy  you choose the variable the status will    be placed in     PAC Control User s Guide 351    CREATING SUBROUTINES       IMPORTANT  Make sure you always check returned status codes for all subroutines  Subroutine  status codes and their meanings are        0 Success     67   Out of memory        69   Null object error  Make sure you are not passing a pointer that points to null            72   Nesting too deep  future use              5  For each paramet
40.   Renaming a Chart                         1  Make sure the strategy is in Configure mode and that the chart you want to rename is the  active window   2  From the Chart menu  choose Rename   I Rename Chart  Description   Controls sprinklers for the front lawn   3  Enter anew name and description  optional   Click OK   The chart is renamed   Deleting a Chart    You can delete any charts except for the Powerup chart  However  you cannot delete a chart if it is  called or used by another chart in your strategy     1   2     Make sure the strategy is open and in Configure mode   In the Strategy Tree  right click the name of the chart you want to delete and choose Delete  from the pop up menu  Or  if the chart is the active window  choose Chart  gt  Delete     At the confirmation message  make sure you are deleting the correct chart   CAUTION  You cannot undo a deletion     Click Yes to delete the chart     The chart window disappears  if it was open   the chart is removed from the Strategy Tree  and  the strategy is saved     PAC Control User   s Guide    CHAPTER 8  WORKING WITH FLOWCHARTS       Printing Charts    You can print any flowchart  To print a chart as it appears on the screen  see    Printing Chart or  Subroutine Graphics    on page 184  To print commands  instructions  for the chart  see    Viewing and  Printing Strategy or Subroutine Commands    on page 187     Exporting and Importing Charts    To copy a chart to another strategy  you must export it as a PAC Control
41.   To create a bend or elbow in a connection  click wherever you want the bend while drawing  the connection     For example  to draw the connection in the following figure  we selected the Connect tool   clicked Block 0  moved the cursor out of the block to the right  clicked at point A  clicked again  at point B  and then clicked the right side of Block 1     PAC Control User s Guide 207    WORKING WITH CHART ELEMENTS       208    New_Chart     G Shortcuts   100           4  While you re still drawing a line  to delete an elbow you don t want  click the right mouse    button once to undo it     If you created several elbows  you can eliminate them in reverse order with repeated right  mouse clicks  If no more elbows remain and you right click again  you delete the connection   Once you have completed a connection  however  you cannot undo it this way     Condition Blocks    1     To connect a condition block to the next block in a program sequence  click the Connect tool  t  Click the source block     Select Connection Type    True Connection False Connection Cancel       Indicate whether you are drawing the True connection or the False connection  and then click  OK     Click the destination block you chose  True or False     The connection is labeled T or F depending on its type   Draw another connection to the second destination block   It is labeled the opposite exit type     For example  the following figure shows the True and False connections from the condition  block
42.   and ending with an asterisk and a slash         This type of comment may span multiple  lines  Block comments may not be nested    Examples    i   a   b    determine i by adding a and b together      i   a   b     determine i by adding    PAC Control User   s Guide    APPENDIX E  OPTOSCRIPT LANGUAGE REFERENCE       a and b together        i   a b     determine i by adding a and b together       OptoScript Grammar Syntax Reference    Tokens are in regular type    Keywords and operators are in bold type   Syntax Rules are in italic type    Program    gt  StatementList    StatementList   gt  Statement   gt  StatementList Statement    Statement    gt  AssignmentStatement    gt  StrAssignmentStatement   gt  PtrAssignmentStatement   gt  Procedurecommand    gt  FunctionCommand      gt  ConditionStatement    gt  ForStatement    gt  WhileStatement    gt  RepeatStatement    gt  SwitchStatement    Procedurecommand   gt  CommandProcedureNoArgs        gt  CommandProcedure  ArgumentList        FunctionCommand   gt  CommandFunctionNoArgs         CommandFunction  ArgumentList      ArgumentList      NumericExp    gt  ArgumentList   NumericExp      Stridentifier    gt  ArgumentList   Stridentifier      ObjVarldentifier      ArgumentList   ObjVarldentifier    NumericExp       NumericExp       NumericExp      LogicalExp      LogicalUnaryExp    PAC Control User s Guide    OPTOSCRIPT GRAMMAR SYNTAX REFERENCE        gt  AdditiveExp    gt  MultiplicativeExp    gt  BitwiseExp    gt  Numidentifier  
43.   click the Font box  In the Font dialog box  change the  font  font style  size  effects  and color  The default font is black 10 point Arial bold       To change text alignment  right click the Font box and choose left  center  or right from the  pop up menu        e To change the color of connection lines  click a Connection line at the far right  Choose the new  color from the Color dialog box     C   Text  Define width  height  and font of text blocks that appear as comments in a chart or  subroutine  Default width is 192  default height is 128  the minimum for both is 16  The default font  is black 10 point Arial bold        D   Also Apply To  To expand the scope of the changes you ve made  click these boxes  Click  PAC Control to apply the changes to all new strategies and subroutines in PAC Control  Click Strategy  to apply the changes to all new charts in the current strategy  Click All Charts to apply the changes  to all new charts and all new graphic elements added to the current strategy     Depending on which dialog box you are in and what is currently open  one or more of these options  may be grayed out  For example  if you are in the Configure PAC Control Default Properties dialog  box  it is assumed that the changes are to be applied throughout PAC Control  and that option is  therefore grayed out     E   Reset All  To reset all parameters and options to their factory default settings  click Reset All     Changing Existing Elements to Match New Defaults  Once
44.   control engine 89  I O points 122  I O unit 113  mistic I O units 114  PID loop 134  301  serial module 130  subroutine parameters 350  table variables 224  variables 221  connection line  changing color or size 203  212  definition 203  deleting 211  drawing 207  moving 210  selecting 210  constant  See literal  continue block  command  instruction  241  configuring 241  definition 203  control characters  adding to string 308  control concepts 45  control engine  active control engine 100  archiving strategies 106  changing definition 99  changing the active control engine 100  commands  instructions  280  configuring 89  definition 45  deleting from strategy 100  download file  creating 172  hostname 92       PAC Control User s Guide     Es        inspecting 101  IP address 92  moving to another PC 109  removing association with strategy 100  restoring archived strategies 108  testing communication 364  viewing message queue 103  control network  segmenting from company network 93  control structures  in OptoScript 336  control system example 44  controller  See control engine  converting a strategy 373  converting IEEE float 296  copying  block 211  chart 213  command  instruction  240  241  configured I O point 131  connection line 211  I O configuration 115  text block 211  count variable programming example 81  counter  commands  instructions  282  CRC commands 280  creating  flowchart 201  PID loop 134  strategy 161  subroutine 348  349  watch window 157  See also c
45.   e Serial messages sent through a serial communication module to a serial device  e Streamed data sent to a device for processing by a software application     I O Unit   Event Message commands are commonly used to find out the state or text of an event  message  or to set its state  Event messages can be in the following states     e  Active   The message has been triggered by the event  If it was configured to be sent just  once  it has been sent  If it was configured to be sent at intervals  it is continuing to be sent     e   nactive   The message is not currently triggered by the event     e Acknowledged   The message has been triggered by the event but has been acknowledged  by the receiver so it will not be sent again   Acknowledgments occur only if the receiving  application writes them to the brain s memory map   Acknowledged is functionally equivalent  to Inactive  but can be useful in some cases to determine whether the receiver has received the  message     The command Set I O Unit Event Message Text is used to dynamically change a message or to   recycle  a message if you run out of event messages on an I O unit  128 event messages are  available for each I O unit   For more information  see individual commands in the PAC Control  Command Reference or online help     PAC Control User s Guide 289    I O UNIT   MEMORY MAP COMMANDS       I O Unit   Memory Map Commands    290    The following commands refer to the memory map in an Opto 22 memory mapped device  eithe
46.   gt  NumericLiteral    gt  FunctionCommand  LogicalExp    gt  NumericExp and NumericExp   gt  NumericExp or NumericExp   gt  NumericExp xor NumericExp   gt  NumericExp    NumericExp   gt  NumericExp  lt  gt  NumericExp   gt  NumericExp  lt  NumericExp   gt  NumericExp  lt   NumericExp   gt  NumericExp  gt  NumericExp   gt  NumericExp  gt   NumericExp   gt  Stridentifier    Strldentifier   gt  PointerVariable    null    gt  null    PointerVariable    gt  null    PointerTable   NumericExp     gt  PointerTable   NumericExp      null  AdditiveExp    gt  NumericExp   NumericExp    gt  NumericExp   NumericExp       MultiplicativeExp    gt  NumericExp   NumericExp   gt  NumericExp   NumericExp   gt  NumericExp   NumericExp       NotNumExp   gt  ObjVarldentifier   gt  Stridentifier    BitwiseExp    gt  bitnot NumericExp    gt  NumericExp bitand NumericExp   gt  NumericExp bitor NumericExp   gt  NumericExp bitxor NumericExp   gt  NumericExp  lt  lt    NumericExp   gt  NumericExp  gt  gt    NumericExp    AssignmentStatement      NumericVariable 2 NumericExp      gt  NumericTable   NumericExp     NumericExp       StringVariable   NumericExp   2 NumericExp      PtrAssignmentStatement   gt  PointerVariable   Pointableldentifier      398 PAC Control User   s Guide    APPENDIX E  OPTOSCRIPT LANGUAGE REFERENCE        gt  PointerVariable   PointerTable   NumericExp       gt  PointerTable   NumericExp     Pointableldentifier      Pointableldentifier      null       amp StringVariable    gt   
47.   may want to see    Notes to Experienced Programmers    on page 392     In this Chapter   About OptoScript  nccesesssssssssssesssssseesssessssssssssseeees F17  When To Use DDIGSCHBL  ct 318  OptoScript Functions and Commands            326  CDS CEU SW  etc 327  OptoScript Data Types and Variables               328  OptoScript Expressions and Operators             333  OptoScript Control Structures    336  Using the OptoScript Editor    340  Troubleshooting    Unable To Find    Errors          344  Troubleshooting Syntax Errors                         344    Debugging Strategies with OptoScript           346    About OptoScript    OptoScript is a procedural type of computer language similar to Pascal  C  or BASIC  It can be used  within any PAC Control strategy or subroutine to replace or supplement standard PAC Control    PAC Control User s Guide 317    WHEN TO USE OPTOSCRIPT       commands  It does not add new functions  but offers an alternative method within PAC Control s  flowcharting environment to simplify some common programming tasks     OptoScript code cannot be mixed with commands in action or condition blocks  it is used in its own  hexagonal flowchart block     The following figure shows an example of an OptoScript flowchart block and its contents     OptoScript editor       OptoScript   Oven_Control   Block 1                 ClActions  4   Conditions  4  Variables Test Compile  gt     LJ  Oven  Control OptoScript Code     if  Oven Temperature     450  then   Ove
48.   or go to the Opto 22 website and search  for  OptoScript Examples        PAC Control User s Guide    OptoScript    CHAPTER 11  USING OPTOSCRIPT       Working with Tables    Following are some examples for using numeric  string  and pointer tables     Numeric tables    ntTablei 0    1    ntTablei 1    2 0    ntTablei 2    nVarl    ntTablei 3    ntTable1 2     ntTablei 4    ntTablel ntTable1 0      ntTablei 5    nVarl   ntTable1 2    3 1    nVarl   ntTable1 0     nVarl    ntTable1 0    ntTablel1 1     ntTable1 2      String tables     stStrT1 0     Hello      stStrT1 1     world    stStrT1 2    stStrT1 0          stStrT1 1    Chr          sStringl   stStrT1 2      Pointer tables    ptTable6 0     amp  pVariable2   ptTable6 1     amp nVarl   ptTable6 2     amp stStrT1 0    StStrT1 0     ptTable6 2      Pointer tables  Note that types are not checked when putting pointers into a pointer table  However  when a  pointer is moved from a pointer table element into a pointer variable  the types are checked at runtime by the  control engine and must match  For example  assume that the following elements have been placed in table  ptPointT    ptPointT 0    null    ptPointT 1     amp nLED A    ptPointT 2     amp fTemp    ptPointT 3     amp sStringl    ptPointT 4     amp Powerup    Based on this information  the first two of the following statements are good  The third one is bad and will cause  a control engine error  because the element at ptPointT 3  is a string and therefore does no
49.   variable  If they are passed by value  the updated value is not passed back to the strategy by the  subroutine  For more information  see the next section     Data Types for Subroutines        When the subroutine ends  the float variable will contain a new value  Passed in items are  called subroutine parameters  and you can use up to 12 of them in a subroutine     e Local items are created when a subroutine begins  and they are destroyed when it ends  For  example  a subroutine could take a passed in item  copy it to a local variable  and add 3 0 to  that local variable for use within the subroutine  The local variable is created when the  subroutine is called  and it disappears when the subroutine ends     Data Types for Subroutines    The following data types may be used in subroutines for both passed in items and local items     umeric variables  integers  floats  and timers       umeric literals  integers and floats   Other types can be passed into the subroutine through  iterals  however  see below for more information       umeric tables    String variables  e String literals         String tables   e   Communication handles   The following data types are also supported    e For passed in items  I O points  I O units  and pointer tables   e  Forlocal items  pointer variables   The following data types are not supported in subroutines  PID loops and charts     Although most variables passed in and out of a subroutine must be of a specific type  literals that are  pass
50.  4 View Chart Status       Name Status Mode Breakpoint Status Paused   t  Digital Control Running Step Off Break Off   Flag Example Chart Stopped Step Off Break Off   Powerup Stopped Step Off Break Off   Sample Stopped Step Off Break Off   Simple Error Handli   Stopped Step Off Break Off   Sprinklers Running Step On Break Off Turn off sprinklers  Timer Example Chart Stopped Step Off Break Off                2  Tochange the status of a chart  double click the chart name     The View Chart dialog box appears  showing the chart name  chart status  run mode  and  breakpoint status  If the chart is paused  mode is Step On   the block at which it is paused is  shown in the Paused At field  In the figure below  the chart is not paused     PAC Control User s Guide 183    VIEWING AND PRINTING          S Alarms      View Chart  scanning        Chart  Flag Example Char       Status  Stopped    Mode    Step Off E  Breakpoints   Break Off         Paused At                 The title bar shows whether scanning is occurring  Scanning stops when you click one of the  changeable fields  Status  Mode  and Breakpoints  and resumes once you click Apply  another  button  or one of the other fields  If scanning resumes before you click Apply  any changes you  made are lost     To stop  run  or suspend a chart  click an arrow in the Status field to select the option  Click  Apply    To turn pausing on or off  click an arrow in the Mode field to select Step On or Step Off  Click  Apply    To observe 
51.  B     Input  Setpoint    1125332990  c     Channel  Style  3 v Value X Y    m a  Flip Alignment Delta Y            Data p J  Input Axis b    Output Axis  gt     Time Axis  gt          16  To measure the system lag  the time between the change in output and the change in input    click and drag the first vertical red bar to just after the output change  Drag the second bar to  just before the change in input     Plot 1 0 Details   Misc  Details   VAL   Velocity Algorithm  Type B     The Delta X cursor displays  the time difference E puti  between the two vertical i  bars     Drag the first bar into  position after the Output  change        Drag the second bar to a  position just before the   Data p J  Input Axis  gt  J  Output Axis  gt     Time Axis  gt  J  change in Input           If you are unable to get the precision you want  you can view the plot at a lower time span   such as 10 seconds  You will need to reposition your plot and the measurement bars of the  Delta X cursor     The example above shows a system lag of 1 88 seconds  Generally  a suitable scan rate can be  anywhere from one third the system lag to two times the system lag  Considerations in setting scan  rate are        e  Slower scan intervals may be easier to tune  The PID controller has time to see the effect of the  previous output before calculating a new output     150 PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       e Faster scan rates may be necessary to achieve the desired response  
52.  Box n    6    ccc ccc cect eect e 25  Adding an Analog I O Polnt   euet etd a bete baa e dip 25  Add Analog Point Dialog BOX         0 0    ccc cece cect e 28  Configuring a Serial Module         0    cece cece cece eee n 30  Changing Point Configuration 2c cess  dis ys eae NEN E UTE ee eG Rees 30  Moving a Configured I O Point 2 0 0 0    ccc c cece cee e e 30   Copying  a Configured VO POINT     2  2225 2  9 Sten dhs hne te dai oer be E Pdl da 31    PAC Control User s Guide                Changing a Configured l O Point              6 00 cece cece e 34  Deleting d Configured OPONT Laos apte oen e RC ea tudo aane qas oaa 34  Conngunng pPID   OODS scatet E detenta te Proc testes tube eMe Ue 34  PIS ANG SHALEQIES   Sri cen oH EPOR UOI ERO ERIS 34  Ad amp irig a PID LOOD  ssi e trente pte eb E tie tbe ese DR 35  Add PID Loop  DialogiBOX preiero ytkostbe Hp piepen he RU PX Rer rtReieRRidh 37  Changing  PID MOOD    45 d rnc E e c e e be e ee ero roo edo dots 39  Deletingsa PID  LOOP  comicdin tard  adesse d da done Cad tct o Prts ed date Gomes 40  Inspecting I O in Debug Mode        6    ccc cece I e 40  Inspecting I O Units and Saving Settings to Flash    40  Irispecting Digital VO POINTS uirinn ER LS ITE Ue DURO UG Ue OG 42  Inspecting Analog I O POINTS Jo Pere rae ee teret tero Fere ERE Or S 44  Inspecting and TUNING  PID LOOPS i esiri eir t be Velewune DIE Cerere 46  Inspecting adllD  assie reps kr ehse x eb teet ax eis EEEN Poo Re er n 46  Determining System AG   ecu ue ve e
53.  Conditions    Like loops and case statements  conditions can be simpler when done in OptoScript code   f then   it then else  and if then elseif statements can all be mixed and nested as needed  Here s an example  of a simple if then else statement as it could be done in standard PAC Control commands and in  OptoScript                rer HEN In standard PAC Control commands  even a simple  MON SOM if then else statement requires three blocks     In OptoScript  a single block  contains the statement           OptoScript   Powerup   Check Oven Temp           C3 Actions  4   Conditions  gt  Variables    Test Compile Belna a     pi             ptoScript Code                 if  Oven Temperature  gt   450  then   Oven   larm   1     Set the oven alarm  else   Oven   larm   0     Clear the oven alarm  endif                TOptoScript   Temperature Control   Temperature Control         Actions     Conditions    Variables     4  Test Compile              OptoScript Code        L if  Temp Probe    80  then  Fan 1   1     Turn on fan 1       if  Temp Probe    95  then  Fan 2   1       Turn on fan 2 too             if  Temp Probe    105  then  Alarm   1      Send alarm   temperature too high  endif    In OptoScript  all the condition  and action blocks and their MEE ie TS  commands are consolidated Fan 1    a   into one block     endif    DelaySec  60   77 Wait 1 min before checking temp again    LJ   gt      PAC Control User s Guide    CHAPTER 11  USING OPTOSCRIPT       For Combining 
54.  Configuration File    When you import the I O configuration file  it does not delete any I O units or points that are already  there  If the import file contains I O units with the same names as those already in the strategy  you  can choose whether to update them  Updating changes points that have the same name and adds  new points  but does not delete points     1   2   3     Open the strategy into which you want to import the I O configuration   In the Strategy Tree  right click I O Units and choose Import from the pop up menu   Navigate to the location of the export file you created  Highlight its name and click Open     The I O units and points are updated from the configuration file  To see them  click the plus sign  next to the I O Units folder on the Strategy Tree     Adding an I O Unit    In PAC Control  the term   O unit usually refers to a mounting rack with a brain or brain board and up  to 161 O modules attached     NOTE  If you have already configured I O in PAC Manager  you can also add 1 0 units or points if necessary  from within PAC Control  as you add commands to the blocks in your strategy     1     Make sure the strategy is open and in Configure mode  On the Strategy Tree  double click the  I O Units folder     You can also select Configure  gt  1 0   The Configure I O Units dialog box opens  showing all configured I O units     I Configure 1 0 Units       Port Address Watc   Enabled  RefC   Descri    Add     Ethern  127 0  Disabled Enabled 12    Modify 
55.  Configure menu  choose Control Engines to open the Select  Control Engine dialog box  Skip to step 3       Using PAC Control  With a strategy open in Configure mode or Online mode   double click the Control Engines folder on the Strategy Tree   You can also select Configure  gt  Control Engines  or right click an individual control engine  on the Strategy Tree and select Configure     The Configure Control Engines dialog box appears     Active Engine   Cookie Controller    Engines Associated with Strategy        jntrof                2  Click Add   The Select Control Engine dialog box appears     Configured Control Engines           This dialog box lists all the control engines configured on your system  whether or not they are  associated with your strategy     3  If the control engine you want appears in the list  it has already been defined on this PC  click to  highlight the control engine s name and then click OK  Then skip to    Associating the Control  Engine with Your Strategy  on page 93     EJ PAC Control User s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES       If the control engine you want is not in the list  click Add   The Control Engine Configuration dialog box appears                                   mon             Complete the fields as described in    Control Engine Configuration Dialog Box    below   Click OK   In the Select Control Engines dialog box  the control engine appears in the list                 In the Select Control Engine dialog box  hi
56.  Control tab at the bottom of the PAC Control main window   The chart appears   Click the Pause Chart button to pause the chart     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL          This chart runs  continuously once the  program has been started     Drop the dough     Drop the chips     Xn SR  ES Back to Xo      Speed OK    SAAS           3  Shortcuts                                           Using a Watch Window    To see clearly what we re doing  we ll create a watch window to monitor cookie production   1  Inthe Strategy Tree  double click nCookie Counter      s  nCookieCounter   scanning        Value    74             The value is frozen at some number  such as the 74 shown above  Since the counter is no  longer increasing  we can see that cookie production has temporarily stopped     2  Maximize the dialog box     Zs nCookie_Counter     scanning     Name  nCookie_Counter       Value   74        3  More Info       3  Click Add Watch   4  Click Watch     PAC Control User s Guide    USING A WATCH WINDOW       Add Watch Entry       Name   nCookie Counter       Select Portions To Watch     Value             Since there is no watch window available to select  we ll create one   5  Click New     Create New Watch Window       Look in    C3 My Cookies             File name                   Files of type    PAC Control Watch Window Files  wth          6  Make sure the My Cookies directory appears in the Look in field  Type a name for the watch  window in the F
57.  Copy To  gt     T v  Expand      gt           If necessary  expand an individual module by clicking its plus sign       or expand all of the  modules by clicking Expand All     Highlight the point you want to move and click Move To     1 Move Point    Select a target 1 0 Unit  Select a target channel    Mixed IO_Unit      roo   00    Switch DO  ESD CCN  00   01    Not Used   00   02    Not Used   00   03    Not Used   01   00    Not Used   01   01    Not Used    01   02    Not Used   01   03    Not Used                         In the Select a target channel area of the Move Point To dialog box  highlight the location you  are moving the point to  Then click OK     You return to the Configure I O Points dialog box  and the point has been moved     Copying a Configured I O Point    If you have several points on a SNAP I O module that are the same  you can copy a configured point     To fill empty points on the same module   To fill all empty points on the I O unit     To another other point on the same or a different I O unit     With the strategy open in Configure mode  double click the I O Units folder on the Strategy  Tree to open the Configure I O Points dialog box     Click Expand All so you can see the points     PAC Control User s Guide 131    CHANGING POINT CONFIGURATION       I Configure 1 0 Points       1 0 Unit   Lights B   Type  SNAP PAC AI  Modules and Points Features           00  SNAPIDCSD  2 5   28 VDC Digital Input   w 0 DO Switch    EEIT       Ly        z a  
58.  D SNAP ADV 2 2 0 10VDC  2 10  10 VDC  2 D  20 m     2 5 60 VDC TPO      r  DR SNAP ADA 28   D SNAP AOD 29       Si          C  Automatically create points within the new module      _ 2_ 3 4             In the Add Module dialog box  choose the module type and then the exact module from the  lists  Click OK     If you want to add points automatically  select    Automatically create points within the new  module       Use the    Name format    text field to create a format for the point names  Enter any combination  of text and the following format codes     961   point type  for example  ai or do    962     O unit name   963   module position   964   channel position   965     a unique identifier that is generated automatically   Example  961 962 963964 would expand to something like di MyloUnit  0801   Example  961 ABC  965 would expand to something like aoABC  473    In the Configure I O Points dialog box  click the plus sign next to the new module to expand it   Notice that the module icon is color coded to reflect the type of module being configured   blue for analog input  green for analog output     PAC Control User s Guide 127    ADDING 1 0 POINTS       Expand or collapse points  on the module by clicking  the   or   sign in the box     128    I Configure 1 0 Points    10 Unit  Sprinkler  Control       Module icon           D0  SNAPADCSD  2 5   28 VDC Digital Input    1  Not Used     02  SNAP ADV 27   Analog Output      Points       9  Highlight the point you want to c
59.  Dough Action  Speed OK  Condition  Start Action  Start Conveyor   ptoScript             14  Select the Speed OK  block by clicking it once  and then click OK     When the program reaches the continue block  it returns to the Speed OK  block  We haven t  changed the way the program works  we ve just done the same thing in a different way   Continue blocks are useful in a complex chart to avoid crossing connection lines     PAC Control User s Guide    ADDING A COMMAND       Adding a Command    Now we re going to add a command  or instruction  to a block in the Dough_Chip_Control chart   We ll add the command so we can keep track of the number of cookies we produce     Double click the Drop Dough block     l Instructions   Dough Chip  Control   Drop Dough R        nCookieMotionPreset Modify   dtCookieMotionTimer  Open the dough valve     Turn On Next Block  doDoughDispenseValve  Previous Block    For animation in ioDisplay   Ladd       Keep the dough valve open for 2 seconds   Delay  Sec   2 0    Close the dough valve   Turn Off       AaNnannhNinnannntinhen             We ll add the new instruction  command  between the Turn On and Delay  Sec  commands   Click anywhere on Delay  Sec  to highlight this command    This highlight indicates the position where the next command is added    Click Add to open the Add Instruction dialog box     Add Instruction    Instruction     Absolute Value    Comment           Type Name    of  Al Valid Types    aD oughVesselPressure       Put Result
60.  Elements    1  With the chart open and the strategy in Configure or Online mode  click the Select tool i      2  To move any action  OptoScript  condition  continue  or text block  click it  Then click and hold  the mouse button anywhere on the selected item except on its handles  and drag it to the  position you want     You can also use the arrow keys on your keyboard to move a block in any direction  Note that  when you move a block  any connections attached to it also move     3  To move a connection  click it  Then click and drag any handle in any direction     You can also move an end point from one block to another  as long as the result is a valid  connection  A disallowed move is ignored     4  Tomove several elements at once  select them  and then click and drag them     PAC Control User s Guide    CHAPTER 8  WORKING WITH FLOWCHARTS       If elements end up stacked on top of each other  you may need to change their z order before  you can move them  See the following section     Moving Elements in Front of or Behind Other Elements  Changing Z Order     If elements are stacked on top of each other  you can select only the one in front  To change their  position  z order   follow these steps     1   2     Click the element to select it     Right click the element  From the pop up menu  choose Z order  From the sub menu  choose  the action you want to take         Bring Forward   moves the element one position closer to the front       Bring To Front   moves it all th
61.  Get Period   Get Period Measurement Complete Status  IVAL Set Analog Filtered Value   IVAL Set Digital Binary  DEPRECATED   IVAL Set Frequency   IVAL Set Mistic PID Control Word   IVAL Set Mistic PID Process Term   IVAL Set Off Totalizer   IVAL Set On Totalizer   IVAL Set Period   Mistic PID Loop Communication Enabled   Read Event Reaction Hold Buffer   Set Analog Totalizer Rate   Set Digital I O Unit from MOMO Masks  DEPRECATED   Set Mistic PID Control Word   Set Mistic PID D Term   Set Mistic PID   Term   Set Mistic PID Input   Set Mistic PID Mode to Auto   Set Mistic PID Mode to Manual   Set Mistic PID Output Rate of Change  Set Mistic PID P Term   Set Mistic PID Scan Rate   Set Mistic PID Setpoint  Transmit Receive Mistic I O Hex String       PAC Control User s Guide 199       LEGACY OPTIONS       200 PAC Control User   s Guide       8  Working with Flowcharts    Introduction    This chapter shows you how to work with flowcharts  the building blocks of your strategy  When you  create a new strategy  one chart is created for you  the Powerup Chart  You must create all the other  charts to do the work of the strategy     In this Chapter   Creating a New Capt 1e 201  Working with Chart Elements    202  Opening  Saving  and Closing Charts              212  Copying  Renaming  and Deleting Charts      213  FORSE COPVAEERS atte tentat 215  Exporting and Importing Charts                     215    Creating a New Chart    1  With your strategy open and in Configure mode  select C
62.  Host  or PID Output     e     Ifthe PID   s process variable comes from an I O point on the same unit  select I O Point  Choose  the point from the drop down list or type a point name to configure a new point     e     Ifthe PID S process variable comes from the PAC Control strategy  select Host  Enter an initial  value for the input     e     Ifthe PID s process variable is the output of another PID on this brain  a cascading control loop    select PID Output  Choose the PID from the drop down list        D   Square Root   Optional  If you chose I O Point or PID for step C  check this box if the error  should be calculated based on the square root of the process variable  applies to flow control  systems where volumetric flow is proportional to the square root of a signal from a flow transducer      PAC Control User s Guide 137    CONFIGURING PID LOOPS       138    E   Low High Range  Set the valid range of the process variable by entering the low range and  the high range   See Output Options for optional responses to out of range input      F   Setpoint  Choose the source for the setpoint  I O Point  Host  or PID Output     e     To control the setpoint using a device  on the same brain  such as a potentiometer  select I O  Point  choose an I O point from the drop down list or type a new point name        e     To control setpoint using PAC Control or PAC Display  select Host  For Initial Value  enter the most  common operating value     e     If another PID loop will con
63.  Low Bits of Integer 64  Greater Than Numeric Table Element   Greater Than or Equal to Numeric Table Element   Greater Than or Equal    Greater     Less Than Numeric Table Element     Less Than or Equal to Numeric Table Element   Less Than or Equal    Less    Make Integer 64   Move 32 bits   NOT   Not Equal to Numeric Table Element   Not Equal    NOT    Numeric Table Element Bit Clear  Numeric Table Element Bit Set  Numeric Table Element Bit Test  OR   OR    Set Variable False   Set Variable True   Test Equal   Test Greater   Test Greater or Equal   Test Less   Test Less or Equal   Test Not Equal   Test Within Limits   Variable False    Variable True    Within Limits    XOR   XOR     Understanding Logical Commands    For condition blocks  the Instructions dialog box provides options to designate AND or OR for  multiple commands  If you have more than one command in the same condition block and you  choose the AND option  all of the commands must evaluate true for the block to exit true  If you  have more than one command in a condition block and choose the OR option  the block exits true if    any of its commands evaluates true     Logical actions and conditions work with integers  individual bits within an integer  a single digital  I O point  or a digital I O unit  These values are treated as Boolean  that is  they are either True or    False     For complex logical operations  you may find OptoScript code easier to use than standard PAC  Control commands  See    Using Logi
64.  Output    Analog Input C  Analog Output       Channels     Type s     10 3 CWAC   2 5 16 VDC   18 32VDC   25 28VDC   10 32 VDC VAC Man Auto Switch   Dry Contact Switch   4 24 VDC   35 75 VAC VDC   15 32VDC   Dry Contact Switch   10 32VDC   25 28VDC   10 32VDC   10 32VDC   90   140 VDCAVAC   180 280 VDC VAC   90 140 VDC VAC Man Auto Switch           30   140 VDC VAC   180  280 VDC AVAC   an  14n nr A c    F   OSNAP IDCS       SNAP IDCS FAST      SNAPIDCSFAST         SNAP IDCSD       SNAP IDCEMA    SNAP IDC5 Sw     SNAP IDC5Q     SNAP IDC5G     SNAP DCS HT      SNAP IDC5 SW NC      SNAP IDCEFM       SNAP IDCSDFM      SNAP IDC 32       SNAP IDC 16    SNAPJACS    a SNAP IAC5A    ag SNAPJACSMA   OU SNAPHACSFM    C  SNAPHACBAFM  2 SMAPIACAE    qe de de dm dm DO ee Se dw d EA      2  e       2   o od dd    n              J Automatically create points within the new module             In the Add Module dialog box  choose the module type and then the exact module from the  lists     If you want to add points automatically  select  Automatically create points within the new  module       Use the    Name format    text field to create a format for the point names  Enter any combination  of text and the following format codes     961   point type  for example  ai or do    962     O unit name   963   module position   964     channel position   965     a unique identifier that is generated automatically   Example  961 962 963964 would expand to something like di MyloUnit  0801    Example
65.  P Prev    PAC Control  Ready Configure      NUM                 To change the docked position  click and drag the window s title bar to any edge of the main  window     To change the docked window s width or height  click and drag the edge of its frame in the  direction you want     To free the window from its docked position  click the docking icon  Sin its title bar     Zooming in a Chart or Subroutine Window    You can change the scale of any chart or subroutine window by using the zoom feature  There are  several ways to zoom     Hold down CTRL key and move the mouse wheel up and down    Press the   or   keys on the keyboard    Right click anywhere on a chart or subroutine window to display a pop up menu  Select Zoom  and choose In  Out  or Reset  to return the zoom to 100 percent     From the View menu  choose Zoom In  Zoom Out  or Zoom Reset     To pick the zoom percentage you want  click the zoom field at the bottom right of the window  and choose one of the preset zoom levels  The    Zoom to fit  option resizes the chart to fit in the  window     NOTE  Zooming always takes place with reference to the center point of the window     Here is a window at 50 percent zoom     E PAC Control User s Guide    CHAPTER 3  WHAT IS PAC CONTROL        Oven_Inspection_Control    Til ohartmaintain c te oven temperature and rejeot  cookie c tatdo no tpa cc vi qual In   peoton     The Powerup ohart cirte  tic ohart    Botovi  360 degree c     Itinpeoton chton coc  a bad oookle  open re
66.  PAC Control  an integer 32 is a 32 bit signed number ranging from  2 147 483 648 to  2 147 483 647   2 billion   An integer 64 ranges from  9 223 372 036 854 775 808 to  9 223 372 036 854 775 807     An integer can only be a whole number   1  0  1  2  3  etc   In other words  integers do not include a  decimal point  The result of an integer operation is always an integer  even if it is placed in a float  variable  For example  if 9 is divided by 10  the result is zero  0 9 truncated to an integer   To receive a  float result  at least one of the operators would have to be a float  Use the Truncate command to  round down to the nearest whole number     Controlling Rounding    Use the Round command to round up or down to the nearest whole number  Note that 1 50 rounds  up to 2 0  and 1 49 rounds down to 10     Using Floats    While computers  CPUs  and electronic devices  such as Opto 22 controllers  store numbers in binary  format  most often they represent real numbers as floating point numbers  or floats  For example  in  industrial automation applications  all analog values read from an I O unit are floats  Floats represent  real numbers in scientific notation  as a base number and an exponent     The IEEE Standard for Binary Floating Point Arithmetic  IEEE 754  is the most widely used standard  for floating point computation  It defines how to store real numbers in binary format and how to  convert between binary and float notations        PAC Control User s Guide    MAT
67.  PAC Control item  such as a chart  an I O point  or a PID loop  You can perform any  operation on the pointer that you could perform on the object the pointer points to  Pointers are an  advanced programming feature and are very powerful  but they also complicate programming and  debugging     PAC Control User s Guide    CHAPTER 3  WHAT IS PAC CONTROL        Because pointers can point to any data type  pointer tables can store an assortment of data types in  a single table     Pointers allow one level of indirection within PAC Control  a pointer cannot point to another pointer   After you add a pointer through the    Add Variable Dialog Box    on page 222  you can use it wherever  the object itself would be used     strategy    The software program you create using PAC Control Basic or PAC Control Professional  The strategy  includes all the definitions and instructions  commands  necessary to control the process that one  Opto 22 controller handles  Since most control processes are complex  the strategy typically consists  of a series of process flowcharts that all work together  with each chart controlling one piece of the  automated process  You may have several PAC Control systems  each controlling a different process  and therefore running different strategies  Or you may have two or more PAC Control systems  controlling identical processes in different areas and running the same strategy     variables    A variable is a holding place that represents a piece of informat
68.  PROGRAMMING WITH COMMANDS       3  Use the command Send Communication Handle Command to specify the filename and  retrieve the file in one step   Use the communication handle command get  lt remote filename gt   lt local filename gt  as  follows   get  GetThisData txt HunkoData txt  If the local filename already exists  it is overwritten     4  When you have finished retrieving data from the file  use the command Close Communication  to close the communication handle     Sending the Data in Pieces  To append data to an existing file  or to send a very large file   larger than 1 MB   you can send data in pieces     Suppose you want to append data from a strategy variable or table to an existing file named  HunkoData txt on the device  Heres how you would send the data     1  Usethe command Open Outgoing Communication to open an FTP communication handle   The value of the handle would be    tp 10 192 56 45 21 JoeG  hello   2  Usethe condition Communication Open  to make sure the communication handle opened    3  To specify the filename on the remote server  use the command Send Communication Handle  Command  The communication handle command you send is   dest HunkoData txt   4  Usea Transmit command  such as Transmit String or Transmit Numeric Table  to send the data   In the command  use the name of the FTP communication handle you just opened   The data is appended to the file   If the remote filename is new  the file is created and the data  placed in it     5  When you hav
69.  Result in Float Variable      fSetpointMinusDeadband       If the argument type is a literal  or constant   you must type it in  You can use either decimal or  hexadecimal form     PAC Control User s Guide 237    ADDING COMMANDS       If you type in the name of an item that doesn t exist  for example a variable or I O point  you are  prompted to add it to the strategy     Each command requires a certain number of arguments  from zero to eight  For help in  completing arguments  see the PAC Control Command Reference or the online help for the  specific command you re using     9  When the arguments are complete  click OK     You return to the Instructions dialog box  which now shows the command you just added   Notice that the comment you entered appears just above the command  The arguments you  entered appear as part of the instruction  The highlight shows where the next command will  be placed if you add another command to this block     Here is an example of an Instructions dialog box for an action block     I Instructions   New  Chart   Block 0       Comment  Command  Arguments      Set ovento 325 degrees       325  Oven  Temperatur      Highlight  L                10  To add another command  click to place the highlight where you want the command to  appear  Click Add and repeat the steps in this section     If you highlight a command that s already in the dialog box  the new command will appear just  before it     TIP  If you are adding commands to several blocks at on
70.  Save Strategy As dialog box  navigate to where you want the new strategy to be  Create a  new folder if necessary     Remember that each strategy must be in its own directory   3  In the Strategy Name field  enter the new strategy name  Click Save   The strategy and all its charts are saved under the new name in the new directory     Saving Before Debugging    When you change to Debug mode  you are prompted to save a strategy you have modified  If you  don t want to be prompted to save before entering Debug mode  choose Configure  gt  Options and  dick to remove the check box for Prompt To Save Strategy Before Running Debugger     Closing a Strategy  To close a strategy  click the close box in the Strategy Tree or choose File  gt  Close Strategy     NOTE  Since only one strategy at a time can be open in PAC Control  creating a new strategy or opening an  existing strategy automatically closes any current strategy first  If you ve made changes to the current  strategy  you are prompted to save them     PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Saving a Strategy to Flash    When you finish working on your strategy and have downloaded it  you should save it to the control  engine s flash memory  By default  a strategy is downloaded to the control engine s RAM  Saving it to  flash protects the strategy in case of a power loss  You can save it to flash just once  when needed  or  save every time the strategy is downloaded     Saving to Flash Once    You
71.  Support    If you cannot find the help you need in this book  the PAC Control Command Reference  or the SNAP  PAC Brains User Guide  call Opto 22 Product Support  See    Product Support  on page 4 for contact  information     Strategy Problems    362    If You Cannot Delete an Item    Sometimes when you try to delete an item in a strategy   a variable  a chart  an I O unit or  point   you receive a message saying    You cannot delete an item with a reference count greater  than zero     This message means you cannot delete the item because other elements in the strategy  use it     You can use Find to locate all references to the item you want to delete  For help in using Find  see     Searching    on page 192     Sometimes the reference counts can become incorrect due to cutting and pasting variables or  importing charts into a strategy  If a reference count appears to be incorrect  you can rebuild the  strategy database by following these steps     1  Click in the Strategy Tree to make it the active window   2  Press CTRL R     PAC Control User   s Guide    APPENDIX A  TROUBLESHOOTING       3  Choose Compile  gt  Compile All   4  Choose File  gt  Save All     The strategy database is rebuilt and the reference counts should be correct     If You Have Memory Problems    Control engine memory is allocated as shown in the following table  You can see the total amount  of RAM and the amount of battery backed RAM available for use by inspecting the control engine in    Debug mod
72.  Switch 163 Counter    No module existed in this slot     7   06  SNAP IDCSD  2 5   28 VDC Digital Input     w 0 DD Switch 192 Counter  Both the points and the module Te B  E pomt  ang og w 1 DO_Switch_193 Counter    were copied from the original  89M 2 DO Switch 194 Counter Expand All  Tt 3 DO_Switch_195 Counter v    Collapse All     gt        To copy the point to one other point  either on the same or a different I O unit  choose To  Specific     The Copy To dialog box opens     I Copy Point To    140 Units      Mixed ID   00   Q0  DI     Sprinkler Control  00   01    Not Used     Sprinkler Control   DO   02   Not Used    00   03   Not Used        02   01    Not Used   02   02    Not Used     03   01    Not Used   03   02    Not Used   03   03    Not Used                   In the left column  choose the same or another I O unit  In the right column  choose the  location of the point to copy to     Available points are shown in black  Already configured points  points on a different type of  module  digital output instead of digital input  for example   and point numbers not on the  rack  such as point 40 on an 8 module rack  are grayed out     If the point is copied to an empty module slot  the module part number from the copied point  is added  too     4  After you copy a point  change the new point as needed by double clicking its point name  In  the Edit Digital Point dialog box  type the new name and make any other changes     PAC Control User s Guide EE    CONFIGURING 
73.  Timer  Timers come in two forms   e     Up timers count up from zero and are generally used to measure how long something takes     e     Down timers count down to zero from a number you set and are frequently used to determine  when events should begin     Here s an example of a down timer  This process starts every 1 5 seconds     The starting value for the  timer is set in Block 0                            x     Instructions   Timer_Example_Chart   Block 0       a   A    Timer  Example  Chart SEE Set Down Timer Preset Value Add     Target Value 15    7  Down Timer Process Timer Modif  Start Timer Dele  Timer Process_Timer     Nent Block  Ulnstructions   Timer Example  Chart   Process Timer E      amp      Down Timer Process_Timer Add     Down Timer Expired   M  Next Block    The condition block checks  whether the timer has  reached zero  If it hasn t  the  chart loops until it has                      When the timer has  expired  it is restarted and  the process begins         Instructions   Timer Example Chart   Start Process Ti              When the process ends   the logic loops back to  check whether the timer  has expired again     Start Timer Add     Timer Process Timer                    3  Shd  BER    Nest Block  Previous Block                  Close     Help               For additional details  see    Using Timers    on page 315     Using a Flag Lock    The Flag Lock and Flag Unlock commands allow you to give a task exclusive access to one or more  objects   s
74.  When you use a command such as Get   O Unit as Binary Value  the only I O units shown for  Argument 1 will be SNAP PAC I O units  SNAP PAC R1  SNAP PAC R2  SNAP PAC EB1   SNAP PAC EB2  SNAP PAC SB1  and SNAP PAC SB2          Commands that are used only with legacy hardware   such as Enable Communication to Mistic  PID Loop or Clear HDD Module Off Latches   wont be listed     Since some Opto 22 customers work with multiple systems  legacy options can be set individually  for each strategy or subroutine  If you are using legacy hardware  you can choose the options that  apply to each strategy you re working with  without affecting other strategies     IMPORTANT  Once you have enabled a legacy option for a specific strategy or subroutine  you cannot  disable it later for the same strategy or subroutine     Enabling Legacy Options   Here s how to set legacy options    1  In PAC Control  open the strategy or subroutine for which you want to change options    2  ChooseFile    Strategy Options  Click the Legacy tab   Depending on the hardware you re using  you can set one or more of the following options       Enable Ethernet  Ultimate  and Simple I O units and commands  see page 197      Enable high density digital commands  see page 198        Enable mistic I O units and commands  PAC Control Pro only  see page 198     3  Clickthe option you want to enable  At the confirmation dialog box  make sure it is correct  and  then click Yes  Repeat to enable other options   The options a
75.  Z x     NeIqeLAW    Z   12  HeiqeLAw  v 30N ees  doo  104  aped eol  uid Berri iio   deis G oL 0    404   deis 0  0   140  pue    es o Bulyyewos op    es o Bulujawos op     uiBeq    eso eso J  pug Jipue  pue   es o Bulujowos op    es o Bulujawos op     es o Bulyyewos op    es o Duiujeuuos op    9si3 ale  uBed   eso Buiujeuuos op    eso Buiujeuos op    jueuJajeJs JI esjo JI   6   lt  1  11 osjo  6   lt   nesie ueu   S   lt     S F usu   G   lt  1  Jiesie    lt     J  BSH Bulyjyewos op    Bulyjyowos op     pua    z    udu   z       yi  Buly ewos op    Buiujeuuos op    c uMH UG    dt  uiBeq     Z     3   Z      j  pue    ese Buiujeuos o  esje Bulujawos o  l lyy ed l Iur p E j  pug jipue    oso asia es o Bulujawos op    es o Bulujawos op     i6   esi3 eso jueuiejejs es o JI  p Buiujeuios op    Buly ewos op     Buiujeuuos op    Buiujeuuos op     uiBeq   ueu   Z      4 ueu  Z      J   ueu  Z   1  JI  c 2201  puo   jl pug jipu    Bupawos pa ee acl op S BuiujeuJos op    Buiujeuios op Il jueuJajels JI  ueu  z   i  u  gz  iu ueu   Z      4 ueu  Z      yi                   v  pE  5  I  Nn  oO  N      2        o  uw  x  e       APPENDIX E  OPTOSCRIPT LANGUAGE REFERENCE        ull eie esse   JUO AjUO Sa  U2DIdUISOIdQ  S   sebenue  19010 YM uouJuJo   S  se doo  e Ul PUBLULUOD Jo ad  yealg e aAeu 3ouue   1du2gOldO  p   9n se anjeA o19z uou e pue as ej se   NJLA oJaz e eal    pue 1du  so1dQ  sJeDa1ul asn X pue 1du5501dQ  ed   e1ep  Ue9 o0g e ALY je  seg pue 5 Svg  D pue 1du  s01dQ ur uey  J
76.  a  registered trademark of Datapoint Corporation  Modbus is a registered trademark of Schneider Electric  licensed to the  Modbus Organization  Inc  Wiegand is a registered trademark of Sensor Engineering Corporation  Nokia  Nokia M2M  Platform  Nokia M2M Gateway Software  and Nokia 31 GSM Connectivity Terminal are trademarks or registered trademarks  of Nokia Corporation  Sony is a trademark of Sony Corporation  Ericsson is a trademark of Telefonaktiebolaget LM Ericsson   CompactLogix  MicroLogix  SLC  and RSLogix are trademarks of Rockwell Automation  Allen Bradley and ControlLogix are a  registered trademarks of Rockwell Automation  CIP and EtherNet IP are trademarks of ODVA                          groov includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit   http   www openssl org     All other brand or product names are trademarks or registered trademarks of their respective companies or organizations     Opto 22  Automation Made Simple     PAC Control User s Guide       Table of Contents       Chapter 1  Welcome to PAC Control             cece cece ccc cece eene 1  MOGUO PEDEM 1  ADOUL UNS Gud Erana LL 1   CHOOSING DOCUMENTALION  so ccadenucieniennn ette ceste citet EEEE E ERTS 3  Document CONVENTIONS s c poe t en eii ap o e n a NER ORE hey 3  Documents and Online Help  2 recte reme re eere dese eerewenhnnsen a 3  Product SUPPO yipek epe d mrt ree epe b n Reb E EOD E es 4  Installing  PAC CONUO  cu et vetet erm erbe cave EE EE peatefut pene
77.  a SNAP R series controller has a total of 16 MB of RAM on the control side  2 MB of which is  battery backed  Volatile RAM shows the amount of total RAM available for use  Battery backed RAM  shows the amount available in battery backed RAM  where persistent variables  variables initialized  on download  the autorun flag  and the strategy archive are stored  File Storage RAM shows the  space available in the control engine s file system See the PAC Manager Users Guide for more  information about the file system  See also form 1646  the SNAP PAC Memory Usage Technical Note     D   Up Time  Total time that the control engine has been running since powerup    E   Device Time  Current date and time recorded on the control engine    PAC Control User   s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES       F   Sync time to PC  Click to synchronize the control engine s time and date to that of the PC  running PAC Control     G   Message Queue  Number of messages  information  warning  and error messages   encountered when attempting to run the strategy on the control engine  up to a maximum of 1000  messages    See    Viewing the Message Queue  below   Click to open the View Messages dialog box   listing the details of any information  warning  or error messages     H   Active  Name of the strategy currently running on the control engine  the date and time it was  downloaded  and the number of charts currently running     I   Archive  Information about the strategy currently arch
78.  a m    1  Checkthe day and the weather  3 Ifit sthe right day and it s dry     turn them on     2  If it s raining  leave the  sprinklers off           1  Check the day and the  weather   Read the day of the week     the hygrometer              If it   s Sunday or Wednesday  read          2  If it   s raining  leave them  off    If the hygrometer says 100     check to make sure sprinklers  are off    If they re on  turn them off              3  If it s the right day and  it s dry  turn them on    If it s Sunday or Wednesday and  if the hygrometer says 9996 or  below  turn sprinklers on    Start the timer    When they ve been on for 15  minutes  turn them off           If a human being were doing this job  this level of instruction would probably be just fine  With a  computer  however  the instructions need more detail  For example  the first instruction   Every day  at 6 00 a m   would have to be expanded more like this     a  Read the hour     b  If the hour equals six  go on to the next step     c  If the hour does not equal six  go back to step a     Testing the Steps    Now that you have your steps in place  run through each sub process in your mind to see if anything  is missing  Is there an answer for every  if   Are all the possibilities taken into account     It may help you to draw out your control process as a flowchart  Often it is easier to see decision  points and responses to decisions in a flowchart  You re still working at the human level at this point   jus
79.  a numeric variable  can be used  For example  you can turn a point off by assigning it a value of zero  or turn it on by  assigning it a non zero value  You can also use standard digital points directly in mathematical  expressions and control structures  For more information  see    Using I O in OptoScript  on page 326     Reading or Writing Digital Points    The Move command is the main command used to read or write digital points     PAC Control User s Guide    ERROR HANDLING COMMANDS       Error Handling Commands    286    The following commands refer to handling errors     Add Message to Queue Get Error Code of Current Error   Add User Error to Queue Get Error Count   Add User I O Unit Error to Queue Get ID of Block Causing Current Error  Caused a Chart Error  Get Line Causing Current Error   Caused an I O Unit Error  Get Name of Chart Causing Current Error  Clear All Errors Get Name of I O Unit Causing Current Error  Copy Current Error to String Get Severity of Current Error   Disable I O Unit Causing Current Error Remove Current Error and Point to Next Error  Enable I O Unit Causing Current Error Stop Chart on Error   Error on I O Unit  Suspend Chart on Error   Error     All good programmers must deal with errors  These error handling commands are used to monitor  errors  figure out which I O unit caused an error  disable or re enable communicatin to the 1 0 unit   and clear errors and other messages from the message queue  For a simple example of an error  handler ch
80.  address  The control engine doesn   t know what  type of data is in any particular address  so it cannot convert the data type     Since these are I O unit commands  remember to check all return values and errors to make sure the  command was successful  If a command variable contains a value that is obviously wrong   for  example  a memory map address in an incorrect format   communication to the I O unit will be  automatically disabled     See the OptoMMP Protocol Guide  Opto 22 form 1465  to determine the memory map addresses and  data types you need to use        PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       I O Unit   Scratch Pad Commands    The following commands are used for peer to peer communication for sharing strategy data with  other Opto 22 memory mapped controllers on the network  These commands are used by PAC  Control to read or write to the Scratch Pad area in the memory map of a SNAP PAC controller     Since each read  get  or write  set  command is completed before another occurs  commands  cannot interfere with each other  For example  a get command won t read a partial string while a set  command is writing the string     Get I O Unit Scratch Pad Bits Set I O Unit Scratch Pad Bits from MOMO Mask  Get I O Unit Scratch Pad Float Element Set I O Unit Scratch Pad Float Element   Get I O Unit Scratch Pad Float Table Set I O Unit Scratch Pad Float Table   Get I O Unit Scratch Pad Integer 32 Element Set I O Unit Scratch Pad Integer 3
81.  apart to easily see the flow  and if possible  design the chart so its entire  flow can be seen within one window  If a chart becomes too complex  split it into smaller  charts     e   When you use OptoScript code  remember that it is not self documenting  Be sure to add  comments so that you or others can easily see what the code is doing   Similar comments are  also useful in other PAC Control flowchart blocks   Use OptoScript blocks within a flowchart for  operations they make easier  such as string handling and math calculations  but keep the logic  and purpose of the strategy clear in the flowchart     e Within a chart  leave Block 0 empty  This makes it easy to insert logic at the beginning of the  chart by adding a block between Block 0 and the next block  If a block contains more  instructions than can be easily traced and debugged  break it down into two or more  sequential blocks  Never place another block in the flowchart before Block 0  Charts always  start with Block 0  which cannot be deleted        Naming Conventions    To save trouble in the long run  it s wise to establish naming conventions for charts  blocks  variables    O units and points  control engines  subroutines  and so on  If you name these elements in a  consistent way from the beginning  it is easier to find them in lists  to see related elements  and to  know their functions without opening them     Since PAC Control automatically alphabetizes these names  you can plan naming schemes to place  
82.  arrow buttons to  see tabs that are not visible  or are only partly visible     Docking Windows    Debug NUM    This white tab shows you are stepping inside the  Variable_Increase_ Notification subroutine  which was called by  the Increment Counter action block on the gray tab at left  The  gray Chart tab farther left shows the chart this action block is in   Click any tab to see how you got to where you are     You can place the strategy Tree and watch windows where you want them  dock them  in the PAC  Control main window  Docked windows do not have tabs but are contained in their own frames   PAC Control remembers their position the next time you open that strategy       To dock a window  click the docking icon  s  in the window   s title bar     The window moves to its own frame   Compare the following figure with the one on page 52  to see the difference in the Strategy Tree window      PAC Control User s Guide    WINDOWS AND DIALOG BOXES IN PAC CONTROL       Docked strategy Tree    IPAC Control Professional  File Edit Configure Chart Subroutine Compile Mode Tools View Window Help  EETCEMEERNMHERSESER 0 00 05050 An 50205995955    Sprinkler  Control     x                Sprinkler_Control   4  E Control Engines    C3 Subroutines Included   Ri    Charts       C3 Variables     E Numeric Variable        String Variables      Pointer Variables  IC Communication F      Numeric Tables      String Tables      Pointer Tables     C3 I O Units                               db Next 
83.  b da E qs 4  System Requirerfielits  irinna gasi bci erre taf eratis V wire av rede drain na 5  Installation Requirements            sssssssssssssssssss ens 5  Compatible Control Engines and I O Units          ssssssssssssssssssssss 5  Important Note on Disk Drives 0 0 2 0    cece ccc cee cect n 6   Chapter 2  PAC Control Tutorial 25  esse ee ner rev enn ese vn EREET 7    POGUCTON PE MUT 7   ICIS Capten C RET                      7  Opening tie Strategy see seat areca caters ens dee Rer Une etd duum suite nde at aere duis RS 7  SAVING THE Strategy   uo ces utete Feo M te dole ved tds dert tie ele diia t qtii te 9  EXAMINING THE Strategy 1  creek EUER UON REN EYE EEG Opec erbe 0  The Strategy MEE 12st cdecuseradatdre aa Cab rodeo oett t bed 0  Docking thE Strategy lee ia eccesso tb e ERR DERRDUUEROIHMREIB  N NE PES 1  Using QUICKIFING E TET 2  OPENING a Chart   asso eo et Quite odds a et dde cei he be tees edd 3  OPINI BIO CK NER NER TT TTE  4  Rading a SORTS I  ERE RHET 8  Corfiguririg a Control ENGINE         eror erret IR erre RE mecaadayagens eds 22  COMPU ING TNE Hate y aeaa brem Uc add Un aeaurntanaaa aces E PRSE RUNE 24  Running tne Strategy Js usse btt eene tae tib ed ne emi ed abe dni eR dee deb gai 26  INSPECTING  Messages  iiiaio t Get ete EE RR LED pU ete peid pels 28  Stepping lhrough the  Chatt d axes scadercdaden coe rox cob E RRRE I D Reb Pens 28  Penis ac 30  Compiling and Downloading the Change          sssssssssssssss een e eee e eee 33  Using a Watch WINGO
84.  can also use CTRL X  cut   CTRL C  copy   and  CTRL V  paste     4  When you have finished changing text  click outside the text frame     The text block stays the same width but changes length to accommodate additional or deleted  text  To change the size or shape of the text block  see    Resizing Blocks or Text Blocks    on  page 212     PAC Control User s Guide 209    WORKING WITH CHART ELEMENTS       PAKO    Selecting Elements    Before you can manipulate most elements  you need to select them  Start with the chart open and  the strategy in Configure or Online mode    1  Click the Select tool 4     2  To select an action  OptoScript  condition  continue  or text block  click the block     Handles appear around the block   NH O      B uE  die Handles   P fi    3  Toselect a connection  click it     Handles appear at the elbows and end points of the connection     i Fowo      Handles       4  To select all connections entering or exiting a block  click the block  click the right mouse  button  and choose Select Connections from the pop up menu     5  To select more than one element  do one of the following       Select the first element  hold down the SHIFT key  and select additional elements         Clickand drag the mouse to draw a rectangle completely around the elements you want to  select         To select all items of the same type  right click anywhere in the window and choose Select  from the pop up menu  From the sub menu  choose the item type you want     Moving
85.  can save the strategy to flash at any time when you are in Debug mode  To do so  choose  Control Engine  gt  Save Strategy to Flash     Saving to Flash on Every Download    CAUTION  It is possible to wear out flash memory if you save to it many  many times  Use the following  steps only when your strategy is finished     1     When you have finished the strategy and are in Configure mode  choose File  gt  Strategy  Options    In the Strategy Options dialog box  click the Download tab  Check Save strategy to flash  memory after download     Strategy Options         Archive   Download   Legacy   Serial 1 0 Ports      Flash Memory  Save strategy to flash memory after download    Set autorun flag after download    Background Downloading     v  se background downloading and fast strategy updating     The controller must be configured for this feature using PAC Manager     Download Compression  None Full                If a control engine loses power and then restarts  the autorun flag tells the control engine to  automatically start running the strategy that is in flash memory  If the autorun flag is not set   the strategy must be started manually after power is restored to the control engine     To have the strategy run automatically after a control engine restarts  check Set autorun flag  after download     Click OK     PAC Control User s Guide 165    ARCHIVING STRATEGIES ON THE COMPUTER       Archiving Strategies on the Computer    Archiving strategies to the computer helps yo
86.  change  Similarly  an off latch is set when the value of a digital point changes from on to off  and  it remains set until cleared     To read a latch and clear it at the same time  use the command Get  amp  Clear On Latch or Get  amp  Clear  Off Latch     Counters    Most standard digital inputs can be used as counters to count the number of times the input  changes from off to on  The availability of counters depends on the brain s capabilities  and the  speed of counters depends on the module     For information on brain capabilities  see form 1689  the SNAP PAC Brains Data Sheet     For more information on module counting speed  see the module s specifications on the Opto 22  website  www Opto22 com  On the website  select Products  gt  SNAP PAC System  gt  Brains and I O  gt   Digital I O     NOTE  You can use counters on high density modules with SNAP PAC R1 controllers and SNAP PAC EB1  and SNAP PAC SB1 brains with firmware 8 1 or newer     Before using a counter  you must configure the point as a counter   See  Adding a Digital I O Point   on page 122 or use PAC Manager   Counters on Ethernet and SNAP PAC I O units do not need to be  started  and they cannot be stopped  Therefore  do not use the Start Counter and Stop Counter  commands with SNAP PAC I O units  However  you can use Get Counter and Get  amp  Clear Counter     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Quadrature Counters    Quadrature counters require a special module and c
87.  chart export file   cxf file  and  then import it into the strategy where you want it     Exporting a Chart    1  With the strategy open and in Configure or Online mode  choose Chart  gt  Export   The Export Chart dialog box appears     Export Chart       Sprinkler Control       Desctiption  Description     Controls sprinklers for the front     lawn                       2  Inthe From section of the dialog box  select the chart to be exported from the Name  drop down list     3  Inthe To section of the dialog box  click Select     Select Destination for Export File       Save in    O PAC Control             Save as type    PAC Control Chart Export Files    c  f  v                PAC Control User s Guide 215    EXPORTING AND IMPORTING CHARTS       216    4  Navigate to where you want the exported chart file to be saved  In the File name field  enter a    name for the exported chart  Click Save     You return to the Export Chart dialog box  which now shows the path and file name in the To  section      Optional  Enter a description for the new chart   Click OK     The exported chart is saved  You can import it into any PAC Control strategy  See the next  section for information on importing charts     Importing a Chart    Use the Automatic Chart Import dialog box to import a chart previously exported  Also see     Exporting a Chart    on page 215     With the strategy open and in Configure mode  choose Chart  gt  Import   The Automatic Chart Import dialog box appears     Autom
88.  configure mode  choose Edit  gt  Find    73   select Global and Operand  and then click Find to search for objects with the  same name as the subroutine  Rename any objects that you find                 Drawing the Flowchart    1  Inthe PAC Control main window  with or without a strategy open   choose Subroutine    New     The Create New Subroutine dialog box appears     Create New Subroutine                         Files of type    PAC Control Subroutine Files   isb  v            2  Enter a subroutine name     The subroutine name will become a command  instruction  in PAC Control  It s a good idea to  make it a descriptive name indicating the purpose of the subroutine  for example     Variable  Increase Notification     You cannot use the name of any existing command  for example     Add         3  Navigate to the directory where you want to store the subroutine and click Open   Unlike strategies  multiple subroutines can be saved to the same directory     A new subroutine window is created     PAC Control User s Guide 349    CREATING SUBROUTINES           Variable Increase Notification SEE        3  Shortcuts                4  Add blocks and connections and name the blocks as you would in a chart  as shown in the  example below         Variable Increase Notification    SEE               You can also copy existing flowchart blocks from another subroutine or chart and paste them  into the new subroutine  See  Cutting  Copying  and Pasting Elements    on page 211     5  Save 
89.  drops the dough and chips on the conveyor belt    amp     Charts The belt must be running between 50  and 65  of max rpm     E  95 Alarms     amp  By Dough Chip Control The Powerup chart starts  E  95 Dough Vessel Pressure   this chart   E  RB Dven Inspection Control     95 Powerup  a  C Variables  E  C Numeric Variables  aa  bStartFlag    132  PE diCookieMotionTimer This chart runs  bal fDoughPressureSetpe continuously once the   8 8  tRampValue program has been started     FLT    Gal fSetpointMinusD eadb    FLT     12  nChartStatus    132    na nCookieMotionPreset  v    2  nLoopCounter A  fl    gt              v  JLNext 4  Prev             PAC Control  Ready Configure       2  Click and drag the title bar of the chart window if necessary to see the maximize button at the  upper right  Click the maximize button     PAC Control User s Guide    OPENING A BLOCK       The chart now covers the whole frame  Notice the tabs at the bottom of the main window  the  white tab tells you you re viewing a chart  and the gray tab shows the chart s name     IPAC Control Basic    Dough  Chip  Control  DER  RE File Edit Configure Chart Subroutine Compile Mode Tools View Window Help     x    Tn Od 0550 An 5009005202896        gt  Em Cooki This chart drops the dough and chips on the conveyor belt   a  ey Cookies   The belt must be running between 50  and 65  of max rpm    C3 Control Engines      Subroutines Included The Powerup chart starts   amp   Ey Charts this chart   E  B Alarms  E  B   Do
90.  editor and verifying there is only one line that says     BEGIN CERTIFICATE          Follow the steps below to place the root certificate in  pki root certs on the SNAP PAC controller   Make sure to execute the Save Files to Flash command and restart the device  For more information   see    Moving Files to the SNAP PAC Controller or I O Unit  in form 1704  the PAC Manager User s Guide     Open PAC Manager and Click the Maintenance button      1    2  Select the Upload File to I O Unit command    3  Inthe Command list  highlight Upload File To I O Unit    4  Nextto Filename field  click the browse button El and locate the Base64 ASCII root certificate  file    5  Inthe Destination field  enter  pki root certs  lt filename gt   where   filename   is the  desired filename for this file on the SNAP PAC device    6  Inthe IP Addresses list  select the IP address of the SNAP PAC device    7  Click Execute   8  Repeat steps 3 7 for each CA root certificate required     9  Select the Save Files To Flash command   10  Click Execute  11  Restart the SNAP PAC device for the newly installed root certificates to be registered     Send Email with Attachments Example    The simple example strategy below demonstrates how to use OptoScript to create and send an  email using the Send Ernail with Attachments command  You can of course use the PAC Control  versions of the Send Email commands  However  with OptoScript you can more easily see and edit  each ofthe email components   the Server in
91.  eem 356  DEBUGGING SUbroUtiries       voe e mienia rin cmi vac Poe pde eres enr eer ies 358  Viewing SUBROUTINES  1 11 dde eU ER HEP OP UR de WIRE Ret EAR MSV Rees 358  Viewing All Subroutines in a Strategy    359  Printing  SUBIOULINES    u c sect prd E dangddd epe dd ds tap T pid ig bis dre ds 359  Appendix A  Troubleshooting                 eese 361  How to Begin Troubleshooting    ure tbe eet e tene qe d va 361  1  Read Any Error Message BOX        ssssssssssssssssssss enne 361   2  Check Communication with the Control Engine                 0  cece eee eee 361   a  Checktne Message QUSS  ree qe rese Ye ED EDO ROCHE ETE EDEPOL HER  362   4  Check Status Codes in Your Strategy         ssssssssssssssss cece eect eee eeees 362   5  CallIPrOdUGL SUPPOME 345 43 Deus sei IRR EUER us 362  Strategy Problems    cci nena caginad reser sex dah vete E EEE lt qe aub ebree 362  If You Cannot Delete an  ESI 43 cx ine dco dte beatus dci ROI Paral oh ab a da bed 362  Tae Eta ve MEMORIES us dia apad UR BORA AG Rer s RS aod a n e 363  Archiving Strategies to Battery Backed RAM            ssssssssssss 363   DO VOW SE  Online Mde  ay uses ce t arto ten e een ae e ve Rad 363  Checking Communication with the Control Engine           0 0 2    cece cece e eee 364  Resolving Communication Problems    ric bere UR RE RR Se o red dad sade bed enews 365  Matching PAC Control Configuration to the Real World                 ccc cee ee eee e ees 365  Resolving TCP IP Cannot Connect Errors   412  2 0 0 2
92.  features in SNAP PAC I O units  such as ramping and pulsing   and offers additional data types  in subroutines  PAC Control Professional also provides a migration path for Opto 22  FactoryFloor   customers by adding support for serial based mistic I O units and by including a  conversion utility to help customers move older OptoControl  strategies to PAC Control  PAC  Control Professional includes about 500 commands  For information on features supported by  a specific controller  see the controller documentation     About this Guide    This user s guide not only teaches you how to use PAC Control  but also provides programming  instruction and tips  The separate PAC Control Command Reference describes in detail all PAC Control  programming commands and instructions     This guide assurnes that you are already familiar with Microsoft  Windows    on your personal  computer  including how to use a mouse  standard commands  and menu items to open  save  and  close files  If you are not familiar with Windows or your PC  refer to the documentation from  Microsoft and your computer manufacturer     PAC Control User s Guide    ABOUT THIS GUIDE        amp   Ge    This guide covers both PAC Control Basic and PAC Control Professional  Features that are available  only in PAC Control Professional are marked with      The Basic icon indicates features or functions that apply only to PAC Control Basic   The Professional icon indicates features or functions that apply only to PAC Control 
93.  for most systems  Your system may  require a larger or a smaller change to stay within safety constraints     Wait for a discernible change in the Input axis     148 PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       Plot 1 0 Details   Misc  Details   IVAL Velocity Algorithm  Type B     Input    Setpoint  Dutput    The Input axis  indicated by  the upper white arrow  added to this picture   begins to respond to the  change in output  lower  white arrow                 Data p  Input Axis  gt     Dutput Axis    Time Axis  gt          12  Increase the resolution of the Time Axis by clicking the Time Axis button and choosing a lower  percentage  such as View 1 Minute Span     13  Scroll the Time Axis to locate the point at which you changed the Output     Both the time and input axes should display the point at which the Output changed  the lag   and the point the input changed  If not  adjust the Input axis and Time axis  until this  information is displayed     Plot 1 0 Details   Misc  Details   VAL   Velocity Algorithm  Type B     78 00          f Data  gt    Input Axis  gt     Dutput Axis p    Time Axis  gt  J       14  From the Data menu  select Cursor   The data cursor  a line with a value bar attached to it  appears on the plot     15  Right click the data cursor and choose Delta X from the Style submenu  as shown below     PAC Control User s Guide 149    INSPECTING AND TUNING PID LOOPS       Plot 140 Details   Misc  Details   IV  L   Velocity Algorithm  Type
94.  gt   View Print  gt  Database    2  To view the same summary for a subroutine  open the subroutine window and select  Subroutine  gt  View Print  gt  Database        The View Print Database dialog box appears     View Print Database    Include   Numeric Variables Numeric Tables   String Variables String Tables   Pointer Variables Pointer Tables   1 0 Units  amp  Points Communication Handles  PID Loops Event Reactions    C  Descriptions       3  Make sure all element types you want to include are checked  Click to uncheck any elements  you do not want     4  To include descriptive comments associated with the elements  click to put a check mark next  to Descriptions     5  Click OK     PAC Control processes the database and puts the data in the Database window     188 PAC Control User   s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Save Search  Print       Sprinkler_Control   Database    TITLE  Strategy Database  STRATEGY  Sprinkler Control  DATE  08 21 04 TIME  12 49 44    NUMERIC VARIABLES  ME OOO e o U UU U U UU U UMMM    Day_of_the_Week   Packer_Busy INT   Status INT   Sum INT   Timer DN TIMER RUN    COMMUNICATION HANDLES       You may need to resize the window and use the scroll bar to see all the data  For each element  the name and reference count  that is  how many times the element is used in strategy  commands  are shown  plus other information depending on the element type  The figure  above shows numeric variables and communication handles     6  To print th
95.  in    Data Types for Subroutines    on  page 348     Adding Variables    This section includes steps for adding numeric  string  pointer  and communication handle variables    For numeric  string  and pointer tables  see    Adding Tables    on page 224      1  With the strategy or subroutine open in Configure mode  choose Configure  gt  Variables   The Configure Variables dialog box opens     I Configure Variables          Xi Numeric Variables Scope    Global v          Name   Type Init Type Init Value Description Ref Count  bStartFlag Integer 32 Download  dtCookieMotionTi    Down Timer Run For animation in io     fDoughPressureS    Float Persistent Desired dough ve     fRampValue Float Run For ramping the c     fSetpointMinusDe    Float Run Dough vessel pre     nChartStatus Integer 32 Persistent  nCookieMotionPre    Integer 32 Run For animation in io     nLoopCounter Integer 32 Run     lt     NON   P    nP                 This dialog box lists all the variables in the strategy or subroutine that are of the type shown in  the Type field  You can sort the data in this dialog by clicking any one of the column header  buttons     2  Inthe Type drop down list  choose the type of variable you want to configure     w    If you are adding the variable to a subroutine  select Subroutine in the Scope drop down list   4  loadda new variable  click Add     PAC Control User s Guide 221    ADDING VARIABLES       The Add Variable dialog box appears     5  Complete the fields as described 
96.  in  AI Valid Types    acConveyorS peedControl          If you knew the exact name of the command to enter  you could type it over Absolute Value   which is first in the alphabetical list of commands   As you typed  the first command that  matched the pattern you entered would be filled in automatically  For example  if you really  wanted to enter Absolute Value  you would start typing abs    Another way to add a command is to click the down arrow just to the left of the Select button   You could scroll through the resulting list of commands to find the right one     The third way to enter a command is the one we ll use here     4  Click Select     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       I Select Instruction    Groups  Instructions        Analog Point     ESIISA  Chart Add   Communication Arecosine   Control Engine Arcsine   Deprecated Arctangent   Digital Point Clamp Float T able Element  Error Handling Clamp Float Variable  Event Reaction Clamp Integer 32 Table Element  High Density Digital Module Clamp Integer 32 Variable   140 Unit Complement   1 0 Unit   Event Message Cosine   140 Unit   Memory Map   Decrement Variable   170 Unit   Scratch Pad Divide   Logical Generate Random Number  CE   Hypetboic Cosine  Miscellaneous Hyperbolic Sine   PID   Ethernet      Hyperbolic Tangent                All PAC Control command groups are listed on the left  and commands in the highlighted  group are listed on the right  The command we want has something to d
97.  in the PAC Control Directory    Subroutine configuration information    Compiled subroutine  component of the run file     382     lt xxx gt  io def    ioCtrl exe   PAC Control cnt   PAC Control GID   PAC Control hlp   PAC ControlCommands cnt  PAC ControlCommands GID  PAC ControlCommands hlp    ioCtrlTools dat    ioSnif log  OptoScriptTemp txt  Readme txt    PAC Control User s Guide    Object definition files  commands  I O points  and I O units   You must not  modify these files     PAC Control executable file   PAC Control help contents file   PAC Control help support file  created when you launch the help file   PAC Control help file   Commands help contents file   Commands help support file  created when you launch the help file   Commands help file    File that lists software applications you ve configured in the Tools menu to  launch from PAC Control    PAC Message Viewer log file  A temporary file  README text file containing information about PAC Control       D  Sample Strategy    Introduction    Chapter 2 introduced the Cookies strategy  a sample project used to illustrate how PAC Control  works  Although this strategy is based on a mythical factory  you may want to know more about the  factory  its process  and its hardware  This appendix gives you that information     Factory Schematic    The following schematic drawing summarizes the cookie factory     PRESSURE  CONTROLLER    1                   PLANT  N o  AIR    DOUGH    LOW LEVEL VESSEL LOW LEVEL PLANT  ALARM
98.  input to a particular value  To do  so  you must disable the input first    You can disable an I O point or unit in two ways  The more common way is from within Debug  mode  by double clicking a point on the Strategy Tree and modifying the point s settings and values  through the Inspection dialog box  The second way is from within the strategy  using commands  such as Disable Communication to Digital Point  Disable Communication to Analog Point  or Disable  Communication to I O Unit   See  Simulation Commands  on page 305      Additional Commands to Use with Standard Digital Points  Although not listed under Digital Point commands  several other commands can be used for digital  operations     e   Use Move to cause an output to assume the state of another input or output  A digital input or  output that is on returns a True  non zero   A True  non zero  sent to a digital output turns it on     e Use NOT to cause an output on one I O unit to assume the opposite state of an input on  another I O unit     e Use Get I O Unit as Binary Value to get the state of all points at once  Then use Bit Test to  determine the state of individual points  This method is much faster than reading each point  individually     e     Use Set I O Unit From MOMO Masks to control all outputs at once     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Standard Digital Points and OptoScript Code    In OptoScript code  a standard digital I O point can be used directly  wherever
99.  later errors are often a result of earlier errors  To check a  command  place the cursor anywhere in the command name and click the Command Help  button  If you need to add variables or other items that don t exist in the strategy  do so after  step 12     13  When you have finished with the code in this OptoScript block  click OK to save your work and  close the editor     You return to the flowchart     Troubleshooting  Unable To Find  Errors    See also   Troubleshooting Syntax Errors  below    If you test compile an OptoScript block and receive  unable to find  errors  try the following  suggestions    For Commands    Check the exact spelling of the command  including upper and lower case  OptoScript commands  are similar to standard PAC Control commands  but contain no spaces and some abbreviations     Also check that the command is necessary in OptoScript  Some common commands  including  comparison commands such as Less  and mathematical commands such as Add  are replaced with  operators built into the OptoScript language  Check Appendix  E  OptoScript Language Reference      for equivalent OptoScript commands     The easiest way to make sure the command you enter is valid is to enter it by clicking one of the  Insert Command buttons in the OptoScript Editor and choosing the command from the Select  Instruction dialog box     PAC Control User s Guide    CHAPTER 11  USING OPTOSCRIPT       For Variables or Other Configured Items    Variables  I O units and points  count
100.  navigate to it  When  the filename appears in the File to Download field  click OK     The file is downloaded to the control engine     Using Command Lines or a DOS Batch File to Perform PAC Terminal Tasks    If you do not want your end user to have to use PAC Terminal  you can use DOS level commands or  create a DOS batch file to download a  cdf file  In addition to downloading a  cdf file  the DOS  commands can also run or stop a strategy  or define the control engine on the PC that will download  the file  PAC Terminal must be installed on the PC where the batch file is used     The following table lists actions you may want to take within PAC Terminal     Show help information for termcl  h control engine name       Download the specified file to the specified controller     Compression can be between 0  none  and 10  max    d control engine name filename   z compression     Run the strategy in the specified control engine  r control engine name                PAC Control User s Guide 173    COMPILING AND DOWNLOADING       Stop the strategy in the specified control engine     s control engine name       Send a Forth command to the control engine    Add a control engine definition to the system  Does not modify an  existing definition   Example   a MyCE tcp 10 20 30 40 22001 0 2000     c control engine name Forth command     a control engine name tcp ip addr port retries timeout ms       Download the encrypted SSD file to the controller     dp control engine name ssd file
101.  of the text in any block   1  Click the Select tool L and click the block to select it    2  Right click the block and choose Font from the pop up menu    3  Inthe Font dialog box  make the changes you want  Click OK   4    To change whether text appears at the left  the center  or the right of a block  select the block  and click the right mouse button  From the pop up menu  choose Justify  from the sub menu   choose Left  Center  or Right     Changing an Element Back to the Defaults  1  Select the item and click the right mouse button   2  Fromthe pop up menu  choose Properties  From the sub menu  choose Copy from Default     To change defaults  see  Changing the Appearance of Elements in a Chart Window  on  page 203     Opening  Saving  and Closing Charts    212    Opening a Chart    Make sure the strategy is open  In the Strategy Tree  double click the chart you want to open     You can also open a chart by selecting Chart  gt  Open  and then double clicking the chart name in  the Open Chart dialog box  which lists all charts that are not currently open     If a chart is open but not visible on the screen  click the chart s name tab at the bottom of the  window to make it visible     PAC Control User s Guide    CHAPTER 8  WORKING WITH FLOWCHARTS       Saving a Chart  1  Make sure the chart is open and is the active window   2  From the Chart menu  choose Save     Charts are automatically saved when you choose File  gt  Save All  If you choose File  gt  Save Strategy  or 
102.  on  See  9  Using Variables  and Commands    for more information  Action blocks can have more than one entrance but only  one exit    Condition Blocks are diamonds containing questions that control the logical flow of a strategy   Condition blocks can have many entrances  but only two exits  True and False    OptoScript Blocks are hexagons containing OptoScript code  a procedural language you may want  to use to simplify certain tasks  See  11  Using OptoScript  for more information  OptoScript blocks  can have more than one entrance but only one exit     PAC Control User s Guide    CHAPTER 8  WORKING WITH FLOWCHARTS       Continue Blocks are ovals that contain no commands  but simply route chart logic to a new  location  such as to the top of a chart  These blocks help keep charts neat by avoiding awkward  connections between two blocks that are far apart     Sync Blocks are used in charts that control systems with controller redundancy  When a sync block  is encountered  the redundant controllers are synchronized  For more information  see form 1831   the SNAP PAC Redundancy Option User s Guide     Connections are lines with arrows that connect one block to the next  directing the flow of strategy  logic     Text explains the chart s purpose and elements for anyone who needs to understand them later     Using the Drawing Toolbar    The drawing toolbar includes tools for each of the elements plus a Select tool  or pointer  for  manipulating elements     Action block  OptoS
103.  only supported in standard confgurations  not redundant ones  In order to use a  hostname  your network must have a domain name server  DNS  and the hostname must already  have been entered in your DNS either by you or someone in your IT department     e   For Standard  Enter the IP address or hostname of the control engine     e   For Redundant Networks  PRO only   Enter the Primary and Secondary IP addresses  The  Primary address is ETHERNET 1 on a SNAP PAC controller  and the Secondary IP address is  ETHERNET 2  Both IP addresses use the same port number  See  Using Ethernet Link  Redundancy in PAC Control  on page 94 for more information     Go e For Redundant Controllers  PRO only   For the SNAP PAC Redundancy Option  Enter addresses  for Controller 1  Controller 2  and Arbiter  For more information on setting up the Redundancy  Option  see form 1831  the SNAP PAC Redundancy Option User s Guide     6       D   Port  Enter the control engine s IP port number  The default of 22001 is the port of the host  task on the control engine  this default normally should not be changed     E   Retries  Retries indicate the number of times PAC Control will reattempt communications  with the control engine  Since retries are automatically handled by the protocol  TCP IP   enter zero  here     F   Timeout  Enter the timeout value in milliseconds  Timeout value is the length of time PAC  Control tries to establish communication through the port  If it fails  it tries again as many time
104.  ports on the controller or communication handles using these ports     NOTE  Once you have configured a serial port for use with an I O unit  do not configure a communication  handle on the same port     1  Make sure the strategy is open and in Configure mode   2  Choose File  gt  Strategy Options  then click the Serial I O Ports tab     Strategy Options      Archive   Download   Legacy   Serial 1 0 Ports    The SNAP PAC S1 and SNAP PAC S2 controllers may use serial 1 0 units such as the B3000  or SNAP PAC SB1              The port type must first be set to RS 485  either by using default ports or by PAC Manager       You must also configure which ports will be used for 1 0 within this strategy   C Use port 0 for 1 0 using 4  baud and mode  SNAP PAC S2 only   C Use port 1 for 1 0 using 40 baud and mode  SNAP PAC S2 only   C Use port 2 for 1 0 using 401 baud and mode  SNAP PAC 52 or  51   C Use port 3 for 1 0 using 4i baud and mode  SNAP PAC S2 only     Serial ports may also be used for communicating with other devices by using PAC Control  communication handles                 3  Select the correct port for the controller  and then choose the correct baud rate from the  drop down list and click OK     NOTE  If you are configuring a SNAP PAC S1 controller you must use port 2  If you are using a  SNAP PAC S2  see Opto 22 form 1704  the PAC Manager User    Guide  for the default serial port  assignments or to change a serial port assignment     Changing the Baud Rate and Mode f
105.  s Definition    Whenever necessary  you can change a control engine s definition on your PC   its name  the port  the PC uses to communicate with it  or the PC port setup  such as timeouts and retries   These  changes can be made either in PAC Control or in the PAC Terminal utility     1  Chooseone of the following       In PAC Control  With the strategy open in Configure mode or Online mode  right click the  control engine name on the Strategy Tree and choose Modify from the pop up menu       In PAC Terminal  Choose Start  gt  Programs  gt  Opto 22  gt  PAC Project 9 2  gt  Tools  gt  PAC  Terminal  From the Configure menu  choose Control Engine     Select Control Engine dialog box appears     PAC Control User s Guide ES    CHANGING OR DELETING A CONTROL ENGINE       100    2  Inthe Select Control Engine dialog box  click the control engine you want to change and click  Modify    3  Make the necessary changes  following the same steps you would for configuring the control  engine initially   For help  see  Defining a Control Engine on Your PC  on page 90      Changing the Control Engine that Receives the Downloaded  Strategy    You can configure several control engines for a strategy  but only one at a time can receive the  downloaded strategy  The control engine that receives the strategy is called the active engine     NOTE  In PAC Control Professional  you can also configure a control engine for Ethernet link redundancy   see  Using Ethernet Link Redundancy in PAC Contro
106.  s part of a chart showing how you would use a count variable in this way     Shipping_Area    tInstructions   Shipping  Area   Set count to 1               RERET   1  a  Wt ow Bag  Count               Increment Variable       Bag  Count            T instructions   Shipping  Area   Count   12     STIEST  i   i           l   Is Bag_Count          Se   NL SL Next Block          Previous Block            perator     AND          If you are an experienced programmer  you ll notice that this example is a   ox loop  You can use the  following OptoScript code within a single OptoScript block to accomplish the same result   for Bag Count   1 to 12 step 1   Count 12 items dropped into box   Bag Dropper   1    Turn on bag dropper  next  See Chapter 11  Using OptoScript for more information on using code to streamline control  structures in your strategy     PAC Control User s Guide    INSTRUCTION EXAMPLES       Programming Case Statements    A frequent need in programming is to create case statements  also called    switch    statements    if then else  statements  or  nested if  statements  These statements create multiple decision  points  if the condition is A  then X will happen  if the condition is B  then Y will happen  and so on    This example uses regular PAC Control commands  see Chapter 11  Using OptoScript for another  option that takes up less space in your flowchart      For example  suppose you have a conveyor with three speeds  high  3   low  2   and stopped  1    Somet
107.  scroll bar to see all the data     2  To print the data  click the Print button on the toolbar  To save it to a text file  click the Save  button  To search the data  click the Search button  When finished  close the window     Viewing and Printing I O Point Mappings    You can view and print a report that shows the location and mappings of I O points  You can use  this report as a look up table for programming purposes  This can be useful with some commands  that use different point mappings such as Move I O Unit to Numeric Table Ex  Move Numeric Table  to I O Unit Ex and IVAL Move Numeric Table to I O Unit Ex     This report basically provides the same information provided in the appendix Table Index Offset   Examples in the PAC Control Command Reference  form 1701  but for the actual points in the strategy    1  To produce an I O point mappings report for a strategy  open the strategy and select File  gt   View Print  gt  I O Point Mappings     View Print 1 0 Point Mappings    This report shows where all the configured points are located on modules and  how they map out to various point mappings  This can be useful with some  commands that use different point mappings  like  Move 1 0 Unit to Numeric  Table Ex      Report Style     Formatted    Comma separated    Options  Module Positions 4 channel mappings 16 channel mappings  Channel Positions 8 channel mappings 32 channel mappings      Cancel       PAC Control User s Guide 191    SEARCHING AND REPLACING       2  Onthe V
108.  so the sequence ID does not match the current  sequence ID   Possible problems     Network problems  Out of sync errors typically occur  when communication to the I O unit is via a network with  high latency or inconsistent latency  such as wireless Ether   net  radio modem  cell modem  etc  This usually does not  occur on a wired network because normal response times  are much shorter than the default timeout period for I O  Units  typically 1 Sec      Note  If an Ethernet packet from a controller to an I O unit  gets dropped  you would get a  539 error instead of an  out of sync error       The timeout interval is too short  Increase the timeout  value to reduce out of sync errors        All  10 000  and  11 000    Various descriptions   errors    Socket or network problems  Check cables and connections  to control engine  cycle power to control engine                       PAC Control User s Guide 379    LIST OF COMMON MESSAGES       380 PAC Control User   s Guide       Introduction    C  PAC Control Files    This appendix lists all of the PAC Control file types and special files  You can use this information to  determine what types of files are present in your PAC Control project directory     Files Related to a Strategy     lt strategy gt  idb   lt strategy gt  crf   lt strategy gt  crn   lt strategy gt  crn1   lt strategy gt  crn2   lt strategy gt  crn3     lt strategy gt  inc     lt strategy gt  inf   lt strategy gt   idb   lt strategy gt  lidb   lt strategy gt  per 
109.  span of the input  output  and time axes according to how much change you expect  from your system  To set a span  click the axis button and choose from the pop up menu     7  If desired  type a new Scan Rate and click Apply     For most systems  you should use an appropriate scan rate based on the system lag  see   Determining System Lag  on page 147   However  you can experiment with Scan Rates before  tuning the P    and D constants or adjust scan rate after tuning     Here is an example for Scan Rate     152 PAC Control User   s Guide    The lag for this system was  determined to be about 2  seconds  The left half of the  plot reflects a 0 5 second  scan rate  while the righ  half shows a 3 second scan  rate  Notice both scan rates  have the same effect on the  input  however  the  3 second scan rate is using  less of the processor s  resources           CHAPTER 6  WORKING WITH I O       3    TemperatureControl      View PID Loop  scanning   Name    TemperatureControl Error   None    Input  80 24991 Gain   5 Scan Rate  3  Setpoint   80 Tune    1 0    Scan Counts    112783 Enable comm  Yes     Y  Output  0 Tune D   0    Plot 1 0 Details   Misc  Details   IV  L   Velocity Algorithm  Type B        Input  E int  Output      E 0 Of    0  Data p     Input Axis  gt     Output Axis Time Axis  gt           Experiment with gain settings by typing a new value in the Gain field and clicking Apply     The easiest way to tune most PIDs is to experiment with the gain constant first  Tr
110.  step 5 for each parameter  To change a parameter  highlight it and click Modify  To  change the order of a parameter in the list  highlight it and click the up  or down arrow button  in the dialog box  To delete a parameter  highlight it and click Delete     NOTE  You cannot delete the Put Status In parameter or change its order in the list  and you cannot  delete a parameter that has a reference count greater than zero  indicating that it is used in the  subroutine   Also  ifyou add or delete parameters after including a subroutine in a strategy  you may  receive an error and will need to add the subroutine to the strategy again    7  When the parameters appear the way you want them in the list  click OK     The parameters you have named can now be used in the subroutine   s commands     Configured Parameters Example    Here s an example of a completed Configure Subroutine Parameters dialog box  showing three  parameters to be passed into the subroutine  When the subroutine is called from the strategy  these  parameters appear in the Add Instruction dialog box     PAC Control User s Guide 353    CREATING SUBROUTINES          I Configure Subroutine Parameters                  Subroutine Name  Group          Variable Increase Notification     Subroutines v       Subroutine s OptoScript Name  Names used in the  subroutine may differ from    those used in the strategy        Variable Increase Notification         Comment                 Add Edit Instruction          Prompt     
111.  string  A string with a width of 100 may currently be empty  which  means its length is zero  A string with a width of 10 containing the characters  Hello   has a length of  six  five for  Hello  and one for the space after the  o    Although a strings length may change  dynamically as the string is modified by the program  its width remains constant     When you configure a string variable or string table  you set the width of the string  All the strings in  a PAC Control string table must be of the same width     PAC Control supports a maximum string width of 1024  For applications requiring wider strings  you  can use several strings to hold the data  use string tables  or use numeric tables  as described in the  next section     Using Numeric Tables as an Alternative to Strings    Since a string is nothing more than a sequence of characters  you can store a string in a numeric  table  with each table element holding a character  The advantage of using numeric tables for  strings is that a numeric table can store strings of any size  The disadvantages are    e   Memory usage is much greater     e  Nostring conversion functions are available for numeric tables  An intermediate temporary  string would be required to use string commands for these tables     Strings in PAC Control can have a width of up to 1024     Strings and Multitasking    Although string commands are completed before the current task loses its time slice  it is important  to note that a string that is con
112.  table  may be  1             FH DstStrTblBody E  4 0 for non secure   lt  gt 0 for SSL  4 DstStrTbiHdr strCmd  77 URI    nHttpStatus     Status returned by HTTP server E  nPortSSL  4  Port to which you want to connect         H HTTP srcStrTbiBody _           StrURL    7 7 Address   numeric or www google com       v db Next 4  Prev                                          PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Make sure to assign to the controller an IP address as well as the appropriate Subnet Mask  DNS   and Gateway for the network  For more information on how do this  see form 1704  the   PAC Manager User s Guide    In order to retrieve HTTPS content from www google com  you will need to obtain the root  certificate used by the target website to validate an SSL secure connection  You must obtain  the root certificate and then register it on your SNAP PAC controller as described below     NOTE  Ifyou are using a SoftPAC controller  root certificates are not needed for using HTTP Get to  retrieve HTTPS content because Windows already has those certificates installed     Obtaining an Equifax Root Certificate  Many secure websites  including www google com    require the Equifax Secure Certificate Authority  DER encoded X 509  root certificate  which is  available on our website  www opto22 com  Go to Support  gt  Downloads and then search for  Equifax Root Certificate in Samples and Freeware     Registering a Root Certificate on a SNAP PAC Con
113.  the    folder for the chart that calls it       Sprinkler Control           Sprinkler  Control      C3 Control Engines         Subroutines Included       5 Variable Increase Notification     Charts    e EN          Subroutines Used     Variable Increase Notification    2 Messages    As Powerup    m5 Temperature Control   C variables          Numeric Variables      String Variables      Pointer Variables   Ej Communication Handles      Numeric Tables       String Tables      Pointer Tables       Yo Units    PAC Control User s Guide       In the Subroutines Included folder    In the calling chart folder    CHAPTER 12  USING SUBROUTINES       You can view  add  and change variables in a subroutine from the Strategy Tree  just as you would for  a chart     Viewing All Subroutines in a Strategy    To see all the subroutines in a strategy  double click the Subroutines Included folder on the Strategy  Tree  All subroutines associated with the strategy are listed in the Subroutine Files dialog box  Click  and drag the right side of the box to see all the information  The path  filename  and reference count   how many times the strategy refers to the subroutine  are shown for each subroutine     Printing Subroutines    For steps to print a subroutine s graphics  see  Printing Chart or Subroutine Graphics  on page 184   To view and print instructions in the subroutine s blocks  see  Viewing and Printing Strategy or  Subroutine Elements  on page 188     PAC Control User s Guide 359    
114.  the active one  but not yet running      Cancel aborts the new download  The controller is left as it was before the download occurs     When the download is complete  you are in Debug mode   If you receive errors  see A   Troubleshooting        After switching strategies  you can switch back to the original strategy by choosing Control Engine   gt  Inspect in Debug mode and use the Switch and Run or Switch button in the Inspect Control    PAC Control User   s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Engine dialog box  or you can use PAC Terminal  When the strategy is switched back  the persistent  variables are created and compared     Switching the Strategy  If there is already an active strategy which is set up to have an alternate strategy  as described in   Background Downloading  on page 170   and you want to switch strategies  do the following     1  In Debug mode  choose Control Engine  gt  Inspect to open the Inspect Control Engine dialog  box   2  Choose either the Switch and Run or the Switch button     The Switch  amp  Run button stops the active strategy and runs the strategy you just downloaded   The Switch button stops the active strategy and makes the new strategy the active one  but  not yet running      When the strategy is switched  as described in the previous steps   the following operations occur     e Persistent variables are compared  If the type and size of the persistent variable are consistent   the contents are copied  If the type and siz
115.  the fans        With Pointers and Indexing    The second way uses pointers and indexing to accomplish the same result in a smaller space  using  less control engine memory and fewer programming steps  The fan outputs and the temperature  inputs are referred to by pointers  The setpoints  instead of requiring individual variables  are simply  numbers in a table     EJ PAC Control User s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY          The flowchart sets initial values for the    Instructions   FanCtrl    Load Pointers fx              pointers  and then cycles through the pointer  Move from Pointer Table Element  tables to control the fans   Tables have already indies FanCtrlndex    been initialized in the Powerup chart   Of Table ptMotors  To Pointer pMotor E    Move from Pointer Table Element  PP GP ED OA O O eee Index FanCtrlindex LJ Next Block    va mew xt 3 Of Table ptTemps    To Pointer Previous Block    V Instructions   FanCtrl   Too Warm          Is  Greater Than Numeric Table Element    MER DER At Index FanCtrlindex       ie  is ob  SEM ies Bs Gn ay m Of Table ftSetpoints    oco o cc M o l Instructions   FanCtrl   Turn Fan On Ed                    PS M EROS    Lm     SETE  ES n  P S E E E E E T   d MMC    Next Block    Previous Block            Using OptoScript    The third way also uses pointers and indexing  but places all the action in an OptoScript block  See     11  Using OptoScript  for more information on using OptoScript     1 OptoScript   Alarms   Stop Co
116.  the strategy to find the PAC Control  command that caused the error  The easiest way to find a block is to open the chart or subroutine   then choose Center on Block from the View menu  You can click the Block column to sort the blocks  by number and locate the one with the problem     To see which line within a block is causing the error  in PAC Control Configure mode  choose  Configure  gt  Full Debug  When the error appears in the queue  it will include the line number of the  command as well as the block ID     Status Codes    Status Codes indicate the success or failure of a PAC Control command  instruction   and they are  reported by the control engine to a variable in your PAC Control strategy or as a returned value in  OptoScript  The status code is either zero  indicating a successful command  or a negative number   indicating an error      For example  suppose you use the command Transmit Numeric Table  You create a variable named  Transmit  Status to put the status of the command in  In Transmit  Status you receive either a zero   indicating that the table was successfully transmitted  or you receive a negative number such as  37  or  42     Status codes that may be returned are listed for each command in the PAC Control Command  Reference and in online help     Naming Conflicts    During various procedures  PAC Control checks for duplicate names of objects such as variables   charts  subroutines  strategy variables  OptoScript instruction names  and reserved keyw
117.  there     We recommend you archive both to the computer  during strategy development  and to the  control engine  when the strategy is completed   Archiving to the control engine as well as the  computer makes sure that an older strategy can always be found and updated  even after personnel  changes occur and years pass  See also   Archiving Strategies on the Computer  on page 166     Archive files are date and time stamped  and zipped for compact storage  The archive file name on  the control engine is in one of the following formats    PathVFilename Download D02282000 T 114351 zip   Path Filename Online D02282000 11 14351 zip   The date stamp  D  is in the format mm dd yyyy  In the examples above  the date is February 28     2000  The time stamp  T  is in the format hh mmy ss  In the examples above  the time is 51 seconds  past 11 43 A M     PAC Control User   s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES       Make sure the control engine has sufficient memory available to store the archive file  Since only one  strategy can be on the control engine at any time  only the latest archive for that strategy is on the  control engine  Other archives are erased during strategy download     In addition to the archived strategy  the archive file also stores persistent variables and variables that  are initialized on strategy download     Follow these instructions to archive a strategy to the control engine   1  In PAC Control  choose File  gt  Strategy Options     Strategy O
118.  time to transfer  and the control engine may become unresponsive  during the process     For Sending  Suppose you want to send the data currently in the file SendThisData txt on the  control engine to a file HunkoData txt on the device   Heres how you would send the data in your PAC Control strategy     1  Use the command Open Outgoing Communication to open an FTP communication handle   The value of the handle would be    tp 10 192 56 45 21 JoeG  hello    2  Usethe condition Communication Open  to make sure the communication handle opened     3  Usethe command Send Communication Handle Command to specify the filename and send  the file in one step        Use the communication handle command send   local filename      remote filename   as  follows     send SendThisData txt HunkoData txt  If the remote filename already exists  it is overwritten    4  When you have finished sending data to the file  use the command Close Communication to  close the communication handle     For Retrieving  Suppose you want to get the data from the file GetThisData txt on the device  and  retrieve it to the file HunkoData txt on the control engine   Heres how you would retrieve the data in your PAC Control strategy     1  Usethe command Open Outgoing Communication to open an FTP communication handle   The value of the handle would be    tp 10 192 56 45 21 JoeG  hello    2  Usethe condition Communication Open  to make sure the communication handle opened     PAC Control User s Guide    CHAPTER 10 
119.  to an industrial process  When you automate a process   you are less dependent on human action to carry out the process  The process generally becomes  faster  more accurate  and more reliable  For example  take a look at the tank level and pump  combination in the diagram on the previous page  Instead of having a person watch the level in the  tank and turn the pump on or off when the level gets too low or too high  you can automate the  process by installing a processor and I O  The processor and I O respond in milliseconds and are on  the job 24 hours a day     Control Engines    In an Opto 22 PAC Control system  the control engine is the programmable component in Opto 22  controllers that provides the intelligence required for automation     Using PAC Control  you create a software program  a strategy  that tells the control engine how  every aspect of a process should work  You download the strategy to a Opto 22 control engine  which runs it as a stand alone application  On a SNAP PAC controller  the strategy is stored in the  controller s electronic memory  the development PC can be turned off or used for other operations  while the control engine runs the program  Whenever necessary you can modify the strategy and  download it again to the control engine     In the diagram on the previous page  one SNAP PAC S series controller runs the program that  controls the three areas of automation     Digital and Analog Inputs and Outputs    An industrial process can include ma
120.  to run in any  strategy is the Powerup chart  so we ll look at it first     1  Double click the Powerup chart on the Strategy Tree  When it opens  notice that it says  Stopped at the bottom left     2  Click the Run Strategy button p      A dialog box asks if you are sure you want to run the strategy   3  Click Start Strategy     A progress window appears  perhaps only briefly  And at the bottom of the chart window  the  word Stopped changes to Running  Let s try pausing the program to see where we are     4  Clickthe Pause Chart button m      PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       IPAC Control Professional    Powerup  DER    1 File Edit ControlEngine Debug Chart Subroutine Mode Tools View Watch Window Help     X     Ci confio    Debus Di or 5 0m u     25  Cookies      a    Cookies       Control Engines  u Cookie Controller       Subroutines Included   amp     Charts  E D Alarms   amp  Bs Deugh Chip  Control   do Wait until start flag is set    B   Dough Vessel Pressure       5 Yn  true  non zero    E B   Interrupt      D Oven_Inspection_Control  E B Powerup  Gm   amp  Variables Start the alarm monitoring   a  C3 Numeric Variables dough chip control  pressure  Oa  bChipDispenseValve control  and oven inspection    El bChipLevelSwitch charts     132     18  BDoughDispenseVah    132     18  bDoughLevelSwitch    132    HE bDoughPressureCont sv       EE   G  Shortcuts   96    lt  i   m    v  db Next  P Prev Powerup    PAC Control  Ready          This c
121.  units unable to  communicate     The solution is to connect all these devices on two networks  if one network goes down  devices can  communicate on the other  Note that each computer has two network interface cards  NICs   1 0  units are controlled by the controller  Each I O unit is connected to its own group of sensors and  actuators  but all are connected to the same two networks     If one network needs maintenance  for example to replace a switch  you can safely shut it down  using the Set Target Address commands in PAC Control and options in PAC Display Professional     PAC Control User s Guide    USING ETHERNET LINK REDUNDANCY IN PAC CONTROL          PC with two NICs PC with two NICs Opto 22 Redundant Network  running PAC Display Pro running PAC Display Pro       Ethernet switch  running OptoOPCServer Ethernet switch   network  1           as PAC Display scanner  network  2    Sensors and Sensors and actuators     actuators  location  1 location  2          Example 2  Ethernet Link  Computer  and Software Redundancy    The second example of link redundancy illustrates concern not only about the stability of the  Ethernet network  but also about the computers and the software run on them  Any of these  things   the network  a computer  or the OptoOPCServer or PAC Display Professional software  running on the computer   may need maintenance or may fail     The solution here is to provide duplicate computers and software  and connect all devices on two  networks  Each c
122.  upper right corner of the Strategy Tree window     The Strategy Tree moves into its own frame at the left side of the main window     PAC Control User s Guide    EXAMINING THE STRATEGY       IPAC Control Basic  File Edit Configure Chart Subroutine Compile Mode Tools View Window Help    TE 00004 0005 8 0 MR 00m m    9 5o 99s Bcomplea       Docked Cookies  Strategy Tree se     amp  E Control Engines      Subroutines Included  a  amp  Chats  E ZT Alarms    2 Dough_Chip_Control  9 Dough Vessel Pressure Cor    t7  9   ven Inspection Control  E 2 Powerup  S    Variables  E  C Numeric Variables   8  bStartFlag    132    DE diCookieMotionTimer    TMR   fDoughPressureS etpoint  fRampValue  fSetpointMinusD eadbanc  QE nChartStatus    132  ga nCookieMotionPreset  pa nLoopCounter       String Variables       Pointer Variables   E Communication Handles    Ey Numeric Tables      String Tables   IC Pointer Tables   gm  E 1 0 Units             DEDE i  Jl Next 4r Prev                            2  Tochange the width of the Strategy Tree s frame  move your mouse over the right side of the  frame  When the cursor changes  click and drag the side to make the frame wider or narrower     Using Quick Find    The quick find tool at the bottom of the strategy tree enables you to find items quickly in the tree   Use the Next and Prev buttons  or F3 and SHIFT F3  to find multiple matches  Any partial match will  work     Cookies o DER        a  c Cookies   amp  G Control Engines      Subroutines Inclu
123.  used for clarity        Fach statement is followed by a           4                                                                              fPressure 300 0  semicolon    nTotal   ntTable  0    ntTable  1    ntTable  2  i       Table elements are put in square    brackets next to the table name     while   GetHours    gt   8  and  GetHours    lt  17    Fan A   1  1 Parentheses are used as separators for    expressions and operators  You can use  an unlimited number of parentheses     wend       Send alarm if oven temperature too hot        if  Oven Temperature  gt   450  then Line comments appear on a separate  Oven Alarm   1     Set the oven alarm ine or after a statement  They are  else preceded by two slashes and a space  Oven Alarm   0     Clear the oven alarm Block comments  not illustrated  are  endif preceded by    and followed by      Parameters  arguments  for a       nCheck   GenerateChecksumOnString  0  sMessage   47    f command are listed in order within  nError Block   GetIdOfBlockCausingCurrentError         parentheses following the command     R E ENF  PE EEE Commands that have no arguments    must still include the parentheses   sGreeting      Hello  world       nPos   FindCharacterInString      0  sGreeting  je  An individual character can be in single            quotes or in double quotes  depending  on its type  A string must be in double  quotes        PAC Control User s Guide 327    OPTOSCRIPT DATA TYPES AND VARIABLES       OptoScript    328    NOTE
124.  uses the same timeout value for the first attempt and the 2 retries  So     120 PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       with a 1 second timeout value and 2 retries  it takes 3 seconds before an unresponsive unit is taken  offline  This means the chart or command that is trying to read or write to that I O unit will be  delayed by 3 seconds     When using SNAP PAC Ethernet brains  SNAP PAC R1  R2  EB1  or EB2  on a wired LAN  local area  network   a timeout value of 0 1 seconds may be fine  When using a WAN  wide area network   a  wireless network  the Internet  or you are not sure what the networking technology is  it may be best  to use the default value of 1 second  However  if the controller s message queue shows loss of  communication with Ethernet I O units  it may be necessary to increase the timeout value     For Advanced Users   If you are an advanced user with a lot of Ethernet experience  you may want to determine normal  response times from a brain using an Ethernet capture utility such as WireShark       www wireshark org   Look for the fastest response time  the normal or typical response time  and  the longest response time     Adjust the timeout value to be larger than the maximum observed response time  It is best not to  use a timeout value that is too short because this will cause unnecessary communication retries and  timeouts  We recommend making the timeout be at least 50  to 100  longer than the maximum  observed response time  I
125.  venT emperature  id aiDoughVesselPressure       PIDs  v  T   a    i    v  dL Next 4p Prev                11  Double click dilnspectionPassFailSwitch     PAC Control User   s Guide    12     13     14     15     16     CHAPTER 2  PAC CONTROL TUTORIAL       4   dilnspectionPassFailSwit     x           val  al Maximize button  In the minimized dialog box  click the maximize button     ps  dilnspectionPassFailSwitch        Mame  dilnspectionPassFailS witch  Type  Digital Input G  More Info  WAL  VAL    State  E   On Latch     Off Latch     Communication   Point  Enabled           2   140 Unit  Enabled           i   Open Parent     ua  mF       NOTE  Don t worry if the red error message    I O unit not configured  or XVAL values appear in this  dialog box  This occurs because the strategy is configured for sample hardware that probably doesn t  correspond to your actual I O units and modules  PAC Control can   t locate this hardware  That s okay  for this example     When an inspection finds a bad cookie  the on latch attached to the I O point  dilnspectionPassFailSwitch is supposed to go on  We re going to trip it manually     Click one of the arrows in the On Latch IVAL field to change it to On  Also make sure that the  Enable comm field says No     The dialog box should look like this         dilnspectionPassFailSwitch            Mame   dilnspectionPassFailSwitch  Type  Digital Input G  More Info    IVAL  XVAL   On latch On    J otae  ERE     Communication             v    Poi
126.  with troubleshooting  Message  2 above is an  example of a message the user placed in the Temperature Control chart     Severity  The Severity column indicates the type of message  information  warning  or error     Chart  Block  Line  Object  f a PAC Control command in the strategy caused an error  the chart  name  block number  and line number  if you are in Full Debug mode  where the command appears  are listed  Message  3 above is an example  an invalid table index was used in block 19 of the  Temperature Control chart  The Object column shows the table name     If an error did not occur in a strategy chart  the Chart column shows   system    Messages 1 and 2  occurred when the strategy was unable to initialize an I O unit  so the Chart column shows   system   INIT  1O    Block and Line do not apply  but the Object column shows the name and IP address of  the I O unit    If an error was caused by a subroutine  the Chart column shows the name of the chart that calls the    subroutine  and the Block column shows the name of the subroutine and the block number where  the error occurred  in the format  lt subroutine name gt   lt block number    Messages 4  5  and 6    372 PAC Control User   s Guide    APPENDIX B  ERRORS AND MESSAGES       are examples  these errors occurred in block 1 of the subroutine Variable_Increase_Notification   which was called by the Temperature_Control chart     Using Queue Messages    If a block number is listed for the error  look in that block in
127.  x    File Edit Format View Help    S2 M Control Engine 0 0 0 0 10 195 56 102 0 0 0 0 O    S1 M Control Engine 0 0 0 0 10 195 56 101 0 0 0 0 O       4  Copy the list of control engines from the source PC file and paste them to the end of the list of  control engines in the target PC file     PAC Control User s Guide 109    DOWNLOADING FILES USING PAC TERMINAL       Target and Source merged on target PC    E    File Edit Format View Help    S2 M Control Engine A  0 10 195 56 102    x    12   S1 M Control Engine    0 10 195 56 101   7     R2 Control Engine    0 10 195 55 112  R1 Control Engine  0 10 195 55 111  Cookie Controller  0 127 0 0 1     lt        5  Save the target ControllerNames ini file on the target PC before closing it   All of the control engines in the merged file will now be available in PAC Control     Downloading Files Using PAC Terminal    Using the PAC Terminal utility  you can download PAC Control strategies or Forth files related to the  strategy  such as library or initialization files  directly to a control engine  without having to open  each program     For information on using the brain  file system to store data and manipulate it within your strategy   see    Using the Control Engine   s File System  on page 257     NOTE  If you are downloading a PAC Control strategy that requires other files  be sure to download the files  in the correct order  for example  library file  then strategy file  then initialization file   If you need to set  initial val
128.  you have changed the defaults for the way elements appear in a chart  you can update  existing blocks  connections  and text to match     CAUTION  When you update existing objects to match  you cannot undo the update    1  Right click on an empty space in the chart whose elements you want to change  Choose Select  from the pop up menu  From the sub menu  choose the item type you want   For example  to select all action blocks  choose Select  gt  Action Blocks     2  Right click again in the chart  and choose Properties  gt  Copy from Default from the pop up  menu     The color  size  and font of all selected items change to match the flowchart defaults     Drawing Blocks    Action  condition  OptoScript  and continue blocks are all drawn the same way     1  With the chart open and the strategy in Configure or Online mode  click the tool you want to  use     m foran action block     fora condition block    PAC Control User s Guide    WORKING WITH CHART ELEMENTS          for an OptoScript block        fora continue block     As you move the mouse into the window  you see an outline representing the block     2  Click where you want to place the block     The new block appears     New  Chart       3  Click in another location to place other blocks of the same type  When you have finished using    the tool  click the right mouse button  click another tool in the toolbar  or press ESC     Naming Blocks    1     2     3     With the chart open and the strategy in Configure or Onli
129.  zero  and Down Timers start from a value you set and count down to zero   Timers can range from 0 001 to 4 611686 x 10      A string stores text and any combination of ASCII characters  including control codes and  extended characters  For instance  a string variable might be used to send information to a  display for an operator to see  A string variable is also used to set parameters for peer to peer  communication  When defining most string variables  you must specify the width of the string   The width is the maximum number of characters that the variable may hold     A string variable can contain numeric characters  but they no longer act as numbers  To use  them in calculations  you must convert them into floating point or integer numbers   Conversely  a numeric value to be displayed on a screen must first be converted into a string     A pointer does not store the value of a variable  instead  it stores the memory address of a  variable or some other PAC Control item  such as a chart or an I O point  You can perform any  operation on the pointer that you could perform on the object the pointer points to  Pointers  are an advanced programming feature and are very powerful  but they also complicate  programming and debugging     A communication handle stores information used to communicate with other entities  for  example other devices on the network or files that store data  The communication handle s  value is a string containing the parameters needed to make a conne
130. 0 baud and   mode  SNAP PAC S2 only   C Use port 1 for 1 0 using   baud and   mode  SNAP PAC S2 only        115200 v   baud and Binary wv   mode  SNAP PAC S2 or  51        C  Use part 3 for 1 0 using 200 baud and   mode  SNAP PAC 52 only     Serial ports may also be used for communicating with other devices by using PAC Control  communication handles           3  Selectthe correct ports for the controller  and then choose the correct baud rate and mode  from the drop down lists and click OK   If you are configuring a SNAP PAC S1 controller  you must use port 2 for serial I O units  If you  are using a SNAP PAC S2  see Opto 22 form 1704  the PAC Manager User s Guide for the default  serial port assignments or to change a serial port assignment     In addition  make sure to jumper the non SNAP PAC brain for the correct setting  either Binary  CRC  cyclic redundancy check  or ASCII CRC  Although at the brain level you can choose  Binary ASCII and CRC Checksum independently  the Opto 22 drivers only support binary CRC  or ASCII CRC    ASCII CRC is only for mistic brains  If a port is set for ASCII but has a SNAP PAC SB1 2 on it  the  compiler will generate a warning     Tuning the I O Unit Timeout Value for Ethernet I O Units  The default I O Unit timeout value is 1 second  However  for best overall performance you can tune  the value for your system     A SNAP PAC controller automatically retries 2 times before disabling communication to an I O unit  that is unresponsive  and it
131. 000 cece cece 66  Keyboard and Mouse Shortcuts         isssssssssssssssssssssssss e e e ese 67  Online AS Be   oce rct rea b ore Oed ve eb bread QU vue reni eas 67  Chapter 4  Designing Your Strategy            ccc cece cece eee nnn 69  ITROGUCLION MER EE MEL te Eben Ce ener eeids 69  li PIAS  MALE MS eter ee ia eere veter Redit Mares meter angie oa ee dicis 69  Steps to DeslQna   osse b oet eed EEE San E EA ENA Cabodaneda Ra D abeans 69  Solving the Problemi  uero o rr UPS da P T TESTE PR MEE e E EXE Nd qa dU ge 70  Defining the Problem iz casicdadwudedugeunaedammnad e wale dd Saude dhs P dp TOS Od 70  Designing a Logical Sequence of Steps to Solve the Problem                     5  71   Testing  tlie Steps  cns ecciesie bte vett be a dod toa ed dah a da ca rud ede Ss 7   Simple Sprinkler System Process Flowchart                0000 cece cece cece cere ees 72  Building the Strategy axis tha ta tee tot ait eaten thea dead eta ROM vH e ES 72  Configuring Hardware   2 0 0 0    ccc cece ccc cece e e ea 72  Determining and Configuring Variables             sss 73  Creating PAC Control Charts and Adding Instructions                   000 e eee eens 73  Compiling and Debugging the Strategy      0 0    eee eee eee e cece cece ees 75  Using ana Improving the Strategy   estes UE ieee e ES 76  secet c reheat anges EE namnehindeani nn ieamaghatonmngadannaienras 76  Chatt Guidelines ice pe DER et E beoe eta edhe kd dee dlls    76  Naming  Convents       excess dnavamitene tem CUR CAN RUD
132. 01  SN4P ODCS5SSAC  5 60 VDC Source Digital Output        ix D Alarm 1 Copy To  gt       v  Benda   o0  iea        3  Highlight the point you want to copy and click the Copy To button  From the pop up menu   choose one of the following     To copy the point to fill empty points on the module  choose Fill In Module   The point is copied to the other empty points on the same module     I Configure 1 0 Points             120 Unit   Lights B Type   SNAP PAC R1    Feaues     Add      7   00  SNAPIDC5D  2 5   28 VDC Digital Input  Original point w 0 DO Switch Counter Modify  w 1 DD Switch 1 Counter     Delete  Copied points w 2 DD Switch 2 Counter    T 3 DD Switch 3 Counter    Bl  01  SNAP ODCSSRC  5  50 VDC Source Digital Output  T 0 Alam 1 None    v  Benda    o0  Comen        To copy the point to fill all empty points on the I O unit  choose Fill In I O Unit     The point is copied to all empty points on similar modules  for example  to all empty points on  digital input modules  whether they are the same or a different part number  and to all  compatible slots without configured modules     E PAC Control User s Guide    CHAPTER 6  WORKING WITH I O       I Configure 1 0 Points       120 Unit  Lights B    This module was already configured   The copied point filled in all empty    5   D5  SNAPADCS  10   32 VDC VAC Digital Input  points  even though the module is a T 0 DO Switch 150 Counter    different part number  ded 1 DO Switch 161 Counter  w 2 D Switch 162 Counter       w 3 DO
133. 2 Element  Get I O Unit Scratch Pad Integer 32 Table Set I O Unit Scratch Pad Integer 32 Table   Get I O Unit Scratch Pad String Element Set I O Unit Scratch Pad String Element   Get I O Unit Scratch Pad String Table Set I O Unit Scratch Pad String Table    Because these are I O unit commands  in order to use these commands with a SNAP PAC S series or  SoftPAC controller  first you need to create an I O Unit of the type Generic OptoMMP Device to  represent the controller  Use the controller s IP address or the loopback address  127 0 0 1     Also because these are I O unit commands  remember to check all return values and errors to make  sure the command was successful  If a command variable contains a value that is obviously  wrong   for example  a memory map address in an incorrect format    communication to the I O  unit will be automatically disabled     Each controller running a PAC Control strategy can place data in its own or another s Scratch Pad  area  and each can retrieve data that has been placed in the Scratch Pad area by other devices using  other applications  Using these commands eliminates the need to open communication handles   see    Communication Commands    on page 247   thus speeding up peer to peer communication     The memory map Scratch Pad area supports four data types  bits  integer 32s  floats  and strings   e For details on the Scratch Pad area  see Opto 22 form 1704  the PAC Manager User s Guide   e  Forthe complete memory map  see form 1465  th
134. 44  chart commands 246  communication commands 247  control engine commands 280  error handling commands 286       I O unit   event message commands  289  I O unit   memory map commands 290  I O unit   scratch pad commands 291  logical commands 293  mathematical commands 295  miscellaneous commands 299  PID    Ethernet commands 300  pointer commands 303  simulation commands 305  string commands 306  time date commands 314  timing commands 315  in OptoScript 326  function 328  procedure 328  printing 187    comment 240  299    in OptoScript 343  396    communication    Fthernet link redundancy 94  287   I O memory map commands  instructions   290   I O unit   event message commands  in   structions  289   I O unit   scratch pad commands 291   incoming 251   outgoing 249   PC and control engine 89   peer to peer 249  291   TCP IP 247  249   with serial communication module 249        253 255  communication commands 247  communication handle   adding 221  definition 49  219  247  examples   File 259   FTP 263   serial 267   TCP 253  254  File 257  FTP 263  port numbers 250  serial 266    serial Communication modules 253  TCP 247  249  types 247    viewing 230  comparison operators 334  compiling  copy errors and warnings 167  strategy 24  166  strategy without downloading 169  subroutine 355  condition block  definition 202  condition command  definition 49  condition in OptoScript 324  configuration mode toolbar 54  Configure mode  definition 53  configuring  continue block 241
135. 5  j g   Next Block  converting it to a string and i 1  appending it to the string you Put Result in Current Temp String Previous Block  Just created  NAppend String to String  Append Current Temp String  To Current Temp Message  Append String to String  3  If needed  append another Tes    To Current Temp Message    literal string                 Alternatively  you can create the message by placing the following OptoScript code within a single  OptoScript block   FloatToString Current Temp  5  1  Current Temp String      PAC Control User s Guide    INSTRUCTION EXAMPLES       Current Temp Message    Current temperature       Current Temp String     E E       OptoScript can be more efficient for string handling than standard PAC Control commands  See  Chapter 11  Using OptoScript for more information     Interrupt    Condition block  determines whether an I O  unit has generated an  interrupt     Action block clears  latches and interrupts     Condition blocks  determine whether an  lt    event has occurred     Action blocks take    necessary action a    when event occurs        G Shortcuts   100                 Error Handling    Every strategy should have a way to handle errors  It s important to check values and errors that are  returned from the commands in your strategy  Communication to an I O unit  for example  will be  automatically disabled if a command sends it variable values that are clearly wrong  such as a  memory map address in an incorrect format     Counting    
136. 5 111 E          Status Scan   amp  Scan Al  43  Scan Selected                   2  Right click the control engine and choose Upload  gt  Strategy Archive from the pop up menu   3  In the Save PAC Control Strategy Archive As dialog box  navigate to the folder where you want  to save the archive file  Keep the file name as it is  so you can see the date and time it was   originally downloaded to the control engine  Click Save     A dialog box shows progress as the archive file is uploaded to the computer     4  Navigate to the zipped archive file  Assuming you are using WinZip  double click the file name   Highlight all files and click Extract  Extract them to the location you want    5  When all files are extracted  double click the  idb file to open the strategy  If necessary  re link  subroutines and files run before or after a strategy     Re linking may be necessary because the directory structure in the zip file may not match what  was originally on the computer  The zip file structure is as follows     Root   idb  chart files   inf   Subroutines  Control engine files  Control Engine Name 1  Before run file  After run file  Control  Engine Name 2  Etc     108 PAC Control User s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES       Moving Control Engines from One PC to Another    Sometimes it   s necessary to transfer a strategy to another computer  such as when the computer has  to be replaced  or when another PC will be used to run the control application  Instead of t
137. 51 33 3 83 53 S 115   73 S   20 14  T DC4 52   34 4 84 54 T 116   74 t  21 15 AU NAK 53   35 5 85   55 U 117   75 u  22 16  V SYN 54   36 6 86 56 V 118   76 v  23 17  W ETB 55   37 7 87   57 Ww 119   77 w  24 18  X CAN 56   38 8 88   58 X 120   78 x  25 19  Y EM 57   39 9 89   59 Y 121   79 y  26   1A AZ SUB 58   3A 90   5A Z 122   7A z  27   1B AT ESC 59   3B 91 5B   123   7B    28   1C   FS 60   3C  lt  92   5C   124   7C    29   1D    GS 61   3D   93   5D   125   7D    30   1E A  RS 62   3E  gt  94   5E A 126   7E    31 1F 27 US 63   3F   95   5F   127   7F   DEL  313       TIME DATE COMMANDS       Time Date Commands    The following commands refer to time  dates  and days     Copy Date to String  DD MM YYYY   Copy Date to String  MM DD YYYY   Copy Time to String   Convert Date  amp  Time to NTP Timestamp  Convert NTP Timestamp to Date  amp  Time  Get Date  amp  Time   Get Day   Get Day of Week   Get Hours   Get Julian Day   Get Minutes   Get Month   Get Seconds   Get Seconds Since Midnight    Get System Time   Get Time Zone Description  Get Time Zone Offset   Get Year   Set Date   Set Day   Set Hours   Set Minutes   Set Month   Set Seconds   Set Time   Set Time Zone Configuration  Set Year   Synchronize Clock SNTP    These commands can be used for timing a process or for making sure things happen according to a  set schedule  For example  you could use the command Get Seconds Since Midnight at the  beginning of a process and again at the end of the process  and then subtr
138. 9  230  232   configuring 221   definition 51  217   deleting 229   in strategy design 73   literal  constant  221   monitoring in a watch window 157  230    232  naming 78  329  OptoScript compared to other languages  392   persisent data in 220   pointer  definition 303   table 219   types of data 218   types  in PAC Control 219   viewing all in a strategy 188  189  velocity algorithm for PID 301  version  checking with OptoVersion 368  subroutine   viewingviewing  See also inspecting  viewing   all operands 189   all variables and I O 188    PAC Control User s Guide KAE        414    another window or chart 57   bill of materials 190  191   chart 183   chart instructions 241   communication handle variable 230   message queue 103   numeric table variable 233   numeric variable 230   PID loop 146   pointer table variable 235   pointer variable 232   string table changing  numeric table 233   string variable 230   subroutine 358    warning    copy compile warnings 167    PAC Control User s Guide    viewing 103   watch window  creating 157  docking 59  159  monitoring pointer variable 232  monitoring table variable 233  235  monitoring variable 230  opening 158   while loop 322  338   Windows  permissions 369    X  XVAL 284    Z    zooming in or out 60  z order  changing 211    
139. A  without error checking  might look like this     As you can see  PAC  R A uses the Set I O Unit  Scratch  Pad Peer  ERE Scratch Pad command to write the data from   Lb ono xo 4 o   Oboe eae xo Wm  xod its own table to its own memory map    Ce ee LECHE RON M PAC_R_A also reads data from PAC  R  B s    Jozana P a memory map and places it in table B_Data       m  HB ee  gt     tlnstructions   Scra   h_Pad_ Peer   Write Data to Scratch Pad                    Set 1 0 Unit Scratch Pad Integer 32 Table               VO Unit PAC_R_A  ue Supe uou duds Length 600  Bee To Index 9        From Index 9  From Table A Shared Data  b   Put Status in Scratch Pad status       Previous Block       structions   Scratch Pad Peer   Read PAC R B data       Get 1 0 Unit Scratch Pad Integer 32 Table    VO Unit PACRB  ins    Length 600  A similar flowchart would be in TERRIA i  PAC_R_B s strategy  to handle To Index 0 slete  ae   To Table B Data  writing to its own Scratch Pad Pac tidie Dias mm    area and reading from PAC  R A                PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Logical Commands    The following commands perform logical functions     AND   AND    Bit AND   Bit AND    Bit Clear   Bit NOT   Bit NOT    Bit Off in Numeric Table Element   Bit Off    Bit On in Numeric Table Element   Bit On    Bit OR   Bit OR    Bit Rotate   Bit Set   Bit Shift   Bit Test   Bit XOR   Bit XOR    Equal to Numeric Table Element   Equal    Get High Bits of Integer 64   Get
140. AC Control or in PAC Manager     IMPORTANT  For E1 and E2 I O units  you must use PAC Manager  See form  1576  Technical Note  I O  Configuration for E1 and E2 Brain Boards  for instructions     For mistic I O units  PAC Manager cannot be used for configuration  Use PAC Control     For most I O units  if you are already in PAC Control  configuration is easier there and you can use the  loopback IP address for SNAP PAC R series I O units controlling themselves  However  some  functions for I O units cannot be configured in PAC Control     If you use PAC Manager  you can save your configuration to a file  load it to multiple I O units at  once  and use it for referencing points in OPC  However  you cannot use the loopback address in PAC  Manager and you cannot use PAC Manager for mistic I O units     Choose your configuration tool based on what you need to do       You have only one I O unit or I O unit   You have multiple I O units whose  configurations are different  configurations are exactly the same or similar     You are configuring mistic I O units    You are configuring an E1 or E2 I O unit     The strategy will run on SNAP PAC R series or     You are using a modem connection  PPP  or  I O units that are controlling themselves using SNMP   the loopback IP address  127 0 0 1   You are using event messages or email     You are using an Ethernet network for   Youare configuring events and reactions on the  communications  or using a SNAP PAC I O unit in addition to strateg
141. AP SCM    Serial Device           Communication Handle value   tcp 127 0 0 1 22507    Ortcp 10 192 59 45 22507  l Il         IP xdi Port number NOTE  For port number information  see  Establish an  Ethernet Connection  in Opto 22 form 1191  the SNAP  Serial Communication Module User s Guide     To a Serial Module on a Different Rack    SNAP R series I O SNAP EB series I O  IP address  10 192 59 45 IP address  10 192 59 62    Serial Device  mm  Ethernet network zd  7 7           SS   4 7 snap scm N    ta    v    iss ea    port 22507         VA    qo    qo       Communication Handle value     tcp 10 192 59 62 22507  L                Ip TW  Portnumber NOTE  For port number information  see  Establish an  Ethernet Connection  in Opto 22 form 1191  the SNAP  Serial Communication Module User s Guide     Using Flowcharts to Control TCP IP Communication    When a control engine is communicating with another device using TCP IP it runs a PAC Control  flowchart or charts to control communication     e For outgoing communication on controller COM ports and serial modules  the  flowchart uses the command Open Outgoing Communication to request a connection     e For incoming communication on controller COM ports  which is requested by another  device  the flowchart must first use Listen for Incoming Communication and then use Accept  Incoming Communication to establish a connection     e For incoming communication on serial modules  which is requested by another device   the flowchart use
142. Block Line   Object   Time Date   4 Info Device has powered up   Powerup clear e      system  _INIT_    N A N     Mixed_l    15 02 03 09 05 07     35 Warning 1 0 point mismatch  a configured point doe     lt system  INIT_    N    N    aoOven    15 02 03 09 05 07     35 Warning 1 0 point mismatch  a configured point doe     lt system     INIT     N    N A aoConv   15 02 03 09 05 07    INIT_    N    N A ai0ven    15 02 03 09 05 07     700 Warning PID Loop 0 has been configured outside of      system  _INIT_    N A N      Mixed      15 02 03 09 05 07  13 Error Overflow error  Dough_Chip_Co    17 N     nul 15 02 21 09 05 07    0  1  2  3  35 Warming 1 0 point mismatch  a configured point doe      system   4  5  B  13 Error Overflow error  Dough Chip Co    17 N A  null  15 02 21 09 05 07    Number of messages  12       This queue shows several types of messages that you might see  To see all the information in a  column  drag the edge of the column heading to the right     Code  Queue errors generated by the system are shown as negative numbers in the Code column   For example  if you specify a table index that is greater than the number of elements in the table  an  error  12   Invalid table index  appears  as in message  3 above  Common queue errors for each  command are listed in the PAC Control Command Reference and in online help     If the Code column indicates User  the error is one you have placed in the queue using the command  Add Message to Queue  User messages can help
143. Command d   Find     Conditions Insert Conditions Command pe Replace        Variables Insert Conditions Command    Toggle Bookmark  4  Test Compile   Test Compile   Clear All Bookmarks   amp  Cut 0 Next Bookmark  Copy  d Previous Bookmark  E Paste a b Toggle Whitespace  e Undo iE Increase Indent   Cx Redo E Decrease Indent                            Begin typing OptoScript code in the top area    You ll notice that what you type is automatically color coded to help you        Blue   operators and control structures        Purple   values       Green   comments       bBlack    commands and names of variables  I O points  charts  and other items      Red   string literals     If you want to see white space marks to help line up code  click the Toggle Whitespace button  in the toolbar  To hide the marks  click the button again     To use a command  place your cursor in the OptoScript code where you want the command to  appear  Click the Insert Actions or Conditions button in the toolbar     PAC Control User s Guide 341    USING THE OPTOSCRIPT EDITOR       I Select Instruction    Groups     Instructions           Chart 3  Communication   Control Engine   Deprecated   Digital Point   Error Handling   1 0 Unit   1 0 Unit   Event Message   170 Unit   Memory Map   170 Unit   Scratch Pad   Logical   Mathematical   Miscellaneous   PID   Ethernet    CalcSet amp nalogG ain  CalcSetAnalogD ffset  GetAnalogMaxValue  GetAnalogMinValue  GetAnalogT otalizerValue  BetClear amp nalogM as alue  
144. D appears in the Configure PID Loops dialog box   When you have finished configuring PIDs  click Close     PIDs appear in the Strategy Tree under the I O unit     Master             Temperature Control   C3 Control Engines       Subroutines Included       Charts       variables        po units    x  GOI Mixed IO Unit  E B Sprinkler B    He    om  Sprinklers    Hj wp Sprinkler_Control             v  dL Next       PAC Control User s Guide    PID loops    CHAPTER 6  WORKING WITH I O                                                                                        Add PID Loop Dialog Box  Add PID Loop  A Name   B Description   Cc Input  1 0 Point v C  Square Root  E Low Range  0 High Range  10    F Setpoint  140 Point      G Output  1 0 Point     v  H Lower Clamp  0 Upper Clamp  p     l Min Change  0 Max Change   0  0 disables min max change   Output options for when the input is out of range    C  Switch to manual mode when input goes out of range  J EM   C  Force output when input is out of range  auto mode only   K Algorithm  Velocity  Type B     Gain  Fd Fwd Initial     L Mode  Auto v    Tune I  Fd Fwd Gain   M Scan Rate   1   sec  Tune D                   Enable communication       A   Name  Type a unique  descriptive name for the PID  The name must start with a letter and may  contain letters  numbers  and underscores  spaces are converted to underscores      B   Description   Optional  Enter a description of the PID     C   lInput  Select the type of input  I O Point 
145. DstStrTblBody     Return body data dest string table  DstStrTblHdr     Return header data dest string table  E HTTP SrcStrTblBody     Source body data string table  may be empty   F 1     0 for non secure   lt  gt 0 for SSL  strCmd     URL  nHttpStatus     Status returned by HTTP server  nPortSSL     Port to which you want to connect  StrURL       Address   numeric or www google com  etc      lt   atts r    A   MoveToStrTableElements  These lines ensure that the tables are empty   B    Web address  The text string used for argument 7  For example    www google com      C   Sub page  A forward slash     indicates the root level     D   Port number  80 is the standard port if you want to retrieve HTTP content  443 is the  standard port if you want to retrieve HTTPS content     E   Timeouts  Use element  0  of the table for Argument 2 to change the timeouts for  transmitting  receiving  and connecting  For details  see    Setting Timeouts for the HTTP Get and  HTTP Post from String Table Commands    on page 279     F   Security mode  Use 0 to retrieve non secure connection HTTP content  Use a number  other than zero  such as 1  to retrieve secure HTTPS content     10  Click Debug  and then click Run Strategy     278 PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       11  Double click the DstStrTbIBody table to see whether the webpage content was retrieved  If  content was retrieved  you will see html code        Ke bIBody   sca  Name  DstStrTblBody       In
146. E       Name       Drop Chips    Drop Dough  Speed OK     Start    Start Conv       Type  Continue  Action  Action  Condition  Action    ptoScript          2  Double click the block you want  or click it once and click OK     The chart or subroutine is redrawn with the selected block in the center of the window     Changing Column Width in a Dialog Box    Many dialog boxes include several columns of information  To see all the data in some columns  you  may need to make columns wider     e lo widen or narrow a column  click the right edge of the column label and drag it horizontally     1 Configure 1 0 Units       Name  Mixed_        Type  SNAP       Port    Ether       Address atc    Enabled  RefC      127 0 Disabled Enabled    Descii                Click and drag    120 Points      PID Loops     Event Reaction        Toresize a column to the exact width of its longest entry  double click the line that separates  the column from the one on its right     Sorting Data in a Dialog Box    In some dialog boxes with columns of data  you can sort the information in the way you want to see  it  The Center On Block dialog box provides an example  The blocks in this dialog box normally    appear in alphabetical order by the block name     PAC Control User s Guide    WINDOWS AND DIALOG BOXES IN PAC CONTROL       Center On Block       Block Id  Name   Type  Back to    Continue  Drop Chips   Action  Drop Dough Action  SpeedOK    Condition  Start Action  Start Conv    OptoScript          
147. Expressions  Operators  and Conditions    The real power of OptoScript can be seen in complex operations                                  bee POU we ee TENURE S This portion of a sprinkler  eae ea EE control system uses    aD   w                     standard PAC Control blocks  GEMES CERIS Ma A d I a a  and commands to control    bd does watering of grass and trees     EG       The OptoScript version of               Grass Trees Control handles the  loops  conditions  and operator   easily in a single block           1 OptoScript   Sprinkler_Control   Grass Trees Control     Actions   Conditions   f  Variables TestComile       2  lt  gt  0  gtk 4M A      ab oc    OptoScript Code            4  Sets Grass and Trees sprinklers to run on Tuesdays and Fridays  as long as it s not raining        if    GetDayOfWeek      2  or  GetDayOfWeek      5   and  Humidity  lt  98   then  if   Max Temp  gt  80  or  Max Temp    Yesterday Temp   10   then  Grass   1   DelaySec  1200        Water grass for 20 mins  Grass   D   else  Grass   1   DelaySec  600      Water grass for 10 mins  Grass   0   endif  while  Soil_Moisture  lt  30   Trees   1     Water trees  wend  else  DelaySec  3600   77 Wait one hour before checking the day again  endif    ieu    i  Generally speaking  the more complex the combination of math expressions  logical and    comparison operators  loops  and conditions  the more convenient it is to use OptoScript code  rather than standard blocks and commands     PAC Control Us
148. For more information  see    Associating the Control Engine with Your Strategy    on page 93     2  Create a numeric variable and a string variable as follows  For more information  see  Adding  Variables  on page 221        nResult Integer32       3  Create a string variable as follows     CRLF 256    PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       4  Create the following string tables  For more information  see    Adding Tables  on page 224              arrstrAttach 10 256  arrstrBody 100 1024  arrstrRecipients 10 256  arrstrServer 10 256                   5  To the Powerup chart  add an Action Block followed by two OptoScript Blocks and then one  more Action Block                 First Init Tables Action Start   Second Init Tables OptoScript Contains the email body   Third SMTP Send OptoScript Sends the email and attachments  Fourth End Action End                   6  Connect the blocks starting with the first Action Block        Init Tables contains the email body            SMTP Send sends the email and attachments    7  Add code to the InitTables OptoScript Block     This block creates the contents of the string tables which includes server information  a  recipient list  the body of the email  and a list of attached files    The first line in the block defines CRLF as a carriage return   linefeed combination   chr 13  chr 10   which starts a new line in the email body  Defining this value allows you to use  CRLF instead of having to spell out th
149. Fthernet port numbers  refer to  www iana org assignments port numbers    IMPORTANT  If you are using TCP IP connections  consult commercially available texts on TCP IP that  discuss client server architectures  so you ll understand how the protocol works and what to expect during  communication     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Using the Control Engine   s File System    The memory available for file storage is about 4 MB on a PAC S series controller  or 2 MB on a PAC  R series controller  File storage on a SoftPAC controller is limited only by the size of your hard drive  and the volumes available on your network  Any types of files can be stored there  and files can be  sorted into directories or folders just as they can on a PC  These stored files are then available for use   for example  the control engine can read them  add data to them  and even send data from them via  FTP to another device on the network  SNAP PAC controllers also allow you to store data or files  using a microSD card  For more information about using a microSD card  see the user s guide for the  controller     NOTE  Certain FTP commands may also be useful when dealing with files  even if the files are all local  For  example  the dir command is available with comm handles     The file communication handle is used to create  write to  and read from stored files on the control  engine  The format for the handles value is    ile   open mode gt   lt filename gt 
150. GetClear  nalogMin alue  GetClearAnalogT otalizer alue  Ramp  nalog0utput  Set4nalogFilterW eight  SetAnalogGain  Set4nalogLoadCellF astS ettleL evel  Set4nalogLoadCellFilterw eight  Set amp nalog  ffset   SetAnalogT otalizerR ate                Pointers Y     SetAnaloaT poPeriod    Include parameter helps          4  In the Select Instruction dialog box  select the command group from the left hand column   and then select the command name from the right hand column     For information on any command  highlight it and click Command Help  or just double click  the command name     NOTE  Ifyou know the command name  you can just type it into the OptoScript code  Remember that  OptoScript command names may be different from standard PAC Control commands  See  E   OptoScript Language Reference     for more information     5  To include information about the instruction in the OptoScript code  select    Include parameter  helps        6  Click OK   The command appears in the OptoScript code     7  To use a variable  table  I O unit or point  chart  counter  timer  or similar item  place your cursor  where you want the item to appear in the code  If you know the item s exact name  enter it and  skip to step 8  If you re not sure of the item s name  click the Variables in the toolbar     342 PAC Control User s Guide    CHAPTER 11  USING OPTOSCRIPT       Select Variable    Type     Name        All Valid Types    All Valid Types  Analog Input   Analog Output   Chart  Communication Han
151. H I O       In this example  an integral constant of 0 1 corrected the offset error     Plot 1 0 Details   Misc  Details   VAL   Velocity Algorithm  Type B        The far left side of the plot  shows the offset before an  integral constant of 0 1 was  applied  This setting eliminated  heoffset  In many applications   a minor fluctuation around the  setpoint is acceptable  and   hese applications use gain and  integral only  In some  applications  however  the  fluctuations at the setpoint  indicate that the gain is too  high  too much gain makes a  System unstable  or that a  derivative constant is required                            10  If derivative correction is needed  experiment with the derivative constant  in the Tune D field   type 1 and click Apply   Your PID loop may require a larger number      In this example  a derivative of 10 makes a noticeable difference in keeping the input near the  setpoint     PAC Control User s Guide 155    INSPECTING AND TUNING PID LOOPS       Many PID systems are effectively  controlled with gain and integral  constants only and no derivative  constant  In this example  the gain  and integral settings are  maintaining the temperature at  0 06 from setpoint  To  demonstrate the effect of the  derivative constant  the resolution  of the input axis was increased to  show a 1 percent span  At this  resolution  the plot reveals  changes of 0 01 degrees F                          The left side of the plot shows the  effect of gain at  30  int
152. HEMATICAL COMMANDS       296    Opto 22   s SNAP PAC System uses IEEE single precision floats  which have 32 binary digits  bits   The  IEEE 754 32 bit float format is as follows     1 bit 8 bits 23 bits  X XXXXXXXX X0000000000000000000000     Sign Exponent Significand    Float calculation    1 99  x  1   Significand 223  x 2  xponent 127     While this is an excellent standard for the purpose  it has limitations that could cause issues if you re  not aware of them  Squeezing infinitely many real numbers into a finite number of bits requires an  approximate representation  Most floats cannot be exactly represented using this fixed number of  bits in a 32 bit IEEE float  Because of this  rounding error is inherent in floating point computation     In PAC Control  and in PAC Manager and the OptoMMP protocol   a float is a 32 bit IEEE  single precision number ranging from  3 402824 x 10  to  3 402824 x 1099  These  single precision floats give rounding errors of less than one part per million  1 PPM   You can  determine the limit of the rounding error for a particular float value by dividing the value by  1 000 000     This format guarantees about six and a half significant digits  Therefore  mathematical actions  involving floats with seven or more significant digits may incur errors after the sixth significant digit   For example  if the mn 555444333 is converted to a float  the conversion yields 5 554444  8   note the error in the 7  digit   Also  converting 5 554444e   back 
153. I EE dV PUER 77   IIS EFUCTIONIEXAIMIDIES 5   usi uet Cope ex ete re e cuti e bre ee ded da rend oe 79  Creating Messages to Display On Screen 00 2    cece cece teen rreren 79  ifs inel tkvdas saved dale dda dened addin A etna wd danadindlsadas    cad 80  Sonne P T 80  Using a Count Variable for Repetitive Actions            0    ccc eceeee cece ee eeenneneeees 81  Programming Case Statements    0s rewire tretit i i RIVER Pr ae Rs 82  SEMIS ME cemwbeee tame dau damm bhaen sen E EA dane A den    83  Usinga Flag LOCK iic rot epe boned ie dehy DO DP be UE hup CR tele 83  Flag  Lock Timeout Valles    cete vtero etr heb amie Rb Rete Ptr teh ens 85  POINTERS ANG Inaexilig      essesebercpb dere pepe b rqe bb tre HH Deeper remp dd Maem ep bra 85  Without Pointe Sne ti eter epic equ T EE COUROL ER ded RE 85   With  Pointers and Indexing   sisse pirne oniu erpiar eens 86   USING OptoSCrIpE eseina tacoma eie exco aet Levit eem wea 87  Optimizing Throdghput ss zo este Goad Goa ag Cand Ub he Au M b ds 87  Chapter 5  Working with Control Engines              ccccee cece cece nn 89   guirorelrai ON RERO LETT 89  TOR ATROCI 89  Configuring Control ENGINES aisea der rb Gael ERROR e DI ORIPD S UrR ND UE 89  Defining a Control Engine on Your PC       iiis 90  Control Engine Configuration Dialog Box   0 0 0    e eee 92  Associating the Control Engine with Your Strategy             sss 93  Using Network Segmenting in PAC Control             0  cece cece eee eet nena 93    PAC Control User s Guid
154. I O Unit  Disable Communication to PID Loop  Disable Communication to Point   Enable Communication to All I O Points  Enable Communication to All I O Units  Enable Communication to I O Unit    Enable Communication to Mistic PID Loop   Enable Communication to PID Loop  Enable Communication to Point   I O Point Communication Enabled    1 0 Unit Communication Enabled     IVAL Set Analog Max Value   IVAL Set Analog Min Value   IVAL Set Analog Point   IVAL Set Counter   IVAL Set I O Unit from MOMO Masks  IVAL Set Off Latch   IVAL Set Off Pulse   IVAL Set On Latch   IVAL Set On Pulse   IVAL Set TPO Percent   IVAL Set TPO Period   IVAL Turn Off   IVAL Turn On   PID Loop Communication Enabled        1 PAC Control Professional only    The Disable commands disconnect the strategy from the real world device  so that it can be tested  without affecting field devices  While the real world devices are disabled  or if they don t exist  the  IVAL commands can be used for testing and simulation  For details on individual commands  see the    PAC Control Command Reference or online Help     PAC Control User s Guide    STRING COMMANDS       String Commands    The following commands are used with strings     Append Character to String   Append String to String   Compare Strings   Convert Float to String   Convert Hex String to Number   Convert IEEE Hex String to Number  Convert Integer 32 to IP Address String  Convert IP Address String to Integer 32    Convert Number to Formatted Hex String    C
155. ID output        PID    Setpoint    Analog  Input Output     Output    M   Scan Rate  Enter a scan rate to determine how often the input is scanned and the controller  output is calculated  Minimum value is 0 001  1 ms   Scan time should be greater than system lag   the time it takes for the controller output to have a measurable effect on the system   Also consider  other PIDs and tasks on the brain competing for processing power        N   Gain  Type a positive or negative value for Gain  Heating systems usually require a negative  value and cooling systems a positive value  NOTE  Gain is usually refined during the tuning process     O   Fd Fwd Initial Fd Fwd Gain   Optional  Enter Feed forward Initial and Feed forward gain  values if you need to offset the controller output in your application  These values are constants that  are multiplied and added to the controller output  often they are not used in PIDs     P   Tune l Tune D   Optional  Type Integral and Derivative settings if you know the desirable  settings  However  Integral and Derivative are not essential to basic configuration and are better  determined in the tuning process     Changing a PID Loop    You can change the PID loop s configuration and its position in the I O unit     1  Make sure the strategy is open and in Configure mode  On the Strategy Tree  expand the I O  Units folder until you see the PIDs folder for the I O unit you want  Double click the PIDs folder     The Configure PID Loops dialog box op
156. ING I O IN DEBUG MODE       A  diDoughLevelSwitch   scanning     Name  diDoughLevelS witch  Type  Digital Input        More Info    IMAL   State   On Latch     Off Latch   Communication    1 0 Unit  Enabled   E Open Parent     Plot  lt  lt   E Data  gt     TimeAxis       _  Include VAL          The Data button allows you to save  copy  or print the current plot  Use the Time Axis button to    adjust the resolution  Click Include IVAL to see a concurrent plot of the IVAL     Inspecting Analog I O Points    You can review an analog point s data  modify its status  or set its internal values or external values in    Debug mode  To monitor the point in a watch window  see page 157  To change th   these steps    1  With the strategy running in Debug mode  double click the I O point on the S  double click an I O unit in the Strategy Tree  click the Points  Compact  tab of  Unit dialog box  and then double click the I O point     e point  follow    trategy Tree  Or  the Inspect I O       The small dialog box that appears shows the IVAL and XVAL  as well as the unit    S       The XVAL  or external value  is the    real    or hardware value as seen by the I O unit  This value    is external to the control engine       The VAL  or internal value  is a logical or software copy of the XVAL that is in the control  engine  The IVAL may or may not be current  since it is updated to match the XVAL only    when a strategy in the control engine reads or writes to an I O point     3   PID  Inp
157. ING OPTOSCRIPT            OptoScript   String Handler   Build  amp  send request  x      9 Actions  4   Conditions      Variables ES Test Compile    BS A   c ae  OptoScript Code    Request   hin          String Handler  ap     gt             In OptoScript code  several strings and  variables can be combined to build the  request in one line     In OptoScript code  the commands  used to parse the response take up less  space  so they all can be seen at once        Hpt   String Handler   Receive  amp  parse response        gt   Actions   Conditions  C  Variables    Test Compile   X FR        c  15               OptoScript Code       ReceiveStringViaSerialPort  Response  1            GetSubstring Response  1  1  Classification    GetSubstring Response  2  2  Model    GetSubstring Response  2  3  Model Temp    Model    Model Temp               Model Number   StringToInt32 Model         v     lt   gt      3 Shorteuts   100  v                   Ds To  o Chart    PAC Control User s Guide 321    WHEN TO USE OPTOSCRIPT       322    For Complex Loops    Strategies that use complex loops   for example  to repeat an operation while a condition remains  true   are easier to create and take up less space in a flowchart when done in OptoScript  While  loops  repeat loops  and for loops are all available     e While loops repeat a process while a test is true  the test comes at the beginning of the  process      e   Repeat loops repeat a process until a test is false  the test comes at the e
158. M    Move I O Unit to Numeric Table       1 PAC Control Professional only    CAUTION  Write   O Unit Configuration to EEPROM is not the recommended method for saving  configuration to flash memory  If it is used too often or is in a loop within a strategy  flash memory can  literally wear out  Instead of using this command in the strategy  it is better to store configurations to flash  manually using either PAC Manager  see the PAC Manager User s Guide for instructions  or PAC Control  in Debug mode  see    Inspecting I O Units and Saving Settings to Flash  on page 140      Commands for Ethernet Link Redundancy    The three target address commands  Get Target Address State  Set Target Address State  and Set All  Target Address States  are used to manually change the path of communication between the  controller and the I O unit s   based on the IP address used for the I O unit  These commands let you  switch communication from a primary to a secondary IP address  or vice versa  or enable or disable  communication to the primary or secondary address     Ethernet link redundancy to I O units is available only in PAC Control Professional  The secondary IP  address for an I O unit may be for the second Ethernet network interface on a SNAP PAC R series  controller  or it may be for a separate I O unit  If it is a separate unit  the primary and secondary I O  units must be the same type  for example  SNAP PAC EB1  and have exactly the same points   because they are configured toget
159. Most standard digital inputs can be used as counters to count the number of times the input  changes from off to on  The availability of counters depends on the brain s capabilities  and the  speed of counters depends on the module     For information on brain capabilities  see form 1689  the SNAP PAC Brains Data Sheet     EJ PAC Control User s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY       For more information on module counting speed  see the module s specifications on the Opto 22  website  www Opto22 com  On the website  select Products  gt  SNAP PAC System  gt  Brains and I O  gt   Digital I O     NOTE  You can use counters on high density modules with SNAP PAC R1 controllers and SNAP PAC EB1  and SNAP PAC SB1 brains with firmware 8 1 or newer     Before using a counter  you must configure the point as a counter   See  Adding a Digital   O Point   on page 122 or use PAC Manager   Counters on Ethernet and SNAP PAC I O units do not need to be  started  and they cannot be stopped  Therefore  do not use the Start Counter and Stop Counter  commands with SNAP PAC I O units  However  you can use Get Counter and Get  amp  Clear Counter     Using a Count Variable for Repetitive Actions    A numeric variable for counting is useful when the same action needs to be repeated a specific  number of times  For example  suppose your process includes filling a packing box with a dozen  bags of cookies  You can use a count variable to track how many bags are dropped into the box     Here
160. NA S kerensia pibe orte rca tes pee wade idarntuld adams Db tomen 305   String COMMANGS     sequ ot tr edere cues eC ureters pO edi bd espe edat rie dee 306  ESTIS SIGS cate  REESE RP ERR REPRE 306  String Men gth and WAGs  oido cutd ira tte bodies Eae urbe adito eui a cea 307  Using Numeric Tables as an Alternative to Strings    307  Strings and Multitasking  2 cbe hes wave reed e pe ea EE dee Meee cde Eden ds 307  Adding Control Characters to a String 2 0 0    cece ccc ccc cece nec e e 308  Sample String Vatiable i    ec enraiar d ve TENE edd taa Du Cb vu UM 308  Sample String  Table eared Ue tot IRR EN UTER RUE n GUM ee e EE 308  String Data Extraction Examples    4     etie ve er ee hr Or ee oed 309   Find Substring in String  Example 1 0    2 2    cece ence e eens 309  Find Substring in String  Example 2 2 2 2 2    cece eect teeta es 309  String Building EXamMple   cse oot P RRIOEPUURPIe ED OD UU Er ed 310  Move SUING  uc ce eene it onerehst bea er eve dee IRE Ur DURER P qu ERU d 310  Append Character tO String   cese ze rero ee reete ede tien 310  Append String to STING   sese ecu cem eh vise ger rele SOUS RP et 310  Append  Characterto String ies neo Pepe UI e OH Rit be bine UR Pla s 310  Comparison to Visual Basic and C sersrississiaki cerere iesin annia tan ee 311  Convert to Stririg COMMANGS areire p tE weeded edet iuda 312  Da  P  enteiching dp EE E CT EE OCE ET EE OEE 313   Time Date COMMANGS  rasons nanoen ove aed Od ve dut ette tg veda UR Wedd Hate qa 314   Timi
161. NG INITIAL VALUES IN VARIABLES AND TABLES DURING STRATEGY DOWNLOAD       Setting Initial Values in Variables and Tables During Strategy    Download    226    When you are adding table variables in PAC Control  you can set all table elements to one initial  value in the Add Variables dialog box  If you want to set each individual table element to its own  value  however  you need to create an initialization file and download it with your PAC Control  strategy     In addition to setting initial values for table elements  sometimes it is easier to initialize all variables  during strategy download using an initialization file     This section shows you how to create an initialization file and download it with your strategy     Creating the Initialization File    A sample initialization file  INIT TXT  is included with PAC Control  You can open this file with a text  editor to see the proper syntax for each initialization entry  and then modify it as necessary for your  strategy     IMPORTANT  Every initialization file should include the following line near the top     X   DOWNLOAD COMPRESSION OFF    Make sure to enter a backslash and a space at the beginning of the line  Download compression removes  the newlines necessary for string initialization  This line tells PAC Control to turn off download compression  so strings can be initialized     IMPORTANT  Each file must end with a carriage return so that the last line in the file is blank  and each  line within the file must end 
162. NTE 50   OULDUC POINT   iecit te e prend ouatniia ve socie ex d te vacui ur bue qi rur gane 50   ejes PEUT MM PACEM 50  unico Ee p DIU 51  variables ae leeena ai nini a AEE A a a I I e e esee 51   PAG Control Main MID dOoWs   oci e cored iota n E E A EET 52  IRURE  53  lC                                M       awa 53  loser ce  EMT 53  Mode Selection  ToOlDal        2 oo ts ressorts Hameed kiitan avt dis game 54  Configure Mode and Online Mode Toolbar              0 cece cece cece e eect eens 54  Depug Mode Tool bai merri 9 ero eletto eee eh oreet oo meade sagas ahh Fede 55  QIEIG AIC D 55  Windows and Dialog Boxes in PAC Control      2 2    e tenet e es 57  Using Tabs to View Open Windows            sss 57   BIere   ore Mad are o  IDEE IIT PT 59  Zooming in a Chart or Subroutine Window          iissssssssssssss eee n neces 60  Panning a halt aeaa oconesaedis vea etre asian d Vtde aia RA RA a Veste ER adt 61  Redrawing a Chart or Subroutine Window              sss 62  Changing Column Width in a Dialog Box        0 2    eee cece teen cece ees 63  soning Data in  Dialog BOX sc ds ceva breue tie id REP de Gan Side dus OS donc dai dea tds 63    PAC Control User s Guide       Customizing PAC Control for Your Needs  i i cireres eeror cerecos DUCERE Ere 65       Setting Decimal  Binary  or Hex Display Mode             ssssssssssssssee 65  Setting Hex String  VIEW  eens cede rere ect con DH e e POP E DRE POP tb eR 65   Setting Up Applications to Launch from PAC Control           0 00
163. O Point    1  With the strategy open and in Configure mode  double click the I O Units folder  not the  individual unit s icon  on the Strategy Tree     PAC Control User s Guide 125    ADDING 1 0 POINTS       2  In the Configure I O Units dialog box  highlight the I O unit the points are on  and click I O  Points   The Configure I O Points dialog box appears   Go 3   Pro only  If you are using a non SNAP I O unit  not including the B3000   double click the  channel you want to use  Skip to step 8   4  If you are using a SNAP I O unit  including the B3000   notice the module icons in the  Configure I O Points dialog box     1 Configure 1 0 Points DEAR   120 Unit    Sprinkler Control SNAP PAC R1  Modules and Points Features   Subty    Add  td  00  SNAP IDC5D  2 5   28 VDC Digital Input  7 Modify       Delete                      v  a      gt        NOTE  In this example  a digital module has already been added in position zero  This example shows  a SNAP PAC I O unit  so both digital and analog modules can be configured on the same rack     5  Highlight the number of the analog module s position on the rack  then click Add     126 PAC Control User s Guide    CHAPTER 6  WORKING WITH I O       tAdd Module    Type     Digital Input    Digital Output    Analog Input   Analog Output  Module     Part Channels     Type s   DE SNAP ADA 3 1 4 20 m    DESNAPADA346 1 4 20 m      M SNAP AOV 5 1 0 10  DC  ab SNAP ADV 7 1 30    10 VDC  DM SNAP  0A 23 2 4 20m    DR SNAP ADA 2345RC  2 4 20m   
164. O Points    Before you add an individual I O point  such as a sensor or a switch  you must add the I O unit the  point is on  See  Adding an I O Unit  on page 116     Adding a Digital I O Point    1  With the strategy open and in Configure mode  double click the I O Units folder  not the  individual unit s icon  on the Strategy Tree     The Configure I O Units dialog box appears     I Configure 1 0 Units       Address    Watc    Enabled RefC Add       SNAP PAC R1 Ethem    127 0    Disabled Enabled 0    Sprinkler    SNAP PAC R2 Ethem    10 123    Disabled Enabled 0 Modify       1 0 Points     PID Loops                   2  Highlight the I O unit the points are on  and click I O Points   The Configure I O Points dialog box appears    3  Ifyou are using a G4EB2 or other non SNAP 1 0 unit  not including the B3000    double click the point you want to use  Skip to step 10     4  Ifyou are using a SNAP I O unit  including the B3000   notice the module icons in the  dialog box     I Configure 1 0 Points DER     1 0 Unit    Sprinkler Control       Type   SNAP PAC R1    Modules and Points Features   Subty                Module icons    IT    122 PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       NOTE  This example shows a SNAP PAC I O unit  so both digital and analog modules can be  configured on the same rack     Highlight the number that represents the module s position on the rack  then click Add     A list of available modules appears     tAdd Module    ut  OO Digital
165. OE E nb bb enini 338  Repeat LOOPS M 339  FOMMOODS  sisirin eeni tiiri iienaa EE ETE E Vanes haa O E E es 339  Using the  OptoScript EOILOT sce e bier ete e det a a a a 340  Troubleshooting    Unable To Find    Errors    344  Troubleshooting Syntax EMOMS    ies    iue cies ce t ee aio dak chm PR ERR i RARE amet 345  Debugging Strategies with OptoScript       0 6    ccc t EREE 346  Chapter 12  Using Subroutines      5cili rrr ehe RR RR he ePTR E E Ee ESS 347  IMTOCUCTION LL 347  In TAIS Chapter ssec seater DR O CEE ex COR pese hdc ber ta a as 347  About  Subroutines    oi ove to te ote QU ede teh Qs eap Data qoe qr dut e hib va 347  D  t   Typ  s f  r SuBr    tines 4 5nd nnn ny PO Mon UR wd UMOR GR ans 348  Creating SUBLOUTINGS     2x sseeolisd reddes RUPTA PDA d E Edd eue delp ise dodi ud 348  TIPS TOF SUDTOLLITIQS  sise bees PDF PIED aereo epe drepurb o epe eH egt pp 348  Drawing the Flowchart csi cased x at e chron e Ob pee ade ie xe edis e 349  Configuring Subroutine Parameters scuro S URP EE PINE PEE OR AERORX E HERR UG 350  Configured Parameters Example           sisse 353   Adding Commands and Local Variables               sss 354  Compiling and Saving the Subroutine 0 0 2 2    0c cece cece eee eee eens 355  USING  SUBIOUTINGS aces 1 c hee Shas whe did dae PAs oid bare ToS Dado endi d ds 355    PAC Control User s Guide       Including a Subroutine in a Strategy 2 0 6    eee eee cece cece eect eee ionini 355    Adding a Subroutine Instruction                ccc cece scot
166. ONTROL           HA Float Table     PID Loop  T ID    E  r  mu             Pointer Variable       Windows and Dialog Boxes in PAC Control    Windows and dialog boxes in PAC Control follow Microsoft Windows standards  You can minimize   maximize  move  resize  and tile them as needed  See your Microsoft Windows documentation for  information on how to do these things     The following topics describe other useful features in PAC Control    Using Tabs to View Open Windows  on page 57    Docking Windows  on page 59    Zooming in a Chart or Subroutine Window  on page 60   Redrawing a Chart or Subroutine Window  on page 62   Changing Column Width in a Dialog Box  on page 63    Sorting Data in a Dialog Box  on page 63    Using Tabs to View Open Windows    When multiple windows are open    especially if they are maximized   it can be difficult to know  where you are  and windows can become lost behind each other  However  you can click the tabs at  the bottom of the main PAC Control window to move among chart windows  subroutine windows   watch windows  and blocks you may be stepping through for debugging     PAC Control User s Guide    WINDOWS AND DIALOG BOXES IN PAC CONTROL       IPAC Control Professional    Dough_Chip_Control  BAR   1 File Edit ControlEngine Debug Chart Subroutine Mode Tools View Watch Window Help     m 44       Cookies    se   amp  E Control Engines      Subroutines Included   amp   Cj Charts     C Variables   amp   C3 Numeric Variables      String Variables    
167. P PAC system  see form 1688  SNAP PAC System Migration Technical Note  For information on how  to enable legacy functionality in PAC Control for a specific strategy  see  Legacy Options  on   page 196     Document Conventions    The following conventions are used in this document     e The Pro icon next to text indicates that a feature is available only in PAC Control Professional   not in PAC Control Basic     e   talic typeface indicates emphasis and is used for book titles   Example   See the PAC Display  User Guide for details          Names of menus  commands  dialog boxes  fields  and buttons are capitalized as they appear in  the product   Example   From the File menu  select Print        File names appear either in all capital letters or in mixed case  depending on the file name itself    Example   Open the file TEST1 txt            Key names appear in small capital letters   Example   Press SHIFT         e Key press combinations are indicated by plus signs between two or more key names  For  example  SHIFT F1 is the result of holding down the shift key  then pressing and releasing the F1  key  Similarly  CTRL ALT DELETE is the result of pressing and holding the CTRL and ALT keys  then  pressing and releasing the DELETE key        e        Click    means press and release the left mouse button on the referenced item   Right click   means press and release the right mouse button on the item     e   Menu commands are referred to with the Menu  gt  Command convention  Fo
168. PAC CONTROL  USER   S GUIDE    PAC CONTROL USER S GUIDE    Form 1700 150413   April 2015    OPTO 22    Automation made simple     43044 Business Park Drive   Temecula   CA 92590 3614  Phone  800 321 OPTO  6786  or 951 695 3000  Fax  800 832 OPTO  6786  or 951 695 2712  www opto22 com    Product Support Services  800 TEK OPTO  835 6786  or 951 695 3080  Fax  951 695 3017  Email  support opto22 com  Web  support opto22 com    PAC Control User s Guide  Form 1700 150413   April 2015    Copyright    2006 2015 Opto 22   All rights reserved   Printed in the United States of America     The information in this manual has been checked carefully and is believed to be accurate  however  Opto 22 assumes no  esponsibility for possible inaccuracies or omissions  Specifications are subject to change without notice        Opto 22 warrants all of its products to be free from defects in material or workmanship for 30 months from the  manufacturing date code  This warranty is limited to the original cost of the unit only and does not cover installation  labor   or any other contingent costs  Opto 22 I O modules and solid state relays with date codes of 1 96 or newer are guaranteed  for life  This lifetime warranty excludes reed relay  SNAP serial communication modules  SNAP PID modules  and modules  that contain mechanical contacts or switches  Opto 22 does not warrant any product  components  or parts not  manufactured by Opto 22  for these items  the warranty from the original manufacturer ap
169. PAC Control Professional    Dough_Chip_Control   E File Edit ControlEngine Debug Chart Subroutine Mode Tools View Watch Window Help    ERNEITTENENE A i 05 50355       Cookies    This chart runs   amp   C3 Cookies continuously once the   amp     Control Engines program has been started       Subroutines Included   amp     amp  Chats 3  E By Alarms Drop the dough   a 95 Dough Chip Control  E  95 Dough Vessel Pressu      co iig   Drop the chips   E  B   Oven_Inspection_Conl  H B   Powerup       Variables        Numeric Variables  ga bStartFlag    DL diCookieMotionTir    HR 2 Shortcuts v    a ji    gt     v  db Next  P Prev    Doc ked Wa tch nCookie_Counter    window Name Type  nCookie Counter Integer 32 Variable 74                                                 PAC Control  Ready    Now we ll trip the latch that signals a bad cookie     9  On the Strategy Tree  under the I O Units folder at the bottom of the window  expand  Mixed  IO Unit by clicking the plus sign at the left of the name     You see a folder named Points   10  Expand the Points folder to display the digital I O points configured for this I O unit       Cookies    DER      amp   C5 Variables   amp     1 0 Units   amp  Hl Mixed IO Unit   amp   amp  Points Points folder  TA diDoughLevelSwitch  WA diChipLevelSwitch  ie dilnspectionPassF ailS wi  w diEStop  M doDoughPressureContrc          Ez doDoughD ispenseValve      im doChipDispenseValve  im doRejectValve   as ao0venT emperatureCor  as aoConveyorSpeedContr  d ai
170. PID LOOPS       Changing a Configured I O Point    1  With the strategy open in Configure mode  expand the I O Units folder on the Strategy Tree  until you can see the I O point you want to change  Double click the I O point name    2  In the Edit Analog Point or Edit Digital Point dialog box  make the necessary changes  Click OK  to save     Deleting a Configured I O Point  You cannot delete an I O point that is referred to in the strategy     CAUTION  Be careful when deleting I O points  You cannot undo a deletion     1  With the strategy open in Configure mode  expand the I O Units folder on the Strategy Tree  until you can see the I O point you want to delete     2  Right click the I O point s name and choose Delete from the pop up menu     You can also delete an I O point from the Configure I O Points dialog box by highlighting its name  and clicking Delete     Configuring PID Loops    PID loops  or simply PIDs  are used to drive an input  a process variable  toward a particular value   the setpoint  and keep the input very close to that value by controlling an output  For example   consider temperature control  where the input is a measurement of ambient temperature  the  setpoint is the desired temperature  and the output is a heater  The PID for this system will use a  mathematical formula that controls the output to maintain a desired temperature  efficiently adjust  to changes in setpoint  and compensate for changes in load  such as the influx of cold air  In this  
171. PIOGCeSS  1siu casein mie dh epa e qun a a a ved danngaeadean ea 384  Doug Vessel   iu cssscnteexeieteee zeit hehe Un banat Meena eoe Ebr qd 384  CHIP HODDER E EUM 384  SUECIAE EROR a aae a a 384  Inispectiori SLALOM TE E E E E T A ETTE 384  CONVEYOR ratit ayarini Er N a EEE EE EE 384  Emergency StODS  Marz sien eise cavreoe serrer Sev OU Iq e D SE TONO E Met 384  Reguifed I O  unitis nob qat eee bk ade dre pedea erledigen ie dre e 385  Xo OPO pst ETE 385  Digital                    385  Appendix E  OptoScript Language Reference                           387  E EN e a MEME CE TTL 387  OptoScript Comparison with Standard Programming Languages            i issues  387  Funcion ompa ON eers 5e pbi ee bbhpe metr cag Depbten mobi d dus eb ee E 388  Variable COMPaniSON  Tsesspbberegereviredzbdeiedupb phuoueeedieames P RRUERPM eU PME 392  Notes to Experienced Programmers         isssssssssssssssssssss t tent toorena 392  Variable Database and Other Surprises           0 0 00 ccc cece cece eee n cece nee eeeeees 392  PAC Control s Target Audience 0    cect e tence ene 392  Langdage Syntax osc Sandan dans aiosane Tor Sand dahemaaded hare OP P EU Eve Re dU Palat 393  OptoScript Lexical Reference creien eperera nn Ei emen 394  token  Syntax bi EET 394  L iterals atd Nares  oirro esc UM peri EE DONREG eR En RR EE td ites 394  Keywords  Reserved Words  o   asco icc baton do etd esrb o itp es ies 395  OpGralOls  ceti cie Dada stre obe rp eher ble apices ets n tet 395  COMMEN S 2a ca aside 
172. PRINTING SUBROUTINES       360 PAC Control User   s Guide       A  Troubleshooting    This appendix provides general tips for resolving problems you may encounter while running PAC  Control or communicating with your hardware  If you encounter problems with permissions in  Windows  see page 369     For information about types of errors and lists of error codes  see  B  Errors and Messages        Also check troubleshooting information in your controller s user guide  See also  Opto 22 form 1690   the SNAP PAC Brain User s Guideform 1     How to Begin Troubleshooting    You ve built your strategy  but now you get errors when you try to download it  or it won t run  properly  How do you begin to figure out what s wrong  The problem may be in communication  with the control engine  in communication between the control engine and I O  in a command  or  in the strategy logic  Following are some steps to help you discover the cause     1  Read Any Error Message Box    If an error message box appears on the computer running PAC Control  it   s probably a PAC Control  error  Here s an example of a PAC Control error message     Opto Error      Timeout while connecting to device  Check hardware connection  address  power  and jumpers     Code   10038       2  Check Communication with the Control Engine    If there is no error message box  or the error indicates that there may be a communication problem   check whether the PC running PAC Control is communicating with the control engine  
173. Printing Chart or Subroutine Graphics  on page 184     Viewing and Printing Strategy or Subroutine Commands  on page 187     Viewing and Printing Strategy or Subroutine Elements  on page 188     Viewing and Printing a Cross Reference  on page 189    PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       e  Viewing and Printing a Bill of Materials  on page 190  e        Viewing and Printing I O Point Mappings    on page 191    For information on viewing and changing I O units  see    Inspecting I O in Debug Mode  on  page 140  For variables  see    Viewing Variables in Debug Mode  on page 230     Viewing Strategy Filename and Path    To see an open strategy   s filename and path  choose File  gt  Strategy Information  A dialog box  appears showing the path and filename     Viewing an Individual Chart or Subroutine    To view an individual chart or subroutine  double click its name on the Strategy Tree  or choose  Chart  gt  Open or Subroutine  gt  Open  You can open as many of these windows as you need  The  names of open windows appear on tabs at the bottom of the PAC Control main window  Click a tab  to bring its window into view     Viewing All Charts in a Strategy    You can see the status of all charts at once and change a chart s status without having to open it     1  Make sure the strategy is open and in Debug mode  On the Strategy Tree  double click the  Charts folder     The View Chart Status dialog box appears  showing every chart in the strategy     3
174. Professional   Here s what is in this user s guide     1  Welcome to PAC Control   Information about the guide and how to reach Opto 22 Product  Support     2  PAC Control Tutorial   A tutorial designed to help you use PAC Control as quickly as possible   The chapter leads you through a sample strategy that you can manipulate  download  and run in  Debug mode     3  What Is PAC Control    An introduction to PAC Control  key terminology  and the main windows  and toolbars     4  Designing Your Strategy    Programming in PAC Control  how to get from your real world  control problem to a working strategy     5  Working with Control Engines   How to configure and communicate with control engines     6  Working with 1 O   How to configure and communicate with input output  I O  units  I O  points  and PID loops     7  Working with Strategies    Detailed steps for creating  compiling  and running strategies     8  Working with Flowcharts   Detailed steps for creating and working with the flowcharts that  make up your strategy     9  Using Variables and Commands   Steps for configuring the seven types of variables you can  use in programming  communication handle  numeric  string  pointer  numeric table  string table   and pointer table variables  Also shows how to use the commands that control the I O and variables  you ve configured     10  Programming with Commands    mportant tips on using PAC Control commands to  accomplish what you want in your strategy     11  Using OptoScrip
175. Receive String Table   Send Communication Handle Command  Set Communication Handle Value  Send Email   Send Email with Attachments   Set End Of Message Terminator  Transfer N Characters   Transmit Character   Transmit NewLine   Transmit Numeric Table   Transmit Pointer Table   Transmit String   Transmit String Table   Transmit Receive Mistic I O Hex String     Transmit Receive String         PAC Control Professional only  mistic I O units only    Communication Handles    A communication handle is a variable in PAC Control that stores the parameters needed to connect  to a specific entity  the entity may be another device on the network  a file located on the control  engine  or some other thing that stores or transfers data  The value of the communication handle  variable is a string consisting of the communication parameters separated by colons     Typically  a communication handle is used to open communication  to transmit and receive data   and to close communication  For example  you might use the TCP communication handle to  communicate with another device on the network via TCP IP  or the FTP communication handle to  send data from the brain to a file on a PC     In many cases you ll define a communication handle variable and never change it  because the  same parameters are always needed  However  in some cases it might be useful to change it  For  example  if you use the same process to send serial data through two different serial communication  modules  you can use 
176. SER Ar dee Ua AT ne E ME 396  OptoScript Grammar Syntax Reference  0 0 00    0  cece cece eee eee eee e 397  WES 64 ci kp Id ad RE tax hs n he hie a 403    PAC Control User s Guide       PAC Control User s Guide       1  Welcome to PAC Control    Introduction    Welcome to PAC Control   Opto 225 visual control language for Opto 22 SNAP PAC control systems  and the input output  I O  units that work with them     PAC Control makes it easy to write control applications with little or no programming experience  If  you know how to design a control application and can draw some flowcharts to describe it  you  already know the basics of PAC Control  At the same time  PAC Control provides a complete and  powerful set of commands  as well as the OptoScript programming language  to meet your most  demanding industrial control needs     PAC Control comes in two forms  PAC Control Basic and PAC Control Professional        e PAC Control Basic is included in the purchase of an Opto 22 SNAP PAC controller and is also  available as a free download from our website  www opto22 com  PAC Control Basic includes  both flowchart and OptoScript programming  subroutines  a graphical debugger  and about  400 commands     e   PAC Control Professional is available for purchase either separately or as part of the  complete PAC Project Professional  software suite  The Professional version of PAC Control adds  Ethernet link to controllers and I O units  controller level redundancy  supports additional 
177. SWITOH nee ALARM SWITCH    SOLENOID  SV  aX Xs   SOLENOID       VALVE  1008 VALVE    CONVEYOR OVEN INSPECTION  TT TY STATION  102 103  TIC  102 WASTE    BIN  TEMPERATURE  CONTROLLER                                                                                                       PAC Control User s Guide 383    DESCRIPTION OF THE PROCESS       Description of the Process    Dough Vessel    The first station in our process is the dough vessel  This tank contains a pre made cookie dough mix     Dough is dispensed onto the conveyor belt through a valve  SV 100B  at the bottom of the vessel   The dough  being somewhat viscous  must be kept under low pressure to dispense properly  To  monitor the pressure  we have included a pressure transmitter  PT 100  in the vessel  Our control  engine  a SNAP PAC R series I O system  maintains the vessel pressure through a plant air valve   SV 100A      The vessel also includes a level switch  LAL 100  to tell us when the dough level is low  When it is   the process is halted so that an operator can refill the vessel     Chip Hopper    The chip hopper supplies chocolate chips  A chip dispenser valve  SV 101  controls the number of  chips dropped on each cookie  Like the dough vessel  this tank also includes a level switch  LAL 101   to stop the system when the chip hopper needs refilling     Oven    After the dough and chips have been dropped onto the conveyor  the conveyor sends the cookie  into the oven  and the oven bakes it     Inspectio
178. See   Checking Communication with the Control Engine  on page 364     PAC Control User s Guide 361    STRATEGY PROBLEMS       3  Check the Message Queue    If communication with the control engine is OK  check the message queue  To open the queue  see     Inspecting Control Engines and the Queue    on page 101  In the    List of Common Messages    on  page 373  look up any errors you find in the queue  Errors are listed in numerical order  Queue errors  may indicate problems with a command or with communication to I O  Check the possible causes  for help in fixing problems     e  Forhelp with a command  look up details about the command in the PAC Control Command  Reference or online help     e  Forhelp with communication to I O  see    Resolving Communication Problems  on page 365   Many of these suggestions apply to I O as well as to control engines     4  Check Status Codes in Your Strategy    If all is well up to this point  double check Status Codes in your strategy  Status Codes are responses  to a command that appear in a variable within your PAC Control strategy or as returned values in  OptoScript  Your strategy should routinely check status codes and adjust logic as necessary to  respond     Status codes may indicate problems with a command or communication to I O  or they may  indicate a problem in the strategy logic  See  List of Common Messages    on page 373 for more  information  Again  look at the possible causes for help in fixing problems     5  Call Product
179. Set Communication Handle Value to switch to the other module  Advanced  users may also want to use pointers     Set Communication Handle Value also allows you to retrieve the communication timeout value for  some types of communication handles  and you can specify the communication timeout value in  seconds     Several types of communication handles are available        For Ethernet communication  For communication with serial modules    See page 249     Tem See page 253                    PAC Control User s Guide 247    COMMUNICATION COMMANDS       248       File    For creating a file to be stored on the control engine  and reading or    writing to a file stored on the control engine S65 PAGO Ai        FTP    For accessing files on the local file system or another FTP server     including transferring files between the two servers Sen Reges        Serial       For using the RS 232 connectors on a SNAP PAC controller to com   municate with serial devices   Not used for serial communication See page 266   modules or serial based I O units                  Adding Communication Handles    Using the Add Variable dialog box  you can create a communication handle for each of the four  types  TCP  File  FTP  and Serial  mentioned in the previous section  For more information on adding  variables  see  Adding Variables  on page 221     To add a communication handle     1  In the Strategy Tree  under Variables  right click Communication Handles  then choose Add to  open the Add Varia
180. String Width  This field varies depending on the variable type     222 PAC Control User   s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS        Table variables only  In the Table Length field  enter an integer between 1 and 1 000 000  representing the number of elements in the table  The greater the number  the more memory  required to store the table      String variables and string tables only  In the String Width field  enter the maximum number of  characters permitted in the string  The number must be an integer between one and 1024  The  greater the number  the more memory required to store the string      Pointer variables only  From the Pointer to Type drop down list  select the type the pointer points  to  Note that void pointers are not allowed  a pointer must point to a specific type  Also note that  you cannot point a pointer to another pointer  PAC Control has only one level of indirection for  pointers  If you try to point to a pointer  PAC Control assigns to the new pointer the address of the  object being pointed to     E   Initialization   For all variables except up timers and down timers   Select one of the following     Initialize on Strategy Run  Sets the variable to the initial value  F  each time the strategy is run  either  manually from the debugger or automatically via the autorun flag      Initialize on Strategy Download  Sets the variable to the initial value  F  only when a strategy is  downloaded  The variable retains its current value when th
181. TER 10  PROGRAMMING WITH COMMANDS       If no root certificate is required for the connection  use    none    for element 4 of the server  information table and the connection will not be authenticated  If the target mail server  doesn t require SSL or TLS  the login will succeed  However  if it requires SSL or TLS  the login  will fail  Most servers require encryption  so unless you re using an in house server  you ll  probably need a root certificate     For a Gmail account  use these values        Server   smtp gmail com  Port 587  Security  t          S                For a Yahoo  Mail account  use these values        Server   smtp mail yahoo com  Port 465  Security  ssl                      B    Recipients  Enter the email address for each recipient  Make sure the recipients list  contains at least one valid entry     C   Message Body  Flement zero is always the subject line  Fach line is entered as a separate  string  However  they will be concatenated in the body of the email  The email body starts with  element one  and continues to the first empty element or the end of the table  whichever  comes first  Note that a blank line is not the same as an empty element     D   Attachment File Names  Files specified in the attachments table must exist on the  controller s file system   RAM  flash  or SD card   and must include the full directory  specification  For example  if a file is in the root directory  just use the filename  However  if it is  in the temp directory of 
182. Table to 20   ge ae a   A adu for nIndex   0 to 4 step 2  arc C E 7 ntTable nIndex    20   next  next    Predefined values can be a numeric expression  but they are evaluated only at the beginning of the loop  For  instance  the following example will loop 0 to 15 because the upper limit of nSide 3 is evaluated only at the    beginning of the loop  not each time through the loop     nSide   5   for nLength   0 to  nSide   3  step 1    nSide   1   next    For loops can be nested and can contain other types of statements  Each for requires a next at the  end     Using the OptoScript Editor    340    1  To use the editor  create an OptoScript block in the flowchart where you want the code to  appear   For more information on creating charts and blocks  see    8  Working with Flowcharts        Double click the OptoScript block to open the editor   The editor is similar to the editor for Microsoft Visual Basic     You can resize the editor window as  needed to see the code     1 OptoScript   Oven_Control   Block 3    Toolbar    Type OptoScript  code in this area     See results of  test compile in  this area          Actions  4   Conditions  C  Variables  lt  lt  Test Compile      ptoScript Code              Column   oc  _ Cancel    Help   elp   Command Help   Help and ne  numbers       PAC Control User   s Guide    CHAPTER 11  USING OPTOSCRIPT       The following tools are provided in the Optoscript toolbar                                                  3 Actions Insert Action 
183. That way if one peer goes offline and then comes online   you can have the flowchart logic set up to immediately open communication again     In some cases  however  one of the devices may be incapable of requesting communication  A serial  device such as a barcode reader attached to a serial communication module on a SNAP PAC 1 0 unit  is an example  The serial device is incapable of requesting Ethernet communication  essentially it  acts as a slave device and can only wait until it is asked for data  For serial devices attached to serial  communication modules  the control engine needing the serial data must request communication  using Open Outgoing Communication   For serial devices attached directly to a serial port on a  SNAP PAC controller or brain  see  Using Serial Communication Handles to Communicate with Serial  Devices  on page 266      Outgoing Communication  For outgoing communication  communication you request   the  communication handle5 value is in the format tcp    IP address gt   lt port gt  Note that tcp is all    PAC Control User s Guide 249    COMMUNICATION COMMANDS       lowercase letters  The following table shows examples of communication handles for outgoing  communication        Communication Handle Value  Outgoing Communication  Protocol IP Address Port       Ethernet TCP   to another control engine tcp 10 192 56 185 22004       Ethernet TCP   to a serial communication module on another    tcp 10 192 54 10 22506  rack       Ethernet TCP   to a seri
184. UAayIp Anueourubis si  e  seg pue Disyg ur SJUaWATe s je250 jo   sn   y  E   ebenbue  je  segi  efqo spuejiog uo peseg   e     aBenbuey seg jensiA SHOS UO paseg  L                        9 ON     ojMspue   yeelq 4 iid   Z 02 21 yess pug z 02 21     pua gnejep 7 0221 Y 3inejop   7 0221 t yeeuq    es 43 ese2 yeoJq  esie A 02 243 I    0221    Koz          A  0c   4 9 NI G3MOTIV LON  Z ese5   Z ese  238p   T4 Jeeuq X  027 1 yeeJq  X 0221 X021   ese  Xx 0z21  iL z  eseo  1  eased 1  ejlesS        eseo  IM    1  yous   1  yams       391    PAC Control User s Guide    NOTES TO EXPERIENCED PROGRAMMERS       Variable Comparison                                           n integer 32 Dim n as Long long n  n  Integer    nn integer 64 Not available LONGLONG d  d  Int64    f float Dim f as Single float f  f  Single    S string Dim as String char s 128   s  ShortString    p pointer not available long   pn  pn   Integer    nt integer 32 table Dim nt 10  as Long long i 10   nt  array 0  9  of Integer   ft float 32 table Dim ft 10  as Single float f 10   ft  array 0  9  of Single   st string table Dim st 10  as String char s 10  128   st  array 0  9  of ShortString   pt pointer table not available void   pt 10   pt  array 0  9  of    Integer           Notes to Experienced Programmers    392    Experienced programmers  especially those who are new to PAC Control  may be interested in the  following notes     Variable Database and Other Surprises    PAC Control maintains a database of all declar
185. W sawdust reet tnd wed eid Ix pee dab breues dva uda 35    PAC Control User s Guide EE       ERES rM 42  Chapter 3  What Is PAC Control               lseeeeeeeeeeeee eee ehh hh 43  IMUOQUETION cm 43  inthis CRADLE   ch  UMS 43  About PAC COnLFOIL  a ici UR t eat pecs Renae 43  Control System Example  si ect db teeth Ute tank rebote eL OE PARIS 44  General Coritrol Concepts 252 1o edu tais ehe CHE Ux e a  Aen d d dde ti bo eR debida tod 45  PUI OM AU OIA sgt etna me STURM MEME MU ed UNE E M 45  Control ENGINES uius ses des o tee eR S E i be debe eati ta re dec ew b d 45  Digital and Analog Inputs and Outputs         00 0 0    cece cece eee teen eee ees 45  SNAP Special Purpose l O Modules          cn terere herr teretes 46  Key Feature S scl                                      46  PAC Control Lenminology  sssaaa aa a E A E E AEAN 47  ACHON DIOCK SR  47   SIATE  018110107  a a AAN EE E A A E EO E ETT 47   sos cL 48  yel PM                                            48  senes des  TT  48  COBUUSDIOGK sioe sti sesto Eos M s aa C iss 48   digital POINT dee  48  external value 2    ce eee nee nnn nn ee nn ee ene ceeded nb ens 48   MS RII iuran E A o 0L 10 0501 05 0 0 EMT 48  HjorgeeM                                                                          49  instructions  Commands  225  ect be ete gia Mahala E e tb a ed ERR dus 49   internal value 2    cee cee ene ee II esa ere 50  multitasking seco der qed ue Due PEDE edad RP RD PERS BEER EN dai dos 50  ejtos  dlojnla  loro PATE
186. When scan intervals are  shorter than the system lag  tuning must compensate for any over correction from the  controller output     Tuning a PID Loop    Tuning a PID involves manipulating the P    and D constants in real time  The following steps should  be viewed as general suggestions to show you features that are available for tuning  We highly  recommend Opto 22 form 1641  OptoTutorial  SNAP PAC PID  for more detailed information    Form 1641 is available for download from our website at www opto22 com     CAUTION  Before following these procedures  make sure you know the limits of the equipment being  controlled and monitored by your PID loop  Also  make sure that these points are configured properly  Any  values suggested in these steps are for example only and must be modified according to the capabilities  and constraints of your system     1  Make sure the following PID features have already been configured     Scan Rate   Input   Input low range and high range  Output   Output lower and upper clamp   Algorithm    Setpoint  If your setpoint changes during normal operation  tune your PID with the  setpoint configured to host  so you can simulate setpoints from an input point or from  another PID     Gain  A final gain constant will be determined by tuning  but before you can tune your PID   your gain constant must be either a positive or negative number according to the type of  system you have  For example  a heating system reports a negative error when heat needs  
187. above  the  control engine was unable to communicate with I O unit EIO  C  The unit s IP address is shown for    easy reference     Time and Date  When the error occurred     PAC Control User s Guide 105    ARCHIVING STRATEGIES ON THE CONTROL ENGINE       Inspecting Control Engines from the PAC Terminal Utility    You can also inspect control engines from the PAC Terminal utility     1  Click the Windows Start menu and select Programs  gt  Opto22  gt  PAC Project 9 2  gt  Tools  gt  PAC  Terminal     The PAC Terminal window appears     File Tools Configure View Help    Control Engines           Controller Name System Type Address 1 Address 2 G re Control Engines          Cookie Controller     Standard 4127 0 0 1 Lr iQ Add         df R1 Controller Standard 4 10 195 55 111    Status Scan     amp  Scan Al  93  Scan Selected                   2  Double click the control engine you want to see  or right click it and choose Status from the  pop up menu    The Inspect Control Engine dialog box appears  The dialog box is explained on page 101     Archiving Strategies on the Control Engine    106    Archiving strategies on the control engine provides a backup in case original strategy files on the  computer are lost  When you archive a strategy to the control engine on an Opto 22 controller  a  zipped file is saved in battery backed RAM  On a SoftPAC controller  a zipped file is saved on the PC s  hard drive  In either case  if power to the control engine is lost  the archive is still
188. accept the data and close the dialog box     14  In the Add Instruction dialog box  click OK     The new instruction appears in the Instructions window for Drop Dough     PAC Control User   s Guide    15     16     17     18     CHAPTER 2  PAC CONTROL TUTORIAL       UInstructions   Dough_Chip_Control   Drop Dough       For animation in ioDisplay   Move  From nCookieMotionPreset  To dtCookieMotionTimer    Open the dough valve   Turn On  doDoughDispenseValve    Increment a counter of cookies produced  Increment Variable  nCookie_Counter    Keep the dough valve open for 2 seconds   Delay  Sec         a             Add     Modify       Delete    Next Block    Previous Block    But maybe it makes more sense to start the counter at the beginning of the process  rather  than in the middle  after some dough has already been dropped     With the Increment Variable command highlighted  press the right mouse button and select    Cut from the pop up menu     You can also use CTRL X to cut  Cutting puts the instruction in the Windows Clipboard     Now click Turn On to highlight it  Click the right mouse button and select Paste from the    pop up menu     You can also use CTRL V to paste  The Increment Variable command is pasted above the    highlighted instruction  like this     l Instructions   Dough Chip  Control   Drop Dough       Increment a counter of co   Increment Variable  nCookie Counter    Open the dough valve   Turn On  doDoughDispenseValve    Keep the dough valve open for 2 se
189. ack in the Drop Dough block s Instructions dialog box  move your cursor to the bottom right  edge of the dialog box    When your cursor changes to a bidirectional arrow  you can resize this dialog box by clicking  and dragging any edge    Close the Instructions   Dough  Chip Control   Drop Dough dialog box by clicking Close or by  pressing ESC     Before we leave the Dough  Chip  Control chart  let s make a cosmetic change  We noted  earlier that we didn t have any continue blocks in this chart  Let s add one to replace the long  connection that loops from the Drop Chips block up to the Speed OK  block     PAC Control User s Guide    OPENING A BLOCK       6  Select the connection line by clicking it at a bend or junction point  and delete it by pressing  DELETE  Click the down arrow at the bottom right of the chart window once to scroll down a  little     7  Now click the continue block tool   in the toolbar     When you bring the mouse back into the chart area  an oval outline appears  representing the  new continue block     8  Position the oval about half an inch below the Drop Chips block  and click your mouse button  once     A continue block appears with the default name Block 19   The number on yours may be  different   If you move the mouse again  a new oval outline follows  Deactivate the continue  block tool by clicking the right mouse button or by pressing ESC     Your screen should now look like this     The Powerup chart starts  this chart     This chart runs  co
190. ackground Downloading    Download Compression  None Full    Q                PAC Control User s Guide 171    COMPILING AND DOWNLOADING       172    6   Optional  To have the strategy run automatically after a control engine restarts  select    Set  autorun flag after download     7  Click OK     PAC Control is now set to download the strategy in the background when you click the Debug  mode button HB   Next  see    Compiling and Downloading  on page 166  See also     Switching  the Strategy    on page 169     Downloading Without Using PAC Control    If you are creating strategies for users who do not have PAC Control on their systems  for example  if  you are an integrator or OEM   you can make a control engine download file that can be  downloaded to a SNAP PAC controllerusing either the graphical interface in PAC Terminal or the  command line interface with a batch file  This one download file is built for a specific control engine  but can also be downloaded to other similar control engines  It contains everything PAC Control  would download  including  per   inc  and  crn files  control engine specific files  and initialization  information     In most cases you will want the downloaded strategy to be saved to flash memory and to start  automatically  autorun  when power is cycled to the control engine  Before you create the  download file  follow the steps in    Saving to Flash on Every Download    on page 165  Check the  boxes to have the strategy saved to flash memory 
191. act the two numbers to    find out how long the process took     You can set the time and date on the control engine by synchronizing it with the PC  in PAC Control  Debug mode  choose this option while viewing the control engine  Control Engine  gt  Inspect   You  can also use these commands to set the time and date on the control engine  Commands with NTP  in the name refer to the Network Time Protocol     PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Timing Commands    The following commands are used for timers and delays in a strategy     Timers Stop Timer   Continue Timer Timer Expired    Down Timer Expired  Up Timer Target Time Reached   Get  amp  Restart Timer   Pause Timer Delays   Set Down Timer Preset Value Delay  mSec    Set Up Timer Target Value Delay  Sec    Start Timer   Delay Commands    Delay commands are used frequently in strategies to pause the logic  Here are two reasons to use  Delay  mSec  or Delay  Sec      e Toallow time for the state of an input to change before it is checked again  For example  a delay  could give an operator time to release a button before the state of the button is rechecked  or  allow time for an alarm state to change before rechecking     e  Toleta chart give up the remainder of its time slice  when its logic does not need to run  constantly  For more information on using delays in this way  see 1776  Optimizing PAC Project  System Performance     Using Timers    Timers are a special type of numeric va
192. actice to save each initialization file to the directory  of the strategy that references it      Downloading the Initialization File    To use the file  you need to download it with your strategy     1  With the strategy open in Configure or Online mode  choose Configure  gt  Control Engines  or  double click the control engine s name     2  Highlight the control engine and click the Download Options button     The Download Options dialog box appears  The initialization file must be downloaded  immediately after your strategy is downloaded     1 Download Options    Files To Download After The Strategy                    3  Click Add   4  Navigate to the initialization file you created  Double click the file name     228 PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS       The file appears in the Download Options dialog box   Click OK     The initialization file sets values for the variables and table elements immediately after your  next full strategy download     IMPORTANT  When you create each variable in the strategy  you must check    Initialize on Strategy  Download  in the Add Variable dialog box     Since download options are specific to each control engine  make sure you set the initialization file as  a download option for every control engine on which the strategy will run  Because control engines  have separate initialization files  you can use the same master strategy for two or more control  engines and configure differences in variables by 
193. address as well as the appropriate Subnet Mask  DNS   and Gateway for the network  For more information on how to do this  see form 1704  the PAC  Manager User s Guide     e     The Send Email commands require you to use an existing email account  You might be able to  use a corporate email account  but check with your network administrator first  Your email  server must support either AUTH LOGIN or AUTH PLAIN authentication  neither AUTH MD5 nor  AUTH CRAM MD5 can be used with the Send Email commands   Or  you can use a free email  account such as Gmail    or Yahoo    Mail     If you will be using a corporate email account  ask your network administrator for the following  information about the email server     Outgoing SMTP server name or IP address  Port    Security type  Choices are ssl  tls  or none    SSL  Secure Sockets Layer  and TLS  Transport Layer Security  are standard security  technologies for establishing an encrypted link between a web server and a browser     If no root certificate is required for the connection  use  none  and the connection will not  be authenticated  If the target mail server doesn t require SSL or TLS  the login will succeed   However  if it requires SSL or TLS  the login will fail  Most servers require encryption  so  unless you re using an in house server  you ll probably need a root certificate     Root certificate  if applicable   A root certificate  which is used to validate an SSL or TLS  secure connection  may be required for your 
194. adecimal  For numeric tables  you can select  Decimal  Hexadecimal  or Binary        3  To view the configuration information  click More Info     PAC Control User s Guide 233    VIEWING VARIABLES IN DEBUG MODE                  3 1  Days Tabl   lt   Days_Table     scar yY ave x           NAME  Days Table   DESCRIPTION    TYPE  String Table  7    Name  Days Table          Index Value         2 Tuesday  3 WVednesday  INITIALIZED  Run  4 Thursday   INITIAL VALUE   5 Friday   B Saturday                           e ino   4  To change a table entry  click its index number  highlight the value  and type in a new value   Click Apply     5  To monitor the table in a watch window  click Watch   The Add Watch Entry dialog box appears     T Add Watch Entry    Name    Days_Table Length   7    Select Indexes To Watch     Out             O Single Index       C Range from          Select Watch Window      J Cie e             6  In the Add Watch Entry dialog box  do one of the following         Ifthe watch window you want to use to monitor the table variable is open  choose it from  the Select Watch window drop down list       Ifthe watch window you want is not open  click Open  Navigate to it and double click it to  open it       Ifyou want to monitor the variable in a new watch window  click New   For help  see   Creating a Watch Window  on page 157    7  Selectthe indexes you want to watch   8  When the Add Watch Entry dialog box shows the correct items to watch and the watch  window you w
195. after download and to set the autorun flag after  download  This information will become part of the download file     Creating the Control Engine Download   cdf  File    With the strategy open in PAC Control in Configure mode  right click the name of the control engine  in the Strategy Tree and choose Compile Control Engine Download File from the pop up menu   You  can also choose Compile  gt  Compile Control Engine Download File      The file is created in the same folder as the strategy  with a  cdf extension and a filename consisting  of the strategy s name and the control engine s name  for example  MyStrategy MyEngine cdf      Once the control engine download file is created  it can be downloaded using either the graphical  interface in PAC Terminal or the command line interface with a batch file you create   Downloading the  cdf File using PAC Terminal    1  Click the Windows Start menu and choose Programs  gt  Opto22  gt  PAC Project 9 2  gt  Tools  gt   PAC Terminal     PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       File Tools Configure View Help    Control Engines    Controller Name System Type Address 1   4f Cookie Controller Standard 4127 0 0 1   3 R1 Controller Standard 410 195 55 111                     2  Right click the name of the control engine you want to download the file to   3  Inthe pop up menu  choose Download    Control Engine Download File              4  Enterthe path and filename ofthe  cdf file  or click the Browse button and
196. al communication module on the same tcp 10 192 55 90 22511  rack  uses SNAP PAC R series IP address or loopback IP or  address  tcp 127 0 0 1 22511                To add a communication handle  see the steps starting on page 248  In the Add Variable dialog box   enter the communication handle value in the Initial Value field     Add Variable    Name  TCP Comm Handle Outgoing  Description     Type  Communication Handle v  Initialization  O Initialize on strategy download     Initialize on strategy run     Persistent       Communication  handle value       Initial Value   tcp 10 132 56 185 22004             Cancel Help       Port Numbers  If you are talking to other control engines or other peers on the network  you can  use any port number that is not already in use by that device  For example  you can safely use ports  22004 and 22005  which have been assigned to Opto 22 by the Internet Assigned Numbers  Authority  IANA   Opto 22 has allocated these Ethernet TCP port numbers for customer use  In  general  anything below 1024 is already predefined and shouldn t be used unless you are  implementing one of the predefined protocols that already has a reserved port  The following port  numbers are reserved by Opto 22 devices for the purposes shown                    20 FTP  file transfer protocol  for get  send  and dir  functions   21 FTP  file transfer protocol    25 SMTP  simple mail transfer protocol    161 SNMP based enterprise management systems   502 Modbus TCP   2001 Main 
197. alls to the control engine  therefore leaving more  processing time for other tasks     In addition  a slower setting may be useful when checking communication using PAC  MessageViewer  see page 366     If you don   t want the debugger to follow auto stepping  deselect  When stepping  make sure the  active block is visible    To change debugger speed  follow these steps     1  With the strategy in Configure mode  choose Configure  gt  Options  Alternatively  in Debug  mode  choose Debug  gt  Options     2  Inthe PAC Control Options dialog box  click the Debugger tab     PAC Control User s Guide    Status bar   Step On    CHAPTER 7  WORKING WITH STRATEGIES          PAC Opus  Workspace   Debugger                   Debugger Performance  Hi    tJ           V  When stepping  make sure the active block is visible     ok    Cm    Me    Low                3  Click and drag the slider to the speed you want     The default speed is shown in the figure above  Since performance varies depending on your  hardware and software  you may need to experiment to find the most efficient speed     Pausing a Chart or Subroutine    You can temporarily stop any running chart or subroutine by pausing it  When you pause a chart or  subroutine  it finishes the instruction it was executing  then stops at the next block  in Minimal    Debug  or the next line  in Full    Debug      To pause the chart or subroutine in the active window  click the Pause Chart or Pause Subroutine  button Ill   or press F7  o
198. amp NumVarldentifier   gt   amp ObjVarldentifier    StrAssignmentStatement    gt  StringVariable   StrExp      gt  Stringlable   NumericExp     StrExp      gt  StringVariable    Stridentifier      gt  StringVariable    Chr   NumericExp        StrExp      StrAdditiveExp      Stridentifier      Chr   NumericExp      StrAdditiveExp   gt  StrExp   StrExp    Stridentifier      StringVariable    gt  StringLiteral    gt  Stringlable   NumericExp      Numidentifier    gt  NumvVarldentifier    gt  Numlableldentifier   gt  StringCharldentifier    NumVarldentifier   gt  NumericVariable    ObjVarldentifier    gt  ChartVariable    gt  DigloUnitVariable    gt  MixedloUnitVariable    gt  Tableldentifier    gt  CommunicationHandle  Numlableldentifier      NumericTable   NumericExp    Tableldentifier      NumericTable    gt  StringTable  StringCharldentifier    gt  StringVariable   NumericExp         NumericLiteral   gt  Integer32Literal    PAC Control User s Guide 399    OPTOSCRIPT GRAMMAR SYNTAX REFERENCE        gt  Integer64Literal   gt  FloatLiteral    LogicalUnaryExp   gt  not NumericExp    ConditionStatement   gt   Statement  StatementListOrEmpty  EndifStatement   gt   fStatement  StatementListOrEmpty  ElseStatement  StatementListOrEmpty  EndifStatement   gt   Statement  StatementListOrEmpty  Elselfl ist  EndifStatement   gt   Statement  StatementListOrEmpty  Elselfl ist  ElseStatement  StatementListOrEmpty  EndifStatement    IfStatement     if   NumericExp   then    ElseStatement     e
199. analog value read from an I O unit and put into an integer is converted from float to integer  automatically     PAC Control User s Guide 297    MATHEMATICAL COMMANDS       To maintain the integrity and accuracy of a numeric type  float or integer   keep all item types the  same  For example  use the Move command to copy an integer value to a variable float when you  want float calculations     298 PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Miscellaneous Commands    The following commands are used with tables and for other purposes  Many of them are commonly    used    Comment  Block  Get Value From Name   Comment  Single Line  Move   Flag Lock Move from Numeric Table Element   Flag Unlock Move Numeric Table Element to Numeric Table   Float Valid  Move Numeric Table to Numeric Table   Generate Reverse CRC 16 on Table  32 bit  Move to Numeric Table Element   Get Length of Table Move to Numeric Table ElementsShift Numeric Table Elements    Get Type From Name    Comment Commands    The comment commands listed above are used with standard PAC Control commands in action  blocks and condition blocks  For information on using comments in OptoScript blocks  see step 10  in    Using the OptoScript Editor    on page 340     Comment  Single Line  and Comment  Block  commands are used in two entirely different ways     e Comment  Single Line  enters a comment to help explain a block or an instruction within a  block  Usually block names and comments within 
200. angent     Digital Point Clamp Float Table Element     Error Handling         Clamp Float Variable     Event Reaction Clamp Integer 32 T able Element    High Density Digital Module Clamp Integer 32 Variable    120 Unit Complement   1 0 Unit   Event Message Cosine   1120 Unit   Memory Map Decrement Variable      1 0 Unit   Scratch Pad Divide     Logical Generate Random Number  EEN    Heoi Cosine     Miscellaneous Hyperbolic Sine   PID   Ethernet ww     Hyperbolic Tangent                   Click the name of a command group in the left column to display all the commands in that  group  In the right column  click the command you want     For more information on any command  click the command name and click Command Help to  open online help  You can also look up the command in the PAC Control Command Reference     When the command you want is highlighted  click OK to return to the Add Instruction dialog  box      Optional  Enter a comment about the purpose of the instruction     Comments help explain the command s purpose in this block and are helpful to anyone who  debugs or updates the strategy later     Complete each argument for the command by typing in the Type and Name fields or by  choosing from the drop down lists     I Edit Instruction    Instruction     mm    Comment                   Open pressure valve when vessel pressure is less than setpoint of 0 5 psig     Type Name       Float Variable v  ID oughPressureS etpoint          Minus Float Literal     05             Put
201. ans enabled  No on a  red background means disabled  To change the status  click one of the arrows  then click Apply   To add the point to a watch window  click Watch and see page 157    To view configuration information for the variable  click More Info    To inspect the I O unit s configuration  click Open Parent     Pro only  To add a plot control  click Plot     2  ai16 Pot   scanning   Name  ail5 Pot  Type  Analog Input  3  More Info    WAL      433 0768 AVAL  420 1997    Communication  Pont SS      1 0 Unit  BAe S Open Parent                                G            14 04 40 14 04 50 14 05 00          Apply     Watch     Plet     FS    Data  gt     Value Axis p     TimeAxis p      Show IVAL          The Data button allows you to save  copy  or print the current plot  Use the Time Axis and Value  Axis buttons to adjust the resolution  Click Include IVAL to see a concurrent plot of the IVAL     PAC Control User s Guide    INSPECTING AND TUNING PID LOOPS       Inspecting and Tuning PID Loops    In Debug mode  you can view PID loops and tune them  This section gives you basic steps for  inspecting PIDs  determining system lag  and tuning PIDs  See also  Opto 22 form 1641  OptoTutorial   SNAP PAC PID  which we highly recommend  Form 1641 is available for download from our website    at www opto22 com     Inspecting a PID    1  With the strategy running in Debug mode  double click the PID on the Strategy Tree     3   pido     Name     Input    Setpoint    Output   Click a 
202. ant  click OK     The table variable appears in the watch window     PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS       Viewing Pointer Tables    1  Make sure the strategy is running in Debug mode  On the Strategy Tree  double click the  pointer table you want to view     The View Table dialog box appears  showing the pointer table   s name  length  and the items  pointed to  You cannot change a pointer table entry in this dialog box           Pointer_Table     scanning     Name  Pointer Table       Index Value  D Total Count     1 1 1 1 1    1 Previous Count  2 Status  3 Alarm gt           L  MODE   More Info       2  To view the status or value of the item pointed to  highlight it in the table and click More Info   If you need help  follow the steps in  Viewing Numeric and String Tables  on page 233     Adding Commands    To make a block in a strategy flowchart do the work it s intended to do  you add one or more  commands  Commands use the I O points and variables you ve already configured  as well as other  elements in your strategy  A command  for example  might turn on a digital point  move a value to a  variable  or check to see whether a chart is running  PAC Control contains more than 500 commands  you can use  A command in PAC Control is often called an instruction     You can add commands to action blocks  condition blocks  and OptoScript blocks  Continue blocks  just move flowchart logic to another block   See  Configuring a Continue Block  
203. ara koe tage dg dase tied das Bide dang gabe Ee dad de Ged wan 64  Saving a Strategy to las room oa pomme tesis caterers mda rte tud tuned eR 65  Saving te Hash ONCE   ueque itin cover te eese ERU Dre Rr idis 65  Saving to Flash ori Every Download    isses p Re eee e RR REO 65  Archiving Strategies on the Computer         issssssssssssssssssssssss eee 66  Compiling and  Downloading is   sistat eu sehr Sarda Ree Rte e dad domed eda Qoi da 66  Compiling and Downloading in One Step              sssssssssssse 67  Switching the Strategy  ioi atate tete ur uu qe tib eere b qae tb d re deed od 69  Compiling without Downloading                sss 69  Compiling the Active Chart or Subroutine          0    ccc ccc ccc cence ences 69          PAC Control User s Guide vii       viii    compiling CHANGES Only  4   iises onere te per pote ter er veperegnremede  Compiling  the Entire Strategy iss cce viec EHE pads UC Rt pH RS khan neat phot des  Downloading Only    iie cod rete eee de rt ee ette e DRM Pee T EA  Background Downloading             sss  Downloading Without Using PAC Control    0 0    cece eee ee eee eee I  Creating the Control Engine Download  cdf  File 2 0 0 0    cece eee eee eee  Downloading the  cdf File using PAC Terminal                 0  000 cc ceeeeeee ees  Using Command Lines or a DOS Batch File to Perform PAC Terminal Tasks          Changing Download Compression           ssssssssssssssssss e eect enn n eee es    Running a strategy Manually          5  2 toii beta te
204. arning  Center  For more information  go to the Opto 22 website  www Opto22 com and search on the part  number  SNAP PACLC     1  Click the Debug mode button EE  on the toolbar  or select Debug from the Mode menu    2  Inthe Save Strategy dialog box  click Yes to save the strategy   3  If you see a Powerup Clear Expected message  click OK     You may see a Download Warning message like this one     PAC Control User   s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       Download Warning    A Strategy Mismatch    The strategy to be downloaded does not match the strategy already in the control engine   Strategy To Download    wv Name  Cookies     Checksum  84D9073CC5C4F42COF7B7004FCF2FCBD  Timestamp  06 04 09 12 29 33    Strategy in the Controller  Name  Cookies  Checksum  577EF49E0D7899DA3EFBEAS9B 3CF3031  Timestamp  06 03 09 17 07 54  If you choose to continue  the strategy that is in the control engine will be replaced by this strategy     Do you want to continue the download        Or you may see a message that the control engine s memory has been cleared   Click Yes to proceed     Two additional dialog boxes appear  The first dialog displays the progress as the strategy is  compiled  The second dialog shows progress as the strategy is downloaded to the control  engine     T Strategy Download    a  Downloading your strategy       Download stratecy       NERRRRRRRRRRRRRRRRRRRRNI       Cancel       Assuming the strategy was compiled and downloaded successfully  you are now in Debu
205. art  see page 80  For more on the message queue  see    Queue Messages    on page 372     You can use the command Add User Error to Queue to add your own information  warning  or error  message to the queue  This command can be helpful in troubleshooting     IO Enabler Sample Strategies    Sample    IO Enabler    strategies are available on the Opto 22 website  The logic in these sample  strategies is designed to automatically recover communications to any I O unit that temporarily  goes offline  that is  has communications disabled  for any reason  Choose a sample that is  compatible with your system configuration  Each sample has the same basic code        www opto22 com site downloads dl drilldown aspx aid 3605    www opto22 com site downloads dl_drilldown aspx aid 3603  www opto22 com site downloads dl_ drilldown aspx aid 3604    PAC Control User   s Guide       I O Unit Co    CHAPTER 10  PROGRAMMING WITH COMMANDS       mmands    The following commands are used to communicate with an I O unit  which controls a group of I O  points     Clear I O Unit Configured Flag Move I O Unit to Numeric Table Ex   Get I O Unit as Binary Value Move Numeric Table to I O Unit   Get I O Unit as Binary Value 64 Move Numeric Table to I O Unit Ex   Get Target Address State  Set All Target Address States    I O Unit Ready  Set I O Unit Configured Flag   IVAL Move Numeric Table to I O Unit Set Target Address State      IVAL Move Numeric Table to I O Unit Ex Write I O Unit Configuration to EEPRO
206. as encountered that cannot be used when   Contact Product Support  See page 4   compiling    66 Requested item in protected dictionary Attempted to remove a strategy when there was no strategy  in the control engine   Out of memory  To minimize the size of your  strategy  reduce the number and size of vari    No room left to create any variables or save any data on the   67 ables  especially tables   You can also shrink   stack  Or an attempt was made to save the strategy to flash   your strategy by using subroutines to per  without enough room in flash to save it   form common tasks   69 Invalid parameter  null pointer  passed to Attempted to use an uninitialized pointer  or a null pointer  command  was received by a command    70 Not enough data supplied  Table index given is larger than the size of the table  X    P Too many persistent variables  variables initialized on down   Out of persistent memory  If applicable     P   71 load  or too large a strategy archive to fit in battery backed  check length of tables   RAM   Communication to I O unit not enabled  Pre   vious communication failure may have dis  Communication to the I O unit may have been disabled by a   93 igne   ERAN f   X  abled communication to the unit communication failure that happened earlier   automatically  Re enable it and try again    95 Stack not empty  Contact Product Support  See page 4   Port could not be unlocked  Task attempting       103 to unlock the port does not match the task AR E to unloc
207. ategy and can be called by any strategy  I O  units and points are specific to a strategy  so they cannot be added to a subroutine  Also  note that  commands and OptoScript code within a subroutine can use only the passed in and local items in  the subroutine  not items in the strategy that calls the subroutine     PAC Control User s Guide    CHAPTER 12  USING SUBROUTINES       Compiling and Saving the Subroutine    1  With the subroutine open  select Compile  gt  Compile Subroutine   When the subroutine has finished compiling  the cursor returns to its normal form     2  Select Subroutine  gt  Save     Using Subroutines    To use a subroutine in a strategy  you include it in the strategy and then add it as a command   instruction  so it can be called from a chart     Including a Subroutine in a Strategy   Since subroutines are independent of strategies  you must include the subroutine in the strategy   before you can use it    1  With the strategy open in Configure mode  double click the Subroutines Included folder on the  Strategy Tree or select Configure  gt  Subroutine Included     The Subroutine Files dialog box appears  listing all subroutines currently included in the  strategy  The example below shows no subroutines currently included     I Subroutine Files  Cookies         Subroutine Filename             2  Click Add     PAC Control User s Guide 355    USING SUBROUTINES       356    3     Select Subroutine File    Look in      Subroutines     v  35 fi            y in
208. atic Chart Import    O Replace existing chart  To  Name             Description  D  escription                          At the top of the dialog box  click Create new chart or Replace existing chart     CAUTION  If you choose Replace existing chart  the old chart will be completely overwritten with  the chart you are importing     Click Select  Navigate to the exported chart  Click OK    In the To section of the dialog box  enter a name for the new chart    If you wish  enter a description  If you are replacing an existing chart  select it from the list  To  copy the imported chart description  select the text in the left description field  copy it  and  paste it in the right description field    Click OK     The chart is imported  A Chart Import Report window shows you how the tags in the chart  match with those already in the strategy  Any tags from the chart that do not already exist in  the strategy are created and added     PAC Control User s Guide       9  Using Variables and  Commands    Introduction    This chapter discusses the seven types of variables used in PAC Control  numeric  string  pointer   numeric table  pointer table  string table  and communication handle variables     This chapter also shows you how to use the commands  or instructions  in PAC Control and discusses  the mechanics of adding commands to your strategy flowcharts  For command information to help  you program your strategy effectively  see Chapter 10  To find out how to use commands in  OptoS
209. atting gloves    2 Batting gloves Catcher   s mitts   3 Catcher   s mitts                            5  Use the command Close Communication to close the communication handle     Reading a File  As another example  suppose you have a file on the control engine that was  placed there via FTP   See the next section for details on using the FTP communication handle   You    PAC Control User s Guide 259    COMMUNICATION COMMANDS       260    want to read this file  New_Data txt  and place the data in it into a string table  Data_Table  in your   strategy    1  Use Open Outgoing Communication to open a file communication handle  The value of the  handle would be    i1e r New Data txt   2  Usethe condition Communication Open  to make sure the handle opened    3  Use the command Set End Of Message Terminator to indicate what character in the    New  Data txt file should be read as the delimiting character   In the example shown below  it s  a slash         TIP  If the lines of data in the text file end with LF  line feed   set the EOM  end of message  terminator  to 10  decimal   which is the ASCII code for LF     4  Use the command Receive String Table to receive the data from New  Data txt directly into  Data Table  To read the whole file  use a value of  1 for the Length parameter                          Control Engine File System Strategy  New  Data txt Data Table  o   485  485  622 35 56   7841 20 1   622  2   35  3   56  4   7841  5   20                               Notice th
210. b ee buque eM echo taeda eui piden Cas 220    PAC Control User s Guide       ISTE RP RR 221    Adding Vatlables    sce pros cree Ebert edo epu RECO RR bets 221  Ada Variable Dialogi BOX occ eee oee teer  aanrementeniaacenarennid 222   Adding TAD              nae ebaae 224  AadingJTableVariablest  s soa dete scam ne T utor tue dais Er 224  Setting Initial Values in Variables and Tables During Strategy Download                     226  Creating the Initialization File             sssssssssssssss 226  TEXUEXAM PICS HET  226  Downloading the Initialization File              sss 228   Starting the Strategy Automatically        00 0    ccc eee ee teen ee eee 229  Changing a Configured Variable          eder RIDRe RUINA i dan be ons 229  Deleting    Variables  i  et cet ro tetro tbe dea reb ett ter To Ue b RU bie bah 229  Viewing Variables in Debug Mode           ssssssssssssssssssI e 230  Viewing Numeric  String  and Communication Handle Variables                    08  230  Viewing Pointer Variables  stas veta te eate Re RR Od EYE e QA br v de Ra Qe a 232  Viewing Numeric and String Tables 0 0    000    cece cece cece cece n eee n rnrn 233  Viewing Pointer Tables        5e iae eae de e ER DR e PP dad Od weds dank 235  Adding COMMANGS uie rete eco Or eeu pbbo e P e tERDU ER Ue 235  Changing a COmlmlalid     eccsc ceste exert dane devra teen re bem tU I REA a cnad entra 239  Deletinig a Gormmarnas  nuca esee Gee ed bb exui qa ebd ded E A OSA 239  Permanently Deleting a Command      
211. be found on the network   If the PING command cannot be found   Verify that the PC has TCP IP bound to and configured  on the network adapter   If you are running Windows 95 or Windows 98  follow these steps   1  Choose Start  gt  Settings  gt  Control Panel and double click Network     2  Highlight the adapter in the list  Make sure both NetBEUI and TCP IP appear just below the  name of the adapter  Click Properties     3  Highlight TCP IP and click Properties  Verify that the IP address and subnet mask are  appropriate for your network     If you are running Windows NT  follow these steps   1  Choose Start  gt  Settings  gt  Control Panel and double click Network     PAC Control User s Guide    OTHER TROUBLESHOOTING TOOLS       2  Click the Protocols tab  Make sure both NetBEUI and TCP IP are listed  Highlight TCP IP and click  Properties    3  Highlight the adapter name in the list  Verify that the IP address and subnet mask are  appropriate for your network    If you are running Windows 2000  follow these steps    1  Choose Start  gt  Settings  gt  Control Panel and double click Network and Dialup Connections     2  Right click your network card and choose Properties from the pop up menu  Make sure that  TCP IP is present and checked     3  Highlight TCP IP and click Properties  Verify that the IP address and subnet mask are  appropriate for your network     If you see the message  Destination host route not defined   the control engine probably has  an IP address and sub
212. be true to exit True  or whether any one condition must be true  to exit True     continue block    Continue blocks are oval shaped blocks in a flowchart that route the flow of execution to an action   condition  or OptoScript block  They do not contain any instructions  but store only the name of the  next block to execute  Continue blocks can have many entrances  but no exits  since the exit is  defined within the block  Continue blocks avoid awkward connections between two blocks that are  far apart     digital point    Digital points can be either on or off  true or false   Push buttons and LEDs are examples of digital  devices  an LED is either on or off  it has no other possible state  Digital points can be either inputs   such as a photo sensor  or outputs  such as a pump      external value    The external value  XVAL  is the real world value measured or set by an I O point  The PAC Control  strategy reads and writes only to internal values  and transfers internal values to external values if  communication to the associated   O unit is enabled     flowcharts    Since most control applications are complex  the strategy typically consists of a series of process  flowcharts  or charts  that all work together  Fach chart controls one aspect of the strategy   one    PAC Control User s Guide    CHAPTER 3  WHAT IS PAC CONTROL        piece of the automated process  Together  all the charts constitute the strategy  The total number of  charts in a strategy is limited only by 
213. bit integer  a  floating point value to an unsigned 64 bit integer  an ASCII  value to a float     NOTE  In OptoScript  an If Statement expects an 32 bit  number and will automatically convert any other type  such  as 64 bit integer or float value  to a 32 bit number  To avoid  this overflow error  a slight change to the code can avoid this  problem  For example     if  your int 64 here  then     becomes   if  your int 64 here  lt  gt  0  then       Also math functions such as multiply  exponentiation   hyperbolic sine  hyperbolic cosine  function x to the y  add   subtract  modulo  negate  move assign     Time date functions  setting a month not in the range  1   12  a day not in the range 1   31  hours not in 0   23  min   utes 0   59  seconds 0   59     Number entered on host port  for example  through PAC  Terminal  was too big for data types         14    Invalid number     Math resulted in an invalid number  like infinity or an imagi   nary number   natural log of the floating point number   square root  arc sine  arc cosine of float  function x to the y   with negative x          15    Cannot divide by zero     Attempted to divide a number by zero         16    Bus error     Contact Product Support  See page 4         17    Port already locked on PAC Control engine     Attempted to lock a connection that   s already locked        Device busy  May be in use by another user  or another application     A resource is already acquired by another task or process        Had t
214. bit operating system  select Edit  gt  Permissions        The Registry Key Permissions dialog box opens  Make sure that    Opto22    appears next to  Registry Key at the top of the window   8  Click Add     9  Inthe Select Users  Computers  or Groups dialog box  select the name of the appropriate group  or domain from the Look In drop down list     10  In the Name list  select the name of the user or group that should have control engine access  and then click Add     11  If itis not already selected  check  Full Control    in the Permission area  Make sure  Allow  inheritable permissions from parent to propagate to this object  is checked     PAC Control User s Guide 369    OTHER TROUBLESHOOTING TOOLS       12  Click OK    13  Select Registry  gt  Exit to close the Registry Editor    14  Restart the computer    The user or group you added can now use control engines without having administrator access     370 PAC Control User   s Guide       B  Errors and Messages    Introduction    This appendix discusses errors and messages you may see in PAC Control and their possible causes   Errors and messages may appear with text only or with a negative number and text  The more  common errors and messages are listed in this chapter in numeric order  starting on page 373     To look up an error in PAC Control  select Help  gt  Error Lookup  In the Error Lookup dialog box  enter  the error code  and then click Get Error     Error Lookup       Error code  0             Error Description
215. ble dialog box          Variables          Numeric Variables       String Variables   C3 Pointer Variables   EE Communication Handles         Numeric Tables Laat y   C3 String Tables Configute      C3 Pointer Tables       2  Atminimum  enter the following things     Name  Create an appropriate name  such as ICP  Handle   Type  Select Communication Handle     Initial Value  Varies with type  For TCP  see page 249  For File  see page 257  For FTP  see  page 263  For Serial  see page 266     Add Variable          Name  Description     Type Type  Communication Handle     v  Initialization  O Initialize on strategy download     Initialize on strategy run     Persistent  Initial Value Initial Value             Cancel Help       PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Using TCP Communication Handles    The TCP communication handle is used for most Ethernet communication  Any device on the  network accessible via TCP IP can be communicated with using communication commands  For  example  data from a serial device can be received through a serial communication module  or  communication can be established with a PC on the network     NOTE  If the two devices that are sharing data are both control engines  it may be easier to use the Scratch  Pad areas on each to transfer data  rather than using communication commands  See    I O Unit    Scratch  Pad Commands  on page 291 for more information     NOTE  Be sure to use a separate TCP communication handle fo
216. ble of all PAC Control commands and their OptoScript equivalents  In  addition  OptoScript equivalents for each command are shown in the PAC Control Command  Reference and in the online command help     Using I O in OptoScript    One advantage of OptoScript is that any named I O point can be used directly  wherever a numeric  variable can be used  rather than requiring a variable  Digital points behave like integer variables that  have only two possible states  zero  off  or non zero  on   Analog points behave like float variables     For example  you can turn a digital point off by simply assigning it a value of zero     PAC Control User s Guide    CHAPTER 11  USING OPTOSCRIPT       Light Switch   0     You can turn a digital point on by assigning it any value other than zero   Light_Switch 1    Light Switch    1    Light Switch   486     You can use I O points directly in mathematical expressions   fLimit   Pressure Input   50     Or use them directly in control structures  for example to turn off the light if the door is closed   if  not Door  then  Light Switch   0   endif  You can set an output based on the value of an input or a variable   LEDO1   Switch A   Proportional Valve   fPressure Control  You can use a point directly with a command   fRange   GetAnalogMaxValue  Temp Input    GetAnalogMinValue  Temp Input    TurnOn  Fan A    IsOn Fan A      OptoScript Syntax    Here is a sample section of OptoScript code to illustrate syntax  Indentation is not required  but is 
217. ble s name or by highlighting it and clicking Modify     Deleting a Variable    You cannot delete a variable that is referenced within the strategy or subroutine  Be careful when  deleting variables  since you cannot undo a deletion     1     Make sure the strategy is open and in Configure mode     PAC Control User s Guide 229    VIEWING VARIABLES IN DEBUG MODE       2  On the Strategy Tree  expand the Variables folder until you see the name of the variable you    want to change  Right click the name and choose Delete from the pop up menu     The variable is deleted     You can also delete a variable from the Configure Variables dialog box by highlighting the variable s  name and clicking Delete     Viewing Variables in Debug Mode    While the strategy is running in Debug mode  you can view its variables and modify the value of a  variable or of entries in a table  You can also view several variables at once   as well as other strategy  elements   by putting them into a watch window     Viewing Numeric  String  and Communication Handle  Variables    1        Make sure the strategy is running in Debug mode  On the Strategy Tree  double click the  variable you want to view     The Inspect Variables dialog box opens  The animated icon at the upper left assures you that  the data is fresh  The title bar includes the name ofthe variable and indicates whether scanning  is occurring          nCookie Counter   scanning        Value  42896 Maximize button                2   nCookie  C
218. bles    O units and points  and PIDs     PAC Control User   s Guide    PAC CONTROL MAIN WINDOW       Strategy tree    Sprinkler_Control     DER     o E         Control Engines  P d Sprinkler Controller       Subroutines Included      Charts     C3 Variables     C5 Numeric Variables       String Variables      Pointer Variables   C3 Communication Handles   C3 Numeric Tables      String Tables   C3 Pointer Tables       JO units     GA Mixed IO Unit     Cj Points       PIDs                vi Jb Next 4  Prev       The Strategy Tree works just like Windows Explorer  you can expand or collapse folders to view or  hide what is in them  You can easily see what is in your strategy  open elements to change them by  double clicking them  or open a pop up menu by right clicking on an element     Each element in the strategy is represented by a button  shown just to the left of its name  The table    below shows the buttons and what they represent                                   a Control Engine HH Integer 32 Table  Ta  Chart Integer 64 Table  Is4  ab  Subroutine H String Table  STR   12  Integer 32 Variable Pointer Table  Isz PTR   Integer 64 Variable cru Digital I O Unit  Iet D  aH Float Variable ini Mixed I O Unit  FLT AFD  a Down Timer Variable pd Analog Input Point  THE It   E Up Timer Variable Digital Input Point  THE p   String Variable wa Analog Output Point  TF  n  f   Communication Handle Digital Output Point  CH o         PAC Control User   s Guide    CHAPTER 3  WHAT IS PAC C
219. bles   See  page 263 for information on FTP     PAC Control User   s Guide       CHAPTER 10  PROGRAMMING WITH COMMANDS       This section of the PAC Control strategy reads the variable names from the text file in the control  engine s file system and places the names in a string table  Product  Names   Next  the strategy uses  the command Get Value From Name to place the values of the variables into another table   Product  Info   The data from this table is then written to another text file  ProductInfo txt  on the  control engine  which can later be sent via FTP to the person who requested the data        The whole operation  including the FTP portions  which are not covered in this code example      might look like this                       Requestor Control Engine   Li File System  ProductRequest txt   ProductRequest txt FTP Num  Widgets    Num  Widgets  o Num  Gadgets    Num  Gadgets  Num  Thingies    Num  Thingies  Num  Whatnots   Num  Whatnots                   ProductSales txt          9556  10867  Productinfo txt    5432  23 9556  10867   FTP Q 5432  23                      PAC Control Strategy       0    Product  Names String Table    Num Widgets       1    Num Gadgets       2    Num Thingies             Num Whatnots                   Get Value  From Name             Product  Info String Table   o  ese    o 1   10867  2 5432  3 23                      PAC Control User s Guide 261    COMMUNICATION COMMANDS       The OptoScript code in this example also makes use of 
220. cal Operators    on page 335 for more information     PAC Control User s Guide 293    LOGICAL COMMANDS       Logical True and Logical False  PAC Control always returns a value of  1 to indicate True in an integer variable     A digital input or output that is on also returns a True   1   Any non zero value sent to a digital  output turns it on  False is defined as zero  0     For individual bits within an integer variable  bits that are set  1  indicate on  Bits that are cleared  0   indicate off    While floats can be used in logic  integers are strongly recommended whenever any bits are  referenced  Since PAC Control does not permit bits in a float value to be altered  float values must be  converted to integers before bits can be evaluated  See    Mathematical Commands  on page 295 for  further information on integers and floats     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Mathematical Commands    The following commands perform mathematical functions     Absolute Value Raise to Power   Add Round   Clamp Float Table Element Seed Random Number  Clamp Float Variable Square Root    Clamp Integer 32 Table Element Subtract    Clamp Integer 32 Variable Truncate  Complement   Decrement Variable Trigonometry  Divide Arcsine   Generate Random Number Arccosine  Increment Variable Arctangent  Maximum Cosine   Minimum Hyperbolic Cosine  Modulo Hyperbolic Sine  Multiply Hyperbolic TangentSine  Natural Log Tangent    Raise e to Power    Using Integers    In
221. cation handle may have been closed by a previous  command that failed    57 String not found  Substring not found in the string being searched   F Attempted to read an empty buffer  or a connection with no  No data received  Ds     58 or characters waiting   or the I O unit may be turned off or  unreachable  or when searching a string for a particular  Character not found  3  character  the character wasn   t found   Command may not apply to the type of communication han    gt  dle you are using  for example  Receive commands cannot   t Could nat receive date  be used with ftp comm handles   Use the get option with  Send Communication Handle Command instead    Empty stack error  PAC Control engine  attempted to perform an operation that  60 expected data on the PAC Control engine Contact Product Suppor  See pagad   stack        376 PAC Control User   s Guide             APPENDIX B  ERRORS AND MESSAGES                                                                            PAC Control User s Guide    A number of things can reduce the amount of dictionary  ae     space  such as   Dictionary full error  PAC tonta engine dic      Too many blocks or variables in a strategy   61 tionary is full and no more  words  can be  defined    Too many large tables    Using background downloads  which cuts available  memory in half  62   Stack full error  PAC Control engine stack       The PAC Control engine stack is full   has grown too big   Execute only error  A command or  word    64 w
222. cause all available socket resources to enter this time  period  When this occurs  any attempt to open an outgoing  communication will fail with this error code because there  are no available sockets to use for this attempt     When an error occurs when trying to open a TCP communi   cation handle  the strategy should back off for a significant  amount of time before reattempting  Subsequent failures  should have additional delays applied  These delays slow  the consumption of TCP resources         440 Could not bind socket     Another device  such as the I O on the brain  is already  using the port  If you are using the Modbus toolkit  make  sure to use PAC Manager to set the brain   s Modbus port to a  number other than 502  Try 0         442 Could not accept on socket     Ethernet    accept    failed         443 Could not receive on socket     Ethernet  receive  failed         444 Could not send on socket     Ethernet  send  failed         446 FTP  Login failed     Incorrect user name or password  The maximum number of  login attempts on the server has been exceeded         531 Buffer full      534 Attempts to communicate with I O unit failed      539 I O error  performing retry    Attempted to write to a full buffer  For a serial communica   tion handle  data is being sent faster than the serial port can  send and buffer it  Use a faster baud rate or a delay  between Transfer Transmit commands     I O unit may have lost power or network connection     I O unit may have l
223. ce  you can quickly move from block to block  in the chart by clicking the Next Block or Previous Block buttons in the Instructions dialog box     If you re working with a condition block  clicking Next Block opens a dialog box so you can select  which block to choose  since condition blocks have two exits  The same dialog box appears if you click  Previous Block and the block you re working with has connections coming from more than one block     11  If you put more than one command in a condition block  complete the Operator group as  follows     f both commands must be true to exit the block true  click AND     If only one of the commands must be true to exit the block true  click OR     Here is an example of an Instructions dialog box for a condition block with two commands  In  this case  the block will exit true if either of the commands is true     238 PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS       tInstructions   Sprinklers   Sunday or Wednesday   x        Day_of_the_Week  3  Day_of_the_Week    Either the first command OR the  second command can be true for    BR this condition block to exit true           Operator          Changing a Command    1     With the strategy open in Configure or Online mode and the flowchart open  double click the  block containing the command you want to change     NOTE  To change commands in OptoScript blocks  see    Using the OptoScript Editor  on page 340     In the Instructions dialog box  double click any li
224. ce of the application may open  It depends on the application  some check to see whether  the application is already running  and some do not   1  With PAC Control open  choose Tools  gt  Customize    The Customize dialog box appears     Customize    Menu Contents                               2  Click Add   3  Inthe Menu Text field  type the name of the application as you want it to appear in the Tools  menu     4  In the Command field  type the path for the application s executable file  or click the browse  button        and navigate to the file     5   Optional  In the Arguments field  type any necessary command line parameters     6   Optional  In the Initial Directory field  type the directory the application should default to  when it runs       66   PAC Control User   s Guide    CHAPTER 3  WHAT IS PAC CONTROL        For example  this is the directory the application would show when you open or save files     7  Repeat the steps to add other applications  To change an application s position in the menu list   highlight it and click the Move Up or Move Down keys     8  When you have finished adding applications  click OK     You return to the PAC Control main window  and the applications you ve added now appear in  the Tools menu     Keyboard and Mouse Shortcuts    Use the following keyboard and mouse shortcuts to view and navigate a chart                       Center on Block 0 0 or Numeric Keypad 0    Move to Bottom Left Numeric Keypad 1   Move to Top Left Numeric Key
225. cessfully     PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Running a Strategy Manually  1  With the strategy open  choose Mode  gt  Debug   2  Click the Run Strategy button p  or press F5  or select Debug  gt  Run      You can also run a strategy from the Inspecting dialog box  See  Inspecting Control Engines in  Debug Mode  on page 101     Running a Strategy Automatically  Autorun     You can set the strategy to run automatically  autorun  if the control engine loses power and then  restarts  In traditional Opto 22 controllers  the OptoControl autorun function was controlled by a  jumper  For PAC Control  it s controlled by the autorun flag  If the autorun flag is not set  the strategy  must be started manually after power is restored to the control engine  The strategy must be saved  in flash memory for autorun to work     You can set the autorun flag in two ways   e In Configure mode  save the strategy to flash memory and set the autorun flag every time the    strategy is downloaded   Be careful you do not save to flash too often  as flash memory  eventually wears out   See  Saving to Flash on Every Download  on page 165     e    n Debug mode  save the strategy to flash memory by choosing Control Engine  gt  Save  Strategy to Flash  Then right click the control engine in the Strategy Tree and choose Inspect  from the pop up menu  In the Inspect dialog box  enable Autorun   See  Inspecting Control  Engines and the Queue  on page 101 for more on the I
226. cking buttons at the right of the  title bar  or you can reshape it by dragging any edge in any direction     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       However  the Strategy Tree window is unique in that it must remain open  since closing it is  equivalent to closing the strategy     The Strategy Tree works like Windows Explorer  you can expand and collapse folders to show or hide  what is in them         e c       Subroutines Included  Expanded L     amp    3 Chats  Charts folder m To Alarms     amp  Bp Dough_Chip_Control    D Dough Vessel Pressure    E  D Oven_Inspection_Control  m D Powerup   amp   C Variables   amp   Cy Numeric Variables      String Variables   C3 Pointer Variables   Cy Communication Handles  E Numeric Tables   Cy String Tables   C3 Pointer Tables  a  E 1 0 Units         iH       v  Next 4  Prev          A quick look at the tree reveals that our strategy includes five flowcharts  in the Charts folder   eight  Numeric Variables  and one Mixed I O Unit  with both analog and digital points   The Strategy Tree  not only shows you all components of the strategy but also provides shortcuts to many common  PAC Control activities  for example  opening flowcharts     Docking the Strategy Tree    Since the Strategy Tree is so useful  you ll probably want to keep it visible while you create and    debug your strategy  To keep the Strategy Tree window always visible  you can dock it in a separate  frame     1  Click the docking icon  S  in the
227. click Refresh     5  To copy all messages in table format for transfer to another program such as Excel  click Copy  All     6  To delete the top  oldest  message on the list  click Pop Top Message    7  To delete all messages  click Clear Messages    8  Close the dialog box to return to the Inspect Control Engine dialog box   Any changes you have made to the queue are reflected there     Message Queue Information    Each message in the View Messages dialog box includes the following information     Code  The message or error code number  see  List of Common Messages  on page 373  or User if  the message was placed in the queue using the command Add Message to Queue     Severity  Information  Warning  or Error     Chart and Block  The chart and block being executed when the error occurred  If the error  occurred someplace outside the strategy  for example when trying to connect to an I O unit  Chart  shows   system    If the error occurred in a subroutine  Chart shows the chart that called the  subroutine  and Block indicates the name of the subroutine plus the block number in the format    sub name gt   lt block number   For example  error  4 above     Cannot divide by zero   occurred in  block 1 of the subroutine Variable Increase Notification  which was called by the   Temperature Control chart     Line  If you are in Full Debug mode  the line being executed when the error occurred   Object  The table  I O unit  or other object affected by the message  In errors  1 and  2 
228. click the Save Strategy button  gd on the toolbar  you can choose which charts to save in the Save  Strategy dialog box     Closing a Chart    To close a chart  click the close box in the upper right corner of the chart s window  not the PAC  Control window   You can also close a chart by pressing CTRL F4 when the chart window is active  If  you have made changes to the chart  you are prompted to save them     Copying  Renaming  and Deleting Charts    Copying a Chart    If an existing chart is similar to one you want to create  it is easier to copy it than to create a new one  from scratch  To copy a chart in the same strategy  follow the steps in this section  To copy a chart to  another strategy  see  Exporting and Importing Charts  on page 215     1  With the strategy open and in Configure mode  select Chart  gt  Copy   The Copy Chart dialog box appears     Copy Chart                   Description  Description     Check the E Stop button     the two level alarms                                2  In the From field  choose the chart you want to copy from the drop down list   3  In the To field  enter a name for the new chart     The name must start with a letter and include only letters  numbers  or underscores   Spaces  are converted to underscores      4   Optional  Enter a description for the new chart     PAC Control User s Guide 213    COPYING  RENAMING  AND DELETING CHARTS       5     Click OK   The new chart is created and appears as the active window on the screen   
229. command processor  OptoMMP based  also  used by SNAP PAC controllers and brains                 250 PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       2222     44818 Ethernet IP       22000 Opto 22 controllers and brains       Host port  for information on configuring the host  22001 port  see form 1704  the PAC Manager User s  Guide        22002 Opto 22 controllers and brains       22003 Opto 22 controllers and brains                   22500    Serial communication modules  22531 i TUM    50000  Internal messagin   50999 M    Note that port numbers on the SNAP PAC controllers and brains are the default ports  some may  have been changed for security reasons   See the section on Security in form 1704  the PAC Manager  User s Guide      If you do not know what port number to use  ask your network administrator or check the list of  standard reserved Ethernet port numbers at www iana org assignments port numbers to see ports  that may apply to your devices on your network     Incoming Communication  For incoming communication  communication requested by  another device   the communication handle value includes just the protocol and the port number   Protocol  Port  ICP automatically tracks senders so there is no mix up in the data sent and  received  Here are a couple of examples of communication handles for incoming communication        Communication Handle Value       Incoming Communication  Protocol Port    Ethernet TCP   from another control engine tc
230. conds   Delay  Sec   2 0             Click Close to return to the chart        Add       Modify       Next Block  Previous Block    You ve just added a cookie counter  On the Strategy Tree  open the Numeric Variables folder in  the Variables folder  The new numeric variable is there     Save the changes you ve made by clicking the Save Strategy button  gj on the toolbar  Click OK    to save     Now we re ready to download the strategy to a control engine  But first we have to tell PAC    Control that we have a control engine     PAC Control User s Guide    CONFIGURING A CONTROL ENGINE       Configuring a Control Engine  Up to this point  we ve been able to play around in PAC Control without hardware  Now it s time to  configure a control engine     1  Ifyou have a PAC Control compatible control engine and   O unit you can use  make sure they  are on the same network as your PC  and make sure you have loaded the most recent firmware     For a list of compatible control engines and I O units  see page 5  For instructions to load  firmware  see Opto 22 form 1704  the PAC Manager User s Guide     2  Turnthe I O unit off and then back on again     3  Double click the Control Engines folder on the Strategy Tree  or select Configure  gt  Control  Engines     The Configure Control Engines dialog box appears     Active Engine     Engines Associated with Strategy        Delete    Download Options                   Since we haven t configured a control engine yet  there are no control e
231. cript block  i  block  HY block  pre t     ut    Changing the Appearance of Elements in a Chart Window    You can change the background appearance of charts or subroutines  the color and size of blocks  and text  and the color of connection lines  Depending on the scope you want to affect  you can  change these window properties at three levels     e     Across PAC Control   to change the appearance of all new charts in all new strategies  and all  new subroutines   e     Across a strategy   to change the appearance of all new charts in the open strategy     e For the open chart or subroutine   to change the appearance of all new elements in the open  chart or subroutine window     IMPORTANT  Note that most changes affect only new charts and their elements  Existing charts   subroutines  and elements are not changed  To avoid having to go back and change each item  individually  make sure you set the defaults the way you want them before you create new charts  Once  you have changed the defaults  see  Changing Existing Elements to Match New Defaults  on page 205 to  change existing elements to match the new defaults     To change the appearance of charts and elements  follow these steps   1  Chooseone ofthe following  depending on the scope you want to change      To change all new charts in all new strategies and all new subroutines  choose Configure  gt   Default Properties to open the Configure PAC Control Default Properties dialog box       o change all new charts in the 
232. cript code  see Chapter 11  For a list of all standard PAC Control commands and their  OptoScript equivalents  see Appendix E        In this Chapter   PRINT Variables    cete mme 217  Variables in PAC Control                   ss 219  Adding Variables e  Adding Tables     Changing a Configured Variable                      229  Viewing Variables in Debug Mode                 230  Adding Commands                s    Changing a Command us  Deleting    Command      Cutting or Copying a Command                     240  Configuring a Continue Block                      241  Viewing and Printing Chart Instructions          241       About Variables    As Chapter 2 mentions  variables store pieces of information in a strategy  You create a variable for  each piece of information in your control process that must be acted upon  These pieces of  information might include the name of a chart  the on or off state of a switch  communication  parameters for a peer on the network  or a table that holds a series of numbers     Each variable has a name and a value  You assign the variables name in plain English  so you know  what it is  The variable s value is the current information it represents  As a strategy runs  the    PAC Control User s Guide 217    ABOUT VARIABLES       218    variables name remains the same  but its value may change  For example  the name of the variable  Oven  Temperature stays the same  but its value  the temperature of the oven  may change several  times while th
233. cript logical operators return an Integer 32 value of zero  false  or of non zero  true   OptoScript sup   ports the following logical operators for numeric values     Operator and Meaning Example   and Result is true if both values are true nVarl   nVar2 and nVar3   or Result is true if at least one value is tue nVarl   nVar2 or nVar3   xor Result is true if only one value is true nVarl   nVar2 xor nVar3   not invert the logical value nVarl   not nVar2     Logical operators are left associative  For exam     Any number of logical operators can be ple  these two lines are equivalent    chained together  nVarl   nVar2 and nVar3 or   nVarl   nVar2 and nVar3 and nVar4  nVar4    nVarl   nVar2 and nVar3 or nVar4  nVarl    nVar2 and nVar3  or  nVar4     The following two lines are equivalent    nVarl   not nVarl and not nVar2   nVarl    not nVarl  and  not  nVar2      The not operator precedes a value  it only takes a value on  its right hand side    nVarl   not nVar2     Logical operators can be combined with comparison operators to create complex logical expressions     nVarl    nVar2    1  and  nVar3    6 5     nVarl    nVar2    1  and  sStringl     abc      nVarl     nVar2  lt  1  and  nVar4 xor nVar5  or  not  fFloati    fFloat2     nVarl   not  nVar2  lt  5      same as   nVarl   nVar2  gt   5      When you use a logical operator in an  f statement  it isn t necessary to put the result in a variable because the  result is used  consumed  by the if   if  Motor 1 or Motor 2  th
234. ction with a specific entity   For outgoing Ethernet communication  for example  these parameters usually include the  protocol  the IP address of the device you are communicating with  and the port number used  on the device     After the initial connection is made  the communication handle is referenced during  communication with the entity  and then used to close communication     Variables in PAC Control    In PAC Control there are seven types of variables     numeric  numeric table  string  string table  pointer  pointer table    communication handle    Numeric  string  and pointer variables contain individual pieces of data  Numeric table  string table   and pointer table variables contain several pieces of related data in the form of a table   Communication handle variables contain parameters used by PAC Control for communicating with  other devices and files        Table Variables    In a table variable  the variable name represents a group of values  not just one  Table variables are  one dimensional arrays  which means that each table is like a numbered list of values  You refer to  each item in the list by its number  or index  Indexes start at 0  not at 1  Here are two table examples     PAC Control User s Guide 219    ABOUT VARIABLES       220    In a float table  values are floating point numbers                    0 82 0  1 86 1  2 85 0  3 74 8  4 72 3  5 72 7                In a string table  values are strings                    0 Maria   1 Tom   2 Siu   3 An
235. customizing the initialization files     Starting the Strategy Automatically    If you want your strategy to start automatically as soon as the strategy finishes downloading to the  controller using PAC Control Debug mode  modify the INIT TXT file as follows     1     Add the following to the end of the INITTXT file   RUN    2  Add 1 or more blank lines after the _ RUN line    This is required  it won t work without at least 1 blank line at the end of the file     If you are not using the other features of the Init txt file to initialize variables after strategy download   you can delete the rest of the content of the file     Changing a Configured Variable    You can change a variable  but you cannot change a variable  type     1     To change a configured variable  make sure the strategy or subroutine is open and in Configure  or Online mode    If you are working in a strategy  on the Strategy Tree  expand the Variables folder until you see  the name of the variable you want to change  Double click its name to open the Fdit Variable  dialog box    If you are working in a subroutine  choose Configure  gt  Variables  In the Configure Variables  dialog box  double click the name of the variable you want to change    In the Edit Variable dialog box  make the necessary changes and click OK     If you need help  see  Adding Variables  on page 221 or  Adding Tables  on page 224     You can also change a variable from the Configure Variables dialog box by double clicking the  varia
236. d  Ethernet port numbers  refer to http   www iana org assignments port numbers  See also   Opto 22 form 1940  TCP and UDP Port Assignments     If you are using the Accept Incoming Communication command to listen for communication  requests  leave out the IP address and use the following format  tcp port    For tables  each value in the table is set to the initial value  If you need to set individual table  elements to differing values intially  you can do so in the Powerup chart  If you need to use an  initialization file to set values on strategy download  contact Opto 22 Product Support     Adding Tables    See the following topics to add numeric  string  and pointer tables        Adding Table Variables     below      Setting Initial Values in Variables and Tables During Strategy Download    on page 226    Adding Table Variables    1     With the strategy or subroutine open in Configure mode  choose Configure  gt  Variables   The Configure Variables dialog box opens  listing all variables of one type in the strategy     PAC Control User   s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS       I Configure Variables    Ive   EEA v      Name    bStartFlag  dtCookieMotionTi     fDoughPressureS     fRampValue    fSetpointMinusDe       nChartStatus    nCookieMotionPre       nLoopCounter    Type    Scope    Global v       Integer 32  Down Timer  Float   Float   Float  Integer 32  Integer 32  Integer 32    Init Type  Download  Run  Persistent  Run  Run  Persistent  Run  Run    D
237. d Up One Level          File name               Files of type    PAC Control Subroutine Files    isb  v            Navigate to the directory containing the subroutine you want to add and double click the  subroutine     I Subroutine Files  Sprinkler _Control    Subroutine Filename Ref Co     C  Program Files Opto22 PAC Project 9 0 Cont                   4  When the full path to the subroutine appears in the Subroutine Files dialog box  click OK     The new subroutine appears in the Strategy Tree in the Subroutines Included folder     Adding a Subroutine Instruction    You use a subroutine just like a PAC Control command  by adding the subroutine instruction to a  block in the chart     NOTE  Subroutines are located in the Subroutine group by default  Ifyou want subroutines in a different  group  you must change the group when you configure the subroutine s parameters  See  Configuring  Subroutine Parameters  on page 350     1   2     With the strategy open in Configure mode  open the chart that will use the subroutine   Double click the block that will call the subroutine     If it is an OptoScript block  list parameters  arguments  in order within parentheses  the same  way you enter parameters for PAC Control commands  see  OptoScript Syntax  on page 327    Be sure to use the subroutine s OptoScript name  using underscores instead of spaces  The Put  Status In return value can be consumed by a variable  as shown below  such as a mathematical  expression or a control structu
238. ded   amp     Charts   amp     Variables   amp     5 1 0 Units                Quick find tool vy  dLNext  F Prev             For example  if you enter the word     setpoint     when you click Next  the first match is found     PAC Control User   s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       Cookies o DBR      C Variables   amp   C Numeric Variables   18  bStartFlag    DE diCookieMotionTimer       TMR  Match bal fDoughPress  34  fRampValue    Fu    bal fSetpointMinusD eadband    pa nChartStatus     18  nCookieMotionPreset    132  iH    eme     lt  ll  setpoint v  db Next  P Prev                      When you click Next again  the next match is found     Opening a Chart    Every control process can be planned and mapped out using one or several PAC Control flowcharts    or charts  Because flowcharts are easy to follow  PAC Control strategies are easy to understand  For an   example  let s take a look at the Dough_Chip_Control chart    1  With the Charts folder expanded  double click the Dough  Chip Control chart name on the  Strategy Tree   You can also open a chart by selecting Chart  gt  Open and navigating to the  chart name      The chart appears somewhere in the large frame of the main window     IPAC Control Basic  T  File Edit Configure Chart Subroutine Compile Mode Tools View Window Help Maximize   Dicono Josuo oo 0 52 0550 nA 5500900558026 button  Cookies      E  C3 Cookies Dough Chip_Control DER                 Control Engines     C3 Subroutines Included This chart
239. dex Value  0  lt  doctype html    html itemscope  itemscope  itemtype  http   schema org WebPa     1 02693 4004334 4004844 4004949 4005865 4005875 4006426 4006442 4006727 400705         2 mers    google startTick function  a b   google timers a   t  start google tim     3  position  absolute  top  999px  visibility  hidden  z   index 998 right 0  gbto   g     4  0 fgbg  gbm right 0  gbxms background color   ccc display block position abs     5 moz box shadow 0 2px 4px rgba 0 0 0  2   webkit box shadow 0 2px 4px rgba 0      6 4c4c4c background image none  background image none background position 0  1     7 background url   ssl gstatic com gb images b 8d5afc09 png   background url       8 bmt focus background feee cursor pointer outline 0 solid black text decorati     9 c  gbps  gbpc  gbps2 display block margin 0 20px  gbmplp gbps margin 90 10px      10  8px 20px 10px  gbmpiawi display inline block padding right 10px margin botto     11 x ipx rgba 0 0 0  1  box shadow inset 0 0 O 1px  fff 0 1px 1px rgba 0 0 0  1     12 lorStr    4787ed   border lpx solid  3079ed color  f  ff important margin 0 0   13 ge  ms linear gradient  top     5  5f5     1f1f1   background   image  o linear gradi     14 d image  ms linear gradient  top   fff   fbfbfb   background image  o linear gra                         4  oply More Info          Setting Timeouts for the HTTP Get and HTTP Post from String Table  Commands    The default timeout for transmitting  receiving  and connecting is 10 000 milli
240. dle  Counter   Digital Input   Digital Output   Down Timer Variable  Float Table   Float Variable  Frequency   Generic OptoMMP Device  Integer 32 Table  Integer 32 Variable  Integer 64 Table  Integer 64 Variable  Off Pulse   Off Totalizer   On Pulse   On Totalizer   Period          aiD oughVesselPressure  ail venT emperature    aoConveyorSpeedControl   ao0 venT emperatureControl  bStartFlag   diChipLevelS witch  diDoughLevelS witch   diEStop  dilnspectionPassF ailS witch  doChipDispenseV alve  doDoughDispenseValve  doDoughPressureControlValve  doRejeclValve  Dough Chip Control   Dough Vessel Pressure Control  dtCookieMotionT imer  fDoughPressureS etpoint  fRamp  alue   fSetpointMinusD eadband  nChartStatus       nCookieMotionPreset             8  In the Select Variable dialog box  select the variable type from the left hand column  and then  select the variable name from the right hand column     The item appears in the code     9  Use the TAB key on the keyboard as you type to indent lines as needed  To increase or decrease  indentation for a line of code you ve already typed  highlight the line and click the Increase  Indent or Decrease Indent button in the toolbar     10    Enter comments to document what the code does  so anyone who must debug or maintain    11     12     the code can clearly see your intentions   Comments appear in green  Line comments must be preceded by two slashes  for example      This is a line comment     Block comments must be preceded by one slas
241. downloading it  See page 165 for information on saving to flash     Archiving Strategies to Battery Backed RAM    Strategies are archived to battery backed RAM  which is limited to 256KB  In addition to an archived  strategy  battery backed RAM holds persistent variables and variables that are initiated on  download  If you have an unusually large strategy or large numbers of persistent variables or  variables that are initialized on download  you may not have sufficient space for an archived strategy   See page 166 for more information on archiving     Do You Use Online Mode     If you frequently use Online mode to change your strategy  you may find you are having memory  problems  When you change a chart in Online mode  a new copy of that chart is downloaded to the    PAC Control User s Guide 363    CHECKING COMMUNICATION WITH THE CONTROL ENGINE       control engine  but the old one is not deleted  After you have made a few online changes  these  additional chart copies begin to take up memory     To avoid memory problems  stop the strategy after making several online changes  Completely  compile and download the strategy  and old chart copies will be cleared from memory     Checking Communication with the Control Engine    You can test communication with the control engine by using the PAC Terminal utility   1  From the Start menu  choose Programs  gt  Opto 22  gt  PAC Project 9 2  gt  Tools  gt  PAC Terminal   The PAC Terminal window appears  showing all control engines c
242. dre  When you define a table  you must specify its length  which is how many values the table can store   The length of a table is NOT the value of the last index  Since indexes start at 0  a table with a length    of 100 contains indexes 0 through 99  Table length is limited only by the amount of memory in the  control engine   For more information on the available memory  see  If You Have Memory Problems  on page 363           Numeric tables store either integer values or floating point numbers  but not both in the same  table   String tables store strings  Because pointers can point to any data type  for example  an I O  point  a chart  or even another table   pointer tables can store an assortment of data types     Persistent Data    Most variables can be either global or persistent in scope  Global variables are set to an initial value   which you specify during configuration  either whenever the strategy is run or whenever it is  downloaded     Persistent variables  however  are initialized only when the strategy is first downloaded  Numeric  variables  and tables  are initially set to 0  String variables  and tables   pointer variables  and tables    and communication handles are initialized as blank  or empty  The key point about a persistent  variable is that its value is saved in the controller s memory  it does not get initialized when the  strategy is run  stopped  or started  and it does not get initialized if the strategy is modified and  downloaded again  A per
243. ds                 0000 cece cece eee ees 276  Retieving    Webpage   cunei etie Pre UG MIR ne donne iaaerten aad 276  Setting Timeouts for the HTTP Get and HTTP Post from String Table Commands   279  CONWUOKENGING COMM INA Sadana aA SUR MN usd bed dM RH 280  Commands Relating to Permanent Storage          ssssssssssssssse 280  Digital Point Commands           066 ccc ccc cence I e ens 281  States  Latches  and Counters   0    0  cece cece eee ees 281  ALC MOS SMEs 282  COUNTERS  EE LUDUM 282  Quadrature COUNTES re cysteines iesi E E E dud add MN upatU RUM US 283  atalizetS   2s cerbesccterete sisti tesexequa E om coe pda tesi sterben ds 283  PUlSgS cuv EO ARR DERE RE URL ES EVE e LH S eens Bes 283  WALANG XVAL MTM 284  Simulation and Test  The  Real  Use for XVAL and IVAL                  000 002 eee 284  Additional Commands to Use with Standard Digital Points                        0005 284  Standard Digital Points and OptoScript Code              ssssssssssssssssssssesse 285  Reading or Writing Digital Points            0    e 285  Error Handling Corimards    deu er dut aa vas Past vb tea ehe ti du e Glendive 286  IO Enabler Sample Strategies            sssssssssssssssssss 286     O  Unit Cor  miarids   i a ceo ent nee ex REI Re tbt exec rebates a Pobre 287  Commands Tor Ethernet Link Redundancy 4er eed EE PER EA e Reden 287  Table COMMANGS sac ced cone verteret e bed ra ttti trol erecta Urea 288   I O Unit    Event Message Commands       cssssssssssssssssssseee e emen 289
244. ds     With a Watchdog  the I O unit monitors activity on the port  If no communication is received for the  specified interval  the unit assumes a Watchdog state  All selected outputs will then immediately go  to a specified value  as configured in the Watchdog field of the Add Analog Point or Add Digital  Point dialog boxes   See  Adding I O Points  on page 122      K   Maximum Analog and High Density Digital Scantime   Ethernet based   O units  only  You can decrease the analog and high density digital scan time to make sure the scanner isn t  slowed or stopped by heavy communication on the network  The Default is 1000 msec  This feature  is also available in PAC Manager where you can fine tune the scan time on the fly     NOTE  Digital Scantime applies only to non PAC I O units  PAC I O units use Digital Feature Resolution  Value instead     PAC Control User   s Guide    Go    CHAPTER 6  WORKING WITH I O       See form 1704  the PAC Manager User s Guide  For more information on optimizing scanner  performance  see  Optimizing Throughput  on page 87 in this guide     Changing the Baud Rate for Serial I O Units    NOTE  This section is for PAC Control Basic users  If you have the Pro version  see    Changing the Baud Rate  and Mode for Serial I O Units  on page 119     If the default baud rate shown in the Add I O Unit dialog box not correct  you can change it  This  baud rate is for communication through the RS 485 port to serial I O units  It does not affect other  serial
245. e       Using Ethernet Link Redundancy in PAC Control        0 0    cece cence cece eee e eee e teen eens 94                System Architecture for Ethernet Link Redundancy           0  ccscceeeeeeneneeeeeees 95  Example 1  Ethernet Link Redundancy              200 cceeeeeeeee eee teen teens 95  Example 2  Ethernet Link  Computer  and Software Redundancy                05  96  Example 3  Ethernet Link Redundancy with Serial I O Units                    005  97  Configuring Ethernet Link Redundancy        sss 98  Using Strategies with Link Redundancy           0 00    cece cece e cece eens 99  Using Redundant Controllers         cessere eere ehe mee erem ee bees 99  Changing or Deleting a Control Engine          0 0    ccc cece ccc cence tence een eee e nes 99  Changing a Control Engine s Definition             sss 99  Changing the Control Engine that Receives the Downloaded Strategy                  00  Removing a Control Engine s Association with a Strategy              ssssssssssssusn 00  Deleting a Control Erigine Tom Your PC oscar rr EE UTR E pO ENN Ei a 00  Inspecting Control Engines and the Queue          ssisssssssssssssssssss 01  Inspecting Control Engines in Debug Mode            ssssssssssssssss 01  Viewing the Message QUEUE  c  5   ia1 cis cane oh terrere Rb ER et RUE ceded 03  Mecsas Queue information  o  xiasteovadoveieincs vissuti pissed ei EENS Belin 05  Inspecting Control Engines from the PAC Terminal Utility                          25  06  Archiving Strategi
246. e     Find Next    Replace    Replace All    Close    Name        Find what  All Valid Types    aiDoughVesselPressure          Replace with  All Valid Types       aiDoughVesselPressure             Or  if the item you want to find is listed in the strategy tree  such as a variable  table  or point   right click the item and select Replace in the pop up menu     z    Points      TH diDoughL evelSwitch  Point name        x  diChipLevelS witch MEME    uu dilnspectionPassF  w diEStop   in doD oughPressure  ic doD oughDispense  we doChipDispenseV     Modify     Configure     Delete    Find          The item appears in the Find and Replace dialog box automatically     I Find and Replace    Search Scope       Global  OLocak Alarm    Search For       Operand  O Instruction    O Tag    Type     Find Next  Replace    Replace All    Close    Name        Find what  Digital Input    v    dChiLevelSwich          Replace with    All Valid Types           x   ai16_P    Point name    2  Under Search Scope  to search the entire strategy  click Global  To search one chart only  click  Local and choose the chart name from the drop down list     If you are searching a subroutine  the search is Local and the subroutine   s name is shown     3  Under Search For  choose one of the following     PAC Control User s Guide 195    LEGACY OPTIONS        To search for a chart  an I O unit or point  or a variable  click Operand  In the Find Type and  Name fields  choose the operand you want to replace from t
247. e  see page 101                     Total memory  RAM  32 MB 16 MB  Memory used for control 32 MB 10 MB  Memory available for strategy and variables 16 MB 5 MB  Total battery backed RAM 8 MB 2 MB  Battery backed RAM for control  8 MB 1 MB                     Stores persistent variables  variables initialized on download  autorun flag  and strategy  archive  Note that strategies are not automatically saved in battery backed RAM  Save your  strategy to flash memory so it will be available if power is lost to the control engine  See     Saving a Strategy to Flash    on page 165     In general  if you experience memory problems  you can reduce the amount of memory needed by  checking strings and tables for lengths and widths that are longer than necessary     If you are using subroutines  use the minimum number of variables and size of tables that the  process requires  Also  less memory is used if only one chart in the strategy calls subroutines than if  multiple charts call subroutines     Since the battery backed RAM contains variables initialized on download  if you have a large  number of these on a smaller controller  you can run out of persistent RAM  To avoid this problem   use as few persistent variables as possible and initialize all other variables on strategy run     Although you can archive the strategy  the currently running strategy is not stored in battery backed  RAM  To make sure the strategy will run after a power loss  save the strategy to flash memory after  
248. e 77     Using Numeric Literals    Here are examples of how to use numeric literals in OptoScript  Formats are automatically converted  if they don t match the variable type  For example  if a value of 300 2 were assigned to an integer 32   the value would be converted to 300     Decimal Integer 64 Literals assigned to variables  Inte   ger 64s have an i64 at the end    dVariablel   0164    dVariable2   10164     Decimal Integer 32 Literals assigned to variables   nVariablel   0    nVariable2   10    nVariable3    123     dVariable3    123i64   Hexadecimal Integer 32 Literals assigned to variables   Hex notation starts with Ox  Digits A F Hexadecimal Integer 64 Literals assigned  may be upper or lower case  to variables   nVariablel   0x0  dVariablel   0x0i64   nVariable2   0x10  dVariable2   0x101i64   nVariable3   0x12AB34CD  dVariable3   0x1234567890ABCDEFi64     nVariable3   0x12ab34cd     Float Literals assigned to variables  Float literals may use scientific notation    fVariablel   0 0   fVariable2   12 3        fVariable3    123 456   fVariable3    1 23456e2   fVariable3    12345 6e 2     Making Assignments to Numeric Variables    Values are easily assigned to variables     Simple Integer 32 assignments  Simple Integer 64 assignments   nl   1  nnl   2164   n2   n1  nn2   nn1     Simple assignments between different data types    Simple Float assignments   Types will be automatically converted to match      t     nl   4 0   j nnl   nl   fl   n1     PAC Control User s G
249. e BASIC column is based on Microsoft s Visual Basic language    2   he Pascal column is based on Borland s ObjectPascal language     3  The use of logical statements in BASIC and Pascal is significantly different than in OptoScript  and C  BASIC and Pascal have a Boolean data type  OptoScript and C use integers  OptoScript  and C treat a zero value as false and a non zero value as true     4   n OptoScript  you cannot use a break type of command in a loop   OptoScript can test only one case in a switch at a time  other languages can test more than one     PAC Control User s Guide 387    OPTOSCRIPT COMPARISON WITH STANDARD PROGRAMMING LANGUAGES          y      ols     V     ols      o s   u    e qeje e JON     V     ols     fo s   u    suayoereyo Buys           shs     l Lhs         shs     l L  s Adouys     gs    1  Ls      shs    1 1hs          olay      ys     olay    s Adoas    Olay     Ls    Olley     Lis juswubisse ejqej Buys     s     ohs     s  Lolis Adoas s    0 is    s    ols   l    ZS   S     Zs  sydogs zs s    7S  S jueuiuBisse Buns   Oll9u     S     olay    S Adouys  Ollgu    S    Olay    S           z    A   x     u     ph     Z    A   x     u    ph     z  4  x     u    p         Z    A   x     u    ph    suoisseJdxe oueuinu                                                 Teh    02 3       Teh    02 3      eh    02 3        Teh    02 3          e    h          h     i  m                z    h    7    m z   1     T   Ih   juswubisse ejqey oueunu      L     oh    L
250. e Control Output SNAP AOV 27   10 to  10 VDC    0 100   SY 104 Conveyor Speed Control Output SNAP AOV 27   10 to  10 VDC  0 100   Digital I O  0 Closed  SV 100A Pressure Control Valve Output SNAP ODC5SRC  5 60 VDC  1 Open    0 Closed  SV 100B Dough Dispense Valve Output SNAP ODC5SRC  5 60 VDC  1 Open  0 OK  LAL 100 Dough Level Alarm Input SNAP IDC5D  2 5 28 VDC  qin  SV 101 Chip Dispense Valve Output   SNAP ODCS5SRC  5 60 VDC  foe    0 OK  LAL 101 Chip Level Alarm Input SNAP IDC5D  2 5 28 VDC  PE Wan      0 OK  XS 103 Inspection Signal Input SNAP IDC5D  2 5 28 VDC  1 Reject    0 Closed  SV 103 Reject Valve Output SNAP ODC5SRC  5 60 VDC  1 Open  0 Stop  XS 105 Emergency Stop Input SNAP IDC5D  2 5 28 VDC  1 0K  385    PAC Control User s Guide    REQUIRED I O       386 PAC Control User   s Guide       E  OptoScript Language  Reference    Introduction  This appendix includes the following reference information about the OptoScript language   OptoScript Comparison with Standard Programming Languages              387  Notes to Experienced Programie Sneen einan i na ea 392  OO SoT OL Lexical RETENE   ae ssccds teer danawdeuanedaietanadss Rd dp 394  OptoScript Grammar Syntax Reference    397    OptoScript Comparison with Standard Programming  Languages    The tables on the following pages compare OptoScript functions and variables to those available in  Pascal  BASIC  and C  For more information on using OptoScript  see  11  Using OptoScript     on  page 317    General Notes    1  Th
251. e Edi hee dalidacotehetaateueds    Running a Strategy Automatically  Autorun       s s s cece t teen ees  Protecting a Running Strategy   sie vss Sa sete tdem vue argue quam eds d   QR e qM as    STOPPING  a Strategy coke eese doble rote epe Debe U kon E PON ERE Gega    DEBUGGING ERE TETTE  Choosing Debudg beVel   ri acp ee eter eng vr pere picked ud  Changing Debugger Speed os cou poene dresse qr Rr hee y Putas pr ehe rep rn  Pausinig a Chart orSubrOUtlnie        od v pei tua ve E Net e eti dit t s  Stepping Through a Chart or Subroutine            sss   Single Stepping   ode be a Meet pe quadr due d EK E ade e da  AUEOISEEDDIBIO E EE ntes etse ted duet ed Hte m RE Dmm E  Setting and Removing Breakpoints            0    c cece cece cence cen eee n eee e ene  Managing Multiple Breakpoints            0    0c cece eee eect eee e eee nnn e ees  Interpreting Elapsed TIMES  ii os ius tete des deren trn ey poke rp ER PARE PI qr QS    VIEWING ANG Priritifig    2n iie IR ER Oeo eee be e eeu yeild ER den  Viewing Strategy Filename and Path                00 ccc cece eect se  Viewing an Individual Chart or Subroutine           00 0    cece eect cence eee  Viewing All Chartsin a Strategy se   crxdcandsrardgaresanad rags chr rer RE ORI bee  Printing Chart or Subroutine Graphics       0    ccc cece cece e   Sewing Up the Page sies enia a eA M Lt A tes accel iri  Previewing a Flowchart Printout           ssessssssssssssss ence nee eee  Printing One Chart or Subroutine       ccc cece cee er
252. e OptoMMP Protocol Guide        e For details on using the Scratch Pad for peer to peer communication with a controller  see the  controller s user s guide     The following page shows a simple example of how Scratch Pad area data exchange would work  between two SNAP R series I O systems     Create two tables for PAC  R  A  one for its own data that will be shared  A Shared  Data  and  another for data it will read from PAC_R_B  B Data   Also create two tables for PAC  R  B  one for its  own data  B  Shared  Data  and one for PAC_R_A   s data  A  Data      PAC Control User s Guide 291    I O UNIT   SCRATCH PAD COMMANDS       292    Suppose PAC_R_A and PAC_R_B are sharing 600 integer elements  of the 10 240 integer elements available in the Scratch Pad                                                                                  PAC_R_A writes data from its PAC Control Tables  Memory Map Scratch Pad   own PAC Control strategy  table to its own Scratch Pad A_Shared_Data Integer elements        indexes 0 599  0 599 ac  area  which SPAC_R_B can  B_Data Y  then read     amp   Meanwhile  PAC_R_B writes PAC Control Tables  Memory Map Scratch Pad   data from its B  Shared  Data AD      Data  table to its Scratch Pad area  B Shared Data Integer elements   8  which PAC_R_A reads   indexes 0 599  0 599    G   amp                 NOTE  When the SNAP R series I O unit is writing  to its own Scratch Pad  use the loopback IP  address  127 0 0 1    This portion of the flowchart in PAC_R_
253. e chart or subroutine  open its window   2  Fromthe Chart or Subroutine menu  select Print Graphics   3  In the standard Windows Print dialog box  do one of the following       To print to a printer  select the printer  page range  and number of copies  Click OK         o print to a file  select Print to file and click OK  In the dialog box  enter the file name and  location     Your chart or subroutine is printed     186 PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Printing All Charts in a Strategy    CAUTION  You can print all charts included in a strategy  but be sure that   s what you want to do before  you begin  You cannot cancel once printing has started     1     2     To print all charts within a strategy  open the strategy and check the page setup   For help  see    Setting Up the Page    on page 184   Select File  gt  Print All Graphics     Printing begins immediately  no Print dialog box appears  Messages inform you of each chart s  printing progress  To skip printing a particular chart  click Cancel when its message appears     Viewing and Printing Strategy or Subroutine Commands    You must be in Configure mode to view and print commands     1     To view all commands  instructions  in a chart or subroutine  open its window and select  View Print Instructions from the Chart or Subroutine menu  Choose whether to sort  instructions by block name or block ID number     To view all instructions in an entire strategy  select File  gt  View Pri
254. e chr 13  chr 10  combination each time  For a double  carriage return   linefeed combination  use CRLF CRLF     NOTE  If multiple emails with the similar subject and body text are sent through the same email  account  the emails may be flagged as SPAM by the email service provider and not be delivered  To    PAC Control User s Guide 273    COMMUNICATION COMMANDS          avoid this  you may need to add code to the subject and body text that changes the text dynamically  with each new email        CRLF chr  13  chr  10    For convenience  arrstrServer 0     myaccount speedmail com      User Account   arrstrServer 1     mypassword      Password   arrstrServer 2     smtp speedmail com      Server   arrstrServer 3     587      Port    arrstrServer  4     tls   JI  ssl    mpg    none   arrstrRecipients 0     xyz mymail com      Recipient list  arrstrRecipients 1     abc yourmail com     arrstrRecipients 2          This blank ends the recipient list  arrstrRecipients 3     johndoe hismail com     This recipient will be ignored  arrstrBody  0     Opto Email Example      Subject line   arrstrBody  1     Hello  4 CRLF     Body starts here   arrstrBody  2    CREB     Could have been combined above    arrstrBody  3   arrstrBody  4   arrstrBody  5   arrstrBody  9   arrstrBody  10   arrstrBody  11   arrstrBody  12     arrstrAttach 0   arrstrAttach 1   arrstrAttach  2   arrstrAttach  3   arrstrAttach  4         nj     This is an example of an email that can be sent from a PAC      control
255. e data  click the Print button on the toolbar  To save it to a text file  click the Save  button  To search the data  click the Search button  When finished  close the window     Viewing and Printing a Cross Reference    You can view and print a report of every operand in your strategy or subroutine   charts  I O units    analog points  digital points  communication handles  numeric variables  string variables  pointer   variables  numeric tables  string tables  and pointer tables  The operands are cross referenced to the   charts  blocks  and instructions in which they are used    1  To produce a cross reference for a strategy  open it and select File  gt  View Print  gt  Cross  Reference    2  To view a similar report for a subroutine  open the subroutine window and select Subroutine  gt   View Print  gt  Cross Reference     PAC Control processes the data and puts it in the Cross Reference window     PAC Control User s Guide 189    VIEWING AND PRINTING          TITLE  Strategy Cross References  STRATEGY  Unit 3 Monitoring  DATE  10 05 06 TIME  14 47 20    Interrupt   Not referenced     Morning  Chart Referenced Block Referenced Instruction    Powerup Start Charts Start Chart         Powerup   Not referenced     ANALOG POINTS    Refrigeration   Chart Referenced Block Referenced Instruction  Morning Check refrigeration Line  3  Morning Check refrigeration Line  11  Morning Check refrigeration Line  11       You may need to resize the window and use the scroll bar to see all t
256. e do not match  a new persistent variable is created   New persistent variables are initialized to zero and new persistent strings are initialized to NULL   empty  strings            O unit configurations are compared  If the I O unit configurations match  I O will not be  initialized    e     The Powerup chart is called    See also   Background Downloading  on page 170     Compiling without Downloading    Sometimes you may want to compile without downloading  just to see if a chart  subroutine  or  strategy compiles correctly  You can compile the active chart or subroutine only  just the changes  you have made to the strategy  or the entire strategy     Compiling the Active Chart or Subroutine    Whenever a chart or subroutine window is open and active  you can compile just that chart or  subroutine  To do so  in Configure mode  click the Compile Active View button   on the toolbar  or  choose Compile  gt  Compile the Active Chart  The menu option shows the name of the chart or  subroutine you are compiling     As soon as you choose the menu option  the chart or subroutine is saved and compiled  You are  alerted only if errors are found     Compiling Changes Only    To compile just the changes since the strategy was last compiled  choose Compile  gt  Compile  Changes  The menu option shows the name of the strategy you are compiling     As soon as you choose the menu option  the strategy and all modified charts and subroutines are  saved and compiled  You are alerted only if 
257. e finished sending and receiving  data  use the command Close Communication to close the communication handle     Make sure your strategy receives data promptly  Incoming serial communication is buffered up to  127 characters  If more than 127 characters come in before the strategy receives them  the  additional characters are lost     See the PAC Control Command Reference or online Help for details on using specific commands     Sending an Email   Use the email commands to have a strategy send an email automatically from your control engine  to recipients via SMTP      Send Email sends a text only email       Send Email with Attachments sends text and one or more attached files such as log files   status reports  and images     The following examples are but a few of the many possible uses for these commands   e   Send out updates of a system s status     e  Havea critical system send hourly status emails  if no email arrives after an hour  it means  something is wrong       Send an email in case of an alarm condition     e Senda daily status report     PAC Control User s Guide 269    COMMUNICATION COMMANDS       270    For more information on these commands  see form 1701  the PAC Control Command Reference  An  example strategy is available for free on the Opto 22 website  www Opto22 com  Go to the product  page for the PAC Project Software Suite and click the Downloads tab  Also see forms 1700 and 1701     Before you begin     e Make sure to assign to the controller an IP 
258. e finished sending data  use the command Close Communication to close the  communication handle           If you are sending a large file from the control engine to the device  you would need to open up two  communication handles  an FTP handle just like the one in the example above  and a File handle for  the file on the control engine  Then use the Transfer N Characters command to send the file in  chunks    For another example  see the diagram in    A More Complex Example  on page 260  which shows  how FTP communication handles and file communication handles might be used together  See the  PAC Control Command Reference or online Help for detailed information on commands     Retrieving a Directory Listing    The OptoScript code in this example makes use of the command Set Communication Handle Value  and the dir option to retrieve a directory listing           Sets the value for the  communication handle  chAFile           Configure the chFTP comm handle to log into itself  The username and     password don t matter  they just can t be left empty  We ll use the     loopback address of 127 0 0 1 so this code is more portable   SetCommunicationHandleValue  ftp 127 0 0 1 21 noimporta whocares   chFTP             PAC Control User s Guide       COMMUNICATION COMMANDS          Opens the communication  handle and checks to make  sure it opened        Open the communication handle  log in to the local server   nStatus   OpenOutgoingCommunication  chFTP     if  nStatus    0  then   
259. e numbers used in this example  These are numbers represented as strings  For the  purpose of storing and sending data  this is the simplest way to represent them  If you need to  use them in calculations  however  you must first convert them to numeric values  You can do  so in your PAC Control strategy by using a command such as Convert String to Float or Convert  String to Integer 32   See  String Commands    on page 306 for more information      5  It might also be helpful to use the command Send Communication Handle Command which  provides the following commands that you can use when accessing files     find  locates data in the file if each line has a unique identifier   getpos returns an integer that indicates the current position in the file   setpos  lt position gt  jumps to the specified position within the file     find  lt mystring gt   strings only  searches for the string within the file and returns its location as  an offset from the current position in the file  The file must have been opened in r  read  mode      6  Finally  close the communication handle by using the command Close Communication     A More Complex Example  Here s a more complex example which shows the actual  OptoScript code  In this example  someone on the network needs the value of several variables in  the PAC Control strategy running on the control engine  This person has sent to the control engine  via FTP a comma delimited text file  ProductRequest txt  containing the names of the varia
260. e opens in a text editor  Logging is turned off when you open the file   View or edit the file as needed  and then close it    You return to the PAC Message Viewer window    To resume logging  choose File  gt  Log to File     PAC Control User s Guide 367    OTHER TROUBLESHOOTING TOOLS       368    7  Torename the log file or change its location  choose File  gt  Select Log File  Navigate to the  location where you want to save the file and enter a name  Click OK     8  When you have finished monitoring communication  close the PAC Message Viewer window     If you leave it open  it will normally appear on top of other running programs  If you don t want  it to appear on top of other programs  choose View  gt  Always on Top to toggle that option     Checking File Versions for Opto 22 Software    Sometimes problems may be caused by older or misplaced files  Product Support may ask you to  run OptoVersion to check the versions and paths of your Opto 22  dll and  exe files  Here s how     1  From the Start menu  choose Programs  gt  Opto 22  gt  PAC Project 9 2  gt  Tools  gt  OptoVersion       OptoVersion Utility     Fie  Version   OptoVersion_  Date   Location          Click Find to search for Opto 22 files on your hard drives     Help   Save As          2  In the OptoVersion window  click Find    The utility searches your hard drive and prints a list of Opto related files found    3  Tosee more information on any file  double click its name  To sort the list in a different orde
261. e strategy is running     To illustrate variables  suppose you are regulating the amount of water in a tank  You must keep the  tank filled beyond a minimum level  but you cannot let it get too full     You ve already configured the I O points  Cc    Level_Meter is an analog input point that registers Level_    o  the quantity of water in the tank Meter Pump  1  q y    Tank         Pump  1isa digital output point that turns the pump  on or off       Drain 1isa digital output point that opens or closes  the drain  Drain  1    Next  you configure variables as places to hold information  that these I O points must work with     e  loavoid constantly polling Level  Meter to find out the quantity of water in the tank  you create  a variable called Tank  Level  Reading in which to store the level  The input point Level Meter is  periodically checked and the value of Tank Level  Reading updated     e To establish the maximum and minimum levels  you create variables called Tank Max Level  and Tank Min  Level  The value in Tank Level  Reading can be compared to the values in these  two variables to determine whether the pump should be turned on or off  or the drain opened  or closed  to maintain the proper level   You could create constant values  called  iterals  for the  minimum and maximum levels  but creating them as variables lets you change their values in  Debug mode     Types of Data in a Variable    A variable stores one of six types of data  floating point  integer  timer  s
262. e strategy is stopped and then run again   either through the debugger or autorun  It also retains its value if power is cycled  Note that this  choice means the variable is stored in battery backed RAM  which is limited in size  To keep a  variable s current value through both power cycles and strategy download  make the variable a  persistent variable  see the Persistent option below and    Persistent Data    on page 220   See    If You  Have Memory Problems    on page 363     Persistent  Data in the variable will be persistent  Pointer variables and timers cannot be persistent   For more information  see    Persistent Data    on page 220     The following table shows how your choices about variable initialization and persistence affect what  happens to variables  applies to all variables and tables except up timers and down timers               variable infiialiesd on Set to initial value Set to initial value Set to initial value  strategy run  default    Venable initialized on Retains current value Retains current value   Set to initial value  strategy download   Persistent variable Retains current value Retains current value   Retains current value                      F   Initial Value   For all variables except pointers  up timers  and down timers  Enter the value to  which the variable is to be set initially  You can use either decimal or hexadecimal form  If you leave  this field blank  the initial value is set to zero      For pointer variables only  When you have s
263. e that if you use the Move command  any value you set using Set Down Timer Preset Value is  overwritten  and subsequent Start Timer commands start the timer from the value last sent by the  Move command     To determine if the timer is finished  use the condition Down Timer Expired  This condition is true  any time the down timer has a value of zero  Down Timer Expired  is much faster than using the  condition Equal  to compare the timer to a value of zero     The Stop Timer command forces the timer to stop and puts its value at zero  If you want to halt the  timer and have it maintain its value at the time it was stopped  use the Pause Timer command  instead  When you use Pause Timer  you can move the timer s value at the time it was stopped to a  variable  You can also use the Continue Timer command to resume the timer where it left off     Up Timer Operation    The Set Up Timer Target Value command sets the time for the Up Timer Target Time Reached   condition  It does not start the timer  however  and the timer does not stop when it reaches the  target value  You must start the up timer from zero by using the Start Timer command     If you use the Move command to move a value to an up timer  the value you moved becomes the  target value and the up timer starts timing immediately   Note that the timer does not start from the  value you moved  it always starts at zero      The up timer does not stop when it reaches the target value  To determine if the timer has reached  it
264. e the Windows Classic  theme  Otherwise  a Microsoft bug with how themes are handled may cause the system to crash     PAC Control User   s Guide    CHAPTER 1  WELCOME TO PAC CONTROL       If you have trouble installing PAC Control  contact Opto 22 Product Support at 800 835 6786 or  951 695 3080     System Requirements    Installation Requirements    Heres what you need to install and run PAC Control  If you are using PAC Display  please note its    requirements in the PAC Display User s Guide     e A computer with at least the minimum processor and memory required for your version of  Microsoft Windows  and Fthernet capability  Additional memory may be required for some  configurations       VGA or higher resolution monitor  Super VGA recommended   Minimum size  800x600 with  small fonts     e   Mouse or other pointing device  e Installed Windows printer  optional   e Microsoft Windows 8 1 Pro  32 bit or 64 bit   Windows 7 Professional  32 bit or 64 bit      Windows Vista   Business  32 bit   or Windows XP Professional  32 bit  with Service Pack 2 or    higher   Windows Server 2008 R2  OptoOPCServer and OptoDataLink only      NOTE  Other versions of Microsoft Windows server and embedded Windows operating systems are  not supported  In addition  Windows Server 2008 is the only Windows Server version supported and  it is only supported by OptoOPC Server and OptoDataLink     e  Foravailable hard disk requirements  please see the PAC Project Release Notes  e Compatible control 
265. e way to the front        Send Backward   moves the element one position closer to the back       Send To Back   moves it all the way to the back     Cutting  Copying  and Pasting Elements    You can cut  copy  and paste most chart or subroutine elements  Cut or copied elements are placed  on the Windows Clipboard  and they can be pasted in the same chart or subroutine  in a different  chart or subroutine  or in a different strategy     A connection can be cut or copied  but it cannot be pasted unless its original source and destination  blocks have also been pasted  Block 0 cannot be cut     1   2     With the chart open and the strategy in Configure or Online mode  click the Select tool is    To cut or copy element s   click them  Press CTRL X to cut or CTRL C to copy    You can also select the element s  and then choose Edit  gt  Cut or Edit  gt  Copy  or click the right  mouse button and choose Cut or Copy from the pop up menu    To paste blocks  press CTRL Y  select Edit  gt  Paste  or right click anywhere on a chart and select  Paste from the pop up menu    Text blocks are pasted immediately  For action  condition  or continue blocks  a message  appears asking if you want to keep the original name of the block being pasted    If you paste to a different strategy or to a subroutine  PAC Control checks the referenced  variables to make sure they match  Variables that do not exist are created  Variables that exist    but are different    for example  a table with the same 
266. ece teen eee eee teens 328  Variable Name CONVENTIONS iori uere ee tee emis T Ds raices adis 329  Using Numeric Literals          sssssssssssssssssss I n nets n eens 329  Making Assignments to Numeric Variables            00 000 cece cece teen eee e eee e es 329  USINO STNO S E MT 330  Working With  POIDIERIS  eb eriste i i aa E E mr EEE AE ETRE 331  Using the     amp     Character to Point to a Tag s Address cari obese edocet ege in 331   Using the   amp     Character To Move a Pointer    331   Using the    Character To Desretererice a Pointer  seis secre rere eer 331   Using the Comparison Operator        00    eect eee eee 332  Determining Which Variable To Use          ssssssssssssssssss e 332   FOr MOE INFOFMALON cese eee vore et RE NR ES I TUNRIMUPUHKR REESE ES 332  Working with  Tables  ore eoe DERE UTR UOT ERSTE Ra Uds 333  OptoScript Expressions and Operators          0 2 0 0 cece eect eee e eee eees 333  Using  Mathematical EXPressiONs  terri nyers Depot RE RD bade ire DI E ERES 334  USING  CorparisonmyjOpelid EOS Qva cm eie ar Re ers d a ve endis digo eoa duda 334  Using Logical Operators 4  rent bte Re guia atienden er vede 335  Using Bitwise Operators 2 2    ccc I nne 336  Precedente   acetate Da ndhdd dave                            T 336  OptoScript Control Str  ctUres          oe rete bb geb UO pee benda e tee 336  jeu T LULA 337  Switch Or Case Statements   s cb vocero doter p DURER RH PORC ESED NiS 337  WhilgEQODS   138 eteies tte vo rti tes dit tede eb der 
267. ed into subroutines can take several types  Using a string literal  you can pass in either a string  literal or a string variable  Using a numeric literal  you can pass in an analog point  a digital point  an  integer variable  a float variable  or a timer variable  If you are familiar with other programming  languages  literals are similar to  passed by value  parameters  while variables are like  passed by  reference  parameters     This flexibility in using literals makes it easier to use a subroutine in multiple strategies  For example   a literal passed into a subroutine from two strategies might be a float value in one strategy and an  analog point in the other     Creating Subroutines    348    Tips for Subroutines    As a general rule  keep subroutines as small as possible to do the job they re intended for  Extra  variables and unnecessarily large table sizes can affect the memory available for running  subroutines     PAC Control User s Guide    CHAPTER 12  USING SUBROUTINES       A Put Status In parameter appears automatically in every subroutine  This parameter is used to let  you know whether the subroutine was called successfully  in the same way that function commands  return a status  Make sure that you always check the status code after calling a subroutine   Subroutine status codes are        0 Success        67   Out of memory        69 Null object error  Make sure you are not passing a pointer that points to null        Invalid subroutine or parameters  In
268. ed variables   a notable difference from common  procedural languages  Variables are not declared in the programming code  but in the PAC Control  tag database  This is a basic concept of PAC Control and how it ties in with PAC Display  but may  seem odd to experienced programmers using PAC Control for the first time  Also  all variables and  objects are global  Local variables do not exist in PAC Control in the way they do in most procedural  languages  Subroutines in PAC Control contain    local    variables  but those local variables apply  throughout that subroutine     Most languages allow you to return from a function before it ends  but OptoScript does not  The  same effect can be achieved in other ways  however  such as introducing tests into the code   Some  people argue that this limitation produces better programming  because each function has only  one exit point      PAC Control s Target Audience    Because PAC Control is based on OptoControl  which was conceived as a simple programming tool  for non programmers  it is designed to be relatively foolproof  Even though OptoScript provides  advanced functionality  this philosophy also influenced the design of OptoScript  OptoScript exists  only inside OptoScript blocks  which can only exist inside a flowchart  Flowcharts are the basis of  PAC Control     Even an experienced programmer may want to think twice before using OptoScript blocks  extensively  Many programmers like PAC Control s simplicity not for themselve
269. egral at 0 1   and no derivative constant  The  arrow shows when a derivative  constant of 10 was applied  The  right side of the plot shows how  the derivative constant is keeping  the input closer to setpoint              3   TemperatureControl    View PID Loop  scanning     Name    TemperatureControl Error    None    Input  90 02628   Gain   30  Tunel   0 1    Tune D  10    ScanRate  1 4   Mode  Auto  Enable comm  Ye        Setpoint    90 Scan Counts    61281    Dutput  66 71089    Plot 1 0 Details   Misc  Details   IVAL   Velocity Algorithm  Type B        90 50      int  30 00 Output    100    Data  gt     InputAsxis  gt     Dutput Axis    Time Axis  gt        11  Click Save Tuning to save your tuning parameters to the strategy database     Changes are lost unless you save them  You may wish to save your tuning parameters when    you see any improvement in performance  even if they are not final     PAC Control Professional       The Following values will be saved to the strategy database     Gain   5 000000  Tune I  10 000000  Tune D  200 000000  Scan rate  3 000000  Feed Forward  0  000000  Feed forward gain  0 000000  Output min change  D  000000  Output max change  0  000000  Output when input is under range  0  000000  Output when input is over range  0  000000    Saving these values to the strategy will require the strategy  to be compiled and downloaded before entering debug mode again     Do you want to continue     12  Click Yes     Values are saved to the PAC Co
270. elected the Pointer to Type  the drop down list in this  field shows all the valid objects for that type that are currently defined in your strategy  Choose one  or leave the initial value as NULL  A NULL value means that the pointer is created but does not  initially point to anything     PAC Control User s Guide 223    ADDING TABLES        For communication handles only  Enter a string containing communication parameters in the  correct format for the type of communication handle you are using  The type  for example  tcp   ftp  file  must be in lowercase letters  and parameters are separated by colons and commas  according to the format required  See    Communication Commands  on page 247 for information  and examples     If you are talking to a serial module  use the IP address of the brain the module is attached to   and use the serial modules port number according to its position on the rack  for example   tcp 10 192 55 185 22502  For port numbers  see  Establishing an Ethernet Connection    in form  1191  the SNAP Serial Communication Module Users Guide  See also  form 1940  TCP and UDP Port  Assignments     If you are talking to another SNAP PAC brain  be aware of port numbers that are reserved for a  specific protocol  For more information  see form 1940  TCP and UDP Port Assignments     For other peers on the Ethernet network  be aware of port numbers they may use for specific  purposes  Ports 22000 and 22001 are reserved for the control engine  For a list of standar
271. election tools are always available     Configuration Mode       Debug Mode       Online Mode                Configure Mode and Online Mode Toolbar    The following toolbar appears in configure mode and online mode     D dW  sEa BK MA a E  O O O D   t A B Compile view H compile Al    In a smaller window  the toolbar looks like this     Quuxae amp xH4usatucsxmooem5musugoo   t                                              3 New Strategy em Pan Tool   SF Open Strategy oO Action Block Tool   ld Save Strategy C OptoScript Block Tool      Cut Qo Condition Block Tool   ga Copy e   Continue Block Tool   B Paste B Checkpoint Block Tool  Delete t Connect Tool      Find   Text Tool   Mo Find and Replace  amp  Compile Active View                      PAC Control User   s Guide    CHAPTER 3  WHAT IS PAC CONTROL           l   Select Tool Compile All          Debug Mode Toolbar    The following toolbar appears in debug mode     B   Run Strategy  Stop Strategy        Pause Chart  4 Into  P Over  P Out   Autostep lj Breakpoint       In a smaller window  the debug toolbar looks like this      gt  BH uniri                                                   gt  Run Strategy ir Over   E Stop Strategy IP Out   I    Pause Chart  amp    Auto Step   PI   Into y Breakpoint  Strategy Tree    The Strategy Tree opens when you open a strategy  and closing it is equivalent to closing the  strategy  The Strategy Tree shows you all the elements of your strategy  control engines  flowcharts   subroutines  varia
272. email server  If so  you must obtain the root  certificate and then register it on your SNAP PAC controller as described below     NOTE  If you are using a SoftPAC controller  root certificates are not needed for sending email because  Windows already has those certificates installed     Obtaining a Root Certificate for Gmail or Yahoo  Mail    The root certificates for Gmail and Yahoo  Mail are both available on our website  www opto22 com    Gmail requires the Equifax Secure Certificate Authority root certificate  Go to Support  gt  Downloads  and then search for Equifax Root Certificate in Samples and Freeware     Yahoo  Mail requires the Digicert High Assurance EV Root Certificate  Go to Support    Downloads  and then search for Digicert High Assurance EV Root Certificate in Samples and Freeware     Registering a Root Certificate on a SNAP PAC Controller    SNAP PAC requires the certificate file to be Base64 ASCII format  Sometimes certificate files are  binary format which SNAP PAC can t use     To tell if a certificate file is Base64 ASCII format   e     Ifthe file has the  PEM extension  it is Base64 ASCII     e     If you open the file in a text editor  such as Notepad  and you see the line         BEGIN  CERTIFICATE       it is Base64 ASCII     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       SNAP PAC requires no more than one certificate per file  You can verify there is only one certificate in  a Base64 ASCII file by opening the file in a text
273. empty the  fields  click Clear     F   Scaling   Scalable modules only   optional  Use to assign custom units and values to the  module  For example  you could scale the readings of a  10 to 4 10 VDC input point to measure its  input as zero liters per second when the real world reading is zero VDC  and 1000 liters per second  when the real world reading is 5 VDC  This example would look like this        Add Analog Point                                           Name   m In this example  units are changed  Berton    to liters second and lower and  upper values are changed  Although  Type  the module has an output of  10 to  Module       SNAP AOV 27   10    10 VDC  Scalable  v  10volts  the device attached to the  point outputs only 0 5 volts  Scaling  Scaling reflects the device s range   Full Range Clamping Actual  Scaled  In this case Clamping protects the  Units   VDC  VDE VDC VDC device b matha  J y ensuring tha  Lower    10 0 0 0 out of range voltage will never be  Upper   10  5  5 1000 sent to it                             Custom scaled values can be any floating point value as long as the upper value is higher than the  lower value  Note that inputs typically have under range and over range capability  which means  you can specify a lower or upper value beyond the standard value  Outputs do not have  under range or over range capability     To return the units and upper lower values to the defaults for the module  click Default     G    Default  To set the initial sta
274. en       Makes the Productinfo txt    d n SetEndOfMessageTerminator chAFile         file comma delimited  too        Writes the data from the  Product  Info string table  into the Productinfo txt file  on the control engine     status   TransmitStrTable 4 0 Product Info chAFile    endif  endif             Deleting Files and Moving Within Them  Another command you ll find useful with file  communication handles is Send Communication Handle Command  Using these commands  you  can delete files  find a position within the file  and jump to a specific position within the file  See the  PAC Control Command Reference or online Help for details     For example  in order to to find specific data in a file  you can use following commands within the  command Send Communication Handle Command     262 PAC Control User s Guide       CHAPTER 10  PROGRAMMING WITH COMMANDS       e find  lt mystring gt    for strings only  Use this command to search for a string within the file and return its location    as an offset from the current position in the file  The file must have been opened in r  read   mode     e  getpos  Returns an integer that indicates the current position in the file   e  setpos position    Jumps to the specified position within the file     Moving Files via FTP    As explained in the previous section   Using the Control Engines File System  starting on page 257   the control engine s memory includes a substantial area available for file storage  You can move files  to and fro
275. en  Motor 3   0   endif    PAC Control User s Guide       OPTOSCRIPT CONTROL STRUCTURES       Using Bitwise Operators    All OptoScript bitwise operators operate on integer values  OptoScript supports the following    bitwise operators     bitand  bitwise and   bitor  bitwise or   bitxor  bitwise xor   bitnot  bitwise not    lt  lt   left shift    SS  right shift    Use the bitwise and operator to and together the  two values bit by bit    nl   n2 bitand 2    nl   n2 bitand n3     Use the bitwise or operator to or together the two values  bit by bit    nl   n2 bitor 2    nl   n2 bitor 0x0002    nl   n2 bitor n3     Hex literals can be convenient   nil   n2 bitand 0x0002     Use the bitwise xor operator to xor together the two val   ues bit by bit    nl   n2 bitxor 2    nil   n2 bitxor 0x0002    nl n2 bitxor n3     The  eft shift operator shifts the left value s bits to the left by the right value     nl   n2       2     left shift n2 s value by 2  nli    n2  lt  lt  n3     left shift n2 s value by n3    The right shift operator shifts the left value s bits to the right by the right value     nl   n2  gt  gt  2  II right shift n2 s value by 2  nl   n2  gt  gt  n3    lright shift n2 s value by n3    Precedence    For a list of operators from highest to lowest precedence  see    Operators    on page 395     OptoScript Control Structures    OptoScript provides the following structures to control the flow of logic in the code     336    e    If Statements     below    e        Swi
276. en you have finished inspecting the I O unit  click Close     Inspecting Digital I O Points    You can inspect a digital point s data  change its status  or set its internal values or external values in   Debug mode  To monitor the point in a watch window  see page 157  To change the point  follow   these steps    1  With the strategy running in Debug mode  double click the I O point on the Strategy Tree  Or  double click an I O unit in the Strategy Tree  click the Points  Compact  tab of the Inspect I O  Unit Dialog box  and then double click the I O point     The small dialog box that appears shows the IVAL and XVAL         The XVAL  or external value  is the    real    or hardware value as seen by the I O unit  This value  is external to the control engine         The  VAL  or internal value  is a logical or software copy of the XVAL that is in the control  engine  The IVAL may or may not be current  since it is updated to match the XVAL only  when a strategy in the control engine reads or writes to an I O point     2   Sprinkler  Switch  h   sc          If the digital point is configured with a counter  the counter values appear instead of the point s  Status     3 4  DO  Switch   scanning        VAL   o   XvAL  4  m Maximize          2  To change the value or to view more information  click the Maximize button   The title bar shows the name of the digital point and whether scanning is occurring     PAC Control User s Guide       oa Mw OR       CHAPTER 6  WORKING WITH I O
277. eneo pem Ix PERS A eU AST EE nU COR ees 212  Changing an Element Back to the Defaults             sss 212  Opening  Saving  and Closing Charts          sss 212   Openinga Chart sausas deen cre eco does Hae er edd dat eri pes e ed etd 212   SAVING  ACMA eana Aa aE atd hile Ee ad d tM retenti 213   dosing a chart sssseserque edad date cameadonsand Ue son E Ee E acdc 213  Copying  Renaming  and Deleting Charts             lsssssssssssssssss 213   COPYING  a CMAN    uu eet eode e dst vestis ieri eredi e quee eredi en 213   Reriaming a Chart  axem ts EEUU RU P EMT EDS 214   Deleting a Chala cus ssec ei oer e Pee dt ie Vibes EE deos bir e ea tbid 214  Printing Ghaltssss iss da biete ine Cerise Roe ds de qid nid b de oids iria obe 215  Exporting and Importing CHAMMS  1  scere ree ere ERR TEE E iai 215   FXportilg a Chart ceser ond ch trten tenir testetur on coke tex tede rode quete tais 215   Importing  Chart  acere ouest PUD US DOR IEEE DU ER ERR HR EO es 216   Chapter 9  Using Variables and Commands                    eee 217  VOCE  o  MR  ODER MIT RU TREND E ER 217    TIS Gael  serisini cearense ienten e Dibdus dresden iade Ron 217  About Variables  saihe rin D eX PET meunhdar ane y OPEP Ju ELO E Oed tip n  217   Types of Dataima  Varia BIE usare qu sorei sancii yat da D CICER GR cun 218   Variables iniPAG Control  eus pr EROS OBI UOTE REO UE REIR 219   Table Variables as  des died acacia Sh rtt antie Deer ete et aree dia ge edu edes n 219   Persistent Data rsss esu Gl certs    u
278. engine and I O unit s   as shown in the following section     Compatible Control Engines and I O Units    The following control engine and I O unit combinations are compatible with PAC Control Basic and    PAC Control Professional as shown     SNAP PAC S series controller    SNAP PAC R1  SNAP PAC R1 W   SNAP PAC R2  SNAP PAC R2 W   SNAP PAC EB1  SNAP PAC EB1 W   SNAP PAC EB2  SNAP PAC EB2 W   SNAP PAC SB1  SNAP PAC SB2    SNAP PAC R1  SNAP PAC R1 W   SNAP PAC R2  SNAP PAC R2 W   SNAP PAC EB1  SNAP PAC EB1 W  SNAP PAC EB2  SNAP PAC EB2 W   SNAP PAC SB1  SNAP PAC SB2       SNAP PAC R series controller          SNAP PAC R1  SNAP PAC R2  SNAP PAC EB1  SNAP PAC EB2       SNAP PAC R1  SNAP PAC R2  SNAP PAC EB1  SNAP PAC EB2          PAC Control User s Guide    INSTALLING PAC CONTROL       SoftPAC controller                SNAP PAC R1 SNAP PAC R1  SNAP PAC R1 W  SNAP PAC R1 W   SNAP PAC R2 SNAP PAC R2  SNAP PAC R2 W  SNAP PAC R2 W   SNAP PAC EB1 SNAP PAC EB1  SNAP PAC EB1 W  SNAP PAC EB1 W   SNAP PAC EB2 SNAP PAC EB2  SNAP PAC EB2 W  SNAP PAC EB2 W     Wired Wireless PACs and I O can be used on a wired Ethernet network or on a wireless LAN           Important Note on Disk Drives    Opto 22 applications  including PAC Control  perform best when using files from a local hard disk   Network drives may be used  but performance may suffer and depends upon the speed and  reliability of the network  While it may be possible to use other drive types  such as floppy disks  key  chain USB dri
279. ens  listing all configured PID loops  Remember that the  number of PID loops available depends on the I O unit     PAC Control User s Guide 139    INSPECTING I O IN DEBUG MODE       I Configure PID Loops    1 0 Unit  Mixed 1D  Unit Y Type    SNAP PAC R1    Name Setpoint Output Mode Enable    Temperature_   Over_T   os Oven    Autom    Ena     Not Used  Not Used  Not Used  Not Used  Not Used  Not Used                         Up  and down  arrows    PID loops are scanned by the I O unit in the order that they appear in this list    2  To move the PID loop to a different position on the I O unit  use the up  and down arrows in  the dialog box    3  Tochange the PID loop s configuration  double click its name to open the Edit PID Loop dialog  box  Change the fields as necessary     For help in completing the fields  see  Adding a PID Loop  on page 135     Deleting a PID Loop    Only PID loops that have a reference count of zero can be deleted  Be careful when deleting PID  loops  you cannot undo a deletion     1  Make sure the strategy is open and in Configure mode  On the Strategy Tree  expand the I O  units folder until you see the PID loop you want to delete     2  Right click the name of the PID loop and choose Delete from the pop up menu   The PID loop is deleted     You can also delete a PID loop in the Configure PID Loops dialog box by highlighting it and  clicking Delete     Inspecting I O in Debug Mode    140    You may want to inspect or change I O while you are runnin
280. enseValve               inm doChipDispenseValve   T doRejectValve       PES ao venT emperatureContrc TUE CE  499719 813 Sec    la Ci  Shortcuts    EA anfinnveunrSneedControl    i                                      Jb Next 4  Prev                Watch Window    nCookie Counter Integer 32 Variable   02  diInsp a     Digital Input       On Latch  Off Latch    PAC Control  Ready LN DEG    On latch reset to Off Counter decreased by one             21  Click the Auto Step Chart button to go back to auto stepping     The counter does not decrease again  because the on latch is no longer set  But the counter  won t increase until we start the Dough Chip  Control chart again     22  Click the Dough  Chip  Control chart tab  Click the Pause Chart button to unpause the chart   Verify that Step On changes to Step Off in the chart status bar     The watch window shows the nCookie Counter value going up again     PAC Control User s Guide    CLOSING THE STRATEGY AND EXITING       Closing the Strategy and Exiting    Before we finish this tutorial  you may want to explore the sample strategy on your own  You can  double click items in the Strategy Tree or open up other charts to see what they do  You can also  double click command blocks to see what they contain     1     What s Next     When you re ready to stop  click the Stop Strategy button in the toolbar    This action prevents the strategy from running continuously unattended on the control engine   A dialog box asks if you are sure y
281. ently than variables used by  more than one chart or process  especially if you have a large chart and want to separate these types  of variables  For variables used only in a table you can include the table name in the variable name   For example  you might use the name Fail  Count  in  Config  Values for a variable to be used in a  table named Config  Values     The following table shows suggested notation for use in PAC Control                                                        integer 32 variable n pointer variable p  integer 32 variable used as Boolean b pointer table pt  integer 32 table nt digital I O unit dio  integer 64 variable nn mixed l O unit mio  integer 64 table nnt analog input point ai  float variable f analog output point ao  float table ft digital input point di  down timer dt digital output point do  up timer ut chart cht  string variable S communication handle cmh  string table st   In I O point names  you may want to indicate the point s function  the state of the device when the    point is active  its location  or a schematic reference  You can abbreviate names of familiar devices  and write out less familiar names  Include the information you need in the order in which it will be  most useful to you     e Heater Switch  You have only one heater        Htr6 Switch SW23B  You have many heaters  and the schematic reference is needed        Cnywr  Speed Encoder  BldgA  You want all conveyors to appear together         BldgA Cnvyr Speed Encoder  You wa
282. ents si e e tree a dese bed y qe dee va een dub dele Qe de 202   Chiatt COmpOHernts  seo gone d ded Ton Re HR ag OUR RU d OU o UO RR RR Ser 202   Using the Drawing  Toolbar sessi c eee e od a eee e ed dere dc a 203  Changing the Appearance of Elements in a Chart Window                00   cece eee 203  Configure Chart Properties Dialog Box         iss 204  Changing Existing Elements to Match New Defaults             sss 205  Drawing BIOGKS   22 urere ette acr eig eu dedi ud aenea ted dvds 205  Naming Blocks         sssssssssssssssse I m ee 206  Renaming Blocks   i t b ce t ede eu e Pa a RE ducti aa 206  Connecting BlOCKs    sa da arp t E e RO SERERE ACA PC oceania  ave 207  Action Blocks and OptoScript Blocks 2 0 0 0    ccc cece ec c eee c eee een e eens 207  COMITIOMABIOCKS EETA TP rr 208  Adding cc MEUM 209  Editing TEXT rM 209  Selecting Elements uero eem em es tempere pee fen E n i E CS 210  Mowvina Elerients see etae eena a a aED po EE EEn ds 210  Moving Elements in Front of or Behind Other Elements  Changing Z Order         211   Cutting  Copying  and Pasting Elements 2 2 2 2    ccc cece cece e eee 211   Deleting Plemet ed sri cash ere eden e ee ben chad someon ver bb vemenedades 211   Charging Element Color arid Size  41  estet eerte ettet tie Pe Rd es 212   Resizing Blocks or l ext Blocks  das   uerb cement ete tabe exce ieee hae eager ad Ores 212  Changing  Block COlOrs   lt  o  ioooe ve toptbe vere Unt ba velas eic Rrte be eher US 212  Changing ext   s   even eset t
283. er s Guide 325    OPTOSCRIPT FUNCTIONS AND COMMANDS       OptoScript Functions and Commands    326    Since functions in OptoScript are provided by commands almost identical to the standard  commands in PAC Control  you have the same complete range of functions  There are no additional  functions for OptoScript code  and you cannot make your own functions     Standard and OptoScript Commands    In many cases you can easily recognize OptoScript commands  because they are almost the same as  standard PAC Control commands  All spaces are removed from the OptoScript commands  however   and in some cases words in the command are abbreviated or left out  Commands are case sensitive   Here are some examples of the same commands in PAC Control and in OptoScript                 Get Counter GetCounter   Set Down Timer Preset Value SetDownTimerPreset  Delay  mSec  DelayMsec   Convert Float to String FloatToString   Get Number of Characters Waiting GetNumCharsWaiting                Some commands are built into OptoScript functionality  Some of these have OptoScript commands  and some do not  you can use either the built in functionality or the OptoScript commana  if it  exists  Here are some examples                       Move   item1   value  Add   1 2   Less   lt  value1  lt  value2  Turn On TurnOn    non zero  digital3   1  Turn Off TurnOff  0 digital3   0  Comment  Single Line  Il   I comment   Set Nth Character SetNthCharacter s1 5     c                       See Appendix E for a ta
284. er you add  do the following steps     NOTE  What you enter here appears in the Add Instruction dialog box when the subroutine is called  from within the strategy  See page 353 for an example     a  Highlight the first empty line  below the Put Status In parameter  and click Add to open the  Add Subroutine Parameter dialog box      1 Add Subroutine Parameter       Prompt          Name                Type             b  In the Prompt field  enter the prompt text you want to show in the Add Instruction dialog  box in the strategy  This field is limited to 16 characters    c  Inthe Name field  enter the name of the parameter  the argument  as it will be referred to  in the subroutine  This name is used within the subroutine only    d  From the Type drop down list  choose the type of item to be passed into the subroutine   Use variables for values the subroutine changes  passed by reference   use literals for values  the subroutine uses but does not change  read only or passed by value      352 PAC Control User s Guide    CHAPTER 12  USING SUBROUTINES       e  Click OK  The parameter appears in the Configure Subroutine Parameters dialog box  above  the Put Status In parameter     I Configure Subroutine Parameters    Subroutine Name  Group   Variable Increase Notification     Subroutines          Subroutine s OptoS cript Name        Variable Increase Notification   Refe rence    Comment  count                   t Prompt    Varia  Counter       down arrow    buttons       6  Repeat
285. eration on the pointer that you could perform on the object the pointer points  to     e        Setting Initial Values in Variables and Tables During Strategy Download  on page 226    When you are adding table variables in PAC Control  you can set all table elements to one initial  value  Or  you set each individual table element to its own value by creating an initialization file  to download with your PAC Control strategy     e  12  Using Subroutines    on page 347    You can use subroutines that are independent from strategies  but that can be called from any  strategy  Subroutines offer two ways to work with variables and other logical elements  they  can be passed in or they can be local to the subroutine     e        Configuring PID Loops    on page 134    A proportional integral derivative  PID  control system  often referred to as a PID loop  monitors  a process variable  compares the variable   s current value to a desired value  a setpoint   and  calculates an output to correct error between the setpoint and the variable  Because the  calculation is complex  it is done by a mathematical formula  or algorithm  that you can then  adjust  tune  for each PID loop     PAC Control Terminology    action block    Action blocks are rectangular blocks in a flowchart that contain one or more instructions  actions   that do the work of the strategy  such as turning things on or off  setting variables  and so on  Several  instructions can be placed in one action block  Action bl
286. errors are found     PAC Control User s Guide 169    COMPILING AND DOWNLOADING       170    Compiling the Entire Strategy    To compile the entire strategy including all charts and subroutines  in Configure mode  click the  Compile All button  amp   on the toolbar  or choose Compile  gt  Compile All  The menu option shows  the name of the strategy you are compiling     As soon as you choose the menu option  the entire strategy is saved and compiled  The Compile  Progress dialog box appears  You are alerted if errors are found     Downloading Only    If your strategy has been compiled  you can download it again quickly  Downloading again is useful  if you want to run your strategy from a clean slate by reinitializing any variables that are set only on a  strategy download     To download a strategy that has already been compiled  you must be in Debug mode  Choose  Control Engine  gt  Download Strategy     The Download to dialog box appears and your strategy is downloaded     Background Downloading    The Background Downloading feature allows you to download an alternate strategy to a controller  while the active strategy currently on the controller continues to run  With two different strategies  downloaded to the controller you can switch rapidly from one strategy to the other    This allows you to     e   Download a new or updated strategy to the controller and then optionally run it with minimal  downtime  For larger strategies  downtime is dramatically reduced     e   Down
287. ers  and other configured items in your strategy   as well as  charts   have usually been created before you use them in OptoScript code  Check their exact  spelling  including underscores and upper and lower case  to make sure they are correct in the code   The easiest way to make sure spelling is correct is to enter the variable or other item by clicking the  Insert Variable button in the OptoScript Editor and choosing the item from the drop down lists     Ifthe item has not yet been configured or created  use the normal PAC Control methods to do so  For  help  see the chapters in this guide on configuring I O and using variables     Troubleshooting Syntax Errors  Check for the following common syntax errors   Missing Code    Check for obvious errors first  For example  make sure nothing essential has been left out of  or  unnecessarily added to  a statement                 iTotal   x   y    iTotal   x   y   Z  Last operator missing a variable   iTotal  x   y z iTotal   x   y   Z  Semicolon missing   sGreeting   Hello     sGreeting    Hello     First quotation mark missing on the string   iTime   Get Hours  iTime   GetHours    pides one add   x    1    x   y   x    1    x   y    Parentheses mismatched  last half missing                    Check to make sure operators are used correctly  You may want to review    OptoScript Expressions  and Operators    on page 333     If you are using control structures such as loops or if statements  especially if they are nested  make  su
288. ers can point to     Integer Variable  snappen   Fost ert    SNAP PAC R2 ngrana  Digital Input Pointer Variable  5e SNAP PAC EB1      Digital Output Analog Input Down Timer Variable  SNAP PAC EB2     Chart  Counter Analog Output Up Timer Variable  Quadrature Counter SNAP PACCO Integer Table  aa asus SNAP PAC SB2 3  Float Table  String Table  Communication Handle                         PAC Control User s Guide 303    POINTER COMMANDS       Advantages of Using Pointers    For certain types of operations  pointers can speed up programming and make the strategy more   efficient  Pointers are usually recommended only for experienced programmers  however  because  their misuse can result in unpredictable behavior  They also complicate strategy debugging  If you  use too many pointers  it s easy to lose track of what s pointing to what     If you choose to use pointers  be sure you use the text tool to document your charts in detail     Referencing Objects with Pointers    There are two types of pointers    pointer variables and pointer tables     Pointer Variables    pointer variable contains a single pointer to a single object  You can set the  initial value for a pointer variable when you configure it  or you can set it later by using the  command Move to Pointer     Once the initial value is set  you can reference it using any command you would use for that type of  object  For example  if the pointer points to a string variable  you can use any command for the  pointer that yo
289. es            Int64Literal    0  xX   hex digit  i64    Hexadecimal Integer 64   Good examples  0x12ABi64   OX12aBi64  0x0i64   Bad examples  x123ABCi64   0123ABCi64       0164  digit  i64  non zero digit  i64    Decimal Integer 64   Good examples  0164  123i64   7890164   Bad examples  123ABCi64       FloatLiteral    digito      Ee  4       opt  digit   opc    digit      Float Literal   Good examples  1 0  2 3  1 2e6   1 2e 6   1   2e6   Bad examples  1   1 e7  1e7       StringLiteral             551 oa           String Literal  Confined to single line   Good examples   abc def   Bad examples   abc def        PAC Control User s Guide       APPENDIX E  OPTOSCRIPT LANGUAGE REFERENCE       NumericVariable  StringVariable  ChartVariable  DigloUnitVariable  MixedloUnitVariable  PointerVariable  NumericTable   String Table  PointerTable  CommunicationHandle     letter    letter  digit _ lo     A letter followed by mix of letters  digits   and underscores  The name must be  found in the PAC Control database     Good examples  MyInt  MyInt2   My Int 3  Bad examples  MyInt  OMyInt       CommandProcedure  CommandProcedureNoArgs  CommandFunction  CommandFunctionNoArgs           letter    letter  digit _ lo        A letter followed by mix of letters  digits   and underscores  The name must be a  built in command or subroutine     Good examples  Sine  Sine2   Sine 3  Bad examples  Sine  OSine          Keywords  Reserved Words     if    then for  to   else ste   elseif RA   endif   Operat
290. es not have to  be turned off  and if communication is lost to the point  the point does not remain on     PAC Control User s Guide 283    DIGITAL POINT COMMANDS       Pulse Measurement commands measure pulses on digital input points  For details  see the  specific command in the PAC Control Command Reference or online Help     IVAL and XVAL    All I O points have two associated values  XVAL and IVAL  If you are using PAC Control in Debug  mode to manipulate I O values or to disable an I O point or I O unit  you need to understand these  values     XVAL  The external value  or XVAL  is the    real    or hardware value as seen by the I O unit  This value  is external to the control engine and strategy logic     IVAL  The internal value  or IVAL  is a logical or software copy of the XVAL that is in the control  engine  The IVAL may or may not be current  since it is updated to match the XVAL when strategy  logic accesses the I O point     If the IVAL does not match the XVAL  a mismatch just means that your strategy logic is not reading  from or writing to the I O point in question at the moment     Simulation and Test  The    Real    Use for XVAL and IVAL    To test output performance  you may want to force an XVAL for a specific output to a particular  value  If the program is actively writing to the output  you need to disable the output to do so  If the  program is stopped  there is no need to disable it     To test program logic  you may want to force an IVAL for a specific
291. es on the Control Engine         isses 06  Restoring Archived Strategies from the Control Engine            00    sss 08  Moving Control Engines from One PC to Another    0 0    cece cece cece ees 09  Downloading Files Using PAC Terminal              csse 10  Chapter 6  Working with 1 0 44d Vox oaa RREREREERERSERXYATAR UA A IRE AGO 113  Jure ree M HL Woe hod hi e ee ER GbE ei a 3  this CNA DUCT tact cos hha dead awen eee cate dome commanded idaieamiad ataamada nee 3  Choosing a Configuration TOO    iode sacer tide Sanddadeariadautawedads begin TS 3  Importing I O Configuration into PAC Control 0 0 0    cece ccc eee cece eee e eens 5  Copying VO Configurations x  2 tae titia eti tu eid de bbb cda deed 5  Creating the Configuration Export File          sss 5  Importing the Configuration File           sss 6  Agdirig and O UNI we sate epo etre rtp ehe eee peer b epp seas 6  Agd O Unit Dialog BOX iii tiere hb cete raed Ohr ROO RP E QE 7  Changing the Baud Rate for Serial I O Units          ssssssssssssssss e 9  Changing the Baud Rate and Mode for Serial I O Units         isses 9  Tuning the I O Unit Timeout Value for Ethernet I O Units           00    eee eee eee 20  Changing Configured I O Units        iiis ttt t teenies 21  Deleting Configured VO Units  2   3 55 39 9 e ope Saver tO dE pr dag eden ed 21  PING  Volt Pei sue susct rte hve eed dE van bus dam une dU bars deu e etie 22  Adding a Digital VO POINT 214  4 to ote RM ua zd dre Qe oa e isch e a 22  Add Digital Point Dialog
292. escription    For animation in io     Desired dough ve     For ramping the c     Dough vessel pre       For animation in io       Pho     Cn no Se NHN          In the Type drop down list  choose the type of table variable you want to add     If you are adding the table variable to a subroutine  select Subroutine in the Scope drop down  list     To add a new table variable  click Add   The Add Variable dialog box appears     Add Variable          Name          Description          Type   Sting    v  StingWidh  1       Initialization     Initialize on strategy download     Initialize on strategy run  O Persistent       Initial Value   1          The figure above shows the dialog box as it appears for string tables  Fields are slightly different  for other table variables     Complete the fields as described in    Add Variable Dialog Box    on page 222    NOTE  If you need to set individual table elements to differing values initially  you can do so in the  Powerup chart  Ifyou need to use an initialization file to initialize the values on strategy download   see the next section     Setting Initial Values in Variables and Tables During Strategy Download       To have data in the table be persistent  select Persistent    Pointer tables cannot be persistent  For more information  see    Persistent Data    on page 220   Click OK     The Add Variable dialog box closes and the new table variable appears in the Configure  Variables dialog box     PAC Control User s Guide 225    SETTI
293. ex  Error Handler Simple   Sinitvariables   CjieCookies   O OptoScript Examples    C SEM             File name     Save as type    PAC Control Strategy Files    idb  v                     4  Type My Cookies to replace New Folder  Double click the folder to open it   5  Click in the File name field and type cookies     The dialog box now looks like this     Save Strategy As       Save in     CJ My Cookies                         File name  Cookies  Save as type    PAC Control Strategy Files    idb                    6  Click Save   The strategy is saved as Cookies in the My Cookies directory     Examining the Strategy    Briefly  our cookie factory includes a tank of pre mixed cookie dough  a tank of chocolate chips  an  oven  a visual inspection station  a conveyor belt  and some compressed air to blow rejected cookies  off the belt  The process starts when a ball of dough drops on the belt  It moves along under the  chip tank to receive some chips  and then it moves into the oven to be baked  The next stop is an  inspection  where rejected cookies are blown off the belt and good cookies move along to shipping   Should anything go wrong  we also have some alarms built in to stop the process when necessary     The best way to see all the components of the strategy is to look at the Strategy Tree     The Strategy Tree    As with any window in PAC Control  you can move the Strategy Tree window by clicking and  dragging the title bar  you can minimize  maximize  or dock it by cli
294. example  a temperature sensor  analog input   a thermostat  analog input   and a heater control   analog output  are components of one system  controlled by a PID loop     This guide assumes that you are already familiar with using PIDs  PID calculations are complex and    the physical qualities of systems suitable for PID control differ greatly  This guide includes only basic  information for configuring PIDs     SNAP PAC I O units support 96 PID loops     PIDs can control isolated systems or be part of cascaded systems where one loop controls the  setpoints or input variables of others  For maximum flexibility  any PID input  setpoint  or output can  be determined by PAC Control commands     PIDs and Strategies    The PID operates at the I O unit  independently of the controller  However  the controller supports  logic commands to read and write various PID parameters and modes  Once configured and  initialized  a PID operates until the I O Unit loses power     When you change PID configuration in PAC Control  remember that changes are not written to the  I O unit until the strategy is downloaded and run  For a SNAP PAC I O unit  be sure to save PID  configuration to flash memory following instructions for the I O unit     PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       If you subsequently download a different strategy to the control engine  you ll receive an error  message   700  reminding you that a PID loop is still running and that it may conflict with t
295. existing charts as well as to new ones  click All charts in D     e To change the chart background color from the default of white  click the Background Color  box  Choose a new color from the Color dialog box     e  Tochange the chart s grid color from the default of black  click the Grid Color box       The grid and block ID numbers are displayed by default  To remove them  click Display Grid or  Display Block ID s to remove the check mark     e  Toenable or disable smooth scrolling in a flowchart  click Smooth Scrolling  this option is  disabled by default     B   Action Block Parameters  Define the appearance of action blocks  condition blocks   OptoScript blocks  and continue blocks in this area  These changes affect new blocks only  not  existing blocks   To change existing blocks  see  Changing Existing Elements to Match New Defaults   below      e   In the Width and Height fields  type the block size in pixels  For action and continue blocks  the  default width is 96 and the default height is 48  the minimum parameters are 48  width  and 32   height   For condition blocks  the default height is 64   Note that the numbers you enter are    PAC Control User s Guide    CHAPTER 8  WORKING WITH FLOWCHARTS       rounded down to be evenly divisible by 16  for example  if you enter 81  click OK and then  reopen the dialog box  the parameter reads 80      e     To change the color of the blocks from the default  click the Color box     e     To change block name text formatting
296. f PAC Control  you can safely ignore the message and click Yes     E PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       The Cookies strategy opens and the PAC Control window now shows the Cookies strategy   yours may look somewhat different      IPAC Control Basic  File Edit Configure Chart Subroutine Compile Mode Tools View Window Help    TE    4 0550 AY 2k Gweoeret eae 8s       Cookies    E DR            Control Engines       Subroutines Included   amp   E Charts  E    Variables  E  C3 Numeric Variables      String Variables      Pointer Variables  IE Communication Handles  IE Numeric Tables      String Tables      Pointer Tables      c 1 0 Units                            Configure     NUM     Saving the Strategy    Now let s save the strategy to a new name  so we can change it while leaving the original intact   1  Select File  gt  Save Strategy As     Save Strategy As       Save in    CJ ioCookies  Fi Cookies idb                               File name   Save as type    PAC Control Strategy Files  idb                      Since each PAC Control strategy must be located in its own directory  you cannot save the  strategy to a new name in its current location     Click the Up One Level button f to move up to the Examples directory     Click the Create New Folder button     The new folder appears in the list     PAC Control User s Guide E    EXAMINING THE STRATEGY       Save Strategy As          Save in     CJ Control Pro Examples          Error Handler Compl
297. f the table it is in and  the index where it can be found  The length of the table is the number of strings it can hold  Because  string table indexes start with zero  indexes can range from zero to the table length minus one        The width of each string in the table is the same  The length of each string can vary from zero to the  configured width of the table     String Data Extraction Examples    To extract various pieces of information from a string  use the command Find Substring in String   Consider the following example    012 3 4 5 6   String 1  O P T O                                                                   One way to get two separate pieces of information from this string is to get characters 0 3 and then  get characters 5 and 6  as shown in the following examples                    Find Substring in String  Example 1    String  1 string variable   Start At 0 integer literal   Number Of 4 integer literal  Move To Sub  String1 string variable  width     5     Results in        Sub String1 O P T  O                            Find Substring in String  Example 2    String  1 string variable   Start At 5 integer literal   Number Of 2 integer literal  Move To Sub_String2 string variable  width   5     Results in     012 3 4    Sub String2 2   2       PAC Control User s Guide 309    STRING COMMANDS       310    String Building Example    Strings are assembled using commands Move String  Append Character to String  and Append  String to String  Consider the fol
298. firmware files  configuration data  or strategy files saved to flash   they affect only files at the root of the control engine s file system  For more information on the file  system  see  Using the Control Engine s File System  on page 257  For the specifics on individual  commands  see online help or the PAC Control Command Reference     CAUTION  Since these commands write to flash memory  use them sparingly within your strategy and  make sure they do not end up in a loop  You can literally wear out flash memory if you save to it or erase it  too many times     280 PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Digital Point Commands    The following commands are used with digital points     Basic Commands  Off    On    Turn Off   Turn On    Totalizers   Get Off Time Totalizer   Get On Time Totalizer   Get  amp  Restart Off Time Totalizer  Get  amp  Restart On Time Totalizer    Counters    Clear Counter   Get Counter   Get  amp  Clear Counter  Start Counter   Stop Counter    Period and Frequency  Get Frequency  Get Period    Get Period Measurement Complete Status    Get  amp  Restart Period  Set TPO Percent  Set TPO Period    Latches   Clear All Latches  Clear Off Latch   Clear On Latch   Get Off Latch   Get On Latch   Get  amp  Clear Off Latch  Get  amp  Clear On Latch  Off Latch Set   On Latch Set     Pulses   Generate N Pulses   Get Off Pulse Measurement   Get Off Pulse Measurement Complete Status  Get  amp  Restart Off Pulse Measurement   Get O
299. formation  Recipients  Message Body  and Attachment  File Names     NOTE  An additional example chart is available for free on the Opto 22 website  www Opto22 com  Go to  the product page for the PAC Project Software Suite and click the Downloads tab     PAC Control User s Guide 271    COMMUNICATION COMMANDS       272       X     5 File Subroutine Compile Mode Tools View Window Help       amp   x     Ce 50502 tae x 08   055090o0 9s4u                            E  3 SMTP  E  amp  Control Engines  a PAC RI   C Subroutines Included  E    y Charts   amp  ds Powerup       Subroutines Used      c Variables  E  Cy Numeric Variables  Dal nResult  Ej  C3 String Variables  CRLF  E Pointer Variables  E Communication Handles  O Numeric Tables  E  C3 String Tables  ET amsti  ttach  E arstBody  pl arstrRecipients  aH arstrServer     C3 Pointer Tables     1 0 Units                             T                              3  Shortcuts 100                              v  lt b Next  Prev                    PAC Control  Ready Configure NUM    The strategy is comprised of only one chart  the Powerup chart  which has two OptoScript blocks   Init Tables and SMTP Send  The first OptoScript block  Init Tables  contains the email body  The  second one  SMTP Send  uses the Send Email with Attachments command to send the email  and attachments   To send an email and attachments using the example   1  Create a new strategy and then choose Configure  gt  Control Engine to configure a control  engine   
300. formation tab and then click the Set button under Stored Configuration  Flash EEPROM      The following parameters are saved        e    O module configuration e    O module configuration  e Initial output settings e Comm link watchdog time  e Comm link watchdog time   e Temperature conversion type   e Input offset and gain settings       NOTE  Use this option to protect the I O unit configuration information from being lost when the  power is turned off  You should save the configuration settings to flash when they are final     Saving to flash memory this way is the same as saving to flash by other methods  such as using  PAC Manager  see the PAC Manager Users Guide   and is preferable to using the command Write  I O Unit Configuration to EEPROM    To reset saved parameters to their powerup default values  click the Clear button    To change the I O unit s current status  click an arrow in the Enable Comm field  Then click  Apply    Yes on a green background means enabled  No on a red background means disabled  If you  change it  the background turns magenta until you click Apply     PAC Control User s Guide 141    INSPECTING I O IN DEBUG MODE       142    5  To view an individual I O point  highlight its name in the list     To add an   O element to a watch window  click Add Watch  See page 157     To open an inspection window to change an I O point  click View  Then see    Inspecting  Digital I O Points  below for the I O point you are changing  analog or digital    6  Wh
301. g  changing compression 174  downloading  without using PAC Control  172  files 381  including subroutine 355  opening 162  replacing elements 194  restoring archive from control engine 108  running 26  automatically 175  manually 175  saving 163  saving to flash EEPROM 165  searching 192  starting automatically 229  stopping 175  transfer to another PC 109  viewing all operands 189  viewing variables and I O 188  Strategy Tree       PAC Control User s Guide    definition 55  docking 59  icons 56  string  adding control characters 308  building  example of 310  commands 306  330  equivalents in Visual Basic and C 311  convert to string commands 312  data extraction  example of 309  definition 49  examples 308  330  in OptoScript 330  length and width 307  quotation marks 330  variable  adding 221  variable  definition of 219  string handling 320  string table  adding 224  example 308  subroutine  adding commands  instructions  354  adding local variables 354  auto stepping 179  breakpoints 180  calling from a chart 356  compiling 355  configuring parameters 350  configuring parameters  example 353  creating 348  349  data types 348  debugging 358  definition 347  including in strategy 355  list of files in 382  parameters 347  pausing 177  printing commands 187  printing graphics 184  saving 355  searching 192  stepping through 178  tips 348  viewing 358  viewing all operands 189  viewing variables 188  Switch  amp  Run 169  Switch statement 323  337       switching strategie
302. g  mode     In the PAC Control window  you ll notice that the Debug toolbar is now available  The mode is  shown at the bottom of the main window  The open chart window shows that the strategy is  stopped  as shown in the following figure     PAC Control User s Guide    RUNNING THE STRATEGY       Debug toolbar  buttons       IPAC Control Professional    Dough _Chip_Control  DER              This chart drops the dough and chips on the conveyor belt      amp     Cookies The belt must be running between 50  and 65  of max rpm      amp   E Control Engines  P 4 Cookie Controller       Subroutines Included        Charts   E 05 Alarms       Q5 Dough Chip Control     D Dough_Vessel_Pressure_          Interrupt   E B   Oven_Inspection_Control     B   Powerup      Variables This chart runs   E  E Numeric Variables continuously once the  ng bChipDispenseValve program has been started    8  bChipLevelSwitch  gal bD oughDispense al   gal bDoughLevelS witch Drop the dough   pal bDoughPressureCont   8  bEStop    3    The Powerup chart starts  this chart     ionPassFailS       bReiectValve      1 G  Shortcuts     gt  7          2  2                                           v  JLNext 4  Prev Mode       C  Program Files Opto22 PAC Project 8 1 Display Pro Examples ioCookies Contral Cookies       Running the Strategy    In Debug mode  we re going to run our strategy and examine it  We ll see how the strategy run  affects variables  how the command blocks are executed  and so on  The first chart
303. g tools  such as stepping and breakpoints  are in effect  The chart or subroutine must be  running in order to use these tools     Choosing Debug Level    You can choose one of two levels of debugging     e Minimal Debug lets you step from block to block  but does not allow you to step into blocks   Less information is downloaded to the control engine for minimal debugging  so downloading  the strategy takes less time and less control engine memory  The strategy also runs slightly  faster     e Full Debug lets you step into blocks  so you can step through each instruction in an Action or  condition block and through each line of OptoScript code in an OptoScript block  If you are  using OptoScript  you will probably want to spend the additional time to download your  strategy at the full debug level     To change debug level  make sure you are in Configure mode  From the Configure menu  choose  Minimal Debug or Full Debug  The next time you enter Debug mode  the strategy will be compiled  and downloaded with the new level     Changing Debugger Speed    Before you enter Debug mode  you may want to consider changing debugger speed  Depending on  the number of charts and windows open in PAC Control  and depending on other processing your  computer is doing at the same time  you may find that running the debugger affects the computer s  or the control engine s performance of other tasks  If necessary  you can slow down the debugger by  increasing the time delay between debugging c
304. g your strategy in Debug mode  This  section shows how to view information about I O and make changes while the strategy is running     To monitor several I O elements at once in a window you can save with your strategy  see    Using  Watch Windows for Monitoring    on page 157     Inspecting I O Units and Saving Settings to Flash    1  With the strategy running in Debug mode  double click an I O unit in the Strategy Tree     PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       The Inspect I O Unit dialog box appears  showing information about the unit and its points  The  title bar shows the name of the I O unit and whether scanning is occurring     4   Mixed IO  Unit   scanning   Name  Mixed IO Unit    Error   None     Enable Comm   Yes        Points  Detailed    Points  Compact    PID Loops   Information         Module Chit Name Type IAL  L3  00  SNAP IDC5D 0 Emerge    D Input  1 POS D Input  2 Freezer    D Input  3 Photo S    D Input  BB  01  SNAP ODCSSRC 0 Alarm D Output  1 Freezer      D Output  2 Inside L    D Output  3 Outside    D Output  ud  02  SNAP ADV 27 0 Fuel_Dis    A Output  1  0    r3  03  SNAP AICTD Store T    A Input 0 0000 78 3616             NOTE  Scanning stops whenever you click a changeable field  It resumes once you click Apply  another  button  or an unchangeable field  If scanning resumes before you click Apply  any changes you made  are lost     To save the current configuration of the I O unit to its EEPROM  flash memory   click the  In
305. ghlight the control engine you want to associate  with the strategy  Click OK  Continue with    Associating the Control Engine with Your Strategy     on page 93     PAC Control User s Guide    CONFIGURING CONTROL ENGINES       Control Engine Configuration Dialog Box    A   Control Engine Name  Enter a descriptive name for the control engine  Valid characters  are letters  numbers  spaces  and most other characters except colons and square brackets  Spaces  cannot be used as first or last characters     B   System Type  Select the system type     Standard  A normal system not using redundant networks or redundant controllers     e     Redundant Networks  PRO only   A system that has redundant networks  which is also referred  to as link redundancy  When selected  two IP address boxes are available under Settings for the  primary and secondary networks  See    Using Ethernet Link Redundancy in PAC Control    on  page 94 for more information     Go e     Redundant Controllers  PRO only   Use with a system configured with the SNAP PAC  Redundancy Option  When selected  three IP address boxes are available under Settings for  Controller 1  Controller 2  and Arbiter  For more information on setting up the Redundancy  Option  see form 1831  the SNAP PAC Redundancy Option Users Guide     6    C   IP Address Hostname  The IP Address Hostname text boxes available depend on your  System Type  Fach IP address is entered in decimal notation  for example  192   9 200  24      Hostnames are
306. git falls off on left  0   0 0   0 0 0  1 Oops    Note that moving the point indicator doesn t help  because the exponent is separate  If the seven          digits for the account represent millions of dollars  1 000000  rather than dollars  1 000 000   the 10  cents would be 0 0000001   still too small to be represented by the seven digits     Seven digits available  1 2  3 4  5 6 7       PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS          Amount in account 1 10  0 0 0 0  0  Add 10 cents  0 0000001    digit falls off on right  1  0 0 0 0  0 0  Add 10 cents  0 0000001    digit falls off on left    010 0 0 0 0  The key is that it is not the size of the numbers that matter  but rather their relative size                                        Oops again           So if you are accumulating relatively small values in a float variable over a long period of time  at  some point  the float value will stop increasing even though you continue to try to add to it     Comparing Floating point Values for Equality  Due to rounding errors and the way  floating point calculations are performed  comparing two floats for equality can yield inaccurate  results  The precision of comparisons depends on the relative size of the float values as compared to  the difference between them    For example  if 2 097 151 0 is compared for equality with 2 097 152 0  the result will indicate that the  two floats are equal  even though it s obvious they are not  The reason is that t
307. h and an asterisk  and be followed by the same  two elements in reverse  For example        This is a block comment that goes  beyond one line        Use the Bookmark buttons in the toolbar as needed to set or clear temporary bookmarks  within the code and to move between them     Bookmarks mark lines of code so you can easily find them and jump from one bookmark to the  next  Bookmarks remain only while the editor is open  they are not saved when the dialog box  is closed     When you have finished entering all the code for an OptoScript block  click the Test Compile  button in the toolbar to compile the code for this block     The code is compiled  and the results appear in the bottom part of the OptoScript window     PAC Control User s Guide 343    TROUBLESHOOTING    UNABLE TO FIND    ERRORS       1 OptoScript   Dough_Chip_Control   Start Conveyor      Actions     Conditions  C  Variables   lt  Test Compile    OptoScript Code        nl   0   repeat    ri    epeat  ntTable nl    nl     set the table element to be equal    nl   nl   1      increment the counter  until  nl X 10      break out of the loop every 10  10  20  30  etc      ntTable nl    ni   until  nl   100      su         Results after code Output   is compiled s                         NOTE  The next time the chart is compiled  all OptoScript code within the chart will be compiled  again     If errors are found  you can fix them now or later  Begin with the first one  the one on the  lowest numbered line   since
308. h four of an integer table named My  Int  32 Table  include the following text   10 0  My Int 32 Table TABLE   20 1  My Int 32 Table TABLE   30 2  My Int 32 Table TABLE   40 3  My Int 32 Table TABLE   50 4  My Int 32 Table TABLE     Integer 64 Table Example  To set initial values of 10  20  30  40  and 50 for elements zero    through four of an integer table named My  Int  64  Table  include the following text   10   0  My Int 64 Table 2TABLE   20   1  My Int 64 Table 2TABLE   30   2  My Int 64 Table 2TABLE   40   3  My Int 64 Table 2TABLE   50   4  My Int 64 Table 2TABLE     Float Table Example  For a float table  the initial values must include a decimal point  To set  initial values of 1 1  2 2  3 3  44  and 5 5 for elements zero through four of a float table named  My  Float  Table  include the following text    0  My Float Table TABLE     My Float Table TABLE     My Float Table TABLE     My Float Table TABLE     My Float Table TABLE     Hn    OF WN mp    1  2  3  4    Ui FWD    String Table Example  To set initial values of  zero    one    two    three   and  four  for elements  0 4 of a string table named My  String  Table  include the following text  Make sure you turn off  download compression and use new lines as shown    0  My String Table STABLEG SINN   zero  1  My_String_Table  TABLE   INN  one  2  My_String_Table  TABLE   INN  two  3  My_String_Table  TABLE   INN  three  4  My_String_Table  TABLE   INN  four             Pointer Table Example  Each index in a poin
309. h is not considered to be a number     For the following examples  assume that     ni   37  fl   9 2   sl    test 123      Using the   amp   Character to Point to a Tag s Address    A pointer variable or pointer table element contains the address of the object  tag  it is pointing to   this is different than the tag itself  In OptoScript  the   amp   means address of  It is used as a prefix to a  tag in OptoScript when moving the address of a tag into a pointer  PAC Control commands were  designed to act on tags and not just the address of the tags  The     amp     prefix tells the controller to use  the address of the tag and not the tag itself     Set the pointer  The types must match or the control engine will generate an error   pni   null     pni    amp nl   pfi    amp f1   psi    amp S1   pcht1    amp Powerup     Using the     amp     Character To Move a Pointer  When moving a pointer to pointer  use the     amp      prefix   To move a value from a pointer to another pointer   pVariableO    amp  pVariable1    To move a value from a pointer to a pointer table   ptlable 0     amp  pVariable4     Using the     Character To De reference a Pointer    Use     to de reference a pointer  It will then behave just like the variable to which it is pointing  The  following two statements are equivalent     n2      pn1    pf1  n22nl  f1     PAC Control User s Guide 331    OPTOSCRIPT DATA TYPES AND VARIABLES       332    The     character has to be used as a prefix to a pointer in Op
310. h or case statement also offers branching logic and can be used in place of if statements  when the expression can match one of a number of numeric values  The value for each case can be  a numeric constant or a mathematical expression only  Comparisons and logical operators cannot  be used in cases  nor can strings  If a case involves a float  the float is converted to an integer before  use  Notice that only one case can be tested at a time     PAC Control User s Guide 337       OPTOSCRIPT CONTROL STRUCTURES       338    Here s an example of a switch statement        switch  nNumber        break             While Loops    The value of the expression in parentheses  nNumber  is compared  I 1    toeach of the cases  If the case matches the value of nNumber  the    case 1  ell action is taken   f1       ak  brea P Make sure you use a colon    after each case     Ifa case matches the value of nNumber  the break statement after    citation immediately exits the switch  Notice that a semicolon is not  used after break    f1   20     break i      You can use a mathematical expression as a case     m If no case matches  the default action is taken  Using a default is  optional  if you use it  it must be at the end of the list     endswitch 4                     A switch statement must be followed by endswi tch     The while loop is used to execute a list of statements while a given condition is true  The condition is    tested at the beginning of each loop     For example  this loo
311. hanging  cross reference window 189  cutting  block 211  command  instruction  240  241  connection line 211  text block 211          o       data  IEEE float format 296   data format   IEEE float 296   data types in subroutines 348  data  sorting  in a dialog box 63  date commands 314       PAC Control User s Guide    Debug mode  definition 53  inspecting control engine 101  inspecting I O 140  debug mode toolbar 55  debugging  changing speed 176  choosing level 176  follow stepping 176  strategy 176  subroutines 358  when using OptoScript 346  delay  commands 315  deleting  chart 214  chart elements 211  command  instruction  239  command  temporarily 240  control engine association with strategy  100  control engine from strategy 100  I O point 134  I O unit 121  PID loop 140  variable 229  designing  basic rules for strategies 76  steps for 69  dialog box  sizing columns 63  sorting columns 63  digital  adding digital point 122  changing I O while strategy is running 142  copying I O point 131  counter 282  I O unit commands 287  latches 282  point commands 326  point  definition 45  pulse commands  instructions  283  quadrature counter 283  totalizer 283  directory listing 265  disabling I O 284  docking  Strategy Tree 59  watch window 159          down timers 315  downloading  files using FTP 263  files using PAC Terminal 110  initialization file for table variable 228  strategy 166  170  changing compression 174  without using PAC Control 172  drawing toolbar 203  dupl
312. hart  gt  New  or right click the Charts  folder on the Strategy Tree and select New from the pop up menu     The Add New Chart dialog box appears     T Add New Chart                Description                    PAC Control User s Guide 201    WORKING WITH CHART ELEMENTS       2  Enter a name for the new chart     The name must start with a letter  but may also include numbers and underscores  If you type  spaces  they are converted to underscores  All other characters are ignored     3   Optional  Type a description   4  Click OK     The new chart is listed on the Strategy Tree under the Charts folder  and the new chart window  appears  Block 0  the starting block  is shown automatically  No matter how many other blocks  you add or where you place them  block 0 is always the first block to be executed in the chart     New_Chart DER         3  Shortcuts          NOTE  Because chart windows show a small portion of a potentially large chart  a small movement  with the scroll bar can mean a big change in what you see  If you lose your flowchart in the window   select View  gt  Center on Block and choose the block you want to see in the middle of the screen     Working with Chart Elements    202    Chart Components    Charts can contain five kinds of flowchart blocks  lines connecting the blocks  and text     Action Blocks are rectangles that contain one or more commands  instructions  that do the work  of the strategy  such as turning things on or off  setting variables  and so
313. hart starts the program and all other charts                                The hatch marks on the Start  block indicate that this command block was about to be  executed when we clicked Pause  Apparently the program isn t getting past this block  Notice  that the False exit routes right back to the top of the Start  block  while the True exit moves on  to Start Charts  We can see that if the start flag had been true  non zero   the program would  have gone right into the Start Charts block  Since we didn t get that far  the start flag must be  Zero     And in fact it is  We planned it that way because we wanted someone  for example  a factory  operator  to start the process intentionally  We can simulate this ourselves in PAC Control by  manually setting the flag to a non zero value     Double click the bStartFlag variable on the Strategy Tree   A little box appears     Ma CT a STO  scanning   X   Value   0 Maximize button          In this dialog box you can view the variable value  but you cannot change it unless you  maximize the dialog box     Click the Maximize button     As    bStartFlag     scanning   Name  bStartFlag    Value          Apply  3  More Info          This dialog box displays current information on the variable bStartFlag  You can see that the  variable is initialized to zero on strategy download     PAC Control User s Guide    RUNNING THE STRATEGY       7  Highlight the value zero in the dialog box and type 1 to replace it   The field turns purple  indica
314. he PID  put into manual mode  but if the PID is already in manual mode  the output will not be forced   You can  use the command Get PID Status Flags to determine current settings      If neither box is checked and the PID input goes out of range  as defined by E  Low High Range  then the  output will freeze  but only while the input is out of range     K   Algorithm  Choose algorithm  Velocity  ISA  Parallel  Interacting  For details on algorithms  see   Algorithm Choices  PID   on page 301     L   Mode  Choose the Mode you want the PID to be initialized to  The main difference between  Automatic and Manual mode is that in Manual mode the PID loop stops its mathernatical  calculation  In both modes the PID s output value is still copied to the analog output     e   Auto mode  The PID makes calculations based on the difference between the input and the  setpoint resulting in changes to the output  which causes the input to move toward the  setpoint     e   Manual mode  The PID stops making changes to the output  but continues to write the PID  output to the analog point  or configured destination for the PID output   Manual mode allows    PAC Control User s Guide    CHAPTER 6  WORKING WITH I O       PAC Control logic or an operator to control the PID output  which in turn is written by the PID  loop to the analog point  or configured destination of the PID output      NOTE  If the value of the analog point or configured destination is changed  it will be overwritten by  the P
315. he data  Notice that the  Instruction column  at right  shows the line number the operand appears in when it is in  OptoScript code     3  To print the data  click the Print button on the toolbar  To save it to a text file  click the Save  button  To search the data  click the Search button  When finished  close the window     Viewing and Printing a Bill of Materials    You can view and print a bill of materials  BOM  that lists all the I O units and I O modules  analog  and standard digital  required to run the strategy   Special purpose modules  such as serial and  high density digital modules  are not included in the BOM      1  To produce a BOM for a strategy  open it and select File  gt  View Print  gt  Bill of Materials   PAC Control processes the data and puts it in the Bill of Materials window     190 PAC Control User   s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Save Search    Dnr     TITLE  Bill of Materials  STRATEGY  Cookies  DATE  02 15 05 TIME  11 15 13    Brains  l SNAP Mixed Ultimate I 0  SNAP UP1 ADS     Digital Input Modules  1 SNAP IDCSD  2 5   28 VDC    Digital Output Modules  l SNAP ODCSSRC  5   60 VDC Source       Analog Input Modules  l SNAP AICTD    l SNAP AIV    Analog Output Modules  l SNAP A0V 27    Totals  Total Brains  1  Total Modules  5    NOTE  Controllers  power supplies  and mounting racks are not specified   Contact your local distributor or Opto 22 for help or to purchase products        You may need to resize the window and use the
316. he difference between  the two values is 1 0  and 1 0 compared to one of the compared values  2 097 151 0  is too small  it is  less than one part per million    In this case  2 097 152 0 divided by 1 000 000 is 2 1  If the difference between the two values is at  least 2 1  then the equality comparison is guaranteed to be correct  So if 2 097 152 0 and 2 097 149 0  were compared for equality  the result will indicate they are not equal  because the difference  3 0  is  greater than one part per million  2 1   Any time the difference is at least one part per million  the  result is guaranteed to be accurate  If the difference is less than 1 PPM  it may or may not be  accurate    One method that programmers use to work around this issue is to subtract one float from the other  and then compare the absolute value of the result to a limit        For example    Float Diff   Floatl   Float2    If  AbsoluteValue Float Diff     1 0   then  SetVariableTrue  EqualityFlag      Else  SetVariableFalse  EqualityFlag      Endif    Helpful Links for More Information   From Wikipedia  the free encyclopedia  http   en wikipedia org wiki IEEE_754  Real numbers  http   en wikipedia org wiki Real_number   Good example  http   en wikipedia org wiki Single_Precision   Rounding error  http   docs sun com source 806 3568 ncg_goldberg html    Comparing floating point numbers   http   www cygnus software com papers comparingfloats comparingfloats htm    Mixing and Converting Integers and Floats    An 
317. he drop down list  In the  Replace With Type and Name fields  choose the operand you want to use instead         To search for an instruction  click Instruction  Click Action or Condition  and choose the  instruction you want to replace from the Find drop down list  In the Replace With  drop down list  choose the instruction you want to use instead         To search for a substring within tag names  click Tag  In the  Find what  text box under  Substrings  enter the substring you want to replace  In the  Replace with  text box  enter  the replacement text  For example  if you have several tag names that contain the  substring   Generic  such as nGenericCount  fGenericTemperature  and diGenericInput  you  could replace  Generic  with  Station  and the tagnames would become nStation 1 Count   fStation1Temperature  and diStation 1 Input     4  Click Find Next     When the first occurrence of the operand or instruction is found  the Instructions dialog box it  appears in is displayed   5  To replace this occurrence  click Replace  To skip it and find the next one  click Find Next     If you are replacing operands  you can replace all occurrences at once by clicking Replace AII  If  you are replacing instructions  you must verify each one    6  If the Edit Instructions dialog box appears  make any necessary changes and click OK to save  them before moving on    7  When replacements are finished  close the Find and Replace dialog box     Legacy Options    196    Because our focus i
318. he new  strategy  To turn off a PID loop  open PAC Manager and use Inspect mode to change the PID s  algorithm to None     Each PID loop must be individually configured and tuned     Configuration steps start in    Adding a PID Loop    on page 135  and tuning steps are described in     Inspecting and Tuning PID Loops  on page 146  For additional information  see  PID   Ethernet  Commands    on page 300  and Opto 22 form 1641  OptoTutorial  SNAP PAC PID     Adding a PID Loop    1  With the strategy open and in Configure mode  double click the I O Units folder  not the  individual unit s icon  on the Strategy Tree     The Configure I O Units dialog box opens     I Configure I O Units         Name Type Port Address    Watc    Enabled   Add       Mixed ID  Unit     SNAP PAC R1 Ethem   10 255    Disabled Enabled      Sprinkler_B SNAP PAC R1 t Disabled Enabled   Modify     Sprinkler Control  SNAP PAC R1 Ether    Disabled Enabled     Delete    120 Points       PID Loops             2  Select the I O unit the PID will be on  and click PID Loops     I Configure PID Loops    10 Unit  B rinkler B v Type  SNAP PAC R1    Name Input Set  Out   Mode En    Ref  Desc     Not    mg  Not     Not     Not     Not     Not     Not     Not                      3  Double click the lowest unused number   The Add PID Loop Dialog appears     PAC Control User s Guide 135    136    CONFIGURING PID LOOPS       Complete the fields as described in    Add PID Loop Dialog Box  below     Click OK     The new PI
319. he strategy     Now compile and debug the strategy   See Chapter 7  Working with Strategies for more information  and step by step procedures  If you have problems  see Appendix A  Troubleshooting   If you have    PAC Control User s Guide    BASIC RULES       multiple charts  debug each one separately and then debug the strategy as a whole  It is easier to  find errors in one flowchart than in a group of interrelated ones     Make sure the connections between charts are accurate  For example  is a chart started at the  correct block in another chart     Use the debugging tools discussed in Chapter 6 to find errors by stepping through a chart and  setting breakpoints to discover which block or line contains the problem  And if you ve tried  everything and it still doesn t work  contact Opto 22 Product Support   See page 4      Using and Improving the Strategy    Any strategy is one of several possible ways to solve a control problem  One way may be more  efficient under some circumstances  another way may be better for others  As you use the strategy  over time  as control needs change  and as you become more knowledgeable about PAC Control   you ll find ways to make the strategy better     Basic Rules    The sprinkler strategy we just created is a simple example  This section gives basic rules to keep in  mind when you re solving more complex control problems     When you create a new PAC Control strategy  a Powerup chart is automatically included  You add all  the other char
320. heel  there are several other ways to zoom out  too  You can  right click on the chart and select Zoom from the pop up menu  You can select Zoom Out  from the View menu  You can press the   or   keys on the keyboard  After zooming out  the  chart looks something like this     Til c ohartdrop c the dough and ohlp c on te conveyor belt  The beltmuctbe running between 60  and 8636 ofmax rpm     The Powerup ohart cirte  dicohart    Tic ohartrune  ice fie  program hac been chried            Brea or     0                         You can zoom back in if you wish by holding down the CTRL key and moving the mouse wheel  down or one of the other methods     The chart s status bar indicates that it is running  but we can t see much happening     PAC Control User s Guide    RUNNING THE STRATEGY       7  Click the Pause Chart button i    One of the command blocks appears with hatch marks   8  Now click the Step Over button tr     The next command block is hatched     9  Continue clicking and watch how the program proceeds from Speed OK  to Drop Dough to  Drop Chips to Back to  5peed OK   and back up to Speed OK     A pulsating green border appears around a block when the commands inside the block are  being executed  While you are stepping through  and anytime the Pause Chart button is  clicked  the chart status indicates Step On     10  Click the Pause Chart button again to run the strategy at full speed   Step Off now appears in the chart status bar     Auto Stepping    The final steppi
321. her  variables later if necessary                 Variable Needed Type Name in PAC Control  Hour of the day Numeric  32 bit integer  Time_of_Day   Day of the week Numeric  32 bit integer  Day_of_the_Week  Humidity Numeric  float  Humidity   Down timer Timer Timer                   Creating PAC Control Charts and Adding Instructions    If you have already drawn the process in a flowchart  this step will go faster  PAC Control is based on  flowcharts because they are a natural way to show a control process  And the block names and  instructions you add to charts   just like the names of variables   are in normal  everyday language    For more information and step by step procedures  see Chapter 8  Working with Flowcharts and  Chapter 9  Using Variables and Commands       The difference between the flowchart you drew before and the chart you create in PAC Control is  that the flowchart was designed for human beings  but the PAC Control chart must be more  detailed so the computer can follow it     Because the chart is more detailed   and because most control processes are far more complex  than our sprinkler system   you will usually create multiple charts for a PAC Control strategy  Break  the process down into logical chunks  or modules  and then create a chart for each module  A  modular design makes it easier to test and to update your strategy     PAC Control User s Guide    STEPS TO DESIGN       Even for a simple process like our sprinkler control  there is no single    co
322. her under one name     One or both target addresses  primary and secondary  can be enabled  but only one address  the  active address   will be used by the controller at one time  For link redundancy  both the primary and  secondary addresses must be enabled  When an I O unit is configured with two IP addresses  the  default is for both to be enabled and the primary address to be active     One address is always active  If communication fails through the primary address  the control engine  automatically switches to the secondary address  It continues to use the secondary address until  communication fails through the secondary address or until you change the active address using  Set Target Address State  for one I O unit  or Set All Target Address States  for all I O units on the  control engine      You may also want to use these commands to disable one address  for example if you are doing  maintenance or repair on a network segment and need to switch communication to another  segment temporarily  Disabling one address  of course  means that you no longer have link  redundancy     PAC Control User   s Guide 287    I O UNIT COMMANDS       288    If both addresses are disabled or unavailable  then communication is not possible and  communication to the I O unit becomes disabled  If both addresses are disabled  and you want to  bring the I O unit back online  you must first enable one or both of the addresses and then enable  communication to the I O unit     You can find ou
323. his block first resets  the on latch triggered by the bad cookie  so that the next cookie won t be marked bad  too  The  block then turns on the reject valve  The valve stays on for two seconds before being shut off   Let s decrement the counter after the cookie is gone and the valve is shut     Scroll down and click on the open spot  below the other instructions   The highlighted line marks the position of the next command to be added   Click Add     1 Add Instruction    Instruction     Absolute Value    Comment                Type Name  of  All Valid Types   lap oughVesselPressure       Put Result in  All Valid Types vl  aoConveyorS peedControl          You can use PAC Control without a mouse  and to demonstrate how  we ll use only the  keyboard to enter data in this dialog box     Type dec in the Instruction field     The Decrement Variable command appears  since it s the first command that starts with that  text pattern  This is the command we want to use     Press TAB twice to move to the Comment field  Type in a comment     Press TAB again to move to the Type field  Press the down arrow on your keyboard twice to  select Integer 32 Variable     Press TAB again to advance to the Name field  and then press the down arrow until you see  nCookie Counter     Press TAB again and notice that an outline appears on the OK button           PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       An outlined button means that pressing the space bar or ENTER is equivalent t
324. ht mouse button  and choose Detail from the pop up  menu   The Select Continue Block Destination dialog box appears  listing all blocks in the chart     I Select Continue Block Destination  x        Block Id    2 Condition  Block 0 Action  Humidity  lt 100     Condition  Read Hygrometer Action  Sprinklers off  Condition  Sunday or Wed    Condition  Timer expired  Condition  Tum off sprinklers Action  Turn off sprinklers Action  Turn on sprinkle    Action  Wait 23 hrs Action  Wait 24 hrs Action  Wait 5 sec Action  Wait 60 sec Action                2  Click the destination block and click OK     Viewing and Printing Chart Instructions    To view or print commands in a chart  see    Viewing and Printing Strategy or Subroutine Commands     on page 187     PAC Control User s Guide 241    VIEWING AND PRINTING CHART INSTRUCTIONS       242 PAC Control User   s Guide       10  Programming with  Commands    Introduction    Commands  or instructions  in PAC Control are roughly grouped by function  This chapter tells you  what you need to know about each group in order to program your PAC Control strategy effectively   For detailed information on using a command  see the PAC Control Command Reference     In this Chapter    Analog Pot Combpmabitis   ies  PR NANA ON E cae Remeras  Communication Commands  Control Engine Covmmateds        eene  Digital Point CTAN S cia  Error Handling Commands        I O Unit Commands              s   1 0 Unit   Event Message Commands              s   1 0 Un
325. ic PID Loop   Disable Event Reaction Group   Disable Mistic PID Output Tracking in Manual Mode  Disable Mistic PID Output   Disable Mistic PID Setpoint Tracking in Manual Mode  Disable Scanning for All Events   Disable Scanning for Event   Disable Scanning of Event Reaction Group   Enable Communication to Event Reaction   Enable Communication to Mistic PID Loop   Enable Event Reaction Group   Enable Mistic PID Output Tracking in Manual Mode  Enable Mistic PID Output   Enable Mistic PID Setpoint Tracking in Manual Mode  Enable Scanning for All Events   Enable Scanning for Event   Enable Scanning of Event Reaction Group   Event Occurred    Event Occurring    Event Scanning Disabled    Event Scanning Enabled    Event Reaction Communication Enabled   Event Reaction Group Communication Enabled   Get Analog Filtered Value   Get Analog Square Root Filtered Value   Get Analog Square Root Value   Get Analog Totalizer Value   Get  amp  Clear Analog Filtered Value   Get  amp  Clear Analog Totalizer Value   Get  amp  Clear Event Latches   Get  amp  Restart Off Time Totalizer   Get  amp  Restart On Time Totalizer   Get  amp  Restart Period          Get Event Latches   Get Frequency   Get Mistic PID Control Word   Get Mistic PID D Term   Get Mistic PID   Term   Get Mistic PID Input   Get Mistic PID Mode   Get Mistic PID Output Rate of Change  Get Mistic PID Output   Get Mistic PID P Term   Get Mistic PID Scan Rate   Get Mistic PID Setpoint   Get Off Time Totalizer   Get On Time Totalizer  
326. icate object names 373    E  editing  See changing  EEPROM  See flash  elapsed time 181  email 269  276  error  cannot delete item 362  copy compile errors 167  queue 103  372  status codes 373  TCP IP cannot connect 365  types 371  See also troubleshooting  error handling  commands  instructions  286  programming example 80  error lookup 371  Ethernet  connections 256  link redundancy 94  commands for 287  ports 256  Ethernet I O units and commands 197  example  case statements 82  323  complex operations 325  control system 44  creating messages to display on screen 79  error handling chart 80  File communication handle 259  flag lock 83  FTP communication handle 263  if statements 324  loops 322  mathematical expressions 319  pointers  indexing  85  repetitive actions 81    serial Communication handle 267  string building 310  320  string data extraction 309  string formats 308  string table 308  subroutine parameters 353  TCP communication handle 253  timer 83  exiting  See closing  exporting  chart 215  I O configuration 115    F    File communication handle 257  examples 259  file system on the brain  moving files via FTP 263  saving files to flash 280  finding a block in a chart 62  flag lock example 83  flash memory 141  saving files to 280  saving strategy to 165  float  IEEE 296  floating point  converting to integer 297  converting to string 312  definition 49  in logic 294  variable  definition 218  flowchart  See chart  flow through logic 76  follow debugger step
327. iew Print I O Point Mappings dialog box  select the report style  either Formatted or  Comma separated  and select the position and mappings types  then click OK     A report window appears     Bi Cookies   Point Mappings    TITLE  I 0 Point Mappings  STRATEGY  Cookies  DATE  04 07 08 TIME  12 36 50    Point mappings for I O Unit  Mixed IO Unit    I O POINTS    diDoughLevelSwitch  diChipLevelSwitch  dilnspectionPassFailSwitch  diEStop  doDoughPressureControlValve  doDoughDispenseValve  doChipDispenseValve  doRejectValve  aoOvenTemperatureControl  aoConveyorSpeedControl  aidvenTemperature  aiboughVesselPressure    OCOOrFOWNFOWNFO  ANWOTHA Qo OI lO    BR       What the columns mean              MOD The module number on the rack   CH The channel number within the module  4 4 channel mapping   8 8 channel mapping                Searching and Replacing    You can search a chart  subroutine  or strategy for missing connections  empty condition blocks  or  any command or operand  An operand is anything that can be affected by a command  including  charts  I O units  analog points  digital points  and all kinds of variables  Searching includes  OptoScript code within OptoScript blocks     You can also replace instructions or operands with similar items     Searching    You can search a strategy or one of its charts  or you can search a subroutine     192 PAC Control User   s Guide    1     CHAPTER 7  WORKING WITH STRATEGIES       Open the strategy or subroutine and select Edit  gt  F
328. il statement at the end     For Loops    For loops can be used to execute a list of statements a certain number of times     The for line sets up a predefined initial value and a predefined final value for the counter that  counts the repetitions  The line also includes the steps by which the counter gets from its initial  value to its final value  step 1 counts by ones  step 2 counts by twos  and so on   The step is  required  The counter can be any numeric variable or   O point  but its value will always be a whole  number  The initial value  final value  and step can be any numeric expression  they are converted to  integer 32s     CAUTION  A step value of zero creates an infinite loop  A float step value between    0 5 and 0 5 also  creates an infinite loop  since it is rounded to zero when converted to an integer 32     This example results in nVariable equaling 6                    nVariable   1  The counter starts at zero  and its final value is 4   for nCounter   0 to 4 step 1 4          It will count up one step at a time   nVariable   nVariable   1   next  lt  The for loop must end with next   339    PAC Control User s Guide    USING THE OPTOSCRIPT EDITOR       Other step amounts can be used  including negative    The forloop counter can be used in the loop    ps  i aps steps  Do not use a zero step  which creates an infi   This example sets the first five elements of table      nite loop  This example sets elements 0  2  and 4 of  ntTable to 10        Ind  TET A nt
329. ile name field  Then click Open   The watch window name appears in the Add Watch dialog box  and the new watch window  appears behind it    7  Inthe Add Watch Entry dialog box  click OK  Close the nCookie Counter view variable dialog  box   The new watch window looks something like this     PAC Control User   s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       Watch window Docking icon    IPAC Control Professional    nCookie Counter  DER     60  File Edit Control Engine Debug Chart Subroutine Mode Tools View Watch Window Help ax    Bin grim  s        Cookies me Type           amp  B Cookies   nCookie Counter Integer 32 Variable     amp j  C5  Control Engines       Subroutines Included   amp     amp  Chats   3 B Alarms  E 95 Dough Chip Control  E B   Dough_Vessel_Pressu    I  RB Interrupt    E  Q5   ven Inspection Conl  I  B   Powerup        Variables  E  E Numeric Variables  Oa  bStartFlag  PE diCookieMotionTir    TMR    bal fDoughPressureSe    bal fRamp  alue    Eur fSetpointMinusDe   iE nChartStatus   pal nCookie Counter  pal nCookieCounter s      a     gt   v   T Next 4  Prev     Ge ven Inspection Control   nCookie Counter                   PAC Control  Ready e       Since we want to be able to see chart windows as well as the watch window  let s dock the  watch window at the bottom     In the watch window  click the docking icon  8  in the upper right corner   The watch window moves to the bottom of the main window     PAC Control User s Guide    USING A WATCH WINDOW       I
330. ilnspectionPassF ailS witch a bad cookie  open reject  uu diEStop valve for 0 5 second   x  doDoughPressureControlV   x  doDoughDispenseValve          in doChipDispenseValve  T doRejectValve         zu ao venTemperatureContrc            EA anfinnveunrSneedControl I   gt      lt  rm            v  db Next  F Prev       Integer 32 Variable 472  ail  Digital Taput TT    State OFF OFF    On Latch On OFF    Off Latch OFF OFF          C  Program Files Opto22 PAC Project 8 1 Control Pro Examples ioCookies Cookies idb    20  Click the Step Over button as many times as it takes to get the hatch marks to the Blow Off  block  Now watch the nCookie_Counter IVAL value in the watch window as you click the  button again     A bad cookie was found  so the counter was decreased by one  At the same time  the on latch  was reset to Off  as you can also see in the watch window     PAC Control User   s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       IPAC Control Professional    Oven Inspection  Control  DER    i File Edit Control Engine Debug Chart Subroutine Mode Tools View Watch Window Help    Te A er se    Cookies       OU    pec     y  Gm Ponts temperature to 20       B O ER p degrees   EI   Event_01  EN i  Wig  ven Set oven temperature to  wb Mixed ID  Unit 450 degrees    amp   amp  Points  T diDoughLevelS witch  W diChipLevelSwitch  m dilnspectionPassFailSwitch If inspection station sees  Te diEStop 3 bad cookie  open reject  im doDoughPressureControlV    valve for 0 5 second   im doDoughDisp
331. imes it runs at high speed  sometimes at low speed  but before a box can be put on the  conveyor  the conveyor must be stopped  And it can only be stopped from low speed  not from high  speed  Here5 a portion of a chart showing the case statements that control this process        l Instructions   Conveyer_Operation   Get conveyor s       Conveyor speed is  checked and moved           Conveyer_Operation    Conveyor_Speed_Sensor  Conveyor_Speed     copied  into a variable              Each condition block  checks for a particular  speed  This one checks for  high speed  3      If speed is too high  it is  shifted down to the next  level  until the conveyor is  finally stopped and the  box can be put on     2  Conveyor_Speed          Next Block  Previous Block              The example above shows three cases  because there are three possible speeds and each speed    demands a different action     If you had only two possibilities   for example if the box could also  be put on the conveyor at low  speed  you could handle both  possibilities within one condition  block  For example  you could put  two Equal  commands in the  same condition block  and check    the Or operator  as shown at right     PAC Control User   s Guide        Instructions   Conveyer_Operation   Conveyor stopped        Is Conveyor_Speed  Equal   To 1    Is Conveyor Speed  Equal   To 2    Next Block  Previous Block          Operator   AND  OR       Or operator    CHAPTER 4  DESIGNING YOUR STRATEGY       Using a
332. in  Add Variable Dialog Box    below     6  Click OK     The Add Variable dialog box closes and the new variable appears in the Configure Variables    dialog box     Add Variable Dialog Box    This dialog box varies depending on the type of variable     Add Variable    Name           Description          Type  String        w  String Width             Initialization    O Initialize on strategy download       Initialize on strategy run    O Persistent          Initial Value           Field at D varies    D depending on    variable type     The figure above shows the Add Variable dialog box as it appears for string variables  Fields are  Slightly different for other variables     A   Name  Enter a name for the variable  The name must start with a letter and may contain  letters  numbers  and underscores   Spaces are converted to underscores      B   Description   Optional  Enter a description of the variable     C   Type  In the Type drop down list  select the type of data for the variable  Possible types are  shown in the following table  For more information  see    Types of Data in a Variable    on page 218     Numeric    Numeric table    Integer 32  integer 64  floating point  up or down timer    Integer 32  integer 64  or floating point             String String  String table String  Pointer Pointer to any data type       Pointer table    Pointer to any data type  and the data type may change  over time       Communication handle          Communication handle          D   
333. ind   The Find dialog box appears     Search Scope       f  O Local    Search For   Operand     Instruction     Missing Connections    Empty Cond  Blocks    Type  Name    Digital Output v  doRejectValve             Or  if the item you want to find is listed in the strategy tree  such as a variable  table  or point   right click the item and select either Find in the pop up menu     3    Points   T diD oughLevelS witch   Te dilnspectionPassF  w diEStop   x doDoughPressure  uu doD oughDispense  T doChipDispenseV Replace  5       Point name    Configure     Delete       The item appears in the Find or dialog box automatically     Search Scope       f  Q Local    Search For     S    perand O Instruction     Missing Connections    Empty Cond  Blocks    Type  Name    Digital Input v    diChipLeyelSwitch             Point name    Under Search Scope  to search the entire strategy  click Global  To search one chart only  click  Local and choose the chart name from the drop down list     If you are searching a subroutine  the search is Local and the subroutine s name is shown   Under Search For  choose one of the following         To search for a chart  an   O unit or point  or a variable  click Operand  In the Type and Name  fields  choose the operand you want from the drop down list         To search for an instruction  click Instruction  Click Action or Condition  and choose the  instruction you want from the drop down list     PAC Control User s Guide 193    SEARCHING AND REPLACING
334. ing I O unit configuration 140  scratch pad commands 291  searching 192  secondary address 118  segmenting control network 93  selecting  block or text block 210  connection line 210  Send Email  timeouts 276  279  send email 269  276  serial Communication handle 266  serial communication module  communicating with 249  253  255  configuring 130  serial devices  communicating with 266  serial I O unit  changing baud rate 119  changing baud rate and mode  Pro  119  setpoint  for PID 134  setting hex display mode 65  shortcuts  keyboard 67  Simple I O units and commands 197  simulation commands 305  sizing columns in a dialog box 63  SNAP PAC redundancy option 99  SNAP PAC S2  RTS CTS 268  SoftPAC  adding a control engine 23  archiving strategies 106  compatible I O units 6  file storage 257  link redundancy 95  saving files to flash 280       PAC Control User s Guide       software  launching from PAC Control 66  sorting columns in a dialog box 63  starting a strategy 175  status codes 373  step into 178  step out 178  step over 178  stepping  inside blocks 178  one block at a time 178  through a chart 178  within a block 176  stopping  strategy 175  strategy  archiving  to computer 166  to control engine 106  dosing 163  164  compiling 24  166  compiling without downloading 169  creating 161  debugging 176  debugging when using OptoScript 346  definition 51  161  deleting control engine 100  designing 69  76  disassociating control engine 100  downloading 166  170  downloadin
335. inside  the current block  so youcan step one  command at a time     The red arrow indicates the command  that will be executed next                 10_Enabler_Chart    e w w ee a    s P c 4 4 Check pointer table element to see     JN   W we  if  ptIO Units nIO EnablerIndex     nui   ok d ow      eS yok es  4 No I O unit is loaded in the ptIO    ntIO UnitCommEnableStatus nIO Enablei         else      IO Unit pointer is valid at th   Soc om es Yo   NumberToString nIO EnablerIndex  sIO           4 4 Get pointer to IO Unit  plO_UnitEnetPAC   ptIO Units nIO Enal             H                      Check to see if the user wants tl    m    nt10  UnitUserDisable nIO   Enabler      TeTalini tCeammRnsh led fant ni  p SS     gt      Ln 86  Col 1   141 4  gt  ef  Chart A OptoScript Block   10 EnableritEnet  amp  PAC    Id  2 n                   The small gray tabs at the left The white tab shows you where  ofthe white tab show how you are  inside a chart  a block  or a  you got to where you are  subroutine called by a chart     6  To move from line to line  click either the Step Into or the Step Over button     If a command within the block calls a subroutine  Step Into takes you into the subroutine  Step  Over skips over the subroutine     7  To step from a command inside a block and go to the next block  click Step Out IF     Clicking Step Out when you are on a block  rather than inside it  unpauses the chart  In a  subroutine  clicking Step Out takes you out of the subroutine     Aut
336. instructions are sufficient  but you can use  Comment  Single Line  if you need more room for explanations     e Comment  Block  comments out instructions  In other words  it tells the strategy to  temporarily ignore certain instructions within a block  It can be useful in debugging or for  saving work when a strategy is temporarily changed     To use it  place one Comment  Block  command at the beginning of the area you want to  ignore  and place another Comment  Block  command at the end of the area  If you do not place  the second Comment  Block  command  all the remaining instructions in that block are  ignored  Areas that are commented out appear in the Instructions dialog box as gray     PAC Control User s Guide 299    PID   ETHERNET COMMANDS       PID   Ethernet Commands    The following commands are used with PID loops on SNAP PAC I O units  Since PID loops are  configured and tuned in Configure Mode while creating your PAC Control strategy  you may not  need to use these commands  PID commands are typically used to change input or output location   for example  if the input is on another I O unit  or to change tuning parameters based on a change  that occurs while the strategy is running  such as a recipe change      300    For steps to configure and tune PIDs  see  Configuring PID Loops  on page 134  For more  information about PID loops  how to tune them  and how to use them in PAC Control  see Opto 22    form 1641  OptoTutorial  SNAP PAC PID     Get PID Configurat
337. ion Flags   Get PID Current Input   Get PID Current Setpoint   Get PID Feed Forward   Get PID Feed Forward Gain   Get PID Forced Output When Input Over Range  Get PID Forced Output When Input Under Range  Get PID Gain   Get PID Input   Get PID Input High Range   Get PID Input Low Range   Get PID Max Output Change   Get PID Min Output Change   Get PID Mode   Get PID Output   Get PID Output High Clamp   Get PID Output Low Clamp   Get PID Scan Time   Get PID Setpoint   Get PID Status Flags    Whatis a PID     Get PID Tune Derivative   Get PID Tune IntegralSet PID Configuration Flags  Set PID Feed Forward   Set PID Feed Forward Gain   Set PID Forced Output When Input Over Range  Set PID Forced Output When Input Under Range  Set PID Gain   Set PID Input   Set PID Input High Range   Set PID Input Low Range   Set PID Max Output Change   Set PID Min Output Change   Set PID Mode   Set PID Output   Set PID Output High Clamp   Set PID Output Low Clamp   Set PID Scan Time   Set PID Setpoint   Set PID Tune Derivative   Set PID Tune Integral    A proportional integral derivative  PID  control systern  often referred to as a PID loop  monitors a  process variable  compares the variable   s current value to a desired value  a setpoint   and calculates  an output to correct error between the setpoint and the variable  Because the calculation is  complex  it is done by a mathematical formula that is adjusted  tuned  for each PID loop  The  mathematical formulas vary  but all PID systems share 
338. ion Technical Note     Saving and Closing    CAUTION  Once a strategy is opened in PAC Control Professional  it can no longer be opened in PAC  Control Basic     Saving the Strategy and All Charts    To save all your work quickly  choose File  gt  Save All  The strategy and all modified charts and  subroutines are saved     Saving the Strategy and Some Charts   NOTE  You cannot save changes to a subroutine this way  To save a subroutine  use File  gt  Save All  or use   Subroutine  gt  Save or Subroutine  gt  Save All    1  To save changes to some charts but not others  click the Save Strategy button laf on the  toolbar  or choose File  gt  Save Strategy  or press CTRL   S      The Save Strategy dialog box appears  highlighting all charts modified since the last save  In this  example  two charts have been modified     PAC Control User s Guide 163    SAVING AND CLOSING       I Save Strategy    Save strategy and selected charts     Digital Control Select All  Flag Example Chart    Clear All                   2  To save some charts and not others  press CTRL and click any charts you don t want to save     You can also click Clear All to select none of the charts  or click Select All to select all of the  charts     3  When only the charts you want to save are highlighted  click OK   The strategy and the highlighted charts are saved     Saving the Strategy to a New Name    1  To save the strategy and all its charts under a new name  choose File  gt  Save Strategy As     2  Inthe
339. ion handles  Communication is defined when the I O unit is configured     NOTE  Be sure to use a single communication handle for each of a controller s physical serial ports used  with the subroutines  If two charts were to run simultaneously while sharing an open communication  handle  it is possible for one serial port to transmit data  on the wire  at the same time the remote device  is transmitting a response     Serial Communication Handle Examples    To enter a serial communication handle  you can use either of the following two methods for SNAP  PAC controllers     Method 1  With this method  the value for the serial communication handle is in the format     ser  lt port number gt   lt baud rate gt   lt parity gt   lt data bits gt   lt stop bits gt     SNAP PAC S1  0  1  or 2  port number SNAP PAC S2  0  1  2  or 3  SNAP PAC R1 and R2  0       230400  115200  76800  57600  38400              paud rate 19200  9600  4800  2400  1200  or 300  parity n  O  or e  none  odd  or even    data bits 8or7   stop bits 1or2                Here is an example of a serial communication handle value   ser 0 115200 n 8 1  port 0  baud rate of 115 200  no parity  8 data bits  and 1 stop bit     To add a communication handle  see the steps starting on page 248  In the Add Variable dialog box   enter the communication handle value in the Initial Value field     PAC Control User s Guide 267    COMMUNICATION COMMANDS       268    Add Variable    Name  Serial_D evice  Communication Handle zm 
340. ion in a strategy  such as the  parameters for communication  temperature reported by a thermocouple  the name of a chart  or a  group of words and numbers to be sent to a display  The information a variable represents is called  the value of the variable  As a strategy runs  the variable   s name remains the same  but its value may  change  For example  the value of a variable named Oven_Temperature may change several times  while its strategy is running  but its name remains Oven_Temperature     A variable stores one of six types of data  floating point  integer  timer  string  pointer  or  communication handle  When you create the variable  you designate the type of data it contains     The instruction shown below is for the condition block  Button D3 On  This block contains only one  instruction  As you look at the chart  you can see that the answer to the question in the instruction  determines whether the process flows to Turn LED D7 On or to Turn LED D7 Off     PAC Control User s Guide    PAC CONTROL MAIN WINDOW       Digital_Control    Instruction for the bloc  named Button D3 On        Previous Block    Operator     AND  Oor       PAC Control Main Window    With a strategy open  the main window in PAC Control Basic and PAC Control Pro looks similar to  this     PAC Control title bar PAC Control Professional  Menu bar  File Edit Configure Chart Subroutine Compile Mode Tools View Window Help    Toolbar Di confio    oebuo Cion ino prega 0 5050 085       Sprinkler Contro
341. ion that came with your  controller        230400  115200  76800   baud 57600  38400  19200  9600                 4800  2400  1200  or 300    PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS                parity E  e  O  o  N    n  9    A value of 9 is used for RS 485 multi drop communications   data 8 7 The number of data bits   stop 1 2 The number of stop bits   mode 0  522    522 enables I O mode  0 should be used for everything else        0 turns rts cts off    1 enables symmetrical rts cts flow control    2 enables asymmetrical rts cts flow control  By default the sys   tem waits up to one second for cts to be asserted     rts cts 0  1 2       timeout float  seconds                   If a parameter is not specified  the current value is used  so you should include any parameter whose  current value you are not sure of     IMPORTANT  As described earlier in this section  be sure to use PAC Manager to set the control function  of any port you want to use to None  Otherwise  you will get a  20   Resource Busy   error  For more  information  see the PAC Manager User s Guide     Using Serial Communication Handles in Your Strategy    To use a serial communication handle in your strategy  first use the command Open Outgoing  Communication  Verify that the communication handle opened by using the condition  Communication Open  Then use Transmit  Transfer  and Receive commands to send or receive data  as necessary  Remember to check for any errors  When you hav
342. it    Memory Map Commands               e 290  I O Unit   Scratch Pad Commands              s 291  Logical Commands  Mathematical Commands  Miscellaneous Commands                 tts  PID   Ethernet Commands  Pointer CommPri  litis    eee ttis  SUTTON COTAN secet tee ettet reete  String Commands  Tire Db COATED eee ttes  TEANG COMA       E       M                PAC Control User s Guide 243    ANALOG POINT COMMANDS       Analog Point Commands    The following commands are used with analog points     Offset and Gain Others  Calculate  amp  Set Analog Gain Get HART Unique Address  Calculate  amp  Set Analog Offset Receive HART Command  Set Analog Gain Receive HART Command Burst  Set Analog Offset Send Receive HART Command   Set Analog Filter Weight  Minimum Maximum Values Set Analog Load Cell Fast Settle Level  Get Analog Maximum Value Set Analog Load Cell Filter Weight  Get Analog Minimum Value Set Analog TPO Period    Get  amp  Clear Analog Maximum Value    Get  amp  Clear Analog Minimum Value    Offset and Gain Commands    The easiest way to set offset and gain is to do so when you configure analog points in PAC Manager   using the Calibrate button in the Configure I O Points dialog box     You can also set offset and gain in PAC Control  If you already know the offset and gain for a point   you can use the commands Set Analog Offset and Set Analog Gain  If you do not know the offset  and gain  you can use the commands Calculate  amp  Set Analog Offset and Calculate  amp  Se
343. iustto  00      normal size    OB  i   t s     Page  Print Header       In the Graphics Scaling area  choose whether you want each flowchart to print at a fixed  percentage of normal size or to span a specific number of pages     To print at a fixed percentage  click the Adjust To option and specify any scaling from one  percent to 1 000 percent    You can type in a number or click the arrows to go up or down to the next increment of 25  percent  Typically  percentages between 50 percent and 200 percent work the best     To print to a specific number of pages  click the Fit To option and select the number of  pages wide and tall you would like each chart to print    If you choose one for each dimension  each chart prints to a single page  For each  dimension  you can specify any integer between one and 255  but be careful  Selecting  values of five and five  for example  would cause each chart to print five pages wide and  five pages long  a total of 25 pages      Recommended  To print a header on each page  put a check mark in the Print Header box     The header lists the strategy name  chart or subroutine name  date and time of printing  page  number  and column and row of the page with respect to the full chart printout     Click OK to save your settings     Previewing a Flowchart Printout    1     To see how a chart or subroutine will print before actually printing it  open the chart or  subroutine window     From the Chart or Subroutine menu  select Print Preview Graphic
344. ived on the control engine  J   Run Stop  Start or stop the active strategy    K   Store to Flash  Click to store either the active or alternate strategy to flash memory  Only one  strategy at a time can be stored in flash memory  This button is enabled if there is a strategy strored  in RAM  even if the strategy is currently stored in flash  See Burned in flash  N  on this dialog box   L   Alternate  Name of the alternate strategy  and the date and time it was downloaded  M   Switch and Run Switch  Click Switch and Run to make the alternate strategy the active  strategy and run it in the control engine  Click Switch to make the alternate strategy the active  strategy without running it    N   Stored in flash  Shows whether a strategy is currently stored in flash memory   O   Autorun  Click to indicate whether the strategy should automatically run when the control  engine is restarted  The strategy must be stored to flash to autorun  See Store to Flash above Saving    a Strategy to Flash    on page 165     P   Loop Time  Time required to gather the inspection data from the control engine  the average  time taken for a single transaction     Q   Comm Errors  Any communication errors    Viewing the Message Queue    The message queue holds error  information  and warning messages  All may be helpful in  troubleshooting  When a message is placed in the queue  a blue INFO  yellow WARNING  or red  ERROR box appears in the PAC Control status bar  as shown in the following diagram   
345. jeot  valve fbr 0 6 ceoond         3  Shortcuts             Oven_Inspection_Control    Set oven temp  350 degrees         3  Shortcuts                Panning a Chart    The pan tool allows you to easily pan around a flowchart     1  Using the pan tool        click and hold to grab a portion of a chart     You can access the pan tool either from the toolbar or by holding down the space bar and  clicking the left mouse button     PAC Control User s Guide    WINDOWS AND DIALOG BOXES IN PAC CONTROL          wnire   is out of spec  set oven   temperature to 200  Pan tool degrees     Set oven temperature to  450 degrees     If inspection station sees  a bad cookie  open reject  valve for 0 5 second        2  Movethe pan tool to a new position and release   The chart moves to a new position         4    This chart maintains the oven temperature and re  cookies that do not pass visual inspection     The Powerup chart starts  this chart     Pan tool          Redrawing a Chart or Subroutine Window  If you want to move quickly to a particular block  you can redraw a chart or subroutine window with  any block at its center     1  With a chart or subroutine open in the active window  select View Center On Block  or  right click in the chart or subroutine window and choose Center On Block from the pop up  menu     The Center On Block dialog box appears  listing all blocks in the chart     PAC Control User s Guide    CHAPTER 3  WHAT IS PAC CONTROL        I Center On Block       Block Id   I
346. jooq  q JON     Ajuo sueajooq  q 1oN                                         0  lt  gt  X  ON    0  lt  gt  X  JON 5p LON Papa  rere ageneso  MO A sox OX IBIBO  Kore AT   C kmx on 0   Ajuo sueejooq  quo e Kllx  Ajuo sueejooq  quo e sa      eioN ees  YO 122160     0  lt  gt  A  10  0  lt  gt  X   0  lt  gt  A  10  0  lt  gt  X    K  gt X   z  x K  gt X   z  x jenbe 10 uey  1918946      x     x     x     x uey  J9jeo46    z  X   z  X      gt  X      gt X jenbe Jo uey  sso       X     X     X     X uey  SSO   Ke gt X K  j X     lt  gt  X     lt  gt  X jenbe jou  K xX A    K X   zz jenbo    u Ju2    oljeu     s     u     9 o  9y    s guuds  uu      Olay    S  u u2      Oly    s   zs    sjeas SuoissaJdxo Bus         S   ZS   Olly     S    ojeu   s Kdous       S   ZS    O0   9U    S       S   ZS      Olay    S                      v  2  3  O  Nn  D  N     I   B       o  UO  U   amp     OPTOSCRIPT COMPARISON WITH STANDARD PROGRAMMING LANGUAGES           G  lt    i oy                           ns ILI  s  lt  1  gun doo X6  lt  1  pun    Md    Z a     l eigeL Aw b t              y 30N ees  doo  3eedaJ     Za      ijeiqerA      H cs i   Z x     NaIgeLAW    Z   1  ijeiqeL AW  op og jeedei  pue       bel l MESES PUAN poe    ATA ae EIE    L l       Zal     i ejqer  A  z   12  JaqeLA    y 30N ees  doo  a IyYM  eee pe eels RRR i  Z         JelqelAw    Z   1    HeiqeL Aw Bi  op  G  gt  1  alym  6  gt  1  enum  S  gt    SUM  S  gt     eium  pue    X9N  xeu  a          A  gn o c       Helden m
347. k a connection that was locked by a dif  X  with the current lock on that port     Communication command didn t find the driver described in   203 Driver could not be found or loaded  the communication handle  Make sure driver name is not X  misspelled  for example  tcp must be lower case     407 File not found  Attempted to save a strategy to flash  but there was no strat   egy in RAM to save    412 TCP IP  Cannot connect error Ethernet    connect    failed  See page 365  x   417 Cannot open file File does not exist or filename may be incorrect   Invalid data range  Verify high value is Invalid data passed to driver  for example  a point number   430   X  greater than low value  larger than the maximum number of points on the rack     433 Object device already locked  Couldn t set the state of a chart  running  suspended  etc    because it   s already locked by something else    437 No acceptable socket interface found  Ethernet accept  attempted  but no more sessions are  available  32 total    377       LIST OF COMMON MESSAGES        438 Could not create socket     This error is generated when the controller has run out of  available TCP sockets  a limited resource   This is most  likely caused when the strategy is overaggressive when try   ing to establish TCP communications to other devices   When sockets are opened and fail or are closed  there is a  time period that must expire before the socket resource may  be reused  Sockets that are rapidly opened and closed will  
348. l                         13  Adding an I O Unit T  Adding I O Points     Configuring a Serial Module                       30  Changing Point Configuration    sess 30  Configuring PID Loops              34  Inspecting I O in Debug Mode    40  Inspecting and Tuning PID Loops    46  Using Watch Windows for Monitoring            57    Choosing a Configuration Tool    Configuring I O is one of your major planning steps in developing a PAC Control strategy  Generally  it s best to configure all I O units  points  and PID loops at once  before you start building flowcharts     There are two tools you can use for configuration  PAC Control and PAC Manager  These two tools  serve different purposes  but they overlap when it comes to configuring I O  The graphic on the next  page compares their functions     PAC Control User s Guide 113    CHOOSING A CONFIGURATION TOOL       PAC Manager Tasks    PAC Control Tasks   Assign and change      3   Configure 1 0     Configure     Program and   IP address C  ivi cust tn debug  Load firmware EH  A UO Station 1  So PC running PAC control logic  Configure communications  t Control can   and events EH  Point communicate with       the SNAP controller              I O can be configured in PAC Control   Ethernet based I O can also be configured in  PAC Manager and imported into PAC Control        I O units and points must be configured to match the PAC Control strategy you will run  You can  configure most I O units and point functions either in P
349. l     BAE       Strategy Tree       Bree     C3 Control Engines   Ey Subroutines Included     Charts    C variables      Numeric Variables      String Variables     Pointer Variables   C3 Communication Handles      Numeric Tables     String Tables      Pointer Tables        Yo units  m D Mixed IO Unit                v  db Next 4  Prev         Sprinkler  Control Mode          Status bar       PAC Control User s Guide    CHAPTER 3  WHAT IS PAC CONTROL        Since PAC Control uses standard Microsoft Windows conventions  you ll recognize the title bar and  menu bar and already be familiar with some of the menus  such as File  Edit  View  Window  and  Help  This section discusses some things that may not be familiar     Status Bar    The status bar at the bottom of the window shows you information about PAC Control  When you  move your mouse over the toolbar  a description of the button you re pointing to appears in the  status bar  The status bar indicates the mode PAC Control is in and indicates messages or errors  helpful in debugging    To hide or show the status bar  choose View  gt  Status Bar  A check mark next to the menu item  means the status bar will show  no check mark means it is hidden     Mode  You can run PAC Control in three modes  Configure  Debug  or Online  The current mode is shown in  the status bar  on the right  Toolbars and menus change depending on the mode     e Configure mode is used to create  modify  save  and compile strategies  flowcharts  and  sub
350. l  on page 94 for more information   In this case  you  can also choose whether the primary or secondary IP address will receive the strategy     To change the control engine that receives the downloaded strategy  follow these steps    1  Make sure the strategy is open and in Configure or Online mode    2  On the Strategy Tree  right click the name of the control engine you want to set as the active  engine   If its name does not appear in the Strategy Tree  follow the steps in  Configuring Control  Engines  on page 89    3  Fromthe pop up menu  choose Set Active   The active engine moves to the top of the list in the Strategy Tree     4  If the control engine is configured for Ethernet link redundancy  right click the name of the  control engine on the Strategy Tree again  From the pop up menu  choose Use Primary IP  Address or Use Secondary IP Address     Removing a Control Engine s Association with a Strategy    If you no longer want to use a control engine with a strategy  you can remove its association with  the strategy  This action does not delete the control engine s definition on your PC     CAUTION  Do not delete the control engine from within the Select Control Engine dialog box  Doing so  will delete it from the PC as well as the strategy     1  Make sure the strategy is open in Configure mode or Online mode     2  Onthe Strategy Tree  right click the name of the control engine you want to remove  From the  pop up menu  choose Delete     The control engine is no l
351. le commands  When you do  the  following commands become available in the strategy     Clear HDD Module Off Latches Get All HDD Module On Latches  Clear HDD Module On Latches Get All HDD Module States   Get  amp  Clear All HDD Module Off Latches Get HDD Module Counters   Get  amp  Clear All HDD Module On Latches Get HDD Module Off Latches   Get  amp  Clear HDD Module Counter Get HDD Module On Latches   Get  amp  Clear HDD Module Counters Get HDD Module States   Get  amp  Clear HDD Module Off Latches Set HDD Module from MOMO Masks  Get  amp  Clear HDD Module On Latches Turn Off HDD Module Point   Get All HDD Module Off Latches Turn On HDD Module Point             Enable mistic 1 O Units and Commands    If you re using legacy mistic hardware with a SNAP PAC S series controller and PAC Control  Professional  you should enable mistic I O units and commands  When you do  the following I O unit  types and commands will become available in the strategy     I O Units Types   G4D16R Mistic PID Loop  G4D32RS Digital Event Reaction  G4A8R  G4RAX Analog Event Reaction  B200 Event Reaction Group  B3000  Digital   B3000  Analog   B100  SNAP BRS                PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Commands     Clamp Mistic PID Output   Clamp Mistic PID Setpoint   Clear All Event Latches   Clear Event Latch   Convert Mistic I O Hex String to Float   Convert Number to Mistic I O Hex String   Disable Communication to Event Reaction   Disable Communication to Mist
352. ler  It includes three attachments  two JPG images       and this strategy   CRLF CRLF     Sincerely    CRLF     Opto Controller     LL    This blank denotes end of body   This is not included in the body        My image file  jpg      List of files to attach   Another image file jpg      A zip file zip            This blank ends the attachment list   Attachment jpg      This attachment will be ignored       A   Server Information  The server table must have each of these five entries in the order  shown in the example  Make sure all server information table elements are filled in     Here are the ways that you can specify the account and  from  names in element 0     No user account and no  from  arrstrServer 0              User Account only    from  uses the arrstrServer 0     MyAccount    account name              Account only  no  from   arrstrServer 0     MyAccount      from  only  no user account  arrstrServer 0      FromName    Separate account and  from  names arrstrServer 0     MyAccount FromName                  If you want to change the timeouts for transmitting  receiving  and connecting  you need to  add a sixth element  5   The default is 10 000 milliseconds  10 seconds  for each  For more  information  see  Setting Timeouts for the Send Email Commands  on page 276     For a corporate email account  use the server  port  and security values for the email server  you obtained previously from your network administrator     PAC Control User s Guide       9     CHAP
353. les  and charts  You cannot  add subroutine parameters or variables that are local to a subroutine     Depending on which element you add and how you add it  it may appear immediately in the  window  as shown here     PAC Control User s Guide 157    USING WATCH WINDOWS FOR MONITORING       ys       Watch 2 o DER       For some elements  the Add Watch Entry dialog box appears  so you can specify what to watch     tAdd Watch Entry       Name   Digital Control       Select Portions To Watch     Items in this area vary diss Select All  depending on the element Bros    you are watching  This Block Paused At  example shows a chart     Select Watch Window       4  If an Add Watch Entry dialog box appears  click to place or remove the check mark next to any  item  When all the items you want to watch are checked  click OK     The element is added to the watch window   The watch window is automatically saved     Opening an Existing Watch Window    If a watch window was open when you exited Debug mode  it will automatically open again when  you re enter Debug mode  To open other watch windows  follow these steps    1  Make sure the strategy is open and in Debug mode    2  Choose Watch  gt  Open    3  Navigate to the watch window you want to open and double click its name     The window opens in the position you left it     PAC Control User s Guide     Docked  watch window    Expand or collapse the  item by clicking the    or   sign in the box     CHAPTER 6  WORKING WITH I O       Worki
354. line  1 is equivalent to line  3  not to  2    ni   n2   n3   n4    nl  n2   n3    n4    nl   n2    n3   n4      Using Comparison Operators    All OptoScript comparison operators return an Integer 32 value of zero  false  or of non zero  true    OptoScript supports the following comparison operators for comparing two numeric values     NOTE  Except for the equal operator       the comparison operators can be used only with a numeric  expression  They cannot be used with a null which is not considered to be a number     Operator and Meaning Example      equal nVarl   nVar2    fFloat3    lt  gt  not equal nVarl   nVar2  lt  gt  fFloat3    lt  less than nVarl   nVar2  lt  fFloat3    lt   less than or equal nVarl   nVar2  lt   fFloat3    gt  greater than nVarl   nVar2  gt  fFloat3    gt   greater than or equal nVarl   nVar2  gt   fFloat3     More complex examples   nVarl    nVar2   2      fFloat3   9 5    nVarl    nVar2   2   lt   fFloat3   9 5      PAC Control User   s Guide    CHAPTER 11  USING OPTOSCRIPT       You can also use a comparison operator to test whether two strings are equal  For example   nVarl   sStringl    sString2     nVarl   sStringl     abc    nVarl   sStringl    stStrT1 0    nVarl   stStrT1 0     stStrT1 1      When you use a comparison operator in an if statement  it isn   t necessary to put the result in a variable  because the result is used  consumed  by the if   if  fICTD Input     Avg Temp  then  Fan A   0   endif    Using Logical Operators    All OptoS
355. load and test a new or updated strategy but still keep the original strategy available  You  can bring back the original very quickly  either by manually switching from one strategy to the  other  or   if the original is still burned to flash   by cycling power     You can use background downloading as an alternative to Online mode  which also allows you to  make changes while a strategy is running  The following table describes the differences between  Online Mode and Background Downloading     No Yes       Can you add variables  I O   and charts        Can you add and change  blocks  change instructions    Yes Yes  and edit existing charts        F   Only the edited charts are The entire alternate strategy is down   What is downloaded in        downloaded  All other charts loaded while the entire active strategy  Debug mode       keep running  continues to run     If you switch to the alternate strategy after  download  the strategy restarts with the  Powerup chart     Where does the strategy The affected charts restart at  restart after download  block 0                    PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES             When a chart is downloaded   the old one is not deleted  so  How is the controller mem  this consumes additional mem   ory affected  ory  To clear memory  the strat   egy should be stopped and then  compiled and downloaded     Controller memory is cut in half when  background download is set it in PAC  Manager  Also  one chart is 
356. lowing original string and the examples that follow     012 34 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                   String 1  S N A P PAIC                                                                   Move String  From OPTO string literal  To String  1 string variable    a    Results in  note that Move String erased the previous contents of the string      012 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                String 1  O  P T O                                                                       lt Length is   gt     Append Character to String    From 32 integer literal  represents a space   To String_1 string variable    Results in  note the space character in position 4      012 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21          String 1  O  P T O                                                                                  Length is    s    Append String to String  From 22 string literal  To String_1 string variable  Results in     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21       0  String 1  OJ P T O 2 2                                                                                lt     Length is        gt     Append Character to String    From 13 integer literal  carriage return   To String  1 string variable  Results in     012 34 5 6 7 89 10 11 12 13 14 15 16 17 18 19 20 21  String 1  OJ P T O 2 2        lt     Length is              PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Comparis
357. lse    ElselfStatement   gt  elseif   NumericExp   then  StatementListOrEmpty    Elselfl ist   gt  ElselfStatement   gt  Elselfl ist ElselfStatement    EndifStatement     endif    CaseList    gt  CaseStatement    gt  CaseStatement DefaultStatement    gt  CaseList CaseStatement    gt  CaseList CaseStatement DefaultStatement    DefaultStatement   gt  default    StatementListOrEmpty    PAC Control User   s Guide    APPENDIX E  OPTOSCRIPT LANGUAGE REFERENCE       break    CaseStatement   gt  case NumericExp    StatementListOrEmpty  break    SwitchStatement   gt  switch   NumericExp    CaseList  endswitch    ForStatement     for NumericVariable 2 NumericExp to NumericExp step NumericExp  StatementListOrEmpty  next    WhileStatement     while   NumericExp    StatementListOrEmpty  wend  RepeatStatement     repeat  StatementListOrEmpty  until NumericExp      PAC Control User s Guide 401    OPTOSCRIPT GRAMMAR SYNTAX REFERENCE       PAC Control User   s Guide       Index    A    action block  definition 202  action command  definition 49  active address 287  adding  analog point 125  command 235  in OptoScript 341  communication handle 221  digital point 122  I O unit 116  numeric variable 221  PID loop 135  pointer 221  pointer variable to watch window 232  string variable 221  table variable 224  table variable to watch window 233  235  text to chart 209  variable 221  variable to watch window 230  algorithms for PID loops 301  analog  adding I O point 125  changing I O while strateg
358. ly  access the Web site using the Help menu in PAC Control  Select Help  gt  Opto 22 on the Web  and  then select an online resource from the submenu     Product Support   If you have any questions about PAC Control  you can call  fax  or email Opto 22 Product Support    Phone  800 TEK OPTO  800 835 6786  NOTE  Email messages and phone  951 695 3080 calls to Opto 22 Product Support   Hours are Monday through Friday  are grouped together and  7 a m  to 5 p m  Pacific Time  answered in the order received    Fax  951 695 3017   Email  support opto22 com   Opto 22 website  www opto22 com    When calling for technical support  be prepared to provide the following information about your  system to the Product Support engineer     e   Software and version being used  e Firmware versions  e PC configuration  type of processor  speed  memory  and operating system   e A complete description of your hardware and operating systems  including       type of power supply      types of I O units installed      third party devices installed  for example  barcode readers   e Specific error messages seen     Installing PAC Control    PAC Control installation is easy and quick  Insert the CD containing PAC Control in your CD ROM  drive  and the installation wizard should appear  If the wizard does not appear  start Windows  Explorer and navigate to your CD ROM drive  Double click Setup exe to begin installation     NOTE  If you run PAC Project applications in Microsoft Windows XP make sure to us
359. m file storage using the File Transfer Protocol  FTP     e To move files to and from file storage using another device such as a PC  use any  standard FTP software  See instructions in Opto 22 form 1704  the PAC Manager Users Guide  A  maximum of five devices can FTP files to a control engine simultaneously    e  Tomove data to and from file storage programmatically  a strategy can request or send a  file using an FTP communication handle  explained in this section  A maximum of 16  communication handles can be used simultaneously to move data via FTP    FTP also allows you to get a directory listing of files on a remote server or in the local file storage   area  In addition  if your SNAP PAC controller has a microSD card slot in the top of the controller s   case  you can use the FTP communication handle to manipulate files on a microSD card     FTP Communication Handle Examples    The value for the FTP communication handle is in the format     ftp   IP address     port     username     password     optional timeout      ftp Use all lowercase letters        IP address IP address  or URL  of the destination device  where the file          will go    port Default port is 21  with 20 for the data port    Enter the username and password set up for the destination  username   NE dud     device  If the destination device is another control engine or  password    the local server  use anything except an empty string        Specify a communication timeout value in seconds  or leave
360. mary connection  route becomes unavailable  If that happens  the controller uses a secondary communication route     There are two types of link redundancy in PAC Project  which you can use individually or combined     e   Controller to 1 0  When link redundancy is configured from the controller to  O  if  communication to the primary I O unit IP address fails  communication switches automatically  to the secondary I O unit IP address  which usually is the second Ethernet network interface on  a SNAP PAC R series controller  See  Commands for Ethernet Link Redundancy    on page 287 for  more information on primary and secondary I O units        NOTE  If your system has redundant controllers  in order to use link redundancy from the controller to  the I O  you must connect ETHERNET 2 on the controllers and on the I O units to the same switch  No  other devices can be connected to that switch     e PAC Display Pro to controller  When a PAC Display Professional project is installed on a PC  with two network interface cards  NICs   the project can be configured to use the primary and  secondary IP addresses to access data from the PAC Control strategy running on the control  engine  One address is always active  If the primary address is unavailable  then the secondary  address becomes the active address  and the PAC Display scanner automatically shifts to the  secondary address  If the secondary address fails  then the primary address becomes the active  address and automaticall
361. me Block Type    Sprinklers Read Hygrometer Action                2  To delete a breakpoint  highlight it and click Remove  To delete all breakpoints in the strategy at  once  click Remove All     3  When you have finished making changes  click OK     Interpreting Elapsed Times    As you debug your strategy  you may notice elapsed time readings appearing in a chart s or  subroutine s status bar  as shown below     PAC Control User s Guide 181    VIEWING AND PRINTING       Sprinklers    Elapsed time                                              Elapsed time readings can help you determine how much time a chart  a subroutine  or a single  block takes to execute  The readings have slightly different meanings depending on what you did to  make them appear  as described in the table below        Run a chart or subroutine and  pause it    Time since the chart or subroutine started or was last paused       Single step  by line or block     Time to execute the previous block       Auto step    Time to execute the most recently executed block          Hit a breakpoint       Time since the last pause  or if the chart or subroutine was not  paused  elapsed time since it started running          Viewing and Printing    You can view and print several helpful things in a strategy as described in the following topics     182       Viewing Strategy Filename and Path     below        Viewing an Individual Chart or Subroutine    on page 183     Viewing All Charts in a Strategy  on page 183     
362. me will be in one of the following formats     Manual archive or archive when strategy is closed Path Filename Archive D02282007 T114351 zip       Archive on download PathYFilename Download D02282007 T114351 zip                Archive when downloading from online mode PathYFilename Online D02282007 T114351 zip       The date stamp  D  is in the format mm dd yyyy  In the examples above  the date is February 28   2007  The time stamp  T  is in the format hh mmy ss  In the examples above  the time is 51 seconds  past 11 43 A M     Compiling and Downloading    166    Before your strategy can be tested or run  it must be compiled and then downloaded to a control  engine  When a strategy is compiled  all the commands  OptoScript code  charts  and variable and  I O definitions it contains are verified and converted into a format that the control engine can  understand  Then the strategy can be sent  downloaded  to a control engine  Only compiled  strategies can be downloaded     NOTE  Before you can download your strategy  make sure you have downloaded the latest firmware to  your control engine  For instructions  see the controller s user s guide     PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Compiling and Downloading in One Step    NOTE  If you are using Ethernet link redundancy in PAC Control Professional  make sure you are  downloading through the IP address you want to use  either the primary or secondary address  See  Using  Ethernet Link Redundancy i
363. n Alarm   1     Set the oven alarm  else   Oven   larm   0      Glear the oven alarm  endif    i  Shortcuts              OptoScript code    OptoScript block    When To Use OptoScript    318    You ll want to use OptoScript for some common programming tasks that can be more difficult to do  using standard PAC Control commands than using a procedural language  Extensive math  calculations or complex loops  for example  can be done with standard commands but take up a lot  of space on a flowchart     When you use OptoScript  however  be aware that it is not self documenting  Make sure you  frequently use comments to explain what the code does  so that when you come back to it a year  later   or when someone who is not as familiar with the code or the strategy must change it   it  can be easily interpreted     This section shows examples of using OptoScript   e for math expressions   e     for string handling   e     for complex loops   e for case statements   e for conditions    PAC Control User   s Guide    CHAPTER 11  USING OPTOSCRIPT       e     for combining math expressions  loops  and conditions     For Math Expressions    OptoScript is especially useful for mathematical computations  Math expressions are simpler and  easier  and many of them are built right into the language  instead of requiring commands such as  Add or Multiply  OptoScript has no limitations on the number of parentheses you can use in math  expressions     Heres an example of a mathematical expression i
364. n Enter Text  All Valid Types          PAC Control User s Guide 357    VIEWING SUBROUTINES       5  Choose the Type and Name for each prompt from the drop down lists     You can configure variables on the fly as you would with any command  Remember that the  Type was chosen when the parameters for the command were configured  so your Type    choices may be limited     6  When the Add Instruction dialog box is completed  click OK   7  Click Close to close the Instructions dialog box and return to the chart     The chart is now set up to call the subroutine     Debugging Subroutines    Debugging a subroutine is just like debugging a flowchart  When you are debugging a strategy that  calls the subroutine  make sure the debug level is Full Debug  see page 176   Then use the Step Into  button to step inside the block that calls the subroutine  The subroutine window automatically  opens  and you can continue to step through blocks or lines inside the subroutine  As you step  through blocks  subroutines  and charts  the tabs at the bottom of the window let you know where  you are  see  Using Tabs to View Open Windows  on page 57      You can also set breakpoints on any subroutine block as needed  See  Setting and Removing    Breakpoints  on page 180 for more information     Viewing Subroutines    Since subroutines appear on the Strategy Tree  it is easy to view information about them  A  subroutine appears in two places on the Strategy Tree  in the Subroutines Included folder and in
365. n OptoScript   integerl    integer2   2     floatl    float2   2    3      To accomplish the same computation using standard PAC Control commands  you would need to  create at least two intermediate variables and use five instructions  as shown below     I Instructions   Math  Expressions   Block 16    Add Add     integer2  Plus 2 Modif   Put Result in tempintegerA  Subtract  float2 Next Block   Minus 2   Put Result in tempfloatA    Divide  float  By tempfloatA  Put Result in tempfloatA    Subtract  tempfloatA  Minus 3 0  Put Result in tempfloatA    Multiply  tempfloatA  Times tempintegerA  Put Result in integer1                As you can see  the OptoScript version of this math expression is not only simpler to create  but also  easier to understand once created     PAC Control User s Guide 319    WHEN TO USE OPTOSCRIPT       For String Handling    If your strategy transmits and receives serial data  you will want to try using OptoScript code  In  standard PAC Control  forming and parsing  decoding  serial data can take several blocks  In  OptoScript  string handling can be easier     The following figure shows a flowchart designed to send the string request     What type of plane      and parse the response     F14     into a classification  F  and a model number  14   Compare these  blocks and instructions with the ones on the following page  done in OptoScript        l Instructions   String Handler   Build new request          ll Move String  From    EXHI p UTC  T del To 
366. n PAC Control  on page 94 for more information     1     With the strategy open in PAC Control  click the Debug mode button REI  on the toolbar  or  choose Mode  gt  Debug     Changing to Debug mode automatically saves and compiles the strategy  including all code in  OptoScript blocks     If you see a Powerup Clear Expected message  click OK   A download warning message may appear     Download Warning    A Strategy Mismatch    The strategy to be downloaded does not match the strategy already in the control engine   Strategy To Download    3    Name  Sprinkler  Control  Checksum  A4DCB  CBSCOECB13D789F123F5148EB11  Timestamp  07 02 09 10 56 05    Strategy in the Controller    Name  Sprinkler  Control  Checksum  B2FF383D7F7BC284EA7DDAAC30845024  Timestamp  06 30 08 12 53 24  If vou choose to continue  the strategy that is in the control engine will be replaced by this strategy     Do you want to continue the download        This message tells you that the strategy to be downloaded doesn t match the strategy already  loaded on the control engine  either because it is a different strategy or because it has been  changed since the last download     To continue the download  click Yes     As the strategy is compiled  the Compile Progress dialog box appears  This dialog may appear  only briefly  However  if there are errors or warnings  the dialog box will stay open  You can copy  the errors and warnings by clicking the right mouse button and selecting Copy All as Text     PAC Cont
367. n PAC Project is on the SNAP PAC System  PAC Control initially shows only SNAP  PAC I O units and the commands used with them  When you re using the SNAP PAC system only   hiding legacy I O units and commands makes it simpler and less confusing to build your strategy   However  the legacy capabilities are still there and can be made visible in a specific strategy as  needed     NOTE  If you enable legacy I O capabilities in PAC Control  see the legacy versions of the PAC control guides  for information on how to use them  forms 1710 and 1711     Existing Strategies    When you open an existing ioControl strategy in PAC Control  either Basic or Professional  PAC  Control will automatically show the I O units and commands appropriate to that strategy  For  example  if you have been using SNAP Ultimate I O  SNAP Ultimate I O units will be visible in the  strategy  In addition  commands used with SNAP Ultimate I O but now deprecated because they are  not needed with SNAP PACs   such as High Density Digital commands   uwill also be available     Similarly  if you open an existing strategy that contains mistic serial   O units  all the mistic I O unit  types and commands   such as event reaction and mistic PID commands   will automatically be  shown     PAC Control User   s Guide    CHAPTER 7  WORKING WITH STRATEGIES       New Strategies    When you create a new strategy in PAC Control  either Basic or Professional  the strategy will show  only the SNAP PAC System  This means      
368. n Pulse Measurement   Get On Pulse Measurement Complete Status  Get  amp  Restart On Pulse Measurement   Start Continuous Square Wave   Start Off Pulse   Start On Pulse        Some digital point commands are available in PAC Control Professional only  Some commands are available  only on some I O units  For details  see specific information for each command in the PAC Control Command    Reference or online Help     States  Latches  and Counters    The following diagram illustrates states  latches  and counters  While states and latches apply to  digital points on all I O units  counters depend on the capability of the brain  See the brain s data    sheet for specifications     PAC Control User s Guide 281    DIGITAL POINT COMMANDS       282    States  Latches  and Counters                   State is ON Off latch is true  1  State is ON  ON  when value changes  from ON to OFF   On latch is true  1     when value changes    from OFF to ON   OFF   State is OFF State is OFF  State  OFF ON OFF ON  On Latch  OFF ON ON  nochange  ON  no change   Off Latch  OFF OFF ON ON  no change   Counter  0 1 1  no change  2  Latches    Latches are an extremely high speed digital function  Both on latches and off latches are available   Latches are automatic and do not have to be configured    When the value of a digital input point changes from off to on  an on latch is automatically set   While the value of the point may return to off  the on latch remains set until cleared  as a record of  the
369. n Station    Our freshly baked cookies then move to the inspection station  where someone inspects them  If the  cookie does not fall within normal tolerances    for example  it doesn   t have enough chips or is  shaped oddly   the inspector closes a switch  XS 103   signalling the bad cookie  A valve  SV 103   then opens to allow plant air to blow the reject cookie into a waste bin     If the cookie passes the inspection  it moves on to packaging and shipping     Conveyor    The conveyor and its motor continuously move the cookies from the dough vessel to the inspection  station  The conveyor speed is controlled through an analog output  SY 104  from a speed controller   SC 104      Emergency Stops    Wired at key locations around our bakery are emergency stop buttons  If something goes wrong  with the process  an operator can press any of these E STOP buttons     PAC Control User   s Guide    APPENDIX D  SAMPLE STRATEGY       The buttons are wired in series and are normally closed  so pressing any E STOP button breaks the  circuit  One digital input can monitor all the buttons  The system can be restarted by resetting the    button     Required I O    Here s the list of analog and digital I O modules required for the cookie factory     Analog I O                                                                            PT 100 Dough Vessel Pressure Input SNAP AIV     10 to  10 VDC  0 15 psig  TT 102 Oven Temperature Input SNAP AICTD  ICTD   50 350  C  TY 102 Oven Temperatur
370. n a strategy or used in more than one  strategy  Subroutines are built using the same tools and logic used to create charts  Once built  you  can call them at any time from any chart in any strategy   You cannot call a subroutine from another  subroutine  however      Like charts  subroutines start at one block and proceed sequentially through command blocks to the  end  They use variables  inputs  and outputs  They can use OptoScript code  Fach subroutine is  displayed in its own window  and you can open and view several subroutine windows at the same  time     Unlike charts  however  subroutines are independent from a strategy  You don t need to have a  strategy open to create or change a subroutine  And if you do have a strategy open  creating a  subroutine has no effect on the open strategy unless you specifically link them together    Debugging a subroutine  however  requires that it be called from a strategy      A second important difference between subroutines and charts is that subroutines offer two ways  to work with variables and other logical elements  they can be passed in or they can be local to the  subroutine     e  Passed in items are passed into the subroutine by the strategy  They are referenced when the  subroutine is executed  If a parameter is passed by reference  the subroutine will pass the value  back to the strategy  For example  you could create a subroutine to add 3 0 to a passed in float    PAC Control User s Guide 347    CREATING SUBROUTINES     
371. n addition  we recommend not using a timeout value that is less than 0 1  seconds  For example  if the value is 0 1 seconds  then communication to an unresponsive I O unit  will be disabled within 0 3 seconds  If the network connectivity is very slow  you may need to use a  significantly longer timeout value such as 3 to 5 seconds or longer     Changing Configured I O Units    1  To change a configured I O unit  make sure the strategy is open and in Configure mode     2  Find the I O unit s name on the Strategy Tree  Double click it to open the Edit I O Unit dialog  box  See    Add I O Unit Dialog Box  on page 117     3  Make the necessary changes and click OK     You can also change an 1 0 unit from the Configure I O Units dialog box by double clicking the  unit s name or highlighting it and clicking Modify     Deleting Configured I O Units    You cannot delete an I O unit if it has I O points configured or if the I O unit is referenced in a PAC  Control command     CAUTION  Be careful when deleting I O units  You cannot undo a deletion     1  To delete a configured I O unit  make sure the strategy is open and in Configure mode     2  Find the I O unit s name on the Strategy Tree  Right click it and choose Delete from the pop up  menu     The I O unit is deleted from the strategy     You can also delete an I O unit from the Configure I O Units dialog box by highlighting the unit s  name and clicking Delete     PAC Control User s Guide 121    ADDING 1 0 POINTS       Adding I 
372. n window is blank  indicating that no messages are being monitored  between the PC and the active control engine  In some cases  for example when PAC Control  launches PAC Message Viewer  messages should appear immediately    To start monitoring or change the level of monitoring  choose View  gt  Monitor Levels     The Monitor Levels dialog box lists all the possible levels to monitor  You can click Refresh to  make sure the list is up to date      amp  Monitor Levels    ioCom  high level comm  1 user  handle 00000004  ioMwd low level  1 user  handle 00000002    All  ioMwd mid level  1 user  handle 00000001 None    Refresh       Highlight one or more of the monitor levels in the list  and click Close     You return to the PAC Message Viewer window  where the changes you made are reflected at  once  To stop monitoring  click Pause  To start monitoring again  click Resume  To erase all  messages from the window  click Clear     By default  communication messages in PAC Message Viewer are automatically saved to a log  file named IOSNIELOG  You can toggle saving on and off by choosing File  gt  Log to File     Also by default  messages are temporarily stored in system cache memory before being saved  to the log file  If you are having trouble with system crashes and need to capture messages just  before a crash  however  you can choose File  gt  Flush File Always to send messages directly to  the log file     To view or edit the log file  choose File  gt  Edit Log File    The fil
373. name       Prevent response messages from printing to the DOS screen    Append the DOS switch  q                This example shows lines included in a batch file that will define the control engine  download the  cdf file to it  and then run the strategy    termcl  a MyCE tcp 10 20 30 40 22001 0 2000   termcl  d MyCE  c MMy ProjectMMyStrategy MyCE CDF    termcl  r MyCE    Changing Download Compression    If you have a very large strategy  short timeouts  and slow connections on your network  you may  need to decrease the compression level to download the strategy successfully  When you decrease  compression  the strategy takes longer to download because it is sent in smaller chunks  If you are  having difficulty downloading your strategy  follow these steps to decrease compression     1  With the strategy open in Configure mode  choose File  gt  Strategy Options   2  Inthe Strategy Options dialog box  click the Download tab     Strategy Options      Archive   Download   Legacy   Serial 1 0 Ports    acy         Flash Memory    C Save strategy to flash memory after download    Set autorun flag after download    Background Downloading   C  Use background downloading and fast strategy updating     The controller must be configured for this feature using PAC Manager     Download Compression    None Full    Q       Slider             3  Move the slider to the left to reduce compression  and then click OK   You may need to experiment with the setting until the strategy downloads suc
374. name but a different table length   are  noted in a log file that appears when the paste is complete     Deleting Elements    1   2     Make sure the chart is open and the strategy is in Configure or Online mode   Click the Select tool 4   Click the element s  to select them     CAUTION  Make sure you have selected the element you want  You cannot undo a deletion     Press DELETE     You can also select the element s   right click them  and select Delete from the pop up menu   Block 0 cannot be deleted     PAC Control User s Guide 211    OPENING  SAVING  AND CLOSING CHARTS       Changing Element Color and Size    You can change the colors and sizes of blocks  connections  and text in your chart  To change one  element  for example  the color of one block   use the steps in this section  To change more than  one at a time  see    Changing the Appearance of Elements in a Chart Window    on page 203     Start with the chart open and the strategy in Configure or Online mode     Resizing Blocks or Text Blocks    1  Click the Select tool L and click the block to select it     2  Click one of the handles  then drag it in the direction you want  To resize horizontally and  vertically at the same time  drag a corner handle     Changing Block Colors    1  Click the Select tool L and click the block to select it   2  Right click the block and choose Color from the pop up menu   3  Pickthe color you want and click OK     Changing Text   You can change the size  font  font style  or color
375. nd  put a space between each one     The following example sets the transmit timeout to 20 seconds and the receive timeout to  15 seconds  The connect timeout is not changed     arrstrServer  5   to tx 20000 to rx 15000     Table name Element 5 Transmit timeout Receive timeout    Retrieving a Webpage    Use the HTTP Get command to retrieve non secure  HTTP  or secure  HTTPS  content from a web  page  The example provided here uses the HTTP Get command in OptoScript to retrieve secure  content from www google com  For more information on this command  see form 1701  the PAC  Control Command Reference        PAC Control     5 File Edit Configure Chart Subroutine Compile Mode Tools View Window Help        E o 50550055            8  x                                         GoogleHttps 9 a  intent  pa a    5 Ge Variables S  gea Slt BIN a  tle A A A  a  e  B  Ej  Numeric Variables   E  nhttpStatus OptoScript Code   D  nPortssL MoveToStrTableElements     0   1  HTTP SrcStrTblBody    Dal nSendStatus MoveToStrTableElements     0   1  DstStrTblHdr    3  Ej    String Variables MoveToStrTableElements     0   1  DstStrTblBody    strCmd StrURL    www google com    strURL strCmd x  wai    nPortSSL   443         Pointer Variables    amp  Communication Handles    amp  Numeric Tables         amp  String Tables    nSendStatus   HttpGet    DstStrTblBody     Return body data dest string table  DstStrTblHdr  7  Return header data dest string table  HTTP SrcStrTblBody       Source body data string
376. nd Exiting                    42  TEE o E E 42    Opening the Strategy    A strategy is a complete control program developed in PAC Control  Our sample strategy controls a  cookie factory  The sample strategy is described in detail on page 383  but for now  let s just open  and explore it     PAC Control User s Guide    OPENING THE STRATEGY       1  Start PAC Control by clicking the Start button and selecting Programs  gt  Opto 22  gt  PAC Project  9 2  gt  PAC Control     The PAC Control main window opens     IPAC Control Basic  File Edit Configure Chart Subroutine Tools View Help    Dicono EEA taex ALA Gm ero sa             PAC Control  Ready    2  Click the Open Strategy button  amp  on the toolbar  or choose File  gt  Open Strategy     3  Inthe Open Strategy dialog box  navigate to C  Users Public Public Documents Opto 22 PAC  Project 9 2 Control Pro  or Basic  Examples     NOTE  For Windows XP  go to C  Documents and Settings All Users Documents Opto 22 PAC Project  9 1 Control Pro  or Basic  Examples     4  In the Examples directory  double click the ioCookies subdirectory to open it   The strategy file Cookies idb appears     Save Strategy As       Save in    CJ ioCookies  Fil Cookies idb                         File name   Save as type    PAC Control Strategy Files    idb  i   j                      5  Double click the Cookies idb file to open it     NOTE  Ifa File Format Change dialog opens warning that you are about to open strategy saved using  an earlier version o
377. nd of the process    This kind of loop is guaranteed to execute at least once     e For loops repeat a process for a specified number of times     Below is an example of a while loop as it would appear in standard flowchart commands  contrasted  with the way it could be handled in an OptoScript block         OWHILELOOP    s    C  testforthehou  se  AA In standard PAC Control commands  the  ABE S   loop takes several blocks  each    JEEP containing one or more instructions                  In OptoScript  the loop is in a single block that  contains one condensed instruction           Script   Powerup   Test Hour   C9 Actions  4   Conditions     Variables    Test Compile me    d   pis      ptoScript Code        AN    while   GetHours    gt   8  and  GetHours    lt  17       do something        vend       ij    Iv    PAC Control User   s Guide    CHAPTER 11  USING OPTOSCRIPT       For Case Statements    Case or switch statements create multiple decision points  They can also be easier to do using  OptoScript  Here is an example of a case statement     In standard PAC Control commands  the case   statement requires several sets of condition and   action blocks  each containing commands  In OptoScript  the code  is all in one block           switch  GetDayOfWeek     1  7  Monday             Using OptoScript for case statements saves space in the flowchart and lets you see all the possible  cases in one dialog box     PAC Control User s Guide 323    WHEN TO USE OPTOSCRIPT       For
378. nd on  and off pulses to an output point  The availability of pulsing depends  on the brain  see the brain s data sheet for specifications     Generate N Pulses   The command Generate N Pulses is frequently used to flash a light or sound  an alarm  For example  you could sound a two second alarm four times  In the arguments  you set  the number of times the on pulse is sent  the length of the on pulse  and the length of the off pulse   Generate N Pulses always starts with an off pulse  If you resend this command  make sure to leave  sufficient time in between so it does not interfere with itself     Start On Pulse and Start Off Pulse   The commands Start On Pulse and Start Off Pulse send a  single pulse cycle    e   Start On Pulse starts with an on pulse of a length you determine  and ends with an off pulse    e Start Off Pulse starts with an off pulse of a length you determine  and ends with an on pulse     Both of these commands can be used as time delays  For example  if a light is on and you want to  turn it off after 30 seconds  you can send a Start On Pulse command  setting the on pulse to be 30  seconds long  At the end of that time  the off pulse is sent to turn off the light     You can also use this type of command in a loop to turn a digital point on or off for short intervals   For example  you could create a loop that checks the level of liquid in a tank and pulses on a drain if  the level is too high  The advantages of using a pulse command are that the point do
379. ne command  hold down the SHIFT key while you click all the  commands to be cut or copied at once     NOTE  To cut and paste all commands in a block  copy and paste the entire block  and then change  its name if necessary    Press CTRL X to cut the command s  or CTRL  C to copy them    You can also click the right mouse button and choose Cut or Copy from the pop up menu   The command is cut or copied to the Windows clipboard     PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS       Pasting a Command  Once you have cut or copied a command  you can paste it into any block in the same strategy   Choose one of the following  and then press CTRL V   e  o paste the command in the same block  click where you want to insert the command       To paste the command at the end of the instruction block  move the cursor just below the last  instruction and click to highlight the empty space     e  o paste the command to another block  click Close to exit the current Instructions dialog box  and double click the block where you want to place the command  Click where you want to  insert the command           Configuring a Continue Block   Continue blocks do only one thing  jump to another block  Thus  the only information you need to   provide in a continue block is the name of the block to jump to    1  With the strategy in Configure or Online mode and the flowchart open  double click the  continue block you want to configure   You can also click the block  click the rig
380. ne mode  click the Select tool L and  click the block to select it     Right click the block and choose Name from the pop up menu     I Name Block    Cancel          In the Name Block dialog box  type the name and click OK     Renaming Blocks    1     206    With the chart open and the strategy in Configure or Online mode  click the Select tool    and  click the block to select it     Right click the block and choose Name from the pop up menu   In the Name Block dialog box  change the name  Click OK     PAC Control User   s Guide    CHAPTER 8  WORKING WITH FLOWCHARTS       Connecting Blocks    To connect blocks  start with the chart open and the strategy in Configure or Online mode   Remember that action blocks and OptoScript blocks have only one exit  and condition blocks have    two     Action Blocks and OptoScript Blocks    1     To connect an action block or an OptoScript block to the next block in a program sequence   click the Connect tool 4     First click the source block and then click the destination block    Although you can click anywhere inside the blocks to make a connection  the connection is    attached at the side closest to where you clicked  In the figure below  Block 0 is the source  block and Block 1 is the destination block     New_Chart     3  Shortcuts          To keep your charts neat  try to draw the most direct connections possible  To do so  after  clicking the source block  move your cursor out of the block at a point closest to its destination   
381. ne module  Any of the digital input or output devices shown in the diagram could  be wired to HDD modules rather than standard 4 channel digital modules     Key Features    See the following topics for some of PAC Control key features        Copying I O Configurations  on page 115    A configuration file allows you to copy an I O configuration from one strategy to another  Or   using PAC Manager  you can send the configuration to multiple I O units at the same time        Using Network Segmenting in PAC Control    on page 93    Using the two independent Ethernet network interfaces on a SNAP PAC controller  you can  segment the control network from the company network        Using Ethernet Link Redundancy in PAC Control    on page 94     Pro only  If you are using SNAP PAC controllers and PAC Control Professional  you can use  Ethernet link redundancy to set up alternate network links        Persistent Data    on page 220    You can configure the data in most variables to be persistent  The variable s value is saved in the  controller s memory  it does not change when the strategy is run  stopped  or started  and it  does not change if the strategy is changed and downloaded again      Pointer Commands    on page 303    PAC Control User s Guide    CHAPTER 3  WHAT IS PAC CONTROL        For advanced programming  you can create pointers that store the memory address of a  variable or some other PAC Control item  such as a chart  an I O point  or a PID loop  You can  perform any op
382. ne of the command you want to change   You can also click the command to highlight it and click Modify    In the Edit Instruction dialog box  make the necessary changes    For help  see    Adding Commands    on page 235     Click OK to return to the Instructions dialog box  where you can see the changed command     Deleting a Command    You can delete a command permanently  or you can comment out a command so it is temporarily  skipped  usually for debugging purposes     Permanently Deleting a Command    1     With the strategy in Configure or Online mode and the flowchart open  double click the block  containing the command you want to delete     NOTE  To delete commands in OptoScript blocks  see    Using the OptoScript Editor    on page 340   In the Instructions dialog box  click any line of the command you want to delete     CAUTION  Make sure you select the correct command  You cannot undo a deletion     Click Delete or press DELETE on the keyboard     PAC Control User s Guide 239    CUTTING OR COPYING A COMMAND       Commenting Out a Command    You can mark certain commands so that the strategy temporarily ignores them  Commenting out  one or more commands can help you pinpoint problems in a strategy     1     With the strategy in Configure or Online mode and the flowchart open  double click the block  containing the command s  you want to comment out     NOTE  To comment out commands in OptoScript blocks  see  Using the OptoScript Editor  on  page 340     In the Instruc
383. net mask that are incompatible with those on the computer  Subnetwork  numbers and netmasks must be identical on the control engine and the computer     If you see the message  No response from host   check the following   e     Are the computer and control engine correctly connected  Is the control engine turned on     e  Arethe IP address and subnet mask on the control engine compatible with those on the  computer     If your host computer has more than one Ethernet card  check your route table to make sure packets  are routed to the correct adapter card     If all else fails  connect the PC and the control engine using an Ethernet crossover cable  and retest  the connection     If you still cannot ping the control engine  contact Product Support   See page 4      Other Troubleshooting Tools    366    Checking Detailed Communication Information Using PAC  Message Viewer    For detailed information about each communication transaction  use the PAC Message Viewer   utility    1  Inthe Start menu  choose Programs  gt  Opto 22  gt  PAC Project 9 2  gt  Tools  gt  PAC  MessageViewer   You can also start PAC Message Viewer from PAC Terminal by choosing Tools  gt  Start PAC  Message Viewer  or from PAC Control in Debug mode by choosing Debug  gt  Sniff  Communication     The PAC Message Viewer window appears     PAC Control User   s Guide    APPENDIX A  TROUBLESHOOTING        amp  PAC Message Viewer    File View Help    Pause F Clear   Messages sniffed        In most cases the mai
384. ng COMMAS eaea d eerte tr de eet eran ats derer alive als Soe hve 315  Delay COMMANGS   sue seo sesto cadonene eset va enit tan CIR Haeret ee PE LAE IER 315  Using TIMES ee  315   Down Timer Operation s3 5 cccemacdiadaas spere aden cagwraanknid aer Erant 315  Up Timer Operation  x4  teeth VeRerho bI re hp RI vetd bbe    MISERE Sum 316  Chapter 11  Using OptoScript os icccccecnceis ics re rara en EE ERI dese  317   HMO oj  TNT 317  lenis Chapter cocotte ertet ppt eR I S eE a Ie e Rb ea qn er URS 317   AbOUEODLOSCHBLU 4  epe iea BEER ir mnogu uto Eier ede 317   When  Tolse ODtOSCIIDLIe tee dde e dida iu SOR Dat dan uin ire UU eq  318  FOP Math EXBTESSIONS    es castes an e red oes catu iiec qoedas e eut tdi ar E fannie dd 319  OR SERIO Handling ERR PEE 320  For Complex WOODS  x54 55d da edo tide veg ede eee idee dE bre or dde  PE Q be Dd Qd 322  Fore ase statements cues oy und o empate ma PRU dide bat Nae et 323  FOF COMGILIONMS  EET 324  For Combining Expressions  Operators  and Conditions                0 00 02  c cece ees 325   OptoScript Functions and Commands                 60  c eect eee eee ene 326    PAC Control User s Guide       Standard and OptoScript Commands               0 cece cece eect teen eee ees 326       Using Oil OPLOSCHDE quiso eivedae ore b bere pora coin dene Ped bir weis 326  OptoScript Syntax    use ressens neriie rctewer E rq a E O ee mE he 327  More About Syntax with Commands           sisse ee 328  OptoScript Data Types and Variables    0 00 0    c
385. ng Control Engines from One PC to Another    109  Downloading Files Using PAC Terminal    ss 110    Configuring Control Engines    Before you can use a control engine to run a strategy  you must first define the control engine on  your PC and then associate the control engine with your PAC Control strategy       See    Defining a Control Engine on Your PC  below to identify the connection through which  the PC and the control engine communicate  Because this process writes to the Windows  Registry on your PC  you must define control engines for each computer that uses your  strategy   If your computer can boot to two operating systems  you must configure control  engines for each OS   You can define control engines in PAC Control or in the software utility  PAC Terminal         See    Associating the Control Engine with Your Strategy  on page 93 to identify which defined  control engine is the active control engine  Although you can associate several control engines  with the same strategy if necessary  the strategy can be downloaded to only one at a time  The    PAC Control User s Guide EJ    CONFIGURING CONTROL ENGINES       control engine set to receive the download is called the active engine  You must use PAC  Control for associating the control engine with your strategy     Defining a Control Engine on Your PC    1  Choose one of the following         Using PAC Terminal  Choose Start  gt  Programs  gt  Opto 22  gt  PAC Project 9 2  gt  Tools  gt   PAC Terminal  From the
386. ng in Watch Windows    Watch windows are flexible  You can dock the window where you want it in the PAC Control main  window  You can also move  delete  and inspect elements in the window     e To dock the watch window  click the docking button  lin its title bar   The window moves to its own frame     PAC Control Professional    Oven Inspection Control      i File Edit Control Engine Debug Chart Subroutine Mode Tools View Watch Window Help  Tas    gt    ll m s    Cookies    pl IP           amp   E Cookies   amp  G Control Engines   amp  E Subroutines Included  a     3    Variables   amp  E Numeric Variables   amp   C3 String Variables      Pointer Variables   E Communication Hanc  E Numeric Tables      String Tables      Pointer Tables   amp   c 1 0 Units  c SA Mixed IO Unit      C3 Points   E PIDs             iil    9                   JL Next 4r Prev          Count Watch  Name    nCookieCounter Integer 32 Variable      Digital Input    713                   02  dilnspectionPassFail      On  On Latch    Off Latch          See  Docking Windows  on page 59 for more information     To expand or collapse watch window you have added to an I O unit  PID loop  chart  or  table  click its plus or minus sign           Watch 2 o DBR     XVAL   272 8985    Name Type     12  Temperature    Analog Input   Deg    O  J  Sprinkler Control SNAP Mixed Ultimat       PAS anes  eine                                   00  Switch DO   05  Sprinkl      12  Tempera     Digital Control               
387. ng limitations in mind as you use the file communication handle with the  controller s file system  see below for microSD card      Maximum length for filenames and directory names       127 characters       Filename characters allowed    All ASCII characters except       null  and         Path name component separator            Maximum number of files and directories that can be  open simultaneously    16       Maximum directory depth    Limited only by available memory       Maximum number of files    Limited only by available memory  Each file uses 516  bytes of overhead plus its number of bytes rounded  up to the nearest multiple of 516 bytes        Maximum number of directories    Limited only by available memory  Each directory  uses 516 bytes        Maximum amount of memory available in the control  engine s file system          Approximately 4 MB on a SNAP PAC S1  or 2 MB  on a SNAP PAC R series controller  varies slightly  depending on the control engine firmware version        If power to the control engine is turned off  files are destroyed unless they have been saved to flash  memory  See  Commands Relating to Permanent Storage  on page 280 for information on saving    files to flash using PAC Control commands     Using a File on a microSD Card    If your SNAP PAC controller has a microSD card slot in the top of the controller s case  you can use  PAC Control commands with files on a microSD card just as you would with any other file in the    controller s file s
388. ng option is auto stepping  You can select this option whether or not the chart is  currently paused     1  Click the Auto Step Chart button 3 and watch the program move from block to block     At one time or another  your chart looks like this     this chart     This chart runs  continuously once the  program has been started     Drop the dough       Drop the chips                                               Notice that in the PAC Control toolbar  the Run and Auto Step Chart buttons are depressed  The  chart status bar shows us the chart is running and in Step Auto mode  The time indicator to the  right of Break Off shows the time it took for the most recent block to execute     2  Clickthe Auto Step Chart button again to end auto stepping   Step Off appears  indicating the program is again running without interruption     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       Now let s see how many cookies we ve produced to this point     On the Strategy Tree  double click the numeric variable nCookie Counter      s  nCookieCounter   scanning        The Value field should increase every time a cookie is produced  adding to the total number of  cookies produced since the strategy run began  The nCookie Counter above shows this figure  as 42   Yours may be different               But nCookie Counter tells us the total number of cookies put on the conveyor belt  without  considering that some of them may be rejected by the inspection station  We need to subtract  
389. ngines in the list   4  Click Add     Configured Control Engines                 5  Click Add again to add a control engine     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       The Control Engine Configuration dialog box appears     Configure Ethemet Connection    Configure control engine name and parameters   Control Engine Name             System Type    Standard     Redundant Networks  PRO only      Redundant Controllers  PRO only     Settings  IP Address Hostname  0 0 0 0    Controller Port  22001  Software Retries  0  Software Timeout  5000       Enter Cookie Controller as the control engine name    The name can contain letters  numbers  spaces  and most other characters except colons and  square brackets  Spaces cannot be used as first or last characters    Under System Type  make sure Standard is selected    Enter the control engine s IP address    On hardware such as a SNAP PAC R series controller  the IP address is usually written on a    sticker on the side of the unit  If an IP address has not been assigned to the control engine  see  Opto 22 form 1704  the PAC Manager User s Guide  for configuration instructions     On a SoftPAC controller  if PAC Control and SoftPAC are on the same PC  use the loopback IP  address  127 0 0 1  However  if SoftPAC is on a different PC  use the address for that PC s network  interface card  NIC   In this case  the SoftPAC PC s NIC must be configured with a static IP  address     NOTE  In PAC Control Professional  a 
390. nspect dialog box      Protecting a Running Strategy  If you want a strategy to run automatically without interruption  you can protect the strategy by  disabling all host communications to the control engine     To protect the strategy  first make sure the strategy is saved to flash and that the autorun flag is set   To disable host communication  open PAC Manager and set the Control Engine port to 0  and then  save that change to flash  For more information on setting this port  see form 1704  the PAC Manager  User s Guide     NOTE  This action also disables communication between PAC Display and the control engine     Stopping a Strategy    To stop the strategy  click the Stop Strategy button mi  or press F3  or select Debug  gt  Stop   You  can also stop a strategy from the Inspecting dialog box  see  Inspecting Control Engines in Debug  Mode  on page 101     PAC Control User s Guide    DEBUGGING       Debugging    176    Once the strategy is running  if it doesn t appear to be working correctly  you can use several tools in  Debug mode to figure out what the problem is  You can pause a chart or subroutine  step into  over   or out of each block  watch it slowly step through the blocks  or add a breakpoint to a block to stop  the strategy just before it executes that block     The chart s or subroutine  status is shown in the lower left hand corner of its window  This corner  shows whether the chart or subroutine is running  stopped  or suspended  and whether the  debuggin
391. nt     G Open Parent       Click Apply    The On Latch IVAL field turns green after a second or two  indicating the latch is on   Click Add Watch    We ll add the variable to our watch window  so we can see what happens     In the Add Watch dialog box  leave all portions checked  Click OK to add the variable to the  Cookie Watch window  Close the view point dialog box     PAC Control User s Guide    USING A WATCH WINDOW       17  In the Cookie Watch window  click the plus sign next to  02  dilnspectionPassFailSwitch   Your screen may show only part of the words     18  Move your cursor over the right side of the Name column until the cursor changes shape  Then  click and drag the column to make it wider  until you can see all the words        Watch Window    Name Type  nCookie Counter Integer 32 Variable    5  02  dilnspectionPassFail    Digital Input  State  On Latch  Off Latch       19  Click in the Oven  Inspection  Control chart to make it active  and move the scroll bars until you  can see the Blow Off block at the bottom     Your window now looks something like this     PAC Control Professional    Oven_Inspection_Control   E File Edit ControlEngine Debug Chart Subroutine Mode Tools View Watch Window Help    Ciconio Sh debus I 0m 55 70559  Cookies degrees         Paints   a    Ems 7 1 Set oven temperature to  Ele  Event 01 Sos Oven Ones 450 degrees    AA Mixed ID  Unit ISSIS    amp   Ej Points  323 diD oughLevelSwitch  T diChipLevelSwitch If inspection station sees  um d
392. nt  gt  All Chart Instructions   NOTE  Subroutine instructions are not included  you can print them separately     PAC Control processes the information and displays it in the Instructions window     Save Search  Print    Bi Cookies   All Chart Instructions    TITLE  Block Instructions for Every Chart  STRATEGY  Cookies  DATE  02 05 10 TIME  10 39 55       CHART  Alarms  ACTIONS    Action Block  Powerup  Id  Z5   Exit to  Goto Start  Id  28     Restart Powerup chart  This will get system going agaim   Start Chart   Chart Powerup   Put Status In nChartStatus    Action Block  Set Devices  Id  2   Exit to  Stop Conveyor  Id  36     Lower oven temperature while conveyor is stopped   Move   From 200 0   To ao  venTemperatureControl    Close all valves   Turn Off       AnChinhi cnenceVelre    PAC Control User s Guide 187    VIEWING AND PRINTING       You may need to resize the window and use the scroll bar to see all the data  Blocks and their  instructions are listed in alphabetical or ID number order by type of block  action blocks first   then OptoScript blocks  then condition blocks  and finally continue blocks     3  To print the data  click the Print button on the toolbar  To save it to a text file  click the Save  button  To search the data  click theSearch button  When finished  close the window     Viewing and Printing Strategy or Subroutine Elements    You must be in Configure mode    1  Toview a summary of I O elements and variables configured in a strategy  select File 
393. nt all points in Building A to appear together      PAC Control User s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY       Instruction Examples    This section includes examples of common instructions you may want to use  See Chapter 10   Programming with Commands  for additional information on programming with PAC Control  If you  need to use math calculations  strings  or complex loops and conditions in your strategy  also see  Chapter 11  Using OptoScript for examples of OptoScript  OptoScript is a procedural language  within PAC Control that can make programming easier  especially if you are an experienced  programmer     Creating Messages to Display On Screen    You may need to create messages to display on screen  for example to give data to operators   Typically these messages consist of some specific  literal words and symbols followed by a variable  value and maybe some additional literal words or symbols     Current temperature  86 3 F      Literal words Variable Literal words   amp  symbols value  amp  symbols    You can create the message in a single block in your PAC Control chart  like this                 To enter the literal text  use the  command Move String   Remember to include spaces Move String    I Instructions   Message_Display   Create Message       where you want them to appear        9  Current temperature      j To Current_Temp_Message  such as after the equal sign   Convert Float to String Delete    Convert Current_Temp  2  Add the variable value by 
394. nt can be used directly  wherever a float variable can be used   For example  you can assign an analog point a value  or use points directly in mathematical  expressions and control structures  For more information  see    Using I O in OptoScript  on page 326     Reading or Writing Analog Points    The Move command is the main command used to read or write analog points     PAC Control User s Guide    CHART COMMANDS       Chart Commands    246    The following commands control charts in the strategy     Call Chart Continue Calling Chart  Calling Chart Running  Continue Chart  Calling Chart Stopped  Get Chart Status  Calling Chart Suspended  Start Chart   Chart Running  Stop Chart   Chart Stopped  Suspend Chart    Chart Suspended     For information about charts in a PAC Control strategy  see    PAC Control Terminology    on page 47     About the Task Queue    How do subroutines fit into the task queue     Whenever a chart calls a subroutine  the subroutine temporarily inherits the task in use by the  calling chart along with its priority     Does a task always use all of its allocated time     Not always  If a chart or subroutine runs in a loop  all allocated time is used  If a chart or subroutine  does not need all of its allocated time to complete its job  all remaining time  including any portion  of a time slice  is given up     The following conditions cause a chart to use less than a full time slice   e     The chart or subroutine stops    e  he chart or subroutine is s
395. ntinuously once the  program has been started     Drop the dough     Drop the chips         3  Shortcuts                9  Connect the Drop Chips block to this new block by clicking the connection tool   amp  in the  toolbar  Click once in the block the connection is coming from  Drop Chips     If you move your cursor around the screen  you see a connection following your movements  If  you move the cursor to the top of Block 19  the connection becomes a short line from the  bottom center of Drop Chips to the top center of Block 19     10  Click inside the upper part of Block 19 to complete the connection  Click the right mouse  button or press ESC to release the tool  returning your cursor to an arrow     Let s name Block 19 something more descriptive   11  Click Block 19 once to select it  then right click it and select Name from its pop up menu   The Name Block dialog box appears     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       I Name Block             12  Type Back to    Speed OK     right over the selected text  then click OK   The chart now looks like this     The Powerup chart starts  this chart     This chart runs  continuously once the  program has been started     Drop the dough     Drop the chips         3  Shortcuts                Now let s give the continue block its instructions     13  Double click the continue block to see a list of all the blocks in the chart      Select Continue Block Destination       Block Id  Name     Drop Chips  Drop
396. ntrol strategy  Remember to save PID parameters to the I O unit s    flash memory  too  see    Inspecting I O Units and Saving Settings to Flash  on page 140      PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       Using Watch Windows for Monitoring    While the strategy is running  you can monitor several strategy elements at once in a watch window   I O units  digital and analog points  PID loops  variables  even charts  You cannot monitor subroutine  parameters or variables that are local to a subroutine in a watch window     Unlike inspection windows  watch windows can be created the way you want  docked in a position  most convenient for you  and are saved with your strategy  You cannot change strategy elements in  a watch window  but you can open the inspect dialog box from the watch window and change the  element there     Creating a Watch Window    1   2     With the strategy open and in Debug mode  choose Watch  gt  New     In the Create New Watch Window dialog box  navigate to the location where you want the  watch window file to be kept  usually in the same folder as the strategy   Enter the watch  window file name and click Open     The empty watch window appears         Watch 2       Add elements you want to watch in this window by clicking them on the Strategy Tree and  dragging them into place in the watch window  or by right clicking them and choosing Watch  from the pop up menu    You can add I O units  digital and analog points  PID loops  variab
397. nveyor         J Actions    Conditions  C  Variables    Test Compile           ptoScript Code     7 loop through elements 1 16 of the tables  for FanCtrlIndex   1 to 16 step 1      nove the AI and DO to the pointers  pMotor ptMotors FanCtrlIndex    pTenp ptTemps FanCtrlIndex        compare the values and act   if   pTemp  ftSetpoints FanCtrlIndex  then  x xpMotor 1    Turn on motor  else   pMotor 0    Turn off motor  endif             next    Optimizing Throughput    For tips on how to design your PAC Project  system and program your PAC Control  strategy to  ensure optimum system performance see form 1776  Optimizing PAC Project System Performance     For additional information  see form 1702  the PAC Display User s Guide     PAC Control User s Guide    OPTIMIZING THROUGHPUT       PAC Control User   s Guide       5  Working with Control  Engines    Introduction    This chapter shows you how to configure and work with control engines  See    Compatible Control  Engines and I O Units  on page 5     In this Chapter   Cong arms Control ENGINE setiembre ttdboste sont 89  Using Network Segmenting in PAC Control    83  Using Ethernet Link Redundancy in PAC Control                       94  Using Redundant Controllers    ttc 99  Changing or Deleting a Control Engine                 ss 99  Inspecting Control Engines and the Queue siisii 101  Archiving Strategies on the Control Engine                 ss 106  Restoring Archived Strategies from the Control Engine               108  Movi
398. ny different hardware components  switches  pumps  tanks   valves  furnaces  conveyors  photo sensors  thermocouples  and so on  All the components  communicate with the control engine in the controller by way of input output  I O  points     Input points are wired to hardware that brings information into the control engine from the  process  Examples of devices that can be wired to input points are thermocouples  switches  and  sensors  The control engine takes the information from the input points   such as whether a switch  is on or what temperature is registered on a sensor    processes it using the software instruction set   and returns information to the process through output points     Output points are wired to hardware that receives information from the control engine and uses   this information to control components of the process  For example  lights  motors  and valves are all   devices that can be wired to output points  Using an output point  the control engine might turn on   a light or open a valve    There are two types of I O points  digital and analog    e Digital points can be either on or off  True or False   Push buttons and LEDs are examples of  digital devices  An LED is either on or off  it has no other possible state     In the Control System Example on page 44  the photo sensor is an example of a digital input  device  The photo sensor is either on or off  When it turns off as the sheet passes through its    PAC Control User s Guide    KEY FEATURES
399. o Stepping    Auto stepping lets you watch a chart s or a subroutines logic in slow motion  one block at a time  A  chart or subroutine does not have to be paused before auto stepping can begin  To begin auto    o     stepping  click the Auto Step button     press r8  or select Debug  gt  Auto Step Chart     Step Auto appears in the status bar  The hatch marks move from block to block as each block s  commands are executed  When you reach a block whose code is currently being executed  the  highlight around the block becomes changing shades of green instead of solid red  unless the block  is executed very quickly      A chart that contains flow through logic stops when it has been stepped through  In a chart that  contains loop logic  the auto stepping continues until you stop it by pressing the Auto Step button  again     PAC Control User s Guide 179    DEBUGGING       Setting and Removing Breakpoints    Sometimes you want to see the action at one or two blocks without having to step through an  entire chart or subroutine  You can use a breakpoint to stop a running chart or subroutine just  before a block is executed     You can set a breakpoint at any block in any chart or subroutine  whether it is running or stopped   paused or auto stepped  The strategy does not need to be running  You can set up to 16 breakpoints  in one chart or subroutine  However  you cannot set a breakpoint inside a block     To set a breakpoint  follow these steps    1  With the chart or subroutine 
400. o clicking the    button   Now the dialog box looks    T Add Instruction    Instruction     like this         Decrement Variable       Comment         Decreases cookie count by one to account for a rejected cookie    Type    Integer 32 Variable    14  Press ENTER        v  nCookie_Counter    The dialog box closes and the new command appears in the Instructions window     l Instructions   Oven_Inspection_Control   Blow Off       Leave reject valve on for 2 seconds   Delay  Sec   2 0    Turn off reject valve     New  command       doRejectValve    ccount for a rejected cookie    nCookie_Counter             Modify       Delete    Next Block    Previous Block    15  Click Close to return to the Oven_Inspection_Control chart     Compiling and Downloading the Change  Now we ll compile and download the modified strategy   1  Click the Debug mode button SER on the toolbar     A message box appears  warning you that changes have been detected and asking if you want  to save them before downloading     2  Click Yes to continue     Another warning notes that the strategy name  check sum  or timestamp differs from that in  the control engine and asks if you want to continue     PAC Control User s Guide    COMPILING AND DOWNLOADING THE CHANGE       Break On    Oven Inspection Control    11     12        Click Yes     On the toolbar  click the Run Strategy button p   In the Strategy Tree  double click the  bStartFlag variable  Maximize the dialog box  change the value to 1  and click Apply
401. o relock host port in  QUIT      Host port needed relocking        Destination string too short     In string manipulations  a string was requested that is longer  than the string it will be put into  or destination string length   lt   Q        Port not locked     Attempted to transmit or receive on a connection that wasn t  locked  or to unlock a connection that wasn t locked        Unknown response from device     OptoMMP based protocol packet returned by the device  was invalid        Wrong object type  Most likely caused by  moving a pointer table element to a pointer  of the wrong type     An object was passed to a command that doesn t handle  that object type              Invalid I O command or invalid memory loca   tion        Contact Product Support  See page 4     PAC Control User s Guide             LIST OF COMMON MESSAGES                                                             I O Point mismatch  The Object field speci   fies the point name  board name  module  number  and point number  A point is incorrectly configured  for example  an output  For example  point is configured as an input point   or the point type is not  333 supported by the I O Unit s firmware  Check  BadPoint AIARMS Point Analog  R1  2  1  PP y    www opto22 com for firmware updates   Point name Board Module Point  i  gt  Feature not yet implemented for this hardware command  Invalid command or feature not imple  S   36 combination  or command may not apply to the type of com   mented  Mer 
402. o the computer with lower level   non administrator privileges  the application may not recognize control engines that have been  previously configured     If this problem occurs  you can modify the permissions to let specific users access previously  configured control engines without having administrator access  This is done using the Registry  Editor utility  Follow the steps below     CAUTION  Use the Windows Registry Editor carefully  It is strongly recommended that you make a  backup copy of your Windows Registry before continuing with this procedure  Without a backup copy  if  you deletethe wrong properties and cannot return the Registry to its original state  application and system  files can become unusable and will have to be reinstalled     1  Make sure you are logged on as an administrator   2  From the Windows Start menu  select Run   The Run dialog box appears   3  Enterthe following command in the Open field and press ENTER     regedt32    NOTE  This is NOT regedit exe  which is a similar tool     The Registry Editor main window appears with several open windows inside it   4  Select the HKEY LOCAL  MACHINE window to make it active   Navigate to Computer HKEY_LOCAL_MACHINE Software   6  Dooneofthe following     vi        Fora 32 bit operating system  select the Opto22 folder       Fora 64 bit operating system  navigate to  Wow6432Node Opto22   7  Doone of the following         Fora 32 bit operating system  select Security  gt  Permissions               Fora 64 
403. o with increasing a  counter  Counting sounds like math  so let s try the Mathematical group     Click Mathematical on the left to highlight it  then scroll down the list on the right until you find  the command Increment Variable  Click it once     I Select Instruction    Groups  Instructions     Digital Point       Clamp Integer 32 T able Element  Error Handling      Clamp Integer 32 Variable  Event Reaction Complement   High Density Digital Module Cosine   170 Unit Decrement Variable   1 0 Unit   Event Message Divide   1 0 Unit   Memory Map Generate Random Number   1 0 Unit   Scratch Pad Hyperbolic Cosine       Logical Hyperbolic Sine  Hyperboli    Miscellaneous   PID   Ethernet   PID   Mistic Minimum  Pointers Modulo  Simulation __    Multiply   String Natural Log  Time Date        Raise e to Power                Notice that if you need information about any command  you can click the Command Help  button     Click OK and this command is entered in the Add Instruction dialog box     The cursor is automatically moved to the next field  which is Comment  Comments are  optional  they can help someone else understand the purpose of the instruction     In the Comment field  type Increment a counter of cookies produced   Next  click the arrow in the Type field  the one that currently reads AII Valid Types     This list shows what those valid types are  a float variable  an integer 32 variable  and an integer  64 variable     Counters are integers  so select Integer 32 Variable 
404. ocks can have many entrances  but only one  exit     analog point    Analog points have a range of possible values  Temperature and pressure are examples of analog  information  Temperature might be any number in a range   2 or 31 65 or 70 1 or many other  possible numbers  Analog points can be either inputs  such as a tank level sensor  or outputs  such  as a fuel pump      PAC Control User s Guide    PAC CONTROL TERMINOLOGY       blocks Dough Chip  Control  DE   A chart is made up of action blocks    condition blocks  continue blocks  and Action block  OptoScript blocks connected by arrows    which show how the process flows  A   chart used with redundant controllers Condition block  also has sync blocks     sync block OptoScript block    The sync block tool is only visible when   controller redundancy support is Checkpoint bloc  enabled  A sync block is used to  synchronize redundant controllers at  strategic locations in a transactional  chart  a chart that contains sync blocks      Continue block       For more information  see form 1831  G Shoteus  100      the SNAP PAC Redundancy Option User s DETTO Chart         Guide     condition block    Condition blocks are diamond shaped blocks in a flowchart that contain questions  conditions  that  control the logical flow of a strategy  Condition blocks can have many entrances  but only two exits   True and False  The block can contain more than one condition  and you can use AND or OR to  indicate whether all conditions must 
405. od by  Cherti N  Previous Block  Gets the   ength of Get Length of Table  Table Int_Table    the table and puts it      Put in Int Table Index  in Int  Table Index                Using the numeric variables Modified  by Chart and Modified by Chart2  from Chart 2   a watch  window can track the number of times the table has been modified by each chart  For more  information  see  Using a Watch Window  on page 35     PAC Control User s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY          Modified by Charti Integer 32 Variable 91  Modified by Chart2 Integer 32 Variable 49  Int Table Index Integer 32 Variable LT    B   Decrement Table Index  The table has 100 elements  numbered from 0 to 99  This  instruction block starts at element 99 and on each loop decrements by 1 to go to the next element   This continues until it reaches index 0     C   Index  gt  0  If the index is greater or equal to zero  the chart proceeds to D  If the index equals   1  the chart goes to E     D   Add 2  or 3  to Table Element  Adds two  or three  to the value of the current table index     E   Release Table Lock  This block uses a Force unlock of zero  which means it will only unlock  for the chart that locked the flag  In this case  if Chart 1 locked the flag  only Chart 1 can unlock the  flag     Flag Lock Timeout Values    The following chart shows the effect of different Timeout values used with the Flag Lock command     Wait until success    The application will wait  block  as long   1 as it take
406. of the resulting  string is too long for its space     PAC Control User   s Guide          ASCII Table    The followin  equivalent c  a CTRL  M  sh    CHAPTER 10  PROGRAMMING WITH COMMANDS       g table shows ASCII characters with their decimal and hex values  For characters 0 31   ontrol codes are also listed  for example  a carriage return  character 13  is equivalent to  own in the table as  M                                                                                                                                                   PAC Control User s Guide    Dec Hex   CC Char Dec   Hex Char Dec   Hex   Char Dec   Hex   Char  0 00        NUL 32   20 Space 64   40   96   60      1 01 A SOH 33   21   65   41 A 97   61 a  2 02  B STX 34   22   66   42 B 98   62 b  3 03  C ETX 35   23   67   43 C 99   63 e  4 04  D EOT 36   24   68   44 D 100   64 d  5 05  E ENQ 37   25 96 69   45 E 101   65 e  6 06  F ACK 38   26  amp  70   46 F 102   66 f  7 07  G BEL 39   27 71 47 G 103   67 g  8 08  H BS 40   28   72   48 H 104   68 h  9 09    HT 41   29   73   49   105   69 i  10   OA  J LF 42   2A E 74   4A J 106   6A j  11 0B  K VT 43   2B   75   4B K 107   6B k  12   0C AL FF 44   2C 76   4C L 108   6C    13   OD  M CR 45   2D   77   4D M 109   6D m  14   OE  N SO 46   2E 78   4E N 110   6E n  15   OF  O SI 47   2F   79   4F O 111   6F o  16 10 AP DLE 48   30 0 80 50 P 112   70 p  17 11    Q DC1 49   31 1 81 51 Q 113   71 q  18 12  R DC2 50   32 2 82 52 R 114   72 r  19 13  S DC3 
407. og Box    Add Digital Point                      Type   Module              Features  None       Defaut   No  Watchdog    No    Enable communication       A   Name  Enter a name for the point  The name must start with a letter and may contain letters   numbers  and underscores   Spaces are converted to underscores      B   Description   Optional  Enter a description of the point     C   Type Module  For non SNAP 1 0 units  choose the module type and the exact module from  the drop down lists  For a G4EB2  all 32 digital points are addressed as a single I O unit  if you are  using the G4EB2 with Quad Pak modules  make sure you configure each group of four points as  either all inputs or all outputs     For SNAP I O units  Type and module are already filled in for you  as shown in the example above   D   Features  1o use a feature of the module  choose it from the drop down list  You can  configure some input modules with a counter  totalizer  or other feature   Inputs automatically have    both on latches and off latches      E   Default  To set a default state for the point when the strategy is run  click Yes and choose the  state  Off or On   To leave the point in the state it was before  click No     F   Watchdog   Output modules only  To set a Watchdog  click Yes and choose On or Off from  the drop down list     G   Enable Communication  Select whether you want communication to this I O point    enabled or disabled on startup  Enabled is the default     Adding an Analog I 
408. ol Main Window  on  page 52  For programming information  see  4  Designing Your Strategy  For steps to create  charts  see  8  Working with Flowcharts     Opening a Strategy    Only one strategy at a time can be open in PAC Control  If you currently have a strategy open  it must  be closed before another is opened  You are prompted to save changes before it closes     Opening an Existing Strategy    1  To open an existing strategy  select File  gt  Open Strategy  or press CTRL   O  or click the Open  Strategy button   on the toolbar   2  Inthe Open Strategy dialog box  navigate to the strategy you want to open and click Open     The strategy opens in Configure mode  with the windows in the same position they were when  the strategy was closed     Opening an ioControl Strategy    If you have been using ioControl Basic or Professional with a SNAP PAC controller  migration to PAC  Project Basic or Professional is simple  Because the individual programs within the suite are  essentially the same  although they have new features and hardware support   you can simply open  a strategy in PAC Control and then save it  For safety  we recommend you back up all ioProject files  before opening them in PAC Project  See also   Opening Strategies in PAC Control Basic and PAC  Control Professional  below  For more information on migrating your system to SNAP PAC  see  form 1680  the SNAP PAC System Migration Technical Note     Opening a Recently Used Strategy    To open a strategy you have 
409. omputer has two NICs  I O units are all controlled by the controller  Each I O unit is  connected to its own group of sensors and actuators  but both are connected to the same two  networks     For more information on using Ethernet link redundancy with PAC Display  see form 1702  the PAC  Display User s Guide     EJ PAC Control User s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES                            Ge ee COME CNN cM MM CMM MEC 75 00 undant Network   Two PCs  each with two NICs ec A  running PAC Display Pro   Two PCs  each with two NICs running  OptoOPCServer  as PAC Display scanner   Ethernet switch   Ethernet switch  i S    SNAP PAC S series controller  network  1 HE oum network  2    controls all   O units    SNAP PAC R series    SNAP PAC R series       Example 3  Ethernet Link Redundancy with Serial I O Units    This third example of link redundancy shows a SNAP PAC S series controller with serial I O units  The  redundancy is in the Ethernet networks between the controller and computers running PAC Display  Professional and OptoOPCServer  This example provides link redundancy for the Ethernet network   Again  note that the computers all have two NICs     PAC Control User s Guide    USING ETHERNET LINK REDUNDANCY IN PAC CONTROL       Opto 22 Redundant Network    PC with two NICs running PC with two NICs running  PAC Display Pro PAC Display Pro   si  lt j  gt          L    s    oz CA a I   z    PCs  with two NICs running  OptoOPCServer  as PAC Display scanner   
410. on 116  info  viewing 103  initialization file 110  225  creating 226  downloading 228  input point  definition 45  disabling 284  input output  See I O  inspecting  control engine 101  control engine using PAC Terminal 106  I O 140  I O using watch window 157  PID loop 146  See also viewing  installing PAC Control 4  instruction  See command  integer  converting to float 297  definition 49  295  in logic 294  variable  definition 218  interacting algorithm for PID 301  IO Enabler 286  IP address  control engine 92  loopback 117  250  254  primary and secondary 117   SA algorithm for PID 301  IVAL 284          K  keyboard shortcuts 67    L  lag time  for PID 147       latch  commands  instructions  282  launching  See opening  legacy options  enabling 196  link redundancy 95  287  SoftPAC controller 95  literal  constant 221  in OptoScript 394  load last mode at startup 162  load last strategy at startup 162  local subroutine parameter 348  local variable 348  log file 382  logic  in charts 76  logical commands  instructions  293  logical operator in OptoScript 335  logical true and false 294  look up an error 371  loop logic 76  loopback address 117  250  254  looping 322  338  339    M    mathematical commands  instructions  295  mathematical expressions 319  in OptoScript 334  memory 363  memory map commands 290  message on screen  programming example 79  message queue 103  microSD card 258  263  minimal debug  definition 176  minimum maximum value 244  245  mistic I O uni
411. on page 241      To add commands to an action or condition block  follow the steps below   To add commands to an   OptoScript block  see  OptoScript Functions and Commands  on page 326 and  Using the   OptoScript Editor  on page 340     1  With the strategy open in Configure or Online mode and the flowchart open  double click the  block to which you want to add a command     The Instructions dialog box appears  The highlighted area shows where the new command will  be added     PAC Control User s Guide    ADDING COMMANDS       tInstructions   New  Chart   Block 1    Highlighted area  Modify    Delete    Next Block  Previous Block    Operator The Operator group      AND appears in the dialog box    Caci Heo OOR only for condition blocks     not for action blocks              2  Click Add to open the Add Instruction dialog box     T Add Instruction    Instruction   AND   Comment                    Type Name  All Valid Types    Button_D3             All Valid Types   bStartFlag          3  If you know the command you want  enter its name in the Instruction field by typing it in or by  choosing it from the drop down list  Skip to step 7     4  If you don t know the command name  click Select to open the following dialog box     236 PAC Control User s Guide    Arguments                 CHAPTER 9  USING VARIABLES AND COMMANDS       I Select Instruction    Groups  Instructions       Analog Point      Chart Add 3    Communication Arccosine     Control Engine Aresine   Deprecated Arct
412. on to Visual Basic and C    The following table lists PAC Control string commands and their equivalents in Microsoft Visual  Basic and C  If you are using OptoScript  see    E  OptoScript Language Reference     for additional  comparisons           i 7 strlen str    Append Character to String S    S    Chr  MyChar   str i    MyChar   str i   1    0   Append String to String S    S       Hello    strcat str   Hello     Convert Hex String Number 196 2   amp h    S  sscanf str   ox    amp iNum         Convert Number to  Formatted Hex String    Convert Number to String    S    Hex  1      S    CStr 1      sprintf str  96x  iNum      sprintf str     d    iNum    sprintf str  9of  fNum         Convert String to Float    F   CSng S      sscanf str  9of    amp tNum      fNum   atof str         Convert String to Integer 32    1    Cint S      sscanf str     d     amp iNum      iNum   atoi str         Get Nth Character    MyByte     ASC MID  Str  n  1      MyByte   str n         Get String Length    MyLENGTH    LEN Str      iLEN   strlen str         Get Substring    SubStr    MID  Str  i n     strncpy subStr   amp str i  n      subStr n        0           Move String    STR       Hello       strcpy strDest  Hello          Test Equal Strings    Equal     STR     Hello      i   strcmp str1  Hello          String Equal     if STR       Hi    then       if  stremp str1     Hi               String Equal to  String Table Element        if STR  n      Hi  then          if  stremp str1 n   Hi 
413. onfiguration  but once they are configured  you  use the same commands  such as Start Counter and Clear Counter  for them as for regular counters     NOTE  You can use counters on high density modules with SNAP PAC R1 controllers and SNAP PAC EB1  and SNAP PAC SB1 brains with firmware 8 1 or newer     Before using a counter  you must configure the point as a counter   See  Adding a Digital I O Point   on page 122 or use PAC Manager   Counters do not need to be started  and they cannot be stopped   Therefore  do not use the Start Counter and Stop Counter commands  However  you can use Get  Counter and Get  amp  Clear Counter  A positive value means that phase A leads phase B  See additional  details in the PAC Control Command Reference or online Help     Totalizers    Digital totalizers track the total time a specific input point has been on or off  For example  you could  track how long a pump  fan  or motor has been on  Digital totalizers are useful for periodic  maintenance  Before using a totalizer  you must configure the point with this feature   See    Adding  I O Points  on page 122 for help   The availability of totalizers depends on the brain  see the brain s  data sheet for more information        To check total time and leave the totalizer running  use Get Off Time Totalizer or Get On Time  Totalizer  To check total time and reset the totalizer to zero  use Get  amp  Restart Off Time Totalizer or  Get  amp  Restart On Time Totalizer     Pulses    Pulsing commands se
414. onfigure and click Add   10  Complete the fields as described in    Add Analog Point Dialog Box    below   11  When you have completed the fields  click OK    The new point is added     NOTE  If you need to add several similar points  see  Copying a Configured I O Point  on page 131     Add Analog Point Dialog Box    Add Analog Point                   A Name     B Description  B  C    Scaling  D Full Range Clamping Actual  Scaled  F       Units   VDC VDC vDC VDC  Lower   10  10  10  Upper  10   10    Clear    G Default    No O Yes  H Watchdog    No O Yes                                     Se       l Enable communication       PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       A   Name  Enter a name for the point  The name must start with a letter and may contain letters   numbers  and underscores   Spaces are converted to underscores      B    Description   Optional  Enter a description of the point     C   Type Module  For non SNAP 1 0 units  choose the module type and the exact module from  the drop down lists     For SNAP I O units  Type and module are already filled in for you  You may be able to choose a  different range or a scalable module from the drop down list     D   Full Range  Full range and units for this module  If the module is scalable  use F to change  scale     E   Clamping   Outputs only   optional  Enter upper and lower clamp if necessary to limit  output to the device attached to the point  If fields are left empty  no clamp is applied  To 
415. onfigured on your system     File Tools Configure View Help    Control Engines   Controller Name System Type Address 1 Address 2 Configure Control Engines  Cookie Controller Standard 4127 0 0 1 ie Q Add         R1 Controller Standard 4 10 195 55 111            Status Scan   amp  Scan Al  435 Scan Selected                      2  If no control engine is listed  configure one by choosing Configure  gt  Control Engine and  following directions on the screen  See  Configuring Control Engines  on page 89 for help    3   o verify that a control engine in the list is communicating  double click the control engine s  name   The Comm  Loop Time  communication time  in the Inspect Control Engine dialog box  indicates how long it takes to gather the information in the dialog box and is a good relative  indicator of communication time   This dialog box also shows the status of the current strategy and any errors in communication  with the control engine  For further explanation  see  Inspecting Control Engines and the  Queue  on page 101     4  If you receive an error indicating a communication problem  go on to the next section     PAC Control User s Guide    APPENDIX A  TROUBLESHOOTING       Resolving Communication Problems    Matching PAC Control Configuration to the Real World     O unit and point configuration in PAC Control must match actual I O units and points with which  the control engine is communicating  See brain and I O module data sheets for specifications and  information
416. onger associated with your strategy     Deleting a Control Engine from Your PC    If you are sure that a control engine will no longer be used with your PC  you can delete it using the  PAC Terminal utility  Deleting the control engine removes its definition only on the PC you are using     1  Choose Start  gt  Programs  gt  Opto 22  gt  PAC Project 9 2  gt  Tools  gt  PAC Terminal     PAC Control User   s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES       2  Right click the name of the control engine in the list     CAUTION  Make sure you are highlighting the right one  You cannot undo a deletion     3  From the pop up menu  choose Delete   The control engine is no longer defined on the PC     Inspecting Control Engines and the Queue    You may want to inspect or change control engines while you are running the strategy in Debug  mode  See the following topics to view control engine information and the engine s message  queue  either from PAC Control in Debug mode or from the PAC Terminal utility     e        Inspecting Control Engines in Debug Mode   below   e  Viewing the Message Queue  on page 103  e        Inspecting Control Engines from the PAC Terminal Utility  on page 106    Inspecting Control Engines in Debug Mode    With the strategy running in Debug mode  choose Control Engine  gt  Inspect     You can also double click the active engine  the first one under the Control Engines folder  on the  Strategy Tree  or right click the control engine and choose Inspect f
417. onnections link the blocks together and show how the program logic flows  Action blocks exit  through just one connection  since they always go in one direction  Condition blocks exit through  two connections  one for a true evaluation and the other for a false evaluation     Opening a Block    Let s see what s in a block   1  Double click the Drop Dough block     The Instructions dialog box appears     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       tinstructions   Dough_Chip_Control   Drop Dough       nCookieMotionPreset Modify     dtCookieMotionTimer    For animation in ioDisplay Caa      Open the dough valve   Turn On Next Block    doDoughDispenseValve  Previous Block  Keep the dough valve open for 2 seconds   Delay  Sec     2 0    Close the dough valve   Turn Off          AaNnannhNinnnannntinhken          This block contains four instructions  Move  Turn On  Delay  Sec   and Turn Off  Each one has a  description above it     Double click the Turn On instruction to see more about it   You could also click it once and click  Modify      The Edit Instruction dialog box for the Turn On command appears     T Edit Instruction    Instruction     umm          Comment         Open the dough valve     Type Name  Digital Output v doDoughDispenseValve       Here we see the details of the command  which simply turns on the digital output   Dough  Dispense Valve  In other words  it opens the valve    Close the Edit Instruction dialog box by clicking OK or Cancel    B
418. onnectors are located on the top of SNAP PAC controllers  These ports can be used for  maintenance  such as loading new firmware  or for Point to Point Protocol  PPP  communication via  a modem  They can also be used to send or receive data directly from a serial device  such as  barcode readers  weigh scales    O  or any intelligent device  Serial communication handles are used  to communicate with these intelligent devices  see examples below     First  the serial port must be set to None in PAC Manager  as follows    1  Open the Inspect window in PAC Manager and enter the IP address for your device    2  Click Communications and choose Communication Port Control     3  In the Value field for the Control Function of the serial port you want to use  select None from  the drop down menu     PAC Control User s Guide       CHAPTER 10  PROGRAMMING WITH COMMANDS       NOTE  For a SNAP PAC S2  you can configure any of the serial ports as a either RS 232 or RS 485 by  changing the Value field for the Mode for Communication parameter     For more detailed information on setting serial communications  see the PAC Manager Users Guide     IMPORTANT  Serial communication handles are used only for direct connection to serial devices  Ifyou  are connecting to serial devices through serial communication modules on the I O unit  use a TCP  communication handle instead  See page 249     NOTE  Serial I O units are wired to an RS 485 port on the controller and do not require serial  communicat
419. onvert Number to Hex String  Convert Number to String   Convert Number to String Field  Convert String to Float   Convert String to Integer 32  Convert String to Integer 64  Convert String to Lower Case  Convert String to Upper Case   Find Character in String   Find Substring in String   Generate Checksum on String  Generate Forward CCITT on String  Generate Forward CRC 16 on String  Generate Reverse CCITT on String    Using Strings    Generate Reverse CRC 16 on String  Get Nth Character   Get String Length   Get Substring   Move from String Table Element  Move String   Move to String Table Element  Move to String Table Elements  Pack Float into String   Pack Integer 32 into String   Pack Integer 64 into String   Pack String into String   Set Nth Character   String Equal to String Table Element   String Equal    Test Equal Strings   Trim String   Unpack String   Verify Checksum on String   Verify Forward CCITT on String  Verify Forward CRC 16 on String  Verify Reverse CCITT on String  Verify Reverse CRC 16 on String    NOTE  All numbers in this discussion of strings are decimal unless otherwise stated     A PAC Control string is a sequence of characters that can be grouped together  Characteristics of    strings include the following     e     Strings area  e     Each charac    e   Each charac    lways referred to by name  and  if in a table  by index    ter is represented by one byte   ter is represented by its ASCII code  0 to 255         e A string con    taining no charac
420. open and in Debug mode  click the Breakpoint tool  y   The pointer turns into a hand    2  Clickthe target block to mark it with the breakpoint hand     Sprinklers       Breakpoint hand                                     Break On in status bar                                            Running step On   DEE se 0 ov       180 PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       3  Click other blocks to set additional breakpoints  or click blocks currently marked with a hand to  remove the breakpoint    4  When you have finished marking or removing breakpoints  click the Breakpoint button again or  click the right mouse button within the window     When the chart or subroutine runs  it pauses just before executing the breakpoint block  You  can inspect variables or I O points  disable strategy elements  change values  and so on to see  the effect the block has     5  To single step past the breakpoint  click the Step Block or Step Line button  Or to run the chart  or subroutine at full speed after the breakpoint  click the Pause Chart button     Managing Multiple Breakpoints    You can see all the breakpoints you have set  and you can remove breakpoints one at a time or all at  once  See also   Setting and Removing Breakpoints  on page 180 to use the breakpoint tool   1  Press CTRL   Bor select Debug  gt  Breakpoints     The Breakpoints dialog box appears  showing all the breakpoints set in the strategy     I Breakpoints         Chart Sub Name Block ID Block Na
421. open strategy only  choose File  gt  Strategy Properties to  open the Configure Strategy Properties dialog box     PAC Control User s Guide 203    WORKING WITH CHART ELEMENTS           To change new elements in the open chart or subroutine only  choose Chart  gt  Properties  or Subroutine  gt  Properties to open the Configure Chart Properties or Configure Subroutine  Properties dialog box     The dialog box that opens looks like this  except that its title may be different     2  Complete the fields as described in    Configure Chart Properties Dialog Box    below   3  When you have made all the changes  click OK     Configure Chart Properties Dialog Box    Configure Chart Properties    Flowchart Parameters    Background Color  Grid Color  MEM    Display Block IDs         Smooth Scrolling    Action Block Parameters    T XM     tion    Width   96  Height   48  Color   BE Fon  Ana Opoint     i  Condition Block Parameters    tL   c penn   1 rue  Mmmm  OptoScript Block E   tion    width   96       Height Color   Fort     Arial 10 point   mma  Checkpoint Block  Width   96 Height    48 Color   1 Font     Arial 10 point      Continue Block Parameters Also Apply To D    Width    96 Height  48 Color  fea Font    Arial 10 point         C PAC Control    Strate  Text    sy    Al charts  Width   192 Height   128 Font    Arial   10 point  E                                                       A   Flowchart Properties  Specify general chart display in this area  To apply these changes to  
422. or Serial I O Units    This section is for PAC Control Professional users  If you have the Basic version  see  Changing the  Baud Rate for Serial I O Units  on page 119     NOTE  Once you have configured a serial port for use with an I O unit  do not configure a communication  handle on the same port     PAC Control User s Guide 119    ADDING AN I O UNIT       If the default baud rate shown in the Add I O Unit dialog box is not correct  you can change it  This  baud rate is for communication through the RS 485 port to serial I O units  It does not affect other  serial ports on the controller or communication handles using these ports     In addition you can also choose Binary or ASCII mode  The controller will talk to all I O units on that  port in the same mode     NOTE  There is no ASCII version of OptoMMP protocol  which is used on SNAP PAC SB brains   so if a port is  set to ASCII  you won t be able to mix mistic and SNAP PAC SB brains as you can in Binary mode     1  Make sure the strategy is open and in Configure mode   2  Choose File  gt  Strategy Options  then click the Serial I O Ports tab     Strategy Options    Archive   Download   Legacy   Serial 1 0 Ports    The SNAP PAC S1 and SNAP PAC S2 controllers may use serial 1 0 units such as the B3000  or SNAP PAC SB1     The port type must first be set to RS 485  either by using default ports or by PAC Manager    You must also configure which ports will be used for 1 0 within this strategy   C Use port 0 for 1 0 using 2
423. or ignore any breakpoints set in the chart  click an arrow in the Breakpoints field to  select Break On or Break Off  Click Apply     This action does not clear or set breakpoints  but just determines whether the chart stops at  breakpoints when it is running        Chart changes occur as soon as you click Apply     To add the chart to a watch window so you can monitor it with other strategy elements  click  Add Watch  In the dialog box  choose what to watch  Select an existing watch window to add  this chart to  or create a new watch window     See  Using Watch Windows for Monitoring  on page 157 for more information on watch  windows     When you have finished making changes  click Close to return to the View Chart Status dialog  box     Printing Chart or Subroutine Graphics    You can print a chart or subroutine just as it appears on screen  You can also print all charts within a  strategy  When printing a single chart or subroutine  you can preview the image to make sure it s  what you want before you print it     NOTE  If you have trouble printing graphics  set your printer for PostScript emulation     Setting Up the Page    Before printing graphics  you should verify your page setup  which determines how each graphic  appears on a page     1     In Configure mode  select File  gt  Page Setup   The Page Setup dialog box appears     PAC Control User s Guide    4        CHAPTER 7  WORKING WITH STRATEGIES          1 Flowchart Graphics   Page Setup    Graphics Scaling     Ad
424. ords  If a  naming conflict is found  you may need to rename an object or perform some other housekeeping  procedures  When converting to a newer PAC Project  make sure to update PAC Control strategies  first and then PAC Display projects so that PAC Display projects are updated based on changes to the  strategy database     List of Common Messages    The following messages may appear in PAC Control  They are listed in numeric order     If an X appears in the Q  column  the code number appears in the message queue  If an X  appears in the I O  column  the message is an I O unit error and may appear either in the  message queue  as a status code in a variable  or both  For more information on handling   O    PAC Control User s Guide 373    LIST OF COMMON MESSAGES       unit errors  see    Error Handling Commands    on page 286 and form 1776  Optimizing PAC Project    System Performance                                         0 Operation performed successfully  NOT AN ERROR  Indicates the command was successful    1 Undefined command  An unknown command was sent to the PAC Control engine   When comparing DVFs  Data Verification Fields   a mis    2 Checksum or CRC mismatch  match occurred  Examples of DVFs include checksum and  CRC   In string manipulations  a string was requested that is longer   3 Buffer overrun or invalid length error  than the string it will be put into  or the destination string  length  lt   0   d Device has powered up    Powerup clear NOT AN ERROR  The de
425. ors    switch  endswitch  case  break  default    while   do   wend ei  null   repeat   until    The following table lists operators in order of highest to lowest precedence                                        negation  not logical not  bitnot bitwise not    multiplication    division    modulo division    subtraction    addition     string append assignment   lt  lt  bitwise left shift   gt  gt  bitwise right shift             PAC Control User s Guide 395    OPTOSCRIPT LEXICAL REFERENCE       396                                                                            equality   lt  gt  non equality   lt  less than   lt   less than or equal to   gt  greater than   gt   greater than or equal to  bitand bitwise and  bitor bitwise or  bitxor bitwise exclusive or  and logical and  or logical or  xor logical exclusive or  not logical not     parentheses no precedence      brackets no precedence  colon no precedence    semi colon no precedence    comma separator no precedence    assignment no precedence   amp  address of no precedence  Comments    OptoScript has two kinds of comments  single line and block     Single line comments are indicated by two slashes  followed by any sequence of characters  until  the end of the line    Examples    i   a   b     this is a comment   i  a   b    determine i by adding a and b together      i  a   b     This whole line is commented out   Block comments are indicated by a slash and an asterisk       followed by any sequence of  characters
426. ost power or network connection  When  communicating with I O Units  retries are logged in the mes   sage queue        PID Loop has been configured outside of this  strategy and could conflict with this strat   egy s logic      700    You are trying to download a new strategy  but a PID loop is  currently running on the brain  Open PAC Manager and turn  off the loop in Inspect mode by changing its algorithm to  None         8607 Invalid protocol     Attempted to set a port to an unknown mode         8608 Port initialization failed              While starting up a chart or task  the default host port could  not be created        378 PAC Control User   s Guide             APPENDIX B  ERRORS AND MESSAGES    Each command sent by the PAC controller has a sequence  ID  Each response from an I O unit includes the sequence  ID of the command it is responding to  This allows the con   troller to verify that a response from an I O unit matches the  most recent command sent to that I O unit        An out of sync error would occur  and be posted in the PAC  controller s message queue  if the response received by the  controller is for a previous command rather than the current  command     It usually occurs like this   Controller sends a command and waits the timeout period  for the response  If no response is received  it sends a  re transmit of the same command  but with a new sequence  ID  The controller receives a response to the original com    8612 Old response to new command mand 
427. ou want to stop the strategy    Click Stop Strategy     To close the strategy  select File  gt  Close Strategy  or select File  gt  Exit to quit PAC Control  If  dialog boxes ask whether you want to remove breakpoints and take charts out of stepping  mode  click Yes     Your introduction to PAC Control is now complete  Using the sample Cookies strategy  you have  learned how to     Open  save  and close a strategy   Work with the Strategy Tree   Work with charts and add commands in blocks   Configure a control engine   Compile  run  step through  and add breakpoints to a strategy  Make an online change   Use a watch window to monitor variables and I O points     The rest of this book expands on the knowledge you ve just acquired  Now may be a good time to  look at the table of contents or thumb through the book and familiarize yourself with its contents   Some sections you may want to read  others you ll probably just refer to as needed     PAC Control User   s Guide       3  What Is PAC Control     Introduction    The tutorial in Chapter 2 introduced you to PAC Control without explaining much about it  In this  chapter we ll learn more about PAC Control and see its main windows and toolbars     In this Chapter   About PAT Control    43  General Control COnCept ettet 45  PAC Control Terminology                      s 47  PAC Control Main Window    52    Windows and Dialog Boxes in PAC Control      57  Customizing PAC Control for Your Needs         65  Online Help             
428. ough a chart one  block at a time  The Step Over button may be all you need to find any problems  If necessary  go  back to Configure mode and change to full debug  see    Choosing Debug Level    on page 176  so  you can step into blocks and execute one line at a time     1  Pause the chart or subroutine to be stepped through by pressing the Pause Chart or Pause  Subroutine button Ill      2  lostepto the next command block  click the Step Over button tr  or press F10  or select  Debug  gt  Step Over      The commands in the highlighted block are executed  the hatch marks move to the next  command block  and the chart pauses again  Compare the chart below to the one on  page 177  The hatch mark has moved to the next block     Dough  Chip  Control    Drop the dough       Drop the chips           EZ EX i Shortcuts   99  v  PAA                             3  Ifyou need to step inside flowchart blocks and move through them one command at a time  or  in OptoScript blocks  one line of code at a time   make sure you have downloaded your strategy  at the full debug level  See    Choosing Debug Level    on page 176 for help    4  Ifthe chart or subroutine is not already paused  press the Pause Chart or Pause Subroutine  button Il     PAC Control User   s Guide    CHAPTER 7  WORKING WITH STRATEGIES       5  To step inside the block you are on  the one with the hatch marks   click the Step Into button  Ti  or press F11  or select Debug  gt  Step Into      The Step Into button takes you 
429. ounter   scanning  Communication handle variables  Name  nCookie Counter show slightly different fields        Value 42908     3  More Info Minimize button          Scanning stops whenever you click a changeable field  It resumes once you click Apply  another  button  or an unchangeable field  If scanning resumes before you click Apply  any changes you  made are lost     If you do not want to change the value of the variable  you can click the Minimize button to  shrink the dialog box back to its original size     To view the configuration information about the variable  click More Info     230 PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS                 bStartFlag          NAME  bStartFlag  DESCRIPTION   TYPE  Integer 32 Variable    SCOPE  Global  Q INITIALIZED  Download    INITIAL VALUE  0       Name  bStartFlag       Value   O       j      Decimal       Binary    A numeric variable can appear as decimal  hexadecimal  or binary  A string variable can appear  as ASCII or hexadecimal     To change the value of the variable  type the new value in the Value field and click Apply   The field turns magenta until you click Apply     For a string variable  if your change lengthens the string beyond its maximum width  the string  is truncated to fit     For a communication handle variable  changing the value of the variable here has the same  effect as using a Set Communication Handle Variable command  If the communication handle  is currently open  the value 
430. out of range  e     Feed forward gain   e Square root of input    In the SNAP PAC  the derivative is applied only to the process variable  the input  and not to the  setpoint  This means you can change the setpoint without causing spikes in the derivative term   These PIDs also prevent integral windup by back calculating the integral without the derivative  term  The feed forward term   bias   is added before output clamping and has a tuning factor     If desired  you can cascade PIDs by simply using the output point of one PID loop as the input point  for another     Algorithm Choices  PID     When you configure a PID loop in PAC Control  choose one of the following algorithms    e Velocity   Type C  available only for PAC R  EB  and SB with firmware version 8 5e and higher   e Velocity   Type B   e ISA   e Parallel   e Interacting    The only difference between Velocity   Type C and Velocity   Type B is the Term P equation  see  equations below   The ISA  Parallel and Interacting algorithms are functionally equivalent  the only  difference is the way the tuning constants are factored  The identical and differing equations for all  algorithms are shown in the following sections     PAC Control User s Guide 301    PID   ETHERNET COMMANDS       Key to Terms Used in Equations                          F Derivative tuning parameter  In units  Process variable  the input to the      PV PID TuneD of seconds  Increasing magnitude  increases influence on output   SP Setpoint Output O
431. p 22004                Ethernet TCP   from another control engine tcp 22005       To add a communication handle  see the steps starting on page 248  In the Add Variable dialog box   enter the communication handle value in the Initial Value field     PAC Control User s Guide 251    COMMUNICATION COMMANDS       252    Add Variable          Name    TCP Comm Handle Incoming    Description     Type  Communication Handle     e         Initialization   O Initialize on strategy download      Initialize on strategy run      Persistent  Communication  handle value       Initial Value   tcp 22004                  Cancel Help       Opening and Closing TCP IP Communication Handles    When using TCP IP communication handles  a communication handle s value that begins with     tcp     keep in mind that the controller has a limited amount of TCP IP resources  and so you need to  be careful about how frequently these communication handles are opened and closed  TCP IP  handles are meant to be left open as long as possible     Per the TCP IP specification  each time one of these resources are closed  they are unavailable for  120 seconds  Rapidly attempting to open and close TCP IP communication handles quickly places  all available resources in the unavailable condition     Once this unavailable state occurs  a communication handle will be unable to gain a resource upon  the next Open Outgoing Communication command  This effectively causes a lock out of any new  TCP IP connections to be made 
432. p sets the first five elements  elements 0 through 4  of a table  ntTable  to a    value of 10       nIndex   0 4       ntTable nIndex    10      nlIndex   nIndex   1           j  wend          matching wend at the end  For example        Initialize the counter     while  nIndex  lt  5 4                                         Execute loop if condtion is true     Set the table element   Increment the counter     hile loops can be nested and can contain other kinds of program statements  Fach while needs a       ni   0   while  n1    100     nti n1    ni   100   ni   n1   1   wend  nti n1    nl   nil   nl   1   wend       while   n1  gt  50  and  n1  lt  60            PAC Control User   s Guide    CHAPTER 11  USING OPTOSCRIPT       Repeat Loops    Repeat loops  in contrast to while loops  are used to execute a list of statements until a given  condition is true  Because the condition is tested at the end of each loop  the content of the loop will  always be executed at least once    This example sets the first five elements of ntTable to 10  Compare this example to the example for  while loops to see the difference           nIndex   0     Initialize the counter    repeat  ntTable nIndex    10        Set the table element   nlIndex   nIndex   1       4 Increment the counter    until  nIndex  gt   5     Fxit loop if condition is true                          Repeat loops can be nested and can contain other kinds of program statements  Fach repeat  statement needs a matching unt
433. pad 7 Move to Bottom Numeric Keypad 2   Move to Top Numeric Keypad 8 Move to Bottom Right Numeric Keypad 3   Move to Top Right   Numeric Keypad 9 Zoom to Fit and Center   F   Move to Left Numeric Keypad 4 Zoom to 100  Z   Move to Center Numeric Keypad 5 Pan Space   Left Mouse Button  Move to Right Numeric Keypad 6 Block Preview Middle click on a block                         Online Help    To open online Help  choose Help  gt  Help Topics  or click the Help button in any dialog box  Help  buttons in dialog boxes are context sensitive and provide help specifically on that dialog box   Buttons labeled    Command Help    give specific information on the command  instruction  you are  currently using     For brief explanations of buttons  move your mouse over the button and look in the status bar     In Action and Condition Instructions dialog boxes  let your mouse rest for a second on an instruction   command   and you ll see a list of the variable types used in that command   To show or hide the  variable types list  in Configure mode  choose PAC Control Options  gt  Show Hide Instruction Type  Information      To open online copies of PAC Control manuals and quick reference cards  choose Help  gt  Manuals   You will need Adobe Acrobat Reader to open these files  You can also find information  documents   and support on the Opto 22 website by choosing Help  gt  Opto 22 on the Web     PAC Control User s Guide    ONLINE HELP       E PAC Control User s Guide       4  Designing You
434. pe  Pointer Variable    Item Pointed To  nLoopCounter       2  To view the status or value of the item pointed to  click the Inspect button     PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS       If you need help  follow the steps in    Viewing Numeric  String  and Communication Handle  Variables    on page 230     Viewing Numeric and String Tables    1     Make sure the strategy is running in Debug mode  On the Strategy Tree  double click the table  variable you want to view     The View Table dialog box appears  showing the table s name  length  maximum number of  entries   width for a string table  initialization method  and security level  It also lists the index  and value of each table entry  The title bar includes the name of the variable and indicates  whether scanning is occurring     Here s an example for a string table     3 4  Days  Table   scanning     Mame  Days Table         Index Value     0 Sunday  1  Monday     2 Tuesday     3 Wednesday                      4 Thursday  5 Friday  B Saturday          Met       Scanning for an individual table element stops whenever you select an element in the table  It  resumes for that element if no changes are made and another table element is selected  or  when you click Apply  A magenta background indicates that scanning is stopped     To change the format of the elements  click the button to the right of the Watch button           Hexadecim  l    For string tables  you can select either ASCII or Hex
435. peed 176  digital I O while strategy is running 142  I O points 134  I O unit configuration 121  I O while strategy is running 140  numeric variable 230  PID loop 139  pointer table 235  pointer variable 232  scale of a chart 60  strategy download compression 174  string table 233  string variable 230  text color or size 203  212  text in chart 209  variable 229  chart  adding text to 209  auto stepping 178  179  breakpoints 180  calling a subroutine 356  changing background 203  changing name or description 214  changing scale 60  dosing 213  commands 246  contents 202  copying 213    RES DAC Control User s Guide    creating 201   definition 48   deleting 214   designing 73   exporting 215   finding a block 62  flow through logic 76  guidelines for design 76  importing 216   loop logic 76   looping 322  monitoring in watch window 157  naming 77  214  opening 212   pausing 177   printing commands  instructions  187  printing graphics 184  replacing elements 194  saving 163  213  searching 192   status 48  183   stepping through 178  viewing 57  183  zooming in or out 60    chart element    changing color or size 212  cutting  copying  and pasting 211  moving 210   selecting 210    closing    chart 213  strategy 163  164    command    adding 235   adding in OptoScript 341   arguments 75   changing 239   commenting out 240   cutting  copying  and pasting 240  241   definition 49   deleting 239   deleting temporarily 240   for continue block 241   groups  analog point commands 2
436. ping 176  for loop 322  339  format  File communication handle 257  FTP communication handle 263  IEEE float 296  serial communication handle 267  TCP communication handle 249  FTP  directory listing 265  FTP communication handle 263  full debug  definition 176  functions in OptoScript 326    PAC Control User s Guide    407       G  gain   and offset 244   in PID loops 151  grammar in OptoScript 397    H    hardware requirements for PAC Control 5  help   See also troubleshooting  help  online 67  hex display mode 65  high density digital   enabling commands 198  high density points 288  host task   definition 50  hostname  control engine 92  Hungarian notation 78  329    I O  changing configured point 134  configuring 122  copying configured point 131  deleting configured point 134  disabling 284  exporting configuration 115  importing configuration 116  in strategy design 70  72  monitoring in watch window 157  moving configured point 130  naming points 78  point numbers 116  point  definition 45  saving configuration 140  segmenting I O from host network 93  using in OptoScript 326  viewing all in a strategy 188  189  I O unit  adding 116  changing 121  commands 287  289  290  291  configuring 113  definition 113  deleting 121    PAC Control User s Guide    exporting configuration 115  importing configuration 116  monitoring in watch window 157  point numbers 116  IEEE float 296  if statements  in OptoScript 337  if then statements 324  importing  chart 216  I O configurati
437. plies  These products include   but are not limited to  OptoTerminal G70  OptoTerminal G75  and Sony Ericsson GT 48  see the product data sheet for  specific warranty information  Refer to Opto 22 form number 1042 for complete warranty information        Wired  Wireless controllers and brains are licensed under one or more of the following patents  U S  Patent No s   5282222   RE37802  6963617  Canadian Patent No  2064975  European Patent No  1142245  French Patent No  1142245  British Patent  No  1142245  Japanese Patent No  2002535925A  German Patent No  60011224     Opto 22 FactoryFloor  groov  Optomux  and Pamux are registered trademarks of Opto 22  Generation 4  groov Server   ioControl  ioDisplay  ioManager  ioProject  ioUtilities  mistic  Nvio  Nvio net Web Portal  OptoConnect  OptoControl   OptoDataLink  OptoDisplay  OptoEMU  OptoEMU Sensor  OptoEMU Server  OptoOPCServer  OptoScript  OptoServer   OptoTerminal  OptoUtilities  PAC Control  PAC Display  PAC Manager  PAC Project  SNAP Ethernet I O  SNAP I O  SNAP OEM  1 0  SNAP PAC System  SNAP Simple I O  SNAP Ultimate I O  and Wired Wireless are trademarks of Opto 22     Activex  JScript  Microsoft  MS DOS  VBScript  Visual Basic  Visual C    Windows  and Windows Vista are either registered  trademarks or trademarks of Microsoft Corporation in the United States and other countries  Linux is a registered  trademark of Linus Torvalds  Unicenter is a registered trademark of Computer Associates International  Inc  ARCNET is
438. plus one host  task  can run at once  On a SNAP PAC S series controller  32 charts  plus one host task  can run at    PAC Control User   s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY       once  On a SoftPAC controller  64 charts  plus one host task  can run at once   For more information   see    Optimizing Throughput    on page 87      In general  follow these chart guidelines     e     Use the Powerup chart just to set initial values for variables  perform setup commands  and  start the main charts  Use flow through logic so the Powerup chart will stop as soon as the  other charts begin     e Create a few charts to monitor essential or time critical pieces of your process  such as  emergency stops on dangerous equipment or I O that must be monitored continuously  These  charts should use loop logic so they are constantly running     e Ifa set of operations is used multiple times in your strategy or is used in more than one  strategy  you can put that logic in a subroutine and call the subroutine when needed  Calling a  subroutine doesn t require as much time as calling a chart or starting a new chart  In addition  a  subroutine starts as soon as it is called in the context of the chart that is calling the subroutine   A Start Chart command is simply placed in the task queue and started in turn  See Chapter 12   Using Subroutines for more information     e  Usethe text tool to type a descriptive title in each chart and add any necessary explanations   Keep blocks far enough
439. ptions    Archive   Download   Legacy   Serial 1 0 Ports       C Archive strategy to disk when strategy is downloaded                2  On the Archive tab in the Strategy Options dialog box  select  Archive strategy to disk when  strategy is downloaded    Also select  During download  save archive to the control engine and  save strategy to flash memory     Strategy Options    Archive   Download   Legacy   Serial 1 0 Ports       C Archive strategy to disk when strategy is closed  Archi i                3  Click OK     The strategy will be archived to the computer and to the control engine when it is  downloaded  Any archive already on the control engine will be replaced by the new archive  In  addition  the strategy will be saved to flash memory  so it will still be available if power to the  controller is turned off     PAC Control User s Guide 107    RESTORING ARCHIVED STRATEGIES FROM THE CONTROL ENGINE       Restoring Archived Strategies from the Control Engine    If original strategy files are lost or damaged  you can use PAC Terminal to restore the strategy archive  from the control engine to a computer     1  Click the Windows Start menu and choose Programs  gt  Opto22  gt  PAC Project 9 2  gt  Tools  gt   PAC Terminal     The PAC Terminal window appears     File Tools Configure View Help    Control Engines   Controller Name System Type Address 1 Address 2 G re Control Engines  4 Cookie Controler     Standard 4127 0 0 1 E iQ Add         PR1 Controller Standard 410 195 5
440. r   click any column heading    4  Toemailthe information to Opto 22 Product Support  click E mail    The utility saves the list to a file named Version bd in the same directory that contains  OptoVersion exe  If you use Microsoft Outlook as your email program  a new message  automatically appears addressed to Product Support  with the version file attached    5  If you use Microsoft Outlook  add comments to the new message and click Send    6  Ifyou use another email program  attach the Version bd file to an email message and address  the message to support opto22 com  along with an explanation of the problem you re  experiencing    7  To save the file  click Save As  Give the file a name and save it in the location you want   OptoVersion also creates a tab delimited file with the same file extension and in the same  directory  This file has the same name you gave it but with _Delimited added  For example   if you name the saved file opto software   txt  the tab delimited file is named    PAC Control User s Guide    APPENDIX A  TROUBLESHOOTING       Opto software Delimited txt  This file can be opened in Microsoft Excel or other  programs to easily sort and view its contents     Problems with Permissions in Windows    When you set up controllers on a computer running the Microsoft Windows operating system   typically you are using the computer with top level  administrator  privileges  If someone later uses  this same computer to run PAC Control or PAC Display  but logs in t
441. r Strategy    Introduction    This chapter introduces you to PAC Control programming   how to design a PAC Control strategy to  control your automated process  For additional important information on using PAC Control  commands  instructions  to program your strategy effectively  see page 243 and the individual  command information in the PAC Control Command Reference     NOTE  Because our focus in PAC Project is on the SNAP PAC System  PAC Control initially shows only SNAP  PAC I O units and the commands used with them  When youre using the SNAP PAC system only  hiding  legacy I O units and commands makes it simpler and less confusing to build your strategy  However  the  legacy capabilities are still there and can be made visible in a specific strategy as needed  For information   see    Legacy Options    on page 196     In this Chapter    EES EO DIEI  te  FSFE iT  M       P                  Instruction Examples                 Optimizing Throughput       Steps to Design    How do you get from your real world control problem to a working PAC Control strategy that solves  it  Here s an outline of the basic approach  we ll fill in the details on the following pages     First  solve the problem   e  Definethe problem      What am trying to do      What inputs and data do   have to work with        What do the outputs have to be      How many times does the process have to be repeated   e Design a logical sequence of steps to solve the problem     PAC Control User s Guide   69 
442. r a  controller or an I O unit  In the case of a controller brain  they can refer to the devices own memory  map or a memory map on another device     Read Number from I O Memory Map   Read Numeric Table from I O Memory Map  Read String from I O Memory Map   Read String Table from I O Memory Map  Write Number to I O Memory Map   Write Numeric Table to I O Memory Map  Write String Table to I O Memory Map  Write String to I O Memory Map    Memory map commands make it possible for advanced users to read from or write to any Opto 22  memory mapped device  such as a SNAP PAC controller or brain  You can use these commands to  read or write to any address within the memory map  The commands are especially useful for  reading data from a SNAP device using newer features that may be available in the memory map  but are not yet incorporated into PAC Control     NOTE  If you are reading or writing to the devices Scratch Pad area  use the I O Unit   Scratch Pad  commands instead  see page 291   If you are changing event messages  use the I O Unit   Event Message  commands instead  page 289      In order to use these commands with a SNAP PAC S series or SoftPAC controller  first you need to  create an I O Unit of the type Generic OptoMMP Device to represent the controller  Use the  controller s IP address or the loopback address  127 0 0 1     When you use these commands  make sure that you read or write the correct type of data  integer   float  string  to match the specified memory map
443. r each chart in a strategy  If two charts were  to run simultaneously while sharing an open communication handle  each chart would be able to read  and write data from the communication handle as ifthe other running chart didn t exist  Because these  reads and writes are not synchronized between the charts  it is possible for one chart to read the other  chart s data     Incoming and Outgoing Communication    TCP communication is normally requested by the device that needs the data  For example  a PAC  Control strategy running on SNAP PAC I O unit A might need the value of a set of variables from  another strategy running on SNAP PAC I O unit B  Unit A would request communication using the  command Open Outgoing Communication  Unit B would Listen for Incoming Communication and  then Accept Incoming Communication to establish the connection  Once connected  data could be  transmitted and received in both directions     This scenario is similar to the way we use the telephone  If Joe Wong needs information from Saul  Garcia  he requests communication by calling Saul on the phone  opening outgoing  communication   If Saul is there  listening for incoming communication   he answers the phone   accepts incoming communication   and the connection is completed  Once connected  both Joe  and Saul can talk and listen to transmit and receive information        Depending on the situation  you may want to have both peers request communication and  establish two connections between them  
444. r example     File  gt   Open Project  means to select the Open Project command from the File menu     e Numbered lists indicate procedures to be followed sequentially  Bulleted lists  such as this one   provide general information     Documents and Online Help    To help you understand and use PAC Control systems  the following resources are provided     e Online Help is available in PAC Control and in most of the utility applications  To open online  Help  choose Help    Contents and Index in any screen     e     PAC Control User s Guide shows how to install and use PAC Control     e PAC Control Command Reference contains detailed information about each command   instruction  available in PAC Control     PAC Control User s Guide    INSTALLING PAC CONTROL       e  Aquick reference card  located in the front pocket of the PAC Control Command Reference  lists  all PAC Control commands plus their OptoScript code equivalents and arguments     e     PAC Manager User    Guide and other guides provided with specific hardware help you install   configure  and use controllers and I O units     Online versions  Adobe  pdf format  of PAC Control documents are provided on the CD that came  with your controller or purchase of Professional software and are also available from the Help menu  in PAC Control  To view a document  select Help  gt  Manuals  and then choose a document from the  submenu     Resources are also available on the Opto 22 Web site at www opto22 com  You can convenient
445. r select Debug  gt  Pause Chart or Debug  gt  Pause Subroutine  Here s an    example of a paused chart     Powerup    NECS 3    Wait until start flag is set  true  non zero      Start the alarm monitoring   dough chip control  pressure  control  and oven inspection  charts                 EX          SU NEUES i Shortcuts  100   v                   Hatch marks and a red outline appear on the Start block  indicating that this block is to be executed  next  The status bar shows Step On  which means you can step through the chart or subroutine if    you wish     PAC Control User s Guide 177    DEBUGGING       178    Stepping Through a Chart or Subroutine    When you step through a chart or subroutine  you control the timing and execution of its  commands in a running strategy  You can see what commands are being executed when  and you  can monitor the status of variables and I O that are affected by the commands    There are two types of stepping  single stepping and automatic stepping  Use single stepping to go  through flowchart blocks at your own pace  Use auto stepping to watch the flowchart step  automatically     CAUTION  Since stepping through a running chart or subroutine   even auto stepping   slows down  execution  be cautious if your strategy is running on real equipment  For example  stepping through a  strategy might leave a valve open much longer than it should be     Single Stepping    When you are debugging a strategy  start by using the Step Over button to go thr
446. rage  See flash memory  permissions in Windows 369  persistent data 220  persistent RAM 363  PID loop  algorithms 301  changing 139  configuring 134  301  definition 300  deleting 140  determining system lag 147  inspecting 146  tuning 151  PID   Ethernet commands 300  pointer  adding 221          commands 303  331  definition 49  219  303  in OptoScript 331  programming example  indexing  85  pointer table 304  adding 224  port  Ethernet 256  peer to peer communication 250  Powerup chart 49  uses 77  precedence for operators 395  primary and secondary addresses  for I O unit 118  printing  bill of materials 190  191  chart commands  instructions  187  chart graphics 184  chart instructions 241  page setup 184  subroutine commands 187  problems  see troubleshooting  Product Support 4  programming  comparing OptoScript with other languages  387  examples 79  in PAC Control 69  pulse  commands  instructions  283    Q  quadrature counter commands  instructions   283  queue  checking messages 103  372  quotation marks in strings 330    R    RAM 363   redundant communication links 94  287  redundant controllers 99   repeat loop 322  339   repetitive actions programming example 81  replacing elements 194   resolution  timer 315   retrieving a directory listing 265    RTS CTS 268   running a strategy 26  automatically 175  manually 175    S  saving  chart 163  213  configurations to flash memory 141  files to flash memory 280  strategy 163  strategy to flash 165  subroutine 355  sav
447. re     nStatus   Variable Increase Notification  bCondition  nValue  Outputl       PAC Control User s Guide    CHAPTER 12  USING SUBROUTINES       For more information on entering a command  instruction  in OptoScript  see    Using the  OptoScript Editor    on page 340    3  In the Instructions dialog box  click where you want the instruction to be placed  and then click  Add   The Add Instruction dialog box appears     T Add Instruction          Instruction   Absolute Value  E     Comment             Type Name       OF All Valid Types aiD oughVesselPressure                Put Result in  AI Valid Types aoConveyorS peedContral          4  Inthe highlighted Instruction field  enter the subroutine name  or choose it using the  drop down list  or click the Select button and locate it in the command group you chose      NOTE  If you click Select  you will find subroutines located in the Subroutine group by default  If you  want subroutines in a different group  you can change group when configure the Subroutine s  parameters  See    Configuring Subroutine Parameters    on page 350     The subroutine command appears in the dialog box  just as any command would  and the  prompts you entered when you configured the parameters appear also     tAdd Instruction    Instruction    Variable Increase Notification          Comment                Type  It  Al Valid Types             It Greater Than   All Valid Types    Prompts              Then Enter Text    All Valid Types                The
448. re all required elements are present  For example  every if must have a then and an endif  See     OptoScript Control Structures    on page 336 for more information     Type Conflicts    Type conflicts are caused when different data types are incorrectly mixed  For example  you cannot  assign an integer to a string  Make sure data types are correct  It is easier to keep track of data types  if you use Hungarian notation when naming variables  See    Variable Name Conventions    on   page 329 for help     PAC Control User s Guide 345    DEBUGGING STRATEGIES WITH OPTOSCRIPT       Debugging Strategies with OptoScript    Before trying to debug strategies containing OptoScript code  make sure the code has been  compiled within each block  or choose Compile All to do all blocks at once     When you begin debugging the strategy  start by stepping through whole blocks  If you run across a  problem  then step within that block  Stepping within the block is discussed in    Choosing Debug  Level    on page 176     346 PAC Control User   s Guide       12  Using Subroutines    Introduction    This chapter shows you how to create and use subroutines     In this Chapter  About Subroutines               s 347  Creating SuDIoUtines    ueit c 348    Using Subroutines            Viewing Subroutines  Printing Subroutines       About Subroutines    A subroutine is a custom command that represents a series of commands  Subroutines are useful  anytime you have a group of commands that is repeated i
449. re changed for the strategy or subroutine     Enable Ethernet  Ultimate  and Simple I O Units and Commands    If you re using any of the I O unit types shown in the following table  you should enable Ethernet   Ultimate  and Simple I O units and commands  When you do  both the I O unit types and the  commands shown in the table will become available in the strategy     IVAL Set Digital 64 I O Unit from MOMO Masks  DEPRECATED   IVAL Set Mixed 64 I O Unit from MOMO Masks  DEPRECATED   IVAL Set Mixed I O Unit from MOMO Masks  DEPRECATED   IVAL Set Simple 64 I O Unit from MOMO Masks  DEPRECATED   Set Digital 64 I O Unit from MOMO Masks  DEPRECATED    Set Mixed 64 I O Unit from MOMO Masks  DEPRECATED    Set Mixed I O Unit from MOMO Masks  DEPRECATED    Set Simple 64 I O Unit from MOMO Masks  DEPRECATED     SNAP ENET D64  SNAP B3000 ENET   SNAP ENET RTC  SNAP UP1 D64  SNAP UP1 ADS  SNAP UP1 M64  SNAP ENET S64                PAC Control User s Guide 197    LEGACY OPTIONS       198    Enable High Density Digital Module Commands    All SNAP high density digital modules are fully supported by the SNAP PAC System using regular  digital point commands  However  three of our older HDD modules can also be used with  analog capable SNAP Ultimate  SNAP Ethernet  and SNAP Simple I O units  if you use the older     deprecated    HDD commands     If you are using SNAP ODC 32 SNK  SNAP ODC 32 SRC  or SNAP IDC 32 HDD modules with these  older I O units  you should enable High Density Digital modu
450. re pieces of  information you must enter in the instruction  You can also press F1 to open online help for  commands  which gives you the same information as in the printed Command Reference     For example  one of the commands shown above  Set Down Timer Preset Value  has two arguments   The Command Reference and online help tell you that the first argument   the target value  or the  value from which the timer counts down   can be a float variable or a float literal  entered in either  decimal or hexadecimal form   and that the second argument is the name of the down timer  variable  You need this information when you enter the instruction in the Add Instruction dialog  box     T Add Instruction    Instruction    Set Down Timer Preset Value       Comment            Type    Float Literal    Arguments  lt 1        The sample flowchart we ve shown uses standard PAC Control commands only  If you have a  programming background  you may wish to incorporate OptoScript blocks in your flowchart   OptoScript is a procedural language that can simplify some programming tasks  including string  handling  math calculations  and complex loops and conditions  See Chapter 11  Using OptoScript  for more information     Compiling and Debugging the Strategy    When all charts are completed and their instructions added  the next step is to compile and debug  the strategy  But first  check your hardware  Check cabling and connections  and make sure the  actual I O matches the configured I O in t
451. recently used  choose its name from the list at the bottom of the File  menu  The ten most recently opened strategies are listed     Loading a Strategy or Mode at Startup  To have PAC Control automatically start up with the strategy that was open when you exited  choose  Configure  gt  Options and click to put a check mark next to Load Last Strategy at Startup     To have PAC Control open strategies in the same mode as when you exited PAC Control  choose  Configure  gt  Options and click to put a check mark next to Load Last Mode at Startup     162 PAC Control User s Guide    CHAPTER 7  WORKING WITH STRATEGIES       Opening Strategies in PAC Control Basic and PAC Control  Professional    A strategy saved in ioControl version 6 1 or less can be opened in either PAC Control Basic or  Professional  A PAC Control Basic strategy can also be opened in PAC Control Professional  However   PAC Control Professional strategies cannot be opened in Basic or in any earlier version of PAC  Control     CAUTION  Once a strategy is opened in PAC Control Professional  it can no longer be opened in PAC  Control Basic        Opening an OptoControl Strategy    If you are moving a strategy from OptoControl to PAC Control Professional  PAC Control will open it  and help you convert it  Although many things will convert without difficulty  planning ahead is  essential to make the job easier  Before opening an OptoControl strategy in PAC Control  read  form 1692  the FactoryFloor to PAC Project Migrat
452. reren  Printing  All Charts ima  SUategy sso iere di deeedia tise dies ia Eo Ee ene dads tose Yd  Viewing and Printing Strategy or Subroutine Commands                0 6    e eee  Viewing and Printing Strategy or Subroutine Elements                   000 cece eee  Viewing and Printing a Cross Reference          sss  Viewing and Printing a Bill of Materials   0 0 0 0    occ c cece  Viewing and Printing I O Point Mappings          ssssssssssssR eens    Searching and Replacing   reet qantas rtr cereo Urol eem tehes bed E THES  Searching  were S  REDIACING ensani cada auumdennnadhed acagatanen ch Reaneega ven ne maramnegnoiaanage nein    LEGACY OPTIONS  ass cnet avothes MUT ky dae thes Im ead hotles ine BMdanet oo Gade dues  EXISTING SIAC OES  Rc   New Strategies  ix ee dent ves te ehe dass tuta rho abd tp reta telae etie dd a dd dart  Enabling Legacy Options    soe eee ee tete tx hee doe e ende erede   Enable Ethernet  Ultimate  and Simple I O Units and Commands                   Enable High Density Digital Module Commands             sss  Enable mistic  O Units and Commands             000  c ccc eee eee e eee e eens             Chapter 8  Working with Flowcharts              ccc eceec cece cece ne    PAC Control User s Guide          JIE Gl OST ON ERE EET E EET aa tty etree Greece talk ane rE 201              UNIS  CHAPIENs oreet bro dcr ey tre prebere debe ape ebbe ena dle 201  Creatingia New Chalt    uoce sorte teret OOIEOE ebledev ot be venti Bu 201  Working with Chart Elem
453. riable  A PAC Control timer stores elapsed time in units of  seconds with resolution of milliseconds  Down timers continuously count down to zero  and up  timers continuously count up from zero  Timers can be paused and continued     To create a timer in PAC Control  configure a numeric variable and select the type Up Timer or Down  Timer  You can use any PAC Control command  for example  Move  that references a numeric  variable to access a timer  You can view the current value of a timer at any time in PAC Control  Debug mode     Since the timer is independent from the control engine s clock  over thousands of seconds  the timer  and the control engine s clock will not match  Timers do not place any additional load on the CPU     Down Timer Operation    The Set Down Timer Preset Value command sets the time the down timer will start from  but does  not start the timer  Use the Start Timer command to start the timer counting down to zero   Since  the default preset value for a down timer is zero  nothing will happen if you use the Start Timer  command before setting a value      Alternatively  you can use the Move command to set the time the down timer will start from  If you  use Move  the down timer begins counting down immediately  If program execution speed is a    PAC Control User s Guide    TIMING COMMANDS       priority  use the Move command and put an integer value rather than a float into the timer  This  action eliminates the float to integer conversion time     Not
454. rned by commands such as Transmit  Numeric Table and Receive Numeric Table  and close communication if there are errors  If your PAC  Control application opens sessions but does not close unused or bad sessions  the maximum  number of sessions could be used up  Note that communication should not be closed for timeout  errors from Receive commands  error numbers  37 and    39   however  because these errors simply  mean that there was no data waiting in the receive buffer for the specified session     To save time  before using a Receive command  such as Receive String or Receive Numeric Table    TCP IP charts should use the command Get Number of Characters Waiting  If there are zero  characters waiting  then there is no reason to use the Receive command  It is also a good idea to  start a down timer  and then loop on the Get Number of Characters Waiting command until either  there are more than zero characters waiting  or the timer expires     The following chart is also an example of TCP IP communication on controller COM ports  but with  three differences  in this case another device is requesting communication  the peer will both  transmit and receive  and error checking is shown for the commands Get Number of Characters  Waiting and Receive Numeric Table  Similar error checking should be used for transmit commands   which in this strategy are in another chart     PAC Control User s Guide    COMMUNICATION COMMANDS       256    EEK          gt   s       Shortcuts  100      
455. rol User s Guide 167    COMPILING AND DOWNLOADING       168    Compile Progress      Compiling tags     WARNING   Serial port 2 is being used by 1 0 Unit  Mixed IO  but has not been configured for 1 0   Compiling charts     Condition Delay  Conveyer   peration  Powerup  Shipping Area  Timer Example Chart  Compiling subroutines     Building run file     Done     D error s   1 wamina s     Progress  ULL LLLI   Eo  t A   Wamings  1    Close       If there are errors  the strategy will not compile  Click Close to continue in Configure mode   If there are only warnings  click Close to continue in Debug mode   If no errors or warnings occur  the Strategy Download dialog box appears     I Strategy Download    x Downloading your strategy       Download strategy       NENREBRRRRRRRRRRRRRRRNN       Store to flash memory    888                The Strategy Download dialog box will vary somewhat depending on your settings     NOTE  Ifyou are using background downloading  see    Background Downloading  on page 170   while the  strategy is downloaded  there may bea very slight degradation in performance  This is due to the overhead  on the controller to process the strategy download     4   Optional  If there is already an active strategy which is set up to have an alternate strategy  and  you want to switch strategies  click Switch  amp  Run to stop the active strategy and run the  strategy you just downloaded  Or  you can click Switch to stop the active strategy and make the  new strategy
456. rollers can run up to 32 charts plus one host task simultaneously  a SoftPAC controller can run  up to 64 charts plus one host task simultaneously  The host task is an invisible chart used to  communicate to a PC  which may be running PAC Control in Debug mode or PAC Display        Each chart in a running or suspended state counts toward the total that can run simultaneously   Charts that are stopped do not  When the Powerup chart is running  it also counts     The actual order and timing for running tasks is not deterministic   that is  it is not always the same   but depends on priorities at any given time  For example  communication may sometimes take a  higher priority than a running chart     OptoScript block    OptoScript blocks are hexagonal blocks in a flowchart that contain OptoScript code  OptoScript is a  procedural language that can simplify tasks such as math computations  string handling  and  complex loops and conditions  OptoScript blocks can have more than one entrance but only one  exit     output point    Output points are wired to hardware that receives information from the brain and uses this  information to control components of the process  For example  lights  motors  and valves are all  devices that can be wired to output points  Using an output point  the control engine in the brain  might turn on a light or open a valve     pointer    A pointer does not store the value of a variable  instead  it stores the memory address of a variable or  some other
457. rom the pop up menu     The Inspecting dialog box opens     PAC Control User s Guide 101    INSPECTING CONTROL ENGINES AND THE QUEUE       102    Qo      Ir amo     o       Inspecting  Cookie Controller    Control Engine  SNAP PAC R2 at 10 192 54 115  Firmware Version  R8 3a  12 23 25 September 18  2008    Volatile RAM  4 98 MB free    Battery backed RAM  1023 96 KB free  File Storage RAM  1 90 MB free    Up Time  12 days  19 hours  27 minutes  25 seconds  Device Time  12 23 59 June 22  2009 Sync time to PC  F    Message Queue     messages    Strategy information  Active  Cookies  17 39 19 June 17  2008   5 chart s  running Archive  No l      p Run   E Stop  4 Store to Flash K       Alternate  Not Enabled    Stored in Flash     strategy is stored in flash memory  Autorun  O Enabled    Disabled    Communication    Loop Time  7 59 msec  Comm Errors  None    Close    Here you see data relating to the control engine  If you are using Ethernet link redundancy in PAC  Control Professional  remember that the information shown is for the IP address you chose before  entering Debug mode   See    Using Strategies with Link Redundancy    on page 99 for more  information      A   Control Engine  Type of device the control engine is running on and the devices IP address     B   Firmware Version  Version number of the firmware  kernel  loaded on the device  and the  date the firmware was released    C   Memory Available  Amount of memory  RAM  available on the control engine  For  example 
458. routines  and to configure control engines  I O  and variables    e Debug mode is used to download  run  and debug strategies and to view control engine and  communication status and errors while the strategy is running    e Online mode is a scaled down version of Configure mode  used to change a strategy while it  is running  You cannot add variables and I O in Online mode  but you can change ones that  already exist    NOTE  When you change a chart in Online mode  a new copy of that chart is downloaded to the  control engine  but the old one is not deleted  After you have made a few online changes  the  additional chart copies begin to take up memory  To avoid memory problems  be sure you stop the  strategy after making several online changes and completely compile and download it to clear out  old chart copies     To change modes  choose the mode you want from the Mode menu  or click its button in the  toolbar     Toolbars    Toolbars give you shortcuts for doing many things that also appear on menus  Toolbars in PAC  Control include standard Windows buttons like New and Save as well as special buttons for PAC  Control functions  The tools that you can use depend on which mode you re in  Tools not currently  available are grayed out     The following toolbars are standard in PAC Control    Mode Selection Toolbar     Configure Mode and Online Mode Toolbar    Debug Mode Toolbar     PAC Control User s Guide    PAC CONTROL MAIN WINDOW       Mode Selection Toolbar    The mode s
459. rrect    way to solve the  control problem and build the strategy  Instead  there are many possible ways  The following chart  shows one example     Sprinklers           3  Shortcuts                One difference between this chart and the human level chart on page 72 is that several delays have  been added to the chart  There is one before rechecking the hour of the day  one before rechecking  the day of the week  one before rechecking whether the timer has expired  and finally one before  starting the flowchart over again     This sprinkler system is not time critical  If the sprinklers turn on at a little past 6 00 a m  or the grass  is watered an extra few seconds  it doesn t matter  Delays give the control engine time to do other  things   For more information on delays and using control engine time effectively  see page 87      Each block in the chart contains the PAC Control commands  instructions  that do the work in the  system  For example  here are the instructions for the block    Turn on sprinklers  set timer        PAC Control User   s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY       VInstructions   Dough_Chip_Control   Start       Turn On  Sprinkler Switch    Set Down Timer Preset Value  Target Value 900 0  Down Timer Timer    Next Block  Start Timer  Timer Previous Block                As you create charts and enter instructions  keep referring to the PAC Control Command Reference   The Command Reference describes the    arguments    for each command  which a
460. s     The preview window appears  showing the image as it will print  The cursor becomes a    magnifying glass     PAC Control User s Guide    VIEWING AND PRINTING       IPAC Control Professional    Dough _Vessel_Pressure_Control  BAE   Di config l ocbuo Cioni  002 0550 55       This chart maintains the pressure In the dough vessel tank     x Magnifying glass Cursor    The Powerup chart starta  this chart    Thila chart runi  continuouwy once the  Calculate the current  program has been started   ponure setpoint minus  a deadband     When pre siure 1 greater  than or equal to setpoint   clove the pressure valve        When pre iure H less than     the setpoint minus the  deadband  open the  pressure valve        Configure           3  To zoom in at 200 percent  click where you want to see more closely  Click again to zoom in at  400 percent  Click a third time to return to 100 percent view     You can also use the Zoom In and Zoom Out buttons at the top of the window to zoom in or  out with respect to the top left corner of the image     4  If the image spans more than one page  click the Next Page or Prev Page buttons to view the  next or previous page  To switch between a single page view and a double page view  click  the Two Page One Page button     5  To print  click the Print button to open the standard Windows Print dialog box  To change  settings before printing  click Close and see  Setting Up the Page  on page 184     Printing One Chart or Subroutine  1  To print on
461. s 169  170  sync block  definition 203  syntax  common errors  in OptoScript 345  in OptoScript 327  393  397  system requirements for PAC Control 5    T    table   commands 288  299   in OptoScript 333   numeric table as alternative to strings 307  table variable 219   adding 224   changing 233  235   configuring 224   initializing during strategy download 226   monitoring in a watch window 233  235  tabs  using to view windows 57  target address 287  task queue 246  TCP communication handle 247  249  TCP IP cannot connect error  resolving 365  text block   deleting 211   moving 210   selecting 210  text  changing color or size 203  212  time date commands  instructions  314  timeouts   Send Email 276  279  timer   commands  instructions  315   definition 49   down timer 315   programming example 83   resolution 315   up timer 316   variable  definition 219  timing a process  commands used for 314  toolbar 53   drawing 203   OptoScript 341  toolbars   configuration mode and online mode 54   debug mode 55  totalizer commands  instructions  283       TPO 244  transfer control engine 109  trigonometry commands  instructions  295  troubleshooting  how to begin 361  in OptoScript 344  memory problems 363  memory problems from Online mode  changes 53  PAC Message Viewer utility 366  Product Support 4  Windows permissions 369  tuning  PID loop 151  types of OptoScript commands 328    U    Ultimate I O units and commands 197  up timers 316    V    variable   adding 221   changing 22
462. s 387  complex loops 322  conditions 324  control structures 336  debugging strategies 346  definition 317  editor 340  for loop 339  functions 326  if statements 337  language reference 387  literals 394  logical operator 335  math expressions 319  334  notes for programmers 392  numeric literals 329  numeric variables 329  pointers 331  precedence for operators 395  repeat loop 339  string handling 320  strings 330  switch statements 337  syntax 327  393  397  tables 333  toolbar 341  troubleshooting 344  types of commands 328  when to use 318  while loop 338  OptoVersion utility 368  order of precedence for operators 395  output point  definition 45  disabling 284       P    PAC Control  definition 43    PAC Control User s Guide    designing a strategy 69  directory  list of files in 382  errors 371  files  list of 381  installing 4  main window 52  mode 53  opening other applications 66  programming 69  317  System requirements 5  PAC Display 50  PAC Manager 113  PAC Message Viewer utility 366  PAC Terminal utility  downloading files 110  inspecting control engines 106  testing communication with control engine  364  PAC Utilities 106  110  364  366  368  page setup for printing graphics 184  panning 61  parallel algorithm for PID 301  parameters  subroutine 347  350  passed in subroutine parameters 347  pasting  block 211  command  instruction  240  241  connection line 211  text block 211  pausing  chart 177  peer to peer communication 219  249  256   291  permanent sto
463. s as  specified in D  Any positive integer is valid  For Ethernet  3 5 seconds  3000 5000 milliseconds  is a  good starting point        PAC Control User s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES       Associating the Control Engine with Your Strategy    After you have defined the control engine on your PC  see page 90   it can be associated with your  Strategy     1  If you are in PAC Terminal  close PAC Terminal  Open the strategy in PAC Control  Configure  mode or Online mode  and choose Configure  gt  Control Engines     In the Configure Control Engines dialog box  the engine s name appears in the list     Active Engine   Active engine R1 Controller    Engines Associated with Strategy        List of control engines    Cookie Controller             2  Check to make sure the correct control engine appears in the Active Engine field  If not   highlight the one you want and click Set Active     Only one control engine can be active  If only one control engine is listed  it automatically  becomes the Active Engine     Your control engine configuration is complete     Using Network Segmenting in PAC Control    You can take advantage of the two independent Ethernet network interfaces on a SNAP PAC  controller to segment the control network from the company network  Because the two network  interfaces are completely independent and have separate IP addresses  they can be set up on two  separate networks  Host traffic can communicate on one  while the controller communica
464. s but for the field    PAC Control User   s Guide    APPENDIX E  OPTOSCRIPT LANGUAGE REFERENCE       technicians and maintenance personnel who will use it in the field  While you could write an entire  chart  or conceivably an entire strategy  in one block  doing so would eliminate most of the  advantages of using PAC Control  Consider limiting your use of OptoScript to math operations   complex string manipulation  and other logic most suited to scripting  so you retain PAC Control s  advantages for non programmers     Language Syntax    In the same way  OptoScript syntax is meant to be simple enough for a beginner to understand but  also easy for an experienced programmer to learn quickly     Some programmers may wonder why OptoScript is not modeled after just one existing language   such as BASIC or C  Instead  one can clearly see influences from Pascal  BASIC  and C  PAC Control s  target audience is one reason  internal consistency with PAC Control commands and the capabilities  and limitations of Opto 22 control engines are another     Some aspects of OptoScript were designed to be consistent with PAC Control commands  For  instance  the bitwise and operator was named bitand in OptoScript because there is a command in  PAC Control named Bit AND     OptoScript provides all the functionality of Opto 22 control engines but is subject to their  limitations  For instance  OptoScript provides some convenient ways of working with strings  but  only to a certain point     For e
465. s moved to the IVAL as part of reading the input  point     H   Watchdog   Outputs only  To set a Watchdog on this point  click Yes  and define the value to  be assigned to the output if the Watchdog is triggered  A Watchdog is triggered if no  communication activity is detected on the bus for the amount of time specified in the Watchdog  field of this point s I O unit  For no Watchdog  click No     I   Enable  Select whether you want communication to this I O point enabled or disabled on  startup  Enabled is the default       Configuring a Serial Module    Use PAC Manager to configure SNAP serial communication modules  including the Profibus module   See the PAC Manager User s Guide  Opto 22 form 1704  for instructions     Changing Point Configuration    130    Moving a Configured I O Point    You can move most configured I O points to an empty point on the same I O unit or on a different  unit     1  With the strategy open in Configure mode  double click the I O Units folder on the Strategy  Tree     2  In the Configure I O Unit dialog box  highlight the unit the point is on and click I O Points   The Configure I O Points dialog box opens  For a SNAP I O unit  it looks something like this     PAC Control User   s Guide    CHAPTER 6  WORKING WITH I O       I Configure 1 0 Points          1 0 Unit    Sprinkler  Control Type   SNAP PACRT  Modules and Points Features   Subty        Add       5   00  SNAP IDC5D  2 5   28 VDC Digital Input  Ld sues is l    a EEE es NN            
466. s target value  use the condition Up Timer Target Time Reached  This condition tests the timer to  see if it is greater than or equal to the target time     The Stop Timer command forces the timer to stop and resets it to zero  If you want to halt the timer  and have it maintain its value at the time it was stopped  use the Pause Timer command instead   After you use Pause Timer  you can then move the timer s value at the time it was stopped to a  variable  You can also use the Continue Timer command to resume the timer where it left off     316 PAC Control User s Guide       11  Using OptoScript    Introduction    This chapter shows you how to create and use OptoScript  an optional programming language that  can simplify certain types of operations in PAC Control  Modeled after computer languages such as C  and Pascal  OptoScript code gives you an alternative to using standard PAC Control commands     In addition to the examples provided here  see the Control Basic Examples directory on your hard  drive for a fully annotated example strategy  OptoScript information is also provided in form 1638   the SNAP PAC Learning Center User s Guide     You will find OptoScript easy to use if you already have computer programming experience   Beginning programmers may also want to try it for control operations involving extensive math  calculations  string handling  or complex loops and conditions    This chapter assumes that you have some programming experience  Experienced programmers
467. s the Open Outgoing Communication and Communication Open   commands to establish a connection     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       The control engine s TCP IP flowcharts should open communication once and then continue to  transmit or receive using the communication handle  Constantly opening and closing  communication for each transaction wastes time and is inefficient     As a simple example  the flowchart at right is  designed to receive data from a serial device  such  as a barcode reader  through a serial  communication module on the same rack as a  SNAP PAC R series I O unit     Communication with serial modules is done via  TCP IP  It can be done from the SNAP PAC R system  itself  as in this example  or from another TCP IP  device on the network     Serial_Comm     In this example  the R series I O unit establishes  communication through the serial module using  the communication handle   tcp 127 0 0 1 22507   The loopback IP address is used  since the serial  module is on the same rack     When characters are detected in the receive buffer   the I O unit receives the string and processes it   and then after a short delay checks for another  message  Communication remains open for  additional messages   4  Shortcuts          This simple flowchart illustrates the basics of  handling communication  without any error checking  However  while receiving and transmitting   TCP IP control charts should also monitor the status value retu
468. s to lock the flag  Since it never  gives up  the only value that can be  returned is 0        Don   t wait at all  Succeeds only if the flag  is available to be locked immediately   Makes this a non blocking call  If the flag  is not already locked  a return of 0  Suc   cess  is returned  If the flag is locked  a   17  Already Locked  error is returned        Wait maximum of value milliseconds to  lock the flag  If it succeeds within the  specified time  0 is returned  otherwise  a   37  Timeout on Lock  error is returned     Value greater than 0                Value less than 0 Produces a 8  Invalid Data  error       Pointers and Indexing    The following examples show three possible ways to control 16 fans based on setpoints     Without Pointers    The first way  shown below  uses individual fan outputs and setpoint variables to determine whether  to turn off or on the appropriate fan  It   s a simple way to solve the problem but takes a long time to    PAC Control User s Guide    INSTRUCTION EXAMPLES       program and produces a large  repetitive section in the flowchart  It also consumes more control  engine memory  due to the large number of conditional and action blocks     Instructions   FanCtrl   01 Too Warm   Tempo1    SP01    I Instructions   FanCtrl   Turn Fan On    Motor01       Each fan output  Motor01   Motor16  uses  a separate temperature input   Temp01 Temp16  and a separate  setpoint variable  SPO1   SP16   The  flowchart cycles through them all to  control
469. second IP address field is available  so you can designate a  secondary communication path to the control engine should the primary one fail  For more  information  see  Using Ethernet Link Redundancy in PAC Control  on page 94     Make sure that you have not changed the values in the Port  Retries  and Timeout fields  and  then click OK     The newly configured control engine appears in the Select Control Engine dialog box     PAC Control User s Guide    COMPILING THE STRATEGY       Configured Control Engines    Cookie Controler                  10  Click the new Cookie Controller control engine to select it  and then click OK   The new control engine appears in the Configure Control Engines dialog box     Active Engine   Cookie Controller    Engines Associated with Strategy     yokie Cont                Since you have only one configured control engine at this point  it is automatically set as the  active control engine  If there were more than one control engine  you would have to select it  and click Set Active to load it into the Active Engine field     11  Click OK to close the Configure Control Engines dialog box     On the Strategy Tree  the new control engine appears as the first entry in the Control Engines  folder     Compiling the Strategy    The simplest way to compile a strategy is to enter Debug mode  The strategy is saved and compiled  before changing modes     NOTE  The remainder of the tutorial is designed to work with the controller and I O on a SNAP PAC Le
470. seconds  10 seconds    If you want to change one or more timeouts from the default  specify the value in element  0  of the  table for Argument 2  as follows     Set transmit timeout  to tx nnnn        Set receive timeout  to rx nnnn              Set connect timeout  to cx nnnn           Fach timeout command is independent of the others so you can use one  two  or all three of the  commands in any order  If you use more than one command  put a space between each one     The following example sets the transmit timeout to 20 seconds and the receive timeout to  15 seconds  The connect timeout is not changed     HTTP SrcStrTblBody  0    to tx 20000 to rx 15000     Table name Element 0 Transmit timeout Receive timeout    PAC Control User s Guide 279    CONTROL ENGINE COMMANDS       Control Engine Commands  The following commands refer to the control engine     Calculate Strategy CRC Get Firmware Version  Erase Files In Permanent Storage Load Files From Permanent Storage    Get Available File Space Retrieve Strategy CRC  Get Control Engine Address Save Files To Permanent Storage  Get Control Engine Type Start Alternate Host Task    Commands Relating to Permanent Storage    The term  Permanent Storage  in three of the commands listed above refers to the control engine s  flash memory  Files that are saved to flash memory remain in the control engine even when power  to it is turned off  On a SoftPAC controller  files are saved to the PC s hard drive     These commands do NOT affect 
471. select  Hexadecimal  Here s how the integers appear in hex     Hex view  The Ox before 3     nCookie Counter   scanning   the number indicates that Meme  nCookie Counter  the number is in hex  Value   0x00000  20    Mare io          To return to decimal view  click HEX and then select Decimal     Setting Hex String View    You can also set strings to appear in hex notation  Here is the View Variable window showing a  string in regular notation     3   String  Variable   scanning   Name  String Variable  Width  10 max width O current width    Value Item price            116 101 109 Item  112 114 105 price    101 32 61          G  More Info       PAC Control User s Guide    CUSTOMIZING PAC CONTROL FOR YOUR NEEDS       To change to hex notation  click the ASCII button on the dialog box  Heres how the string appears in  hex      s  String Variable   scanning   Name  String Variable  Width  10 max width     0 current width       Value   49 74 65 6D 20 70 72 69 63 65 20 3D      112 114 105 price    99 101 32 61    116 101 109 Item  32       OMe F       Setting Up Applications to Launch from PAC Control    You may find it useful to launch other software applications directly from PAC Control  For example   you may want to launch PAC Display  Notepad  or the Calculator from PAC Control  You can set up  PAC Control so that these applications appear in the Tools menu     NOTE  Ifyou launch an application from within PAC Control when that application is already running  a  second instan
472. series   O Device A  IP address  10 192 59 45 IP address  10 192 59 31    a    Request communication   z  9  9 I   ri   i      Communicate  R 4 Ds  Id    Communication Handle value   tcp 22004    Sends communication to  10 192 59 45 on port 22004        Communication Handles for Serial Communication Modules  For communication  with serial devices through a serial communication module  the communication handle value  consists of the IP address of the brain the module is attached to  plus the serial module5 port  number according to its position on the rack     NOTE  For port number information  see  Establish an Ethernet Connection  in Opto 22 form 1191  the  SNAP Serial Communication Module User s Guide     PAC Control User s Guide 253    COMMUNICATION COMMANDS       Here are two examples of communication handles for communicating with serial modules  the first  showing communication through a module on the same rack as a SNAP PAC R series controller  and  the second showing communication through a module on a different rack     To a Serial Module on the Same Rack    For a serial module on the same  rack  use the loopback IP address  127 0 0 1  which tells the brain to   gt  alk to its own rack  You can also use    port 22507   he brain s own IP address  in this  IWA example  10 192 59 45   but the  qe    oopback address allows you to  change the IP address of the brain  without having to change the  communication handle     SNAP R series I O  IP address  10 192 59 4     T SN
473. similar items together in the way you expect to use them     Names have a maximum length of 50 characters  They can be all upper case characters  or they can  be mixed case     In chart names  for example  you might include a few letters indicating whether the chart monitors  critical tasks  is a master chart calling others  or is periodically called     e  Mntr  Tank Leak  constantly running chart that monitors a critical situation        Mstr  Conveyor  Process  master chart that calls others for a sub process     PAC Control User s Guide    BASIC RULES         Call Message Display  chart called by a master chart for a specific purpose     Block names should tell what the block does  so you can understand a chart without needing  additional explanations  Block names should describe the purpose of the instructions within them   Use a question for the name of a condition block  with a true exit reflecting the answer yes     e   Read Thermometer  action block     e   emperature Too High   condition block        e  urn On Pump 1 or Pump 1 On  action block   e     Pump On   condition block     Variable names can include Hungarian notation to indicate the type of variable  since the variable  type is not always apparent in its name  For example a variable named Month might be either a  string or an integer  However  using Hungarian notation  sMonth indicates a string  and nMonth  indicates an integer     Another good practice is to identify variables used in a single chart differ
474. sistent variable s value remains the same until one of the following events  OCCUIS     e A strategy with a different name is downloaded        he RAM memory on the controller is cleared    e     Anew firmware kernel is downloaded to the controller   e The persistent object is changed as follows     PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS           A persistent table s length  integer  64 bit integer  float  and string  was modified       Apersistent string variable s length was modified       Apersistent string table element s string length was modified         A persistent variable s type has changed  For example  a persistent float variable is deleted  and a new persistent integer variable is created with the same name     Persistent data can be very useful in certain situations  For example  suppose you have a PID setpoint  that is fine tuned as your process runs  If the setpoint is configured as persistent  its value won t be  lost if you must re download the strategy after making a program change     Pointer variables  pointer tables  and timers are not allowed to be persistent  but all other variables  and tables can be  Persistent variables cannot be configured on the fly     Literals  A literal is used like a variable  but it is constant data that never changes  A literal has no variable  name  only a fixed value  which may be a floating point number  an integer  or a string     If you are using subroutines  see the information on literals
475. ssible upgrades are available in the drop down  list     D    Primary Address  For Ethernet   O units  type the IP address of the brain attached to the I O  unit  If the unit is local  the same SNAP PAC brain on which the strategy will run   select Local   loopback   This sets the address to a loopback address  127   o   o   1  This tells the brain to talk to  itself  so if you change the brain s IP address  you don t have to change the address for the I O unit     For serial units  type the unit s address  valid range is 0 255      PAC Control User s Guide 117    ADDING AN I O UNIT       118    E   Secondary Address   Optional  Pro only  Ethernet based 1 0 units only  To designate a  secondary I O unit for communication if this I O unit is unavailable  enter the secondary unit s IP  address  Note that both I O units use the same port number     F   Port  For Ethernet based I O units  communication with the control engine is Ethernet  and the  default port number is 2001  If you have changed this port for security purposes  also change it here    See the controller s user guide for details      For serial based I O units  the communication port and parameters are shown for you  binary CRC  settings on your hardware are required  For more information  see  Changing the Baud Rate for  Serial I O Units     G   Enable Communications  Select whether you want communication to the I O unit  enabled or disabled on startup  Enabled is the default  Disabling communication to an I O uni
476. step reference for working  with strategies in all three strategy modes  Configure  Debug  and Online     In this Chapter   Creating a New Strategy    61  Opening a Strategy    62  Saving and Closing             s 63  Saving a Strategy to Flash    65  Archiving Strategies on the Computer            66  Compiling and Downloading                       66  Running a Strategy Manually                       75  SUING E       76  Viewing and Printing                 n Hd  Searching and Replacing s 192  legacy ODDS    ceret 96          Creating a New Strategy    Each PAC Control strategy must be located in its own directory  When you create a new strategy you   must create a new directory or use an empty one  Having each strategy in its own directory keeps all   its files in one place and makes it easy to copy a strategy to another location for modification or   backup    1  To create anew strategy  select File  gt  New Strategy  or press CTRL   N  or click the New Strategy  button  3 on the toolbar    2  In the New Strategy dialog box  navigate to the directory where you want the strategy to be  placed  Create a new folder if necessary    3  Type the strategy name     PAC Control User s Guide 161    OPENING A STRATEGY       As you can see in the Files of type field  PAC Control files have an extension of  idb    4  Click Open   The new strategy is created  Its Strategy Tree and Powerup charts appear in the PAC Control  main window  For information on the main window  see  PAC Contr
477. structed in more than one step may require more than one time slice  to complete    For example  if a string is being constructed in two steps  such as Move String  Hello  and Append  String to String     World    after the first step a task switch could occur  and another chart looking at  the resulting string might see    Hello    rather than  Hello World      If another chart is relying on a completed string  you can use a temporary string for building the  string  and then move it to the final string  This idea is illustrated in the following example  where a  string variable named MSG  String is built in two steps using a temporary string    1  Move the string literal  The pressure is   to a temporary variable named sTemp     PAC Control User s Guide 307    STRING COMMANDS       2  Append a string variable  sPressure  to sTemp   3  With the complete string now built  move sTemp to MSG String     Adding Control Characters to a String    You can input most control characters in a string by typing a backslash  X  followed by the  two character hex value of the character  For example  to add an ACK  CTRL F  character  enter N06  as part of the string     This technique works for all control characters except null   00   carriage return  NOD   line feed   0A    backspace   08   and CTRL Z  M A   To add these characters to a string  you must use the Append  Character command     To input a single backslash in a string  type in a double backslash          Sample String Variable
478. t   Details on the optional scripting language available in PAC Control for  complex loops  string handling  and mathematical expressions     12  Using Subroutines   How to use subroutines to streamline your strategy development     A  Troubleshooting   Tips for resolving communication problems and other difficulties you may  encounter     B  Errors and Messages    Types of errors  where you ll see them  and the causes of common errors     C  PAC Control Files   A list of all PAC Control files located in the PAC Control directory and in any  strategy directory     D  Sample Strategy   An illustration and description of the sample  Cookies  strategy used in  Chapter 1     E  OptoScript Language Reference    Details about OptoScript code  including comparisons to  other languages  lexical reference  and notes to experienced programmers     Index   Alphabetical list of key words and the pages where they are located     PAC Control User s Guide    CHAPTER 1  WELCOME TO PAC CONTROL       Choosing Documentation    This user s guide contains the latest information you need to use PAC Control with your SNAP PAC  system  However  if you are using Opto 22  legacy  products designed to work with pre SNAP PAC  systems  see form 1710  PAC Control User Guide  Legacy Edition  The legacy version includes  references to pre SNAP PAC devices and commands  which are not included in this guide     form 1For information on what we mean by  legacy  and how to migrate from an older system to a  SNA
479. t Analog Gain  to have the brain calculate them  Calculate offset first  and then calculate gain     By setting offset and gain  you make sure that values read are accurate     Offset is the difference between the minimum input of an analog input point and the actual  minimum signal received from a field device  For example  if a 4 20 mA input receives a minimum  signal that is slightly off  not exactly 4 mA   the difference between the two minimums is the offset   Reading   Offset   Actual Value  For example     If minimum input   4 000 mA  and zero scale reading   4 003 mA  then offset    0 003 mA    Gain is the difference in the full scale reading  but expressed differently   Measured Value   Gain   Actual Value  For example     If maximum input   20 00 mA  and measured value   20 50 mA  then gain   0 9756097560976    PAC Control User   s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Minimum Maximum Values    The Opto 22 brain automatically keeps track of minimum and maximum values for analog input  points  Min max values are often used to monitor pressure or temperature     To read the minimum or maximum value and leave it as is  use Get Analog Minimum Value or Get  Analog Maximum Value  To read the minimum or maximum value and clear it   for example  to  record the minimum pressure in each 24 hour period   use Get  amp  Clear Analog Minimum Value or  Get  amp  Clear Analog Maximum Value     Analog Points and OptoScript Code    In OptoScript code  an analog I O poi
480. t be aware that the computer may require more details     PAC Control User s Guide    STEPS TO DESIGN       Here is a possible flowchart for the simple sprinkler control problem        Simple Sprinkler System Process Flowchart             At 6 00 a m   read  the day of the week          Is it Sunday or  Wednesday              Read the hygrometer       Yes        Ishumidity less  than 10096           Sprinklers off           Turn sprinklers Turn sprinklers off  on and set timer    for 15 minutes    Timer expired  wo      Yes                               Turn sprinklers off                Building the Strategy    Once you have the control problem solved in detail  you can begin building the strategy in PAC  Control  Now you ll add all the logical details the computer needs     Configuring Hardware    The first step in building your strategy is to configure your control engine  I O units  and I O points    For more information and step by step procedures  see Chapter 5  Working with Control Engines  and Chapter 6  Working with I O  You can add more I O units and points later if needed  but it saves  time to configure them now     When you solved this control problem  some of the inputs and outputs you defined were physical  I O  such as the hygrometer and the switch to turn on the sprinklers  You configure these physical  inputs and outputs as the I O points     PAC Control User s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY       Here are the I O points you might configure for 
481. t is the  same as disabling communication to all points on the unit     H   Timeout  Enter the number of times the control engine should try to communicate with the  I O unit  and enter the length of time the control engine should wait for a response when  communicating with this I O unit  If after the first communication attempt there is no response  within the timeout period  the control engine retransmits  If there is no response within the timeout  period  it transmits again  This repeats according to the number of tries specified  If no response is  received within the final timeout period  communication to the I O unit is disabled  The default  number of tries is 3  The default timeout period is 1 second     In most cases  it is a good idea to start with the default values and only make changes if your system  has problems using the defaults     CAUTION  If the timeout is long and the I O unit is turned off or unreachable  the control engine could  take quite a while to execute a command that talks to I O  See also     Tuning the I O Unit Timeout Value for  Ethernet I O Units  on page 120     I   Fahrenheit Celsius   Analog and Mixed units only  Choose whether temperatures will be  handled in Fahrenheit or Celsius     J   Watchdog  Select whether you want a Watchdog on the unit  not available on remote simple  I O units   The default is No  disabled   If you select Yes  a new field appears  enter the Watchdog  timeout value  in seconds   The default timeout is 0 5 secon
482. t match the variable  pntl  which is defined as an integer 32    pni   ptPointT 1     pfi ptPointT  2     pni   ptPointT 3      Expressions and Operators    OptoScript includes mathematical expressions as well as comparison  logical  and bitwise operators   Because expressions and operators are built into the OptoScript language  several standard PAC  Control commands such as Multiply  Bit Shift  and Greater Than or Equal  are not used     PAC Control User s Guide 333    OPTOSCRIPT EXPRESSIONS AND OPERATORS       Using Mathematical Expressions    Addition   nCount   nLast Count   2   fPressure   1 5   fReading   nTotal   nMonday   nTuesday   10     Subtraction  nNumber A   nNumber B   250   fRange   fMax Temp   fMin Temp     Multiplication   nQuantity   nBoxes   12   nHours   nSeconds   60   60   fMax Speed   fSpeed   16 52     Division  nBoxes   nCount   6   fConversion   fLimit   2 0     Modulo division  If any argument is a float  it is    rounded to an integer before the division occurs  Mixture of operators    nVarl   nVar2   2  nAvg    nHrs A    nHrs B    2   nVarl   2   nVar2   nVar3  nVarl   fFloat2   nVar3   4   fFloatil   fFloat2   2 5     Use parentheses to clarify groupings and meaning  You can use an unlimited number of parentheses   nVarl   nVar2    fFloat2   2 0    nVarl    nVar2   2     nVar3    fFloat1    fFloat2   2     3      The       and   operators have greater precedence than   and     See page 395 for the order of precedence   In  the following lines  
483. t which addresses are enabled for an I O unit and which address is currently active  by using Get Target Address State  If an address is enabled but is not functional when a strategy is  started or when communication for an   O unit is changed from Disabled to Enabled  an error is  posted in the controller s error queue     To use these commands  you must have already designated primary and secondary IP addresses  when configuring I O units  For steps  see  Adding an I O Unit  on page 116  For additional  information about link redundancy  see  Using Ethernet Link Redundancy in PAC Control  on  page 94     Table Commands    The table commands for I O units affect the states or values of all points on the I O unit at once  For  example  you can use the command Move I O Unit to Numeric Table to read the states of all digital  points and the values of all analog points on one I O unit and place them into a table for easy  retrieval  Table commands move data very quickly for faster throughput     Three of the table commands   IVAL Move Numeric Table to I O Unit Ex  Move I O Unit to Numeric  Table Ex  and Move Numeric Table to I O Unit Ex    provide support for high density points  A Points  per Module parameter lets you specify the number of points required  For example  if you are using  32 channel modules  you would pass a 32  But if you are only using 8 channel modules  you could   pass an 8 instead  This allows table sizes to be as small as possible        Other commands rela
484. t www opto22 com     1     Determine two significantly different output settings that are within the capabilities of your  system     2  With the strategy running in Debug mode  double click the PID on the Strategy Tree     w    2  pid0    View PID Loop  scanning     Name   Input   Setpoint   Output     Plot    pid   Error   None    73 2753 Gain      15   ScanRate  3  78   Tunel   0 05   Scan Counts   112783  2 252521 Tune D   0 02     120 Details   Misc  Details   VAL   Velocity Algorithm  Type B     os   DS   Q 0 0 0 0    Data p    InputAxis  gt     Output Axise    Time Axis  gt           Set the Mode to Manual  if not set already  and click Apply   In the Output field  type one of your two output settings and click Apply     Use an output value typical of your system but low enough to allow you to change output by  20      Reset your time axis  if necessary  by clicking the Time Axis and choosing from the pop up  menu  Then choose Reset Scale Tracking from the same menu     The span setting varies according to your system  a 3 minute span is often suitable  Until you  are familiar with the PID plot  it is recommended that you avoid using the shortest settings   10 seconds or 1 second   After you ve observed a change in the input  you can zoom in on the  graph  which is described later     6  Wait for your system to stabilize     PAC Control User s Guide 147    INSPECTING AND TUNING PID LOOPS       Astable system exhibits little  change in the Input value   which is shown n
485. tab to see or  change additional data           Setpoint and Input plot   Adjust resolution using    the Input Axis button  below the plot  Click and  drag on the scale to  move the line           Output plot    Adjust resolution using  he Output Axis button   Click and drag on the  scale to move the line     Q       Time axis  Adjust  resolution using the    Plot    Data p    InputAxis  gt     Dutput Axis p    HER            View PID Loop  scanning    pid0   Error   None   79 2753 Gain   15 Scan Rate   3   sec  Mode  aj  79 Tune I   0 05 Scan Counts    112783 Enable comm  Yes          2 252521   Tune D   0 02     120 Details   Misc  Details   VAL   Velocity Algorithm  Type B        0 30 0 09 44 00 0 09                 Time Axis button  Click  and drag left or right to  see other times     Close    View or change PID parameters as necessary  Click the other tabs to see additional data  To tune    the PID  see page 151     menu        146 PAC Control User   s Guide    To add the PID to a watch window  click Add Watch and see page 157   To save  copy  or print the current plot  click the Data button and choose from the pop up    To save changes to any of the PID configuration parameters  click Save Tuning     CHAPTER 6  WORKING WITH I O       Determining System Lag    You can directly control the PID output to determine system lag  which is essential to setting the PID  scan rate  Also see Opto 22 form 1641  OptoTutorial  SNAP PAC PID  available for download from our  website a
486. tch or Case Statements  on page 337  e    While Loops    on page 338   e    Repeat Loops    on page 339   e    For Loops    on page 339    PAC Control User   s Guide    CHAPTER 11  USING OPTOSCRIPT       If Statements    If statements offer branching in logic  if statement A is true  then one action is taken  if statement A is  false  or statement B is true   a different action is taken   f statements are very flexible  here are  several examples of ways you can use them     Since a comparison operator returns an  Any numeric value can be tested by the if statement  NOTE  The Integer 32 value  it can be used as the    value is first converted to an Int32   test value   if  n1  then if  nl  gt  3  then  fl  22 0  fl a 2 0   endif   2     5 257  endif    An optional else statement can be    Complex logical operations can also be used  added   np M P i if  nl  gt  3  then  if   n1   3  and  not n1    6   then  fl ze 2 05   fi e 2 05 ye e Es  f2   6 5  Bon  endif STEE    3   8 8   endif    Multiple elseif statements can be used to chain together sev   eral tests  The else statement is still allowed at the end   if  nl  gt  3  then    If statements can be nested  Each if  requires an endif   if  nl  gt  3  then    fi   2510   fl 2 2 05  f2   6 53 e  elseif  n1  lt   3  then men  f3   8 8       pipi if  nl   10  then  elseif  n1    0  then  fl   f1   2   f3   f1     2   f2   f2   35  else EM  fa   0   f3 x     2     OF  endif  zc endif  endif    Switch or Case Statements    A switc
487. te eee beet be ee bpwvacig eel ente epi vat cdd 47  Toning PUD EOD s ast ete d tl e ete dee oet eee d REPRE ARARE d 51  Using Watch Windows for Monitoring 0 0 2 2    cece t ttt 57  Creating a Watch Window        0    c ccc ccc cece I ne 57  Opening an Existing Watch Window        06 6    cece cece cette e 58  Working in Wate  WINdOWS  esse vester One ERROR PUR EXE PERSE EEE ERE 59  Chapter 7  Working with Strategies             cece cece cece cece nnne 161  MOGUO ins dus REEL 6   Bins Sero EEUU 6  Credtirig a New Strategy  serei debere ia RR REPE ee VERE POR ORE I Re ewe dd 6  OPENING a Sta lOO mv 62  OPENING an EXIStING Strategy   ssec be nds pee eun Co ru eere verd qued ees 62  Opening an ioControl Strategy   0 0 2    0c cette ence ett enn nett tenes 62  Openinga Recently Used  Strategy    ccictsca cass did suesd ere dade  dee ede Red e be dean 62  Loading a Strategy or Mode at Startup        0    e ence tees 62  Opening Strategies in PAC Control Basic and PAC Control Professional                  63  Opening an OptoControl Strategy   2 2    c eee ett tenn nett teens 63  Saving and CloSing      cats hae rorem eee eee E cage t Peas e PR RAUM EORR ed 63  Saving the Strategy and All Charts 00 0 0    ccc cece cece eect eet ete n nee es 63  Saving the Strategy and Some Charts        0 0    c cece eet eeet teen eect tenes 63  Saving the Strategy to a New Name         00 0    cece e eee e n 64  Saving Before Debugging       6  cece cece cece s 64  dosing a Strategy    c oss aids d
488. te of the controller s interval value  IVAL  for this I O point when  the strategy is run  click Yes and define the value  To leave the IVAL at its last state  click No     If communication to the point is disabled  only the internal values  IVALs  are accessed or updated  by the control engine  The real world external values  XVALs  for inputs don t change because they       PAC Control User s Guide 129    CONFIGURING A SERIAL MODULE       are controlled by external devices  The IVALs for inputs are set and will be overwritten by the XVALs  unless communication to the I O unit or point is disabled     The default  value  is available for both inputs and outputs  It sets the IVAL for the point in the  strategy in the controller when the strategy is run  This can be useful when the I O unit is not  accessible or communication to the I O unit is intentionally disabled when the strategy first starts   When communication to an I O unit is disabled  any l O related commands in the strategy will act  only on the I O point IVALs because the controller is not able to access the XVALs at the I O unit  when communication to that I O unit is disabled     Once communication to the I O unit is enabled and the I O unit is accessible  then the first  command to access that point will update the IVAL  For example  if you use the Move command to  write a different value to an output  both the IVAL and XVAL are updated with the new value  If you  use a Move command to read an input  the XVAL i
489. teps to the next command block  Since there  are no more blocks in this chart  we are actually exiting this chart and moving on to new  instructions in another chart  The Powerup chart has stopped  and you can see the word  Stopped at the bottom left of the chart     In the View Variable dialog box  the bStartFlag value reverts to zero  because the Start Charts  block set the flag back to zero     3  Close the bStartFlag View Variable dialog box  In the Powerup chart window  click the Pause  Chart button to turn stepping off     PAC Control User s Guide    CHAPTER 2  PAC CONTROL TUTORIAL       Then close the Powerup chart   Double click the Charts folder on the Strategy Tree   The View Chart Status dialog box appears     ey View Chart Status       Name Status Mode Breakpoint Status Paused At  Alarms Running Step Off Break Off  Dough_Chip_Control Running Step Off Break Off  Dough Vessel Pre   Running Step Off Break Off    ven Inspection      Running Step Off Break Off  Powerup Stopped Step Off Break Off                This dialog box shows us all the charts in our strategy  As you can see  four of the charts are  running  and one  Powerup  is stopped     Powerup is stopped because it has already done its job  Let s check the running charts     Close the View Chart Status dialog box and click inside the Dough  Chip  Control chart again     If your mouse has a wheel  hold down the CTRL key and move the mouse wheel up or down to  change the zoom     If your mouse doesn t have a w
490. ter table points to another item within the  strategy  for example an I O point  a variable  or a chart  Setting initial values for pointer tables  means designating the items the pointer table initially points to  For example  you would include  the following text to have a pointer table named My_Ptr_Table initially point to Oven_Temperature   a variable   Alarm_Handler  a chart   Thermocouple  an analog input   Fuel_Pump  an analog  output   and Fan_1  a digital output      Oven Temperature 0 PTBL My Ptr Table TABLE     amp Alarm Handler 1 PTBL My Ptr Table TABLE     Thermocouple 2 PTBL My Ptr Table TABLE     Fuel Pump 3 PTBL My Ptr Table TABLE     Fan 1 4 PTBL My Ptr Table TABLE     PAC Control User s Guide 227    SETTING INITIAL VALUES IN VARIABLES AND TABLES DURING STRATEGY DOWNLOAD       Special Characters in the Initialization File  Note that the initial character on each line of  the initialization file is a special character that identifies the object type  Possible characters include                            the following   Pa eee    float  integer  or timer    string  PTR_ pointer variable  ias I O point   amp  chart    float table or integer table    string table  PTBL_ pointer table    I O unit                Saving the Initialization File  When you have finished modifying the file  save it as a text file   txt file extension  to your strategy directory  You can name the file anything you like   You can also  save it to any directory you like  but it is good pr
491. ters is referred to as an empty string       Strings are frequently used in serial communication as a container for moving numeric  characters from one device to another     e Although a string may appear to contain numeric values  it does not  Digits  0  through  9  are  characters just as much as    A    through    Z     they do not represent numeric values     To illustrate          As 22     306 PAC Control User s Guide    let s look at the number 22  This is a decimal number representing a quantity of 22     The number 22 can be represented in a string in several ways  here are two of them     two character 50 s  The ASCII code for 2 is 50      CHAPTER 10  PROGRAMMING WITH COMMANDS           As   16  a character 49   1   and a character 54   6    The hex value of 22 is 16      Note that the string representation of the number 22 is no longer a number  It is simply one or  two ASCII characters  The string representation of a number must be converted to a numeric  value if it is to be used in calculations  Several Convert commands are available for this purpose     e In standard PAC Control commands  do not use double quotes around string literals  You can  use single quotes  but they are not required     e  n OptoScript code  you must use double quotes for string literals  See    11  Using OptoScript   for more information     String Length and Width    The width of a string is the maximum length a string can be  length is the actual number of  characters contained in the
492. tes with  the I O units on the other     To segment networks  start by assigning a secondary IP address to the controller in PAC Manager   following instructions in the PAC Manager User s Guide  The secondary IP address is used for  communication through the controller s Ethernet 2 interface  Remember that this interface must be  on a completely separate network segment     You don t need to do anything special in PAC Control  Configure only one control engine  using the  IP address of the Ethernet interface to be used for host communication  The control engine will  direct communication to I O units through the other interface  based upon the I O unit s IP address   The IP addresses of the I O units must be compatible with the secondary IP address of the controller     PAC Control User s Guide    USING ETHERNET LINK REDUNDANCY IN PAC CONTROL       NOTE  PAC Display Basic and other hosts on the company network cannot communicate with I O units  when they are on a separate network  To solve this problem  you can purchase PAC Project Professional  or  PAC Display Professional and OptoOPCServer  version 7 0 and newer  separately  these applications  support network segmenting by communicating with I O units through the controller  Also  you can add  a second network interface card  NIC  and assign it an IP address compatible with the I O unit network     Using Ethernet Link Redundancy in PAC Control    Ethernet link redundancy provides a backup network connection in case the pri
493. tg                       2  Navigate to the configuration file you created and saved in PAC Manager  Double click it to  open it     The configuration information is imported  You can expand the I O units folder to see the  imported units and their points     If you need to configure additional I O units from within PAC Control  see  Adding an I O Unit   on page 116  To tune PID loops  see  Inspecting and Tuning PID Loops  on page 146     Copying I O Configurations  If you have two strategies that use similar I O units and points  you can export an I O configuration  from one strategy into a file  and then import it into the other strategy     If you need similar configurations for several I O units  you can use PAC Manager to send it to  multiple I O units at once   You cannot use PAC Manager for serial based I O units   For more  information on using PAC Manager  see Opto 22 form 1704  the PAC Manager User s Guide     Creating the Configuration Export File    1  Open the strategy you are copying from in PAC Control  In the Strategy Tree  right click the I O  Units folder and choose Export from the pop up menu     The Export I O Units to an Opto Tag Database dialog box appears     PAC Control User s Guide 115    ADDING AN I O UNIT       2     Navigate to the location where you want to place the export file  Type the file name  and click  Save    The export file is created  It is a comma delimited ASCII file  If you wish  you can open it in  Notepad or Excel     Importing the
494. the amount of memory available in the control engine     A chart can be running  suspended  or stopped  A running chart is actively performing its assigned  task  A suspended chart is temporarily paused  A stopped chart is inactive  Every chart in a PAC  Control strategy can change the status of any other chart in the strategy  yet every chart is  independent of every other chart  Any combination of charts can be running simultaneously  up to  the maximum limit allowed on the control engine   See also  multitasking      Every strategy automatically contains a Powerup chart  The Powerup chart is automatically started  when the strategy begins running  so it starts other charts  All other charts you create  based on the  needs of your process     input point   Input points are wired to hardware that brings information into the brain from the process   Examples of devices that can be wired to input points are thermocouples  switches  and sensors  The  control engine in the brain takes the information from the input points   such as whether a switch  is on or what temperature is registered   processes it using commands in the strategy  and returns  information to the process through output points     e A floating point  or float  is a numeric value that contains a decimal point  such as 3 14159   1 0  or 1234 2  A good example of a float variable is one that stores readings from an analog  input  such as a thermocouple     e An integer is a whole number with no fractional part  E
495. the command Set Communication Handle  Value to change the value of a specific communication handle during the operation        Sets the value for the  communication handle  chAFile     SetCommunicationHandleValue   file r  ProductRequest txt  chAFile          Opens the communication  handle and checks to make  sure it opened     status   OpenOutgoingCommunication chAFile     if  status    0  then       Sets the end of message  erminator to a comma SetEndOfMessageTerminator chAFile         because the file to be read  is comma delimited        Reads the contents of the  file Product_Names into a status   ReceiveStrTable 4 0 Product_Names  chAFile     string table        Loops through the items in  Product_Names table and             places the values they index   0    represent into another while   index  lt  4  and  status    0     string table  Product_Info  status   GetValueFromName  Product Names index     Note thatthe    numbers    in   Product_Info  index        the Product_Info table are index   index   1    not true numbers  but wend   string representations of   numbers     Closes communication  status   CloseCommunication chAFile          Changes the value of the  communication handle  it  is now set to write to the SetCommunicationHandleValue   file w  ProductInfo txt  chAFile     file Productinfo txt on the  control engine        Opens the communication  handle and checks to make  sure it opened     status   OpenOutgoingCommunication chAFile     if  status    0  th
496. the number of bad cookies so that nCookie Counter keeps track of the number of cookies sent  out the door  not just sent to the oven     Close the nCookie Counter View Variable window and click the Configure mode button on the  toolbar     Double click the Oven  Inspection Control chart on the Strategy Tree to open it   The chart window looks something like this     The Powerup chart starts  this chart     While conveyor speed  is out of spec  set oven  temperature to 200  degrees     Set oven temperature to  450 degrees     If inspection station sees  a bad cookie  open reject  valve for 0 5 second        G Shortcuts  100  v                Near the bottom of the chart  the Reject Cookie  block determines whether a bad cookie has  been found  If one has  the strategy moves to the next block  Blow Off  which is where the bad  cookie gets blown off the conveyor  When that happens  we want to decrement the  nCookie_Counter variable     Double click the Blow Off block to open its instructions window     PAC Control User s Guide    RUNNING THE STRATEGY       10   11     12     13     Instructions   Oven_Inspection_Control   Blow Off       Reset the on latch after it has been t  Clear On Latch  On Point dilnspectionPassFailSwitch    Modify   Turn on reject valve to blow away bad cookie     Turn On  doRejectValve Next Block    Leave reject valve on for 2 seconds  Previous Block    Delay  Sec   2 0                This command block is executed only when a bad cookie has been found  T
497. the process  Each block in a chart contains one or more instructions  such as  Convert Number to String or Start Counter or Chart Running     Commands are in two forms  Actions and Conditions     PAC Control User s Guide    PAC CONTROL TERMINOLOGY       e Action commands do something in the process  for example  Convert Number to String and  Start Counter are both action commands  On the flowchart they appear as instructions in action  blocks  which are rectangular in shape  They may also appear in hexagonal OptoScripts     e   Condition commands check a condition and are in the form of a question  Chart Running   and Variable False  are examples of condition commands  They appear as instructions in  condition blocks  which are diamond shaped  or in hexagonal OptoScript blocks  Condition  commands are questions that always have two possible answers  either yes or no  true or false    The answer determines the flow of logic and what happens next in the chart     internal value    The internal value  IVAL  is the value read or written by the PAC Control strategy  Internal values are  transferred to external values only when communication to the I O unit is enabled     multitasking    The control engine can run several charts seemingly at once  each performing a different task   through a time slicing technique called multitasking  also called multicharting   Opto 22 SNAP PAC  R series controllers can run up to 16 charts plus one host task simultaneously  SNAP PAC S series  cont
498. the sdcard  you must put  sdcard0 temp  in front of the filename  Any  kind of file may be attached  so long as there is room in the file system  However  be cautious  about file size  many Internet service providers still have a 10 MB attachment limit     Add code to the SMTP Send OptoScript block     This block invokes the Send Email with Attachments command to send the email with  attachments              Send email with attachments  using the tables set up previously     nResult   SendEmailWithAttachments     arrstrServer     Table with server info  arrstrRecipients     List of recipients  arrstrBody     Body text  arrstrAttach       List of attachments    Click Debug  and then click Run Strategy     The email and attachments are sent to the recipient s  in your list     PAC Control User s Guide    COMMUNICATION COMMANDS       276    Setting Timeouts for the Send Email Commands    The default Send Mail commands timeout for transmitting  receiving  and connecting is 10 000  milliseconds  10 seconds  when you have filled in elements 0 4 of the Server Information table  see  page 274   If you want to change one or more timeouts from the default  add an element 5 and  specify the value as follows     Set transmit timeout  to tx nnnn        Set receive timeout  to rx nnnn        Set connect timeout    to cx nnnn                   Each timeout command is independent of the others so you can use one  two  or all three of the  commands in any order  If you use more than one comma
499. the simple sprinkler system                 Physical I O Type I O Point Name  Hygrometer Analog Input Hygrometer   Sprinkler status Digital Input Sprinkler_Status  Sprinkler switch Digital Output Sprinkler_Switch                   Determining and Configuring Variables    Some of the inputs and outputs you defined when you solved the problem were not physical 1 0   but information  For example  the day of the week is not a physical input  it   s a piece of information  you can get using a command in PAC Control  These inputs and outputs become variables     You also need variables to store the information that input points give you  And you may need  variables for manipulating information     To determine the variables you need  think about the pieces of information your process requires   Then look at the PAC Control commands in the PAC Control Command Reference  Find the commands  you need and check them to see what types of variables each command requires        For example  you need to know what day of the week it is  Will the control engine give you this  information as a string  for example   Wednesday   or in some other format  When you check the  command Get Day of Week  you discover that the day is returned as a number    Wednesday   3   so you set up this variable as a numeric integer     Here are some variables you may need   See Chapter 9  Using Variables and Commands for more  information and step by step procedures to add variables   You can change them or add ot
500. the subroutine by selecting Subroutine  gt  Save     Configuring Subroutine Parameters    Before you can call a subroutine from a strategy  you must configure the variables and other logical  items that are passed into it  These passed in items  called subroutine parameters  are the only  information that is shared between a subroutine and the calling strategy  Twelve parameters can be    350 PAC Control User   s Guide    CHAPTER 12  USING SUBROUTINES       passed into a subroutine  and since a table can be a parameter  those 12 parameters can include a  large amount of data    An item passed into a subroutine may be called by one name in the strategy and by another name  in the subroutine  In fact  if a subroutine is used for more than one strategy  it is good practice to  select generic names in the subroutine  For example  if you create a subroutine to average values in  any float table  the table might be named Float_Table in the subroutine  You could use this  subroutine to average pressures in a table named Pressure_Values from a strategy  and  Pressure_Values would be referred to as Float_Table in the subroutine     1  With the subroutine open  select Subroutine  gt  Configure Parameters   The Configure Subroutine Parameters dialog box appears     I Configure Subroutine Parameters BAR    Subroutine Name  Group   Variable Increase Notification Subroutines          Subroutine s OptoS cript Name   Variable Increase Notification             Comment                 t Prompt
501. these fundamental concepts     e  hey evaluate a process variable against its setpoint     e  hey control an output to correct the process variable     e The output comprises proportional  integral  and derivative calculations     e The effect of proportional  integral  and derivative calculations is modified by user determined    P    and D constants        e The Pl  and D constants need to be tuned for each system     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       PID Loops on I O Units    SNAP PAC controllers and brains provide 96 PID loops per I O unit  Because PIDs run on the I O side  of the SNAP PAC R series controller  not on the control side  these PIDs will keep running on the  SNAP PAC R series I O unit even if the PAC Control strategy stops     In PAC Control  you can configure each of the PID loops with unique settings for a large number of  parameters  For a simple PID loop  you must configure at least the following     e Input  the process variable being monitored    e     Setpoint  the desired value    e   Output  the I O point that effects change in the system       Scan time  how often the input is sampled    e  PID algorithm used  four algorithms are available  see  Algorithm Choices  PID   on page 301   e Valid range for input   e   Upper and lower clamps for output   e   Minimum and maximum change for output   You can also configure the following parameters if necessary    e Forced output value or use of manual mode if input goes 
502. ting a change has been made but not implemented     8  Click Apply to implement the change  Click the Minimize button in the bStartFlag View Variable  dialog box and move it out of the way  Click the Powerup tab to make the Powerup chart the  active window     Inspecting Messages    1  Lookfor a light blue  MEO box in the status bar at the bottom of the window     The status bar in the main PAC Control window tells you when an information  warning  or error  message has been placed in the message queue  Messages can help in troubleshooting your  strategy  In this example an Information message is in the message queue     2  Click the IMFO box or select Control Engine  gt  Messages to view the View Message Queue  dialog box       View Message Queue for    Cookie Controller       e  Refresh   23 Copy All   Pop Top Message  gt  lt  Clear All Messages         Code Severity Description Chart Block Line Object Time Date     4 Info Device has powered up    Powerup clea      system   l   N A N    Mixed    13 13    09 25          This message tells you that the I O unit has powered up   3  Close the dialog box to return to the Powerup chart     Stepping Through the Chart    Now let s step through the chart to see what s happening   1  Click inside the Powerup chart  and then click the Step Over button tr      The hatch marks move from Start  to Start Charts  We ve just moved  stepped  to the next  block     2  Clickthe button again     PAC Control executes the Start Charts block and s
503. ting to tables can be found in the following topics      Miscellaneous Commands  on page 299   Logical Commands  on page 293   Mathematical Commands  on page 295   Pointer Commands  on page 303   String Commands  on page 306     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       I O Unit   Event Message Commands  The following commands refer to event messages sent from SNAP PAC I O units     Get I O Unit Event Message State  Get I O Unit Event Message Text  Set I O Unit Event Message State  Set I O Unit Event Message Text    A SNAP PAC I O system can send a message as a response to an event that occurs within strategy  logic  For example  if pressure in a pipe reaches a certain level  the system can send a warning email  message to a technician  Or data about a process can be streamed to a computer every 30 seconds  for monitoring     CAUTION  Events and reactions  including event messages  that are processed separately from your  strategy can conflict with strategy logic  If you are using PAC Control  use strategy logic instead of local  events and reactions on the I O unit  or be very careful that local events and reactions do not conflict     Use PAC Manager to configure event messages  following the steps in Opto 22 form 1704  the PAC  Manager User s Guide  You can configure the following types of event messages   e Email or paging messages sent to a person      Simple Network Management Protocol  SNMP  traps sent to an enterprise management  System  
504. tions dialog box  click the first command you want to comment out  Click Add    In the Add Instructions dialog box  choose the instruction Comment  Block   Click OK    You return to the Instructions dialog box  and all the instructions in the block from that point  on are grayed out  indicating that they will be ignored when the strategy runs    Click just beyond the last command you want to comment out  Add another Comment  Block   instruction    When you return to the Instructions dialog box  all commands between the two Comment   Block  instructions are grayed out    When you no longer want the strategy to ignore the command s   delete the two Comment   Block  instructions     NOTE  The Comment  Block  command is used for this purpose  The Comment  Instruction   command just places an explanatory comment in the Instructions dialog box  It does not affect any  commands     Cutting or Copying a Command    For commands in action  condition  and continue blocks you can cut or copy commands to the  Windows clipboard and then paste them in the same block or in another block  or even in a block of  another chart within the same strategy  For OptoScript blocks  see  Using the OptoScript Editor  on  page 340     240    1     With the strategy in Configure or Online mode and the flowchart open  double click the block  containing the command you want to cut or copy     In the Instructions dialog box  click any line of the command you want to cut or copy     To cut or copy more than o
505. to an integer yields 555444352   note the error starting in the 7  digit         Float Issues and Examples    Accumulation of Relatively Small Floating point Values  When adding float values  the  relative size of the two values is important  For example  if you add 1 0 to a float variable repeatedly   the value of the float variable will correctly increase in increments of 1 0 until it reaches 1 677722e 7   16 777 220      Then the value will no longer change  because 1 0 is too small relative to 1 677722e     to make a  difference in the significant digits  The same thing will occur if you add 0 0001 to 2 048 0  or add  1 000 0 to 1 71 7987e   The key is the relative size of the numbers     Here s another way to think of it  Suppose your bank could only keep track of seven digits  If you  were fortunate enough to have one million dollars   1 000 000  in your account and tried to add 10  cents   0 10  to it  you would not be able to  because the 10 cents is not big enough relative to the  total to be significant  Since the bank has only seven digits to keep track of your money  in this  example   one digit has to fall off the end  either the 10 cents falls off the right side or the million  digit falls off the left side  Which would you rather see in your bank account                                         Seven digits available  1 213 4  5 6 7   Amount in account  1  0 0 0  0  0 0   Add 10 cents  0 10    digit falls off on right  1  0 0  0 0  0 0   Add 10 cents  0 10    di
506. to be applied  a negative gain constant turns this error into a positive output for the heater   Alternatively  a cooling system reports a positive error when the input exceeds the  setpoint  a positive gain constant maintains the positive output to the chiller     Optional  depending on your system  Minimum and maximum changes to Output and  Output forcing when the Input is out of range        2  Download and run your strategy     The current PID configuration is written to the I O unit  You can stop your strategy at this point  if you wish  as the PID will continue operating     3  In Debug mode  double click the PID on the Strategy Tree     PAC Control User s Guide 151    INSPECTING AND TUNING PID LOOPS       3  pid0    View PID Loop  scanning   Name   pid0 Error   None    Input  79 2753 Gain   15 Scan Rate  3  Setpoint  79 Tunel   0 05 Scan Counts   112783 Enable comm  Yes     Y  Dutput 2 252521 Tune D   0 02    Plot 1 0 Details   Misc  Details   IVAL   Velocity Algorithm  Type B     5 oint  Dutput    09 44 00 0     09     Data p     InputAxis  gt     Dutput Axis     Time Axis  gt           4  Setthe PID Mode to Auto  if not set already  and click Apply     5  Change the Setpoint  if desired  by typing a new setpoint and clicking Apply   Setpoint must be  configured as Host      Depending on the type of system  your PID may maintain a setpoint or respond to changes in  setpoint  Experiment with setpoint changes again after tuning the P    and D constants     6  Adjust the
507. toScript command equivalent  GetMonth  has no arguments and places the result in the  variable     In most cases you will use the value a function command returns by placing it in a variable  a control  structure  or a mathematical expression  Occasionally  however  you may not need to use the result   For example  the command StartChart returns a status  If you do not need to track the status  you  can ignore it by not placing the result anywhere  for example    StartChart  Fan Control      Data Types and Variables    Unlike most procedural languages  PAC Control maintains a database of all declared variables  which  is shared with PAC Display  Variables are not declared in OptoScript code  but are created  declared   within PAC Control   See  9  Using Variables and Commands  Variables are not declared in  OptoScript because local variables are not allowed  All variables are global for the strategy  or global  within a subroutine      PAC Control User s Guide    CHAPTER 11  USING OPTOSCRIPT       If you use a variable in OptoScript code that does not currently exist in the strategy  you ll receive an  error message when you test compile the code and can add the variable then     Variable Name Conventions    With OptoScript and in PAC Control generally  it s a good idea to get into the habit of indicating the  variable type in each variable s name  Some variable types may be obvious in the name itself  but  others are not  For more information  see  Naming Conventions  on pag
508. toScript so that the tag that is pointed  to will be used instead of the address of the tag  When using a pointer with normal PAC Control  commands you need to de reference the pointer because PAC Control commands are designed to  use tags instead of the address of the tags     Using the Comparison Operator             To see if a pointer is pointing to something  use the comparison operator     see page 334  to  compare it to null  This use is similar to standard PAC Control condition commands such as Pointer  Equal to NULL  For example     n2   pnl    null   n2   null    pnl   if  pt1 0     null  then    Determining Which Variable To Use    Pointers are very useful when you don t know what variables need to be used until runtime  For  instance  the next example uses a switch statement  see page 337  to determine which variable to  use based on the day of the week  It then uses a pointer to perform a calculation using the correct  variable     switch  GetDayOfWeek       case 0     Sunday    pni   n2   break   case 6     Saturday  pni   n3   break   default     Monday Friday  pni  5 n4   break   endswitch    Use the pointer to set the chosen variable     pnl   n5   f1   5    For More Information   For more information and examples of using pointers in OptoScript  see the following   e Pages    Pointer Commands  on page 303 and    Pointers and Indexing  on page 85   e   See Appendix    E  OptoScript Language Reference     e   Download the OptoScript Examples  Either click here
509. tring  pointer  or  communication handle  When you create the variable  you designate the type of data it contains  It  is always best to choose the most appropriate data type for the information you are storing  PAC  Control can store an integer in a floating point variable  but it has to convert the data first   Unnecessary data conversions take up processor time     e Numeric data stores numbers and can be one of the following types       A floating point  or float  is a numeric value that contains a decimal point  such as  3 14159  1 0  or 1 2342  A good example of a float variable is one that stores readings from  an analog input such as a thermocouple  PAC Control uses IEFE single precision floats with  rounding errors of no more than one part per million       Aninteger is a whole number with no fractional part  Examples of integer values are  1  0   1 999  or  4 568  The state of a switch  for example  could be stored in an integer variable as  1  on  or 0  off    Most integers used in PAC Control are 32 bit signed integers  which can range from   2 147 483 648 to 2 147 483 647  These 32 bit integers should be used for general integer  use  such as status variables  mathematics  and indexes    64 bit integers address the entire  I O unit at once but are slower than integer 32 commands     PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS           Atimer stores elapsed time in units of seconds with resolution in milliseconds  Up Timers  count up from
510. trol the setpoint  select PID Output and choose the PID from the  drop down list     G   Output  Choose the destination for the PID output  I O Point or Host   To use the output for  controlling the setpoint or input of another PID  choose Host      H   Lower Clamp Upper Clamp  Enter upper and lower clamp values to prevent the output  from exceeding a desirable range  These values should equal the range of the output point  if used   Or choose values to make sure that the output device doesn t shut off  for example  keeping a  circulation pump running regardless of the PID output  or that the output never reaches a  destructively high setting  for example  keeping a motor below maximum      I   Min Change Max Change   Optional  Enter minimum and maximum change values  The  output wont respond until the minimum change is reached  for example  you may not want a  heater to turn on to correct a 1 degree error   Maximum change prevents too drastic a change in  output  for example  you could limit the increase in a pump5 output to prevent pipe breakage   The  default for both minimum and maximum is zero  which disables the feature     J   Output Options  Choose how the PID should respond if the input goes out of range To have  PAC Control logic or an operator respond  check Switch to manual mode  To force the output to a  specific value  check that option and type the output values     NOTE  If both boxes are checked  forced output and manual mode   the output will be forced and t
511. troller  Using PAC Manager  use the  Upload File to I O Unit command to place the root certificate in  pki root certs on the SNAP PAC  controller  Then make sure to execute the Save Files to Flash command and restart the device   For more information  see    Moving Files to the SNAP PAC Controller or I O Unit  in form 1704   the PAC Manager User s Guide     In PAC Control  create a new strategy     Create the following numeric  Integer 32  variables set to    Initialize on strategy run     For more  information  see  Adding Variables  on page 221           nHttpStatus Integer32  nPortSSL Integer32  nSendStatus Integer32                Create the following string variables     strCmd String 100       strURL String 256                   Create the following string tables  For more information  see    Adding Tables    on page 224           DstStrTbIBody String 100 1024  DstStrTblHdr String 100 1024  HTTP  SrcStrTblBody   String 10 256                      Add an Action Block named Begin  and an OptoScript Block named Get Content to the  Powerup chart     PAC Control User s Guide 277    COMMUNICATION COMMANDS       8  Connect the Begin block to the Get Content block        9  Add the following code to the OptoScript Block           MoveToStrTableElements     0   1  HTTP SrcStrTblBody    A 3 MoveToStrTableElements     0   1  DstStrTblHdr     MoveToStrTableElements     0   1  DstStrTblBody    B StrURL    www google com    C strCmd         D nPortSSL   443   nSendStatus   HttpGet   
512. ts 114  mistic I O units and commands 198  mode   Configure  definition of 53   Debug  definition of 53   Online  definition of 53  modifying  See changing  monitoring  See inspecting and viewing  moving  block 210  connection line 210  control engine definitions 109  files via FTP 263  I O point 130       text block 210   to another window or chart 57  moving control engines 109  multitasking 50   and strings 307    N  naming  block 78  206  chart 77  214  conventions 77  78  329  I O points 78  variables 78  329  naming conflicts 373  network  segmenting control network 93  etwork redundancy 94  umber  converting to string 312  urneric literals in OptoScript 329  umeric table  adding 224  as alternative to strings 307  numeric variable  adding 221  in OptoScript 329       my x 4e      O    offset and gain commands  instructions  244  offset  definition 244  online help 67  Online mode  avoiding memory problems 53  definition 53  online mode toolbar 54  opening  applications from PAC Control 66  chart 212  strategy 162  watch window 158  operator  bitwise  in OptoScript 336  comparison  in OptoScript 334  in standard commands  AND OR  238  logical  in OptoScript 335  order of precedence 395  OptoScript  bitwise operators 336    PAC Control User s Guide     Eie        block example 318  block  definition 202  bookmark 343  case statements 323  337  command types 328  commands 326  comments 396  communication handle 260  comparison operators 334  comparison with other language
513. ts you need  and the total number of charts in the strategy is limited only by the  control engines memory  Be aware  however  that the maximum number of charts that can be  running at any one time is based on the control engine you are using     e     16 charts on a SNAP PAC R series controller   e 32 charts on a SNAP PAC S series controller   e 64 charts on a SoftPAC controller   Program logic moves through a flowchart in one of two ways  flow through or loop        e Achart with flow through logic performs a set of specific commands and then stops  It has a  beginning and an end  and at the end is a condition or action block that has no exit     Subroutines  the Powerup chart  and any other chart that does not need to run continuously  should always have flow through logic  In complex strategies  be careful when using delays  and condition looping  waiting for something to occur  in charts with flow through logic     e     A chart with loop logic has no end  It loops through a set of actions and conditions  continuously  A loop logic chart can have several paths through which the direction of the  logic may flow  depending on certain criteria  Use loop logic for a chart that needs to run  continuously   The simple sprinkler chart has loop logic  it runs continuously      Chart Guidelines    As you design your strategy  put each sub process of your overall control problem into a separate  chart within the strategy  On a SNAP PAC R series controller  a maximum of 16 charts  
514. u track changes during development and provides a  backup in case of a failure on the control engine  Archive files are date and time stamped  and  zipped for compact storage that you can copy to another computer or disk for backup  Archives are  always placed in the same folder as your strategy  Since a new archive file is created each time you  archive a strategy  remember to manually delete any old archive files you do not want to keep     We recommend you archive both to the computer  during strategy development  and to the  control engine  when the strategy is completed   Archiving to the control engine as well as the  computer makes sure that an older strategy can always be found and updated  even after personnel  changes occur and years pass  See also     Archiving Strategies on the Control Engine    on page 106        PAC Control offers three ways to archive strategies to the computer     e     To make an archive at any time  choose File  gt  Archive Strategy  A dialog box shows you the  name and location of the archive file     e     To have an archive automatically created whenever the strategy is closed  choose File  gt   Strategy Options  In the Strategy Options dialog box  click Archive strategy to disk when  strategy is closed     e To have an archive automatically created whenever the strategy is downloaded  choose File  gt   Strategy Options  In the Strategy Options dialog box  click Archive strategy to disk when  strategy is downloaded     The archive file na
515. u would normally use for a string variable  such as Append String to String or Convert  String to Float     Pointer Tables  A pointer table contains a list of objects of different types  each of which can be   pointed to  For example  the object at index 0 could be a chart  the object at index 1 a digital point   and the object at index 2 a string variable  An example of using a pointer table for indexing is shown  on page 85     When you create a pointer table  no initial values are set  You can use the Move to Pointer Table  command to set individual values in the table     A pointer table element cannot be directly referenced  It must be copied to a pointer variable first   using the command Move From Pointer Table Element  Once it is in the pointer variable  you can  reference it as you would any object of that type  For example  if index 3 in a pointer table points to  a counter input  use Move From Pointer Table Element to put the counter input address in a pointer  variable  Then you can use any command for the pointer variable that you would normally use with  a counter input  such as Start Counter or Clear Counter     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Simulation Commands    The following commands are used for simulation and program testing     Communication to All I O Points Enabled   Communication to All I O Units Enabled   Disable Communication to All I O Points  Disable Communication to All I O Units  Disable Communication to 
516. uch as tables  integers  or I O units   until the task is complete  For example  if you want  two different charts to change the values in the same table  it is important for one chart to complete  its task before allowing the second chart to access the table     To demonstrate  the following charts show how to construct two charts in a strategy so that each  chart can access the same table without interference from the other chart     PAC Control User s Guide    INSTRUCTION EXAMPLES       Chart 1 and Chart 2 are very similar  The main difference is that one block  D  in Chart 1 adds 2 to  each table element  while in Chart 2 it adds 3                          Here s what each block accomplishes     A    Get Table Lock  Uses the following instructions to wait until Chart 2 unlocks the flag before  it locks the flag on the table  It also tracks the number of times Chart modifies the table  and it gets  the length of the table  The Timeout value of  1 makes the chart wait the other chart has  successfully unlocked the flag on the table  See also     Flag Lock Timeout Values    on page 85     Flag lock will wait until          Chart 2 unlocks the flag I Instructions   Chart1   Get Table Lock  on the table  See also      Flag Lock Timeout  1 Timeout    yait until lock succeeds   Values    on page 85  pens  Flag Int Table Flag  Timeout  1  Tracks the number of Put Result in Int Table Flag Result  times the table has been    Increment Variable Next Block   modified by Chart1 Modifi
517. ues for individual table elements on strategy download only  see  Setting Initial Values in  Variables and Tables During Strategy Download  on page 226     1  Click the Windows Start menu and choose Programs  gt  Opto22  gt  PAC Project 92  gt  Tools  gt   PAC Terminal     The PAC Terminal window appears     File Tools Configure View Help  Control Engines   Controller Name System Type Address 1 Address 2     f Cookie Controller   Standard 4127 0 0 1  3 R1 Controller Standard 410 195 55 111                        110 PAC Control User s Guide    pa    CHAPTER 5  WORKING WITH CONTROL ENGINES       Right click the control engine and choose Download  gt  Forth File from the pop up menu   In the Download File dialog box  click Browse    In the Open dialog box  locate the file you want to download  When the full path appears   click OK    If necessary to find the file  choose All Files from the Files of Type drop down menu     The download begins  and a dialog box shows its progress     PAC Control User s Guide 111    DOWNLOADING FILES USING PAC TERMINAL       112 PAC Control User s Guide       6  Working with I O    Introduction    In addition to configuring a control engine to run your strategy  you also need to configure  input output hardware to do the work  turning things on  setting temperatures  monitoring  controls  and so on     This chapter shows you how to configure and work with I O units  I O points  and PID loops           In this Chapter   Choosing a Configuration Too
518. ugh_Chip_Control    B   Dough_Vessel_Pressure_ 1      B     ven Inspection Control        a Powerup  a 2 vewner        This chart runs   amp   C3 Numeric Variables continuously once the  ng bStartFlag program has been started   24 dtCookieMotionT imer  E  fDoughPressureS etpc      FLT  E fFlampValue Drop the dough   ex  fSetpointMinusDeadb   H FLT  White tab shows  B  nChartStetus    this is a chart  QE  nCookieMotionPreset  ga nLoopCounte                         Gray tab shows  chart name                       PAC Control  Ready Configure    Let s take a closer look at what this chart does  Even without its descriptive comments  it   s easy to  see that this program segment begins by starting a conveyor belt  If the belt is not running at the  correct speed  the process goes into a loop until the speed is correct  When it is correct  dough is  dropped on the belt  and then chips are dropped on the dough  The process then loops back to  re evaluate the conveyor speed  waiting if it   s incorrect  and dropping more dough and chips if it s  correct     The rectangular shaped blocks are called action blocks  They do things  The diamond shaped blocks  are condition blocks  They decide things  Charts may also contain other blocks  including  oval shaped continue blocks  which route the program logic back to another block in the same  chart  and hexagon shaped script blocks  which contain instructions and logic written in PAC  Control s built in OptoScript programming language    C
519. uide 329    OPTOSCRIPT DATA TYPES AND VARIABLES       330    Using Strings    As noted in the section on syntax  a string in OptoScript must be in double quotes  An individual  character can be used either as a string  in double quotes  or as an integer value representing that  character in ASCII  in single quotes   When you assign a single character to a string  use double    quotes to avoid a syntax error     sString    a      To change a single character integer into a string  use the chr    keyword as shown below     sString   Chr  a     sString   Chr 97      foc O73  sString   Chr 97     NOTE  If you intend to retrieve the string data in either PAC Display or OptoOPCServer  to avoid an error do  not use the Chr   keyword character to insert an embedded null  e g  Chr 0      Strings can be used in the following ways     String literals  must be all on one line    sGreeting    Hello  world      When you use the Chr   keyword to assign a  character value to a string variable  you can    either quote a character or give its ASCII value     For example  the following two statements are    equivalent  sStringl   Chr  A     sStringl   Chr 65      Clear a string using empty quotation marks   sStringl          String variables   sOutgoing   sIncoming     A string can be thought of as a table of  characters  The number in square  brackets is the character   s index    Note that the index starts with the  number zero   The following code would  result in sGreeting equaling  Hello  
520. umerically    and graphically     Adjust resolution of the    Input Axis by clicking the    Input Axis button     10     11            The system is stable when the Input value does not vary significantly  some drift can be  expected   Stabilization may take several minutes  depending on the system     3  TemperatureControl    View PID Loop  scanning  E  n  x   Name    pid   f   Emor  None  77 32614   Gan   5 Scan Rate   1   sec  Mode     Manual    Setpoint    90   Tunel   0 Scan Counts    249642   Enable comm  Yes      Output   30   Tune D   0       4 4      Plot  120 Details   Misc  Details   VAL   Velocity Algorithm  Type B     Input  Setpoint  Dutput    Reset Scale Tracking    View 500  Span  View 200  Span  View 100  Span  View 50  Span  View 25  Span  View 10  Span  View 5  Span  View 1  Span    Center on Input  Center on Setpoint       Increase the resolution of the Input Axis by clicking the Input Axis menu and choosing a span  setting of 1 or 5 percent     Center the Input Axis  if necessary  by clicking the red line at its left end and dragging it up or  down until the plot is visible     Under the Time Axis menu  choose Reset Scale Tracking     This is a precautionary step  as changing settings on the plot can fix the plot at a certain point  in time  Resetting the time axis ensures that you are viewing the real time values     In the Output field  type the other of your two output settings and click Apply     A 20  percent increase is a moderate  detectable change
521. unication Handle Command   delete  getpos  or setpos    Set Communication Handle Value   Set End of Message Terminator                   To work with files in your strategy  first use the command Open Outgoing Communication     Writing to a File  For example  suppose you have data in your strategy in a string table   Product_Table  that you want to write to a file  Products txt  in a directory  Company Data  on the  control engine  Here s how you would do it     1  Use Open Outgoing Communication to open a file communication handle  The value of the  handle would be    ile w  Company Data Products txt    2  Usethe condition Communication Open  to make sure the communication handle opened     3  To put the data from the string table into a comma delimited file  which is easy to open in  database software   use the command Set End Of Message Terminator to indicate that a  comma should be used as the delimiting character  Or  if you want each line of your data to end  with a LF  line feed   set the EOM  end of message  terminator to 10  decimal   which is the  ASCII code for LF  See    ASCII Table  on page 313 for other EOM characters     4  Use the command Transmit String Table to transmit data from Product  Table directly into the  Products txt file  Items from the string table are separated by commas in the file     Strategy ee  Control Engine File System    Product_Table Company Data  Products txt                   0 Bats   1 Baseballs j    CU       Bats  Baseballs         B
522. used for the  alternate download port  so there is one  less chart that can run           To enable Background Downloading     NOTE  Controller memory is cut in half when background downloading is set it in PAC Manager  Also  one  chart is used for the alternate download port  so there is one less chart that can run     1  Open PAC Manager and do the following steps    a  Clickthe Inspect button to open the Inspect window    b  In the IP Address field on the Inspect window  type the IP address for the SNAP PAC  controller    c  Click Status Write  then scroll down to Strategy Download Method    d  Click on the Value field for Strategy Download Method  select Background from the  drop down menu  then click Apply    e  Under Operation Commands  highlight  Store configuration to flash     and click Send  Command     The configuration is stored to flash memory and a Success message appears   For more information  see the PAC Manager User s Guide  form 1704   2  Turnoffthe power to the control engine  and then turn it back on again   In Configure mode in PAC Control  choose File  gt  Strategy Options     4  On the Download tab under Flash Memory  select  Use background downloading and fast  strategy updating       5   Optional  Under Flash Memory  select    Save strategy to flash memory after download     w    Strategy Options    Archive   Download   Legacy   Serial 1 0 Ports    Flash Memory       Save strategy to flash memory after download    Set autorun flag after download    B
523. uspended    e A Delay command is used     Using the command Delay  mSec  with a value of 1 millisecond is a handy way to give up the time  slice while waiting in a loop for a condition to become True  For more information  see form 1776   Optimizing PAC Project System Performance     When does the requested change to a chart or task status take effect     Not immediately  In any multitasking system  timing and synchronization issues are always a  concern  The time required for a particular request to be implemented depends on the number of  tasks currently running and the specified chart s location in the task queue  We recommend using  commands such as Calling Chart Suspended  and Chart Running  to determine the status of a  chart     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       Communication Commands    The following commands refer to moving data among entities that store and transfer data     Accept Incoming Communication  Clear Communication Receive Buffer  Clear Receive Buffer   Close Communication  Communication Open    Get Active Interrupt Mask   Get Communication Handle Value  Get End Of Message Terminator   Get Number of Characters Waiting  HTTP Get   HTTP Post Calculate Content Length  HTTP Post From String Table   Listen for Incoming Communication  Open Outgoing Communication  Receive Character   Receive N Characters   Receive Numeric Table    Receive Numeric Table Ex    Receive Numeric Variable   Receive Pointer Table   Receive String   
524. ut   scanning     XVAL    61 44073 Maximize          2  To change the value or to view more information  click the Maximize button        PAC Control User s Guide    The title bar shows the name of the analog point and whether scanning is occurring     NOMS    CHAPTER 6  WORKING WITH I O       24  PID_Input     scanning     Name  PID Input  Type  Analog Input    IAL  0   XVAL   60 57773 B    Communication    Point     170 Unit  Enabled           1 amp 3 Open Parent          Scanning stops whenever you click a changeable field  It resumes once you click Apply  another  button  or an unchangeable field  If scanning resumes before you click Apply  any changes you  made are lost     Asterisks in a field indicate an out of range value  Dashes in an XVAL field indicate a  communication error     Change the fields as necessary     A   IVAL  The point s current internal value  You can change it to any value within the valid  range ofthe analog point  For an input  the valid range may exceed the apparent range  that is   you may be able to enter a value lower than the zero scale value or higher than the full scale  value  For an output however  you cannot enter a value outside of the range defined by the  zero scale and full scale values  After you change it  click Apply        B   XVAL  The point s current external value  You can change it to any value within the valid  range of the analog point  then click Apply     C   Enable comm  Current point status  Yes on a green background me
525. ut Data the input provides   Hygrometer Humidity  percentage from 0   10096    Day Day of the week  Sunday through Saturday    Time Hour of the day  24 hour clock    Sprinkler status Whether sprinklers are currently running  on or off   Input from timer Length of time sprinklers have been on  in minutes                 PAC Control User s Guide    CHAPTER 4  DESIGNING YOUR STRATEGY       What do the outputs need to be  List all the outputs  Describe the results that are needed  Check  for any outputs you need but don t have        Output What it does    Sprinkler switch Turns sprinklers on or off       Timer control Sets timer                How many times does the process have to be repeated  Our example is a simple sprinkler  system in which the process happens twice a week on certain days  In a more complex system   however  you might have one section of the sprinklers turn on  followed by other sections  repeating  the process several times in different areas and then repeating the whole pattern on certain days     Designing a Logical Sequence of Steps to Solve the Problem    Now that you ve determined what you re trying to do and what your inputs  data  and outputs look  like  you re ready to outline the steps needed to solve the control problem  Think about how you  would do the job if you were doing it by hand  Again  work from the top down  starting with big  steps and then breaking those big steps into smaller steps        Sprinkler Control System    Every day at 6 00
526. utput from the PID  TnLo  Range of the input P The Error  PV     SP  from the previ   InHi   ous scan  OutLo Integrator  Anti windup is applied  D ae Range of the output Integral   after the output is determined to be  ius within bounds   Cain Proportional tuning parameter  PV1  PV2 PV from the previous scan and the  Unitless  May be negative  scan before that   integral tuning parameter  In units s Actual scan time  time since previ   Tunel of seconds  Increasing magnitude ScanTime    j ous scan   increases influence on output                          Equations Common to All Algorithms   Err   PV   SP   Span    OutHi   OutLo     InHi   InLo   Output   Output   FeedForward   TuneFF    Velocity   Type C Algorithm   TermP     PV   PV1     TermI   TuneIl   ScanTime   Err   TermD   TuneD   ScanTime     PV   2   PV1   PV2    Aoutput   Span   Gain     ATermP   Atermt   ATermD      Velocity   Type B Algorithm   TermP     Err   Err 1     TermI   TuneI   ScanTime   Err   TermD   TuneD   ScanTime     PV   2   PV1   PV2    Aoutput   Span   Gain     ATermP   Atermt   ATermD      Non velocity Algorithms   These equations were derived from the article    A Comparison of PID Control Algorithms  by John P   Gerry in Control Engineering  March 1987   These three equations are the same except for the tuning  coefficients  converting from one equation to another is merely a matter of converting the tuning  coefficients     Equations common to all but the velocity algorithm   Integral   Integral
527. ves  and memory cards  their use is not recommended  They are better suited for  transferring files rather than directly accessing them     ES PAC Control User s Guide       2  PAC Control Tutorial    Introduction    In this chapter  we ll start with a sample strategy  a control application for a simple cookie factory   You ll learn how to work with strategies  open and manipulate flowcharts  work with variables and  I O points  configure a control engine  compile and download a strategy  run it in Debug mode   make an online change  and more  The tutorial can be used with either PAC Control Basic or PAC  Control Professional   PAC Control Basic is shown in the graphics      The best way to use the tutorial is to sit down at your computer and follow it through  To start  all  you need is PAC Control  which allows you to do everything up to the point of downloading your  strategy  To do the complete tutorial you will need the controller and I O included in a SNAP PAC  Learning Center  For more information  go to the Opto 22 website  www Opto22 com and search on  the part number  SNAP PACLC        In this Chapter   Opening the Strategy            ss 7  Saving the Strategy    9  Examining the Strategy    10  Opening Cart    siete 13  Opening a Block   Adding a Command    18  Configuring a Control Engine uses 22    Compiling the Strategy  Running the Strategy     Compiling and Downloading the Change       33       Using a Watch Window                  s 35  Closing the Strategy a
528. vice has been turned off and then  expected  message received   on again since the last communication  and is now ready   An attempt to store the strategy to flash failed  or an attempt   5 Operation failed  to do something with a chart failed  like call  continue  sus   pend  start  initialize threads    Invalid year entered  must be between 2000 and 2099   or   6 Data field error  invalid data read from memory when attempting to read the  strategy from flash memory    7 Watchdog timeout has occurred  See    Add I O Unit Dialog Box    on page 117   Invalid data read when attempting to read a strategy from   8 Invalid data  flash  or an invalid character number was passed to a string  function     Valid range for Ethernet is 0   65535  For a communication   10 Invalid port number       handle  serial port format may be incorrect   A Transmit or Transfer command fails when using a comm   11 Could not send data  handle  For example  an attempt is made to send a file to a  remote ftp server that has gone off line   42 Invalid table index  Mn an index greater than the number of elements in the       PAC Control User s Guide              13    APPENDIX B  ERRORS AND MESSAGES       Overflow error     Typically  a math result too big to fit in the value passed   while doing number conversion functions such as con   verting a float value to engineering units  a float to an  unsigned integer  a float to an integer  a 64 bit integer to a  32 bit integer  a floating point value to a 64 
529. will be changed but will not affect the connection     To monitor the variable in a watch window  click Watch     If you have only one watch window and it is already open  the variable appears immediately in  the window for monitoring     Otherwise  the Add Watch Entry dialog box appears     PAC Control User s Guide 231    VIEWING VARIABLES IN DEBUG MODE       232    T Add Watch Entry       Name   Time of Day       Select Portions To Watch     Value    Select Watch Window     Sv   New        0             Check the items you want to watch   Items to watch vary depending on the variable type   In the Add Watch Entry dialog box  do one of the following         Ifthe watch window you want to use to monitor the variable is open  choose it from the  Select Watch Window drop down list        Ifthe watch window you want is not open  click Open  Navigate to it and double click it to  open it        Ifyou want to monitor the variable in a new watch window  click New   For help  see     Creating a Watch Window  on page 157     When the Add Watch Entry dialog box shows the correct items to watch and the watch   window you want  click OK     The variable appears in the watch window     Viewing Pointer Variables    1     Make sure the strategy is running in Debug mode  On the Strategy Tree  double click the  pointer variable you want to view     The View Pointer dialog box appears  showing the pointer s name  type  and item pointed to     3   Pointer  A   scanning     Name  Pointer     Ty
530. with a carriage return  If you add comments to the file they must be preceded  by a backslash  V  and a space     Text Examples    NOTE  Variable names are case sensitive and can include both upper  and lower case letters     Integer Example   To set an initial value of 123 for the variable INTEGER  VARIABLE  you would  include the following text in the initialization file   123  INTEGER VARIABLE       Float Example   To set an initial value of 456 789 for the variable FLOAT  VARIABLE  you would  include the following text in the initialization file   456 789    FLOAT VARIABLE       String Example   To set an initial value of  String Variable Test String  for STRING  VARIABLE  you  would include the following text in the initialization file  The spaces and newline are very important    STRING VARIABLE SINN   String Variable Test String    Communication Handle Example   To add the parameters of a communication handle  named COMM Handle  you would include the following text in the initialization file  The spaces and  newline are very important     COMM Handle SINN   tcp 10 0 0 1 1000    PAC Control User s Guide    CHAPTER 9  USING VARIABLES AND COMMANDS       Pointer Example   To have the pointer PTR_POINTER_VARIABLE point initially to    INTEGER_VARIABLE  you would include the following text in the initialization file      INTEGER VARIABLE MoveToPointer PTR POINTER VARIABLE    Integer 32 Table Example  To set initial values of 10  20  30  40  and 50 for elements zero    throug
531. with the controller  whether from the strategy or externally      The lock out affects applications such as PAC Control  PAC Display  PAC Manager  OptoOPCServer   and PAC Terminal  These applications will either have intermittent or no connectivity with the  controller     The solution to this dilemma is to control the rate at which TCP IP communication handles are  opened and closed  When a TCP IP communication handle is closed  whether a result of a prior  successful or unsuccessful opening   it should be reopened no sooner than 3 seconds  If this  reopening fails to succeed  double the delay to 6 seconds  If this subsequent reopening fails  double  the delay to 12 seconds  And thereafter  subsequent reconnections should be performed no shorter  than every 24 seconds  This throttling of the opening allows several TCP IP resources to expire their  closing timer     PAC Control User s Guide    CHAPTER 10  PROGRAMMING WITH COMMANDS       TCP Communication Handle Examples    The following diagram shows an example of a communication handle value for outgoing  communication     Outgoing Communication    SNAP R series I O Device A  IP address  10 192 59 45 IP address  10 192 59 31       Request communication  ag    E  i i       M Receives communication  DI da on port 22004  E        Communication Handle value     tcp 10 192 59 31 22004  l   d         IP address Port number    For incoming communication  the communication handle value could be     Incoming  Communication    SNAP R 
532. xample  in an assignment statement  strings can be added together like this   strDate   strMonth         strDay         strYear     It would certainly be nice to use the same kind of string addition in a procedure call   TransmitString strMonth         strDay         strYear  nPort      However  due to the current abilities of control engines  this type of string addition inside a function  call is not possible     PAC Control User s Guide 393    OPTOSCRIPT LEXICAL REFERENCE       OptoScript Lexical Reference    Token Syntax Legend    Tokens are the smallest units that the OptoScript compiler processes     bold character      parenthesis     brackets    opt subscript   no subscript   0  subscript   1 subscript   1  subscript     specific character   content is treated as a unit   set of possible items   item is optional   item is not allowed   0 or more items may be chosen  one item must be chosen   one or more items must be chosen    Literals and Names    Int32Literal    0  xX  jyhex digit            letter     any character  any character a through z     upper or lower case  T    one of  0123456789   digit   non zero diait 998 of 12345678 9   bid one of   0123456789ABC  hex digit     DEFabcdef     Hexadecimal Integer 32 bit   Good examples  Ox12AB  OX12aB   0x0   Bad examples  x123ABC  0123ABC       0  non zero digit     Decimal Integer 32 bit  Good examples  0  123  7890       digito  Bad examples  123ABC  Single Character   tola  Good examples   A    1          Bad exampl
533. xamples of integer values are  1  0  1   999  or  456  The state of a switch  for example  could be stored in an integer variable as 1  on   or 0  off      e A timer stores elapsed time in units of seconds with resolution in milliseconds  Up timers  count up from zero  and down timers start from a value you set and count down to zero  For  example  you could set a down timer to make sure a value is updated at precise intervals     e A string stores text and any combination of ASCII characters  including control codes and  extended characters  For instance  a string variable might be used to send information to a  display for an operator to see     A string variable can contain numeric characters  but they no longer act as numbers  To use  them in calculations  you must convert them into floating point or integer numbers  And a  numeric value to be displayed on a screen must be converted into a string first     e A pointer does not store the value of a variable  instead  it stores the memory address of a  variable or some other PAC Control item  such as a chart or an I O point     e Communication handles store parameters needed for communication with other devices     You can use variables that are individual pieces of information  and you can also use table variables   which are groups of related information in the form of a table     instructions  commands     PAC Control commands  or instructions  tell the control engine what to do at each step in the  flowchart to control 
534. y is running 144  copying I O point 131  I O unit commands 287  minimum maximum value 244  245  offset and gain commands  instructions   244  point commands 244  326  point  definition 46  TPO 244    applications   launching from PAC Control 66  archiving strategies   restoring archives 108   to computer 166   to control engine 106  argument 75  237   in OptoScript 328  ASCII  decimal and hex values of characters 313  auto stepping through a chart 178  179  automation 45  autorun 175    B    background downloading 169  170  baud rate and mode for serial I O units  Pro  119  baud rate for serial I O units 119  bill of materials 190  191  bit commands 293  bitwise operator  in OptoScript 336  block  block 0 202  changing color or size 203  212  connecting blocks 207  definition 202  deleting 211  drawing 205  finding in a chart 62  moving 210  naming 78  206  OptoScript 318  selecting 210  stepping through 178  BOM 190  191  bookmark 343    PAC Control User s Guide 403       breakpoints in a chart 180    C    calling a subroutine 356  case statement 323  337  programming example 82  changing  active control engine 100  analog I O while strategy is running 144  baud rate and mode for serial I O units  Pro   119  baud rate for serial I O units 119  block color or size 203  212  chart background 203  chart name or description 214  column width in a dialog box 63  command  instruction  239  connection line color or size 212  control engine definition 99  debug level 176  debugger s
535. y logic   controller with an SB brain    Exception  Use   You are not using PAC Control   PAC Manager for E1 or E2 I O units      The strategy handles all logic  you are not also  configuring events and reactions on I O units                 Whichever tool you use for configuring I O  be aware of the impact if you later change configuration   For example  if you configure I O in PAC Manager  download the configuration file to I O units  and  then later add a point in PAC Control  remember that your configuration file doesn t contain that  point     PAC Control User s Guide    CHAPTER 6  WORKING WITH I O       If you use PAC Manager  follow instructions in Opto 22 form 1704  the PAC Manager User s Guide   When you have finished configuration and saved the configuration file  you can import it into PAC  Control following the steps in    Importing I O Configuration into PAC Control  below     If you use PAC Control  follow the steps beginning with  Adding an I O Unit  on page 116     Importing I O Configuration into PAC Control    If you have configured all I O units  points  and PID loops in PAC Manager  follow these steps to   import the configuration file into a PAC Control strategy    1  Open the strategy in PAC Control  In the Strategy Tree  right click the I O units folder  From the  pop up menu  choose Import     Import 1 0 Units from an Opto Tag Database  Look in     C3 Samples x  Q    eam                         File name     Files of type    Opto Tag Database Files   o
536. y tries the primary address again  For details  see from 1702  the PAC    Display User s Guide   bl    PC with two NICs        running OptoOPCServer    H    PC with two NICs  running PAC Display Pro          SNAP PAC S series    PAC Control User s Guide    CHAPTER 5  WORKING WITH CONTROL ENGINES       NOTE  If your system has redundant controllers  you cannot use link redundancy between PAC Display  Pro and the controller  For more information on using redundant controllers  see from 1831  the SNAP  PAC Redundancy Option Users Guide        System Architecture for Ethernet Link Redundancy    As shown in the examples below  you can set up your system in several ways to take advantage of  the link redundancy capability in PAC Control  For additional information  see the SNAP PAC  controllers    user s guides  For details on how PAC Display works with link redundancy  see form 1702   the PAC Display User   s Guide     Using a SoftPAC Controller  In examples 1 and 2 below  the PAC S series controller can be  replaced by a SoftPAC controller  The PC running SoftPAC must have two network interface cards   NICs  configured with static primary and secondary IP addresses on different subnets        Example 1  Ethernet Link Redundancy    In this example  the primary concern is that the Ethernet network may need maintenance or may  fail  leaving the computer running PAC Display Professional  the computer running the  OptoOPCServer  as the PAC Display scanner   the controller  and the I O
537. y various  gains to see how well the system stays at setpoint and responds to setpoint changes     In the example below  the white arrows  added for the example   show where gain constants of   2  5  10  and  20 were applied     PAC Control User s Guide 153    INSPECTING AND TUNING PID LOOPS          Name    TemperatureControl Error   None   Input  87 5283 Gain   20 Scan Rate  1 4 sec  Mode  Auto  Setpoint  90 Tunel  0 Scan Counts   112783 Enable comm  Yes      Output  61 7775 Tune D         Plot 1 0 Details   Misc  Details   IVAL   Velocity Algorithm  Type B        30 00  Input  Setpoint    Output          Data p    InputAxis  gt     Output Axis       Time Axis  gt          Close     Add Watch    Save Tuning     Help mr    In this example  a gain setting of  30 revealed an offset error     Plot  20 Details   Misc  Details   IVAL   Velocity Algorithm  Type B     With only a gain constant 30 00   applied  the input often Mao   stabilizes at an incorrect    eae  value  In this heating   example  a gain setting of   30 drove the input close  to the setpoint  bu  subsequent increases 100  failed to eliminate the  offset  It is time to try  integral constants to  eliminate the offset error                            Data  gt     Input Axis p    Output Axis    Time Axis  gt       9  Experiment with the integral constant  in the Tune   field  type a number between 0 and 1 and  click Apply   Your PID may require larger numbers      PAC Control User   s Guide    CHAPTER 6  WORKING WIT
538. yping in  each control engine on the new computer  you can open the ControllerNames ini text file and  merge the control engine names from a source PC with those on a target PC     NOTE 1  Use this procedure only ifyou have PAC Control version R9 4a or newer  For versions prior to R9 4a   see the OptoKnowledgeBase article KB80603 on the Opto 22 website  http   opto22 com  However  the  best method is to install the newest software and use the method described here     NOTE 2  When PAC Control version R9 4a or newer is first used  it automatically migrates the control engine  definitions from older versions  If you then use an older version of PAC Control to add another control  engine  the new control engine will not automatically be available in the R9 4 or newer version because it  only checks the older versions of control engine definitions the first time it is run     To move all the control engines from a source PC to a target PC    1  On the source PC  locate the Controller ini file  This file can be found in the following location   C  ProgramData Opto 22 PAC Project ControllerNames ini   2  Send the file by email or other means so that it can be opened on the target PC     3  Onthetarget PC  open the ControllerNames ini files for the source and target PCs with a text  editor such NotePad     Source    File Edit Format View Help  R2 Control Engine 0 0 0 0 10 195 55 112       R1 Control Engine 0 0 0 0 10 195 55 111  Cookie Controller 0 0 0 0 127 0 0 1       Target    Ej
539. ystem  Just remember two things     e Include the card s directory name in the path in the file communication handle  for example     file a  sdcard0 VoltLog txt    e   Filename length  See your controller s user s guide for card compatibility information   Filenames up to 127 characters can be used on higher capacity microSDHC cards  However  on  lower capacity standard microSD cards  2GB or less  formatted with FAT16   all files you store on  the card must be named with a maximum of eight characters in the name plus three  characters in the extension  8 dot 3 format   for example  data  ile txt    For more information on using the microSD card  see the controller s user guide     PAC Control User s Guide       CHAPTER 10  PROGRAMMING WITH COMMANDS       Working with Files in Your Strategy    The commands you use with a communication handle vary according to the action  the open  mode  defined in the handle s value  To change actions   from read to write  for example   you can  use Set Communication Handle Value to change the handle s value        Close Communication    Communication Open      Transfer N Characters      Receive Numeric Table 3   Get Available File Space Receive Pointer Table Transmit Character   Get Number of Characters Waiting Transmit NewLine    Receive String  Receive String Table  Send Communication Handle Command     find     Transmit Numeric Table  Transmit Pointer Table  Transmit String  Transmit String Table    Open Outgoing Communication   Send Comm
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
pf 46 french - service navigator  PGI Tools Guide  DOSSIER PERMANENT  AOC L32W781A 32" HD-Ready Black LCD TV  Melissa Steel Series 253-002 User's Manual  DM-D001-SC Rev 4.01.11A OpInst Manaul for DL850 540kHz  Wirand FS3N  Tracer X6  MANUALE DELL`UTENTE LETTORE HARD DISK UNITISERVE  GA-E7AUM-DS2H Manual    Copyright © All rights reserved. 
   Failed to retrieve file