Home
ioCONTROL USER'S GUIDE
Contents
1. Description Possible Cause Q 1 0 23 Destination string too short In string manipulations a string was requested that is X X longer than the string it will be put into or destination string length lt 0 25 Port not locked Attempted to transmit or receive on a connection that X wasn t locked or to unlock a connection that wasn t locked 26 Unknown response from device OptoMMP based protocol packet returned by the device X was invalid 29 Wrong object type Most likely caused by An object was passed to a command that doesn t handle moving a pointer table element to a pointer that object type of the wrong type 34 Invalid I O command or invalid memory Contact Product Support See page 1 4 X location 35 Point mismatch An analog point is incorrectly configured for example an X X output point is configured as an input point 36 Invalid command or feature not Feature not yet implemented for this hardware command X implemented combination or command may not apply to the type of communication handle you are using 37 Timeout on lock Unable to lock a resource such as a variable for exclusive X 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 42 Invalid limit on string index task state A character number greater than the length of the string prior
2. Bit Mask Here is this example shown in OptoScript code OptoScript Sprinklers Block 1 B Oe OptoScript Code ClearHddModuleOffLatches Sprinkler_Control 4 0 060000C2 A Me ab 2 EE ono ven wv 2 as SB NOTE In standard ioControl commands you can enter the bitmask in binary or in hex depending on the integer display you ve chosen under the View menu In OptoScript code use hex In either case don t use decimal to represent masks since ioControl s 32 bit integers use the most significant digits as the sign As a final example of working with all points on a module at once here is a rewritten version of the pump control script shown on page 10 9 In this example the pumps controlled by HDD Output modules 5 and 6 on the 1 0 unit NE_Pump_System are turned on by the Set HDD Module From MOMO Masks command Notice that this command turns on all the pumps controlled by a single module simultaneously rather than one after the other OptoScript Powerup HDD Example 2 Ea amp BS a ti A wb E E on cov OptoS cript Code Turns on 64 pumps in order nPunp_Status SetHddModuleFromMomo NE_Pump_System 5 OxFFFFFFFF 0 nPump_Status SetHddModuleFromMomo NE_Pump_ System 6 OxFFFFFFFF 0 A ioControl User s Guide 10 11 PROGRAMMING WITH COMMANDS __ u T All HDD Modules on the I O Unit Commands with t
3. ioControl User s Guide D 3 D 4 ioControl User s Guide APPENDIX E OptoScript Command Equivalents Introduction This appendix compares standard ioControl commands to their equivalents in OptoScript code See Chapter 11 Using OptoScript and Appendix F OptoScript Language Reference for more information on OptoScript The following table lists both action and condition commands in alphabetical order The Type column shows whether the OptoScript command is a function command F or a procedure command P Function commands return a value from their action procedure commands do not For more information on command type see More About Syntax with Commands on page 11 12 Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Absolute Value AbsoluteValue Of F Accept Incoming AcceptIncomingCommunication Communication F Communication Handle Add x y F Add Message to Queue AddMessageToQueue Severity Message P Add User Error to Queue AddUserErrorToQueue Error Number P Add User 1 O Unit Error to AddUserIoUnitErrorToQueue Error Number P Queue I O Unit AND x and y F AND See AND F Append Character to String sl a P Append String to String sl s2 P Arccosine Arccosine Of F Arcsine Arcsine Of F Arctangent Arctangent Of F Bit AND x bitand y F Bit AND See Bit AND F
4. Communication Handle Value Outgoing Communication Protocol IP Address Port Ethernet TCP to another control engine top 10 192 56 185 22004 Ethernet TCP to a serial communication module on another tep 10 192 54 10 22506 rack Ethernet TCP to a serial communication module on the same tep 10 192 55 90 22511 rack uses SNAP Ultimate brain s IP address or loopback IP or address tcop 127 0 0 1 22511 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 used by another device on the network For example do not use the following port numbers which are used by Opto 22 devices for the purposes shown Port Purpose 21 FTP file transfer protocol 20 FTP file transfer protocol for get send and dir functions 502 Modbus TCP hardware and software 2001 Main command processor OptoMMP based also used by SNAP Ethernet I O and E1 E2 brains 161 SNMP based enterprise management systems 22000 Host port for information on configuring the host port 22001 see form 1440 the ioManager User s Guide Note that port numbers on the SNAP Ultimate brains SNAP LCE controllers and SNAP PAC controllers are the default ports some may have been changed for security reasons See the section on Security in form 1440 the ioManager User s Guide If you do not know what port number to use ask your network administrator or check the list of standard
5. Opens the communication handle Open the communication handle log in to the local server and checks to make sure it opened nStatus OpenOutgoingCommunication chFTP if nStatus 0 then Requests directory listing returns nStatus SendCommunicationHandleCommand chFTP dir number of listings Makes sure dir worked firmware if nStatus gt 0 then must be version 7 1 or greater nFileCount nStatus Reads in listings to stList Set the EOM character to the last byte of the listing 00 SetEndOfMessageTerminator chFTP 0x00 Note Each listing from an Opto 22 nStatus ReceiveStrTable nStatus 0 stList chFTP device server ends with these three hex bytes 0D 0A 00 if nStatus 0 then Optional parses each listing into for nIndex 0 to nFileCount 1 step 1 separated tables for GetSubstring stList nIndex 0 17 stDateTimeStamps nIndex 1 date time stamp first 17 GetSubstring stList nIndex 18 23 sTemp characters ntSizes nIndex StringToInt32 sTemp 2 file size next 23 characters GetSubstring stList nIndex 39 1000 stFilenames nIndex 3 filename remaining characters and removes the OD OA left over on nLength GetStringLength stFilenames nIndex the end of the filename GetSubstring stFilenames nIndex 0 nLength 2 stFilenames nIndex next Further parsing could be done on the endif date time stamps depending on endif how those values
6. ioControl User s Guide WORKING WITH I O re i Compatible Max Brain Part Number Racks Modules Module types SNAP UP1 D64 SNAP digital SNAP ENET D64 Shar pens 1 limited digital functions no high density digital ea ae SNAP analog digital and special pas analog digital and special purpose the ee SNAP M32 8 limited digital functions standard and i i high density digital modules OK in any position SNAP M64 16 amp The following I O units are supported in ioControl Professional Only SNAP B4M 4 SNAP B8M SNAP analog and standard digital SNAP B8MC 8 no high density digital no serial SNAP B8MC P B3000 serial SNAP B12M SNAP B12MC 12 SNAP B12MC P SNAP analog and standard digital no high density digital no serial SNAP B16M standard digital in positions 0 7 only SNAP B16MG 16 SNAP B16MC P SNAP B8M so SNAP BRS SNAP B8MC 8 pre re vii no high density SNAP B8MC P S EEN G4D16R Brick 16 G4 digital max 16 points G4D32RS Brick 32 G4 digital max 32 points G4A8R Brick 8 G4 analog max 8 points B100 FBIG 16 G1 G4 or Quad Pak digital max 16 points G4PB16 sae 9 ees B200 PB16A 16 G1 analog max 16 points For most serial based brain boards racks are limited to 16 points of either analog or digital I 0 so each 0 unit is either digital or analog Racks for Ethernet based brains however hold up to 64 points and can be either digital only or both analog and
7. Remove Current Error and Point to Next Error Add Modify Delete The top error is removed L Neeok from the queue and the Previous Block chart checks for more errors Continued on next page ioControl User s Guide 4 13 DESIGNING YOUR STRATEGY The error chart shown on the previous page is designed to be started by the Powerup chart and to run continuously If necessary you might modify the chart to take different actions depending on the error code using the command Get Error Code of Current Error Or you might want to track problem 1 0 units with the command Get Name of I O Unit Causing Current Error and then save the I O unit names to a string table These and other commands used in error handling are listed on page 10 56 Counting If an I O unit supports counting any digital input on it can be used as a counter Counters count the number of times the input changes from off to on You must start the counter before you can read it See Counters on page 10 3 for more information Counters are often started in the Powerup Chart For example suppose you wanted to count the number of widgets moving along a conveyor belt from manufacturing to shipping You could start the counter in the Powerup Chart like this Powerup olx The counter is started in the Powerup Chart Start Counter gt e e e a oom wi a a e oe r o a e a On Point Widget_Counter fy Sr
8. OPTOSCRIPT COMMAND EQUIVALENTS es M Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Get Firmware Version GetFirmwareVersion Put in P Get Frequency GetFrequency From Point F Get HDD Module Counters GetHddModuleOffLatches I O Unit Module F Number Put Result In Get HDD Module Off Latches GetHddModuleOnLatches I O Unit Module F Number Put Result In Get HDD Module On Latches GetHddModuleStates I O Unit Module F Number Put Result In Get HDD Module States GetClearAllHddModuleOffLatches I O Unit F Start Index Put Result In Get High Bits of Integer 64 GetHighBitsOfInt64 High Bits From F Get Hours GetHours F Get I O Unit as Binary Value Get loUnitAsBinaryValue I O Unit F Get I O Unit Event Message Get IoUnitEventMsgState I O Unit Event F State Message Put Result in Get I O Unit Event Message Get IoUnitEventMsgText I O Unit Event F Text Message Put Result in Get I O Unit Scratch Pad Bits GetIoUnitScratchPadBits I O Unit Put F Result in Get I O Unit Scratch Pad Get loUnitScratchPadFloatElement I O Unit F Float Element Index Put Result in Get I O Unit Scratch Pad Get IoUnitScratchPadFloatTable I O Unit F Float Table Length From Index To Index To Table Get I O Unit Scratch Pad Get IoUnitScratchPadInt32Element I O Unit F Int
9. To copy the point to one other point either on the same or a different 1 0 unit choose To Specific The Copy To dialog box opens Copy Point To Exi 1 0 Units UIO_B Cancel Help Output 09 Refrigeration 10 Not Used 11 Not Used 12 PID_Input 13 Temperature_Input In the left column choose the same or another 1 0 unit In the right column choose the location of the point to copy to 6 28 ioControl User s Guide WORKING WITH 1 0 as il 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 Changing a Configured I O Point 1 With the strategy open in Configure mode expand the 1 0 Units folder on the Strategy Tree until you can see the I O point you want to change Double click the 1 0 point name 2 Inthe Edit Analog Point or Edit Digital Point dialog box make the necessary changes Click OK to save For help in making changes see the previous sections on adding 1 0 points Deleting a Configured I O Point You
10. 3 From the Chart drop down list select the chart in this strategy in which you want to place a breakpoint Every block in that chart appears in the Block list You can click the ID Name or Type column labels to sort the blocks numerically by ID or alphabetically by name or type 4 To add a breakpoint highlight a block and click OK The new breakpoint appears in the Breakpoints dialog box ioControl User s Guide 7 19 WORKING WITH STRATEGIES a 5 To delete a breakpoint highlight it and click Remove To delete all breakpoints in the strategy at once click Clear All 6 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 Sprinklers Elapsed time Running Step On Break Off 15 916 Sec 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 When you Elapsed time represents Run a chart or subroutine and Time since the chart or subroutine started or was last paused pause it 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 paus
11. Initialization Initialize on strategy run Initial Value Initialize on strategy download Cancel Hep The figure above shows the dialog box as it appears for string tables Fields are slightly different for other table variables 6 Complete the fields as described in Add Variable Dialog Box on page 9 6 NOTE If you need to set individual table elements to differing values initially you can do so in the Powerup chart If you need to use an initialization file to initialize the values on strategy download see the next section Setting Initial Values in Tables During Strategy Download 7 Click OK The Add Variable dialog box closes and the new table variable appears in the Configure Variables dialog box Setting Initial Values in Tables During Strategy Download When you are adding table variables in ioControl 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 ioControl 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
12. Background Color Grid Color M Display Grid JV Display Block ID s Smooth Scrolling m r Action Block Parameters Connection Width a6 Height 148 Color si Font Arial 10 point m Condition Block Parameters Tiue Width 96 Height 64 Color Font h Hee FE coe Fone Aral 10 point EE B ___ Optesetipt Block Connection Width fas Height 48 Color E Font Avial 10 point r Continue Block Parameters Also Apply To D Width 36 Height 48 Color E Font Avial 10 point I ioControl I Strategy p Text T All charts C width fise Height fize Font Arial 10 point Cancel Help Reset All z E 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 A Flowchart Properties Specify general chart display in this area To apply these changes to 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 To change the chart s grid color from the default of black click the Grid Color box e 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 To enable or disable smooth scrolling in a flowchart cli
13. 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 ioControl 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 ioControl that can make programming easier especially if you are an experienced programmer ioControl User s Guide 4 11 DESIGNING YOUR STRATEGY 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 Average price 4 86 You can create the message in a single block in your ioControl chart like this 1 To enter the literal text use the command Move String Remember to include spaces where you want them to appear such as after the equal sign Move String From Current temperature To Current_Temp_Message Modify Convert Float to String Delete Convert Current_Temp Length 5 Nevt Block Decimals 1 5 Put Result in Current_Temp_String Previous Bloc
14. 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 oo Control Engine File System Product_Table Company Data Products txt 0 Bats Bats Baseballs Batting gloves 2 Batting gloves Catcher s mitts 1 Baseballs 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 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 file r New_Data txt 2 Use the 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 10 44 ioControl User s Guide PROGRAMMING WITH COMMANDS 4 Use the command Receive String Table to receive the data from New_Data txt directly into Data_Table Control Engine File System Strategy New_Data txt Data_Table 0 485 485 622
15. Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Get PID Feed Forward GetPidFeedForward PID Loop F Get PID Feed Forward Gain GetPidFeedForwardGain PID Loop F Get PID Forced Output When GetPidForcedOutputWhenInputOverRange PID F Input Over Range Loop Get PID Forced Output When GetPidForcedOutputWhenInputUnderRange PID F Input Under Range Loop Get PID Gain GetPidGain PID Loop F Get PID Input GetPidInput PID Loop F Get PID Input High Range GetPidInputHighRange PID Loop F Get PID Input Low Range GetPidInput LowRange PID Loop F Get PID Max Output Change GetPidMaxOutputChange PID Loop F Get PID Min Output Change GetPidMinOutputChange PID Loop F Get PID Mode GetPidMode PID Loop F Get PID Output GetPidOutput PID Loop F Get PID Output High Clamp GetPidOutputHighClamp PID Loop F Get PID Output Low Clamp GetPidOutputLowClamp PID Loop F Get PID Scan Time GetPidScanTime PID Loop F Get PID Setpoint GetPidSetpoint PID Loop F Get PID Status Flags GetPidStatusFlags PID Loop F Get PID Tune Derivative GetPidTuneDerivative PID Loop F Get PID Tune Integral GetPidTuneIntegral PID Loop F Get Pointer From Name GetPointerFromName Name Pointer P Get Seconds Get Seconds F Get Seconds Since Midnight Get SecondsSinceMidnight F Get Severity of Current Error Get SeverityOfCurrentError F Get String Length GetStringLength Of String F Get Substring GetSubstring From
16. F Setpoint Choose the source for the setpoint 1 0 Point Host or PID Output e To control the setpoint using a device on the same brain such as a potentiometer select 1 0 Point choose an 1 0 point from the dropdown list or type a new point name e To control setpoint using ioControl or ioDisplay select Host and enter an initial value e f another PID loop will control the setpoint select PID Output and choose the PID from the dropdown list G Output Choose the destination for the PID output 1 0 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 won t 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 pump s output to prevent pipe breakage The default for both minimum and maxim
17. In ioControl 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 Output the I 0 point that effects change in the system e Scan time how often the input is sampled e PID algorithm used four algorithms are available see Algorithm Choices PID Ethernet on page 10 60 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 out of range e Feed forward gain e Square root of input In the SNAP Ultimate and SNAP Ethernet PIDs 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 Ethernet When you configure a PID loop in ioControl choose one of the following algorithms e Velocity e ISA e Parallel e Interacting The
18. Points Fa diDoughLevelsw Hh diChipLevelSwite Fa dilnspectionPas Eh diEStop 2 doDoughPressur 93 doDoughDispens 9 doChipDispense 92 doRejectValve y aoOvenTempere ined aoConveyorSpe Sad aiOvenTemperal Oe aiDoughVesselP PIDs bd gt 10 Double click dilnspectionPassFailSwitch In the minimized dialog box click the maximize button dilnspectionPassFailSwitch sca Name dilnspectionPassFailS witch Type Digital Input SNAP IDC5D 2 5 28 VDC Default Last Scope Strategy Global Error Nme IVAL KVAL State Oft OnLach or Off Latch Off Enable comm Fes Apply AddWatch Hep 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 ioControl can t locate this hardware That s okay for this example When an inspection finds a bad cookie the on latch attached to the 0 point dilnspectionPassFailSwitch is supposed to go on We re going to trip it manually 11 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 2 36 ioControl User s Guide IOCONTROL TUTORIAL as i 12 13 14 15 16 17 The dialog box should look like this dilnspectionPassFailSwitch NOT SCs m 4
19. To cut or copy more than one 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 3 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 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 To paste the command in the same block click where you want to insert the command e 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 To 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 right mouse button and choose Detail from t
20. 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 ik and click the block to select it 2 Right click the block and choose Color from the pop up menu 3 Pick the color you want and click OK Changing Text You can change the size font font style or color of the text in any block 1 Click the Select tool ik and click the block to select it 2 Right click the block and choose Font from the pop up menu 3 In the 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 From the 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 8 3 ioControl User s Guide 8 13 WORKING WITH FLOWCHARTS Opening Saving and Closing Charts 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 Open and then double clicking the chart name in the Open Chart dialog
21. Product Support If you have any questions about ioControl you can call fax or email Opto 22 Product Support Phone 800 TEK OPTO 835 6786 951 695 3080 NOTE Email messages Hours are Monday through and phone calls to Friday Opto 22 Product Support 7 a m to 5 p m Pacific Time are grouped together and answered in the Fax 951 695 3017 order received Email support opto22 com Opto 22 Web site support opto22 com When calling for technical support be prepared to provide the following information about your system to the Product Support engineer 1 4 ioControl User s Guide WELCOME TO IOCONTROL EE l e Software and version being used e Firmware versions e PC configuration type of processor speed memory and operating system e Acomplete 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 ioControl ioControl installation is easy and quick Insert the CD containing ioControl 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 ioProject applications in Microsoft Windows XP make sure to use the Windows Classic theme Otherwise a Microsoft bug with how themes are handled may cau
22. 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 ioControl has only one level of indirection for pointers If you try to point to a pointer ioControl assigns to the new pointer the address of the object being pointed to E Initialization For all variables except up timers and down timers To set the variable to the initial value F each time the strategy is run either manually from the debugger or automatically via the autorun flag click Initialize on Strategy Run To set the variable to the initial value F only when a strategy is downloaded click Initialize on Strategy Download The variable retains its current value when the 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 See If You Have Memory Problems on page A 3 To keep a variable s current value through both power cycles and strategy download make the va
23. Z 2 Enter a subroutine name The subroutine name will become a command instruction in ioControl 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 ioControl User s Guide 12 3 USING SUBROUTINES 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 ariable Increase Notification 4 Add blocks and connections and name the blocks as you would in a chart as shown in the example below ariable Increase Notification 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 8 12 5 Save the subroutine by selecting Subroutine Save 12 4 ioControl User s Guide USING SUBROUTINES T 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 passed into a subroutine and since a table can be a parameter those 12
24. arts oh e 1G A hoe oe Cookies Contral Engines 4 Subroutines Included E Charts E Variables E Numeric Variables E String Variables Pointer Variables Communication Handles Numeric Tables String Tables Pointer Tables 1 0 Units ee ate oe ae 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 Save Strategy As Save Strategy As 2 x Save in E ioCookies ex EE A Cookies idb Save as type ioContiol Strategy Files idb 7 pea A Since each ioControl strategy must be located in its own directory we cannot save the strategy to a new name in its current location 2 Click the Up One Level button a to move up to the Examples directory ioControl User s Guide 2 3 IOCONTROL TUTORIAL 3 Click the Create New Folder button El The new folder appears in the list aixi Save A Examples e ex em l ioCookies Save as type fioControl Strategy Files idb aa Cancel Z 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 aixi Save nfa My Cookies gt amp fa ee EJ Save as type ficControl Strategy Files idb Cancel Z 6 Click Save The strategy is saved as Cookies in the My Cookies director
25. e Using ioControl With a Strategy open in Configure mode or Online mode double click the Control Engines folder on the Strategy Tree You can also click the Configure Control Engines button in the toolbar select Configure Control Engines or right click an individual control engine on the Strategy Tree The Configure Control Engines dialog box appears Configure Control Engines x Active Engine Engines Associated with Strategy SepActye Add Modit Downoad Wpicns 2 Click Add The Select Control Engine dialog box appears Select Control Engine x Configured Control Engines Add Modi OK Cancel This dialog box lists all the control engines configured on your system whether or not they are associated with your strategy 5 2 ioControl User s Guide WORKING WITH CONTROL ENGINES 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 click OK Then skip to Associating the Control Engine with Your Strategy on page 5 4 4 Ifthe control engine you want is not in the list click Add The Control Engine Configuration dialog box appears Control Engine Configuration xi Configure Ethernet Connection Configure control engine name and parameters Control Engine Name Poo A m Settings Primary IP address 00 0 0 290 B Secondary IP address o 0 0 0 ioProject Professio
26. ioControl User s Guide Index 3 deleting 8 12 drawing 8 7 moving 8 11 selecting 8 10 constant See literal continue block command instruction 9 25 configuring 9 25 definition 8 3 control characters adding to string 10 25 control concepts 3 3 control engine active control engine 5 11 archiving strategies 5 17 changing definition 5 10 changing the active control engine 5 11 commands instructions 10 16 configuring 5 1 in iolerminal 7 10 definition 3 3 deleting from strategy 5 12 download file creating 7 9 inspecting 5 12 primary and secondary addresses 5 6 removing association with strategy 5 11 restoring archived strategies 5 18 testing communication A 4 viewing message queue 5 14 control network segmenting from company network 5 5 control structures in OptoScript 11 22 control system example 3 2 controller See control engine copying block 8 12 chart 8 14 command instruction 9 24 9 25 configured 0 point 6 26 connection line 8 12 1 0 configuration 6 3 text block 8 12 count variable programming example 4 15 counter commands instructions 10 3 programming example 4 14 CRC commands 10 16 creating ioControl User s Guide flowchart 8 1 mistic PID loop 6 34 PID loop 6 29 strategy 7 1 subroutine 12 3 toolbar 3 28 watch window 6 73 See also changing cross reference window 7 28 customizing toolbars 3 25 cutting block 8 12 command instruction 9 24
27. 4 To view or edit the log file choose File Edit Log File The file opens in a text editor Logging is turned off when you open the file 5 View or edit the file as needed and then close it You return to the ioMessage Viewer window 6 To resume logging choose File Log to File 7 To rename the log file or change its location choose File 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 ioMessage 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 Always on Top to toggle that option A 8 ioControl User s Guide a if 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 Opto 22 i0Project Software Tools OptoVersion jE OptoVersion Utility 2 In the OptoVersion window click Find The utility searches your hard drive and prints a list of Opto related files found 3 To see more information on any file double click its name To sort the list in a different order click any column heading 4 To email the information to Opto 22 Product Support click E mail The u
28. Delete Next Block Previous Block il Close Help Command Help Using OptoScript The third way also uses pointers and indexing but places all the action in an OptoScript block See Chapter 11 Using OptoScript for more information on using OptoScript Optoscript FanCtrl Update Fan states bB Qo dat AM wb t no veo ov OptoScript Code _ loop through elements 1 16 of the tables a for FanCtrlIndex 1 to 16 step 1 move the AI and DO to the pointers pMotor ptMotors FanCtrlIndex pTemp ptTemps FanCtrlIndex conpare the values and act if pTemp gt ftSetpoints FanCtrlIndex then pMotor 1 Turn on motor else pMotor 0 Turn off motor endif next 4 20 ioControl User s Guide DESIGNING YOUR STRATEGY Optimizing Throughput See additional related information on throughput in Opto 22 form 1302 the oDisplay User s Guide Throughput can refer to communications between a PC and the control engine or communications between the control engine and 1 0 The following factors affect throughput for these two types of communication PC lt gt Control Engine Control Engine lt gt I O Increasing host task frequency Using I O unit commands Using design efficiencies Using an I O error handling chart In both types of communication throughput is affected by control strategy design The following sections discuss how to design your control strategy to maxi
29. WORKING WITH STRATEGIES To pause the chart or subroutine in the active window click the Pause Chart or Pause Subroutine button wj or press F7 or select Debug gt Pause Chart or Debug Pause Subroutine Here s an example of a paused chart Powerup Se RI E a E E Dae pees ten doughichip control pressure Sata de mine hc control and oveniinspection Status bar Step On Do oe e 8 a a a lll gt o tlle OIE tt tl Break Off 11194 Sec 100 x Running f Step On 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 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
30. window Address 10 192 55 69 Loader Version R5 0a The status bar in the main Verson tne 10 38 21 27 September 2006 ioContro window tells you when Loe a Lee 4 ersistent A tee an information warning Or error File Space Avail 2 09 MB message has been placed in the Device Time 13 33 01 27 September 2005 Sync time to PC Q 0 i message queue Messages can E ea help in troubleshooting your Name Strategy_70 strategy In this example an Ha Hise ean ay R Information message is in the Auton C Enabled G Disabled Archive NOT AVAILABLE m Communication Loop Time 6 msec ioControl User s Guide 2 23 IOCONTROL TUTORIAL 3 Click View Messages to see the information message ox Number of Message s 1 Pop First Message Clear Messages Code Severity Description Chat Block Line Object Time Date 0 4 Info Device has powered up Powerup clear lt system _INI N A N A Mixed 12 18 14 09 16 04 This message tells you that the 1 0 unit recently lost power but is now on 4 Close both dialog boxes 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 im The hatch marks move from Start to Start Charts We ve just moved stepped to the next block 2 Click the button again ioControl executes the Start Chart
31. 11 28 F 10 communication Ethernet link redundancy 5 6 I O memory map commands instructions 10 55 I O unit event message commands instructions 10 54 I O unit scratch pad commands 10 51 incoming 10 37 link redundancy 10 15 optimizing throughput 4 21 outgoing 10 37 overhead reducing by using event reactions 10 22 PC and control engine 5 1 peer to peer 10 36 10 51 TCP IP 10 35 10 36 with serial communication module 10 36 rs i 10 38 10 40 communication commands 10 35 communication handle definition 3 8 9 3 10 35 examples File 10 43 FTP 10 48 serial 10 51 TCP 10 38 10 39 File 10 42 FTP 10 48 port numbers 10 37 serial 10 50 serial communication modules 10 38 TCP 10 35 10 36 types 10 35 viewing 9 14 comparison operators 11 20 Compile toolbar 3 13 compiling strategy 2 20 7 6 strategy without downloading 7 8 subroutine 12 9 condition block definition 8 3 increasing efficiency in loops 4 22 condition command definition 3 8 condition in OptoScript 11 8 Configure mode definition 3 11 Configure toolbar 3 12 configuring continue block 9 25 control engine 5 1 event reaction 6 42 high density digital module 6 25 0 points 6 16 1 0 unit 6 1 mistic I O units 6 2 mistic PID loop 6 34 10 62 PID loop 6 29 10 59 serial module 6 25 subroutine parameters 12 5 table variables 9 8 variables 9 5 connection line changing color or size 8 3 8 12 definition 8 3
32. 2 3 To accomplish the same computation using standard ioContro commands you would need to create at least two intermediate variables and use five instructions as shown below Instructions Math_Expressions Block 16 x Add integer2 Plus 2 Put Result in tempintegerA Modity Subtract float2 Minus 2 Put Result in tempfloatA Next Block Previous Block iL Divide float1 By tempfloatA Put Result in tempfloatA Subtract tempfloatA Minus 3 0 Put Result in tempfloatA Multiply tempfloatA Times tempintegerA Put Result in integer1 Close Help Command Help As you can see the OptoScript version of this math expression is not only simpler to create but also easier to understand once created ioControl User s Guide 11 3 USING OPTOSCRIPT For String Handling If your strategy transmits and receives serial data you will want to try using OptoScript code In standard ioControl 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 String_Handler Instructions String_Handler Build new request Move String From plane To sVe
33. 6 25 naming points 4 11 point numbers 6 4 point definition 3 3 segmenting 0 from host network 5 5 using in OptoScript 11 12 viewing all ina strategy 7 26 7 28 1 0 unit adding 6 12 changing 6 16 commands 4 23 10 15 10 51 10 54 10 55 compatibility chart 6 4 configuring 6 1 definition 6 1 deleting 6 16 exporting configuration 6 3 importing configuration 6 4 mistic 6 5 monitoring in watch window 6 73 point numbers 6 4 serial 6 5 if statements in OptoScript 11 22 if then statements 11 8 importing chart 8 18 1 0 configuration 6 4 info viewing 5 14 initialization file 5 19 9 10 creating 9 10 downloading 9 12 input point definition 3 3 disabling 10 5 input output See 0 inspecting control engine 5 12 control engine using ioTerminal 5 16 event reactions 6 56 0 6 51 6 52 I O using watch window 6 73 mistic PID 6 71 PID loop 6 58 See also viewing installing ioControl 1 5 instruction See command integer converting to float 10 33 definition 3 7 10 32 in logic 10 34 variable definition 9 2 interacting algorithm for PID 10 60 interrupt 6 42 ioControl customizing 3 25 definition 3 1 designing a strategy 4 1 directory list of files in C 2 errors B 1 files list of C 1 installing 1 5 rs i main window 3 11 mode 3 11 opening other applications 3 29 programming 4 1 11 1 system requirements 1 5 ioDisplay 3 8 ioManager 6 1 ioMessage Viewer utility
34. 75 VACAYDC SNAP IDC5 HT 15 32 VDC SNAP IDC5 SW NC Dry Contact Switch SNAP IDC5FM 10 32 VDC SNAP IDCSDFM 2 5 28 VDC SNAP IACS 90 140 VDC VAC SNAP IACH5A 180 280 YDC VAC SNAP IACSMA 90 140 VDC VAC Man Auto Switch SNAP IAC5SFM 90 140 DC AC SNAP IACSAFM 180 280 YDC VAC Lok cma _ He 6 In the Add Module dialog box choose the module type and then the exact module from the lists Click OK 7 Inthe Configure 1 0 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 Configure I O Points m o x 140 Unit Sprinkler_Control Type SNAP Mixed Ultimate 1 0 SNAP UP1 4 Module icon Modus and Points Type Features Unis Enabled B A 00 SNAP IDC5D 2 5 28 VDC Digital Input 74 01 Not Use Expand or collapse points it Analog Output on the module by clicking ot Us the or sign in the box PY _ 09 Not Used fff 103 Not Used i Lj 04 Not Used Modify Delete Move To Points Copy To v Expand All ELLE Collapse All 6 22 ioControl User s Guide WORKING WITH I O 8 Highlight the point you want to configure and click Add Add Analog Point x A Name B Description C Type Output z SNAP
35. 9 25 connection line 8 12 text block 8 12 D data types in subroutines 12 2 data sorting in a dialog box 3 23 date commands 10 18 Debug mode definition 3 12 inspecting control engine 5 12 inspecting 1 0 6 51 Debug toolbar 3 13 debugging changing speed 7 14 choosing level 7 13 strategy 7 13 subroutines 12 12 when using OptoScript 11 30 delay commands 10 19 using in condition block loops 4 22 deleting chart 8 16 chart elements 8 12 command instruction 9 23 command temporarily 9 24 control engine association with strategy 5 11 control engine from strategy 5 12 event reaction 6 51 1 0 point 6 29 1 0 unit 6 16 PID loop 6 41 toolbar buttons 3 27 variable 9 13 designing basic rules for strategies 4 9 for faster throughput 4 21 steps for 4 1 dialog box sizing columns 3 22 sorting columns 3 23 digital adding digital point 6 16 changing 1 0 while strategy is running 6 53 copying I O point 6 26 counter 10 3 high density module commands 10 6 I O unit commands 10 15 latches 10 3 MOMO event or reaction 6 46 point commands 11 12 point definition 3 4 pulse commands instructions 10 4 quadrature counter 10 4 totalizer 10 4 digital only 1 0 unit 6 9 directory listing 10 50 disabling 1 0 10 5 docking Strategy Tree 3 17 watch window 6 75 DOS batch file 7 10 down timers 10 20 downloading files using FTP 10 48 files using ioTerminal 5 19 initialization file for
36. Downloading the Initialization File oe ccecseesestesesteeseeteseeeseeesestseeseeeeeeees 9 12 Changing a Configured Variable eicss5 sichcessccancasieneescdbinbscepideaseebinsanaacneneddsiaiscasaaidalandalantans 9 13 Deleting a WANA Cass acantstastenectsctnctaaeutsmacmscuakestcsapsatsntdctackinaantuennsapantslidasiedmacmaesunssensttasss 9 13 Viewing Variables in Debug Mode ccsccnconscsccsscsiancets crosaensencdlocnacpacnsensatecctansnacestssisetnateaiactte 9 14 Viewing Numeric String and Communication Handle Variables ccccceeeee 9 14 Viewing Pointer Variables ics ceiasa sxe stein cis ate xccasincciedsckaseaitalesbaclescucananboteasustineGeatekelseuseie 9 16 Viewing Numeric and String Tables oo cccsccssesesceseseeseeceseecsseecssssteseseetssseeeseeeees 9 16 Viewing Pointer Tables casi 2sisaischitacoacianiantncanbiatcedbsnsntpaoianeesea easiisatlamatianusuaiaaiails 9 17 Adding COmMMANdS cen cierscteemscnaseints sitini iiias cansnspactactatseutiosseatats Aii aaia Niinan 9 18 Changing a Command ccaicdeceaentanacnetacipdctaiesecdeateshacheckdedsasentendontsancassctbinietiacbachateanasterss 9 23 Deleting a Command Remeeee ee me ene eee or er ee nen ne Oe On UR ODR DPD errre 9 23 Permanently Deleting a Command iccictics ccescsicsescassipabesbietincsteetaoleolagitasnasaanneamaaeas 9 23 Commenting Qut a Command scacckccsaccacssencanctnensizedhadaadacdnes scsndeaconciie ximccesenadeasaataneentedacs 9 24 Cutting or Copying a GONNA ING cis c5a
37. E 4 f the correct I O unit does not appear in the 1 0 Unit field choose it from the drop down menu 5 Double click an unused line or highlight it and click the Add button The Add PID Loop dialog box opens Ana_4_ch_input_3 G 6 Complete the fields as described in Add PID Loop Dialog Box mistic below ioControl User s Guide 6 35 WORKING WITH 1 0 7 If you chose Host as the Input source and O Point as the Setpoint source complete the following fields Add PID Loop x Name Description Mode Auto Options Scan Rate fo sec i Input Host 7 Initial Value jo _ A B Low Scale 32768 High Scale 32767 C Output Fluid_Output Max Chg Rate fi 0 Lower Clamp fo Upper Clamp fi 0 Setpoint io Point Fluid_Qutput Bn D Gain fi Integral fo Derivative jo J Enable communication Cancel Help A Initial Value If Host is selected as Input source Specify the initial value for the input for the PID calculation This value must be between the low scale and high scale values B and C By default this value is set to zero B Low Scale If Host is selected as Input source Specify the lowest possible input value The default is 32 768 C High Scale If Host is selected as Input source Specify the highest possible input value The default is 32 767 D 1 0 point If
38. For more information and step by step procedures see Chapter 5 Working with Control 4 4 ioControl User s Guide DESIGNING YOUR STRATEGY Engines and Chapter 6 Working with I 0 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 1 0 such as the hygrometer and the switch to turn on the sprinklers You configure these physical inputs and outputs as the I O points Here are the O points you might configure for the simple sprinkler system Physical I O Type 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 ioControl 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 ioContro commands in the joControl Command Reference Find the commands you need and check them to see
39. Name dilnspectionPassFailS witch Type Digital Input SNAP IDCS5D 2 5 28 VDC Default Last Scope Strategy Global Error None IMAL VAL State jot g Ott On tatch On T Orian Enable comm mH Apply AddWatch Hep 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 In the Cookie Watch window click the plus sign next to 02 dilnspectionPassFailSwitch Your screen may show only part of the words 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 Cookie Watch eee i O f Latch 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 ioControl User s Guide 2 37 IOCONTROL TUTORIAL Your window now looks something like this JioControl Oven_Inspection_Control Sg x RE File Edit Control Engine Debug Chart Subroutine Mode Tools View Watch Window Help l x DEH eX A OSH hma aa Saele E a Hie y A l al G S oh dh Cookies ol x Numeric Tables String Tables Pointer Tables I O Units ne Set oven temperatur
40. Put Status In Integer 32 Variable J Count_Status X fal Cancel Help Command Heb Adding Commands and Local Variables Adding commands instructions to subroutines is exactly like adding instructions to charts For help see Adding Commands on page 9 18 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 9 5 12 8 ioControl User s Guide USING SUBROUTINES rs Remember that the subroutine is separate from any strategy and can be called by any strategy 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 Compiling and Saving the Subroutine 1 With the subroutine open select Compile Compile Subroutine When the subroutine has finished compiling the cursor returns to its normal form 2 Se
41. 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 ioControl User s Guide 4 3 DESIGNING YOUR STRATEGY 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 just be aware that the computer may require more details 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 Wait 24 hours Read the hygrometer Yes Is humidity less than 100 Are sprinklers off Turn sprinklers on Turn sprinklers off and set timer for 15 minutes Turn sprinklers off Building the Strategy Once you have the control problem solved in detail you can begin building the strategy in ioControl 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 1 0 units and 1 0 points
42. WORKING WITH STRATEGIES 5 To step inside the block you are on the one with the hatch marks click the Step Into button or press F11 or select Debug Step Into Counter TETELE E a aoa a ee ae The Step Into button takes you inside the arn Ds current block so you can step one tee Gr Fe command at a time ee eee A e eee The red arrow indicates the command topes o Production o 2 ooo that will be executed next E ae gto ag ah OS cece gt Increment Variable Delay Sec The white tab shows you where you are inside a chart a block or a subroutine called by a chart The small gray tabs at the left of the white tab show how you got to where you are ft Chart A Action Block Increment Counter Id 7 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 iP Clicking Step Out when you are on a block rather than inside it unpauses the chart Ina subroutine clicking Step Out takes you out of the subroutine Auto Stepping Autostepping lets you watch a chart s or a subroutine s 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 stepping click the Auto Step
43. and is initially set to zero It is clamped at 400 at the 32768 upper end Poo Dio po For the PID calculation the gain term is one the integral term is 0 1 and the derivative term is zero Configure PID Loops B3000_Analog Temperature Controller Oven _Temperature Host Oven_Temperature_Control Auto Ena Not Used Not Used Not Used Not Used Not Used Not Used Not Used 6 40 ioControl User s Guide WORKING WITH 1 0 rs Changing a PID Loop Ethernet or mistic You can change the PID loop s configuration and its position in the 1 0 unit 1 Make sure the strategy is open and in Configure mode On the Strategy Tree expand the 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 opens listing all configured PID loops Remember that the number of PID loops available depends on the 1 0 unit ioixi 140 Unit B3000 _Analog x Type B3000 SNAP Analog B Temperature Co Oven Temp Host Oven_Temperature_C Not Used Not Used Not Used Not Used Not Used Not Used Kl at Iland Up and down arrows PID loops are scanned by the 1 0 unit in the order that they appear in this list 2 To move the PID loop to a different position on the 1 0 unit use the up and down arrows in the dialog box 3 To change the PID loop s configuration double click its name to open the Edit PID Loop
44. dialog box Change the fields as necessary For help in completing the fields see Adding a PID Loop Ethernet on page 6 30 or Adding a PID Loop mistic on page 6 34 Deleting a PID Loop Ethernet or mistic 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 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 ioControl User s Guide 6 41 WORKING WITH 1 0 You can also delete a PID loop in the Configure PID Loops dialog box by highlighting it and clicking Delete Configuring Event Reactions Event reactions apply to serial based mistic 1 0 units only If you are moving from OptoControl to ioControl note that the interrupt line is not currently supported in ioControl NOTE Similar events and reactions can be configured on a SNAP Ethernet based 1 0 unit using ioManager but they can interfere with ioControl strategy logic unless you are very careful For more information see the ioManager User s Guide Opto 22 form 1440 Event reactions do exactly what their name suggests they make something happen in response to an event Their advantage is that they simplify and speed the control engine s job by offloading certain control functio
45. gt I In the Strategy Tree doubleclick the bStartFlag variable Maximize the dialog box change the value to 1 and click Apply 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 Inthe 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 button Step Off changes to Step On Click the Breakpoint Tool button d and click once on the Blow Off block A breakpoint hand appears on the block ioControl User s Guide 2 31 IOCONTROL TUTORIAL 9 Click the right mouse button or press ESC to release the tool Notice that Break On now appears in the chart status bar is chart maintains the oven temperature and rejects ookies that do not pass visual inspection he Powerup chart starts his 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 Break On Dough
46. n3 break default Monday Friday pnil 5 n4 break endswitch Use the pointer to set the chosen variable opnl p5 f1 5 Working with Tables Following are some examples for using numeric string and pointer tables Numeric tables ntTablel1 0 1 ntTablel 1 2 0 ntTablel 2 nVarl ntTablel 3 ntTablel 2 ntTablel 4 ntTablel ntTablel1 0 ntTable1l 5 nVarl ntTablel 2 3 1 nVarl ntTablel 0 nVarl ntTablel 0 ntTablel 1 ntTablel 2 String tables stStrT1 0 Hello stStrT1 1 world stStrT1 2 stStrT1 0 T stStrT1 1 Chr sStringl stStrT1 2 Pointer tables ptTable6 0 amp pVariable2 ptTable6 1 nVarl ptTable6 2 stStrT1 0 stStrT1 0 ptTable6 2 ioControl User s Guide 11 17 USING OPTOSCRIPT eo 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 er
47. 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 Configure Parameters The Configure Subroutine Parameters dialog box appears Configure Subroutine Parameters j 5 x Subroutine Name Group Variable Increase Notification Subroutines hd Subroutine s OptoScript Name Variable ncrease_Notification Comment CE kad Modify a Delete mo amp oo N gi Cancel Help 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 for example 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
48. 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 1 0 Unit See Simulation Commands on page 10 69 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 ioControl User s Guide 10 5 PROGRAMMING WITH COMMANDS e Use NOT to cause an output on one 0 unit to assume the opposite state of an input on another 1 0 unit e Use Get I 0 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 Standard Digital Points and OptoScript Code In OptoScript code a standard digital 1 0 point can be used directly wherever 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 structur
49. the entire time slice is used up waiting for the condition to become true In the example on the right however the delay allows the control engine to run other tasks while waiting for the condition to become true Condition_Delay 4 22 ioControl User s Guide DESIGNING YOUR STRATEGY Ensuring Data Freshness for ioDisplay Remember to develop your ioControl strategy in conjunction with your ioDisplay project to help optimize performance To ensure maximum throughput the strategy should be coordinated with Refresh groups in ioDisplay For example if ioDisplay is using typical freshness values of one second then the strategy should read all of the 1 0 at least once every second One efficient way to do so is to use 1 0 Unit commands See the section below Optimizing Control Engine to I O Throughput Throughput between the control engine and I O is also affected by strategy design You can take advantage of I O unit commands to communicate with several 1 0 points at once and you can use an error handling chart to handle 1 0 errors efficiently Using I O Unit Commands 0 unit commands speed up communications between the control engine and 1 0 by using tables to read or write all points on an I O unit at once rather than reading or writing one point at a time For example using the command Move 1 0 Unit to Numeric Table is many times faster than using the Move command once for each point The command Move Numeric Table to 1 0 Un
50. ves Ne Hep 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 3 To continue the download click Yes As the strategy is compiled the Compile Progress dialog box appears usually very briefly Compile Progress Compiling Chart Alarms iii amp 86 6 ioControl User s Guide 7 7 WORKING WITH STRATEGIES If no errors occur the Download Progress dialog box appears a 7 FRRARRERERAE Percent Complete 53 8 Time Elapsed sec jo When the download is complete you are in Debug mode If you receive errors see Appendix A ioControl Troubleshooting 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 El on the toolbar or choose Compile gt Compile 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
51. y 79 4F o 111 6F o 16 10 P DLE 48 30 0 go 50 P 112 70 p 17 11 Q Det 49 31 1 81 51 a 13 71 q 18 12 R DC2 50 32 2 82 52 R 14 72 r 19 13 s DC3 51 33 3 83 53 s 115 73 s 20 14 T DC4 52 34 4 84 54 T 116 74 t 21 15 U NAK 53 35 5 85 55 U 117 75 u 22 16 av SYN 54 36 6 86 56 v 118 76 v 23 17 w ETB 55 37 7 87 57 w 119 77 w 24 18 X CAN 56 38 8 88 58 x 120 78 x 25 19 Y EM 57 39 9 8 59 y 121 79 y 26 1A z SUB 58 3A 90 5A z 122 7A z 27 1B p ESC 59 3B 91 5B 123 7B 28 ic A FS 60 3c lt g2 5ce 124 7C 29 1D 4 GS 61 3D 93 5D 125 7D 30 1E m RS 62 3E gt 94 5 E 126 7E 31 1F _ US 63 3F 95 5F _ 127 7F DEL ioControl User s Guide 10 31 PROGRAMMING WITH COMMANDS Mathematical Commands The following commands perform mathematical functions Add Subtract Multiply Divide Modulo Decrement Variable Increment Variable Maximum Minimum Round Truncate Generate Random Number Seed Random Number Absolute Value Complement Square Root Raise to Power Raise e to Power Using Integers Natural Log Clamp Float Variable Clamp Float Table Element Clamp Integer 32 Variable Clamp Integer 32 Table Element Trigonometry Sine C
52. you can also configure a control engine for Ethernet link redundancy see Using Ethernet Link Redundancy in ioContro on page 5 6 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 5 1 3 From the pop up menu choose Set Active The active engine moves to the top of the list in the Strategy Tree 4 ioControl Pro only 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
53. 0 and variables you ve configured Chapter 10 Programming with Commands Important tips on using ioControl commands to accomplish what you want in your strategy Chapter 11 Using OptoScript Details on the optional scripting language available in ioControl for complex loops string handling and mathematical expressions Chapter 12 Using Subroutines How to use subroutines to streamline your strategy development Appendix A ioControl Troubleshooting Tips for resolving communication problems and other difficulties you may encounter Appendix B ioControl Errors and Messages Types of errors where you ll see them and the causes of common errors 1 2 ioControl User s Guide WELCOME TO IOCONTROL EO Appendix C ioControl Files A list of all ioControl files located in the ioControl directory and in any strategy directory Appendix D Sample Strategy An illustration and description of the sample Cookies strategy used in Chapter 1 Appendix E OptoScript Command Equivalents A table of all standard ioControl commands showing their equivalents in OptoScript code Appendix F OptoScript Language Reference Details about OptoScript code including comparisons to other languages lexical reference and notes to experienced programmers Index A phabetical list of key words and the pages they are located on Document Conventions The following conventions are use
54. 1 E 2 t 2 tli 2 t i 2 t i 1 3 t i 1 3 t i 1 3 t i 1 3 numeric expressions i f 2 0 t 3 i f 2 0 t 3 i f 2 0 t 3 i f 2 0 t 3 t 4 n x y t 4 n x y t 4 n x y z t 4 n x y z z z string assignment s hello s hello strepy s hello s thello s s2 s s2 strcpy s s2 S S2 string table assignment st 0 s st 0 s strepy st 0 s st 0 s st 1 hello st 1 hello strcepy st 1 hello st 1 hello st 1l i st 5 st 1 i st 5 strcpy st 1 i st 5 st 1 i st 5 string characters n s 0 Not available n s 0 s 0 A s 0 A s 0 A JON4Y5IIY JDVNONVI LdlYOSOLdO 4 3ping S 3SN 01 7U0901 OptoScript BASIC c Pascal string expressions s hello s2 s3 s hello s2 s3 strcpy s hello s hello s2 s3 strcat s s2 s hello Chr n s hello Chr n sprintf s hello Sc n s thello Chr n equal x y x y x x y not equal x lt gt y x lt gt y x l y x lt gt y less than x lt y x lt y x lt y x lt y less than or equal x lt y x lt y x lt y x lt y greater than x gt y x gt y x gt y x gt y greater than or equal x gt y x lt y x gt y x lt y logical OR See Note 3 x or y x lt gt 0 Or y lt gt 0 x
55. 1 0 Point is selected as Setpoint source Select from the drop down list the 1 0 point providing the setpoint value If the point doesn t exist enter a new name and add it Add PID Loop Dialog Box mistic A Name Enter a 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 Mode Select whether the initial mode of the PID is automatic or manual In Automatic mode the PID is automatically calculated In Manual mode no calculation is made 6 36 ioControl User s Guide WORKING WITH 1 0 Ce D Options To set advanced options click Options and see Setting PID Loop Control Options mistic PIDs on page 6 38 E Scan Rate Enter a time in seconds representing the interval between PID loop calculations The smaller the number the more often the PID will be calculated The default of 0 1 specifies a PID calculation 10 times per second F Input Select whether the input for the PID calculation will be read from an I O point or a host device the controller Your choice determines the other data required in the Input section of the dialog box If you choose Host see the figure in step 7 for additional fields to complete G Input drop down list If 1 0 Point is selected at F Select from the drop down list the 1 0 point providing the input value If the point doesn t exist e
56. 10 14 Analog WOU LYS potent schanccn iach ca Saceasd adda disdeccamunscsennnsunen ca mamncecagatntag recedes 10 14 Analog Points and OptoScript Code seec dasiacisecsearurseestansanveeacesaorsmstactencinactactacacceazbes 10 15 0 Unit Commands Sct sets ce extectckncis ta vec aeh tsucgntcaccectcccndaeds ats Sekaesbdlgecihechasbeseserscedias 10 15 Commands for Ethernet Link Redundancy cccccccceeseeteseeteseeteseetessetesesteeseees 10 15 Table Commands accesses cacnscrccmadnatsntssd bbl stsacedans ans aaveet tateacmaatadiactactectsctsnsdvatsadteesediinss 10 16 Control Engine Commands cixciscian ductantectcchuiaecedssvaasiacie she iachdescdiacesdacetcarctacastciccsepeatdeteanas 10 16 Commands Relating to Permanent Storage c cccccccseseeseseeteseeteseetessetesesteeseees 10 17 Chart COmMMANdS serseri eneee eeaeee eate AERE ENAERE SE EEEE EREEREER EEE 10 17 About the Task Queue c ccccscccssssscsssssssecosserserssscsesensasaccecsscstcseenssersssesacacaasenaacssasts 10 17 Time Date CommandS s ssiissiisssisssiisssisssiisssiissiisninnsnintsnintnnininninsnninanninanninnnnnnnnn 10 18 Timing ComMmandS ect cpcznceecce teed cp banearasn tassiass cicada capcatacosaauasea ceoncteasbincarceaseiaeasaninccastaans 10 19 Delay CMAN NEN ccc axacetcesteeexidk cred ssdnedecacahsnctecanelta acs atedenSokSetdectscdheciadadeeteaieas 10 19 Using TIME Sgt uence i adersi and ect apa EAEAN RE 10 19 Down Timer Operation sdesensessennatedbsccnasnsthaaneteaa
57. 10 41 Using the Control Engine s File System snc taken esdesdtesces onoucdaetehcdinacdcctocterateniarean 10 42 Working with Files in Your Strategy ccccccsceesseescesesteseeceseetesestetesteeseeees 10 43 Moving Files ea sscasstacctccsceaedanicccacatannsendancapiassciecdcansabes oauneastantecatategtetsauseadaets 10 48 FTP Communication Handle Examples scccosssencacseisetsuseencin artadincsanchestactaeizesarastas 10 48 Using FTP Communication Handles in Your Strategy ccccccceecestetesteeees 10 48 Retrieving a Directory Listing sccscccarcnsensessersitenssosccacandasienliadnccsasisastninaccacaaisinas 10 50 Using Serial Communication Handles to Communicate with Serial Devices 10 50 Serial Communication Handle Examples c c cccccseeccseesesceseseetesestesesteseaeneees 10 51 ioControl User s Guide xiii So Using Serial Communication Handles in Your Strategy ccccceceeeeeeeees 10 51 I O Unit Scratch Pad Commands cccccccscscsccsssscssescsscscssssecssssscssescssssessescatenseeseens 10 51 O Unit Event Message Commannds cccccccsscssssessssssessscsssssessaesssscesesssnsesseeees 10 54 I O Unit Memory Map Commans c cccccsesssccsscsccssscsssscsssssstssescessseesscsteneeeneens 10 55 Error Handling C OMUIMAINTS cczscircsscasascnsecsnisensesstitagacesntsoanaieadpuipdetiedsaincn ulsctsensianenatmodmasastosels 10 56 Pointer COMMAS lt 5ss2 cot doecss canon snniensansecdectectas
58. 15 step over 7 15 stepping inside blocks 7 16 one block at a time 7 15 through a chart 7 15 within a block 7 13 stopping strategy 7 13 without using ioControl 7 10 strategy archiving to computer 7 5 to control engine 5 17 7 6 closing 7 3 7 4 compiling 2 20 7 6 compiling without downloading 7 8 creating 7 1 debugging 7 13 debugging when using OptoScript 11 30 definition 3 9 7 1 deleting control engine 5 12 designing 4 1 4 9 designing for faster throughput 4 21 disassociating control engine 5 11 downloading 7 6 7 9 downloading changing compression 7 11 downloading without using ioControl 7 9 files C 1 including subroutine 12 9 opening 7 2 replacing elements 7 31 restoring archive from control engine 5 18 running 2 21 automatically 7 12 manually 7 12 without using ioControl 7 10 saving 7 3 saving to flash EEPROM 7 4 searching 7 29 stopping 7 13 viewing all operands 7 28 viewing variables and 0 7 26 Strategy Tree definition 3 14 docking 3 17 icons 3 14 string adding control characters 10 25 as i building example of 10 27 commands 10 23 11 16 equivalents in Visual Basic and C 10 29 convert to string commands 10 30 data extraction example of 10 26 definition 3 7 examples 10 25 11 16 in OptoScript 11 16 length and width 10 24 quotation marks 11 16 variable adding 9 5 variable definition of 9 3 string handling 11 4 string table ad
59. 19 Optimizing ThrOUgRPU ninenin iaa iniii aanas 4 21 ioControl User s Guide v So Understanding ioControl Multitasking 0 ccccccccescesestetesteseseeseseeseseeeseateeesneseane 4 21 Host acters a n a EE 4 21 Optimizing PC to Control Engine Throughput ccccccccescesesceteseeteseeteseeeseseseaee 4 22 Increasing Host Task Frequency ccccsccscsesesesseseesescesescssesessesesceseacessatessaeesees 4 22 Increasing Efficiencies in Your Strategy cccccccsesessesesescsesesesesteseseseseseees 4 22 Ensuring Data Freshness for ioDisplay c cccecccceeseetesteteseeeseseseesesesteseseneans 4 23 Optimizing Control Engine to 1 0 Throughput cc cceesesesteesceseseetescsteseaeeeane 4 23 Using 1 0 Unit COMA NTS 3s acca ence des scaiccoadhsdancacdasceacaxtarnsaentsstankssnstarsnessneaceaceiabad 4 23 Handling 17 Ol Errors TEMICIMEY ic secscsscscccSiccastan cans es intalbecwraicleaniatekdand etedboctaiaadton 4 23 Chapter 5 Working with Control Engines cscssssceecseseeeeeeeees 5 1 Introduction cn ntsc tne dred weakest ann ce ctneaanech deste smiboalme sc hecuea aasteadee Racca tes 5 1 In this Chapter xc sene esos geuecessacaugsca acca tccstsaascosgaccanccascutsnsas aapseutes oe bemencssecntanoneietaaces 5 1 Configuring Control EMONMOS ss crccnaceacusessessccacssepcecardctanatcnatssoveindeseessenastsctdcsies ade nc eatepestedtias 5 1 Defining a Control Engine on Your PC eecesceccscecscsescssesessesessesescesestes
60. 2 On the 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 longer associated with your strategy ioControl User s Guide 5 11 WORKING WITH CONTROL ENGINES 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 ioTerminal utility Deleting the control engine removes its definition only on the PC you are using 1 Choose Start Programs gt 0Opto 22 ioProject Software gt Tools ioTerminal 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 ioControl in Debug mode or from the ioTerminal utility e Inspecting Control Engines in Debug Mode below e Viewing the Message Queue on page 5 14 e Inspecting Control Engines from the ioTerminal Utility on page 5 16 Inspecting Control Engines in Debug Mode With the Strategy running in Debug mode click the Inspect Control Engine button a in the toolbar You can also do
61. 21 Each block in the chart contains the ioControl commands instructions that do the work in the system For example here are the instructions for the block Turn on sprinklers set timer Instructions Sprinklers Turn on sprinklers set timer x Sprinkler_Switch Madi Set Down Timer Preset Value Target Value 900 0 Delete Down Timer Timer Next Block Start Timer Timer Previous Block Close Help Eommand Help As you create charts and enter instructions keep referring to the oContro Command Reference The Command Reference describes the arguments for each command which are 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 ioControl User s Guide 4 7 4 8 Arguments DESIGNING YOUR STRATEGY 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 Add Instruction x Instruction s et Down Timer Preset Value ba Select Comment Type Name Target Value
62. 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 i 16 2 4 0010 ici 10 __16 16 7 16 1 4 FFFO a FFFFFFFO _ 16 16 7 0 1 4 0000 0 0 0 ___0 0 1000 1 2 3E8 1000 1000 Indicates an overflow The whole number portion of the resulting string is too long for its space PROGRAMMING WITH COMMANDS ASCII Table The following table shows ASCII characters with their decimal and hex values For characters 0 31 equivalent control codes are also listed for example a carriage return character 13 is equivalent to a CTRL M shown in the table as M Dec Hex CC Char Dec Hex Char Dec Hex Char o o0 NUL 64 40 9 60 1 o a SOH 65 41 A 97 61 a 2 o2 B STX 66 42 B 98 62 b 3 03 C ETX 67 43 c 99 63 c 4 o4 D EOT 68 44 D 100 64 d 5 o5 E ENQ 69 45 E 101 65 e 6 o6 F ACK 70 46 F 102 66 f 7 07 G BEL 71 47 G 103 67 g 8 o8 H BS 72 48 H 104 68 h 9 oo HT 73 49 105 69 i 10 0A J LF 74 4a J 106 6A j 11 0B K VT 43 B 75 4B K 107 6B k 12 0c L FF 44 2c 76 4c L 108 6c 13 0D M CR 45 2D 77 4D M 109 6D m 14 0E N so 46 2e 78 4E N 110 6E n 15 0F 0 SI 47 2F
63. 35 56 7841 20 1 622 2 35 3 56 4 7841 5 20 Notice the 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 ioControl strategy by using a command such as Convert String to Float or Convert String to Integer 32 See String Commands on page 10 23 for more information 5 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 ioControl strategy running on the control engine This person has sent to the control engine via FIP a comma delimited text file ProductRequest txt containing the names of the variables See page 10 48 for information on FTP This section of the ioControl 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 Productlnfo txt on the control engine which can later be sent via FIP t
64. A 7 ioTerminal utility downloading files 5 19 inspecting control engines 5 16 testing communication with control engine A 4 ioUtilities 5 16 5 19 A 4 A 7 A 8 IP address loopback 10 37 10 39 primary and secondary 5 6 ISA algorithm for PID 10 60 IVAL 10 5 L lag time for PID 6 59 latch 10 6 commands instructions 10 3 launching See opening link redundancy 10 15 literal constant 9 5 in OptoScript F 8 load last mode at startup 7 2 load last strategy at startup 7 2 local subroutine parameter 12 2 local variable 12 2 log file C 2 logic in charts 4 9 4 22 logical commands instructions 10 33 logical operator in OptoScript 11 20 logical true and false 10 34 loop logic 4 9 loopback address 10 37 10 39 looping 11 6 11 23 11 24 M mathematical commands instructions 10 32 mathematical expressions 11 3 ioControl User s Guide Index 7 in OptoScript 11 19 memory A 3 memory map commands 10 55 message on screen programming example 4 11 message queue 5 14 minimal debug definition 7 13 minimum maximum value 10 13 10 14 mistic I O unit 6 5 addressing points 6 10 6 12 mistic I O units 6 2 mistic PID commands 10 62 mode Configure definition of 3 11 Debug definition of 3 12 Online definition of 3 12 mode toolbar 3 13 modifying See changing MOMO 6 46 6 57 monitoring See inspecting and viewing mounting rack analog digital serial 1 0 units 6 7 B3000 serial 6 10
65. 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 ioControl 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 calls to the control engine therefore leaving more processing time for other tasks In addition a slower setting may be useful when checking communication using ioMessageViewer see page A 7 To change debugger speed follow these steps 1 With the strategy in Configure mode choose Configure Options 2 In the ioControl Options dialog box click the Debugger tab ioControl Options i x Workspace Debugger Debugger Performance Hi Low Cancel Help 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 7 14 ioControl User s Guide
66. Chart Suspended Calling Chart Suspended Get Chart Status Continue Calling Chart For information about charts in an ioControl strategy see ioControl Terminology on page 3 6 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 ina 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 The chart or subroutine is suspended 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 Increasing Efficiencies in Your Strategy on page 4 22 ioControl User s Guide 10 17 PROGRAMMING WITH COMMANDS 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 loc
67. Check hardware connection address power and jumpers ioControl User s Guide A 1 o e UUD 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 ioControl is communicating with the control engine See Checking Communication with the Control Engine on page A 4 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 5 12 In the List of Common Messages on page B 3 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 1 0 Check the possible causes for help in fixing problems e For help with a command look up details about the command in the oControl Command Reference or online help e For help with communication to 1 0 see Resolving Communication Problems on page A 5 Many of these suggestions apply to 1 0 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 ioControl strategy or as returned values in OptoScript Your strategy should routinely check status codes and adjust logic as necessary to resp
68. Drawing Toolbar Select Connect Condition Block Text kX BO NA Action Block Continue Block OptoScript Block Configure Toolbar control Eine Variables Wl kk 1 0 Subroutines 3 12 ioControl User s Guide WHAT IS OCONTROL rs Compile Toolbar Active View Changes All CEEI Mode Toolbar Configure Online Debug El EX Debug Toolbar Stop Strategy Step Out New Watch Window ie Into en Sniff Communications gt TEL TE s at a8 Run Strategy Step Over Auto Step Inspect Control Engine Pause Chart Open Watch Window View Toolbar Zoom in Hex Integer Display Zoom Out Hex String Display Binary Integer Display Moving Toolbars You can move toolbars to the place where they are most convenient for you To move a toolbar click and drag it with the mouse to the location where you want it to be Hiding and Showing Toolbars To hide or show a toolbar choose View Toolbars In the dialog box click to put a check mark in the box next to the toolbar you want to show To hide a toolbar click the box to remove the check mark ioControl User s Guide 3 13 WHAT IS IOCONTROL Sprinkler Control MIC TES a Control Engines Sprinkler Controller Subroutines Included E Charts variables C Numeric Yariables String Variables Pointer Variables E Communication Handles C Numeric Tables String Tables Pointer Tables YO Units 7 UIO_A Po
69. Eea IR mGBOo Al P agM He QGal MPT Ole a Ale A oi dh E ojx a Cookies B Control Engines amp Cookie Controller Subroutines Included Charts amp Alarms Dough_Chip_Control Dough_vessel_Press w Oven_Inspection_Cc amp Powerup E Variables Numeric Variables 840 bStartFlag GL dtcookiemotionT 1 fDoughPressure i FRamp alue t FSetpointMinusD 83 nChartStatus 832 nCookie_Counte 832 nCookieMotionPr 848 nLoopCounter String Variables E Pointer Variables 4 Communication Hand Numeric Tables E String Tables x gt ioControl Ready p bebug NUM Z This chart starts the program and all other charts Wait until start flag is set true non zero Start the alarm monitoring doughichip control pressure control and oven inspection 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 exampl
70. F Oven_Temperature fo 447 1234 Reaction Activate PID Loop IVAL WAL PID Temperature _Controller G Input Oven_Temperature 0 447 1234 Output fOven_Temperature_Control 0 0 Setpoint From Host 450 fo Apply Add Watch Help 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 2 Change the fields as described in View Event Reaction Dialog Box below 3 To add the event reaction to a watch window click Add Watch and see page 6 73 6 56 ioControl User s Guide WORKING WITH 1 0 a i View Event Reaction Dialog Box A Name Name of the event reaction B Enabled Current status Yes on a green background means enabled No on a red background means disabled To change status click one of the arrows then click Apply C Unit The 0 unit on which the event reaction is configured D Error Any communication error appears here with a red background E Event Occurring Event Occurred Scan Status Internal and external values for whether the event occurred or is occurring whether scanning is occurring and whether an interrupt is to be generated when the event occurs If the reaction type involves a read and hold operation a Read a
71. Float Literal 7 300 0 7 Down Timer Down Timer Variable fT imer Cancel Help Command Help The sample flowchart we ve shown uses standard ioControl 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 O matches the configured O in the 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 ioControl Troubleshooting If you have 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
72. From Point F Measurement Get amp Restart On Time GetRestartOnTimeTotalizer From Point F Totalizer Get amp Restart Period GetRestartPeriod From Point F Get All HDD Module GetAllHddModuleOnLatches I O Unit Start F Off Latches Index Put Result In Get All HDD Module GetAllHddModuleStates I O Unit Start F On Latches Index Put Result In Get All HDD Module States GetHddModuleCounters I O Unit Module F Number Start Table Index Put Result In Get Analog Filtered Value GetAnalogFilteredValue From F Get Analog Maximum Value GetAnalogMaxValue From F Get Analog Minimum Value GetAnalogMinValue From F Get Analog Square Root GetAnalogSquareRootFilteredValue From F Filtered Value Get Analog Square Root GetAnalogSquareRoot Value From F Value Get Analog Totalizer Value GetAnalogTotalizerValue From F Get Available File Space GetAvailableFileSpace File System Type F Get Chart Status GetChartStatus Chart F Get Communication Handle GetCommunicationHandleValue From To P Value Get Control Engine Address GetControlEngineAddress F Get Control Engine Type GetEngineType F Get Counter GetCounter From Point F Get Day GetDay F Get Day of Week GetDayOfWeek F Get End Of Message GetEndOfMessageTerminator Communication F Terminator Handle Get Error Code of Current GetErrorCodeOfCurrentError F Error Get Error Count GetErrorCount F Get Event Latches GetEventLatches E R Group F E 8 ioControl User s Guide
73. Get amp Clear All HDD Module On latches latches and clearing latches Get All HDD Module States Get All HDD Module Off Latches Get All HDD Module On Latches lt x KK Xx Xx Get HDD Module States Get HDD Module Off Latches Get HDD Module On Latches Get HDD Module Counters Get amp Clear HDD Module Counters Get amp Clear HDD Module Counter X Reading and clearing counters XxX X XxXxX 10 8 ioControl User s Guide PROGRAMMING WITH COMMANDS Reads or writes to Purpose Command name Set HDD Module from MOMO masks X Writing to points Turn On HDD Module Point X Turn Off HDD Module Point X Individual Point A few HDD module commands such as Turn On HDD Module Point and Get amp Clear HDD Module Counter address an individual point by module and point number Remember that Opto 22 modules and points start at zero HDD points do not have names If you need to refer to a specific point or a group of points by name however you can create an ioControl variable and place data in it Creating a variable for a group of points can be very useful in a large installation with many similar inputs or outputs For example suppose output modules 5 and 6 on the NE_Pump_System I O unit each control 32 pumps You could use an integer 32 variable called nPump_Line for the module number and another integer 32 variable called nPump_Number for the point number The variables make it easy to loop throu
74. Guide E 5 OPTOSCRIPT COMMAND EQUIVALENTS ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name Enable Event Reaction EnableEventReactionGroup E R Group P Group Enable I O Unit Causing EnableIoUnitCausingCurrentError P Current Error Enable Mistic PID Output EnableMisticPidOutput On PID Loop P Enable Mistic PID Output EnableMisticPidOutputTrackingInManualMode P Tracking in Manual Mode On PID Loop Enable Mistic PID Setpoint EnableMisticPidSetpointTrackingInManual P Tracking in Manual Mode Mode On PID Loop Enable Scanning for All EnableScanningForAllEvents On I O Unit P Events Enable Scanning for Event EnableScanningForEvent Event Reaction P Enable Scanning of EnableScanningOfEventReactionGroup P Event Reaction Group Equal to Numeric Table n nt 0 F Element Equal x y F Erase Files in Permanent EraseFilesInPermanentStorage F Storage Error on I O Unit IsErrorOnIoUnit F Error IsErrorPresent F Event Occurred HasEventOccurred Event Reaction F Event Occurring sEventOccurring Event Reaction F Event Scanning Disabled sEvent ScanningDisabled Event Reaction F Event Scanning Enabled sEvent ScanningEnabled Event Reaction F Event Reaction sEventReact ionCommEnabled Event Reaction F Communication Enabled Event Reaction Group sEventReactionGroupEnabled E R Group F Communi
75. Handle F Comment Block block comment P Comment Single Line single line comment F Communication Open IsCommunicationOpen Communication Handle F Communication to All I O IsCommToAl1lIoPointsEnabled F Points Enabled Communication To All I O IsCommToAllIoUnitsEnabled F Units Enabled Compare Strings CompareStrings String 1 String 2 F Complement x P Continue Calling Chart ContinueCallingChart F Continue Timer ContinueTimer Timer P Convert Float to String FloatToString Convert Length Decimals P Put Result in ioControl User s Guide E 3 OPTOSCRIPT COMMAND EQUIVALENTS Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name Convert Hex String to HexStringToNumber Convert F Number Convert IEEE Hex String to IEEEHexStringToNumber Convert F Number Convert Integer 32 to IP Int32ToIpAddressString Convert Put Result F Address String In Convert IP Address String to IpAddressStringToInt32 Convert F Integer 32 Convert Mistic I O Hex to MisticIoHexToFloat Convert F Float Convert Number to NumberToFormattedHexString Convert P Formatted Hex String Length Put Result in Convert Number to Hex NumberToHexString Convert Put Result in P String Convert Number to Mistic O NumberToMisticIoHex Convert Put Result P Hex in Convert Number to String NumberToString Convert Put Result in
76. Here s how you would send the data in your ioControl strategy 1 Use the command Open Outgoing Communication to open an FIP communication handle The value of the handle would be tp 10 192 56 45 21 JoeG hello 2 Use the condition Communication Open to make sure the communication handle opened 3 Use the command Send Communication Handle Command to specify the filename and send the file in one step The communication handle you send is send UseThisData txt HunkoData txt If the remote filename already exists it is overwritten 4 When you have finished sending 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 Here s how you would send the data 1 Use the command Open Outgoing Communication to open an FIP communication handle The value of the handle would be ftp 10 192 56 45 21 JoeG hello 2 Use the 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 Use a Transmit command such as Transmit String or Transmit Numeric Table to sen
77. If you clicked the Options button in the Add PID Loop dialog box in step 6 of Adding a PID Loop mistic on page 6 34 the PID Loop Control dialog box opens x m Automatic Mode A Output Enabled Disabled m Manual Mode B Output Enabled Disabled C Dutput Track Input Yes No D Setpoint Track Input Yes C No E i Reset C Yes No Cancel Help 1 Set the options as described in PID Loop Control Options Dialog Box below NOTE Since you can switch between automatic and manual modes through the View PID Loop dialog box in Debug mode you may want to configure options for both modes 2 When you have set the options click OK to return to the Add PID Loop dialog box 6 38 ioControl User s Guide WORKING WITH 1 0 rs PID Loop Control Options Dialog Box A Automatic Mode If you want the PID calculation transferred to the output click Enabled the default If you do not want the PID calculation transferred to the output click Disabled In either case the PID will continue calculating and will not be reset B Manual Mode Output If you want the PID calculation transferred to the output click Enabled the default If you do not want the PID calculation transferred to the output click Disabled C Manual Mode Output Track Input If you want the output to assume the input value click Yes You can use this option to create a signal converter for exampl
78. If you see the message Destination host route not defined the control engine probably has an IP address and subnet 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 Are the 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 1 4 A 6 ioControl User s Guide a i Other Troubleshooting Tools Checking Detailed Communication Information Using ioMessage Viewer For detailed information about each communication transaction use the ioMessage Viewer utility 1 In the Start menu choose Programs Opto 22 ioProject Software Tools ioMessageViewer You can also start ioMessage Viewer from iolerminal by choosing Tools Start ioMessage Viewer or from ioControl in Debug mode by choosing Debug Sniff Communication The ioMessage Viewer window appears g loMessage Viewer Bel Es File View Help Pause R
79. O E E AE eens 11 1 this Chapter scini ra a a A t 11 1 About OPtOSGiPt saiia 11 1 When To Use HOS GUNN acca Dasecneenadlansne teeters caatancanant dabaancat dalea itutaneacsuetaCnatbuatnatescestncioss 11 2 For Math TEXTES SIONS csceasacasenessanhachepsteicdscvacsacsssatiucanteecnotsadeiessnsesesacknreucensbdandesscetiacta 11 3 For String HandliNg ncssa 11 4 xiv ioControl User s Guide EE ee For Complex OID ec cei case ach reseed cpa duadibccocaneseaaseadh nasohautaveckeckneslenitacen ene eibasais 11 6 For Case Statements cectel Sats echertaiele cc tan aeciesiait dlink tian a on ononciacnaciunie tnt 11 7 For A MARVIN Sc cee ccs sic caactes chad baenctnaveenarene tee dactecice apes tecentendaatere ace ciBipoartachomtennaxtalasns 11 8 ate Saas Sek ace ape cee tee aa ae eee cee eae a esc ceh cea 11 8 For Combining Expressions Operators and Conditions ccececcceeseeseeeeeeeeeeeeee 11 10 OptoScript Functions and Commands s c ceccsccccccseccsscscesceccssecescarseseanecseatsscasssssnssees 11 11 Standard and OptoScript GOmM Mans siicsi stamacancenscecidciaseatiassensetvaaaeneandecsunsnenddes 11 11 Using 1 0 in OptoSceript cccesassceccnsensensdcatcatnncsc acca xsbaheosastaaessaracsachscncwstvabesteatincistiandd 11 12 OptoScript VIN AN sre tecencines ata cneotuctsvnncehcontoncar ausiestelrasastin tan xe leetialictnesattecbicnamacatdutaemiecter 11 13 More About Syntax with Commands ccscccctccccicsssadssdccdaccsaccnsscdeattdsascanxeca
80. OptoScript equivalents see Appendix E In this Chapter About Variables sence cciaccaciasissraccnasiescnstisess 9 1 Adding Commannds ccccecseeeeees 9 18 Variables in ioControl c c cccccccccscecsacdeedecns 9 3 Changing a Command cccceceeeees 9 23 Adding Variables cccccecceceeeceeseetestees 9 5 Deleting a Command cece 9 23 Adding TADIGS eccna 9 8 Cutting or Copying a Commanid 9 24 Changing a Configured Variable 9 13 Configuring a Continue Block 0 0 0 9 25 Viewing Variables in Debug Mode 9 14 Viewing and Printing Chart Instructions 9 26 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 variable s 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 variable s name remains the same but its value may change For example the name of the ioControl User s Guide 9 1 USING VARIABLES AND COMMANDS variable Oven_Temperature stays the same but its value the temperature of the oven may change
81. Pointer Commands on page 10 56 and String Commands on page 10 23 Control Engine Commands The following commands refer to the control engine Get Control Engine Address Get Firmware Version Get Control Engine Type Save Files To Permanent Storage Get Available File Space Erase Files In Permanent Storage Calculate Strategy CRC Load Files From Permanent Storage Retrieve Strategy CRC 10 16 ioControl User s Guide PROGRAMMING WITH COMMANDS Commands Relating to Permanent Storage The term Permanent Storage in the last three 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 These commands do NOT affect 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 10 42 For the specifics on individual commands see online help or the joContro 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 Chart Commands The following commands control charts in the strategy Chart Running Calling Chart Running Chart Stopped Calling Chart Stopped
82. Professional Features that are available only in ioControl Professional are marked with G Here s what is in this user s guide Chapter 1 Welcome to ioControl Information about the guide and how to reach Opto 22 Product Support Chapter 2 ioControl Tutorial A tutorial designed to help you use ioControl as quickly as possible The chapter leads you through a sample strategy that you can manipulate download and run in Debug mode Chapter 3 What Is ioControl An introduction to ioControl key terminology and the main windows and toolbars Chapter 4 Designing Your Strategy Programming in ioControl how to get from your real world control problem to a working strategy Chapter 5 Working with Control Engines How to configure and communicate with control engines Chapter 6 Working with 1 0 How to configure and communicate with input output 1 0 units 1 0 points and PID loops Chapter 7 Working with Strategies Detailed steps for creating compiling and running strategies Chapter 8 Working with Flowcharts Detailed steps for creating and working with the flowcharts that make up your strategy Chapter 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
83. Subroutine Graphics on page 7 23 To view and print instructions in the subroutine s blocks see Viewing and Printing Strategy or Subroutine Elements on page 7 26 ioControl User s Guide 12 13 USING SUBROUTINES 12 14 ioControl User s Guide APPENDIX A ioControl Troubleshooting This appendix provides general tips for resolving problems you may encounter while running ioControl or communicating with your hardware If you are running Windows NT or Windows 2000 and encounter problems with permissions see page A 9 For information about types of errors and lists of error codes see Appendix B ioControl Errors and Messages Also check troubleshooting information in your controller s user guide and the troubleshooting appendix in Opto 22 form 1460 the SNAP Ethernet Based I O Units Users Guide 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 1 0 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 ioControl it s probably an ioControl error Here s an example of an ioControl error message ioControl x AN Timeout No response from device
84. Subroutines Included i Charts The Powerup chart starts aS Alarms this chart E amp Dough_Chip_Control E amp Dough_Vessel_Press amp Oven_Inspection_Cc amp Powerup 5 Variables E Numeric Variables ge bStartFlag This chart runs GL dtCookieMotionT continuously once the fut FDoughPressure program has been started fand fRampValue ty FSetpointMinusD 38 nChartStatus Drop the dough 848 nCookie_Counte 848 nCookieMotionPr 238 nLoopCounter Strategy status String Variables 3 Drop the chips P Pointer Variables Communication Hand Stopped Step Off Break Off 100 7 Numeric Tables a Chart String Tables ba J g P pad DEAE Mode ioControl Ready Debug 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 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 button M At the bottom of the chart window the word Stopped changes to Running Let s try pausing the program to see where we are ioControl User s Guide 2 21 IOCONTROL TUTORIAL 3 Click the Pause button i JioControl Powerup E lol x E File Edit Control Engine Debug Chart Subroutine Mode Tools view Watch Window Help 18 x EE Bex An
85. Variable 1 0 Unit Memory Map Complement 120 Unit Scratch Pad Cosine Logical Decrement Variable Divide Miscellaneous Generate Random Number PID Hyperbolic Cosine Pointers Hyperbolic Sine Simulation Hyperbolic Tangent String Increment Variable Subroutines Maximum Time Date Minimum Timing Modulo Cancel Help Command Heb 5 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 press F1 to open online help You can also look up the command in the oControl Command Reference 6 When the command you want is highlighted click OK to return to the Add Instruction dialog box 7 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 9 20 ioControl User s Guide USING VARIABLES AND COMMANDS 8 Complete each argument for the command by typing in the Type and Name fields or by choosing from the drop down lists Edit Instruction x Instruction Move x Select Comment Set oven to 325 degrees Type Name From integer 32 Literal 225 M Arguments To analog Output Oven_T emperature_Control E Cancel Help _Command Hel If the argument type is a literal or constant you must type it in I
86. You are using OPC to communicate with I O for E1 or E2 I O units units The strategy handles all logic you are not also You are not using ioControl configuring events and reactions on I O units Whichever tool you use for configuring 1 0 be aware of the impact if you later change configuration For example if you configure 1 0 in ioManager download the configuration file to I O units and then later add a point in ioControl remember that your configuration file doesn t contain that point 6 2 ioControl User s Guide WORKING WITH 1 0 rs If you use ioManager follow instructions in Opto 22 form 1440 the ioManager Users Guide When you have finished configuration and saved the configuration file you can import it into ioControl following the steps in Importing 1 0 Configuration into ioControl below If you use ioControl follow the steps beginning with About 1 0 Units on page 6 4 Importing I O Configuration into ioControl If you have configured all 1 0 units points and PID loops in ioManager follow these steps to import the configuration file into an ioControl Strategy 1 Open the strategy in ioControl In the Strategy Tree right click the 1 0 units folder From the pop up menu choose Import Import 10 Units from an Opto Tag Database 24 xi Look in a Samples gt c mal Files of type Opto Tag Database Files otg 7 Cancel 2 Navigate to the configuration file you created
87. a standard digital module in position 3 and a serial module in position 4 elements 3 and 4 in the table would be zero filled To use the data in the table you can manipulate the table using commands such as Shift Numeric Table Elements and Numeric Table Element Bit Set For example the first command in the block shown below places data for all modules on the rack in the table nHDDInputs starting at table element zero The second command tests bit 4 in table 10 12 ioControl User s Guide PROGRAMMING WITH COMMANDS element 7 which corresponds to point 4 on the module in position 7 and puts the result of the test into the variable nState Instructions ReadPoints Read Rack Get module and Test Bit Get All HDD Module States VO Unit UVio_wHDD Start Index 0 Modify Put Result in nHDDinputs Put Status in nScanStatus Delete Numeric Table Element Bit Test Next Block Element Index T Of Integer Table nHDDInputs Previous Block Bit to Test 4 Put Result in nState H If you need to work with the data for only one module in the table you can use the command Move From Numeric Table Element to move the module s data from the table into an integer variable Then you can use bit commands within the integer Analog Point Commands The following commands are used with Analog Points Offset and Gain Others Set Analog Offset Ramp Analog Output Calculate amp Set Analog Offset Set Analog TPO Period Set Analog Gain S
88. 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 page 8 5 to change existing elements to match the new defaults To change the appearance of charts and elements follow these steps 1 Choose one of the following depending on the scope you want to change e To change all new charts in all new strategies and all new subroutines choose Configure Default Properties to open the Configure ioControl Default Properties dialog box ioControl User s Guide 8 3 WORKING WITH FLOWCHARTS e To change all new charts in the open strategy only choose File Strategy Properties to open the Configure Strategy Properties dialog box e To change new elements in the open chart or subroutine only choose Chart Properties or Subroutine 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 Configure Chart Properties xi m Flowchart Parameters A ees 7
89. and operators ee Sig te Sy Oe en ee a Mar gt ee ee ey we ee ee ee ee Ge easily in a single block OptoScript Sprinkler_Control Grass Trees Control x Hale aE lezl Ajala raofrcra ry Z OptoScript Code 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 0 else Grass 1 DelaySec 600 7 7 Water grass for 10 mins Grass 0 endif while Soil_Moisture lt 30 Trees 1 Water trees wend el se DelaySec 3600 Wait one hour before checking the day again endif A 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 ioControl User s Guide 11 9 USING OPTOSCRIPT D OptoScript Functions and Commands Since functions in OptoScript are provided by commands almost identical to the standard commands in ioControl 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 alm
90. 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 FIP 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 Set Communication Handle Value to switch to the other module Advanced users may also want to use pointers Several types of communication handles are available TCP For Ethernet communication For communication with serial modules See page 10 36 See page 10 38 File For creating a file to be stored on the control engine and reading or writing to a file stored on the control engine See page 10 42 ioControl User s Guide 10 35 PROGRAMMING WITH COMMANDS FTP For accessing files on the local file system or another See page 10 48 FTP server including transferring files between the two servers Serial For using the RS 232 connectors on a SNAP See page 10 50 Ethernet based controller to communicate with serial devices Not used for serial communication modules or serial based I O units Using TCP Communication Handles The TCP communicatio
91. and saved in ioManager Double click it to open it The configuration information is imported You can expand the 1 0 units folder to see the imported units and their points If you need to configure additional I O units from within ioControl see About 1 0 Units on page 6 4 To tune PID loops see Inspecting and Tuning PID Loops on page 6 58 Copying 1 0 Configurations If you have two strategies that use similar I O units and points you can export an 1 0 configuration from one Strategy into a file and then import it into the other strategy If you need similar configurations for several Ethernet based 0 units you can use ioManager to send it to multiple 1 0 units at once You cannot use ioManager for serial based 1 0 units For more information on using ioManager see Opto 22 form 1440 the ioManager Users Guide ioControl User s Guide 6 3 WORKING WITH 1 0 Creating the Configuration Export File 1 Open the strategy you are copying from in ioControl In the Strategy Tree right click the 1 0 Units folder and choose Export from the pop up menu The Export I O Units to an Opto Tag Database dialog box appears 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 Configuration File When you import the 1 0 configuration file it does n
92. and so on 6 12 ioControl User s Guide WORKING WITH 1 0 Na M e A G4D32RS brick contains the equivalent of two 16 module units and the brain board addresses them separately When you configure it in ioControl notice that it is called a G4D16RS Configure two G4D16RS 1 0 units for each brick Adding an I O Unit NOTE If you have already configured 1 0 in ioManager you can also add 1 0 units or points if necessary from within ioControl 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 1 0 Units folder You can also click the Configure 1 0 icon on the toolbar or select Configure 1 0 The Configure 1 0 Units dialog box opens showing all configured 1 0 units SNAP Mi Ethernet 127 0 0 1 Disabled Delete 120 Points PID Loops 2 To configure a new I O unit click Add or double click anywhere in the box below any listed units ioControl User s Guide 6 13 WORKING WITH 1 0 The Add 0 Unit dialog box appears x A Name l B Description C _ Type SNAP Mixed Ultimate 1 0 SNAP UP1 4DS D C Fahrenheit Celsius E Pott Ethemet z for J Enable Communications J F Primary Address 0 0 0 0 G _ Secondary Address ee eee H _ Timeout fi second s Watchdog No Yes OK Cancel Help ok 3 Complete the fie
93. are not required e In OptoScript code you must use double quotes for string literals See Chapter 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 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 string s 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 an ioControl string table must be of the same width ioControl 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 10 24 ioControl User s Guide PROGRAMMING WITH COMMANDS e No str
94. are saved Saving the Strategy to a New Name 1 To save the strategy and all its charts under a new name choose File Save Strategy As 2 In the 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 Options and click 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 Close Strategy NOTE Since only one strategy at a time can be open in ioControl 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 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
95. aware that quadrature counters differ on Ethernet based and mistic 1 0 units On mistic 1 0 units quadrature counters must be started with the command Start Counter and a positive value means that phase B leads phase A On Ethernet based 1 0 units counters start as soon as they are configured the Start Counter command is only used after Stop Counter and a positive value means that phase A leads phase B See additional details in the oControl 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 1 0 Points on page 6 16 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 send 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 yo
96. be Single Stepping When you are debugging a Strategy start by using the Step Over button to go through 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 7 13 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 m ioControl User s Guide 7 15 WORKING WITH STRATEGIES 2 To step to the next command block click the Step Over button iP or press F10 or select Debug 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 7 15 The hatch mark has moved to the next block Powerup Joj x d doughichip control pressure i control and oveniinspection SO fh ee eae ee ee a ee Ae A eg of 4 1 Running Step On Break Off l 0 000 Sec 3 If you 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 7 13 for help 4 lf the chart or subroutine is not already paused press the Pause Chart or Pause Subroutine button wj 7 16 ioControl User s Guide
97. 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 11 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 3 C4 af Aly eb rao col rv Z OptoScript Code repeat repeat atTablefnili ni set the table element to be equal ni nl increment the counter until nl 18 break out of the loop every 10 10 20 30 etc ntTable nl n1 until nl 100 wil Results after code is compiled Output p Cancel Help _ Command Hep nzc 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 later errors are often a result of earlier errors To check a ioControl User s Guide 11 27 USING OPTOSCRIPT 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 12 When you have finished with the code in this OptoScript block click OK to sav
98. by an integer 5 3 1 Mixing and Converting Integers and Floats An analog value read from an I O unit and put into an integer is converted from float to integer automatically 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 Logical Commands The following commands perform logical functions Equal AND Bit AND Equal to Numeric Table Element AND Bit AND Not Equal NOT Bit NOT Not Equal to Numeric Table Element NOT Bit NOT Greater OR Bit OR Greater Than or Equal OR Bit OR Greater Than Numeric Table Element XOR Bit XOR Greater Than or Equal to Numeric Table Element XOR Bit XOR Less Bit Off Test Equal Less Than or Equal Bit On Test Not Equal Less Than Numeric Table Element Bit Clear Test Greater Less Than or Equal to Numeric Table Element Bit Set Test Greater or Equal Within Limits Bit Rotate Test Less Variable False Bit Shift Test Less or Equal Variable True Bit Test Test Within Limits Set Variable False Set Variable True Get High Bits of Integer 64 Get Low Bits of Integer 64 Make Integer 64 Move 32 bits Numeric Table Element Bit Clear Numeric Table Element Bit Set Numeric Table Element Bit Test ioControl User s Guide 10 33 PROGRAMMING WITH COMMANDS Understanding Logical Commands For Condition Blocks the Instr
99. can be tricky but they are powerful tools For more information on using pointers see Pointer Commands on page 10 56 For the following examples assume that nl 5 fl 9 2 sl test 123 Set the pointer The types must match or the control engine will generate an error pnil null pn1 amp nl pfl amp f1 psl amp sl pchtl amp Powerup 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 pnl pfl n2 nl fl 11 16 ioControl User s Guide To see if a pointer is pointing to something use the comparison operator see page 11 20 to compare it to null This use is similar to standard ioControl condition commands such as Pointer Equal to NULL For example n2 pn1 null n2 null pnil if pt1 0 null then To move a value from a pointer to another pointer pVariableOd amp pVariablel To move a value from a pointer to a pointer table ptTable 0 amp pVariable4 USING OPTOSCRIPT rs 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 11 23 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 pnl n2 break case 6 Saturday pnl
100. chart or subroutine open its window 2 From the Chart or Subroutine menu select Print Graphics 3 In the standard Windows Print dialog box do one of the following e To print to a printer select the printer page range and number of copies Click OK e To print toa file select Print to file and click OK In the dialog box enter the file name and location Your chart or subroutine is printed 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 To print all charts within a strategy open the strategy and check the page setup For help see Setting Up the Page on page 7 23 2 Select File 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 2 To view all instructions in an entire strategy select File View Print All Chart Instructions NOTE Subroutine instructions are not included
101. 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 s 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 debugging 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 ioControl User s Guide 7 13 WORKING WITH STRATEGIES 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
102. clicking in the chart or choosing another tool from the toolbar ioControl User s Guide 8 9 WORKING WITH FLOWCHARTS Editing Text 1 With the chart open and the strategy in Configure or Online mode click the Select tool 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 CTRLt arrow keys and CTRL HOME or END for navigation You 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 8 13 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 R 2 To select an action OptoScript condition continue or text block click the block Handles appear around the block 3 To select a connection click it Handles appear at the elbows and end points of the connection ae Block 0 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 8 10 ioControl Use
103. command in the oControl Command Reference or online Help IVAL and XVAL All I O points have two associated values XVAL and IVAL If you are using ioControl in Debug mode to manipulate 1 0 values or to disable an I O point or 1 0 unit you need to understand these values XVAL The external value or XVAL is the real or hardware value as seen by the 1 0 unit This value is external to the control engine WAL 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 only when a strategy in the control engine reads or writes to an 1 0 point Do not be concerned if the VAL does not match the XVAL A mismatch just means that the program is not reading from or writing to the 1 0 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 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
104. compatibility 6 4 digital 1 0 units 6 9 G4 B100 B200 serial mistic brains 6 12 SNAP BRS 6 10 SNAP ENET S64 6 8 SNAP UP1 M64 6 8 moving block 8 11 connection line 8 11 files via FTP 10 48 I 0 point 6 25 text block 8 11 to another window or chart 3 15 toolbar 3 13 3 26 toolbar buttons 3 27 multitasking 3 8 4 21 and strings 10 25 must on must off See MOMO N naming block 4 10 8 6 chart 4 10 8 15 ioControl User s Guide o conventions 4 10 11 14 1 0 points 4 11 variables 4 11 11 14 network segmenting control network 5 5 network redundancy 5 6 number converting to string 10 30 numeric literals in OptoScript 11 15 numeric table adding 9 8 as alternative to strings 10 24 numeric variable adding 9 5 in OptoScript 11 16 O offset and gain commands instructions 10 13 10 14 offset definition 10 14 online help 3 30 Online mode avoiding memory problems 3 12 definition 3 12 opening applications from ioControl 3 29 chart 8 14 strategy 7 2 watch window 6 75 operator bitwise in OptoScript 11 21 comparison in OptoScript 11 20 in standard commands AND OR 9 22 logical in OptoScript 11 20 order of precedence F 9 OptoScript bitwise operators 11 21 block example 11 2 block definition 8 3 bookmark 11 28 case statements 11 7 11 23 commands 11 11 E 1 comments F 10 communication handle 10 45 comparison operators 11 20 comparison with other la
105. control engine is communicating See brain and 1 0 module data sheets for specifications and information and see page 6 4 for help configuring I O in ioControl 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 joManager Users 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 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 Programs MS DOS Prom
106. control engine s name for example MyStrategy MyEngine cdf Once the control engine download file is created it can be downloaded using either ioTerminal or a DOS batch file you create ioControl User s Guide 7 9 WORKING WITH STRATEGIES Downloading the cdf File using ioferminal 1 Click the Windows Start menu and choose Programs Opto22 io0Project Software Tools ioTerminal T ioTerminal TST Fie Tools Configure View Help Control Engines Door Control amp UIO_A Number of control engines 2 Right click the name of the control engine you want to download the file to 3 In the pop up menu choose Download In the submenu choose Control Engine Download File x File to Download Browse Cancel 4 Enter the path and filename of the cdf file or click the Browse button and navigate to it When the filename appears in the File to Download field click OK The file is downloaded to the control engine and a dialog box shows its progress Downloading the cdf File Using a DOS Batch File If you do not want your end user to have to use ioTerminal you can create a DOS batch file to launch ioTerminal in the background and download the cdf file In addition to downloading the cdf file the batch file can also run or stop the strategy or even define the control engine on the PC that will download the file iolerminal must be installed on the PC where the batch file is used 7 10 ioControl Us
107. controller or SNAP Ultimate 0 unit running an ioControl 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 10 35 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 1440 the ioManager Users Guide e For the complete memory map see form 1465 the 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 Ultimate I 0 systems 10 52 ioControl User s Guide PROGRAMMING WITH COMMANDS SN l Create two tables for SNAP_UIO_A one for its own data that will be shared A_Shared_Data and another for data it will read from SNAP_UIO_B B_ Data Also create two tables for SNAP_UIO_B one for its own data B_Shared_Data and one for SNAP_UIO_A s data A_ Data SNAP_UIO_A ioControl Tables Suppose SNAP_UIO_A and Memory Map Scratch Pad SNAP_UIO_B are sharing 600 integer A_Shared_Data Indexes 0 599 elements of the 3072 integer elements Integ
108. 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 ioControl User s Guide 11 23 USING OPTOSCRIPT This example results in nVariable equaling 6 nVariable 1 cena The counter starts at zero and its final value is 4 for nCounter 0 to 4 step 1 It will count up one step at a time nVariable nVariable 1 next lt The for loop must end with next The for loop counter can be used in the loop Other step amounts can be used including negative This example sets the first five elements of steps Do not use a zero step which creates an table ntTable to 10 infinite loop This example sets elements 0 2 and 4 for nIndex 0 to 4 step 1 of ntTable to 20 ntTable nIndex 10 for nIndex 0 to 4 step 2 next ntTable nIndex 20 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
109. 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 an ioControl command by adding the subroutine instruction to a block in the chart 1 With the strategy open in Configure mode open the chart that will use the subroutine 2 Double click the block that will call the subroutine If it is an OptoScript Block see Using the OptoScript Editor on page 11 25 for how to enter a command instruction For action or condition blocks continue with step 3 3 In the Instructions dialog box click where you want the instruction to be placed and then click Add 12 10 ioControl User s Guide USING SUBROUTINES Le 4 Prompts 5 6 The Add Instruction dialog box appears Add Instruction i x Instruction Absolute Value Select Comment E o Type Name Of fall Valid Types x Put Result in fal Valid Types oOo Cancel Help Command Heb In the 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 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 Add Instruction E xj Instruction Variable Increase Notificati
110. digital If the rack attached to a SNAP Ethernet based brain accommodates both analog and digital modules the 1 0 unit includes both analog and digital modules In most cases the I O unit you configure in ioControl is the same as the physical 1 0 unit rack brain and I O modules The entire rack of points is configured as one 1 0 unit because that s how the points are addressed by the brain ioControl In two cases however the 1 0 unit in ioControl does not exactly correspond to the physical O unit because these brains address their I O modules in a different way e ASNAP B3000 serial brain addresses up to four groups of 16 points on the largest rack Each group of 16 points must be configured as a separate 0 unit either analog or digital ioControl User s Guide 6 5 WORKING WITH 1 0 Some ioControl commands communicate with all the points on one I O unit at once For more information on these commands see Using 1 0 Unit Commands on page 4 23 e A G4D32RS brick contains the equivalent of two 16 module units and the brain board addresses them separately When you configure it in ioControl notice that it is called a G4D16RS Configure two G4D16RS 1 0 units for each brick Addressing I O Units To configure 1 0 you must know how the brain addresses its 1 0 points The following pages show module and point numbers for the brains listed below IMPORTANT These diagrams show addressing for analog and sta
111. down timer This process starts every 1 5 seconds The starting value for the timer is set in Block 0 Set Down Timer Preset Value Target Value 1 5 Down Timer Process_Timer Modify Start Timer Delete Timer Process_Timer Next Block Eevads a Timer_Example_Chart The condition block checks whether the timer has reached zero If it hasn t the chart loops until it has Down Timer Process_Timer Add Down Timer Expired s Modi When the timer has Puw expired it is restarted and the coe Ce a aa Instructions Timer_Example_Chart Process Timer Expired process begins When the process ends the logic loops back to check Next Block whether the timer BR Biock has expired again Timers can be tricky For additional details see Using Timers on page 10 19 ioControl User s Guide 4 17 DESIGNING YOUR STRATEGY Using a Flag A flag is a way of controlling logical flow within a strategy You can set a flag in one part of the strategy and then test it in another part If the flag is set the logic flows one way if the flag is not set it flows another way For example a flag could be set to indicate that a machine is busy with one process to prevent another process from using the machine at the same time The following chart shows logic for one of the processes that uses the machine If another process has already set the flag this process must wait
112. even a simple if then else statement requires three blocks In OptoScript a single block contains the statement AAAA EE if Oven_Temperature gt 450 then Oven_Alarm 1 7 Set the oven alarm else Oven_Alarm 0 endif 7 Clear the oven alarm P OptoScript is even more useful for more complex conditions such as the following In OptoScript all the condition and action blocks and their commands are consolidated into one block ioControl User s Guide OptoScript Temperature_Control Temperature Control x BEJE ael lezl Alalla DAE OptoScript Code if Temp_Probe gt 80 then Fan_1 1 Turn on fan 1 if Temp_Probe gt 95 then Fan_2 1 Turn on fan 2 too if Temp_Probe gt 105 then Alarm 1 Send alarm temperature too high endif endif else Turn off all fans Fan_1 0 Fan_2 0 endif DelaySec 60 77 Wait 1 min before checking temp again 5 4 gt USING OPTOSCRIPT For Combining Expressions Operators and Conditions The real power of OptoScript can be seen in complex operations S e fe yee Sats ty tute Jn Ua ol la tel Bes an Gg Sane This portion of a sprinkler O control system uses standard Cn ioControl blocks and ch ee ee aN as a e EG Goo e He an commands to control a ee watering of grass and trees zz The OptoScript version of Grass Trees Control handles the See ooo a _ _ loops conditions
113. 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 Experienced programmers especially those who are new to ioControl may be interested in the following notes Variable Database and Other Surprises ioControl maintains a database of all declared variables a notable difference from common procedural languages Variables are not declared in the programming code but in the ioControl tag database This is a basic concept of ioControl and how it ties in with ioDisplay but may seem odd to experienced programmers using ioControl for the first time Also all variables and objects are global Local variables do not exist in ioControl in the way they do in most procedural languages Subroutines in ioControl 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 tha
114. 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 Here s an example of a switch statement The value of the expression in parentheses nNumber is compared to each of the cases If the case matches the value of nNumber the action is taken switch nNumber case 1 fl 10 Make sure you use a colon after each case reak case 2i If a case matches the value of nNumber the break statement after the ae action immediately exits the switch Notice that a semicolon is not used a r after break break You can use a mathematical expression as a case fl 20 break ae If no case matches the default action is taken Using a default is default i i 3 PEI optional if you use it it must be at the end of the list r f2 1 break A switch statement must be followed by endswitch endswitch While Loops 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 loop sets the first five elements elements 0 through 4 of a table ntTable to a value of 10 nindex 0 lt Initialize the counter while nIndex lt 5 lt cM_ Execute loop if condition is tr
115. h E Aa PE button o of Cookies Control Engines Subroutines Included Charts amp Alarms Dough_Chip_Contre Dough_Vessel_Pres paa Oven_Inspection_C amp Powerup Variables Numeric Variables 30 bStartFlag GL dtcookiemotior fang fDoughPressur feani FRampYalue feani FSetpointMinusl 840 nChartStatus 848 nCookieMotiont 848 nLoopCounter String Variables Pointer Variables Communication Ha Numeric Tables String Tables Pointer Tables I O Units Dough_Chip_Control This chart drops the dough and chips on the conveyor belt The belt must be running between 50 and 65 of max rpm The Powerup chart starts this chart This chart runs continuously once the program has been started T Drop the doug 4 Pa ioControl Ready Configure NUM da 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 ioControl User s Guide 2 7 IOCONTROL TUTORIAL 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 x ee File Edit Configure Chart Subroutine Compile Mode Tools View Window Help a x DEH tex A SSE lR
116. iew PID Loop scanning 5 x Name pido Error None Input 79 2753 Gain 15 Scan Rate 3 sec Mode auo 2 Setpoint 79 Tunel 0 05 Scan Counts 112783 Enable comm Fe 4 Output 2 252521 Tune D 0 02 Plot 1 0 Details Misc Details VAL Velocity Algorithm Input 5 etpoint Output 09 00 0 O 0 0 09 44 00 0 09 44 30 0 09 45 00 0 Data Input Axis id Output Axis Time Axis Add Watch Save Tuning Help 4 Set the 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 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 popup 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 6 59 However you can experiment with Scan Rates before tuning the P I and D constants or adjust scan rate after tuning 6 66 ioControl User s Guide WORKING WITH I O as i The lag for this system was determined to be about 2 seconds The left half of the plot reflec
117. 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 ioControl to apply the changes to all new strategies and subroutines in ioControl 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 ioControl Default Properties dialog box it is assumed that the changes are to be applied throughout ioControl 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 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 Action Blocks 2 Right click again in the chart and choose Properties Copy from D
118. 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_l 4 PTBL_My_Ptr_Table TABLE 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 A float integer or float table or timer integer table string string table PTR_ pointer variable PTBL_ pointer table I O point I O unit amp chart 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 practice 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 click th
119. lines line 1 is equivalent to line 3 not to 2 ni n2 n3 n4 ni n2 n3 n4 ni n2 n3 n4 11 18 ioControl User s Guide USING OPTOSCRIPT ee 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 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 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 f1ICTD_Input lt Avg_Temp then Fan_A 0 endif Using Logical Operators All OptoScript logical operators return an Integer 32 value of zero false or of non zero true OptoScript supports the following logical operators for numeric values Oper
120. 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 11 24 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 Chapter 8 Working with Flowcharts Double click the OptoScript block to open the editor ioControl User s Guide USING OPTOSCRIPT Ue Toolbar Type OptoScript code in this area The editor is similar to the editor for Microsoft Visual Basic You can resize the editor window as needed to see the code OptoScript Oven_Control Block 3 x sele ole at aalala mofcojv OptoScript Code See results of test compile in this area Output Column and line Cancel Help Command Help Ln 1 Col 1 e The toolbar includes the following buttons Clear all bookmarks Insert action command Go to previous Increase Cut Paste Redo Replace bookmark indent Insert variable a Test compile Insert condition command Copy Undo Find Go to next Toggle bookmark whitespace Set clear bookmark Decrease indent 2 Begin typing OptoScript code in the top area You ll notice that what you type is au
121. 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 will be changed but will not affect the connection 4 To monitor the variable in a watch window click Add 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 j Add Watch Entry 2 x Name Time_of_D ay m Select Portions To Watch Iv Value Gear r Select Watch Window New Open Cancel Help 5 Check the items you want to watch ioControl User s Guide 9 15 USING VARIABLES AND COMMANDS Items to watch vary depending on the variable type 6 In the Add Watch Entry dialog box do one of the following e Ifthe watch window you want to use to monitor the variable is open choose it from the Select Watch Window drop down list e f the watch window you want is not open click Open Navigate to it and double click it to open it e lf you want to monitor the variable in a new watch window click New For help see Creating a Watch Window on page 6 73 7 When the Add Watch Entry dialog box s
122. nen 11 22 f Statements che stacy nc resem tcbectesecic hv ch scree esoacoetsture odd aca des Do ener hecteeschacedeesersee mentees 11 22 Switch or Case es CNC NI SUING etc attend deuce Peaces ccsSocatonieced danciccdeesedtadeatactse 11 23 While LOOPS eienenn naene eat taarna ea seai ei TEES 11 23 PREG GO esas siesta che deka cud care Sadad oc eeancasanceasccnes ienaenesanauceaaebsueeeaehatascices 11 24 PCO AMI OTR tena nescence caseceu teeta caseaten se nese memes este a tte ctu causa ceadenstaetactaelatas 11 24 Using the OptoScript EIEN cst sc hatd esa odis cis odtcenenzesi bind senstesloacaeiasunsenacta tiveleseeleeiatiaesetavencacss 11 25 Troubleshooting Unable To Find Errors c ccccsescsesestesesseseeteseetesesesseststesnetsseeneseees 11 29 Troubleshooting Syntax edo pe emempeeerre ae nner er eevee eran RTE oR unre GLo ty tm re ereneN rennet 11 29 Debugging Strategies with OptoScript ci ciccicccccsscssccssscsdcescscsnsssacadseseesdexeceneasacennandaaiens 11 30 Chapter 12 Using Subroutines ccscseeceeeesseeeeeeseeneeseeeeeeseeseeensennees 12 1 MtrOdUCHON isina tte or ee reer area encenDD rene nON eet Opp are naen eee Re er ee 12 1 WO UNS AG FIP Me areas See bed a E E 12 1 About SU ONTOS siteon ensite r a a a E aari 12 1 Data Types for Subroutines sss sssssssisssesiseeeietssritisessntinesnttttennrnnnnennnnnnanrntennrnene 12 2 Creating SOMONE Sata nec daa dae teen sacs sc nacla tad alee ach xdesrtaclens ancactaadnancants 12 3 T
123. not logical not parentheses no precedence i 3 brackets no precedence colon no precedence A semi colon no precedence F 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 and ending with an asterisk and a slash 7 This type of comment may span multiple lines Block comments may not be nested F 10 ioControl User s Guide OPTOSCRIPT LANGUAGE REFERENCE Examples i a b determine i by adding a and b together i a b determine i by adding 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 talic type Program gt StatementList StatementList Statement StatementList Statement Statement AssignmentStatement gt StrAssignmentStatement PtrAssignmentStatement ProcedureCommand FunctionCommand ConditionStatement ForStatement WhileStat
124. of related information in the form of a table Instructions Commands ioControl commands or instructions tell the control engine what to do at each step in the flowchart to control 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 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 OptoScript Blocks 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 ioControl strategy Internal values are transferred to external values only when the 1 0 unit is enabled 3 8 ioControl User s Guide WHAT IS IOCONTROL es Multitasking The control engine can run several charts seemingly at once each performing a different task through a time slicing te
125. of their respective companies or organizations ioControl User s Guide Table of Contents Chapter 1 Welcome to ioControl sssieiesisscccccsssscccessesseseniencacsensntcassnureneseses 1 1 TO RUNS MU hi cca waco neve sana case tame eb certo ge teaty ea tt Sct tec cmteaerasbes emia sieeioeeteneee 1 1 Abo t this GU ces sca hace hae casei db aoa ctse epuck EEE 1 1 Document Conventions acess ascdesacinscisciviertncse Qeasiasancastttvahinsdbacianinedstaastatiectvoscieeccelasiatlats 1 3 Other SOUS castica ct aca cba xeaicas he chbe ceastcamsb nce acdaceaathedbe acca Gee oa dnatanlacadbehcidachactseucancacensdnivaste 1 4 Documents and Online TEND ccc asda ciecenistronerdeasedetnraoudaumsnenieeauedaiaded 1 4 Product S UII ONE cas tscanteucctdenat etlseaesiet atcmsaced eatatiecteietaes ted E aa EERE EENE EAER 1 4 Installing ioControl accede scastetendecibustasteusucdsctacterr ach stax ane daedinsded sca actatsadiesss iedesdeneaeiontlactinaant 1 5 System Requirements sedis encsecseciichsedcescsesceidorascanceNaeiechans hstastasaesahrdeelemeiaieslaaedead 1 5 Installation OCU MMOS 2 i cesiotialalesntyeakianictssai cn vardsta acai ie ianasbachaceassaaetsesSeentaoas 1 5 Compatible Control Engines and 1 0 Units oo cece ccseecesceseseetessseseasesesteseeeenees 1 6 Important Note on Disk Drives as cscczcssscoicescsstiiassatdneatace taatsedbestassarieseeaisadsaiamntieca 1 6 Chapter 2 ioControl T utorial sssssssesesesesenenuunununenuununununununnunununene
126. or condition block follow the steps below To add commands to an OptoScript block see OptoScript Functions and Commands on page 11 11 and Using the OptoScript Editor on page 11 25 ioControl User s Guide USING VARIABLES AND COMMANDS 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 Instructions New_Chart Block 1 x Highlighted area Madi Command nel 2 Click Add to open the Add Instruction dialog box The Operator group appears in the dialog box only for condition blocks not for action blocks Add Instruction All Valid Types Button_D3 ha All Valid Types Button D3 ha 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 ioControl User s Guide 9 19 USING VARIABLES AND COMMANDS ee 4 If you don t know the command name click Select to open the following dialog box x Groups Instructions Analog Point Chart Communication Arecosine Control Engine Aresine Digital Point Arctangent Error Handling Clamp Float Table Element High Density Digital Module Clamp Float Variable 1 0 Unit Clamp Integer 32 Table Element 1 0 Unit Event Message Clamp Integer 32
127. output is scaled 0 10 It is connected to a valve that begins to open at 1 25 and is effectively fully open at 5 75 even though it may only be 70 open Set Lower Clamp to 1 2 valve closed and Upper Clamp to 5 75 valve effectively fully open This prevents reset windup potentially resulting in dramatically improved control when the output value has reached either limit and has to suddenly reverse direction Setting the maximum change rate of the output The Max Change Rate can be ignored since it defaults to 100 per scan To limit the output rate of change set Max Change Rate to 10 to start This setting would limit the output rate of change to 100 in 10 scan rate periods Output The output can be preset or changed at any time by an operator or by the program For example if the output should start at 40 whenever the system Is activated simply set the PID output or the analog channel output to this value under program control Manual Mode The factory default causes the setpoint to track the input when the PID is in manual mode which means that the setpoint will be altered when in manual mode If you don t want the setpoint to be altered when in manual mode disable the setpoint track output feature so that when the PID is in manual mode the setpoint will not be changed Input Filtering If the input signal is noisy you may want to filter it To do so follow these steps 1 Use the command Set Analog Filter Weight specifyi
128. prevents the strategy from running continuously unattended on the control engine 2 To close the strategy select File Close Strategy or select File Exit to quit ioControl If dialog boxes ask whether you want to remove breakpoints and take charts out of stepping mode click Yes What s Next Your introduction to ioControl is now complete Using the sample Cookies strategy you have learned how to e Open save and close a strategy e Work with the Strategy Tree e Work with charts and add commands in blocks e Configure a control engine e Compile run step through and add breakpoints to a strategy e Make an online change e Use a watch window to monitor variables and 0 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 2 40 ioControl User s Guide CHAPTER 3 What Is roControl Introduction The tutorial in Chapter 2 introduced you to ioControl without explaining much about it In this chapter we ll learn more about ioControl and see its main windows and toolbars In this Chapter About 10Control ccceceececeeeeeeee 3 1 Windows and Dialog Boxes in ioControl 3 15 General Control Concepts 3 3 Customizing ioControl for Your Needs 3 2
129. program And the instructions can be easily modified when necessary 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 many different hardware components switches pumps tanks valves furnaces conveyors photo eyes thermocouples and so on All the components communicate with the control engine in the controller by way of input output 1 0 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 ioControl User s Guide 3 3 WHAT IS IOCONTROL oe There are two types of 0 points digital and analog e Digital points can be either on or off True or False Push buttons a
130. read is comma delimited Reads the contents of the file status ReceiveStrTable 4 0 Product_Names chAFile Product_Names into a string table Loops through the items in index 0 Product_Names table and while index lt 4 and status 0 places the values they status GetValueFromName Product_Names index Product_Info index j represent into another string index index 1 table Product_Info Note that wend the numbers in the Product_Info table are not true numbers but string representations of numbers Closes communication status CloseCommunication chAFile Changes the value of the SetCommunicationHandleValue file w ProductInfo txt chAFile communication handle it is now set to write to the file Productinfo txt on the control engine Opens the communication status OpenOutgoingCommunication chAFile handle and checks to make if status 0 then sure it opened Makes the Productlnfo txt file SetEndOfMessageTerminator chAFile comma delimited too Writes the data from the status TransmitStrTable 4 0 Product_Info chAFile Product_Info string table into endif the ProductInfo txt file onthe endif control engine 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 a
131. requested that is X X longer than the string it will be put into or the destination string length lt 0 ioControl User s Guide B 3 o Description Possible Cause Q 1 0 4 Device has powered up Powerup clear NOT AN ERROR The device has been turned off and then X expected message received on again since the last communication and is now ready 5 Operation failed An attempt to store the strategy to flash failed or an attempt to do something with a chart failed like call continue suspend start initialize threads 6 Data field error Invalid year entered must be between 2000 and 2099 or X invalid data read from memory when attempting to read the strategy from flash memory 7 Watchdog timeout has occurred See Add 1 0 Unit Dialog Box on page 6 13 8 Invalid data Invalid data read when attempting to read a strategy from flash or an invalid character number was passed to a string function 10 Invalid port number Valid range for Ethernet is 0 65535 For a communication X handle serial port format may be incorrect 11 Could not send data A Transmit or Transfer command fails when using a comm handle For example an attempt is made to send a file to a remote ftp server that has gone off line 12 Invalid table index Used an index greater than the number of elements in the X X table 13 Overflow error Typically a math result too big to fit in the
132. sacselastactncdscssascierstennuetcedeedsanecienacwsctbelsese A 5 Matching ioControl Configuration to the Real World ccccceeseesteseseeeeeeeeesees A 5 Resolving TCP IP Cannot Connect Errors 412 sssrin A 5 Pinging the Control ERG IIE ccs cucescescascxssscsascarcusuecs staectaceateiexSekdseacacehegscmuadhecadhacedees A 5 Other Troubleshooting Tools wscjcccasceicnccbtcrsas sed cadcaesaiscscassetsucdanisacd scasessansisstaceasend ebdaadeearbeabals A 7 Checking Detailed Communication Information Using ioMessage Viewev A 7 Checking File Versions for Opto 22 Software ou cesceccccecesceestesestesesteseetsseetesesteseseees A 8 Problems with Permissions in Windows 2000 c cccccscescsesestesestesesteseeteseetesesneees A 9 Appendix B ioControl Errors and Messages scessseeeeesereeenennees B 1 NOON CN M senna anin a N a R B 1 TYPES Of ENO S annia E eee A B 1 OCONUONENO S irem e a E E A E B 1 Queue Messages siissiisssiisssisssiisssiisssiisssissnistnrintnritnniknintnnittnnintnrinanritnrrntnn reta B 2 Using Queue Messages icasensecsestestesierned ais cancataeisttduracdnesaerssiectd cas chcusdncduabnachecsaeste B 3 xvi ioControl User s Guide HULLS hc ehaihehn neocon slant cha access a B 3 List of Common hes sts16 serene cre ete ee te toner Seon Ore pray ete rere ee ee neer Hee B 3 Appendix C ioControl Files scisscseccssiessscscsecscasensecsnsansesestsncacasancesaasceasncneaie C 1 Introduction Sgn exch ute
133. several times while the 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 0 points ee e Level_Meter is an analog Input Point that registers Level _o the quantity of water in the tank Meter a Pump_1 e Pump_1 is a digital Output Point that turns the pump on or off e Drain_1 is a digital output point that opens or closes the drain Drain_1 Next you configure variables as places to hold information that these I 0 points must work with e To avoid 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 itera s 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 t
134. stop a bad cookie open reject B doDoughPressureCont valve for 0 5 second G2 doDoughDispenseValy 0 doChipDispensevalve O doRejectValve ied aoOvenTemperaturec ofl 4 J Ody o aoConveyorSpeedCor Ruia 5 g tep On Break On 2 034 Sec 100 brad aiOvenTemperature brad aiDoughYesselPressur a gt j Dough_Chip_Control Cookie Watch E 2 Name type va va 5 nCookie Counter Integer 32 Variable 73 diInspectionPassFailSwitch Digital Input E OFF On Latch OFF i Off Latch OFF OFF xl Coriri Rea ZN eZ On latch reset to Off Counter decreased by one 19 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 20 Click the Dough_Chip_Control chart tab Click the Pause 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 ioControl User s Guide 2 39 IOCONTROL TUTORIAL 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 When you re ready to stop click the Stop button in the toolbar This action
135. strategy that is currently resident in the control engine will be REPLACED by this strategy Continue download Yes No Hep Or you may see a message that the control engine s memory has been cleared 4 Click Yes to proceed Two additional dialog boxes appear briefly The first displays the progress as the strategy is compiled The second shows progress as the strategy is downloaded to the control engine Download Progress 5 ETENCTNAAERE Percent Complete l 49 9 Time Elapsed sec fi Assuming the strategy was compiled and downloaded successfully you are now in Debug mode 2 20 ioControl User s Guide IOCONTROL TUTORIAL CE Ee In the ioControl 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 JioControl Dough_Chip_Control 5 y iol x E File Edit Control Engine Debug Chart Subroutine Mode Tools View Watch Window Help la x Debug toolbar buitoris EARLE DRA HAR je Se B Mi sO b or Ale oh dh E Cookies ojx E Cookies a x Fy i Control Engines This chart drops the dough and chips on the conveyor belt g Cookie Controller The belt must be running between 50 and 65 of max rpm
136. support event reactions they are the only units listed 4 Highlight an unused line and click Add or double click an unused line The Add Event Reaction dialog box appears xi A Name l B Description C Sean on Run Yes C No D r Event Type Watchdog Timeout zi This figure shows the fields in the dialog box when you first open it Depending on the type of event or reaction you select other fields may appear E Reaction Type None S YS F Enable communication Cancel Help 5 Complete the fields as described in Add Event Reaction Dialog Box below 6 Click OK The event reaction appears in the Configure Event Reaction dialog box Add Event Reaction Dialog Box A Name Enter a name for the event reaction 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 event reaction C Scan on Run If you want the 1 0 unit to begin scanning for the event automatically as soon as the strategy is run click Yes If you want scanning to wait until it is started by a command in the strategy click No D Event Type From the drop down list select an event to scan for Complete additional fields that appear as described in the following tables ioControl User s Guide 6 43 WORKING WITH 1 0 D For digital 1 0 units For th
137. that you read or write the correct type of data integer float string to match the specified memory map 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 1 0 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 ioControl User s Guide 10 55 PROGRAMMING WITH COMMANDS Error Handling Commands The following commands refer to handling errors Error Error on I O Unit Copy Current Error to String Remove Current Error and Point to Next Error Clear All Errors Caused a Chart Error Caused an 1 0 Unit Error Add User Error to Queue Add User 1 0 Unit Error to Queue Add Message to Queue Get Error Count Get Error Code of Current Error Get Severity of Current Error Get ID of Block Causing Current Error Get Line Causing Current Error Get Name of Chart Causing Current Error Get Name of 0 Unit Causing Current Error Disable 0 Unit Causing Current Error Enable 1 0 Unit Causing Current Error Stop Chart on Error Suspend Chart on Error All good programmers must deal with errors These e
138. 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 e Faster scan rates may be necessary to achieve the desired response When scan intervals are shorter than the system lag tuning must compensate for any over correction from the controller output Tuning a PID Loop Ethernet NOTE This section applies to SNAP Ethernet and SNAP Ultimate 1 0 units only For information on tuning PID loops on serial based mistic I O units see PID Mistic Commands on page 10 62 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 1410 PID Configuration and Tuning SNAP Ultimate O 6 64 ioControl User s Guide WORKING WITH I O Ue Learning Center Supplement for more detailed information Form 1410 is available for download from our Web site 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 An
139. the Configure PID Loops dialog box 6 When you have finished configuring PIDs click Close PIDs appear in the Strategy Tree under the 0 unit Add PID Loop Dialog Box 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 Input Select the type of input 1 0 Point Host or PID Output e If the PID s process variable comes from an 0 point on the same unit select I O Point Choose the point from the dropdown list or type a point name to configure a new point ioControl User s Guide WORKING WITH 1 0 rs e fthe PID s process variable comes from the ioControl 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 dropdown list D Square Root Optional If you chose 1 0 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 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
140. 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 as shown below StartChart Fan_Control OptoScript Data Types and Variables Unlike most procedural languages ioControl maintains a database of all declared variables which is shared with ioDisplay Variables are not declared in OptoScript code but are created declared within ioControl See Chapter 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 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 ioControl 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 example a variable named Month might be either a string or an integer An easy way to avoid this confusion is to use Hungarian notation that is to place letters indicating variable type at the beginning of the name For example sMonth would indicate a ioControl User s Guide 11 13 USING OPTOSCRIPT S A string nMonth would indicate an integer The following table shows suggested notat
141. 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 5 12 ioControl User s Guide 6 77 WORKING WITH 1 0 6 78 ioControl User s Guide CHAPTER 7 Working with Strategies Introduction A strategy is the software program you create in ioControl 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 step reference for working with strategies in all three strategy modes Configure Debug and Online In this Chapter Creating a New Strategy 7 1 Running a Strategy Manually 7 12 Opening a Strategy ccc FL Debugging rca scacarassscoccscnscensesdaasbacaseasinazasansene 7 13 Saving and Closing accccrccsccrnesncsnecsseicessss 7 3 Viewing and Printing 7 20 Saving a Strategy to Flash wee 7 4 Searching and Replacing c cceeeeceees 7 29 Compiling and Downloading 0 7 6 Creating a New Strategy Each ioControl Strategy must be located in i
142. the other fields If scanning resumes before you click Apply any changes you made are lost 3 To stop run or suspend a chart click an arrow in the Status field to select the option Click Apply 4 To turn pausing on or off click an arrow in the Mode field to select Step On or Step Off Click Apply 5 To observe 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 6 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 7 22 ioControl User s Guide WORKING WITH STRATEGIES See Using Watch Windows for Monitoring on page 6 73 for more information on watch windows 7 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
143. 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 ioControl 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 name but a different table length are noted in a log file that appears when the paste is complete Deleting Elements 1 Make sure the chart is open and the strategy is in Configure or Online mode 2 Click the Select tool Click the element s to select them CAUTION Make sure you have selected the element you want You cannot undo a deletion 3 Press DELETE You can also select the elements right click them and select Delete from the pop up menu Block 0 cannot be deleted 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 8 3 Start with the chart open and the strategy in Configure or Online mode 8 12 ioControl User s Guide WORKING WITH FLOWCHARTS Resizing Blocks or Text Blocks 1 Click the Select tool ik and click the block to select it
144. the same summary for a subroutine open the subroutine window and select Subroutine View Print Database 7 26 ioControl User s Guide WORKING WITH STRATEGIES rs The View Print Database dialog box appears View Print Database x m Include M Numeric s M String Variables IV Pointer Variables V Communication Handles IV Numeric Tables V String Tables IV Pointer Tables I 120 Units amp Points I Descriptions Cancel Help 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 ioControl processes the database and puts the data in the Database window Save_ Search walala Print Sprinkler_Control Database Jol x TITLE Strategy Database STRATEGY Sprinkler_Control DATE 08 21 01 TIME 12 49 44 Day_of_the Week Packer Busy Status Sum Timer NAME UIO_East NUMERIC VARIABLES INT INT INT 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 ioControl User s Guide 7 27 7 28 WORKING WITH STRATEGIES strategy commands are shown plus other information depending on the element type The figure above shows numeric var
145. the vessel Our control engine a SNAP Ultimate 1 0 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 Inspection 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 D 2 ioControl User s Guide as i Required Emergency Stops Wired
146. time axis if necessary by clicking the Time Axis and choosing from the popup 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 ioControl User s Guide WORKING WITH I O 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 TemperatureControl Yiew PID Loop scanning Name TemperatureControl Error None Sa meee ee little Input 77 32614 Gain 5 Scan Rate ft sec Mode Manual i change in the Input value Z which is shown numerically Setpoint 90 Tunel f0 Scan Counts 249642 Enable comm Fes and graphically Output 30 Tune D f0 i Plot 1 0 Details Misc Details IvAL Velocity Algorithm l 100 Reset Scale Tracking view 200 Span view 100 Span view 50 Span View 25 Span View 10 Span View 1 Span Center on Input Adjust resolution of the Input 5 are v Center on Setpoint Time Axis Axis by clicking the Input ue ey Close Apply Add Watch Save Tuning Help 7 Increase the resolution of t
147. to and received from a serial device In the diagram on page 3 2 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 one 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 3 4 ioControl User s Guide WHAT IS IOCONTROL rs Key Features See the following topics for some of ioControl key features e Copying 1 0 Configurations on page 6 3 A configuration file allows you to copy an I O configuration from one strategy to another Or using ioManager you can send the configuration to multiple I O units at the same time e Using Network Segmenting in ioControl on page 5 5 Using the two independent Ethernet network interfaces on a SNAP PAC controller you can segment the control network from the company network e Using Ethernet Link Redundancy in ioControl on page 5 6 ioControl Pro only If you are using SNAP PAC controllers and ioControl Professional you can use Ethernet link redundancy to set up alternate network links e Configuring Event Reactions on page 6 42 ioControl Pro only For seria based mistic I O units you can configure specific reactions to events when they occur e Persistent Data on page 9 4 You can configure the data in most variables to be persistent The variable s valu
148. to use with communication handle comm handles in Read mode file comm handles in Write or Append mode Open Outgoing Communication Receive Numeric Table Transmit Character Communication Open Receive Pointer Table Transfer N Characters Send Communication Handle Command Receive String Transmit NewLine delete getpos or setpos Receive String Table Transmit Numeric Table Set Communication Handle Value Send Communication Handle Transmit Pointer Table Set End of Message Terminator Command fina Transmit String Get Available File Space Transmit String Table Get Number of Characters Waiting Close Communication 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 ioControl User s Guide 10 43 PROGRAMMING WITH COMMANDS 1 Use Open Outgoing Communication to open a file communication handle The value of the handle would be file w Company Data Products txt 2 Use the 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
149. ts Delete Nev Block ee ee Re ee ee ee ee te es A oG Previous Block fio Close Help Be Once the counter is started you can read its value at any time by using the command Get Counter If you want the counter to start over when you read its value for example to count the number of widgets in each 24 hour period use the command Get amp Clear Counter 4 14 ioControl User s Guide DESIGNING YOUR STRATEGY 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 s part of a chart showing how you would use a count variable in this way Shipping_Area OL x as a ga ay age es Instructions Shipping Area Set count to 1 Ea 1 a oe er ee Bag_Count Modi ee e h l l l Delete S D a Next Block Instructions Shipping_Area Increase count by 1 x Increment Variable Add Bag_Count J Hadif OO i Dee O C M O oo Next Block og a Erevious Block _ oe amp woe e lt r iia Oe Is Bag_Count gt To 12 Modity Delete 100 a _ ___ __ m M Next Block Previous Block Operator AND Command Help Cc OR If you are an experienced programmer you ll notice
150. value brackets is the character s index For example the following two statements are Note that the index starts with the equivalent number zero The following code would result in sGreeting equaling Hello sStringl Chr A sGreeting Hello sStringl Chr 65 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 Clear a string using empty quotation marks sstringlL ioControl User s Guide 11 15 USING OPTOSCRIPT The operator is used to paste strings together There is no limit to the number of operators you can use on a line The operator must be used in an assignment statement sStringl Hello sString2 world sString3 After the thr lines above the following two lines would produce the same result sString4 sStringl sString2 sString3 sString4 sStringl world sString3 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 s 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 Pointers
151. value passed X while doing number conversion functions such as converting 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 bit integer a floating point value to an unsigned 64 bit integer an ASCII value to a float 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 minutes 0 59 seconds 0 59 Number entered on host port for example through ioTerm was too big for data types 14 Invalid number Math resulted in an invalid number like infinity or an X imaginary 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 X 16 Bus error Contact Product Support See page 1 4 17 Port already locked on ioControl engine Attempted to lock a connection that s already locked X 20 Device busy May be in use by another user A resource is already acquired by another task or process X or another application 21 Had to relock host port in QUIT Host port needed relocking B 4 ioControl User s Guide Ue
152. 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 Click the Open Watch Window icon EA on the toolbar or choose Watch 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 ioControl User s Guide 6 75 WORKING WITH 1 0 So Working in Watch Windows Watch windows are flexible You can dock the window where you want it in the ioControl main window You can also move delete and inspect elements in the window e To dock the watch window click the docking icon ol in its title bar The window moves to its own frame JioControl Oven_Inspection_Control E jol x E File Edit Control Engine Debug Chart Subroutine Mode Tools View Watch Window Help l x Ke CECA SECT Rm Oo Al aS a gt a n APE Y amp te or AS oh dh Cookies __ axi Cookies werup chart starts Control Engines art Subroutines Included c Charts variables 7 Numeric Variables While conveyo String Variables is out of spec Pointer Variables temperature toi degrees l El Communication Handles Numeric Tables String Tables Poi
153. 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 ioControl User s Guide 6 73 WORKING WITH 1 0 The empty watch window appears oe Watch 2 Of OF x Type rvar va 3 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 1 0 units digital and Analog Points PID loops variables 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 oe Watch 2 ol ioj x 6 74 ioControl User s Guide WORKING WITH 1 0 CE Ee For some elements the Add Watch Entry dialog box appears so you can specify what to watch Add Watch Entry AES Name Digital_Control Select Portions To Watch Items in this area vary depending on the element you are watching This example shows a chart Select All Clear M Breakpoints IV Block Paused At Select Watch Window Hew Open Cancel Help 4 Ifan 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
154. 0 Configuring a Control Engine 2 17 Opening the Strategy A strategy is a complete control program developed in ioControl Our sample strategy controls a cookie factory Appendix C describes the sample strategy in detail but for now let s just open and explore it 1 Start ioControl by clicking the Start button and selecting Programs Opto 22 i0Project Software ioControl ioControl User s Guide 2 1 IOCONTROL TUTORIAL The ioControl main window opens 5 x JioControl File Edit Configure Chart Subroutine Tools View Help Oe l sex e OSG kK maeorvaAl ae CGH SBPA A gt HRY olor R S S He ioControl Ready 2 Click the Open Strategy button lon the toolbar or choose File Open Strategy 3 In the Open Strategy dialog box navigate to ioControl Examples 4 In the Examples directory double click the ioCookies subdirectory to open it The strategy file Cookies idb appears Open Strategy 2 x Look in E ioCookies e E A Cookies idb Files of type ioControl Strategy Files idb 7 Cancel h 5 Double click the Cookies idb file to open it 2 2 ioControl User s Guide IOCONTROL TUTORIAL a i The Cookies strategy opens and the ioControl window now shows the Cookies strategy yours may look somewhat different JioControl Ee EA Fie Edit Configure Chart Subroutine Compile Mode Tools View Window Help OSeE tex A OSG kK maeor sAl as 889 R gt
155. 0 Port 2o Retries fs Timeout msec joo x e 6 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 7 Enter the control engine s IP address On a hardware control engine such as a SNAP PAC or SNAP LCE controller or a SNAP Ultimate brain the IP address assigned to the device 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 1440 the oManager User s Guide for configuration instructions Pro NOTE In ioControl Professional a 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 ioControl on page 5 6 8 Make sure that you have not changed the values in the Port Retries and Timeout fields and then click OK 2 18 ioControl User s Guide IOCONTROL TUTORIAL The newly configured control engine appears in the Select Control Engine dialog box Select Control Engine x Configured Control Engines Cookie Controller 9 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 Configure Control Engines x Active Eng
156. 0 19 PROGRAMMING WITH COMMANDS 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 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 Note 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
157. 0 Points dialog box and the point has been moved Copying a Configured 1 0 Point If you have several points that are the same you can copy a configured point e to fill empty points on the same module e to fill all empty points on the 1 0 unit e to another other point on the same or a different 1 0 unit 6 26 ioControl User s Guide WORKING WITH 1 0 Le 1 With the strategy open in Configure mode double click the 1 0 Units folder on the Strategy Tree to open the Configure 0 Points dialog box 2 Click Expand All so you can see the points Configure 1 0 Points 170 Unit uIo_A Type SNAP Mixed Ultimate 1 0 Modules and Points Features Subty 4 Add Et 00 SNAF IDC5D 2 5 28 VDC Digital Input Modify it Te 00 DO_Switch Counter Modi 01 Not Used Delete 02 Not Used 03 Not Used E i 01 SNAFP DDC5SRC 5 60 VDC Source Digital Output 9 04 Alarm 9 05 Not Used 9 06 Not Use 07 Not 3 Highlight the point you want to copy and click the Copy To button From the popup 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 Configure I O Points Ble x 140 Unit uIo_A Type SNAP Mixed Ultimate 1 0 Modules and Points a Add G Cd 00 SNAP IDCS5D 2 5 28 VDC Digital Input Modify Original point
158. 000001 00111010 31 16 00000000 00000000 15 0 00000001 00111010 Binary view All the bits cannot be shown at once Value Bits Here you can see all the bits shown in bytes so masks are easy to understand Click on a line to see its place in the string Apply Add Watch Hep e To view integers and integer tables in hex view click the Hex Integer Display button on the toolbar t or choose View Hex Integer Display Here s how the integers appear in hex amx Hex view The 0x before cokie_ Countess a xl Name Cookie_Counter the number indicates that the numberisinihet Type Integer 32 Variable Initialized On Run Apply Add Watch Help e To return to decimal view click the toolbar button again or choose the same item again from the View menu 3 24 ioControl User s Guide WHAT IS IOCONTROL rs 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 String_ ariable scanning Sle x Name String Variable Type String Variable 127 max length Initialized On Download Value Item price Bytes 73 116 101 109 Item 32 112 114 105 pri 99 101 32 61 ce 32 Apply Add Watch Hep N O bO H To change to hex notation click the Hex String Display button on the toolbar ist or choose View Hex String Display Here s how the string appe
159. 1 Choose View Toolbars 2 In the Customize dialog box make sure the Toolbars tab is open Customize Toolbars tab Basic 800x600 Noalber rene 3 Click New Enter a name for the custom toolbar and click OK A small box appears in the upper left corner of the main window You build your custom toolbar by placing the buttons you want in this box 4 In the Customize dialog box click the Commands tab Customize Commands tab 3 28 ioControl User s Guide WHAT IS IOCONTROL Ue 5 In the Categories list click the name of the standard toolbar that contains the button you want to place in the custom toolbar The buttons in that toolbar appear in the Buttons area 6 Click the button you want and drag it to its place in the small gray box Repeat until you have all the buttons you want in the custom toolbar 7 When you have finished building the custom toolbar click it to outline it and drag it into position in the ioControl main window 8 When you have finished customizing toolbars click OK in the Customize dialog box Setting Up Applications to Launch from ioControl You may find it useful to launch other software applications directly from ioControl For example you may want to launch ioDisplay Notepad or the Calculator from ioControl You can set up ioControl so that these applications appear in the Tools menu NOTE If you launch an application from within ioControl when that
160. 1 3 WELCOME TO IOCONTROL Other Resources Documents and Online Help To help you understand and use ioControl systems the following resources are provided e Online Help is available in ioControl and in most of the utility applications To open online Help choose HelpContents and Index in any screen e joControl User s Guide shows how to install and use ioControl e joControl Command Reference contains detailed information about each command instruction available in ioControl e A quick reference card located in the front pocket of the soControl Command Reference lists all ioControl commands plus their OptoScript code equivalents and arguments e joManager User s Guide and other guides provided with specific hardware help you install configure and use controllers and I O units Online versions Adobe Acrobat format of ioControl 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 ioControl To view a document select Help Manuals and then choose a document from the submenu When you purchase ioControl Professional or ioProject Professional you also receive a complete set of printed documents Resources are also available on the Opto 22 Web site at www opto22 com You can conveniently access the Web site using the Help menu in ioControl Select Help Opto 22 on the Web and then select an online resource from the submenu
161. 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 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 see the brain s and module s data sheets for specifications Before using a counter you must configure the point as a counter See Adding a Digital 1 0 Point on page 6 16 or use ioManager The counter begins counting as soon as it is configured You do not need to use the Start Counter command to start it ioControl User s Guide 10 3 PROGRAMMING WITH COMMANDS Quadrature Counters Quadrature counters require a special module and configuration but once they are configured you use the same commands such as Start Counter and Clear Counter for them as for regular counters Be
162. 2 59 62 Serial Device SNAP SCM port 22507 Communication Handle value top 10 192 59 62 22507 Using Flowcharts to Control TCP IP Communication When a control engine is communicating with another device using TCP IP it runs an ioControl flowchart or charts to control communication For outgoing communication the flowchart uses the command Open Outgoing Communication to request a connection For incoming communication 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 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 ioControl User s Guide 10 39 PROGRAMMING WITH COMMANDS As a simple example the flowchart at iolxi 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 Ultimate 1 0 unit Communication with serial modules is done via TCP IP It can be done from the SNAP Ultimate I O system itself as in this example or from another TCP IP device on the network In this example the Ultimate 0 unit listens for and accepts communication from the serial module using the communication handle t
163. 2 T114351 zip Archive on download Path Filename Download D02282002 T 114351 zip Archive when downloading from online mode Path Filename Online D02282002 T114351 zip The date stamp D is in the format mm dd yyyy In the examples above the date is February 28 2002 The time stamp T is in the format hh mm ss In the examples above the time is 51 seconds past 11 43 A M Archiving to the Control Engine When you archive a Strategy to the control engine you are placing the zipped file in battery backed RAM If power to the control engine is lost the archive is still there 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 Make sure there is sufficient memory in the control engine for the archive file Battery backed RAM holds 256KB total in addition to the archived strategy it stores persistent variables and variables that are initialized on strategy download Steps for archiving to the control engine are on page 5 17 Compiling and Downloading 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 eng
164. 4 gt ON a 32 B3000 BASE 0 k pi 11 10 3 8 pr CIGITAL ANALOG oe Ls u E a Sle 4 ss 2 j o maa n C7 e anatos aporess r 4 BASE 2 Mi 3 2 1 i H DIGITAL ANALOSG 4 9 3 Y DIGITAL ADDRESS L7 6 6 4 es a 40 BASE 1 F 1 11 10 3 8 H CIGITAL ANALOG A 13 12 NOTE On the B3000 analog S 6 as n po ammmon a t modules can be placed in any M me 0 ae woe L ANALOG ONLY J position standard digital modules r 3 ale o i wo 3 2 can be placed in positions 0 7 only pausing anes 4 Li L ANALOG ONLY J A nh L 4 The SNAP BRS brain uses digital oe ey TF ete modules only on an 8 module rack panies oniy 4 ane Note E ion a a al SNAP serial and high density Base Address set by gt MONIN Mon TEET digital modules cannot be used jumpers on brain board p 259S 0N 4 with these brains t A 3 n S ANALOG ONLY a 15 14 Non SNAP Serial Based mistic I O Units Brain boards Racks G4D16R G4D32RS Bricks brain is built into rack G4A8R B100 PB16 B200 G4PB16 PB16A Because non SNAP serial based brain boards generally have a maximum of 16 modules on the rack and each module has only one point addressing points is simple Point numbers correspond to module positions on the rack 0 15 except for the following e f you are using Quad Pak modules each module contains four points module position zero contains points 0 3 module position one contains points 4 7
165. 4 ioControl Terminology cccceeeeeee 3 5 Online PN ices ce sccacicescenccescooscexsccecsecdeenterdccseeteace 3 30 ioControl Main Window 004 3 11 About ioControl ioControl is a programming language based on flowcharts Whether you have ioControl Basic or ioControl Professional you use ioControl 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 ioControl 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 1 0 points on the subordinate SNAP Ethernet and SNAP Simple 1 0 units monitor and control the analog digital and serial devices connected to them All these terms are defined in the following pages ioControl User s Guide 3 1 WHAT IS IOCONTROL Control System Example ioDisplay Viewing Trending ioControl Alarming Programming Debugging SNAP Ethernet 1 0 unit SNAP PAC S series controller Runs strategy controls all 1 0 alog output lt p D 5 p Furnace Temperature w Thermocouple s SNAP Ethernet Analog input 1 0 unit a gt Pump On or Off Digital output SNAP
166. 5 Click OK The command appears in the OptoScript code 6 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 Insert Variable button w f in the toolbar Select Variable xi Name Cancel Help 7 From the Type drop down list in the Select Variable dialog box choose the type of item you want to use From the Name drop down list choose the item Click OK 11 26 ioControl User s Guide USING OPTOSCRIPT a i The item appears in the code 8 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 9 Enter comments to document what the code does so anyone who must debug or maintain 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 slash 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 10 Use the Bookmark buttons in the toolbar as needed to set or clear temporary bookmarks within the code and to move
167. 59 45 on port 22004 Communication Handle value tcp 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 module s port number according to its position on the rack For port number information see Opto 22 form 1191 the SNAP Serial Communication Module Users Guide 10 38 ioControl User s Guide PROGRAMMING WITH 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 Ultimate 1 0 brain and the second showing communication through a module on a different rack To a Serial Module on the Same Rack SNAP Ultimate 1 0 IP address 10 192 59 45 Serial Device SNAP SCM For a serial module on the same rack port 22507 use the loopback IP address 127 0 0 1 which tells the brain to talk to its own rack You can also use the brain s own IP Sate address in this example 10 192 59 45 but the loopback address allows you to Communication Handle value top 127 0 0 1 22507 Aa ie IP ia of it brain of tcep 10 192 59 45 22507 without having to change tie communication handle To a Serial Module on a Different Rack SNAP Ultimate 1 0 SNAP Ethernet 1 0 IP address 10 192 59 45 IP address 10 19
168. 6 15 Eror Cannot divide by zero Temperature Control Variable Increase Notification 1 2 full 13 06 01 09 17 04 xl 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 oControl 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 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 If an ioControl 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 lt system gt Messages 1 and 2 occurred when the strategy w
169. 6 OptoScript 11 2 selecting 8 10 ioControl User s Guide Index 1 stepping through 7 15 BOM 7 29 bookmark 11 28 breakpoints in a chart 7 18 C calling a subroutine 12 10 case statement 11 7 11 23 programming example 4 16 changing active control engine 5 11 analog 0 while strategy is running 6 54 baud rate for serial I O units 6 14 block color or size 8 3 8 12 chart background 8 3 chart name or description 8 15 column width in a dialog box 3 22 command instruction 9 23 connection line color or size 8 12 control engine definition 5 10 debug level 7 13 debugger speed 7 14 digital I O while strategy is running 6 53 event reaction 6 50 1 0 points 6 29 I O unit configuration 6 16 I O while strategy is running 6 51 numeric variable 9 14 PID loop 6 40 pointer table 9 17 pointer variable 9 16 scale of a chart 3 20 strategy download compression 7 11 string table 9 16 string variable 9 14 text color or size 8 3 8 12 text in chart 8 10 variable 9 13 chart adding text to 8 9 auto stepping 7 15 7 17 breakpoints 7 18 calling a subroutine 12 10 changing background 8 3 changing name or description 8 15 changing scale 3 20 Index 2 ioControl User s Guide closing 8 14 commands 10 17 contents 8 2 copying 8 14 creating 8 1 definition 3 7 deleting 8 16 designing 4 6 exporting 8 17 finding a block 3 21 flow through logic 4 9 guidelines for design 4 9 impor
170. 6 ioControl User s Guide Index A action block definition 8 2 action command definition 3 8 adding analog point 6 21 command 9 18 in OptoScript 11 27 digital point 6 16 event reaction 6 42 1 0 unit 6 12 mistic PID loop 6 34 PID loop 6 30 pointer variable to watch window 9 16 table variable 9 8 table variable to watch window 9 16 9 17 text to chart 8 9 variable 9 5 variable to watch window 9 14 alarm enunciation 10 23 algorithms for PID loops 10 60 analog adding 1 0 point 6 21 biasing 10 23 changing 1 0 while strategy is running 6 54 copying I O point 6 26 O unit commands 10 15 minimum maximum value 10 13 10 14 offset and gain commands instructions 10 13 10 14 point commands 10 13 11 12 point definition 3 4 totalizer 10 14 TPO 10 13 applications launching from ioControl 3 29 archiving strategies restoring archives 5 18 to computer 7 5 to the control engine 5 17 7 6 argument 4 7 9 21 in OptoScript 11 13 ASCII decimal and hex values of characters 10 31 auto stepping through a chart 7 15 7 17 automation 3 3 autorun 7 12 B batch file 7 10 baud rate for serial O units 6 14 bill of materials 7 29 bit commands 10 33 bitwise operator in OptoScript 11 21 block block 0 8 2 changing color or size 8 3 8 12 connecting blocks 8 7 definition 8 2 deleting 8 12 drawing 8 6 finding in a chart 3 21 guidelines for use 4 10 moving 8 11 naming 4 10 8
171. 8 1 WORKING WITH FLOWCHARTS 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 OF x 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 Center on Block and choose the block you want to see in the middle of the screen For information on splitting and zooming chart windows see page 3 18 Working with Chart Elements 8 2 What s In a Chart Charts can contain four 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 on See Chapter ioControl User s Guide WORKING WITH FLOWCHARTS 9 Using Variables and Commands for more information Action blocks can have more than one entr
172. 89 Tune D 10 Plot 1 0 Details Misc Details IvAL ISA Algorithm 90 50 90 00 Output 12 1 0 0 0 Data v Input Axis Output Axis Time Axis Close pp Add Watch Save Tuning Help 11 Click Save Tuning to save your tuning parameters to the strategy database ioControl User s Guide WORKING WITH 1 0 rs 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 ioControl AN 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 0 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 ioControl strategy Remember to save PID parameters to the 1 0 unit s flash memory too see Inspecting 1 0 Units on page 6 52 Inspecting a PID Loop mistic ioControl This section applies to serial mistic 1 0 units only For SNAP Ethernet and SNAP Ultimate 1 0 units see page 6 58 You can review a PID loop s data modify its status or set its Internal Values or External Values in Deb
173. A 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 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 Totalizers Analog totalizers are available on mistic 1 0 units only Analog totalizers are used to track total volume or quantity For example if an Analog Point measures gallons per minute you could use an analog totalizer to determine the total number of gallons moved over a period of time 10 14 ioControl User s Guide PROGRAMMING WITH COMMANDS To read the value and leave the totalizer running use the command Get Analog Totalizer Value To read the va
174. ADV 27 10 10 VDC Se Module E Scaling D Full Range Clamping Actual Scaled Units voc voc voc voc Lower jio Upper fio Clear Default G Default No C Yes H Watchdog No Yes F Enable Cancel Help 9 Complete the fields as described in Add Analog Point Dialog Box below 10 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 6 26 Add Analog Point Dialog Box 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 ioControl User s Guide 6 23 WORKING WITH 1 0 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 emp
175. AL 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 Minimize button fp _ Maxiniize button ojx IVAL jo VAL 61 44073 2 To change the value or to view more information click the Maximize button The title bar shows the name of the analog point and whether scanning is occurring PID_Input scanning 4 iol xj Name PID_Input Type Analog Input SNAP AICTD ICTD Temp Probe Default No Zero Scale 40 Full Scale 150 Units Scope Strategy Global Error None B A ial fo xvAL 60 57779 Enable comm S4 C Apply Add Watch Hep 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 3 Change the fields as necessary A IVAL The point s current internal value You can change it to any value within the valid range of the 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 Afte
176. Add Watch Entry dialog box click OK Close the nCookie_Counter view variable dialog box The new watch window looks something like this Watch window Docking icon JioControl Cookie Watch Go File Edit Control Engine Debug Chart Subroutine Modd Tools View Watch Window Help l x Deh sex A SSH RmGeo Al H A 2H slo gt le hme ole r S om che CE E Cookies Control Engines f 4 Cookie Controller Subroutines Included S Charts Alarms amp Dough_Chip_Control amp Dough_Vessel_Press El amp Oven_Inspection_Cc ie Powerup B Variables Numeric Variables e30 bStartFlag dtCookieMotionT 3 14 FDoughPressure 3 4 FRamp alue 3 4 FSetpointMinusD 83 nChartStatus 842 nCookie_Counte 842 nCookieMotionPr 833 nLoopCounter String Variables Pointer Variables Communication Hand ee of E Oven Inspection Control Dough_Chip_Control es Cookie Watch ioControl Ready I I Debug Num A nCookie Counter Integer 32 Variable 74 w 2 34 ioControl User s Guide IOCONTROL TUTORIAL aa M 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 7 In the watch window click the docking button J in the upper right corner The watch window moves to the bottom of the main window JioControl Dough_Chip_Con
177. And if you ve tried everything and it still doesn t work contact Opto 22 Product Support See page 1 4 ioControl User s Guide DESIGNING YOUR STRATEGY 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 ioControl 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 ioControl strategy a Powerup chart is automatically included You add all the other charts you need and the total number of charts in the strategy is limited only by the control engine s 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 32 charts on a SNAP PAC S series controller e 16 charts on a SNAP PAC R series or SNAP LCE controller e 8charts on SNAP Ultimate 1 0 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
178. 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 If you put more than one command in a condition block complete the Operator group as follows e f both commands must be true to exit the block true click AND e f only one of the commands must be true to exit the block true click OR 9 22 ioControl User s Guide USING VARIABLES AND COMMANDS 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 Instructions Sprinklers Sunday or Wednesday Day_of_the_ Week 3 Modi Day_of_the_Week Delete 0 Next Block Previous Block Either the first command OR the second command can be true for this condition block to exit true 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 11 25 2 In the Instructions dialog box double click any line of the command you want to change You can also click the comm
179. Comm link watchdog time Comm link watchdog time e Temperature conversion type Input offset and gain settings Saving to flash memory this way is the same as saving to flash by other methods such as using ioManager see the joManager User s Guide and is preferable to using the command Write 1 0 Unit Configuration to EEPROM 3 To reset saved parameters to their powerup default values click the Clear button 4 To change the 0 unit s current status click an arrow in the Enable field Then click Apply 6 52 ioControl User s Guide WORKING WITH 1 0 Ue 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 5 To view an individual 0 point highlight its name in the list e To add an 0 element to a watch window click Add Watch See page 6 73 e To open an inspection window to change an I O point click View Then see Inspecting Digital 1 0 Points below for the I O point you are changing analog or digital 6 When you have finished inspecting the 1 0 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 6 73 To change the point follow these steps 1 With the strategy running in Debug mode double click the 1 0 point on the Strategy Tree or double cl
180. Control Engine Commands 006 10 16 Chart Gomis inniinn 10 17 Time Date Commands 15511150111511 10 18 Timing Commands cecececesestesceteeeeens 10 19 Miscellaneous Commands 0 00 10 21 String CRT AIG iscaceceaidatcncteczsieeearaes 10 23 Event Reaction Commands 0 008 10 22 Mathematical Commands 10 32 Logical Commands ceeeeeeeee 10 33 Communication Command 10 35 1 0 Unit Scratch Pad Commands 10 51 O Unit Event Message Commands 10 54 1 0 Unit Memory Map Commands 10 55 Error Handling Commands 0006 10 56 Pointer Commands cccccccceeees 10 56 PiD Ethernet Commands 2 10 58 PID Mistic Commands 0cc000 10 62 Simulation Commands ccccceeee 10 69 ioControl User s Guide 10 1 PROGRAMMING WITH COMMANDS Digital Point Commands The following commands are used with standard Digital Points only For high density digital 10 2 points see page 10 6 Basic Commands Turn On Turn Off On Off Totalizers Get Off Time Totalizer Get On Time Totalizer Get amp Restart Off Time Totalizer Get amp Restart On Time Totalizer Latches Get Off Latch Get On Latch Clear Off Latch Clear On Latch Clear All Latches Get amp Clear Off Latch Get amp Clear On Latch Off Latch Set On Latch Set Counters Start
181. Counter Stop Counter Get Counter Clear Counter Get amp Clear Counter Period and Frequency Get Frequency Get Period Get amp Restart Period Set TPO Percent Set TPO Period Get Period Measurement Complete Status Pulses Generate N Pulses Start Off Pulse Start On Pulse Get Off Pulse Measurement Get Off Pulse Measurement Complete Status Get amp Restart Off Pulse Measurement Get On Pulse Measurement Get On Pulse Measurement Complete Status Get amp Restart On Pulse Measurement Start Continuous Square Wave Reference or online Help Some digital point commands are available in ioControl Professional only Some commands are available only on some I O units For details see specific information for each command in the ioControl Command ioControl User s Guide PROGRAMMING WITH COMMANDS 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 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 t 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
182. E A 8 17 mporting G NI cece hess dec ceaheatesetaciucteaaatatsencex cecdtechachsescsaeaceucecsspaicrbataueatsraxtececaxten 8 18 Chapter 9 Using Variables and Commands 1cscceceeseeeeeeteeteeeeeenees 9 1 POMPEU toie aA E A 9 1 WPMD SAG vel Masha ots Soha cab ge becpesiausee netetb ac sac asa cehtehsvacentantestetkinedehacnasecaeatiacaaasaiaa 9 1 About Variable Sirrini a A r E S 9 1 Types of Data in a Variable sus fs ts cassan che atsceacace senses stat ctaststslnec vas cxasetaxoasdnstegDi ain pesatunclues 9 2 Variables in TOG ONO ch enccadcasiccecpastosctocsdiednatsnstcteade diacidedsuasaaeksandeesstestachannidalecashetents 9 3 LEICA LAT IG I 9 4 Persistent Data ee ech thes casas apaeteecaaciaentss paced staat eagacdiedeasndl doeccsstencsnestacceeteencs reine tan 9 4 DI US obec lace E ee cheaters cece acetate a eee 9 5 Adding Variables ce ly ac tat daha eta abn Dac lee We ac alone a aii 9 5 Add Variable Dialog BOX occ conctsitacavsacanedacacncsesiascacsndendessuidaddecswasedfatencaxscencdoceateatas 9 6 Adding Table Sirari aaa aan te each RE ate 9 8 Adding Table Variables ceca atc cedecistsnccacicptasensbanscabsdesdsnpsiach andaeasicoasmeeusabaneutalinaiedata 9 9 Setting Initial Values in Tables During Strategy Download cccecececeeeteseeee 9 10 Creating the Initialization File sa cicdactacascsesdatiadd chacaldaccanedsdeetdadacaiantactsclentocicaty 9 10 WA ANT Ne sce cpcrscnsepscmsansetacpseacataccaanett A rarei ea S aiai 9 10
183. ERE 3 4 ioControl Terminology ecatet cli au stato et then Gor Slaten taenten yes peatiatennetoniheeieitneatte 3 5 Analog POINT oeren rarena aie aeaeaei ree EREEREER REEE ia aani RETRA 3 5 BIOCKS ornan e E a E 3 6 Digital POINT eneee a a a 3 6 External octet then tcoent tect ce tates usat vote ec tac ndnd nesiedectonsan vanes noes daa tentunnskacees 3 7 BUMS AIA sieniniai iaaa an A aA RAE 3 7 Input Point sp knchrcce ches pces ch crinctsan cece ace caae teste etcncest tata adcdt Soe in ek bec banuerteuceeeeeoctoeese 3 7 Instructions COMMANAS c cceccccsecesesesesesesecesecscsceseceseserevececevevececvevsvesevevsvsceveveceeees 3 8 UU PRGA WAM rirerire neiaie aa iaie tarnii aiea 3 8 Multitasking s sssaisssissssisssiisssiisssissssissniissniisniisnittsniitniinaniitanninannitaninnanintaninannnnnnnn ant 3 8 PUTS OU E saem aane e A E O TA 3 9 POIO are E E E 3 9 Strategy nerra ca teach at E E S 3 9 Variable scenic hes E eceeneteetcaaniatensiecterearias 3 9 ioControl Main WindoW scasieictinstnstesacedeadbacascdecadaadessdecaarscecehenss anines dvsdesisseskeninanachicateatsseaias 3 11 Satus iad a ate A E MS este E 3 11 MOda eae a eea e AE ae EEEE E E 3 11 TOOIDATS aranne N EN E Ar NAN 3 12 Moving Toolba Sininen iiia iin 3 13 Hiding and Showing Toolbars c cccscsccseeceseesesestesestssestesessssseeseseesescsteeeaneneane 3 13 Strategy TEE oct ci aacatienincs eee ona a a Aai a aen a a A AANA 3 14 Windows and Dialog Boxes in ioControl 0 cecescse
184. Each standard SNAP digital module contains four input or four output points SNAP analog modules supported by these processors contain either two or four points Each point on the rack is numbered when you configure the point or read or write to it you reference it by its number The following diagram shows the largest rack as an example Note ioControl User s Guide 6 7 WORKING WITH 1 0 that four numbers are shown for each analog module If you are using analog modules that contain only two points ignore the upper two point numbers This diagram applies to DIGITAL I O ANALOG I O SNAP PAC R1 3 SNAP UP1 ADS Sh SNAP B3000 ENET iB SNAP ENET RTC EDO eee gt R PEPEE o Sthemet Le 34 Module position 0 o al oo p i o E o gt 7664 i a 1 10 9 8 o i On 1 10 9 8 L d r ng o m oe some ee lh eh Laem POINTS 19 48 17 16 o Mana oa 19 48 17 16 F a o m oa l 7 26 25 24 i a f 27 26 25 24 31 30 29 28 o M on 31 30 2928 ANALOG F 1 o DONN o l POINTS l o DOOSSNNN o 39 38 37 36 NOTE Analog modules can be placed in f 4 any position standard digital modules o N oz 43 42 4140 can be placed in positions 0 7 only F 1 o z os 47 46 45 44 46 45 44 This diagram does not apply to SNAP F 1 high density digital modules which can ie AR 51 50 43 48 be placed in any position have 32 P ee AA a points and are usually read or written L J to using a bitmask or table
185. Enter the username and password set up for the destination password device If the destination device is another control engine or the local server use anything except an empty string optional Specify a communication timeout value in seconds or leave timeout 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 Using FIP Communication Handles in Your Strategy Suppose you have data you need to send via FIP 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 10 48 ioControl User s Guide PROGRAMMING WITH COMMANDS Sending the Data All At Once This method is better for small data files files larger than 1 MB may take a long time to transfer and the control engine may become unresponsive during the process Suppose you want to place the data into a file HunkoData txt on the device the data is currently in the file UseThisData txt on the control engine
186. Form 1410 is available for download from our Web site at www opto22 com Inspecting a PID Ethernet This section applies to SNAP Ethernet and SNAP Ultimate 1 0 units only For serial mistic 1 0 units see page 6 71 6 58 ioControl User s Guide WORKING WITH I O a M Click a tab to see or change additi Setpo onal data int 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 Adjus t resolution using the Output Axis button Click and drag on the scale to move he line Time axis Adjust resolution using he Time Axis button Click and drag left or right to see other times 1 With the strategy running in Debug mode double click the PID on the Strategy Tree pidO Yiew PID Loop scanning i lol x Name pido Error None Input 79 2753 Gain 15 Scan Rate 3 sec Mode auto 2 Setpoint 79 Tunel 0 05 Scan Counts 112783 Enable comm Fe 4 Dutput 2 252521 Tune D 0 02 Plot 0 Details Misc Details VAL Velocity Algorithm Input 09 43 30 0 09 44 00 0 09 44 30 0 09 45 00 0 Data Input Axis id Output Axis Time Axis Add Watch Save Tuning Help 2 View or change PID parameters as necessary Click the other tabs to see additional data To tune the PID see page 6 64 3 To add the PID to a watch window click Add Watch and see page 6 73 4
187. Group Disable Scan for All Events None Read and Hold Analog Input Data Specify the I O point and type of data current Read and Hold Analog Output Data average maximum minimum or total to be read Select the I O point from a drop down list or specify a new name for the point and configure it Activate PID Loop Specify the PID loop to be affected Select the PID Deactivate PID Loop from a drop down list or specify a new name for the PID and configure it Set PID Loop Setpoint Specify the PID loop to be affected and the setpoint value Select the PID from a drop down list or specify a new name for the PID and configure it ioControl User s Guide 6 45 WORKING WITH 1 0 For this type of reaction Enter this information Set Analog Output Specify the I O point and the value to set it to Select the I O point from a drop down list or specify a new name for the point and configure it Ramp Analog Output to Setpoint Specify the I O point the ramping speed in units per second and the end point value to ramp to Select the I O point from a drop down list or specify a new name for the point and configure it F Enable Communication To enable communication to this event reaction check to enable communication to this event reaction or uncheck to disable communication Adding a MOMO Event or Reaction mistic 1 0 Units Only Ona digital multifunction I O unit a special type of event or reaction you ca
188. Guide EE ee Saving a Strategy to Flash es cssat ace doncenesneciackendchndysceiacacancorestunascacestareadaasastecksecaecseckeaactsesie 7 4 Saving to Flash ONCE ew cae de anc tactical sho dendelsdaeraoilonpaeladeadact noyicatnatandenialesiegss 7 4 Saving to Flash on Every Download c cecceceseesesseseseeseeteseeteseeteseeteseeteseetsseetesesnsseeess 75 Archiving Strategies crac ccdcchca ceaticecend cnconscartisetcakendiassncacsndone boasheedAdicaddiseserdesseds Gabanseedesieniate ees 7 5 Archiving to the Computer jas cac ise chcacce sc pesecceceasasaaszasatapiasstesadactgsethnaianetianenuadiaaaeains 7 5 Archiving to the Control Engine caccacscdacdscsscdaectas acces etanntacesodankeseespacidescatcnsdsshaceadaacxddnads 7 6 Compiling and Downloading ices scacvaceadescossacdacsssdaceucdeis oezeans ch dencaccietecixesiutaciaeadhachscasessenasents 7 6 Compiling and Downloading in One Step ow ccccecseseseessesesceseseeseseseseaseseseeseanesees 7 7 Compiling without DOW ACI G 5cc3ccsassscsacersacisecencintastecdccnaceiecs exdatdezdes eceataskacsesapaceste 7 8 Compiling the Active Chart or Subroutine ccc cesceccsceescesestesestescscssescaeseanesees 7 8 Compiling Changes Only casa sckschaic st otedeacasrzss tnx dsenstaastavbtteedbacheucsesaeasedsetaecencnte 7 8 Compiling the Entire Strategy sic escseicssinstccutss dhasdvcscaes ctauetsansststsacatsnlgeaeectectcadicndend 7 8 Downloading ON carer aseratsedeaceacsecscehcunanacasaavaniasd elvan
189. 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 10 60 ioControl User s Guide PROGRAMMING WITH COMMANDS EEE M Key to Terms Used in Equations PV Process variable the input to the TuneD Derivative tuning parameter In units PID of seconds Increasing magnitude increases influence on output SP Setpoint Output Output from the PID InLo Range of the input Err_1 The Error PV SP from the InHi previous scan OutLo Range of the output Integral Integrator Anti windup is applied OutHi after the output is determined to be within bounds Gain Proportional tuning parameter PvIn_1 PV from the previous scan and the Unitless May be negative PvIn_2 scan before that Tunel Integral tuning parameter In ScanTime Actual scan time time since units of 1 seconds Increasing previous scan magnitude increases influence on output Equations Common to All Algorithms Err PY SP Span OutHi OutLo InHi InlLo Output Output FeedForward TuneFF Velocity Algorithm The velocity algorithm is similar to the algorithm used in OptoControl for Mistic I O except that the derivative does not act on setpoint changes TermP Err Err 1 TermI TunelI ScanTime Err Te
190. ISA Algorithm 12 55 30 0 12 56 00 0 Data v Input Axis Y Output Axis Y Time Axis Y ioControl User s Guide Input Setpoint Output 12 58 00 0 6 69 WORKING WITH 1 0 oo 10 If derivative correction is needed experiment with the derivative constant in the Tune D Many PID systems are effectively controlled with gain and integral constants only and no derivative consta nt In this example the gain and integral settings are maintaining the temperature at 0 06 from setpoint To demon deriva resolu was in percen resolu changes of 0 01 degrees F The le the eff strate the effect of the ive constant the ion of the input axis creased to show a 1 t span At this ion the plot reveals t side of the plot shows ect of gain at 30 integral at 0 1 and no deriva shows consta ive constant The arrow when a derivative nt of 10 was applied The right side of the plot shows consta how the derivative nt is keeping the input closer to setpoint 6 70 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 TemperatureControl Yiew PID Loop scanning Name TemperatureControl Error None Input 90 02628 Gain 30 Scan Rate 1 4 sec Mode Auto 4 Setpoint 90 Tunel 10 1 Scan Counts 61 281 Enable comm Fe Output 166 710
191. Ie 00 D0 Switch Counter _ Te 01 DO_Switch_1 Counter Delete Copied points Te 02 DO_Switch_2 Counter O Bk 03 DO_Switch_3 ee 01 SNAP ODCS5SRC 5 60 VDC Source Digital Output Counter Move To 9R 04 Alarm None 0 05 Not Used 9 06 Not Used i OF 07 Not Used v Col Al a j 5 ollapse To copy the point to fill all empty points on the 1 0 unit choose Fill In 1 0 Unit ioControl User s Guide 6 27 WORKING WITH 1 0 oo 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 Configure I O Points This module was already configured The copied point filled in all empty points even though the module is a different part number Cd 05 SNAP IDC5 SW Dry Contact Switch Digital Input M odify KR 20 D0_Switch_20 Counter Berl i Te 21 DO_Switch_21 Counter Delete Te 22 DO_Switch_22 Counter AR 23 D0_Switch_23 Counter imei J 06 SNAP IDCSD 2 5 28 VDC Digital Input Tt 24 DO_Switch_24 Counter oo Ka 25 DO_Switch_25 Counter Te 26 DO_Switch_26 Counter Expand All No module existed in this slot Both the points and the module were copied from the original Ie 27 DO_Switch_27 Counter X mm Pia Collapse All Close Help
192. Index From Set I O Unit Scratch Pad SetIoUnitScratchPadStringTable I O Unit F String Table Length To Index From Index From Table Set Minutes SetMinutes To P Set Mistic PID Control Word SetMisticPidControlWord On Mask Off Mask P For PID Loop Set Mistic PID D Term SetMisticPidDTerm To On PID Loop P Set Mistic PID Term SetMisticPidITerm To On PID Loop P Set Mistic PID Input SetMisticPidInput PID Loop Input P Set Mistic PID Mode to Auto SetMisticPidModeToAuto On PID Loop P E 16 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS EE ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Set Mistic PID Mode to SetMisticPidModeToManual On PID Loop P Manual Set Mistic PID Output Rate of SetMisticPidOutputRateOfChange To On PID P Change Loop Set Mistic PID P Term SetMisticPidPTerm To On PID Loop P Set Mistic PID Scan Rate SetMisticPidScanRate To On PID Loop P Set Mistic PID Setpoint SetMisticPidSetpoint PID Loop Setpoint P Set Month SetMonth To P Set Nth Character SetNthCharacter To In String At Index s n x F Set PID Configuration Flags SetPidConfigFlags PID Loop Configuration P Flags Set PID Feed Forward SetPidFeedForward PID Loop Feed Forward P Set PID Feed Forward Gain SetPidFeedForwardGain PID Loop Feed Fwd P Gai
193. Manager IMPORTANT For E1 and E2 1 0 units you must use ioManager See form 1576 Technical Note 1 0 Configuration for E1 and E2 Brain Boards for instructions For mistic I 0 units ioManager cannot be used for configuration Use ioControl For most I O units if you are already in ioControl configuration is easier there and you can use the loopback IP address for SNAP Ultimate 1 0 units controlling themselves However some functions for Ethernet based 1 0 units cannot be configured in ioControl If you use ioManager 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 ioManager and you cannot use ioManager for mistic 1 0 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 e You are configuring mistic I O units e You have an E1 or E2 I O unit e The strategy will run on SNAP PAC R series e You are using a modem connection PPP or or SNAP Ultimate I O units that are controlling SNMP themselves using the loopback IP address e You are using event messages or email 127 0 0 1 You are configuring events and reactions on e You are using an Ethernet network for the I O unit in addition to strategy logic communications Exception Use ioManager
194. Notice that one parameter Put Status In has been automatically entered for you ioControl User s Guide 12 5 12 6 USING SUBROUTINES 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 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 parameter 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 12 8 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 Add Subroutine Parameter x Prompt l Name Type E OK Cancel Help OK b In the Prompt field enter the prompt text you want to show in the Add Instruction dialog box in the s
195. OBCOO A PAR S e e E mrs 1 l l Al A i dh axl Cookies a Control Engines This chart drops the dough and chips on the conveyor belt Subroutines Included The belt must be running between 50 and 65 of max rpm Charts te Alarms The Powerup chart starts co Dough_Chip_Contre this chart paa Dough_Vessel_Pres Oven_Inspection_C ee Powerup Variables Numeric variables 840 bStartFlag GL dtCookieMotior This chart runs Bu FDoughPressur continuously once the Bu FRampvalue program has been started 14 FSetpointMinusl ey nChartStatus 40 nCookieMotiont 838 nLoopCounter 4 String Variables E Pointer Variables e Drop the dough White tab shows Communication Han Drop the chips bd his i h C Numeric Tables 4 gt this is a chart String Tables hoz z Pointer Tables COnN Chart Gray tab shows E E YO Units xil chart name a oT E Douh ChipContol ioControl Ready Configure NUM 2 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 dro
196. P Convert Number to String NumberToStringField Convert Length Put P Field Result in Convert String to Float StringToFloat Convert F Convert String to Integer 32 StringToInt32 Convert F Convert String to Integer 64 StringToInt64 Convert F Convert String to Lower Case StringToLowerCase Convert P Convert String to Upper Case StringToUpperCase Convert P Copy Current Error to String CurrentErrorToString Delimiter String P Copy Date to String DateToStringDDMMYYYY String P DD MM YYYY Copy Date to String DateToStringMMDDYYYY String P MM DD YYYY Copy Time to String TimeToString String P Cosine Cosine Of F Decrement Variable Decrement Variable Variable x x l P Delay mSec DelayMsec Milliseconds P Delay Sec DelaySec Seconds P Disable Communication to All DisableCommuncationToAllIoPoints P I O Points Disable Communication to All DisableCommunicationToAllIoUnits P I O Units E 4 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS ns i Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Disable Communication to DisableCommunicationToEventReaction Event P Event Reaction Reaction Disable Communication to DisableCommunicationTolIoUnit I O Unit P 1 0 Unit Disable Communication to DisableCommunicationToMisticPidLoop PID P Mistic PID Loop L
197. P cannot connect error resolving A 5 variable text block adding 9 5 deleting 8 12 changing 9 13 9 14 9 16 moving 8 11 configuring 9 5 selecting 8 10 definition 3 9 9 1 text changing color or size 8 3 8 12 deleting 3 13 throughput optimizing 4 21 in strategy design 4 5 time date commands instructions 10 18 literal constant 3 5 timer monitoring in a watch window 6 73 9 14 commands instructions 10 19 3 16 definition 3 7 naming 4 11 11 14 down timer 10 20 OptoScript compared to other languages programming example 4 17 F 6 up timer 10 20 persisent data in 9 4 variable definition 9 3 pointer definition 10 57 timing a process commands used for 10 18 table 9 4 toolbar 3 12 types of data 9 2 buttons moving and deleting 3 27 types in ioControl 9 3 customizing 3 25 3 28 viewing all in a strategy 7 26 7 28 drawing 8 3 velocity algorithm for PID 10 60 hiding 3 13 version checking with OptoVersion A 8 matching to screen resolution 3 25 View toolbar 3 13 moving 3 13 3 26 subroutine E OptoScript 11 26 viewingviewing See also inspecting showing 3 13 viewing totalizer commands instructions 10 4 10 14 all operands 7 28 TPO 10 13 all variables and 1 0 7 26 trigonometry commands instructions 10 32 another window or chart 3 15 troubleshooting bill of materials 7 29 how to begin A 1 chart 7 21 Index 12 ioControl User s Guide rs chart instructions 9 26 watch window communica
198. P 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 handle s value is ile lt open mode gt lt filename gt Note that file is all lowercase Open modes are Open mode Description r Opens a file for reading If the file does not exist or cannot be found the open call fails w 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 file w myfile txt writing Opens the existing file myfile txt so data can file a myfile txt be appended to it Creates the file Temperature data txt in the file w Data_files Temperatur directory Data_files and opens it for writing If data txt the directory doesn t exist it is created Opens the file Temperature data txt in the file r Data_files Temperatur directory Data_files for reading data txt 10 42 ioControl User s Guide PROGRAMMING WITH COMMANDS EE M Keep the following limitations in mind as you use the file communication handle Maximum length f
199. PID Forced Output When Input Over Range Get PID Output Set PID Forced Output When Input Over Range Set PID Output Get PID Forced Output When Input Under Range Set PID Forced Output When Input Under Range What is a PID 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 that is adjusted tuned for each PID loop The mathematical formulas vary but all PID systems share these fundamental concepts e They evaluate a process variable against its setpoint e They 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 I and D constants e The P and D constants need to be tuned for each system PID Loops on I O Units Analog digital SNAP Ultimate 0 units provide 32 PID loops per 1 0 unit SNAP Ethernet 1 0 units provide 16 PID loops per unit Because PIDs run on the I 0 side of the SNAP Ultimate brain not ioControl User s Guide 10 59 PROGRAMMING WITH COMMANDS on the control side these PIDs will keep running on the Ultimate 1 0 unit even if the ioControl strategy stops
200. 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 Page Setup The Page Setup dialog box appears Flowchart Graphics Page Setup x r Graphics Scaling Adjust to foo a normal size Fitto fi pagels wide by fi pages tall m Page I Print Header Cancel Help 2 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 e 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 e 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 ioControl User s Guide 7 23 WORKING WITH STRATEGIES 3 Recommended To print a header on each page put a check mark in
201. 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 Achart 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 As noted above on a SNAP Ultimate brain you can have a maximum of eight charts plus one host task running at once On a SNAP PAC R series or SNAP LCE controller a maximum of 16 charts plus one host task can run at once On a SNAP PAC S series controller 32 charts plus one host task can run at once For more information see Optimizing Throughput on page 4 21 ioControl User s Guide 4 9 DESIGNING YOUR STRATEGY 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
202. See Note 4 repeat Do do repeat MyTable i i 2 MyTable i i 2 MyTable i i 2 i i 1 i i 1 MyTable i i 2 i i 1 until i gt 5 Loop Until i gt 5 i i 1 until i gt 5 while i gt 5 case See Note 5 switch i Select Case i switch i case i of case 1 Case 1 1 f 2 0 x f 2 0 x case 1 E c 2 0 ox break Case z f 2 0 x 2 case z f 2 0 y break f 2 0 y f 2 0 y Case Else case z NOT ALLOWED IN C else break f 2 0 23 TE f 2 0 y f 2 0 z default End Select A break end f 2 0 z default break ES 2 0 z endswitch break Notes 1 Based on Microsoft s Visual Basic language G 4 gt pIND SASN 01 7U0901 2 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 OptoScript cannot have a break type of command in a loop as is common with other lanuages 5 OptoScript can test only one case at a time JONIYAITY JOVNONVI LdlYOSOLdO OPTOSCRIPT LANGUAGE REFERENCE Variable Comparison Variable ioControl Type BASIC Example C Example Pascal Example Name integer 32 Dim n as Long n Integer integer 64 Not available LONGLONG d d Int64
203. Simple 1 0 unit 3 2 ioControl User s Guide WHAT IS IOCONTROL aa General Control Concepts Automation Automation is a way of adding intelligence 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 0 respond in milliseconds and are on the job 24 hours a day Control Engines These processors are programmable electronic components that provide the intelligence required for automation In an Opto 22 ioControl system the processor is called a control engine and it is built into the Opto 22 controller Using ioControl you create a set of instructions a software program that tells the control engine how every aspect of a process should work Using ioControl you download the software program to a Opto 22 SNAP PAC controller and the controller runs it as a stand alone application Since the instruction set is stored in the processor s electronic memory much as a small computer would store it the PC can be turned off or used for other operations while the control engine in the processor runs the
204. State and Set All Target Address States are used to manually change the path of communication between the controller and the 1 0 unit s based on the IP address used for the 1 0 unit These commands let you switch communication from a primary to a secondary IP address or vice versa or enable or disable the primary or secondary address Ethernet link redundancy to 0 units is available only in ioControl Professional only froma SNAP PAC controller and only to Ethernet based 1 0 units The secondary IP address for an 1 0 unit may be for the second Ethernet network interface on a SNAP PAC R series controller or it may be for ioControl User s Guide 10 15 PROGRAMMING WITH COMMANDS a separate 0 unit If it is a separate unit the primary and secondary 1 0 units must be the same type for example SNAP ENET S64 and have exactly the same points because they are configured together under one name One or both target addresses primary and secondary can be enabled but only one of them is active at any time For link redundancy both must be enabled When an 1 0 unit is configured with two IP addresses the default is for both to be enabled and the primary address to be 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 Ta
205. String Start at Index P Num Characters Put Result in Get System Time Get SystemTime F Get Target Address State Get TargetAddressState Enable Mask Active P Mask I O Unit Get Type From Name Get TypeF romName Name F Get Value From Name Get ValueFromName Name F Get Year Get Year F ioControl User s Guide E 11 OPTOSCRIPT COMMAND EQUIVALENTS ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Greater Than Numeric Table x gt nt 0 F Element Greater Than or Equal to x gt nt 0 F Numeric Table Element Greater Than or Equal x gt y F Greater x gt y F Hyperbolic Cosine HyperbolicCosine Of F Hyperbolic Sine HyperbolicSine Of F Hyperbolic Tangent HyperbolicTangent Of F I O Point Communication sIloPointCommEnabled I O Point F Enabled 1 0 Unit Communication sIoUnitCommEnabled I O Unit F Enabled I O Unit Ready sIoUnitReady I O Unit F Increment Variable ncrement Variable Variable x x 1 P IVAL Move Numeric Table to valMoveNumTableTolIoUnit Start at Index P 1 O Unit Of Table Move to IVAL Set Analog Point valSetAnalogPoint To On Point P IVAL Set Counter valSetCounter To On Point P IVAL Set Frequency valSetFrequency To On Point P IVAL Set I O Unit from valSetIoUnitFromMomo On Mask Off Mask P MOMO Masks On I O Unit IVAL Set Mistic PID Control valSetMi
206. StringCharldentifier StringVariable NumericExp NumericLiteral Integer32Literal Integer64Literal FloatLiteral LogicalUnaryExp gt not NumericExp ConditionStatement gt fStatement StatementListOrEmpty EndifStatement gt fStatement StatementListOrEmpty ElseStatement StatementListOrEmpty EndifStatement gt fStatement StatementListOrEmpty ElselfList EndifStatement fStatement StatementListOrEmpty ElselfList ElseStatement StatementListOrEmpty EndifStatement fStatement if NumericExp then ElseStatement else ElselfStatement elseif NumericExp then StatementListOrEmpty ElselfList FiselfStatement Fiselflist ElselfStatement F 14 ioControl User s Guide OPTOSCRIPT LANGUAGE REFERENCE EndifStatement gt endif CaseList CaseStatement CaseStatement DefaultStatement CaseList CaseStatement gt CaseList CaseStatement DefaultStatement DefaultStatement default StatementListOrEmpty break CaseStatement case NumericExp StatementListOrEmpty break SwitchStatement switch NumericExp CaseList endswitch ForStatement for NumericVariable NumericExp to NumericExp step NumericExp StatementListOrEmpty next WhileStatement while NumericExp StatementListOrEmpty wend RepeatStatement repeat StatementListOrEmpty until NumericExp ioControl User s Guide F 15 OPTOSCRIPT LANGUAGE REFERENCE F 1
207. T A E o an 1 10 98 L a gi 14 11 9 oe 1B 14 13 12 L a in A 19 18 1716 a oa 19 18 1716 4 8 22 21 20 a ta Bm 2120 F 4 7 26 25 24 k te 27 25 25 24 a q 31 30 29 28 a 31 30 2928 DIGITAL ANALOG POINTS 35 34 3332 BoM 33 32 POINTS rT 3 a 39 38 37 36 ba 39 38 37 36 wr o 43 42 41 40 gt S 43 42 41 40 wr This diagram does not apply to T as SNAP high density digital we 51 60 49 48 modules which have 32 points and are usually read or written to using a bitmask or table 9 47 46 45 44 r 51 50 49 48 55 64 53 62 a 55 64 63 62 3 a g ee OO ojo O o bos s lt gt i J is ssimzaye Nai 5 ke a atl E T T T 59 68 67 66 59 68 7 56 3 Je dek ARSE EEA EEE 63 62 61 60 ea 63 62 64 60 r ioControl User s Guide 6 9 WORKING WITH 1 0 ee SNAP Ethernet Digital Only Systems Processors Compatible Racks SNAP UP1 D64 SNAP ENET D64 SMAR DOTRS CAUTION Do NOT connect a digital only processor to any rack except the SNAP D64RS Using any other rack will severely damage the brain or controller A SNAP D64RS 1 0 mounting rack can hold up to 16 standard digital modules Analog serial and high density digital modules cannot be used with digital only processors Each SNAP standard digital module contains four input or four output channels for a total of 64 points of 1 0 on the rack Each point on the rack is numbered when you
208. To save copy or print the current plot click the Data button and choose from the popup menu 5 To save changes to any of the PID configuration parameters click Save Tuning 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 1410 PID Configuration and Tuning SNAP Ultimate 1 0 Learning Center Supplement available for download from our Web site at www opto22 com 1 Determine two significantly different output settings that are within the capabilities of your system ioControl User s Guide 6 59 6 60 WORKING WITH 1 0 2 With the strategy running in Debug mode double click the PID on the Strategy Tree pidO iew PID Loop scanning I 5 x Name pido Error None Input 79 2753 Gain 15 Scan Rate 3 sec Mode Auto 2 Setpoint 79 Tunel 0 05 Scan Counts 112783 Enable comm Fe 4 Output 2 252521 Tune D 0 02 Plot 1 0 Details Misc Details VAL Velocity Algorithm Input 5 etpoint Output 03 43 00 0 0 0 0 09 44 00 0 03 44 30 0 09 45 00 0 Data Input Axis id Output Axis Time Axis Add Watch Save Tuning Help 3 Set the Mode to Manual if not set already and click Apply 4 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 5 Reset your
209. XVAL field indicate a communication error 3 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 Counter 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 4 To add the point to a watch window click Add Watch and see page 6 73 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 6 73 To change the point follow these steps 1 With the strategy running in Debug mode double click the 1 0 point on the Strategy Tree or double click the point in the View I O Unit dialog box The small dialog box that appears shows the IVAL and XVAL as well as the units e The XVAL or external value is the real or hardware value as seen by the 1 0 unit This value is external to the control engine 6 54 ioControl User s Guide WORKING WITH 1 0 es e The VAL or internal value is a logical or software copy of the XV
210. _Chip_Control tab Dough chin Conti 10 Click the Dough_Chip_Control tab at the bottom of the ioContro l main window The chart appears 11 Click the Pause button to pause the chart The Powerup chart starts this chart This chart runs continuously once the program has been started Drop the dough Drop the chips 2 32 ioControl User s Guide IOCONTROL TUTORIAL rs i 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 nCookie_Counter scanning py ici gt i eT 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 nCookie_Counter scanning MEE 3 Click Add Watch Add Watch Entry Since there is no watch window available to select we ll create one ioControl User s Guide 2 33 IOCONTROL TUTORIAL 4 Click New Create new Watch Window E Look in yj My Cookies vile ee E Files of type iControl Watch Window Files wth Cancel 4 5 Make sure the My Cookies directory appears in the Look in field Type a name for the watch window in the File name field Then click Open The watch window name appears in the Add Watch dialog box and the new watch window appears behind it 6 In the
211. _UIO_A Get VO Unit Scratch Pad Integer 32 Table VO Unit SHAP_UIO_B Add Length 600 From Index 0 To Index 0 Delete To Table B_Data to handle writing to Put Status in B_Data_status Next Block Previous Block 10 53 ioControl User s Guide PROGRAMMING WITH COMMANDS I O Unit Event Message Commands The following commands refer to event messages sent from SNAP PAC R series SNAP Ultimate or SNAP Ethernet 1 0 units They do not apply to mistic event reactions Get I O Unit Event Message State Set I O Unit Event Message State Get O Unit Event Message Text Set I O Unit Event Message Text A SNAP Ultimate or Ethernet 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 ioControl 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 ioManager to configure event messages following the steps in Opto 22 form 1440 the ioManager Users Guide You can configure the following types of event messages e Email or pa
212. a computer or the OptoOPCServer or ioDisplay 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 computer has two network interface cards NICs Opto 22 Redundant Network a PC with two NICs mee f running ioDisplay PC with two NICs running ioDisplay PC with two NICs o OO PC with two NICs running primary running secondary OptoOPCServer OptoOPCServer t d SNAP PAC S series gi controller controls all j ia V O units F222 e909 cgcgccgcc V O units are all controlled by the controller Ethernet switch Each I O unit is connected to its own group of Ethernet switch network 1 sensors and actuators but both are connected network 2 i to the same two networks l l l SNAP PAC l T R series a ra e a a Sensors and actuators location 1 SNAP PAC i R series Sensors and actuators location 2 5 8 ioControl User s Guide WORKING WITH CONTROL ENGINES Ethernet Link Redundancy with Serial 1 0 Units This third example of link redundancy shows a SNAP PAC S series controller with serial 1 0 units The redundancy is in the Ethernet networks between the controller and computers running ioDi
213. abel x Block id Name Type Action 5 ls Switch Condition 6 Production OptoScript 7 Increment Action Cancel Help e To sort in 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 ioControl User s Guide 3 23 WHAT IS IOCONTROL Customizing ioControl for Your Needs Setting Decimal Binary or Hex Display Mode You can set up ioControl 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 format is particularly useful for entering integer literals and initial values for a digital only Ethernet brain Hex view is available in all modes Configure Debug and Online The default view is in decimal notation as shown in the following figure Cookie_Counter scanning 5 x Name Cookie_Counter Decimal view Type Integer 32 Variable Initialized On Run Value G14 Apply Add Watch Help To view integers and integer tables in binary view click the Binary Integer Display button on the toolbar EJ or choose View gt Binary Integer Display The integers appear as shown below Cookie_Counter scanning Sj xj Name Cookie_Counter Type Integer 32 Variable Initialized On Run 0000000 oo000000 00
214. ain USB drives and memory cards their use is not recommended They are better suited for transferring files rather than directly accessing them 1 6 ioControl User s Guide CHAPTER 2 ioControl 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 0 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 ioControl Basic or ioControl Professional ioContro Basic is shown in the graphics The best way to use the tutorial is to sit down at your computer and follow it through All you need is ioControl and access to a control engine Even if you can t access a control engine at the moment you can still do everything up to the point of downloading your strategy In this Chapter Opening the Strategy ccceeeeeeee 2 1 Compiling the Strategy ccsees cece 2 20 Saving the Strategy 2 3 Running the Strategy cseeseeeseeee 2 21 Examining the Strategy ccscecseeeeeee 2 5 Compiling and Downloading the Change 2 31 Opening a Chart ccc 2 6 Using a Watch WindoW cccceceseeeeseeee 2 33 Opening a BIOCK ccc 2 9 Closing the Strategy and Exiting 2 40 Adding a Command ccccceseseeees 242 WARIS NEK iriri 2 4
215. an ioControl command CAUTION Be careful when deleting 1 0 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 1 0 unit s name on the Strategy Tree Right click it and choose Delete from the pop up menu The 1 0 unit is deleted from the strategy You can also delete an 1 0 unit from the Configure 1 0 Units dialog box by highlighting the unit s name and clicking Delete Adding I 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 0 Unit on page 6 12 Adding a Digital I O Point NOTE This section applies to points on most digital modules but not to points on SNAP high density digital modules For information on high density digital modules see page 6 25 1 With the strategy open and in Configure mode double click the 1 0 Units folder not the individual unit s icon on the Strategy Tree 6 16 ioControl User s Guide WORKING WITH I O rs The Configure 1 0 Units dialog box appears Configure 1 0 Units Ethernet 10 1925 Disabled Ethernet 127 0 0 1 Disabled 2 Highlight the 1 0 unit the points are on and click 0 Points The Configure 1 0 Points dialog box appears ioControl Pro only If you are using a non SNAP 1 0 unit double click the channel you want to use Skip to step 8 4 If you are using a SNAP 1 0 unit
216. an Rate 60 which results in time in minutes All values are in Engineering Units The change in output calculated by this formula is added to the existing PID output If the input span and the output span are different the change is normalized and then added to the output This is accomplished by converting the change to a percentage of the input span The same percentage of output span is then added to the output Gain P For those familiar with the term proportional band gain is simply the inverse Gain acts directly on the change in error since the last scan Error is the setpoint minus the input value in engineering units Therefore in the case of steady state error that is change in error 0 gain alone has no effect on the output For this reason gain cannot be used alone Gain is also used as a multiplier on the integral and derivative ioControl User s Guide 10 63 PROGRAMMING WITH COMMANDS The velocity PID algorithm uses gain much as it is used in the Honeywell type A PID and the Bailey error input type PID Higher gain results in increased output change Too much gain results in output oscillation Too little gain results in very slow performance Integral I This term acts only on the current error It is used to reduce the current error to zero Note that during steady state conditions integral multiplied by current error multiplied by gain is the only thing affecting the output The larger th
217. an get counts for high density digital modules used with SNAP UP1 M64 and SNAP ENET S64 brains which do not support high speed counting Counting on HDD modules is at 0 50 Hz at a 50 duty cycle This rate is useful for applications that require counting but not at high speeds for example rotating shafts flow meters that generate pulses and electrical meters tuned to slower speeds Using HDD Module Counters Counters on HDD modules are always active you do not need to configure a counter before using it Because counters are always active you should clear a counter before using it to make sure the count accurately reflects your current task Counters are returned as 32 bit integers either in a variable for one point or in an integer 32 table for all points on a module The table must contain 32 elements beyond the starting index since there are 32 points on the module See the oControl Command Reference or ioControl command Help for more information about specific commands Using HDD Module Commands As shown in the following table HDD module commands work either with an individual point with all points on one module or with all HDD modules on the 1 0 unit Reads or writes to Purpose Command name Clear HDD Module Off Latches Clear HDD Module On Latches Get amp Clear HDD Module Off Latches x Xx Xx Xx Get amp Clear HDD Module On Latches Get amp Clear All HDD Module Off latches Reading states and
218. ance 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 Chapter 11 Using OptoScript for more information OptoScript blocks can have more than one entrance but only one exit 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 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 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 ioControl to change the appearance of all new charts in all new strategies and all new subroutines e Across
219. and Test The Real Use for XVAL and IVAL u eects 10 5 Additional Commands to Use with Standard Digital Points cccceeseeeeeeeeee 10 5 Standard Digital Points and OptoScript Code ccc cesesseseseeteseeseseeesesteneaeseane 10 6 High Density Digital Module Commands cccccsccseesesesesesesestesesesesceseseessscsteseseneans 10 6 About High Density Digital Modules c cccccecseescesestesesteseeteseeteseetesssneteseesseeess 10 6 Comparing SNAP High Density and Standard Digital Modules cccce 10 7 Counting on High Density Digital Modules 0 0 ccc csc esteteseeeseeeseeseseesesesteseane 10 7 Using HDD Module Counters c ccccsccccsccsesceesesescsesesesescessseeseseesesestescaneneans 10 8 Using HDD Module COMINGS sic ccasiecestsscdscraicssiativeaacissetsusceinedstnnn alia tivemsanosasuncescieedsen 10 8 individual PS DN ads cased aac nck ie E toad eee eens 10 9 All Points on a Module cgi ssascaizcsscs escssesacssecancchs ceaideesestgatained ca ieccicatmatinapaaiaieniaian 10 9 All HDD Modules on the 1 0 Unit ccceccsescsesessesescesescssescssescaneseaneseecenas 10 12 Analog Point Commands 0ciccicaceacsscss eassacsecocstednaceatarcasinsasesansathdessseransctssanedsanseoseatbaces 10 13 Offset and Gain Commands Se ces sccsscz hctsecnatea ec ea ial sara de eaten iatawbsunerbiasienaseacencsaaaat 10 14 Minimum Maximum Values cccccccccscsescesescssescescscsnescsnssesnesesnssssnsscscescseeasscaneaes
220. and to highlight it and click Modify 3 In the Edit Instruction dialog box make the necessary changes For help see Adding Commands on page 9 18 4 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 ioControl User s Guide 9 23 USING VARIABLES AND COMMANDS NOTE To delete commands in OptoScript Blocks see Using the OptoScript Editor on page 11 25 2 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 3 Click Delete or press DELETE on the keyboard 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 11 25 2 In the Instructions dialog box click the first command you wan
221. ane eed secede a a dead ac a cnacanedoatoaton 6 1 Choosing a Configuration TOON ccs hcnachesscpcrsatesceecha ac cosas ecaceeeadamonomaiainatcdeccentaleniasiousss 6 1 Importing 1 0 Configuration into ioControl oo ce ecssescetesesseseeteseetesesteseeteseeneseeeees 6 3 Copying 1 0 Configurations epeeteenerer tree tater ner tae pre tet ere rTererereh rh Vere se irr tenet nr ner ner vere an 6 3 Creating the Configuration Export File cccsccccseseseeseeesceseseeseseeescsescsneneans 6 4 Importing the Configuration File ae siiesacckce sched aces tiocunctarinsanteaveabduuic ube vaunecredsndsneseieass 6 4 PDO O UMIS sikiane a at a otal seed EE as 6 4 Addressing 0 Units an cxsce sta ac scesetn th esetescsereened ekshasu soistr sects eaniogeicpicosantanpathateebieheatessesien 6 6 SNAP Ethernet Analog and Digital SySt MS cccccecccesessesesceseseeseseeseseaeseateseaeesees 6 6 SNAP Ethernet Analog and Simple Digital Systems ccc cccecesestesesteeeteeeeesens 6 8 SNAP Ethernet Digital Only Syst Ms ccccccccscecescsscscesestesestesescesestesestesesteseeteseeeesees 6 9 SNAP Serial Based mistic 1 0 Units oo cccccccsescscecsesesesssestsseseseseesesesessesesesen 6 10 Non SNAP Serial Based mistic I O Units cccccccesesceccssesscccescsesesesescseseseevsnsneeees 6 12 Adding an 0 UTIs Senet detacensdchartcecaietacieen cian sentieesadde aches scaecasetattcsscsasactciedpenteatiachecs 6 12 Add 0 Unit Dialog BOX sca scsocs acatgesissasnasiasatz
222. application is already running a second instance 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 ioControl open choose Tools Customize The Customize dialog box appears nies Cancel Help Menu Text TE Tone Command N HETGYE Arauments e Move Up ThitaliDirectary a HeD 2 Click Add 3 In the 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 Bl and navigate to the file ioControl User s Guide 3 29 WHAT IS IOCONTROL 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 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 ioControl main window and the applications you ve added now appear in the Tools menu Online Help To open online Help choose Help Help Topics or click the Help button in any dialog box Help buttons in dialog boxes are context sensitive a
223. ar 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 continuously once the program has been started Drop the dough Drop the chips 2 10 ioControl User s Guide IOCONTROL TUTORIAL rs 9 Connect the Drop Chips block to this new block by clicking the connection tool H 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
224. are stacked on top of each other you can select only the one in front To change their position z order follow these steps Click the element to select it 2 Right click the element From the pop up menu choose Z order From the sub menu choose the action you want to take e Bring Forward moves the element one position closer to the front e Bring To Front moves it all the way to the front e Send Backward moves the element one position closer to the back e Send To Back moves it all the way to the back ioControl User s Guide 8 11 WORKING WITH FLOWCHARTS 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 ina 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 With the chart open and the strategy in Configure or Online mode click the Select tool 2 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 Cut or Edit Copy or click the right mouse button and choose Cut or Copy from the pop up menu 3 To paste blocks press CTRL V select Edit Paste or right click anywhere on a chart and select Paste from
225. ariable ClampFloatVariable High Limit Low Limit P Float Variable Clamp Integer 32 Table ClampInt32TableElement High Limit Low P Element Limit Element Index Of Integer 32 Table E 2 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS es M Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name Clamp Integer 32 Variable ClampInt32Variable High Limit Low Limit P Integer 32 Variable Clamp Mistic PID Output ClampMisticPidOutput High Clamp Low P Clamp On PID Loop Clamp Mistic PID Setpoint ClampMisticPidSetpoint High Clamp Low P Clamp On PID Loop Clear All Errors ClearAllErrors P Clear All Event Latches ClearAllEventLatches On I O Unit P Clear All Latches ClearAllLatches On I O Unit P Clear Communication ClearCommunicationReceiveBuffer P Receive Buffer Communication Handle Clear Counter ClearCounter On Point P Clear Event Latch ClearEventLatch On Event Reaction P Clear HDD Module ClearHddModuleOffLatches I O Unit Module F Off Latches Number Clear Mask Clear HDD Module ClearHddModuleOnLatches I O Unit Module F On Latches Number Clear Mask Clear Off Latch ClearOffLatch On Point P Clear On Latch ClearOnLatch On Point P Clear Pointer pni null F Clear Pointer Table Element pt 0 null P Close Communication CloseCommunication Communication
226. ariable is one that stores readings from an analog input such as a thermocouple ioControl User s Guide 3 7 WHAT IS IOCONTROL e An integer is a whole number with no fractional part Examples 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 ioControl 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
227. ars in hex String_ ariable scanning ial x Name String Variable Type String Variable 127 max length Initialized On Download Value fag 74 65 6D 20 70 72 69 63 65 20 3D Bytes 49 74 65 6D Item 4 20 70 72 69 pri 8 63 65 20 3D ce 12 20 Apply Add Watch Help Customizing Toolbars You can customize toolbars in ioControl for the way you work You can choose toolbars to match your screen resolution You can move toolbars to another place in the window You can move a button into another position or toolbar or delete it if you don t use it You can even create your own toolbar with just the buttons you use Choosing Toolbars for Your Screen Resolution You can choose toolbars to match your screen resolution and place the most frequently used toolbar buttons all on one line To do so follow these steps 1 Choose View Toolbars ioControl User s Guide 3 25 WHAT IS IOCONTROL 2 In the Customize dialog box make sure the Toolbars tab is open Toolbars tab Toolbars Commands Toolbars V Show Tooltips New Drawing I Cool Look Configure i Reset Compile ese Mode Debug View VAII Toolbar Buttons Basic 1152x864 Basic 1024x768 Basic 800x600 Toolbar name Cancel Apply Help 3 Click to place a check mark next to the toolbar for your current screen resolution Click OK The m
228. as unable to initialize an I O unit so the Chart column shows lt system _INIT_IO gt 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 gt Messages 4 5 and 6 are examples these errors occurred in block 1 of the subroutine Variable_Increase_Notification which was called by the Temperature_Control chart B 2 ioControl User s Guide as i Using Queue Messages If a block number is listed for the error look in that block in the Strategy to find the ioControl 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 ioControl Configure mode choose Configure 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 an ioControl command instruction and they are reported by the control engine to a variable in your ioControl Strategy or as a returned value in OptoS
229. asic includes both flowchart and OptoScript programming subroutines a graphical debugger and about 400 commands e ioControl Professional is available for purchase either separately or as part of the complete ioProject Professional software suite The Professional version of ioControl adds Ethernet link redundancy to controllers and I O units supports additional features in Ethernet based 1 0 units such as ramping and pulsing and offers additional data types in subroutines ioControl Professional also provides a migration path for Opto 22 FactoryFloor customers by adding support for serial based mistic 1 0 units and by including a conversion utility to help customers move older OptoControl strategies to ioControl ioControl Professional includes about 500 commands About this Guide This user s guide not only teaches you how to use ioControl but also provides programming instruction and tips The separate oContro Command Reference describes in detail all ioControl programming commands or instructions This guide assumes 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 ioControl User s Guide 1 1 WELCOME TO IOCONTROL and close files If you are not familiar with Windows or your PC refer to the documentation from Microsoft and your computer manufacturer This guide covers both ioControl Basic and ioControl
230. 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 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 I O Here s the list of analog and digital I O modules required for the cookie factory Analog 1 0 Name Description Type Module REW G 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 Temperature 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 1 0 Name Description Type Module States SV 100A Pressure Control Valve Output SNAP ODCS5SRC 5 60 VDC 0 Closed 1 Open SV 100B Dough Dispense Valve Output SNAP ODCS5SRC 5 60 VDC 0 Closed 1 Open LAL 100 Dough Level Alarm Input SNAP IDCS5D 2 5 28 VDC 0 OK 1 Low SV 101 Chip Dispense Valve Output SNAP ODCS5SRC 5 60 VDC 0 Closed 1 Open LAL 101 Chip Level Alarm Input SNAP IDC5D 2 5 28 VDC 0 OK 1 Low XS 103 Inspection Signal Input SNAP IDC5D 2 5 28 VDC 0 OK 1 Reject SV 103 Reject Valve Output SNAP ODCS5SRC 5 60 VDC 0 Closed 1 Open XS 105 Emergency Stop Input SNAP IDC5D 2 5 28 VDC 0 Stop 1 OK
231. at table In a string table Index Value gates are floating Index Value Joas aS 0 82 0 point numbers 0 Maria 1 86 1 1 Tom 2 85 0 2 Siu 3 74 8 3 Andre 4 72 3 5 72 7 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 A 3 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 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 A persistent variab
232. ata bits gt lt stop bits gt port number Oori baud rate 115200 76800 57600 38400 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 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 have 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 oControl Command Reference or online Help for details on using specific commands ioControl User s Guide 10 51 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 ioControl to read o
233. ategy 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 of the variable and indicates whether scanning is occurring m Maximize button ioixl Value fazeo6 9 14 ioControl User s Guide USING VARIABLES AND COMMANDS 2 To view more information click the Maximize button Minimize button Pierre Name Cookie_Counter Type Integer 32 Variable Initialized On Run Value faz908 Apply Add Watch Help Communication handle variables show slightly different fields 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 3 To change the value of the variable type the new value in the Value field and click Apply The field turns
234. ategy running in Debug mode double click an I O unit in the Strategy Tree The View I O Unit dialog box appears showing information about the unit and its points The title bar shows the name of the 1 0 unit and whether scanning is occurring x Name Mixed_IO_Unit Type SNAP Mixed Ultimate 1 0 Firmware Version R5 1f Port Ethernet 2001 Address 127 0 0 1 Config EEPROM Set Clear Scope Strategy Global Error None Show 1 0 Points PID Loops Communication Enabled ES 00 diDoughLevelSwitch Digital Input Off Off 0 diChipLevelS witch Digital Input Off Off 02 dilnspectionPassFailS Digital Input Off Off 03 diE Stop Digital Input Off Off 04 doDoughPressureCon Digital Output Off Off 05 doDoughDispenseValve Digital Output On On 06 doChipDispenseValve Digital Output Off Off 07 doRejectValve Digital Output Off Off 08 aoOvenT emperatureC Analog Output 450 100 og aoConveyorSpeedCo Analog Output 55 55 10 Not Used x Cr Rhett len dt Apply mawan View Hep _ 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 2 To save the current configuration of the 1 0 unit to its EEPROM flash memory click the SET button The following parameters are saved Digital e I O module configuration e I O module configuration e Initial output settings
235. ation in the task queue We recommend using commands such as Calling Chart Suspended and Chart Running to determine the status of a chart Time Date Commands The following commands refer to time dates and days Dates and Days Time Get Year Get Hours Set Year Set Hours Get Month Get Minutes Set Month Set Minutes Get Day Get Seconds Set Day Get Seconds Since Midnight Get Day of Week Set Seconds Get Julian Day Set Time Set Date Get System Time Copy Date to String MM DD YYYY Copy Time to String Copy Date to String DD MM YYYY 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 subtract 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 ioControl Debug mode choose this option while viewing the control engine Control Engine Inspect You can also use these commands to set the time and date on the control engine 10 18 ioControl User s Guide PROGRAMMING WITH COMMANDS Timing Commands The following commands are used for timers and delays in a strategy Timers Delays Start Timer Delay mSec Stop Timer Delay Sec Pause Timer Continue Timer Timer Expired Set Down Timer Preset Value Down Timer Expired Set Up Timer Targe
236. ation on integers and floats 10 34 ioControl User s Guide Communication Commands PROGRAMMING WITH COMMANDS The following commands refer to moving data among entities that store and transfer data Communication Open Open Outgoing Communication Listen for Incoming Communication Accept Incoming Communication Close Communication Clear Communication Receive Buffer Get Communication Handle Value Set Communication Handle Value Send Communication Handle Command Get Available File Space Get Number of Characters Waiting Transfer N Characters Get End Of Message Terminator Set End Of Message Terminator Communication Handles Receive Character Receive N Characters Receive String Receive Numeric Table Receive String Table Receive Pointer Table Transmit Character Transmit NewLine Transmit String Transmit Receive String Transmit Receive Mistic I O Hex String Transmit Numeric Table Transmit String Table Transmit Pointer Table joControl Professional only mistic 1 0 units only A communication handle is a variable in ioControl 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
237. ative term of 0 when cascading PID loops Tuning Graphs PID mistic 0 5 x Integral Optirral integral Hoh Gin Lowlntega Hoch Gin Optimal Itega 2x i Vooo Optimal Gain Optimal tega Hgh Gain Hgh megad Oird Gin Hgh Integral Optimd Gain Low tega Optimal Gain Low Gain Lowlrtegal LowGan Optima Itega Low Gain Hgh htegral 05x en Gan 10 68 ioControl User s Guide Simulation Commands PROGRAMMING WITH COMMANDS The following commands are used for simulation and program testing Communication to All 1 0 Points Enabled Communication to All 1 0 Units Enabled Disable Communication to Point Disable Communication to All 1 0 Points Disable Communication to I O Unit Disable Communication to All 1 0 Units Disable Communication to PID Loop Enable Communication to Point Enable Communication to All 1 0 Points Enable Communication to O Unit Enable Communication to All 1 0 Units Enable Communication to PID Loop 1 0 Point Communication Enabled I O Unit Communication Enabled PID Loop Communication Enabled IVAL Turn Off IVAL Turn On IVAL Set Analog Point IVAL Set Counter VAL Set Off Latch VAL Set On Latch Disable Communication to Mistic PID Loop Enable Communication to Mistic PID Loop Mistic PID Loop Communication Enabled Disable Communication to Event Reaction Disable Event Reaction Group Enable Communication to Event Reaction Enable Event Reaction Group Event Reaction Communication Enab
238. ator 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 true 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 Any number of logical operators can be Logical operators are left associative For chained together example these two lines are equivalent nVarl nVar2 and nVar3 and nVar4 nVarl nVar2 and nVar3 or nVarl nVar2 and nVar3 or nVar4 nVar4 nVarl nVar2 and nVar3 or nVar4 The not operator precedes a value it only takes a The following two lines are equivalent value on its right hand side nVarl not nVarl and not nVarl not nVar2 nVar2 nVarl not nVarl and not nVar2 ioControl User s Guide 11 19 USING OPTOSCRIPT a Logical operators can be combined with comparison operators to create complex logical expressions nVarl nVar2 lt 1 and nVar3 6 5 nVarl nVar2 lt 1 and sStringl abc nVarl nVar2 lt 1 and nVar4 xor nVar5 or not fFloatl fFloat2 nVarl not nVar2 lt 5 same as nVarl nVar2 gt 5 When you use a logical 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 Motor_1l or Motor_2 then Motor_3 0 endif Using Bitwise Operators All OptoScript bitwise operators operate on integer values OptoScript
239. ble_Increase_Notification X Ga Augeri Tabisz Po emp Variable Increas g Count Watch WARNING ENA Debug NM 2 C Program Files Opto22 ioProjeck Click the arrow buttons to see This white tab shows you are stepping inside the Variable_Increase_ tabs that are not visible or are Notification subroutine which was called by the ncrement Counter only partly visible action block on the gray tab at left The gray Charttab farther left shows the chart this action block is in Click any tab to see how you got to where you are Docking Windows You can place the Strategy Tree and watch windows where you want them dock them in the ioControl main window Docked windows do not have tabs but are contained in their own frames ioControl remembers their position the next time you open that strategy e To dock a window click the docking button al in the window s title bar ioControl User s Guide 3 17 WHAT IS IOCONTROL The window moves to its own frame Compare the following figure with the one on page 3 11 to see the difference in the Strategy Tree window JioControl File Edit Configure Chart Subroutine Compile Mode Tools view Window Help Dae A sex ME SSa KmGaeorv AlPARS CHH PAR gt 9 a Ss Oh or a A S dh Docked Strategy Tree Eimear of x EE Sprinkler _Contro
240. bles Pointer Variables Communication Handles Numeric Tables E String Tables Pointer Tables I O Units FA UIO_A Points Fk DO_Switch ER Sprinkler_Switch De Alarm 0 LED_DS G PID_Output SH Refrigeration rag PID_Input brad Temperature_Input PIDs ioControl Ready Messages have been placed in the queue To see the message queue 1 Click the INFO WARNING or ERROR box or click the Inspect Control Engine button a s in the toolbar 2 In the Inspect Control Engine dialog box click the View Messages button Number of Messages 29 Pop First Message Clear Messages Code Severity b i 0 534 Info PET to communicate with 1 0 Unit failed lt system _INIT_IO gt N A N A EIO_C 1 0 Unit Mixed 10 192 55 63 13 06 01 09 17 04 1 444 Eror Could not send on socket lt system INITIO gt N A N A EIO_C 1 0 Unit Mixed 10 192 55 63 13 06 01 09 17 04 2 User Warning Temperature exceeds valid limit Temperature_Control 16 2 null 13 06 01 09 17 04 3 12 Error Invalid table index Temperature_Control 19 2 String_Table Table String 13 06 01 09 17 04 4 415 Error Cannot divide by zero Temperature_Control Variable_Increase_Notification 1 2 null 13 06 01 09 17 04 5 415 Eror Cannot divide by zero Temperature_Control Variable_Increase_Notification 1 2 null 13 06 01 09 17 04 amp 15 Error Cannot divide by zero Temperatu
241. box make sure the Archive tab is on top Click Archive strategy to disk when strategy is downloaded Also click During download save archive to the control engine and save strategy to flash memory Strategy Options x Archive Download I Archive strategy to disk when strategy is closed MV Archive strategy to disk when strategy is downloaded ting download save archive to the control engine ma isave strategy to flash memory Cancel Help 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 or SNAP Ultimate brain is turned off Restoring Archived Strategies from the Control Engine If original Strategy files are lost or damaged you can use ioTerminal to restore the strategy archive from the control engine to a computer 1 Click the Windows Start menu and choose Programs Opto22 io0Project Software Tools iolerminal 5 18 ioControl User s Guide WORKING WITH CONTROL ENGINES The ioTerminal window appears ioT erminal oix File Tools Configure View Help Ultimate Brain Number of control engines 1 2 Right click the control engine and choose Upload Strategy Archive from the pop up menu 3 In the Save ioControl Strategy Archive As d
242. 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 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 Save All If you choose File Save Strategy or click the Save Strategy button i 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 ioControl 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 8 17 1 With the strategy open and in Configure mode select Chart Copy 8 14 ioControl User s Guide WORKING WITH FLOWCHARTS The Copy Chart dialog box appears From mio Name Description Description Check the E Stop button and the two level alarms 2 In the From field choose the
243. broutine window and choose Center On Block from the popup menu The Center On Block dialog box appears listing all blocks in the chart Center On Block E xi BlockId Name Type Block 0 Action Increment Action Is Switch Condition Production OptoScript 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 To widen or narrow a column click the right edge of the column label and drag it horizontally Modi Delete Click and drag I D Romits 3 22 ioControl User s Guide WHAT IS OCONTROL as i To resize 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 Center On Block x BlockId Name Type 0 Block 0 Action 7 Increment Action 5 ls Switch Condition 6 Production OptoScript coca te _ e To sort by block number instead click the Block Id column l
244. button 5 press F8 or select Debug 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 autostepping continues until you stop it by pressing the Auto Step button again ioControl User s Guide 7 17 WORKING WITH STRATEGIES 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 open and in Debug mode click the Breakpoint Too button The pointer turns into a hand 2 Click the target block to mark it with the breakpoint hand Sprinklers iof x Breakpoint hand Break On in status bar l Ru
245. by using the zoom feature You can view elements at seven sizes from one eighth to eight times the normal size There are several ways to zoom e Click the Zoom In or Zoom Out buttons on the toolbar e Press the or keys on the keyboard e Right click anywhere on a chart or subroutine window to display a pop up menu Select Zoom and choose In to zoom in at twice the size Out to zoom out at half the size or Reset to return the zoom to 100 percent e From the Window menu choose Zoom In Zoom Out or Zoom Reset e To pick the zoom percentage you want click the Zoom field at the bottom right of the window and select 12 5 percent 25 percent 50 percent 100 percent the default 200 percent 400 percent or 800 percent 3 20 ioControl User s Guide WHAT IS IOCONTROL rs NOTE Zooming always takes place with reference to the center point of the window Here is a window at 50 percent zoom Oven_Inspection_Control olx The same window at 200 percent zoom looks like this Oven_Inspection_Control Set oven temperat_ 450 degrees If inspection statio 200 7 ioControl User s Guide 3 21 WHAT IS IOCONTROL 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 su
246. 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 mE 2 Ale 4 aj alee TAR OptoScript C ide XN 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 I De 100 ioControl User s Guide 11 5 USING OPTOSCRIPT 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 end 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 lt WHILELGOP gt testforthe hourn gt gt gt in standard ioControl commands the loop takes several blocks each containing one or more instructio
247. can print any flowchart To print a chart as it appears on the screen see Printing Chart or Subroutine Graphics on page 7 23 To print commands instructions for the chart see Viewing and Printing Strategy or Subroutine Commands on page 7 25 8 16 ioControl User s Guide WORKING WITH FLOWCHARTS Exporting and Importing Charts To copy a chart to another Strategy you must export it as an ioControl 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 Export The Export Chart dialog box appears Export Chart 2 In the From section of the dialog box select the chart to be exported from the Name drop down list 3 In the To section of the dialog box click Select Select Destination for Export File EAE acct Sl ee OptoControl Chart Export Files cxf 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 ioControl User s Guide 8 17 WORKING WITH FLOWCHARTS 5 Optional Enter a description for the new chart 6 Click OK The exported chart is saved You can import it into any ioControl strategy See the next section for information on importing charts Importing a Chart 1 With the stra
248. cannot delete an 0 point that is referred to in the Strategy CAUTION Be careful when deleting 0 points You cannot undo a deletion 1 With the strategy open in Configure mode expand the 1 0 Units folder on the Strategy Tree until you can see the 1 0 point you want to delete 2 Right click the 1 0 point s name and choose Delete from the pop up menu You can also delete an 0 point from the Configure 1 0 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 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 ioControl User s Guide 6 29 WORKING WITH 1 0 This guide assumes that you are already familiar with using PIDs PID calculations are complex and the physical qualities of systems suitable for PID con
249. cassstindsoinaiess 11 13 OptoScript Data Types and Variables c cccccccceccscstesestescseseseeseseeseseesescsneseseneaencase 11 14 Variable Name Conventions cccccsscsssscsssscsssscsssetsssessssseessecesssnsssesesssnetssneseseess 11 14 Using Numeric Literals ecstatic asec he cise omn de daaeicc Oe aadtacden ted 11 15 Making Assignments to Numeric Variables 0 0 cccccccceceeceesteseeteseetesesteesneseseees 11 16 USing SiN Seach satis ca seca esac acahes a E se 11 16 Working with COINS snares Se Se feds dtce ats weeeadennttte sainechvetsatesredbentsadalacsseincinemusacietles 11 17 Working with Fal M Os cnednzicenstnech eoespacensieonnteesdaciaenedtcaisenasicicentenedasegSrteateorsdherastecdes 11 18 OptoScript Expressions and Operators cccicccccscsccscescaacccsecscacsassaisedsacnssevesseanarseeecacsacsracedsed 11 19 Using Mathematical EXOreSSIONS sicsccccasescasense etsacanscetcaticancstaensed cersatsnsduateathocdnetentid 11 19 Using Comparison Operators sccicii ccctescastsiaaesenanens asl Gouna eaene 11 20 Using Logical Operators ck catenin taco iatnedcin vinnldeesavbedens Seva aes uiasaaientact 11 20 Using Bitwise Operators cc cccccadcndcas hss cccdantsstcavasesdsedsndseadtenstiidedesscasdstdestadtottadastectaranss 11 21 Precedence cst iceocacetevedeasasanincesaliusitetinetandass eandcasantacnstenence om puaceesnyiaatenauianasaaas taade 11 21 OptoScript Control Structures eee neRree ene neE Ee ErnEEy Deno eH entire Tne te ern eTnErt rn eri
250. cation Enabled Find Character in String FindCharacterInString Find Start at F Index Of String Find Substring in String FindSubstringInString Find Start at F Index Of String Float Valid IsFloatValid Float F Generate Checksum on GenerateChecksumOnString Start Value On F String String Generate Forward CCITT on GenerateForwardCcittOnString Start Value F String On String E 6 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS ns i Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Generate Forward CRC 16 GenerateForwardCrc160nString Start Value F on String On String Generate N Pulses GenerateNPulses On Time Seconds Off P Time Seconds Number of Pulses On Point Generate Random Number GenerateRandomNumber F Generate Reverse CCITT on GenerateReverseCcittOnString Start Value F String On String Generate Reverse CRC 16 GenerateReverseCrcl6OnString Start Value F on String On String Generate Reverse CRC 16 GenerateReverseCrcl16OnTable32 Start Value F on Table 32 bit Table Starting Element Number of Elements Get amp Clear All HDD Module Get ClearAllHddModuleOnLatches I O Unit F Off Latches Start Index Put Result In Get amp Clear All HDD Module GetClearHddModuleCounter I O Unit Module F On Latches Number Point Number Put Result In Get amp Cl
251. ccc ceve sakes tue ceeeertor Satta te dot cteebecmaoieed eee iene C 1 Files Related to a Sere IY ae ccciaccaccacdtiasacscetascoivatclaeeeuchidicataladaauaspreshscneuetelaaues C 1 Files Associated with a Subroutine oo ccc cecsceescssesessescsseseaseseasesesnsseeceseacsseaeseateseecanens C 2 Files in the ioControl DMECRORY sacsescssiaiesestescestacscaicaseacoichedesdlancasatedidetdesuinsiteiamianaaiaanaimeneecs C 2 Appendix D Sample Strategy savscecssavessccctecsesctecctsusesivanecosannesousstncosnececteoes D 1 UNOPS UG M SUAccsc cerns cn Sarasin cb seotcsgscassanemareneasce base oct AAA EE AEAEE AAEE anA Ennni nanana nrnna nannan D 1 Factory Schematic sce Sas acu hca ce coacacdisaa 9 cancaaad acucaescenesats lasicdeedbaapeetse ee werneetegnamaniceuamnaaae D 1 Descriptionot the FICC S ceaes ttnaansseecdsectmseedtaenscrane cbt cba otpudetes segncrsoa ensiestiadeacensenceascimntoatide D 2 Dough WSS A siacc ca cosepnc aks eeccland cadaacahiadesiecascanceaciaceace ieshic Saasucsncsaheadouncebeldbdekcesueatads D 2 CHp FeV IIS sninen veda feeds ed ste a Deaton se eestor iia D 2 UUs satee searcher laches daceas aaa a e E A T D 2 Inspection Station sssztsssceccaiscaedscdssdeastnel attests sctieataadasianiataseestassaadsesceteebscesieacetealessauaaiian D 2 OI a esnea see acne cesar pcre EE D 2 PEAVEY UO erein vances dex E T EAEN iia D 3 Reguired AM ca a Stee ee cde en E A ER D 3 Analog l 0 tease ca eek coc cent en natectene cbt sb oc ta anc baat cae deals ene ee
252. ce 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 the folder for the chart that calls it ojx Sprinkler _Control Control Engines Subroutines Included Variable Increase Notification In the Subroutines Included folder E Charts 5 E Subroutines Used Variable Increase Notification In the calling chart folder Messages g Powerup g Temperature_Control 3 Variables Numeric Variables String Variables E Pointer Variables E Communication Handles Numeric Tables String Tables Pointer Tables YO units You can view add and change variables in a subroutine from the Strategy Tree just as you would for a chart 12 12 ioControl User s Guide USING SUBROUTINES CE Ue 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
253. 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 5 Click OK The new chart is created and appears as the active window on the screen Renaming a Chart 1 Make sure the strategy is in Configure mode and that the chart you want to rename is the active window ioControl User s Guide 8 15 WORKING WITH FLOWCHARTS 2 From the Chart menu choose Rename Rename Chart Ea Description Controls sprinklers for the front lawn 3 Enter a new 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 Make sure the strategy is open and in Configure mode 2 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 3 At the confirmation message make sure you are deleting the correct chart CAUTION You cannot undo a deletion 4 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 Printing Charts You
254. chnique called multitasking also called multicharting Opto 22 SNAP Ultimate 1 0 control engines can run up to eight charts plus one host task simultaneously SNAP PAC R series and SNAP LCE controllers can run up to 16 charts plus one host task simultaneously SNAP PAC S series controllers can run up to 32 charts plus one host task simultaneously The host task is an invisible chart used to communicate to a PC which may be running ioControl in Debug mode or ioDisplay 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 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 ioControl item such as a chart an 1 0 point or a PID loop You can perform any operation on the pointer that yo
255. ck Move Numeric Table Element to Numeric Table Comment Single Line Move Numeric Table to Numeric Table Float Valid Get Length of Table Move Shift Numeric Table Elements Move to Numeric Table Element Generate Reverse CRC 16 on Table 32 bit Move to Numeric Table Elements Get Type From Name Move from Numeric Table Element Get Value From Name Comment Commands The comment commands listed above are used with standard ioControl commands in Action Blocks and Condition Blocks For information on using comments in OptoScript Blocks see page 11 28 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 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 a
256. ck 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 on page 8 5 8 4 ioControl User s Guide WORKING WITH FLOWCHARTS e n 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 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 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 e 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
257. click in the view to make it active then use the scroll bars as usual You can also zoom in the active view See page 3 20 for more information on zooming e To return the window to full view double click the split bar again or click and drag it back to the left of the scroll bar ioControl User s Guide 3 19 WHAT IS IOCONTROL e To divide a window horizontally double click the split bar at the top of the right scroll bar or click and drag the split bar down The window is split into two horizontal views of the same chart or subroutine Oven_Inspection_Control OL x ae Ge Be oa aa a ates are is out of spec set oven Moe at at ace PAG GH ets roe temperature to 200 Fr tty ais af caw ee As Ae ea fr aa A Wm i a tee wee we ee van degrees File Yeas ET hd r PE C a a E a ee j Cat anan hamnanntima ba s E Split bar is out of spec set oven temperature to 200 degrees gt 100 7 e To return the window to full view double click the split bar again or click and drag it back to the top of the scroll bar You can divide a window into four views by splitting horizontally and vertically at the same time Remember that when you split a window you are looking at multiple views of the same chart or subroutine You do not create two different charts subroutines when you split a window Zooming in a Chart or Subroutine Window You can change the scale of any chart or subroutine window
258. 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 white for digital DC input red for digital DC output yellow for digital AC input and black for digital AC output 6 18 ioControl User s Guide Module icon Expand or collapse points on the module by clicking the or sign in the box Points WORKING WITH I O Configure 1 0 Points 9 Complete the fields as described in Add Digital Point Dialog Box below 10 When you have completed the fields click OK ioControl User s Guide 6 19 WORKING WITH 1 0 The new point appears in the list Here is an example of how it might look on a SNAP 1 0 unit Configure 1 0 Points 15 x 140 Unit Sprinkler_Contral Type SNAP Mixed Ultimate 1 0 SNAP UP1 4 Modules and Points Type Featur Units Enabled Ref Count Desc a Add 34A po Shanin ca 2 5 28 VDC Digital Input Modif 00 Switch_DO Modi Delete 01 Not Used Te 02 Not Used Ie 3 Not Used Move To A Ot Not t Used EA 02 Not Used CopyTo a Enabled Counter E mi Expand All Close Help Collapse All NOTE If you need to add several similar points see Copying a Configured I O Point on page 6 26 Add Digital Point Dialog Box A Name Enter a name for the poin
259. completes the tuning When increasing the gain and integral it is fastest to just keep doubling them When the process variable starts oscillating then make smaller gain and integral changes For example start out with a gain of 0 1 and an integral of 0 1 Next try a gain of 0 2 while keeping the integral at 0 1 then a gain of 0 4 then 0 8 then 1 6 then 3 2 If the PID loop starts oscillating with a gain of 3 2 then try a gain of 2 0 or something in the middle between 1 6 and 3 2 Then make smaller changes until the best gain is found Suppose the best gain was 2 3 the next step is to keep the gain at 2 3 and then change the integral to 0 2 to 0 4 and then to 0 8 and so on until the best integral is found ioControl User s Guide 10 67 PROGRAMMING WITH COMMANDS Derivative Tuning the derivative term is not addressed in these graphs because most PID loops are fine without it Derivative in the Opto 22 implementation of the velocity PID algorithm works fine for disturbance rejection the derivative should be kept very very low However using derivative does not work well for setpoint changes because it will cause spikes in the output This is because the derivative term of the velocity PID algorithm is calculated based on the error which is the difference between the setpoint and the process variable If the setpoint changes then instantly a jump in error occurs and results in a jump in output Therefore it is best to use a deriv
260. configure the point you reference it by its number The diagram below shows the reference numbers for all 64 digital points DIGITAL 1 0 This diagram applies to Org a SNAP UP1 D64 Maan SNAP ENET D64 ah L Sure 20 O giper S faa we 2 Ed ammam O d R an EY BEE z aN zo o ultimate i o o bo m lt 4 Module position 0 L in 7 6 6 4 gt Zz L DIGITAL L 1 10 9 8 E s DIGITAL L DIGITAL L 19 18 17 16 E s DIGITAL L DIGITAL E a 27 26 25 24 M L DIGITAL k DIGITAL ee H aeren POINTS 39 38 37 36 e POIN L DIGITAL k 43 42 41 40 o MN L DIGITAL 47 46 45 44 ee manani This diagram does not apply to p m SNAP high density digital 51 50 49 48 m modules which cannot be used L n r with digital only processors p DIGITAL 59 58 57 56 o ONN F DIGITAL 63 62 61 60 L DIGITAL 6 10 ioControl User s Guide WORKING WITH I O SNAP Serial Based mistic I O Units B3000 serial SNAP B series SNAP BRS SNAP BRS is limited to 8 module racks SNAP B series mounting racks can hold either 4 8 12 or 16 Opto 22 SNAP I O modules The serial B3000 brain can use any size B series rack and both analog and digital modules It cannot use serial or high density digital modules The SNAP BRS uses standard SNAP digital modules only no high density digital and only on an 8 module rack Analog modules can be placed in any p
261. cp 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 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 returned by commands such as Transmit Numeric Table and Receive Numeric Table and close communication if there are errors If your ioControl 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 follo
262. cpy strDest Hello Test Equal Strings Equal STR Hello i stremp str1 Hello String Equal if STR Hi then if stremp str1 Hi String Equal to if STR n Hi then if stremp str1 n Hi String Table Element ioControl User s Guide 10 29 PROGRAMMING WITH COMMANDS __ u 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 following page shows how various parameters affect the string as it is converted Note the following e Some 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 10 30 ioControl User s Guide Command Convert to Siring Commands Parameters o 2 ao go 52 s amp s _ z Zo 2 S Bo 3 8 2x50 Leo E E L Eo gt gt ee e Ecos LE 55 si sc os o gt D 53I gt cs zn zo zs 8 50 5 Zu PE SH ux 2E t E o 22 4 585 e SI 6 fe 5 2 Eo gt a 2 Q E o Zo Se EED S O og Ze OSJ oO oO Oo D oo gt Ww 16 0 1 4 41800000 16 0 10 1 6e 01 1 6e 01 16 0 2 4 41800000 ha 10 1 6e 01 1 6e 01 2 16 0 1 4 C1800000 or FFFFFFFO 1 6e 01 1 6e 01 fs s L 1 23 1 4 3F9D70A4 1 2 1 1 23e 00 1
263. cript 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 oControl Command Reference and in online help List of Common Messages The following messages may appear in ioControl 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 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 1 0 unit errors see Error Handling Commands on page 10 56 and Handling 1 0 Errors Efficiently on page 4 23 Description Possible Cause Q 1 0 0 Operation performed successfully NOT AN ERROR Indicates the command was successful 1 Undefined command An unknown command was sent to the ioControl engine 2 Checksum or CRC mismatch When comparing DVFs Data Verification Fields a mismatch occurred Examples of DVFs include checksum and CRC 3 Buffer overrun or invalid length error In string manipulations a string was
264. ctstenacnccannenisteitwaamnatsiascttentineneee 10 20 Up Timer Operation ssc5ackscccazsissecd ctandad deta antandeparanoaaeiel eens Mecaieddusdcaionseniasies 10 20 Miscellaneous Commands cciccici2s35 ciccci czas sacesacacdaptapagieneidlaansdiccabeiaeeecalamannaesdanne 10 21 Comment Commands ces seece ceeses ced atcasestusiaates ascsseeveaceciaciesseteuhctaatusia inencaadeattaccnedese 10 21 Event Reaction COMMANAS cccccecccceeseesestesesestesesteseeteseetessstsssststeseetsseeteseetesssnesesneees 10 22 xii ioControl User s Guide EE ee Understanding Event Reactions mistic I O Units Only ccecceceecetesesteeeseeeeee 10 22 Why Use Event Reactions satus baci axcnsctccsaatents delicate piskiavnenacandedsteatadiaciacet 10 22 Typical Applications for Event Reactions cccccccceescesestesecssesneestetsseeteseeees 10 23 String OMNIS ec Scssrcateadrdens cortactaceeurhiacsweastecedessnseacSeahadk tussesmniestiendeeacetentasautiaceavanncee 10 23 Using Stin Senani AA 10 23 String Length and Width c lt cscescsncantseseaceachceacdactcxneeatansuesandeunaieazaceaennqsedancehanscaseainadeazae 10 24 Using Numeric Tables as an Alternative to StringS 0cccccccseseseeteseeteeeteseeen 10 24 Strings and Multitasking cscseasnccsecsescccactdctscadancamaceneameesactnctacnnensciactsmcsmocineisesaciaupentanias 10 25 Adding Control Characters to a String c cccccssesesessssestesesteseersseetesssnetesneeseees 10 25 Sample String Variable a te cr
265. cvearcacaudenndsscdtatensetstecissdumeianibeensieeacdecacans 9 24 Pasting VIN NMER cet sce sca ecto ce cesanctu acts onaaacedaniansnessoaccaseateaoneeccmuatacdseualanamacamuseaes 9 25 Configuring a Continue IIOIEI ics iccssnakzaccaccosncseaseicpssacansnesnesbeaused ouiaadaasitaptusaeisedansasiacieciapaand 9 25 Viewing and Printing Chart Instructions sciccaccscuceicssssssetieruccsscaccaneacsisaiturdnecssdscansunstioua teases 9 26 Chapter 10 Programming with CommandS sssssssssssssnnunnunnnnnnnnnnnnnnnnnn 10 1 fudge Tol ET js Woremeeerenre treme nrrsersrr srr err aaia a a 10 1 ioControl User s Guide xi So In this Chapter eat oso Sach nce antes oes web eo vboe obscene ate Se ssedbata dese uted names oopeact cece 10 1 Digital Point Commands soccer nec wisetcehenbcaaduesadabbnetsand adanetcemccacd icaadsalsndaebeenssbonttaecaaanas 10 2 States Latches and Counters ods daceeza stanzas saesteecin ec aseedaleacescn eanioneunsdebdcasuabeaneteieciexs 10 3 PL na cacao cchessses E E 10 3 COUN EFS occa occ cco cate tci sas apcensseeniecicouain scancarcatcuonsdautasbea aaemastanuce a neon anaaiing 10 3 Quadrature Counters 5 sees csncinckaceaciasiethcdasdeadhcdecanshcndiacsachsolaiavbseanesseialackackesaeieies 10 4 Totalize ecg ee rae elect cae E ecto easter ees eters 10 4 ENG SS ee e aE e ets stan E e cacwitwenestiatiatsets 10 4 VAL and AAs cis sie ene raccdttslse ce cl tt ns acciucacmnsateatedsoamanstare ts hetausanduaseivadeetsuaeaiee 10 5 Simulation
266. d Into a 1 Conveyor_Speed e variable Delete Next Block Each condition block checks for Is Conveyor_Speed Add Equal a particular To 3 en speed This one Lf sees checks for high speed 3 i Next Block Go Previous Block Instructions Conyeyor_Operation Shift to low x fi Move Add From 2 To Conveyor_Speed_Control Modity If speed is too high it is shifted down to the next level until the 4 16 conveyor is finally stopped and the box can be put on 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 Instructions Conveyor_Operation Conveyor stopped x Conveyor_Speed Add To 1 Modify possibilities within one condition Conveyor _Speed Dare block For example you could put Nest Block two Equal commands in the Previous Block same condition block and check Operator Or operator the Or operator as shown at c ae right ioControl User s Guide DESIGNING YOUR STRATEGY EE MM Using a 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
267. d in this document Pro e The Pro icon next to text indicates that a feature is available only in ioControl Professional not in ioControl Basic e Italic typeface indicates emphasis and is used for book titles Example See the oDisplay User s Guide for details e Names of menus commands dialog boxes fields and buttons are capitalized as they appear in the product Example From the File menu select Print e File names appear either in all capital letters or in mixed case depending on the file name itself Example Open the file TEST1 txt e Key names appear in small capital letters Example Press SHIFT e Key press combinations are indicated by hyphens 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 Command convention For 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 ioControl User s Guide
268. d the data In the command use the name of the FIP 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 have 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 FIP 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 10 45 which shows how FIP communication handles and file communication handles might be used together See the oControl Command Reference or online Help for detailed information on commands ioControl User s Guide 10 49 PROGRAMMING WITH COMMANDS ee 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 Configure the chFTP comm handle to log into itself The username and communication handle chAFile 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
269. de WORKING WITH I O For serial units type the unit s address valid range is 0 255 G Secondary Address Optional ioControl Professional only Ethernet based 1 0 units only To designate a secondary 0 unit for communication if this 1 0 unit is unavailable enter the secondary unit s IP address Note that both 1 0 units use the same port number H Timeout Enter the length of time the control engine should wait for a response when communicating with this I O unit Default is 1 second CAUTION For Ethernet two retries are built in 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 1 0 I Watchdog Select whether you want a Watchdog on the unit not available on remote simple 0 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 seconds With a Watchdog the 1 0 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 1 0 Points on page 6 16 Enable Communications Select whether you want communication to the 1 0 unit enabled or disabled on startup Enabled is the default Disabl
270. deacansetbcapeatedestessuiactncrtesextslcssiatwacnsesaiies 8 3 Changing the Appearance of Elements in a Chart Window ccccececeeeseseeseseetens 8 3 Configure Chart Properties Dialog BOX ccsivscsvescsenssenccssepcescutastscstivsariecceseaseaetsessei s 8 4 Changing Existing Elements to Match New Defaults 0 c cccccececeeeseseeteneeees 8 5 PMNS VOENS cccae cased cc sceecceiea secs pacaacasn aassioaccuten ianententuaneates aa ai 8 6 PUTING UG et ocak ost chechecsicasies neice saancheea eee acien wea atesds Sexdek Se aceheeieee atcrset eae nes etek 8 6 Renaming ENON Siirsin EAEE EE REA tata A 8 6 Connecting Blocks s sssissssiisssisssissniissniisssiissniisnissnrinsniinsnienaninnnnintnrinsnrinanretnrrntnrrnta n 8 7 Action Blocks and OptoScript Blocks 0ccccccceessesteteseetesteteseetesteteseensseenseeees 8 7 Condition BIOCKS iiion na ra EA 8 8 Adding TEXt eision aaia adi aiaiai 8 9 Editing Tetana A 8 10 Selecting ESI GI NS cas cxxszcireactexstus iattedioacemexncratacischcesedssdeacoreatsnia mrapitaeisstscacanessisiesnesueclen 8 10 Moving Eleme S arimena A E oneness 8 11 Moving Elements in Front of or Behind Other Elements Changing Z Order 8 11 Cutting Copying and Pasting Elements ccccccccscsesesesesteseseessseeseseesesestenesneeeaee 8 12 Deleting Elements sh ice its sessile deen Sta tacteedeadsieiecnlpalies Maukinesroedtidaadan aes daeas 8 12 Changing Element Color and Size c c cceccsccccsccsesseesceses
271. dialog box appears Name Block E xi 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 Now let s give the continue block its instructions ioControl User s Guide 2 11 IOCONTROL TUTORIAL 13 Double click the continue block to see a list of all the blocks in the chart xi Name Te 7 Drop Chips 5 Drop Dough Action 2 Speed OK Condition 0 Start Action 17 Start Conveyor OptoS cript Cancel Help 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 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 1 Double click the Drop Dough block Instructions Dough_Chip_Control Drop Dough x For animation in ioDisplay add Move From nCookieMotionPreset Modify To dtCookieMotionTimer Delete Open the dough valve Turn On Next Block doDoughDispenseValve Pre
272. ding 9 8 example 10 26 subroutine adding commands instructions 12 8 adding local variables 12 8 auto stepping 7 17 breakpoints 7 18 calling from a chart 12 10 compiling 12 9 configuring parameters 12 5 configuring parameters example 12 8 creating 12 3 data types 12 2 debugging 12 12 definition 12 1 including in strategy 12 9 list of files in C 2 parameters 12 1 pausing 7 14 printing commands 7 25 printing graphics 7 23 saving 12 9 searching 7 29 stepping through 7 15 tips 12 3 viewing 12 13 viewing all operands 7 28 viewing variables 7 26 switch statement 11 7 11 23 syntax common errors in OptoScript 11 29 in OptoScript 11 13 F 7 F 11 system requirements for ioControl 1 5 ioControl User s Guide Index 11 m aS SI T in OptoScript 11 29 table ioMessage Viewer utility A 7 commands 10 16 10 21 memory problems A 3 in OptoScript 11 18 memory problems from Online mode numeric table as alternative to strings changes 3 12 10 24 Product Support 1 4 table variable 9 4 Windows 2000 permissions A 9 adding 9 8 Oe changing 9 16 9 17 mistic PID loop 6 71 configuring 9 8 PID loop 6 64 initializing during strategy download 9 10 monitoring in a watch window 9 16 9 17 U optimizing throughput 4 23 tabs using to view windows 3 15 target address 10 15 up timers 10 20 task queue 4 21 10 17 V TCP communication handle 10 35 10 36 TCP I
273. do something End If do something begin do something end if else statement if i 2 then do something else If i 2 Then do something Else if i 2 do something if i 2 then begin do something do something else do something else end endif End If else else begin do something else do something else end if else if statement if i 2 then Te 2 if i 2 IES 2 do something do something begin elseif i gt 5 then do something else else do something else endif ElseIf i gt 5 Then do something else Else do something else End If do something else if i gt 5 do something else do something end else if i gt 5 begin do something end else else else begin do something else do something else end for loop See Note 4 for i 0 to 5 step 1 For i 0 To 5 Step 1 for i 0 i lt 5 i for i 0 to 5 do MyTable i i 2 MyTable i i 2 begin next Next MyTable i i 2 MyTable i i 2 end while loop See Note 4 while i lt 5 While i lt 5 while i lt 5 while i lt 5 do MyTable i i 2 MyTable i i 2 begin i i 1 i i 1 MyTable i i 2 MyTable i i 2 wend Wend i i 1l i s i 1 end JONJ4443H J9VYN NVY1I ldlY SOldO OptoScript BASIC c Pascal repeat loop
274. e 4 20 mA input to 0 10 V output since the output is proportional to the input D Manual Mode Setpoint Track Input If you want the setpoint to be set to the input value click Yes You can use this option to smooth the transfer when returning to automatic mode E Manual Mode Reset If you want to force the PID loop to reset when entering manual mode click Yes This option stops all calculations sets all process errors to zero and resets the scan rate timer leaving the output unchanged If you want the PID calculation to continue click No When you enter automatic mode however you cannot force a reset Mistic PID Loop Configuration Example Here s an example of a completed mistic PID configuration for a temperature controller The PID modifies an output automatically every second ioControl User s Guide 6 39 WORKING WITH 1 0 o E The input is an I O point called Oven_Temperature Its value is averaged before being applied to the PID calculation The output being driven is an 1 0 point called Oven_Temperature_Control which must remain between zero and 100 units Edit PID Loop Temperature Controlle TIC 102 Oven Temperature Controller awo Do The maximum change rate has been Oven_Temperat 170 Point set to the full range 100 which Dj v means we are allowing the output to change as much as it needs to during e fe each oyee e m The setpoint is read from the host device the controller
275. e E Close Help Command Help You can place the bit s value in a variable and test it as in the example above or you can use the bit to direct flowchart logic In the example below the Bit On command tests the bit and exits true if the bit is 1 false if the bit is 0 Instructions scan_io Read Module x Get HDD Module States Add VO Unit Uio_wHDD fi Module 5 Modify Put Result in nModuleStates Put Status in Next Block Previous aak nScanStatus nModuleStates 4 Close Help Command Help Here s another example of a command that works with all points on the module at once Suppose you want to reset the off latches on a few points on the module in rack position 4 specifically points 1 6 7 25 and 26 Using Clear HDD Module Off Latches you indicate the 1 0 unit the module number 4 and then use a bitmask to determine the off latches to clear The bitmask would be 00000110000000000000000011000010 10 10 ioControl User s Guide PROGRAMMING WITH COMMANDS As you can see in the illustration below the 1 bits in the mask will affect their respective points so off latches for point numbers 1 6 7 25 and 26 will be cleared To save space only the first 8 and last 8 off latches are shown Point Number 31 30 29 28 27 26 25 24 gt 7 6 5 4 3 2 1 0 Binary 0 0 0101 011 1 0 gt 1 1 0 0 0l0 1l0 Hex 0 6 C 2
276. e NOTE Gain is usually refined during the tuning process 0 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 I 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 SCENT of 10 x E Temperature_Control Control Engines Charts E variables E Yo units id Simple_Unit c Av Ultimate _Lnit E Points CoE Faa Main_Temp_Control EE Be BE PID loops Adding a PID Loop mistic Mistic PID loops can be configured only on B3000 brains and G4A8R bricks For PID loops on Ethernet based 1 0 units see page 6 30 1 To configure a mistic PID loop make sure you have the strategy open in Configure mode 2 On the Strategy Tree double click the 1 0 Units folder not the individual unit s icon 3 In the Configure I O Units dialog box click the PID Loops button 6 34 ioControl User s Guide WORKING WITH 1 0 a Ee The Configure PID Loops dialog box appears listing all PID loops on the 1 0 unit Configure PID Loops ax B3000_Analag Ej as Modity a Delete
277. e a factory operator to start the process intentionally We can simulate this ourselves in ioControl by manually setting the flag to a non zero value 4 Double click the bStartFlag variable on the Strategy Tree A little box appears Minimize button E Maximize button bStartFlag scanning Value fo In this dialog box you can view the variable value but you cannot change it unless you maximize the dialog box 2 22 ioControl User s Guide IOCONTROL TUTORIAL rs 5 Click the Maximize button bStartFlag scanning oe lx Name bStartFlag Type Integer 32 Variable Initialized On Download Value jo Apply _Addwatch Hep This dialog box displays current information on the variable bStartFlag You can see that the variable is initialized to zero on strategy download 6 Highlight the value zero in the dialog box and type 1 to replace it The field turns purple indicating a change has been made but not implemented 7 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 message queue Click the MFO box The dialog box that appears Cen Seren on illustrated at right shows you information about the control engine 1 Look for a light blue NEG box in BEE the status bar at the bottom of the g Device Type SNAP UP1 ADS
278. e or if the chart or subroutine was not paused elapsed time since it started running 7 20 ioControl User s Guide WORKING WITH STRATEGIES Viewing and Printing You can view and print several helpful things in a Strategy as described in the following topics e Viewing Strategy Filename and Path below e Viewing an Individual Chart or Subroutine on page 7 21 e Viewing All Charts in a Strategy on page 7 21 e Printing Chart or Subroutine Graphics on page 7 23 e Viewing and Printing Strategy or Subroutine Commands on page 7 25 e Viewing and Printing Strategy or Subroutine Elements on page 7 26 e Viewing and Printing a Cross Reference on page 7 28 e View and Print a Bill of Materials on page 7 29 For information on viewing and changing O units see Inspecting 0 in Debug Mode on page 6 51 For variables see Viewing Variables in Debug Mode on page 9 14 Viewing Strategy Filename and Path To see an open Strategy s filename and path choose File 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 Open or Subroutine 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 ioControl main window Click a tab to bring its window into view Viewi
279. e 1 0 unit recognizes them automatically Be sure to remember which module positions on the rack are occupied by HDD modules HDD modules are supported by SNAP Ethernet based I O units only For more information on using these modules in your strategy see High Density Digital Module Commands on page 10 6 Changing Point Configuration Moving a Configured 1 0 Point You can move most configured I O points to an empty point on the same 1 0 unit or on a different unit 1 With the strategy open in Configure mode double click the 1 0 Units folder on the Strategy Tree 2 In the Configure I O Unit dialog box highlight the unit the point is on and click 1 0 Points ioControl User s Guide 6 25 WORKING WITH 1 0 The Configure 1 0 Points dialog box opens For a SNAP 1 0 unit it looks something like this ioixi Type Sea Add a su oe 2 5 28 VDC Digtal Input Modify a ee Analog Output Bees f 04 Not Used Move To fi 05 Not Used eae E 06 Not Used Copy To Expand All Close Help Collapse All 3 If necessary expand the modules by clicking Expand All 4 Highlight the point you want to move and click Move To Move Point To xi 1 0 Units Lights A 00 Switch_DO Cancel Help 5 In the Points 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 1
280. e 10 62 Since PID loops are configured and tuned in Configure Mode while creating your ioControl 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 O unit or to change tuning parameters based on a change that occurs while the strategy is running such as a recipe change 10 58 ioControl User s Guide PROGRAMMING WITH COMMANDS For steps to configure and tune PIDs see page 6 29 For more information about PID loops on Ethernet based 1 0 units how to tune them and how to use them in ioControl see Opto 22 form 1410 Tutorial PID with SNAP Ultimate I O Systems Get PID Gain Get PID Output High Clamp Set PID Gain Set PID Output High Clamp Get PID Tune Derivative Get PID Output Low Clamp Set PID Tune Derivative Set PID Output Low Clamp Get PID Tune Integral Get PID Max Output Change Set PID Tune Integral Set PID Max Output Change Get PID Input Get PID Min Output Change Get PID Current Input Set PID Min Output Change Set PID Input Get PID Mode Get PID Input Low Range Set PID Mode Set PID Input Low Range Get PID Configuration Flags Get PID Input High Range Set PID Configuration Flags Set PID Input High Range Get PID Status Flags Get PID Scan Time Get PID Feed Forward Set PID Scan Time Set PID Feed Forward Get PID Setpoint Get PID Feed Forward Gain Get PID Current Setpoint Set PID Feed Forward Gain Set PID Setpoint Get
281. e 5 1 It is not necessary to separately define the second controller on your PC To configure link redundancy from the control engine to 1 0 units make sure the secondary IP address has been assigned in ioManager Then enter both the primary and secondary IP addresses when you configure the 1 0 unit see Adding an 1 0 Unit on page 6 12 Using Strategies with Link Redundancy Although clients of ioControl strategies such as ioDisplay and OptoOPCServer automatically shift to the secondary address if the primary address is not available the ioControl debugger does not In ioControl 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 you must be in Configure or Online mode Follow the steps in Changing the Control Engine that Receives the Downloaded Strategy on page 5 11 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 Changing or Deleting a Control Engine See the following topics to change or delete a control engine e Changing a Control Engine s Definition below e Changing the Control Engine that Receives the Downloaded Strategy on page 5 11 e R
282. e Configure Control Engines button on the toolbar choose Configure 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 9 12 ioControl User s Guide USING VARIABLES AND COMMANDS Download Options x Files To Download After The Strategy 3 Click Add 4 Navigate to the initialization file you created Double click the file name The file appears in the Download Options dialog box 5 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 customizing the initialization files Changing a Configured Variable You can change a variable but you cannot change a variable s type 1 To change a configured variable make sure the strategy or subroutine is op
283. e 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 of x 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 3 To create a bend or elbow in a connection click wherever you want the bend while drawing the connection ioControl User s Guide 8 7 WORKING WITH FLOWCHARTS 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 New_Chart olx 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 Bi 2 Click the source block S
284. e fields as described in Add Variable Dialog Box below 7 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 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 9 2 NETaE Le Possible Data Types Numeric Integer 32 integer 64 floating point up or down timer Numeric table Integer 32 integer 64 or floating point 9 6 ioControl User s Guide USING VARIABLES AND COMMANDS NETaE Le Possible Data Types 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 String Width This field varies depending on the variable type 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
285. e finished the mask click OK You return to the Add Event Reaction dialog box and the numerical equivalent of the mask you have set appears in the Must On Mask and Must Off Mask fields 3 In the Event and Reaction sections choose whether to display the mask in decimal hexadecimal or binary form The default is decimal 4 When the event reaction is configured click OK The new event reaction appears in the Configure Event Reaction dialog box ioControl User s Guide 6 47 WORKING WITH I O Event Reaction Configuration Example NOTE Event reactions are available on serial mistic I O units only Here s an example of an Add Event Reaction dialog box for an event reaction involving a counter Edit Event Reaction South_Packing_Station Start Off Pulse v Dropit Configure Event Reactions B3000_Digital Box_Full Counter Start OF Delete laroup 6 48 ioControl User s Guide WORKING WITH 1 0 NN M Using Event Reaction Groups mistic I O Units Only Since you can configure up to 256 event reactions on an I O unit it s useful to be able to divide them into groups of 16 By grouping related event reactions you can also take advantage of commands that start or stop scanning of all event reactions in a group Creating Groups 1 Make sure the strategy is open and in Configure mode On the Strategy Tree expand the O Units folder until you see the E Rs folde
286. e have a control engine Configuring a Control Engine Up to this point we ve been able to play around in ioControl without hardware Now it s time to configure a control engine 1 If you have an ioControl compatible control engine and I 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 1 0 units see page 1 6 For instructions to load firmware see Opto 22 form 1440 the oManager User s Guide 2 Turn the I O unit off and then back on again 3 Double click the Control Engines folder on the Strategy Tree or click the Configure Control Engine button on the toolbar The Configure Control Engines dialog box appears Configure Control Engines E xj Active Engine Engines Associated with Strategy Add Modify Delete Download Options Cancel Help Since we haven t configured a control engine yet there are no control engines in the list ioControl User s Guide 2 17 IOCONTROL TUTORIAL 4 Click Add Select Control Engine x Configured Control Engines Add Modify Delete Cancel 5 Click Add again to add a control engine The Control Engine Configuration dialog box appears Control Engine Configuration x Configure Ethernet Connection Configure control engine name and parameters Control Engine Name Settings IP Address 0 0 0
287. e integral value the larger the change in output A positive integral value is required Integral that is too low will result in undershoot Integral that is too high will result in overshoot Derivative D This term acts only on the change in slope of the input signal Its purpose is to anticipate where the input will be on the next scan based on a change in the rate of change of the input value In other words it changes the output as the input gets near the setpoint to prevent overshooting or undershooting Derivative is used in feed forward applications and in systems where the loop dead time is long Its action type is unlimited that is it has no filtering If the input signal is noisy and the derivative value is greater than zero the input value must be filtered See Input Filtering on page 10 65 for details If the slope of the input signal has remained unchanged for the last two scans the derivative has no effect Judging by the change in direction of the input the derivative contributes an appropriate value to the output that is consistent with where the input will be at the next scan if it continues at Its current rate of change The derivative is very useful in loops with a long dead time and long time constants To disable it set it to zero Integral Derivative Interaction Integral and derivative can try to move the output in opposite directions When this is the case the derivative should be large enough
288. e 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 e Pointer Commands on page 10 56 For advanced programming you can create pointers that store the memory address of a variable or some other ioControl item such as a chart an 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 e Setting Initial Values in Tables During Strategy Download on page 9 10 When you are adding table variables in ioControl 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 ioControl strategy e Using Subroutines on page 12 1 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 6 29 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 math
289. e 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 All 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 7 32 ioControl User s Guide CHAPTER 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 Chaft ccceeeseeee 8 1 Copying Renaming and Deleting Charts 8 14 Working with Chart Elements 8 2 Printing Charts ccacaccseccerassanscticacescascasceaceases 8 16 Opening Saving and Closing Charts 8 14 Exporting and Importing Charts 0 0 00 8 17 Creating a New Chart 1 With your strategy open and in Configure mode select Chart 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 Add New Chart ioControl User s Guide
290. e to G Mixed_IO_Unit od 450 degrees Points Fi diDoughLevelSwitch Ka diChipLevelSwitch SSM dilnspectionPassFailSy If inspection station sees Ka diEStop a bad cookie open reject 9 doDoughPressureCont valve for 0 5 second 9 doDoughDispenseVvaly 99 doChipDispenseValve 0 doRejectValve wy aoOvenTemperaturec nd aoConveyorSpeedCor oy aiOvenTemperature 9 aiDoughVesselPressun aa gt Cookie Watch temperature to 4 degrees On Latch i Off Latch Cr O peo O o A 18 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 2 38 ioControl User s Guide IOCONTROL TUTORIAL es i 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 JioControl Oven_Inspection_Control File Edit ControlEngine Debug Chart Subroutine Mode Tools View watch Window Help 18 x Dee sex e Oea Re GOe AH Ae Bt is EN aa f gt m tPF F 8 tr or AB QAA ch dh te ox Numeric Tables String Tables Pointer Tables 1 0 Units Set oven temperature to G Mixed_1O_Unit 450 degrees Points Ha didoughLevelSwitch Ha diChipLevelSwitch temperature to 4 degrees En dilnspectionPassFailsy If inspection station sees Fn di
291. e to download the files in the correct order for example library file then strategy file then initialization file If you need to set initial values for individual table elements on strategy download only see page 9 10 1 Click the Windows Start menu and choose Programs Opto22 io0Project Software Tools io Terminal The ioTerminal window appears toT erminal Bie File Tools Configure Yiew Help Ultimate Brain Number of control engines 1 2 Right click the control engine and choose Download Forth Files from the pop up menu 3 In the Download File dialog box click Browse 4 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 ioControl User s Guide CHAPTER 6 Working with 1 0 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 1 0 units 1 0 points and PID loops In this Chapter Choosing a Configuration Tool 6 1 Changing Point Configuration 00 6 25 About NAN siruri 6 4 Configuring PID LOOpS cece 6 29 Addressing FD Units ncccicsccscccsccss
292. e 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 ioControl 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 Command Equivalents 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 For Variables or Other Configured Items Variables I O units and points counters 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 t
293. ea erecenes ocean ced D 3 fer ice By 8 EAeeremeeneeeeereresmeere penne eres steer conreerie R en meer erm D 3 Appendix E OptoScript Command Equivalents seesseeeeeeneees E 1 ntroduction angina ctassssanienbechantantantshusass es iunnssna ixeuncuncentdacda cada ed sbnann nsquarcucenasacsnsnairaiaieaiedaa E Appendix F OptoScript Language Reference ssssseeeeseeseeeeneeees F 1 UNOS EMO ON ceca Sc aca e cae ebetpek grates sco care cate tate ike teat actadS cei ecteedaeaed F 1 OptoScript Comparison with Standard Programming Languages cetceeeeeeeeee F 1 Function GG MM A ON ss teen an chen se seD SSR ca bnhieceeats ee eton Slicated act cond dgtandoch F 2 Variable COMparison ccsspesec ncrsensateceenen stnsersdnu tak scpaopacncanc aon tute ensesacnavtahestastaeRiemnsensipnciies F 6 Notes to Experienced Programmers ccccecsscessscsssscsseseesssesssseessseesssesssseeseseessseeessnessaneess F 6 Variable Database and Other SurpriS s cccscccssseseeseeseeseseeeseseeseseeesesassneeneneeneaes F 6 ioControl s Target AUN Gs lt icescusanieatsesseathccacdeechactieacanpassasichesthcasclteurbacetdaadea aceneshelasts F 6 Language SyntaX cal tireceth cnn cetera E TEE EAA ue womadadnd F 7 OptoScript Lexical Reference aiscsiseetsitarril ak fcbdsachasiteseieyeansdbiatonnlloneaslh ahcieascntecaaiteciertannsenecs F 8 Token Syntax Legend cas ccc anncetcaactcnen tne cxptonctad acc acdant anh achuc sens cettententatdeceathe
294. eaction this set of LEDs appears below the event s on and off masks Momo Display Base Shows the display base for the MOMO event or reaction You can switch among binary hex and decimal values ioControl User s Guide 6 57 WORKING WITH 1 0 You cannot change the Internal Values or External Values of the MOMO masks or of the 1 0 unit status However other fields are the same as for other event reactions Start_Motor scanning JOf x Name Enabled e Unit Digital_IO_Unit Error None Event Type MOMO Match Reaction Type Set MOMO Outputs Event Occurring Event Occurred Scan Status Event Momo Match OnMa k 0 0 UO oO Cee eC OSGeo OffMask OF 0 O00 0000 0000 00 0 0 On and Off Masks Reaction Set MOMO Outputs OnMask OF 000 0000 0000 100 1 Oita USO So o So oS to ao Unit seus mss POPS PPPO OOOO GOSS MOMO Display Base MOMO Display base Binay Hex Decimal Apply Add Watch Help The example above shows on and off masks for both the MOMO Match event and the Set MOMO Outputs reaction 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 For PIDs on Ethernet based 1 0 units we highly recommend Opto 22 form 1410 PID Configuration and Tuning SNAP Ultimate 1 0 Learning Center Supplement which contains more detailed information
295. ead one can clearly see influences from Pascal BASIC and C ioControl s target audience is one reason internal consistency with ioControl commands and the capabilities and limitations of Opto 22 control engines are another Some aspects of OptoScript were designed to be consistent with ioControl commands For instance the bitwise and operator was named bitand in OptoScript because there is a command in ioControl 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 example 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 ioControl User s Guide F 7 OPTOSCRIPT LANGUAGE REFERENCE o OptoScript Lexical Reference Token Syntax Legend Tokens are the smallest units that the OptoScript compiler processes ka bold character specific character any character parenthesis content is treated as a unit letter any character a through z brackets set of possible items upper or lower case opt subscript item
296. ear Analog Filtered Get ClearAnalogFilteredValue From F Value Get amp Clear Analog Maximum GetClearAnalogMaxValue From F Value Get amp Clear Analog Minimum GetClearAnalogMinValue From F Value Get amp Clear Analog Totalizer Get ClearAnalogTotalizerValue From F Value Get amp Clear Counter GetClearCounter From Point F Get amp Clear Event Latches GetClearEventLatches E R Group Get amp Clear HDD Module Get ClearHddModuleCounters I O Unit Module F Counter Number Start Table Index Put Result In Get amp Clear HDD Module GetClearHddModuleOffLatches I O Unit F Counters Module Number Put Result In Get amp Clear HDD Module GetClearHddModuleOnLatches I O Unit F Off Latches Module Number Put Result In Get amp Clear HDD Module GetAllHddModuleOffLatches I O Unit Start F On Latches Index Put Result In Get amp Clear Off Latch GetClearOffLatch From Point F Get amp Clear On Latch GetClearOnLatch From Point F Get amp Restart Off Pulse GetRestartOffPulseMeasurement From Point F Measurement ioControl User s Guide E 7 OPTOSCRIPT COMMAND EQUIVALENTS ee _ _ Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Get amp Restart Off Time GetRestartOffTimeTotalizer From Point F Totalizer Get amp Restart On Pulse GetRestartOnPulseMeasurement
297. eate in ioControl is that the flowchart was designed for human beings but the ioControl 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 an ioControl 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 Even for a simple process like our sprinkler control there is no single correct way to solve the control problem and build the strategy Instead there are many possible ways The following chart shows one example Sprinklers 4 6 ioControl User s Guide DESIGNING YOUR STRATEGY Notice one of the differences between this chart and the human level chart on page 4 4 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 Optimizing Throughput on page 4
298. eating 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 a m 1 Check the day and the weather 2 If it s raining leave the 3 If it s the right day and it s dry sprinklers off turn them on 1 Check the day and the weather 2 If it s raining leave them off 3 If it s the right day and it s Read the day of the week If the hygrometer says 100 dry turn them on If it s Sunday or Wednesday read the check to make sure sprinklers If it s Sunday or Wednesday and hygrometer are off if the hygrometer says 99 or If they re on turn them off 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
299. ecaseinas 6 6 Configuring Event Reactions ccccee 6 42 Adding an VO UNit ncscias 6 12 Inspecting I O in Debug Mode 0 6 51 Adding 7 0 POMS acerina 6 16 Inspecting and Tuning PID Loops 6 58 Configuring Special Purpose Modules 6 25 Using Watch Windows for Monitoring 6 73 Choosing a Configuration Tool Configuring I O is one of your major planning steps in developing an ioControl 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 ioControl and ioManager These two tools serve different purposes but they overlap when it comes to configuring I 0 The graphic on the next page compares their functions ioControl User s Guide 6 1 WORKING WITH 1 0 ioManager Tasks ioControl Tasks Assign and change j _Configure I O configure Program and ne rea E I O Unit control engine debug control oad firmware HM i So PC running ioControl logic Configure communications i in iil can saa Si with and events AA Points the SNAP controller i 1 0 can be configured in ioControl Ethernet based 1 0 can also be configured in ioManager and imported into ioControl I O units and points must be configured to match the ioControl strategy you will run You can configure most Ethernet based 1 0 unit and point functions either in ioControl or in io
300. ecsactuscteraceatesdieundsxtiaiselrduisnamaanraraadned 6 25 Copying a Configured 0 POM orscsstscssaasatsnesnsseiensensdsatnassacsnesdatesiccttitendencavecsactncaieatas 6 26 Changing a Configured 1 0 POint ccccccececescstesestescsteseseesesceseseeseseeseseseseseeneseees 6 29 Deleting a Configured 0 Point siesta chtncdacctacie later enue aas cca Cdeehedian ata cchasceeecs 6 29 Configuring OIG fee aniser aiins 6 29 PIDs and PES IEG 2h 25 2eciccienvavaceaetnavacAicesnatelseciadiclaclachdentsctaszeteactanndhieahcmectuteins 6 30 Adding a PID Loop Ethernet 0 cccccccccccsccsesnssesessesessesesseressesessesessssnstsstsestsesetenees 6 30 Add PID Loop TANGO i aes crscnscaccstesn cstconcntacs aca tact dot Scvceacaaneiacataedhcchenscadetazonsas 6 32 Adding a PID Loop mistic cesses scat descaiscaocens anu rcsncnes nasi tdnaawaintacaseacenccertaacmnesessens 6 34 Add PID Loop Dialog Box MIStiC 0 cc ccccsceescesessssessssessseessesstsesessesessteeeennees 6 36 Setting PID Loop Control Options mistic PIDS 0c cece 6 38 PID Loop Control Options Dialog BOK stacearacccteccaxscdovnnadaideatucdancaatinitansaleriaibaens 6 39 Mistic PID Loop Configuration Example cccccccscsseseseseeceseeeseetesesteseseeseseees 6 39 Changing a PID Loop Ethernet or MiStic 0 0 cccccccscecescssesesceseeseeseeeseeseeseesescaseeseees 6 40 Deleting a PID Loop Ethernet or mistic 0 c c ccccccccssescsscessstsessceeeseeecessessstsessteeseee
301. edsernsesdasscncanesadiautactsutscasiasdsaanenndes 6 57 MOMO Event Reactions ccc ccscessccccacesssscsssnacosesssanessactscteassdessserannacsceacinesssesacee 6 57 Inspecting and Tuning PID LoOpS cccccccsccsccsscsssscessassesscessssecsssasectecsssscscsasdasseecenseaseteenesdcaces 6 58 Inspecting a PID Ethernet xaos ai ccseciscecatiaibusdsatseninsanutsivaissbatosbssessenostnabtceuiseuncssatanrenions 6 58 Determining System Lag casireis cecaijaiersiraisstcendeceadadieanadiwleekdntuaseaddeeenandeenties 6 59 Tuning a PID Loop Ethernet cccccccccccccscsccsessssessssessssesessesessesessseessteessssesessneeseneess 6 64 Inspecting a PID Loop mistic sae ce css sce acs tccerectcbecess okgndesucabcantcaiccesnbacanshanisaiceice 6 71 View PID Loop mistic Dialog c ccccccccceessssesesssessesteseeesstsesseeessttesteesteenentens 6 72 Using Watch Windows for Monitoring sici cccctccsscscieccesutsesecstestaseescorensnsstseedseseaceacencicientins 6 73 Creating a Watch WV WOW cists ectsantaniaeaane das dex csecvdvexisnaneasiusdicaadedectcatdatdanteddandidawades 6 73 Opening an Existing Watch Window accep ccc2seciascsaseshinesceshdaancd bea landeatieiiiaceadenaiaieadss 6 75 Working in Watch VU INOW Soc is cxsetcescasasdansstcsbisbisieceltnineiceacassptamcsabinsinsactestacbeceses cede 6 75 Chapter 7 Working with Strategies cccccecsseeeeseeseeseessseeseeeenensenees 7 1 MI A esta tana shennan dade ORAR EEN EEEN ER 7 1 In this Chapter ae tedsc
302. ee Alaa 5 ee Docked Strategy Tree Control Engines Subroutines Included Charts amp Alarms g Dough_Chip_Cor Dough_Vessel_Pr Oven_Inspection Powerup E variables Numeric Variables 830 bStartFlag Gl dtcookiemot k n FDoughPress kani FRampValue ea FSetpaintMin e38 nChartStatu 840 nCookieMatic 848 nLoopCounte String Variables Pointer Variables v Ea Campunir ar E ioControl Ready 2 To change 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 ioControl User s Guide IOCONTROL TUTORIAL es Opening a Chart Every control process can be planned and mapped out using one or several ioControl flowcharts or charts Because flowcharts are easy to follow ioControl strategies are easy to understand For an example let s take a look at the Dough_Chip_Control chart 1 Double click the Dough_Chip_Control chart name on the Strategy Tree You can also open a chart by selecting Chart Open and navigating to the chart name The chart appears somewhere in the large frame of the main window JioControl loj xj File Edit Configure Chart Subroutine Compile Mode Tools View Window Help DEH s Sex Mm SCS RODCOO A PAKS o Cis lHae gt umR y Aiea Ae e
303. eecareseaseseanees 5 2 Control Engine Configuration Dialog BOX sicsscaies6 cscascsesxeseteatcwnaddeteadies atantacdcebetess 5 4 Associating the Control Engine with Your Strategy cccccccccecccesestesesteeseeteseeneees 5 4 Using Network Segmenting in ioControl ou ccecesessesesescescscssescssesesnesesnsscsneseseescseesescaneaes 5 5 Using Ethernet Link Redundancy in ioControl ssciscsseteeacardeadeociece eresealachsetustentenieiarcee acd 5 6 System Architecture for Ethernet Link Redundancy ecseeccseesteestesescseseeseseenens 5 6 Ethernet Link Redundancy o4icesecczscihcstistabeasacicescdesnnsetvaiceacdaltcanaiestacaadascacseecausanconicds 5 7 Ethernet Link Computer and Software Redundancy ccccceceseseeseseeteseeens 5 8 Ethernet Link Redundancy with Serial 1 0 Units ccccsceceseeseseeseseeteeseseenens 5 9 Configuring Ethernet Link Redundancy cccccciccecciscssascccsceasdesccsctassedcestsacacceacoscoxtanacancenee 5 9 Using Strategies with Link Redundancy cc cccccstesesteesteseseeseseeseseeesestenesneneane 5 10 Changing or Deleting a Control Engine c cccceccscceseeseseseseseseseseseesesceseseesescsnesestencans 5 10 Changing a Control Engine s Definition cccsp cciiccssvatsaesack oc cedlecthomnsapsenstnediasaacexdonetebielons 5 10 Changing the Control Engine that Receives the Downloaded Strategy 00 5 11 Removing a Control Engine s Association with a Strategy ccccccceesceeeceseseseeee 5 11 Del
304. efault from the pop up menu The color size and font of all selected items change to match the flowchart defaults ioControl User s Guide 8 5 WORKING WITH FLOWCHARTS New_Chart of x oie Me Re i eH a NK ke ek He te a ge e tool you want 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 With the chart open and the strategy in Configure or Online mode click the Select tool R and click the block to select it 2 Right click the block and choose Name from the pop up menu Name Block x 3 In the Name Block dialog box type the name and click OK Renaming Blocks 1 With the chart open and the strategy in Configure or Online mode click the Select tool R and click the block to select it 2 Right click the block and choose Name from the pop up menu 3 In the Name Block dialog box change the name Click OK 8 6 ioControl User s Guide 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 NI i 2 First click the sourc
305. eger 32 Element Index Put Result in Get I O Unit Scratch Pad Get loUnitScratchPadInt32Table I O Unit F Integer 32 Table Length From Index To Index To Table Get I O Unit Scratch Pad Get loUnitScratchPadStringElement I O Unit F String Element Index Put Result in Get I O Unit Scratch Pad Get loUnitScratchPadStringTable I O Unit F String Table Length From Index To Index To Table Get ID of Block Causing Get IdOfBlockCausingCurrentError F Current Error Get Julian Day Get JulianDay F Get Length of Table Get LengthOfTable Table F Get Line Causing Current Get LineCausingCurrentError F Error Get Low Bits of Integer 64 Get LowBitsOfInt64 Integer 64 F Get Minutes GetMinutes F ioControl User s Guide E 9 OPTOSCRIPT COMMAND EQUIVALENTS ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name Get Mistic PID Control Word GetMisticPidControlWord From PID Loop F Get Mistic PID D Term GetMisticPidDTerm From PID Loop F Get Mistic PID Term GetMisticPidITerm From PID Loop F Get Mistic PID Input GetMisticPidInput PID Loop F Get Mistic PID Mode GetMisticPidMode PID Loop F Get Mistic PID Output GetMisticPidOutput PID Loop F Get Mistic PID Output Rate of GetMisticPidOutputRateOfChange From PID F Change Loop Get Mistic PID P Term GetMisticPidPTerm From PID Loop F Ge
306. elect Connection Type False Connection coa 3 Indicate whether you are drawing the True connection or the False connection and then click OK 8 8 ioControl User s Guide WORKING WITH FLOWCHARTS 4 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 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 New_Chart 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 Al When you move the mouse onto the chart a rectangle representing the text area appears Click the mouse button and type your comments If you type in more text than the text frame holds it expands in length 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 8 13 Click in another location to create another text frame or release the tool by right
307. ematical formula or algorithm that you can then adjust tune for each PID loop ioControl User s Guide 3 5 WHAT IS IOCONTROL ioControl Terminology 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 Blocks A chart is made up of action condition continue and OptoScript blocks connected by arrows which show how the process flows Sample Action Block Action block 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 blocks can have many entrances but only one exit Condition block OptoScript block Continue block Condition Block 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 be true to exit True or whether any one condition must be true to exit True Continue Block Oval shaped bloc
308. ement RepeatStatement SwitchStatement ProcedureCommand CommandProcedureNoArgs CommandProcedure ArgumentList FunctionCommand CommandFunctionNoArgs CommandFunction ArgumentList ArgumentList NumericExp ArgumentList NumericExp Stridentifier ArgumentList Stridentifier gt ObjVarldentifier ArgumentList ObjVarldentifier ioControl User s Guide F 11 OPTOSCRIPT LANGUAGE REFERENCE NumericExp NumericExp NumericExp LogicalExp LogicalUnaryExp AdditiveExp MultiplicativeExp BitwiseExp Numidentifier Numericliteral FunctionCommand LogicalExp NumericExp and NumericExp NumericExp or NumericExp NumericExp xor NumericExp NumericExp NumericExp NumericExp lt gt NumericExp NumericExp lt NumericExp NumericExp lt NumericExp NumericExp gt NumericExp NumericExp gt NumericExp gt Stridentifier Strldentifier PointerVariable null null PointerVariable null PointerTable NumericExp Pointerlable NumericExp null AdditiveExp NumericExp NumericExp NumericExp NumericExp MultiplicativeExp NumericExp NumericExp NumericExp NumericExp NumericExp NumericExp NotNumExp ObjVarldentifier gt Strldentifier BitwiseExp gt bitnot NumericExp NumericExp bitand NumericExp Numer
309. emoving a Control Engine s Association with a Strategy on page 5 11 e Deleting a Control Engine from Your PC on page 5 12 Changing a Control Engine 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 ioControl or in the ioTerminal utility 1 Choose one of the following e InioControl 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 e InioTerminal Choose Start Programs Opto 22 i0Project Software Tools iolerminal From the Configure menu choose Control Engine 5 10 ioControl User s Guide WORKING WITH CONTROL ENGINES Select Control Engine dialog box appears 2 In the 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 5 2 Changing the Control Engine that Receives the Down loaded 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 ioContro Professional
310. en a bad cookie has been found This 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 7 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 8 Click Add Add Instruction 4 xj Select Type Name OF jal Valid Types x Jan oughVesselPressure 7 Put Result in fall Valid Types 7 aoCorveyors peedControl X Cancel Help Command Heb You can use ioControl without a mouse and to demonstrate how we ll use only the keyboard to enter data in this dialog box 9 Type dec in the Instruction field ioControl User s Guide 2 29 IOCONTROL TUTORIAL 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 10 Press TAB twice to move to the Comment field Type in a comment 11 Press TAB again to move to the Type field Press the down arrow on your keyboard twice to select Integer 32 Variable 12 Press TAB again to advance to the Name field and then press the down arrow until you see nCookie_Counter 13 Press TAB again and notice that an outline appears on the OK button An outlined button mean
311. en and in Configure or Online mode 2 Ifyou 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 Edit Variable dialog box 3 Ifyou are working in a subroutine click the Configure Variables button 48 on the toolbar or choose Configure Variables In the Configure Variables dialog box double click the name of the variable you want to change 4 Inthe Edit Variable dialog box make the necessary changes and click OK ioControl User s Guide 9 13 USING VARIABLES AND COMMANDS If you need help see Adding Variables on page 9 5 or Adding Tables on page 9 8 You can also change a variable from the Configure Variables dialog box by double clicking the variable 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 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 Str
312. ennacd estiesdasiaducdarsanisenscaaincatdeddendendaskosals 10 56 NRE Y SAP HII IMSS cscs ct caciazescdsnadancecaecaatedaaenee aalanbiaasnassdin ba eiaiamiesajaaaaneansiouas 10 57 Advantages of Using Pointers scac sesccccesashenssicstarinibcetdanteetausionantacaadis te taetbenactteadesases 10 57 Referencing Objects with POInters ccccccsscsccsesesseseescsesseseesesesseseeseseescsteseseeneees 10 57 PIlD Ethernet Commands Ga accecc cca enuseapahassscmaciraiicctedtassedheaites Mommoennmadradancaiarsouiucecls 10 58 What is a PID athena estes tc eae oee sa daceecacsatice atm ace eatceeade deta teastedee Ee 10 59 PID Loops on 0 4 1 ccmemeenreneeerreten amerree cn cemrinnrsenrene errant teeter sic en Ri Repro STs 10 59 Algorithm Choices PID Ethernet 0 cccsccsescessssesessesssesessesesesessesseesessesessens 10 60 Equations Common to All Algorithms cc cececcsesessestssesteseseseseetesesteseseeees 10 61 Velocity Algorithm scat cccpccscas eased aac secsts cacansntsnanidsaes oa depeacsamnaiasatuaciialiaaueasnee 10 61 Non velocity AIQOrithims ccccescsescssssesscsccssscescscssssesssecesssesssseensaeeseseeeeseesess 10 61 PID Mistic GOMES sic sacinezaecisniachctbchandnnsclostssediaiendenideachachtcs hiedauiessitadaniaereidandss 10 62 NENG PID aae eave ctacticcecannathater avaiennaan a E ates 10 62 Using PIDs on mistic 1 0 UNIS c Leacessicccdoncontctactveansacacadctcdneastashddhicencosdaidacdessadaattatacens 10 63 Velocit
313. er elements f available in the Scratch Pad 0 599 sa B_Data SNAP_UIO_A writes data from its own SNAP_UIO_B ioControl strategy table to its own Scratch Pad area which SNAP_UIO_B can then read Meanwhile SNAP_UIO_B writes data ioControl Tables B_Shared_Data Indexes 0 59 from its B_Shared_Data table to its Scratch Pad area which SNAP_UIO_A reads Memory Map Scratch Pad Integer elements 0 599 A_Data NOTE When the SNAP Ultimate 1 0 unit is writing to its own Scratch Pad use the loopback IP address 127 0 0 1 This portion of the flowchart in SNAP_UIO_A without error checking might look like this scratch Pad Peer TT As you can see SNAP_UIO_A uses the Set 0 Unit Scratch Pad command to write the data from its own table to its own memory map SNAP_UIO_A also reads data from SNAP_UIO_B s memory map and places it in table B_Data x Instructions Scratch_Pad_Peer Write data to Scratch Pad i x Set I O Unit Scratch Pad Integer 32 Table VO Unit SHAP_UIO_A Length 600 Modify To Index 0 From Index 0 Delete From Table 4 amp _Shared_Data Put Status in Scratch_Pad_status Next Block Previous Block Instructions Scratch_Pad_Peer Read SNAP _UIO_ B data A similar flowchart would be in SNAP_UIO_B s strategy its own Scratch Pad area and reading from SNAP
314. er of conditional and action blocks 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 the fans Greater 3 Than SP01 Modify Delete Motor01 er Modify Delete Next Block Previous Block x Close Close Help Command Help ioControl User s Guide 4 19 DESIGNING YOUR STRATEGY 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 The flowchart sets initial values for the Move from Pointer Table Element Index FanCtrlindex pointers and then cycles through the pointer Or Tiii nT Modify tables to control the fans Tables have j To Pointer pMotor wi ags cp z Jet already been initialized in the Powerup chart tee Move from Pointer Table Element Index FanCtrlindex Next Block Of Table ptTemps To Pointer pTemp Previous Block Instructions FanCtrl Too Warm 1 cl p pTemp Add Greater Than Numeric Table Element At Index FanCtrlindex Modify Of Table ftSetpoints Delete Next Bloc Previous Ble EE r A iun Modify
315. er s Guide WORKING WITH STRATEGIES EE l The following table lists actions you may want to take within ioTerminal To do this Use this Add a control engine a or addce Download the specified file to the specified control engine d or download Run the strategy in the specified control engine r or run Stop the strategy in the specified control engine s or stop Show help information for this function in io Terminal h or help Start ioTerminal normally lt no arguments gt Format for lines in the batch file is as follows ioTerm control_engine_name d filename r ioTerm a control_engine_name tcp IP address port retries timeout_ms ioTerm h 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 ioTerm a MyCE tcp 10 20 30 40 22001 0 2000 ioTerm MyCE d c My_Project MyStrategy MyCE CDF ioTerm MyCE r 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 Strategy Opt
316. erminal 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 Cyrano Opto 22 FactoryFloor Optomux and Pamux are registered trademarks of Opto 22 Generation 4 ioControl ioDisplay ioManager ioProject ioUtilities mistic Nvio Nvio net Web Portal OptoConnect OptoControl OptoDisplay OptoENETSniff OptoOPCServer OptoScript OptoServer OptoTerminal OptoUtilities SNAP Ethernet 1 0 SNAP 1 0 SNAP OEM I 0 SNAP Simple 1 0 SNAP Ultimate 1 0 and SNAP Wireless LAN 1 0 are trademarks of Opto 22 Activex JScript Microsoft MS DOS VBScript Visual Basic Visual C and Windows 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 a registered trademark of Datapoint Corporation Modbus is a registered trademark of Schneider Electric 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 All other brand or product names are trademarks or registered trademarks
317. es For more information see Using 0 in OptoScript on page 11 12 High Density Digital Module Commands The following commands are used with SNAP high density digital input and output modules States Latches t HD Get HDD Module States Get HDD Module On Latches Get All HDD Module States HDD Module Off L Set HDD Module from MOMO Masks S t HDD Module Off Latches Get All HDD Module On Latches Turn On HDD Module Point All HDD M Turn Off HDD Module Point A S m Clear HDD Module On Latches Clear HDD Module Off Latches Counters Get amp Clear HDD Module On Latches Get HDD Module Counters Get amp Clear HDD Module Off Latches Get amp Clear HDD Module Counter Get amp Clear All HDD Module On Latches Get amp Clear HDD Module Counters Get amp Clear All HDD Module Off Latches About High Density Digital Modules SNAP high density digital modules can be used on 1 0 units with the following brains SNAP UP1 ADS SNAP B3000 ENET SNAP UP1 M64 SNAP ENET RTC SNAP ENET S64 High density modules cannot be used with digital only brains because they communicate with the brain as an analog or special purpose module communicates 10 6 ioControl User s Guide PROGRAMMING WITH COMMANDS Comparing SNAP High Density and Standard Digital Modules SNAP high density digital modules are different in several other ways from standard SNAP digital input and output modules e Standard digital modules contain four points per module high densi
318. es 6 41 ioControl User s Guide vii o Configuring EV Rt ROAGtIONS lt 1ccs cascacesces sxssaoctacassaraatdescecurnacassasercecansecacescensasaniceascesanae 6 42 Add Event Reaction Dialog BOX iss nc Sucrcasecacheatadtceehictiad ulleibiainslducencdlastantactic 6 43 Adding a MOMO Event or Reaction mistic 1 0 Units Only 0 00 0 6 46 Event Reaction Configuration Example cccceccccsecestescstesestescsesesesestesesesesneseaee 6 48 Using Event Reaction Groups mistic 1 0 Units Only cccceceeeccecesceseesteeeteaeeee 6 49 Creating GOUS irirna aavan ian 6 49 Deleting SO oss pscaca sedan csnctcacecagsedcascansntasvadaadaabsatacaeustentucntunencaiaauieasss 6 50 Changing Configured Event Reactions mistic 1 0 Units Only cece 6 50 Deleting Event Reactions mistic 1 0 Units Only c cccccccceccceecsesteesesteseetesteeeeees 6 51 Inspecting 1 0 in Debug WHOLE ecxeccicencts erseoenns intial iua dates Uentesite os neveeadebschesncseccatabaetics 6 51 Inspecting 0 TIMID se xcseaceeensRicaictas uctorttanastheaaaie teed iedcnesndsifoctetlaanIatetecstacidieeecdustont 6 52 Inspecting Digital 0 Points ste oczstecescehast cash cats icticedeestengainsulcasba bicediaseg hapa tana ptelsmesteas 6 53 Inspecting Analog WF ONS ve cexcecatiactcasetecticckecariachstasmstssmcenieeatbncinaadumeiane 6 54 Inspecting Event HEA IONS xcdecixteacsacesinrerinecdeerdtcantean tiedaknlntsasndaucmeuiats 6 56 View Event Reaction Dialog BOX sscccxsu steccamoansthaes
319. escscssesessesesteseaesees 4 5 Creating ioControl Charts and Adding Instructions ccccccceseecesesteseeteseeteseees 4 6 Compiling and Debugging the Strategy cccceccssesessesescesescesescssescseseeteseeeesees 4 8 Using and Improving the Strategy c cccccccscscssescssescsssseseesescesescessseseacssesseeseaesees 4 8 Basie RUES oe teeters petal can eect acca E ae 4 9 Chart UNAS NAIM Syiiran Galante reac Me Mee a aA 4 9 Naming Conventions 2 55s vnaseichecieesicunch cess scadcacsntwed peda ctnatsSondexta iecbachecichacasiey sis echccateatien 4 10 Instruction Examples a atsinacanescczabcabe wtcancus ki haadrapsics aes eqeceusd Guaantherisasakectasamaseaaaieeeaees 4 11 Creating Messages to Display On Screen cecccccessesestesesteseseeseseesesestesesteneseeeseees 4 11 Error Handli eeina Gitachesedcbacka dion asteeas 4 13 COUNTING sc pcchee cscs cacsccanscasaat ia aaaea AEN AE E 4 14 Using a Count Variable for Repetitive Actions c cceccsccceseeceseeteseeteseetesestesesteeeseees 4 15 Programming Case Sta teMENIS a vetsceciecdcatcduactdhendeaciatentiacavabsatrebendentactaencacndtdenduaces 4 16 WGI TINY Sessaceactescteacareecead eel aeosesaactansa deed anata piuauteneenctadtesiexcauatestivnesaeanianisesusdastasts 4 17 Using aU Accesses sccacea cake tc nueceetns dnc aeaaataatoaneh sca betale ee Riera raeseteaaaaiaetaeaees 4 18 Pointers and Indexing teases teectactctsds sie ind al fat elen anesfanindsd sacs atabda ad dadeatantae 4
320. eseeteseeteesneesee 12 13 Printing Subroutines cis ane Soap serustacnnctaieacmasinsasahtsnsstsdaacansaspaateactnntasaratsasacetnstssensiacceassacts 12 13 Appendix A ioControl Troubleshooting csccssseeceeeeseeeetesteeeeeenees A 1 How to Begin TroubleShOoting ccccscscsesessssessssesteseecsseecsssseessseessseessseeteseersssseeseseees A 1 1 Read Any Error Message BOK cx ccasosecatGacischaclacisbistestcsbenetesdemasnemtanteskstencicuraciestedseie A 1 2 Check Communication with the Control ENgine ccccccsseseseeseseseseseseseeseeeesees A 2 3 Check The Message Queue wcscacsclsenscdoencadsicceneinaen ces detiainaesncrastectsosiatiasdcadmateasasesseiicla A 2 4 Check Status Codes in Your Strategy oo ccccccscscesessesseseseeseseesescsteseseseseessseeneseane A 2 5 Call MMIC i NON isnin innii A 2 Strategy ProDIEMS prissione aana ea rS airasia ES A 2 If You Cannot Delete an Item cc cccsccsesceseseetesseseseesesestesssnessssssseesseetesesneseseees A 2 If You Have Memory Probbens ccscscsaiesisicaceataccacacascasaasassniptdnaicdanseapduiadaadatounacascabseniaal A 3 Archiving SEALE GIES ci aats 02s acasecaehaceneheshecidensbadsscssansacatbedandhednaaceaiaaencrasbaredixiuckeedies A 4 Do You Use Online Mode ce Sr cea eee cence eect thaalcapsebalmierte dune tectness A 4 Checking Communication with the Control ENgin cccscsescseesesestesesteseeteesneseseees A 4 Resolving Communication Problems lt aiisscacescunsis acticin
321. esize the window and use the 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 ioControl User s Guide 7 29 WORKING WITH STRATEGIES 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 1 0 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 a Strategy or one of its charts or you can search a subroutine 1 Open the strategy or subroutine and select Edit Find The Find dialog box appears Find x Search Scope Globab Chart C Local Pistaco Search For B Qperand Instruction Missing Connections C Empty Cond Blocks Close Type Name Help fal Valid Types v Button_D3 v 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 e To search for a cha
322. 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 fa set of operations is used more than once in your strategy or is used in more than one strategy you can put it 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 but a chart is simply placed in the task queue and started in turn See Chapter 12 Using Subroutines for more information e Use the text tool to type a descriptive title in each chart and add any necessary explanations Keep blocks far enough 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 ioControl 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 use the start block Block 0 for setting initial values but not for cont
323. estesesteseseeseseeseseesescsteneaeneans 8 12 Resizing Blocks or Text Blocks ic cacccscastdcatcacincasaszoaseensaessbiadathaaaes ua beacieadgcanadenrgans 8 13 Changing TENG ONOUG sce asccsdstaxaets tacustasansbistisssatnicalaarndtebnathsciviakaSmamadsene 8 13 Changing TBI ices calerotsaaiveicenccbee dec Metis tnathaapesdes darted caeiaesteientomminecaiens 8 13 Changing an Element Back to the Defaults 0 0 0 ccccesceccstenesceteseetesestesesteneaes 8 13 Opening Saving and Closing Charts ssedcaciesceccencarnesacansarann cad cnteacnaesncrastaaiacinestandnednadeatsscsues 8 14 Openinga Occ a Meeeeeereenene een ene ENa a E a Hier 8 14 savino a Charte ere a E ducsxtoasebccatadesdenieacicareeiaeistias 8 14 Closing a Chart Baca cel chenc sa engin Rice aedreere ie dneceeesonecesseedeescenieenteepecasas Sateen ded actevhveene 8 14 Copying Renaming and Deleting Charts c cccccccccsescssessescsesesesescesesesseseesesesteseseseane 8 14 Copying a Chart a tercescssesersapacaecesepnetsscoitnad eteancaesa andes nthetneshantsanaatStiacts aacwisnceeatiaeiaelies 8 14 Renaming a MAN saiesaieencacstitabrarcatceisscctane iaaandoisiati to tadeteuas Ghai uahowacduke 8 15 Deleting a Chart east ciate Sc ake Ne btdaat etic a cnet dana aaeenes ans eed 8 16 FIND gE cease hans hs eh E RE 8 16 x ioControl User s Guide EE Ee Exporting and Importing CATS sass crates cescsecatdeddsscatas suse scasteatesnasonasnamexkinsacetscaehdcracancosansindens 8 17 Exporting a Chaitan EEN
324. esume Clear In most cases the main window is blank indicating that no messages are being monitored between the PC and the active control engine In some cases for example when ioControl launches ioMessage Viewer messages should appear immediately 2 To start monitoring or change the level of monitoring choose View Monitor Levels ioControl User s Guide A 7 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 g Monitor Levels EI ioCom high level comm 1 user handle QOO0Q004 ioMwd low level 1 user handle 00000002 All ioMwd mid level 1 user handle 00000001 None Refresh Close 3 Highlight one or more of the monitor levels in the list and click Close You return to the ioMessage 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 ioMessage Viewer are automatically saved to a log file named IOSNIF LOG You can toggle saving on and off by choosing File 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 Flush File Always to send messages directly to the log file
325. et Analog Load Cell Fast Settle Level Calculate amp Set Analog Gain Set Analog Load Cell Filter Weight Set Analog Filter Weight Set Analog Totalizer Rate Minimum Maximum Values Get Analog Totalizer Value 2 Get Analog Minimum Value Get amp Clear Analog Totalizer Value Get amp Clear Analog Minimum Value Get Analog Square Root Value Get Analog Maximum Value Get Analog Square Root Filtered Value 2 Get amp Clear Analog Maximum Value Get Analog Filtered Value Get amp Clear Analog Filtered Value 1 Applies to ioControl Professional only 2 Applies to mistic 1 0 units only ioControl User s Guide 10 13 PROGRAMMING WITH COMMANDS Offset and Gain Commands The easiest way to set offset and gain is to do so when you configure Analog Points in ioManager using the Calibrate button in the Configure 1 0 Points dialog box You can also set offset and gain in ioControl 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 Set 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 m
326. et commands 10 58 PID mistic commands 10 62 pointer adding 9 5 commands 10 56 11 17 definition 3 8 9 3 10 57 in OptoScript 11 17 programming example indexing 4 19 pointer table 10 58 adding 9 8 port Ethernet 10 41 peer to peer communication 10 37 Powerup chart 3 7 uses 4 9 powerup sequencing 10 23 precedence for operators F 9 primary and secondary addresses for control engine 5 6 for 1 0 unit 6 14 printing bill of materials 7 29 chart commands instructions 7 25 chart graphics 7 23 chart instructions 9 26 page setup 7 23 subroutine commands 7 25 problems see troubleshooting Product Support 1 4 programming ioControl User s Guide Index 9 comparing OptoScript with other languages F 1 examples 4 11 in ioControl 4 1 pulse commands instructions 10 4 Q quadrature counter commands instructions 10 4 queue checking messages 5 14 B 2 quotation marks in strings 11 16 R rack for I O modules analog digital serial 1 0 units 6 7 B3000 serial brains 6 10 compatibility 6 4 digital 1 0 units 6 9 G4 B100 B200 serial mistic brains 6 12 SNAP BRS 6 10 SNAP ENET S64 6 8 SNAP UP1 M64 6 8 RAM A 3 redundant communication links 5 6 10 15 repeat loop 11 6 11 24 repetitive actions programming example 4 15 replacing elements 7 31 retrieving a directory listing 10 50 rounding 10 32 running a strategy 2 21 automatically 7 12 manually 7 12 without usi
327. eting a Control Engine from Your PG sseicsccssnccessasscecbcieseimescteasistiacdvosraacussoasedessedees 5 12 Inspecting Control Engines and the Queue ce ccsescescescscesescssescsseseasessasesestessecaneeeeseas 5 12 Inspecting Control Engines in Debug Mode c cccccccccscesescstesessesestesesteseeteseeeesees 5 12 Viewing the Message Queue oc aicisescesceccsessscascnitaneanecetnacescussnsa rast scaasittincduaeadendsatseaiess 5 14 Message Queue Information c ccccccssssesesesccssseesescseseseseseseseessseessscateecaneneans 5 16 Inspecting Control Engines from the ioTerminal Utility 0 ccc cceceececeseeesteeeeenees 5 16 Downloading Files to the Control Engine s cccstscsssecessecscsseecsaescessinestsciactvensanccsdeeceatiaesees 5 17 Archiving Strategies a cattancecctaceacusseainsacutaaechucenertisats ncpereemteneatin tens ainiesdanauemadsae 5 17 Archiving to the Control Engine cse cktcsaceseanasedtecas ctsarescesamactsets canateceduadnadandmstiennes 5 17 Restoring Archived Strategies from the Control Engine cccccccceeeceesteseeee 5 18 Downloading Files Without Opening ioControl oo cece cescesestetesceteseetesesteseseneane 5 19 Chapter 6 Working with I O s scscscecessseeseesssesesseseseseseeeseneaeeeeseseeeeees 6 1 vi ioControl User s Guide EE ee Introduction ce nceherh cite bach cctneseesch octets uscaea pie scecoxeac feceateads asses tecenckinaceedienie nat seeusameieane 6 1 Mihis Mich Me ated
328. f 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 oControl 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 ioControl User s Guide 9 21 USING VARIABLES AND COMMANDS Comment Command Arguments Highlight Here is an example of an Instructions dialog box for an action block Instructions New_Chart Block 4 Set oven to 325 degrees dd Move From 325 Mody To Oven_Temperatur Delete Hert Block ILLE Previous Block Close Help Command Help 10 To add another command click to place the highlight where you want the command to 11 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 once you can quickly move from block to block in the chart by clicking the Next
329. fault G Default To set the initial values for this 1 0 point when the strategy is run click Yes and define the value To leave the internal external values at their last state click No If communication to the point is disabled only the internal values IVALs are updated by the control engine The real world external values XVALs for inputs don t change because they are controlled by external devices The IVALs for inputs are set and will be overwritten by the XVALs unless communication to the point is disabled 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 6 24 ioControl User s Guide WORKING WITH 1 0 Ce I Enable Select whether you want communication to this 1 0 point enabled or disabled on startup Enabled is the default Configuring Special Purpose Modules Configuring a Serial Module Use ioManager to configure SNAP serial communication modules including the Profibus module Serial modules can be used with SNAP Ethernet based 0 units only See the oManager Users Guide Opto 22 form 1440 for instructions Configuring a SNAP High Density Digital Module SNAP high density digital HDD modules do not require configuration because th
330. 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 ioControl Using Tabs to View Open Windows on page 3 15 Docking Windows on page 3 17 Splitting a Chart or Subroutine Window on page 3 18 Zooming in a Chart or Subroutine Window on page 3 20 Redrawing a Chart or Subroutine Window on page 3 21 Changing Column Width in a Dialog Box on page 3 22 Sorting Data in a Dialog Box on page 3 23 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 ioControl window to move among chart windows subroutine windows watch windows and blocks you may be stepping through for debugging ioControl User s Guide 3 15 WHAT IS IOCONTROL JioControl Counter molz File Edit ControlEngine Debug Chart Subroutine Mode Tools View watch Window Help 12 x Oe sex A OLA km Eeen AH Ae e se Ha gt ln iri y se ar Al S oh He Sprinkler_Control Control Engines LEB Subroutines Included aws variables Numeric Variables faa Bad_Result 835 Count out Status String Variables E Pointer Variables Communication Handle Nu
331. g ioControl If you are creating strategies for users who do not have ioControl 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 Ultimate I 0 brain or suitable SNAP controller using just iolerminal or a DOS 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 ioControl 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 7 5 Check the boxes to have the strategy saved to flash memory 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 ioControl 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 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
332. g variable width 5 Results in 12 3 4 Sub_String2 2 2 String Building Example Strings are assembled using commands Move String Append Character to String and Append String to String Consider the following original string and the examples that follow 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 String_1 U L T I M JA TIE 1 O Move String From OPTO string literal To String_1 string variable 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 ioControl User s Guide 10 27 PROGRAMMING WITH COMMANDS 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 lt Length is s Append String to String From 22 string literal To String_1 string variable Results in 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 2 2 lt Length is gt Append Character to String From 13 integer literal carriage return To String_1 string va
333. gates it may be necessary to set the scan time several times longer than the dead time This allows reaching the setpoint with fewer moves of the gate The terms aggressive and conservative are extremely subjective and depend on the process Aggressive tuning can be thought of as tuning where the speed of reaching the setpoint is the primary concern and overshoot is tolerated to gain fast response Conservative tuning can be thought of as tuning required in a system where overshoot is not tolerated and speed of response is sacrificed to prevent overshoot The tuning suggestions given here are to achieve the fastest response with no overshoot This would be on the aggressive side of conservative tuning Tuning rules found in control textbooks such as Ziegler Nichols typically advocate quarter amplitude decay which means an overshoot that results in an undershoot that is 1 4 the amplitude of the overshoot and then an overshoot that is 1 4 the amplitude of the undershoot etc until it stabilizes on the setpoint This kind of tuning could be considered very aggressive Determining the Loop Dead Time To determine the dead time put the PID output in manual mode then set the output somewhere around midrange After the loop has achieved a steady state change the output by at least 10 of its span Measure the time in seconds that it takes the input to start responding to the change This is the dead ti
334. ge 11 24 If Statements fstatements 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 fstatements are very flexible here are several examples of ways you can use them Any numeric value can be tested by the if statement if n1 fl endif then 2 0 Complex logical operations can also be used if nl gt 3 and not nl 6 then fl 2 0 f2 6 5 endif Multiple elseif statements can be used to chain together several tests if n1 fl f2 elseif 3 elseif 3 else fl f2 3 endif The else statement is still allowed at the end gt 3 2 0 6 5 nl lt 3 8 8 nl 0 fl 2 then then then 0 0 0 Since a comparison operator returns an Integer 32 value it can be used as the test value if n1 gt 3 then fl 2 0 f2 6 5 endif An optional e1 se statement can be added if nl gt 3 then f1 92 0 f2 6 5 else f3 8 8 endif If statements can be nested Each if requires an endif if ni gt 3 fl 2 0 f2 6 5 then if nl 1 fl f2 else f3 0 endif endif ioControl User s Guide 11 21 USING OPTOSCRIPT eo Switch or Case Statements A switch or case statement also offers branching logic and can be used in place of fstatements when the expression can match one of a number of numeric values The value
335. gh all pumps to turn them on as shown in the following OptoScript example BBD Mth AGS wd E LE mca ww GB OptoScript Code Turns on 64 pumps in order for nPump_Line 5 to 6 step 1 for nPump_Number 0 to 31 step 1 nPunp_Status TurnOnHddModulePoint NE_Pump_System nPump_Line Delay 5 1 next All Points on a Module Several commands such as Get HDD Module States work with all points on a module at once by using a bitmask The least significant bit corresponds to point zero A bit with a value of 1 indicates that the corresponding point is on a bit with a value of 0 indicates the point is off Because HDD points on a module are represented and controlled through bitmasks Logical Commands such as Bit Test and Bit Clear are useful for manipulating the bits The following example reads the states of all points on the module in rack position 5 and places the bitmask in an integer variable nModuleStates To read point 4 which corresponds to bit 4 ioControl User s Guide 10 9 PROGRAMMING WITH COMMANDS you can use Bit Test The result of the bit test is placed in the variable nState If nState 1 the point is on if nState 0 the point is off Instructions scan_io Block 13 xi Get HDD Module States VO Unit Uio _wHDD Module 5 Modify Put Result in nModuleStates Put Status in nScanStatus Delete Bit Test Nest Block nModuleStates Bit to Test 4 Previous aak Put Result in nStat
336. gine 5 17 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 ioControl 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 ioControl or in the software utility ioTerminal See Associating the Control Engine with Your Strategy on page 5 4 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 control engine set to receive the download is called the active engine You must use oControl for associating the control engine with your strategy ioControl User s Guide 5 1 WORKING WITH CONTROL ENGINES Defining a Control Engine on Your PC 1 Choose one of the following e Using ioTerminal Choose Start Programs Opto 22 ioProject Software Tools iolerminal From the Configure menu choose Control Engines to open the Select Control Engine dialog box Skip to step 3
337. ging messages sent to a person e Simple Network Management Protocol SNMP traps sent to an enterprise management system 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 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 Inactive The message is not currently triggered by the event e Acknowledged lThe 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 0 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 1 0 unit For more information see individual commands in the oContro Command Reference or online help 10 54 ioControl User s Guide PROGRAMMING WITH COMMANDS I O U
338. gorithm 700 0 12 51 30 0 1 Daa v Input Axis Output Axis Time Axis pply Add Watch Save Tuning Help 6 68 ioControl User s Guide WORKING WITH I O With only a gain constant applied the input often stabilizes at an incorrect value In this heating example again setting of 30 drove the input close to the setpoint but subsequent increases failed to eliminate the offset It is time to try integral constants to eliminate the offset error The far left side of the plot shows the offset before an integral constant of 0 1 was applied This setting eliminated the offset In many applications a minor fluctuation around the setpoint is acceptable and these 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 In this example a gain setting of 30 revealed an offset error Plot 1 0 Details Misc Details IvAL ISA Algorithm 90 00 88 00 86 00 Data v Input Axis Output Axis Time Axis Y ae Input Setpoint Output Experiment with the integral constant in the Tune field type an number between 0 and 1 and click Apply Your PID may require larger numbers In this example an integral constant of 0 1 corrected the offset error Plot 1 0 Details Misc Details IVAL_
339. h 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 Replace The Find and Replace dialog box appears Find and Replace Eg m Search Scope ia Find Next Next Globa Chat L_find Newt_ Local Digital Control z Replace m Search For Replace All Operand C Instruction Close Type Name _ oe Find all Valid Types 7 Button_D3 x Help Replace With all Valid Types x Button_D3 x 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 lf you are searching a subroutine the search is Local and the subroutine s name is shown ioControl User s Guide 7 31 WORKING WITH STRATEGIES 3 Under Search For choose one of the following e Jo search for a chart an 1 0 unit or point or a variable click Operand In the Find Type and Name fields choose the operand you want to replace from the drop down list In the Replace With Type and Name fields choose the operand you want to use instead e 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 4 Click Find Next When the first occurrenc
340. hart 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 Each 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 and if they are variables they are permanently affected ioControl User s Guide 12 1 USING SUBROUTINES by the subroutine For example you could create a subroutine to add 3 0 to a passed in float variable 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 ina subroutine e Local i
341. he archive file name on the control engine is in one of the following formats Path Filename Download D02282000 1114351 zip Path Filename Online D02282000 1114351 zip The date stamp D is in the format mm dd yyyvy In the examples above the date is February 28 2000 The time stamp T is in the format hh mm ss In the examples above the time is 51 seconds past 11 43 A M Archiving to the Control Engine When you archive a Strategy to the control engine you are placing the zipped file in battery backed RAM If power to the control engine is lost the archive is still there 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 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 Follow these instructions to archive a strategy to the control engine ioControl User s Guide 5 17 WORKING WITH CONTROL ENGINES 1 In ioControl choose File Strategy Options Strategy Options x Archive Download I Archive strategy to disk when strategy is closed Jo Domna downoad save archive to the contrallenaine and Saye strategy to Nash memory Cancel Help 2 In the Strategy Options dialog
342. he pop up menu ioControl User s Guide 9 25 USING VARIABLES AND COMMANDS The Select Continue Block Destination dialog box appears listing all blocks in the chart Select Continue Block Destination x Block Id Name Type 2 Between 6 amp 7 Condition 0 Block 0 Action 4 Humidity lt 100 Condition 7 Read Hygrometer Action 5 Sprinklers off Condition 3 Sunday or Wed Condition 6 Timer expired Condition 13 Turn off sprinklers Action 11 Tum off sprinklers Action Tum on sprinkle Action 14 Wait 23 hrs Action 10 Wait 24 hrs Action 12 Wait 5 sec Action 9 Wait 60 sec Action coed ___Het 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 7 25 9 26 ioControl User s Guide Introduction CHAPTER 10 Programming with Commands Commands or instructions in ioControl are roughly grouped by function This chapter tells you what you need to know about each group in order to program your ioControl strategy effectively For detailed information on using a command see the oControl Command Reference where commands are listed alphabetically In this Chapter Digital Point Commands cccecece 10 2 High Density Digital Module Commands 10 6 Analog Point Commands cccceseee 10 13 0 Unit Commands ocd eas cts cis cscertenncses 10 15
343. he Input Axis by clicking the Input Axis menu and choosing a span setting of 1 or 5 percent 8 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 9 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 10 In the Output field type the other of your two output settings and click Apply A 20 percent increase is a moderate detectable change for most systems Your system may require a larger or a smaller change to stay within safety constraints ioControl User s Guide 6 61 WORKING WITH I O 11 Wait for a discernible change in the Input axis Plot 1 0 Details Misc Details IVAL_ Velocity Algorithm The Input axis indicated by the upper white arrow added to this picture begins to respond to the change in output lower white arrow 78 00 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 6 62 ioControl User s Guide WORKING WITH I O O p 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 ax
344. he OptoScript Editor and choosing the item from the drop down lists If the item has not yet been configured or created use the normal ioControl methods to do so For help see the topicschapters in this guide on configuring O and using variables 11 28 ioControl User s Guide USING OPTOSCRIPT i 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 Sample Statement Should Be Missing Code iTotal x y iTotal x y Ze Last operator missing a variable iTotal x y z iTotal x y Zz Semicolon missing sGreeting sGreeting First quotation mark missing on the string Hello Hello iTime Get Hours iTime GetHours Extra space in command name parentheses missing after the command 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 11 19 If you are using control structures such as loops or if statements especially if they are nested make sure all required elements are present For example every i must have a then and an endif See OptoScript Control Structures on page 11 22 for more information Type Conflicts Type conflict
345. he details of any information warning or error messages K Name and Time Name of the strategy currently running on the control engine and the date and time it was downloaded L Status Current status of the strategy M 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 page 7 4 for more information N Run Stop Buttons to start or stop the strategy This example shows the strategy running 0 Archive Information about the strategy currently archived on the control engine P Loop Time Time required to gather the inspection data from the control engine the time taken for a single transaction Q Up Time Total time that the control engine has been running since powerup R 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 ioControl status bar as shown in the following diagram 5 14 ioControl User s Guide WORKING WITH CONTROL ENGINES JioControl Counter in File Edit ControlEngine Debug Chart Subroutine Mode Tools View Watch Window Help a i Sex e Ota Ra GOO AH AR e gt a amp se ar S S oh He Sprinkler_Control of x 840 Previous_Count 4a Status 40 Total_Count String Varia
346. he word All in their title such as Get All HDD Module States work with all HDD modules on one O unit at once They do so using a table each element in the table contains a bitmask representing the data for one module For example to read the states of all points on all HDD modules on one 1 0 unit you would use the command Get All HDD Module States If the 1 0 unit consists of an 8 module rack filled with HDD modules the table would contain data such as the following Index Value Bitmask 0 00000001000101000000000110010000 Each index contains the status data for the HDD 1 module in the corresponding position on the rack A 01100001010001110000001010110010 value of 1 indicates that the point is on a value of 0 2 00000000000010000100010000000111 indicates that it is off The least significant bit in the mask corresponds to point zero on the module 3 00100000011000000010010001000100 4 01100001010001110000001010110010 5 00001110000100001100100000001001 In this example index 2 which contains the status of 6 all points on the module in slot 2 shows that points 0 ee ca coe 1 2 10 14 and 19 are on All other points on the 7 00110000011100001111100000000001 module are off 8 OO0000000000000000000000000000000 E y y The remainder of the table is zero filled since there 15 00000000000000000000000000000000 _ no more modules Returned data is only for HDD modules If the rack contained
347. her 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 If your mouse has a wheel you can also hold down the CTRL key and move the mouse wheel up or down to change the zoom ioControl User s Guide 2 25 IOCONTROL TUTORIAL After zooming out the chart looks something like this l Running Step Off Break Off ee Dough_Chip_Control You can zoom back in if you wish using the Zoom In button on the toolbar or one of the other methods The chart s status bar indicates that it is running but we can t see much happening 7 Click the Pause button f One of the command blocks appears with hatch marks 8 Now click the Step Over button T 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 Speed 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 button is clicked the chart status indicates Step On 10 Click the Pause button again to run the strategy at full speed Step Off now appears in the chart status bar 2 26 ioControl User s Guide IOCONTROL TUTORIAL rs Auto Stepping The final stepping option is auto stepping You can select this option whether
348. hicle Move String From What type of To Request Building a string using standard ioControl can require several commands Append String to String Append sVehicle To Request Append String to String Append is in stall To Request Convert Humber to String Convert Put Result in Append String to String Append To Append String to String Append To 4 A Instructions String_Handler Parse response Get Substring From String Response Start at Index 1 Hum Characters 1 Put Result in Classification Get Substring Ba Hoes From String Response If substrings or individual Start at Index characters within a string Hum Characters must be handled a standard Put Result in ioControl block can become quite large Convert String to Integer 32 Convert Model Put Result in TER Close Help Command Help 11 4 ioControl User s Guide USING OPTOSCRIPT Ue String_Handler 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 OptoScript String_Handler Build amp send request tlele al Alala OptoScript Code Request What type of plane In OptoScript code several strings and variables
349. hows 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 scope and item pointed to Pointer_A scanning x Name Pointer_A Type Pointer Variable Scope Strategy Global Item Pointed To nLoopCounter Inspect Help 2 To view the status or value of the item pointed to click the Inspect button If you need help follow the steps in Viewing Numeric String and Communication Handle Variables on page 9 14 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 9 16 ioControl User s Guide USING VARIABLES AND COMMANDS Here s an example for a string table Days_Table scanning 2 x Name Days_Table Type String Table 7 elements 9 string width Initialized On Run Table entries and their current value
350. iIOCONTROL USER S GUIDE Form 1300 060515 May 2006 OPTO 22 43044 Business Park Drive e Temecula e 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 ioControl User s Guide Form 1300 060515 May 2006 Copyright 2001 2006 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 responsibility 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 1 0 modules and solid state relays with date codes of 1 96 or later 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 applies These products include but are not limited to OptoT
351. iables and communication handles 6 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 Cross Reference You can view and print a report of every operand in your Strategy or subroutine charts 1 0 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 View Print Cross Reference 2 To view a similar report for a subroutine open the subroutine window and select Subroutine View Print Cross Reference ioControl processes the data and puts it in the Cross Reference window Save Search Print B Unit 3 hlonitoring Cross Reference TITLE Strategy Cross References STRATEGY Unit 3 Monitoring DATE 04 17 01 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 wind
352. ialog 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 ioControl User s Guide 5 19 5 20 WORKING WITH CONTROL ENGINES Downloading Files Without Opening ioControl Using the ioTerminal utility you can download ioControl 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 s file system to store data and manipulate it within your strategy see page 10 42 NOTE If you are downloading an ioControl strategy that requires other files be sur
353. ic a yellow background means Manual Click an arrow to change the mode then click Apply E Setpoint and Input plot Adjust resolution using the Input Axis button at right Click and drag on the scale to move the line F Output plot Adjust resolution using the Output Axis button Click and drag on the scale to move the line G Time axis Adjust resolution using the Time Axis button Click and drag left or right to see other times H Current status Yes on a green background means enabled No on a red background means disabled To change status click one of the arrows then click Apply I Data and Axis buttons 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 With the strategy open and in Debug mode click the New Watch Window icon in the toolbar or choose Watch New 2 In the Create New Watch Window dialog box navigate to the location where
354. icExp bitor NumericExp NumericExp bitxor NumericExp NumericExp lt lt NumericExp NumericExp gt gt NumericExp F 12 ioControl User s Guide AssignmentStatement NumericVariable NumericExp Numericlable NumericExp NumericExp StringVariable NumericExp NumericExp PtrAssignmentStatement PointerVariable Pointableldentifier PointerVariable PointerTable NumericExp PointerTable NumericExp Pointableldentifier Pointableldentifier gt null gt amp StringVariable amp NumVarldentifier amp ObjVarldentifier StrAssignmentStatement gt StringVariable StrExp gt Stringlable NumericExp StrExp gt StringVariable Stridentifier StringVariable Chr NumericExp StrExp gt StrAdditiveExp gt Stridentifier Chr NumericExp StrAdditiveExp gt StrExp StrExp Strldentifier StringVariable StringLiteral Stringlable NumericExp Numldentifier NumVarldentifier NumfTableldentifier gt StringCharldentifier NumVarldentifier NumericVariable ObjVarldentifier ChartVariable DigloUnitVariable MixedloUnitVariable Tableldentifier CommunicationHandle OPTOSCRIPT LANGUAGE REFERENCE ioControl User s Guide F 13 OPTOSCRIPT LANGUAGE REFERENCE Num Tableldentifier NumericTable NumericExp Tableldentifier NumericTable gt StringTable
355. ice the control engine is running on B Address Device s IP address C Loader Version Version of the loader software The loader is used to download firmware to the device D Firmware Version Version number of the firmware kernel loaded on the device and the date the firmware was released E Volative and Persistent RAM Amount of memory RAM available on the control engine For example a SNAP Ultimate brain has a total of 8 MB of RAM on the control side 256 KB of which is battery backed Volatile RAM shows the amount of total RAM available for use Persistent 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 F File Space Avail Space available in the control engine s file system See the joManager Users Guide for more information about the file system ioControl User s Guide 5 13 WORKING WITH CONTROL ENGINES G Device Time Current date and time recorded on the control engine H Sync time to PC Click to synchronize the control engine s time and date to that of the PC running ioControl click the Sync to PC s Time Date button I 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 on page 5 14 J View Messages Click to open the View Messages dialog box listing t
356. ick the point in the View I O Unit dialog box The small dialog box that appears shows the IVAL and XVAL e The XVAL or external value is the real or hardware value as seen by the 1 0 unit This value is external to the control engine e 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 1 0 point Sprinkler_Switch scanning l Ioj x vai M gt e If the digital point is configured with a counter the counter values appear instead of the points status Minimize button o o Maximize button ioii IVAL jo VAL j 2 To change the value or to view more information click the Maximize button ioControl User s Guide 6 53 WORKING WITH 1 0 The title bar shows the name of the digital point and whether scanning is occurring ixi Name DO_Switch Type Digital Input SNAP IDC5D 2 5 28 VDC Default Last Error None A se M E c mahn M Sa Orian Counter fo 4 Enable comm Fe 4 Close Add Watch Help Apply 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
357. ield If not highlight the one you want and click Set Active Only one control engine can be active at any time If only one control engine is listed it automatically becomes the Active Engine Your control engine configuration is complete Using Network Segmenting in ioControl 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 1 0 units are on the other To segment networks start by assigning a secondary IP address in ioManager following instructions in the oManager User s Guide The secondary IP address is used for communication through the controller s ENET2 interface Remember that this interface must be on a completely separate network segment You don t need to do anything special in ioControl 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 0 units through the other interface based upon the 1 0 unit s IP address NOTE ioDisplay Basic and other hosts on the company network cannot communicate with O units when they are on a separate network To solve this problem you can purchase ioProject Professional or ioDisplay Professiona
358. ight PID loops are available per I O unit The PID algorithm used with mistic protocol brains such as the serial B3000 and the G4A8R is the velocity PID algorithm It is an interacting type with a reverse output e Interacting means that the gain is distributed to each term in the equation Therefore if you double the gain you also double the integral and derivative terms e Reverse output means that the output increases as the input decreases The reverse output mode is used for pump up control such as maintaining level pressure and flow as well as heating For cooling or pump down control direct output is required To switch to direct simply reverse the sign of the gain For example a gain of 1 28 would become 1 28 Note that this is not negative gain The minus sign only serves to change the type of PID output from reverse to direct This velocity PID algorithm also referred to as the incremental PID algorithm is inherently anti windup since it has no summation in the integral term to saturate The algorithm is described on pages 160 162 of the book Microprocessors in Instruments and Control by Robert J Bibbero published by John Wiley and Sons Velocity PID Equation PID mistic Change in output Gain Error Last Error Integral Time Error Derivative Time Error 2 Last Error Oldest Error where e Error is Setpoint Input in Engineering Units e Time is Sc
359. imer string 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 ioControl 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 234 2 A good example of a float variable is one that stores readings from an analog input such as a thermocouple ioControl uses IEEE single precision floats with rounding errors of no more than one part per million An integer 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 O off Most integers used in ioControl 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 If you are using the 9 2 ioControl User s Guide USING VARIABLES AND COMMANDS SNAP UP1 D64 SNAP UP1 M64 or SNAP ENET D64 brains which handle digital modules in all 16 module positions you can use 64 bit integers to address the entire I O unit at once Intege
360. ine Cookie Controller Engines Associated with Strategy Set Active Modify Delete Download Options OK Cancel Help 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 10 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 ioControl User s Guide 2 19 IOCONTROL TUTORIAL Compiling the Strategy The simplest way to compile a strategy is to enter Debug mode The strategy is saved and compiled before changing modes 1 Click the Debug Mode button on the toolbar or select Debug from the Mode menu 2 In the 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 Download Warning x Warning The name and or timestamp of the strategy to be downloaded does not match the name and or timestamp of the strategy already in the active control engine Name of strategy to download Cookies Timestamp of strategy to download foe 4 04 11 13 13 Name of strategy in control engine Cookies Timestamp of strategy in control engine fost 0 04 15 51 03 Warning If you choose to continue the
361. ine Only compiled strategies can be downloaded 7 6 ioControl User s Guide WORKING WITH STRATEGIES NOTE Before you can download your strategy make sure you have downloaded the latest firmware to your control engine For instructions see the controllers users guide Compiling and Downloading in One Step NOTE If you are using Ethernet link redundancy in ioControl 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 in ioControl on page 5 6 for more information 1 With the strategy open in ioControl click the Debug Mode button on the toolbar or choose Mode Debug Changing to Debug mode automatically saves and compiles the strategy including all code in OptoScript Blocks 2 If you see a Powerup Clear Expected message click OK A download warning message may appear Download Warning x Warning The name and or timestamp of the strategy to be downloaded does not match the name and or timestamp of the strategy already in the active control engine Name of strategy to download Sprinkler_Control Timestamp of strategy to download osa 0 01 16 15 40 Name of strategy in control engine Sprinkler Control Timestamp of strategy in control engine 08706701 11 35 48 Warning IF you choose to continue the strategy that is currently resident in the control engine will be REPLACED by this strategy Continue download
362. ing communication to an O unit is the same as disabling communication to all points on the unit Changing the Baud Rate for Serial I O Units If the default baud rate shown in the Add 1 0 Unit dialog box not correct you can change it This baud rate is for communication through the RS 485 port to serial 1 0 units It does not affect other serial ports on the controller 1 Make sure the strategy is open and in Configure mode 2 From the File menu choose Strategy Options Click the Serial Port tab Strategy Options xj Archive Download Serial Port Configure the RS 485 serial port when using serial Mistic 1 0 units This will not affect control engines that do not have an RiS 485 port Baud rate Cancel Help ioControl User s Guide 6 15 WORKING WITH 1 0 3 Choose the correct baud rate from the drop down list and click OK The baud rate to serial 1 0 units is changed Changing Configured I O Units 1 To change a configured 1 0 unit make sure the strategy is open and in Configure mode 2 Find the 1 0 unit s name on the Strategy Tree Double click it to open the Edit 1 0 Unit dialog box 3 Make the necessary changes and click OK You can also change an 1 0 unit from the Configure 1 0 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
363. ing conversion functions are available for numeric tables An intermediate temporary string would be required to use string commands for these tables Strings in ioControl 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 constructed 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 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 followed by the two character hex value of the character For example to add an ACK CTRL F character enter 06 as part of the st
364. ints PIDs Description Control Engine e Strategy Tree The Strategy Tree shown at left 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 variables I O units and points and PIDs 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 Description Integer 32 Table Chart Integer 64 Table Subroutine String Table Integer 32 Variable Pointer Table Integer 64 Variable Digital 1 O Unit Float Variable Mixed I O Unit Down Timer Variable Analog Input Point Up Timer Variable Digital Input Point String Variable Analog Output Point Communication Handle Digital Output Point Float Table PID Loop te He TT ia ae 1 It Ju ig An ra Pointer Variable ioControl User s Guide WHAT IS OCONTROL aaa M Windows and Dialog Boxes in ioControl Windows and dialog boxes in ioControl
365. ioControl 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 DOWNLOAD_COMPRESSION_OFF 9 10 ioControl User s Guide USING VARIABLES AND COMMANDS Download compression removes the newlines necessary for string initialization This line tells ioControl to turn off download compression so strings can be initialized IMPORTANT Each file must end with a carriage return and each line within the file must end with a carriage return If you add comments to the file they must be preceded by a backslash and a space Text Examples NOTE Variable names are case sensitive and can include both upper and lower case letters Variables Example To set initial values of 123 for the variable INTEGER_VARIABLE 456 789 for FLOAT_VARIABLE String Variable Test String for STRING_VARIABLE and to have pointer PTR_POINTER_VARIABLE point initially to INTEGER_VARIABLE you would include the following text in the initialization file 123 INTEGER_VARIABLE 456 789 FLOAT_VARIABLE STRING_VARIABLE SIN String Variable Test String INTEGER_VARIABLE MoveToPointer PTR_POINTER_VARIABLE Integer Table Example To set initial values of 10 20 30 40 and 50 for elements zero through four of an integer table named My_In
366. ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS a Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name Bit Clear BitClear Item Bit to Clear x bitand bitnot 1 lt lt F nBitToClear Bit NOT bitnot x F Bit NOT See Bit NOT F Bit Off IsBitOff In Bit not x bitand 1 lt lt F nBitToTest Bit On IsBitOn In Bit See Bit Test F Bit OR x bitor y F Bit OR See Bit OR F Bit Rotate BitRotate Item Count F Bit Set BitSet Item Bit to Set x bitor 1 lt lt F nBitToSet Bit Shift x lt lt nBitsToShift F Bit Test BitTest Item Bit to Test x bitand 1 lt lt F nBitToTest Bit XOR x bitxor y F Bit XOR See Bit XOR F Calculate amp Set Analog Gain CalcSetAnalogGain On Point F Calculate amp Set Analog Offset CalcSetAnalogOffset On Point F Calculate Strategy CRC CalcStrategyCrc F Calling Chart Running IsCallingChartRunning F Calling Chart Stopped IsCallingChart Stopped F Calling Chart Suspended IsCallingChart Suspended F Caused a Chart Error HasChartCausedError Chart F Caused an I O Unit Error HasloUnitCausedError I O Unit F Chart Running IsChartRunning Chart F Chart Stopped IsChart Stopped Chart F Chart Suspended IsChart Suspended Chart F Clamp Float Table Element ClampFloatTableElement High Limit Low P Limit Element Index Of Float Table Clamp Float V
367. ion for use in ioControl Variable type Letter Variable type Letter 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 I 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 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 32 Literals assigned to variables nVariablel 0 Decimal Integer 64 Literals assigned to variables Integer 64s have an i64 at the end nVariable2 10 dVariablel 0164 nVariable3 123 dVariable2 10164 dVariable3 1231i164 Hexadecimal Integer 32 Literals assigned to Hexadecimal Integer 64 Literals assigned variables Hex notation starts with Ox Digits A F to variables may be upper or lower case dVariablel 0x0i64 nVariablel 0x0 dVariable2 0x10i64 nVariable2 0x10 dVariable3 nVariable3 0x12AB34CD 0x1234567890ABCDEFi64 nVariable3 0x12ab34cd Float Literals assigned to variables Floa
368. ion 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 connection 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 ioControl In ioControl there are seven types of variables numeric numeric table string string table pointer pointer table communication handle ioControl User s Guide 9 3 USING VARIABLES AND COMMANDS 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 ioControl 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 In a flo
369. ions ioControl User s Guide 7 11 WORKING WITH STRATEGIES 2 In the Strategy Options dialog box click the Download tab Strategy Options x Archive Download r Download Compression Je Eero e a E Full Slider m Flash Memory I Save strategy to flash memory after download Set autorun Hag etter dawnload Cancel Help 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 successfully Running a Strategy Manually 1 With the strategy open choose Mode Debug 2 Click the Run Strategy button gt or press F5 or select Debug Run You can also run a strategy from the Inspecting dialog box See page 5 12 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 ioControl 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 a
370. ips for Subroutines snsexscoscra texasncenscnatiseseetiuetassesssacaah cbiabcaciantactedtcsinatnseuatvoteseniaesiansne 12 3 ioControl User s Guide xv So Drawing the WAS AI scans cehehavtcebvesce cence ace acescetnddad ues ciate ale ata Sokainarenednpaesusbbcr merece senses 12 3 Configuring Subroutine Parameters aecct cisdar taeda tesla tea Piciomcdacdus Cinslaninetandacons 12 5 Configured Parameters ExAMple c cccccsesessescsesescesessesescesessssesteseansseseeseeess 12 8 Adding Commands and Local Variables ccccccsceccssesesteseesesestesessesesnesssnesesneneseees 12 8 Compiling and Saving the SUDPOUING cise descr ssnsssescaessssoeersesanactnomnatiatineatanceadiesasciadiaes 12 9 Using Subroutines cn tact ata saa cde teh ehnn cece oct oas ic vacpaate tbe cceotep eh ca eseavtcedatacesnetaciaeatgoee 12 9 Including a Subroutine in a StrateGY eccccscseccsesessesessssessesesseseasesesteseasescseeseaesees 12 9 Adding a Subroutine Instruction cstacccessesccrostechacasoscascesdsathecienscedan cescetiac srsehsahdncdeases 12 10 Debugging Subroutines ccs ccscescacastcetcetchauasceciostoniacaee ates pce tahahaabecransiecadeiomeecaaaes 12 12 Viewing and Printing Suro wt ci ci incdsedjespacestucdacieacossoneasaccncgnsecaeasea sees lanes saasazinageamaacs 12 12 Viewing Subroutines cs scscenctn sin ates sist ected tetaetschaugsincsheeuteeicshaunbeas iat etctacseuaeiasinninns 12 13 Viewing All Subroutines in a Strategy cccccceseeeeseesesteseet
371. ipt Command with Arguments OptoScript Equivalent Example amp Command Name Test Not Equal See Not Equal F Test Within Limits See Within Limits F Timer Expired HasTimerExpired Timer F Transfer N Characters TransferNChars Destination Handle Source F Handle Num Chars Transmit Character TransmitChar Character Communication F Handle Transmit NewLine TransmitNewLine Communication Handle F Transmit Numeric Table TransmitNumTable Length Start at Index F Of Table Communication Handle Transmit String TransmitString String Communication F Handle Transmit Receive String TransmitReceiveString String F Communication Handle Put Result in Truncate Truncate Value F Turn Off TurnOff Output doOutput 0 P Turn Off HDD Module Point TurnOffHDDModulePoint I O Unit Module F Number Point Number Turn On TurnOn Output doOutput 1 P Turn On HDD Module Point TurnOnHddModulePoint I O Unit Module F Number Point Number Up Timer Target Time HasUpTimerReachedTargetTime Up Timer F Reached Variable False IsVariableFalse Variable not x F Variable True IsVariableTrue Variable x F Verify Checksum on String VerifyChecksumOnString Start Value On F String Verify Forward CCITT on VerifyForwardCcittOnString Start Value On F String String Verify Forward CRC 16 on VerifyForwardCrcl6OnString Start Value On F String String Verify Reverse CCITT on VerifyReverseCcittOnString Start Value On F String S
372. is and Time axis until this information is displayed Plot 1 0 Details Misc Details IvAL ISA Algorithm Input Setpoint Output 09 33 40 0 09 0 09 34 00 0 09 34 10 0 09 34 20 0 09 34 30 0 Data Md Input Axis x Output Axis TimeAxis Y 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 Plot 10 Details Misc Details VAL Velocity Algorithm Input Setpoint 78 00 Channel 109 v Vale wy Onions EER Flip Alignment Delta ioControl User s Guide 6 63 WORKING WITH 1 0 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 Plat o Details Misc Details VAL Velocity Algorithm The Delta X cursor displays the time difference between the Input two vertical bars eo Setpoint Output Drag the first bar into position after the Output change Drag the second bar to a position just before the change in Input 14 26 00 0 Data Input Axis Y Output Axis v Time Axis Md 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
373. is optional digit one of 0123456789 no subscript item is not allowed non zero digit one of 1234567 8 9 0 subscript 0 or more items may be chosen hex digit one of 0123456789AB 1 subscript one item must be chosen CDEFabcdef 1 subscript one or more items must be chosen Literals and Names Token Name Token Syntax Comments 0 xX lhex digit1 Hexadecimal Integer 32 bit Good examples 0x12AB OX12aB 0x0 Bad examples x123ABC 0123ABC 0 Decimal Integer 32 bit non zero digit1l Good examples 0 123 7890 digit 0 Bad examples 123ABC Int32Literal no 1 Single Character Goodexamples A 1 Bad examples 0 xX lhex digit1 L Hexadecimal Integer 64 Good examples 0x12ABL OX12aBL OxOL Bad examples x123ABCL Int64Literal 0123ABCL 0 Decimal Integer 64 digitl Good examples OL 123L 7890L non zero digit0O L Bad examples 123ABCL FloatLiteral digitO digitl1 Float Literal Ee 1 Jopt Good examples 1 0 2 3 digit1 opt 1 2e6 1 2e 6 1 2e6 Bad examples 1 1 e7 le7 StringLiteral no O String Literal Confined to single line Good examples abc def Bad examples abc def F 8 ioControl User s Guide OPTOSCRIPT LANGUAGE REFERENCE Token Name Token Syntax Comments NumericVariable letter 1 letter A letter followed by mix of letters digits StringVariable digit _ 0 and underscores The name must be Char
374. is purpose but they can be configured For information see Opto 22 form 1440 the ioManager 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 Ethernet port numbers refer to http 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 ioControl User s Guide 10 41 PROGRAMMING WITH COMMANDS __ T Using the Control Engine s File System The memory in SNAP PAC and SNAP LCE controllers and in SNAP Ultimate controller brains includes a substantial area about 4 MB on a SNAP PAC S1 2 MB on a SNAP PAC R series controller or SNAP Ultimate brain and 1 MB on a SNAP LCE available for file storage Any types of files can be stored there and files can be sorted into directories or folders just as they can on aPC 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 FIP to another device on the network Note Certain FI
375. is type of event Enter this information Watchdog Timeout No information required Counter gt Value Specify the I O point to be monitored and the value to compare the Quadrature gt Value I O point against Totalize On gt Value Select the I O point from the drop down list or specify a new name Totalize Off gt Value for the point and configure it On Pulse gt Value Off Pulse gt Value Period gt Value Frequency gt Value Quadrature lt Value Frequency lt Value Counter lt Value MOMO Match See Adding a MOMO Event or Reaction mistic I O Units Only on page 6 46 For analog I O units For this type of event Enter this information Watchdog Timeout No information required Analog Input gt Value Specify the I O point to be monitored the value to compare the Analog Input lt Value I O point against and the type of comparison value current Analog Output gt Value average maximum minimum or total Analog Output lt Value Select the I O point from the drop down list or specify anew name for the point and configure it E Reaction Type From the drop down list select the reaction to take in response to the event Complete additional fields that appear as described in the following tables For digital I O units For this type of reaction Enter this information None no reaction None Enable Scan for Event Select the event from the drop down list Disable Scan f
376. it is many times faster than using Turn On or Turn Off for each point Handling I O Errors Efficiently If the control engine encounters an error when communicating to 1 0 it disables communication to the I O unit Disabling communication ensures that control engine performance is maintained If an I O timeout error occurred and communication with the I 0 unit was not disabled throughput to the remaining 1 0 units would drop significantly while the control engine tried to communicate If you use an I O error handling chart make sure there is a reasonable delay after each attempt to re enable communication to the 1 0 unit In addition for debugging purposes it is helpful if the error handling chart logs the error Investigate and correct the root cause of any I O unit communication error to maintain throughput ioControl User s Guide 4 23 DESIGNING YOUR STRATEGY 4 24 ioControl User s Guide CHAPTER 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 1 6 In this Chapter Configuring Control Engin S ccccseceeeeeeeees 5 1 Using Network Segmenting in ioControl 5 5 Using Ethernet Link Redundancy in ioControl 5 6 Changing or Deleting a Control Engin 5 10 Inspecting Control Engines and the Queue 5 12 Downloading Files to the Control En
377. ity etc was used or the string had a zero length or an invalid value was passed when setting the state of a chart running etc 44 String too short String less than 8 characters used to read time X 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 46 Invalid string String not 8 characters long when setting time or invalid X format when setting date or invalid communication handle string or comm handle command such as a missing colon 47 Invalid connection Device drivers might be Attempted to open an already open connection X missing or not loaded running 49 No more connections are available No more sessions available for Ethernet maximum is 32 X Maximum number of connections already in use 50 Open connection timeout Could not Unable to open a connection in time X establish connection within the timeout period 52 Invalid connection not opened Attempted to close a connection that wasn t opened X Communication handle may have been closed by a previous command that failed 57 String not found Substring not found in the string being searched ioControl User s Guide B 5 So Description Possible Cause Q 1 0 58 No data received Attempted to read an empty buffer or a connection with no X or characters waiting or the I O unit may be turned off or Character not fo
378. k 2 Add the variable value by converting it to a string and appending it to the string you just created Append String to String Append Current_Temp_String To Current_Temp_Message Append String to String 3 If needed append another literal kond p string To Current_Temp_Message 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 Current_Temp_Message Current temperature Current_Temp_String Ep hs OptoScript can be more efficient for string handling than standard ioControl commands See Chapter 11 Using OptoScript for more information 4 12 ioControl User s Guide DESIGNING YOUR STRATEGY EE l 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 An 1 0 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 You can easily build a simple error handling chart like the one shown below which automatically checks errors and other messages and takes action based on the type of error This chart for example checks for 1 0 unit errors Suppose a remote 1 0 unit loses power for a few seconds and then the power comes back on When the power is lost communica
379. kept Archive files are date and time stamped and zipped for compact storage We recommend you archive both to the computer during strategy development and to the control engine when the strategy is completed Archiving to the Computer Archiving strategies to the computer is an excellent way to track changes over time and to produce a zipped file you can copy to another computer or disk for backup Archives are always ioControl User s Guide 7 5 WORKING WITH STRATEGIES 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 ioControl offers three ways to archive strategies to the computer e To make an archive at any time choose File 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 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 Strategy Options In the Strategy Options dialog box click Archive strategy to disk when strategy is downloaded The archive file name will be in one of the following formats Archive method File name format Manual archive or archive when strategy is closed Path Filename Archive D0228200
380. ks 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 3 6 ioControl User s Guide WHAT IS IOCONTROL rs OptoScript Block 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 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 eye or outputs such as a pump External Value The external value XVAL is the real world value measured or set by an 1 0 point The ioControl strategy reads and writes only to internal values and transfers internal values to external values if the associated 0 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 Each chart controls one aspect of the strategy one piece of the auto
381. l Control Engines i Subroutines Inc E Charts Variables E Numeric va io h String Varie Pointer var E Communica E Numeric Ta String Tabh i i Pointer Tat H E Yo Units e To change the docked position click and drag the window s title bar to any edge of the main window e To change the docked window s width or height click and drag the edge of its frame in the direction you want e To free the window from its docked position click the docking button J in its title bar Splitting a Chart or Subroutine Window In chart and subroutine windows you can split the view of a window to see two horizontal views two vertical views or even four views of the same chart or subroutine You can scroll around within each view to compare parts or to copy and paste elements Splitting is especially useful for large charts and subroutines 3 18 ioControl User s Guide WHAT IS OCONTROL Split bars appear at the top of the right scroll bar and at the left of the bottom scroll bar Oven_Inspection_Control iof x Split bar is out of spec set oven temperature to 200 degrees Split bar 100 7 e To divide a window vertically double click the split bar at the left of the bottom scroll bar or click and drag the split bar to the right The window is split into two vertical views of the same chart or subroutine Oven_Inspection_Control Split bar fioo 7 e To scroll in any view
382. l and OptoOPCServer version 7 0 and newer separately ioControl User s Guide 5 5 WORKING WITH CONTROL ENGINES these applications support network segmenting by communicating with I O units through the controller Using Ethernet Link Redundancy in ioControl In ioControl Professional you can configure a secondary control engine IP address for Ethernet link redundancy in case communication to the primary address fails The secondary address can be the second Ethernet network interface on a SNAP PAC controller or a separate controller If it is the second Ethernet network interface on a SNAP PAC controller you must assign the secondary IP address in ioManager in order to communicate with it See the ioManager User s Guide for instructions NOTE If you use a separate controller for link redundancy be aware that coordinating strategy data on two controllers can be difficult and no automatic method for doing so is available Using a separate controller for monitoring over a redundant link is usually less difficult to coordinate than using a separate controller for control over a redundant link The two Ethernet interfaces on a SNAP PAC controller are ideal for adding redundant Ethernet network links to your control system An ioDisplay Professional project or OptoOPCServer for example can be set up to use the primary and secondary addresses to access data from the ioControl strategy running on the control engine If the primary address is
383. l just duplicates the existing pointer The following table lists the objects that pointers can point to Digital Objects Analog 1 0 Units NETEE Le Other Objects Objects Digital Input Analog Input SNAP ENET D64 Integer Variable Chart Digital Output Analog Output SNAP UP1 D64 Float Variable Counter SNAP B3000 ENET String Variable Quadrature SNAP ENET RTC Pointer Variable Counter SNAP UP1 ADS Down Timer Variable SNAP UP1 M64 Up Timer Variable SNAP ENET S64 Integer Table Float Table String Table Communication Handle 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 A 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 ioControl User s Guide 10 57 PROGRAMMING WITH COMMANDS Once the initial value is se
384. l_Process Not Used 003 Fil_Process Not Used Delete Fill_Process Not Used v Fill Process Not Used iie Delete Group Close Help Deleting Groups When you delete a group you re deleting only the group name not the event reactions that were assigned to the group To delete a group name in the Configure Event Reaction dialog box select any event reaction in the group and click the Delete Group button The group name is removed from all 16 event reactions in the group and the selected event reaction appears at the top of the list box Changing Configured Event Reactions mistic I O Units Only You can change an event reaction 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 O Units folder until you see the E Rs folder for the 1 0 unit you want Double click the E Rs folder 6 50 ioControl User s Guide WORKING WITH 1 0 a i The Configure Event Reaction dialog box opens listing all configured event reactions T Configure Event Reactions ToT Type B3000 SNAP Number Group Name Name Event Reaction 000 Fill Process Box_Full Counter Start Of O 001 Fill Process Not Used 002 Fill Process Not Used 003 Fill Process Not Used Fill Process Not Used Fill Process Not Used Add Modify Delete Name Groups Delete Group Up and down arrows Event reac
385. larm else Oven_Alarm 0 Clear the oven alarm endif pa Oo ORA fioo OptoScript code OptoScript block When To Use OptoScript You ll want to use OptoScript for some common programming tasks that can be more difficult to do using standard ioControl 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 e for combining math expressions loops and conditions 11 2 ioControl User s Guide USING OPTOSCRIPT ee 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 Here s an example of a mathematical expression in OptoScript integerl integer2 2 floatl float2
386. lds as described in Add I O Unit Dialog Box below Add I O Unit Dialog Box A Name Enter a name for the 1 0 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 Select the type of 0 unit from the drop down list Brain model numbers are listed in parentheses to help you determine which type to choose D Fahrenheit Celsius Analog and Mixed units only Choose whether temperatures will be handled in Fahrenheit or Celsius E Port For Ethernet based 1 0 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 If you need to change the baud rate see Changing the Baud Rate for Serial 1 0 Units F Primary Address For Ethernet 0 units type the IP address of the brain attached to the 0 unit If the unit is local the same SNAP Ultimate brain on which the strategy will run use 127 0 0 1 as the IP address This is a loopback address it 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 1 0 unit 6 14 ioControl User s Gui
387. le s value remains the same until one of the following events occurs e A strategy with a different name is downloaded e The RAM memory on the controller is cleared e Anew firmware kernel is downloaded to the controller 9 4 ioControl User s Guide USING VARIABLES AND COMMANDS e The persistent object is changed in some way for example the length of a persistent table changes 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 in Data Types for Subroutines on page 12 2 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 9 8 1 With the strategy or subroutine open in Configure mode click the Configure Variables button
388. lect Subroutine 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 click the Include Subroutines button on the toolbar or select Configure Subroutine Included The Subroutine Files dialog box appears listing all subroutines currently included in the strategy The example below shows no subroutines currently included Subroutine Files Sprinkler_Control x Name Ref Count Add Remove Cancel Help ioControl User s Guide 12 9 USING SUBROUTINES 2 Click Add Select Subroutine File E 21 x Look in E Subroutines z e 0 c A Variable Increase Notification isb File name J Files of type ioControl Subroutine Files isb aa Cancel h 3 Navigate to the directory containing the subroutine you want to add and double click the subroutine Subroutine Files Sprinkler_Control x Name Ref Count Add C Program Files Opto22 ioProject S oftware Examples Subroutines Variable Atte FEMGVE Cancel Help 4 When the full path to the subroutine appears in the Subroutine Files
389. led Event Reaction Group Communication Enabled IVAL Set 1 0 Unit from MOMO Masks IVAL Set Off Pulse IVAL Set On Pulse IVAL Set Off Totalizer 2 IVAL Set On Totalizer IVAL Set TPO Percent IVAL Set TPO Period IVAL Set Period IVAL Set Frequency IVAL Set Mistic PID Control Word 2 IVAL Set Mistic PID Process Term 1 ioControl Professional only 2 mistic 1 0 units 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 oControl Command Reference or online Help ioControl User s Guide 10 69 PROGRAMMING WITH COMMANDS 10 70 ioControl User s Guide CHAPTER 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 ioControl Modeled after computer languages such as C and Pascal OptoScript code gives you an alternative to using standard ioControl commands 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 s
390. ll y x lt gt 0 Or y lt gt 0 a Or b booleans only a Or b booleans only logical AND x and y x lt gt 0 And y lt gt 0 x amp amp y x lt gt 0 And y lt gt 0 x And y booleans a And b booleans only only logical XOR x xor y x lt gt 0 Xor y lt gt 0 Not available x lt gt 0 Xor y lt gt 0 x Xor y booleans a Xor b booleans only only logical NOT not x Not x lt gt 0 Vx Not x lt gt 0 Not b booleans only Not b booleans only logical expressions x gt 0 and y 3 x gt 0 And y 3 x gt 0 amp amp y 3 x gt 0 and y 3 not x gt 0 or not Not x gt 0 Or y lt gt x gt 0 II y 3 not x gt 0 or y lt gt 3 y 3 3 bitwise NOT bitnot x Not x x not x bitwise OR See Note 3 x bitor y x Or y x y x or y bitwise AND x bitand y x And y x amp y x and y bitwise XOR x bitxor y x Xor y x y x xor y bitwise shift left x lt lt y Not available x lt lt y x shl y bitwise shift right x gt gt y Not available x gt gt y x shr y JONIYAIFY JOVNONVI LdlYOSOLdO t d IPIND S 43SM 01 U0901 OptoScript BASIC C Pascal bitwise expressions i x bitand i x And amp H0000FFFF i x amp 0x0000FFFF i x and amp 0000FFFF Ox0000FFFF Not available i x lt lt i 2 i x shl i 2 i x lt lt i 2 if statement if i 2 then If i 2 Then if iss if i 2 then do something endif
391. lue and set the totalizer back to zero use the command Get amp Clear Analog Totalizer Value Analog Points and OptoScript Code In OptoScript code an analog 1 0 point 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 1 0 in OptoScript on page 11 12 I O Unit Commands The following commands are used to communicate with an 1 0 unit which controls a group of I 0 points I O Unit Ready Get I O Unit as Binary Value Set 1 0 Unit from MOMO Masks 2 IVAL Move Numeric Table to I O Unit Move 1 0 Unit to Numeric Table Move Numeric Table to 1 0 Unit Write I O Unit Configuration to EEPROM Get Target Address State Set Target Address State Set All Target Address States 1 ioControl Professional only 2 mistic 1 0 units only CAUTION Write 1 0 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 using ioManager see the ioManager User s Guide for instructions or using ioControl in Debug mode see page 6 52 Commands for Ethernet Link Redundancy The three target address commands Get Target Address State Set Target Address
392. m memory Checking Communication with the Control Engine You can test communication with the control engine by using the ioTerminal utility 1 From the Start menu choose Programs Opto 22 i0Project Software Tools io Terminal The ioTerminal window appears showing all control engines configured on your system ioT erminal iOi x File Tools Configure View Help Ultimate Brain Number of control engines 1 2 If no control engine is listed configure one by choosing Configure Control Engine and following directions on the screen See Configuring Control Engines on page 5 1 for help A 4 ioControl User s Guide a 3 To 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 5 12 4 Ifyou receive an error indicating a communication problem go on to the next section Resolving Communication Problems Matching ioControl Configuration to the Real World I O unit and point configuration in ioContro must match actual I O units and points with which the
393. mated process Together all the charts constitute the strategy The total number of charts in a strategy is limited only by 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 chartis inactive Every chart in an ioControl 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 on page 3 8 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 v
394. me Tuning The tuning guidelines below are followed by a series of graphs showing the effects of implementing various multiples of the optimal gain and integral The optimal gain and integral are multiplied by 2 too high and 0 5 too low and every combination of these tuning parameters is shown on the graphs Comparing actual PID loop performance with these graphs can usually identify what adjustments are necessary to improve the tuning of the actual PID loop It is important to use a graphical tool like ioDisplay to assist in the tuning process Note that the graphical PID tuner in ioControl cannot be used for tuning mistic PID loops 10 66 ioControl User s Guide PROGRAMMING WITH COMMANDS These graphs and guidelines are just generalizations They won t be valid in all possible cases they are just a guide to help These tuning guidelines can be used both to solve tuning problems in an existing loop or as a help to start tuning a new loop IMPORTANT NOTE Textbook tuning rules such as Ziegler Nichols tuning methods DO NOT work for tuning the velocity PID algorithm Solving Tuning Problems Oscillations Oscillations can be caused either by gain that is too high or integral that is too high If the process variable oscillates below the setpoint it is probably caused by the gain being too high If it oscillates at the setpoint it is not possible to know by looking at the graphs which tuning parameter is causing the pr
395. meric Tables String Tables Pointer Tables 5 10 Units R UIO_A Paints ER DO_Switch DF Alarm S PID_Output gt C Program Files Opto22 ioProject Software In Prog White tabs show where you are when stepping through a chart or Gray tabs show open windows Click subroutine a tab to bring its window into view 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 3 16 ioControl User s Guide WHAT IS IOCONTROL Ue aod E File Edit ControlEngine Debug Chart Subroutine Mode Tools View watch Window Help la x Dae t sex m SCSE Ik maGeevAlP aes He Sfe gt a PPPS 8 lor lt Ale A ok dh E xi Sprinkler_Control fF Control Engines Subroutines Include H Variable Increas Charts amp Counter amp Messages Powerup amp Temperature_C variables Numeric Variable fean Bad_Result 832 Count 32 New_Count 840 Previous_C 840 Status e ECC Creme eer X 38 Total_Cou 4 of String Variables Pointer Variable Running Step On Break Off 0 000 Sec froo Communication 4 4 gt Pf Chart A Action Block increment Counter Id 7 Subroutine Varia
396. mize throughput Understanding ioControl Multitasking When SNAP controllers run ioControl strategies they can multitask or run several tasks at once The total number depends upon the controller you use e A SNAP PAC S series controller can run up to 33 tasks 32 flowcharts plus the host task e A SNAP PAC R series or SNAP LCE controller can run up to 17 tasks 16 charts plus the host task e A SNAP Ultimate brain can run up to 9 tasks at once 8 charts plus the host task Total tasks include e Host task which is a vehicle for communicating with a PC e Powerup Chart e Any other chart or subroutine in your strategy that is running or suspended A subroutine assumes the time slice of the chart that called it The tasks are not actually run simultaneously each task gets a small amount of time before the control engine moves to the next task in the queue If a task is finished before its time is up the control engine moves to the next task sooner For example a suspended chart uses no time even though it is counted as a task Host Task The host task functions as a slave which means it never originates messages but only responds to inquiries or commands The host task runs by default but it only uses time when there is communication to the controller The host task must be used to download new firmware to the control engine ioControl User s Guide 4 21 DESIGNING YOUR STRATEGY Optimizing PC to Control Engine Thr
397. mp Hold Value field also appears in this area together with its internal and external values You can change any of the internal or external values If you do click Apply F Event Parameters Parameters of the event together with their internal and external values This example shows an O point being monitored for the event For a MOMO Match event MOMO data will appear instead See MOMO Event Reactions on page 6 57 You can change the internal or external values If you do click Apply G Reaction Parameters Parameters of the reaction together with their internal and external values This example shows the PID to be activated and the sources of its input output and setpoint values We also see the internal and external values of the input output and setpoint Depending on the reaction type other parameters that can appear here include an I O point an event to be triggered or MOMO data You can change any of the internal or external values If you do click Apply MOMO Event Reactions When a MOMO must on must off event or reaction is involved the bottom of the event reaction dialog box displays the following On and Off Masks Shows On and Off Masks for the MOMO event and reaction Unit Status Shows LEDs representing the external value of the digital 1 0 unit on which the event reaction is configured Green represents one on red represents zero off and gray represents no value reported If there is no MOMO r
398. n Set PID Forced Output When SetPidForcedOutputWhenInputOverRange PID P Input Over Range Loop Forced Output Set PID Forced Output When SetPidForcedOutputWhenInputUnderRange PID P Input Under Range Loop Forced Output Set PID Gain SetPidGain PID Loop Gain P Set PID Input SetPidInput PID Loop Input P Set PID Input High Range SetPidInputHighRange PID Loop High Range P Set PID Input Low Range SetPidInputLowRange PID Loop Low Range P Set PID Max Output Change SetPidMaxOutputChange PID Loop Max P Change Set PID Min Output Change SetPidMinOutputChange PID Loop Min P Change Set PID Mode SetPidMode PID Loop Mode P Set PID Output SetPidOutput PID Loop Output P Set PID Output High Clamp SetPidOutputHighClamp PID Loop High P Clamp Set PID Output Low Clamp SetPidOutputLowClamp PID Loop Low Clamp P Set PID Scan Time SetPidScanTime PID Loop Scan Time P Set PID Setpoint SetPidSetpoint PID Loop Setpoint P Set PID Tune Derivative SetPidTuneDerivative PID Loop Derivative P Set PID Tune Integral SetPidTuneIntegral PID Loop Integral P Set Seconds SetSeconds To P ioControl User s Guide E 17 OPTOSCRIPT COMMAND EQUIVALENTS ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name e Set Target Address State SetTargetAddressState Must On Mask P Must Off Ma
399. n be grouped together Characteristics of strings include the following e Strings are always referred to by name and if in a table by index ioControl User s Guide 10 23 PROGRAMMING WITH COMMANDS e Each character is represented by one byte e Each character is represented by its ASCII code 0 to 255 e A string containing no characters is referred to as an empty string e 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 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 As 22 two character 50 s The ASCII code for 2 is 50 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 ioControl commands do not use double quotes around string literals You can use single quotes but they
400. n configure is called MOMO must on must off A MOMO Match event monitors several inputs and or outputs on an I O unit for a match to a specific pattern A Set MOMO Outputs reaction defines a set of values for outputs on an I O unit You can use just a MOMO event just a MOMO reaction or both The following figure shows the additional fields and buttons that appear if you select the MOMO Match event or the Set MOMO Outputs reaction Add Event Reaction x Name Description Scan on Run Yes C No Event Type Momo Match Must On Mask Configure Mask Evert Must Off Mask Decimal section The gray Must On C Hex Mask and Must Off C Binary Mask fields show any current mask Reaction Type Set MOMO Outputs Must On Mask Configure Mask Reaction Must Off Mask Decimal section Hex Binary JV Enable communication ceo __ 1 To set up or change the must on pattern or must off pattern called the mask click Configure Mask in the Event or Reaction sections 6 46 ioControl User s Guide WORKING WITH 1 0 a Le The Configure MOMO dialog box appears listing all 1 0 points you can set in the mask ConfigureMOMO Ch Name MOMO o0 Fans E 01 Fan 6 ka o2 Fme k o fFnto S ki u fa C GI EE o ems K 10 eeoa R 1 e A 2 For each 0 point click the scroll arrows to indicate that the point is On Off or X ignored When you hav
401. n 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 10 Unit Scratch Pad Commands on page 10 51 for more information Incoming and Outgoing Communication TCP communication is normally requested by the device that needs the data For example an ioControl strategy running on SNAP Ultimate 1 0 unit A might need the value of a set of variables from another strategy running on Ultimate 1 0 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 connec
402. nal Only C Port f22001 D Retries ot E Timeout msec F 5 Complete the fields as described in Control Engine Configuration Dialog Box below 6 Click OK In the Select Control Engines dialog box the control engine appears in the list Select Control Engine x Configured Control Engines Ultimate Brain Modi Delete 7 In the Select Control Engine dialog box highlight the control engine you want to associate with the strategy Click OK Continue with Associating the Control Engine with Your Strategy below ioControl User s Guide 5 3 WORKING WITH 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 IP Address Enter the IP address of the control engine in decimal notation for example 192 9 200 24 Pro C Second IP ioControl Pro only To configure Ethernet link redundancy enter a secondary IP address The secondary IP address can be the second Ethernet interface on a SNAP PAC controller or a separate controller running a strategy designed to respond if the primary control engine is unavailable Note that both IP addresses use the same port number See Configuring Ethernet Link Redundancy on page 5 9 for more information D Po
403. ncarians astiaeractncacetnasdnadeatnsepciateniansies 7 25 Printing All Charts in a SU AtCQY a sccccscasiecseetescdbcsweiead asseacatteucsuacanascesssacelcivens 7 25 Viewing and Printing Strategy or Subroutine Commands c ccccccceeeeeteseeteees 7 25 Viewing and Printing Strategy or Subroutine Element ccccccceceseeteseeteseetenens 7 26 ioControl User s Guide ix Viewing and Printing a Cross Reference ccccseescesestesestesesteseetsseetesssteteseeteseees 7 28 View and Print a Bill of Materials cxscsinces ietealcecaiesiastechsldiasledin uslasascowbidacaachbasdatiacoieteals 7 29 Searching and PVG ACUI sc sccse cade accede ctataatettiscdeciiatiedo as see aeleanaelavetieenonedancaienanianomendsscest 7 29 BEAN MIMIC Scheer eee saeactactscetc sles a ans ema Neti tna exp Geltacitela eo nevae tected 7 30 FE A MN cea cataaanaceire vee ace a AN 7 31 Chapter 8 Working with FlowCharts ccsecsseeseseeseeseeesseeseeneennenees 8 1 trodUGtON reniri a N A a wir mtn 8 1 Atis Chapter setaa A astanboycarpaceneitene wscuateactaeiss 8 1 Creating a New RAI I se statntvinacertacases Sees ta lake wien eaeeateatuntbstestesondteseseasaiacatoen th cea tadestiacluaiad 8 1 Working with Chart Elements ccsccsccscsecssocsccassasssceccsacsactesarsseatucesaansacededconesareteearearentasensseas 8 2 What s In a Chart ext acca at cud etceccena dance a adic edad naa ened ih tatccrcandaaeastosnss 8 2 Using the Drawing Toolbar sascenaenseneleercscostdos
404. ncing String Commands The following commands are used with strings Move String Move to String Table Element Move to String Table Elements Move from String Table Element Compare Strings String Equal String Equal to String Table Element Test Equal Strings Get String Length Append Character to String Append String to String Convert Float to String Convert Number to String Convert Number to String Field Convert Hex String to Number Convert Mistic 1 0 Hex to Float Convert IEEE Hex String to Number Convert Number to Hex String Convert Number to Mistic 1 0 Hex Convert Number to Formatted Hex String Convert Integer 32 to IP Address String mistic 1 0 units only Using Strings Convert IP Address String to Integer 32 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 Get Nth Character Set Nth Character Find Substring in String Get Substring Generate Checksum on String Verify Checksum on String Generate Forward CCITT on String Verify Forward CCITT on String Generate Reverse CCITT on String Verify Reverse CCITT on String Generate Forward CRC 16 on String Verify Forward CRC 16 on String Generate Reverse CRC 16 on String Verify Reverse CRC 16 on String NOTE All numbers in this discussion of strings are decimal unless otherwise stated An ioControl string is a sequence of characters that ca
405. nd Deleting Buttons iaccicscssasininctsteccealeshotssntsreshcorieeeednai Marte Macasdlects 3 27 Creating Your Own Toolbar sccacsasstts rcnesatastisniaehcusten aia ceasois ciunacsestachaeicaizassetandaies 3 28 Setting Up Applications to Launch from ioControl 0 0 0 0 ccccceceseesesestesestesesteseeeesens 3 29 OU MATL catia cae ge sca ttc dtc atcancn ots a decttat a ta de ao iamtataeteattonns 3 30 Chapter 4 Designing Your Strategy ss ssssssensenenenenennunununununnunununenenenenennnn 4 1 Mtrod GtON gerrena EA toe etd etc taa E E EAA need aad 4 1 n this C Fea MMM eet eieianrririeirererinan niiair ri oi eaea ai iaaiiai 4 1 Steps t0 DESIGN ea casecaceteateipuensceactaekaaacuacrodia testi sedinacausaiacaneah arieeutanessteatieacsatnedeateans EEA aeaa 4 1 Solving the Problem cscs sesainaicacededeetnicktcesacenseduiduiatoeaaagctece ansdeaicatis otraeeelas useieaaaeeandanaaass 4 2 Defining the I MATH IN ts wb eae sresdedecntau ots nis nsclcaes ge bachatnateanesenshucinelaatascotesbes casts 4 2 Designing a Logical Sequence of Steps to Solve the Problem 0 ccccceeeee 4 3 Testing the SS Ica ce cto ase Scan naceccccc adap cede deata daw al paawtaccuenapsceaaiaaiaaaenans 4 4 Building the SS RO cao cane rcs sas ohdandcbtcdcesdavchpesasessnnciatbcdcconbuit and eta eacondeaeeecueetachckariadeste 4 4 Configuring Hardware cabs cnn ecencewaea pec ete cect ac alanettecnateniedadeadincs 4 4 Determining and Configuring Variables cccsceccsssesesescescse
406. nd LEDs are examples of digital devices An LED is either on or off it has no other possible state In the diagram on page 3 2 the photo eye is an example of a digital input device The photo eye is either on or off When it turns off as the sheet passes through Its 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 e 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 diagram on page 3 2 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 ioControl system some 1 0 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
407. nd jump to a specific position within the file See the oControl Command Reference or online Help for details ioControl User s Guide 10 47 PROGRAMMING WITH COMMANDS ee T Moving Files via FTP As explained in the previous section Using the Control Engine s File System starting on page 10 42 the control engine s memory includes a substantial area available for file storage You can move files to and from 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 FIP software See instructions in Opto 22 form 1440 the ioManager Users Guide A maximum of five devices can FIP files to a control engine simultaneously e To move data to and from file storage programmatically a strategy can request or send a file using an FIP communication handle explained in this section A maximum of 16 communication handles can be used simultaneously to move data via FIP FTP also allows you to get a directory listing of files on a remote server or in the local file storage area FTP Communication Handle Examples The value for the FIP communication handle is in the format ftp lt IP address gt lt port gt lt username gt lt password gt lt optional timeout gt ftp Use all lowercase letters IP address IP address of the destination device where the file will go port Default port is 21 with 20 for the data port username
408. nd 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 ioControl Options gt Show Hide Instruction Type Information To open online copies of ioControl 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 Web site by choosing Help Opto 22 on the Web 3 30 ioControl User s Guide CHAPTER 4 Designing Your Strategy Introduction This chapter introduces you to ioContro programming how to design an ioControl strategy to control your automated process For additional important information on using ioControl commands instructions to program your strategy effectively see Chapter 10 Programming with Commands and the individual command information in the oContro Command Reference In this Chapter Steps tO DESIGN enaiis 4 1 Instruction ExaMples 0cccccseeeceeereees 4 11 Basie RUES cc cincaccaacsseaceassnrabcoseaceacencenes 4 9 Optimizing Th
409. ndard SNAP digital modules only High density digital modules do not require configuration Serial modules are not configured unless you need to change communication parameters if so use ioManager For this brain See SNAP PAC R1 SNAP UP1 ADS SNAP B3000 ENET SNAP ENET RTC page 6 6 SNAP PAC R2 SNAP UP1 M64 page 6 8 SNAP ENET S64 SNAP UP1 D64 SNAP ENT D64 Bee B3000 serial SNAP BRS page ee G4 bricks B100 page 6 12 B200 66 E1 See form 1576 I O Configuration E2 for E1 and E2 Brain Boards 6 6 ioControl User s Guide WORKING WITH 1 0 Le SNAP Ethernet Analog and Digital Systems Processor Compatible Racks SNAP PAC R1 SNAP M series SNAP M16 SNAP M32 SNAP M48 SNAP M64 SNAP UP1 ADS SNAP B series SNAP B4 SNAP B8 SNAP B12 SNAP B16 SNAP B3000 ENET SNAP B8MC SNAP B12MC SNAP B16MC SNAP B8MC P SNAP ENET RTG SNAP B12MC P SNAP B16MC P CAUTION Make certain you use a rack shown as compatible for the processor Using any other rack will severely damage the brain or controller The mounting racks used with these processors can hold either 4 8 12 or 16 Opto 22 SNAP 1 0 modules Analog serial and high density digital modules can be placed in any position on these racks For the larger racks standard digital modules can be placed in positions 0 7 only For more information see the data sheet for your rack Data sheets can be downloaded from www opto22 com
410. needed or save every time the strategy is downloaded Saving to Flash Once You can save the strategy to flash at any time when you are in Debug mode To do so choose Control Engine Save Strategy to Flash 7 4 ioControl User s Guide WORKING WITH STRATEGIES 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 Strategy Options 2 In the Strategy Options dialog box click the Download tab Check Save strategy to flash memory after download Strategy Options x Archive Download m Download Compression None Full i i m Flash Memory T Set autorun flag after download Cancel Help 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 3 To have the strategy run automatically after a control engine restarts check Set autorun flag after download 4 Click OK Archiving Strategies Strategy archives help you track changes during development and provide a backup in case of a failure on the control engine or on the computer where the original files are
411. nenenennns 2 1 MirodUCHON snena a E a N 2 1 this Chapters erene a E aS 2 1 Opening the Strategy os ctechectceices dhaznctacsacoadeasstashcbrancisesodneneate nds len eessecestheste bsidcinceeastaseeasauts 2 1 Saving the Strategy ats ds ccs stack wntaheetceact sacs db ecuactessdeaeescise sedis ate Snciehas bonkackataeesebaauereneeaedh 2 3 Examining the Strategy oss csccsasciacdtastacsiedcaseininncahdckcxcnidied Sabandaatenacd uanssudaaed eraeabeuaaeiducls 2 5 WT AT TOE herena odie stesteacsiatelacsaaraacsedscuseucp 2 5 Docking the Strategy TEx tecciccensacivshcmrcntsaed dc sawietttacaatsaliabivierarmieetedrasuanaedacad 2 5 CGPS TT ke n re La OAO E chorea eaeattaH A ern testa E E EE 2 6 Opening A Blot Keiciasi ccc coc han ea naiiai 2 9 Adding a OMIM ANNE cece cd etnste sa wsess eka etelandun sta shastatttnoteucaetaeanon ci Pace eahacneel calactonisets 2 12 Configuring a Control Engine oho ois cvscsscvesetsaccacsaccatdana dants ate Soxsonsukavecknecuessedbsescescbocusarelaates 2 17 Compiling the SU ANY ccscsees Sas cacsccsdedacraicacdeheedcuseaauseaisdisd ohacoenad tase ance tncalaalereeaddeaaetis 2 20 Running the RAY css ccsccta sha c eacd sas snec sacs capac beat cataasstousdasiocn ou ssebeascasaseasoncesaajaaitemmaindonss 2 21 Inspecting Messages ss daceccestucssadcaieats scence bsthsosceceisndsesautotascderacbin Gieesdtadaseduataatanlacdnaiaicd 2 23 ioControl User s Guide iii So Stepping Through the Chart ssssssssissssisssiisssisssisssi
412. net I O SNAP Simple I O SNAP Simple I O E1 and E2 E1 and E2 B3000 serial SNAP BRS G4D16R G4D32RS G4A8R B100 and B200 SNAP PAC R series controller SNAP PAC R1 SNAP PAC R1 SNAP PAC R2 SNAP PAC R2 SNAP Ultimate I O SNAP Ultimate I O SNAP Ethernet I O SNAP Ethernet I O SNAP Simple I O SNAP Simple I O E1 and E2 E1 and E2 SNAP LCE controller SNAP PAC R1 xe SNAP PAC R2 SNAP Ultimate I O SNAP Ethernet I O SNAP Simple I O E1 and E2 SNAP Ultimate controller prain SNAP PAC R1 se SNAP PAC R2 SNAP Ultimate I O SNAP Ethernet I O SNAP Simple I O E1 and E2 E1 and E2 I O units are supported for the features available under the OptoMMP protocol only not for all Optomux features See the E1 and E2 User s Guide form 1563 for details For configuration see I O Configuration for E1 and E2 Brain Boards form 1576 SNAP LCE controllers and SNAP Ultimate I O can use ioControl Basic but they are not equipped to use the extra features in ioControl Professional For example they do not have dual Ethernet interfaces for network segmenting nor RS 485 ports to support serial mistic I O units Important Note on Disk Drives Opto 22 applications including ioControl 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 ch
413. ng 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 ioControl User s Guide 7 21 WORKING WITH STRATEGIES The View Chart Status dialog box appears showing every chart in the strategy View Chart Status BEI Status Mode Breakpoint Status PausedAt 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 To change 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 Flag_Example_Chart View Chart scanning Chart Status Stopped Mode Step Off a Breakpoints Break Off Paused At Apply Addwatch Help 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
414. ng ahead is essential to make the job easier Before opening an OptoControl strategy in ioControl read the FactoryFloor to ioProject Migration Technical Note Opto 22 form 1596 Saving and Closing CAUTION Once a strategy is opened in ioControl Professional it can no longer be opened in ioControl Basic Saving the Strategy and All Charts To save all your work quickly choose File 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 Save All or use Subroutine Save or Subroutine Save All 1 To save changes to some charts but not others click the Save Strategy button on the toolbar or choose File 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 Save Strategy Eg Save strategy and selected charts Digital Control S Select All Flag Example Chart sran Clear All cmo e 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 ioControl User s Guide 7 3 WORKING WITH STRATEGIES 3 When only the charts you want to save are highlighted click OK The strategy and the highlighted charts
415. ng ioControl 7 10 S saving chart 7 3 8 14 configurations to flash memory 6 52 files to flash memory 10 17 strategy 7 3 strategy to flash 7 4 subroutine 12 9 Index 10 ioControl User s Guide scanning event reactions in a group 6 49 scratch pad commands 10 51 searching 7 29 secondary address 5 6 6 14 segmenting control network 5 5 selecting block or text block 8 10 connection line 8 10 serial communication handle 10 50 serial communication module communicating with 10 36 10 38 10 40 configuring 6 25 serial devices communicating with 10 50 serial I O unit 6 5 changing baud rate 6 14 setpoint for PID 6 29 setting hex display mode 3 24 showing toolbars 3 13 simulation commands 10 69 sizing columns in a dialog box 3 22 SNAP B3000 ENET referencing points on the rack 6 6 6 7 SNAP D64RS rack 6 9 SNAP ENET D64 referencing points on the rack 6 9 SNAP ENET RTC referencing points on the rack 6 6 6 7 SNAP ENET S64 referencing points on the rack 6 8 6 9 SNAP PAC R1 referencing points on the rack 6 6 SNAP PAC R2 referencing points on the rack 6 8 SNAP UP1 ADS referencing points on the rack 6 6 6 7 SNAP UP1 D64 referencing points on the rack 6 9 SNAP UP1 M64 referencing points on the rack 6 8 6 9 software launching from ioControl 3 29 sorting columns in a dialog box 3 23 splitting chart windows 3 18 starting a strategy 7 12 status codes B 3 step into 7 15 step out 7
416. ng the appropriate analog input channel Use a filter weight value of less than 10 times the scan rate Otherwise the loop cannot be tuned 2 Configure the PID loop to use the average filtered value 3 You can store the configuration to EEPROM or Flash memory to save the filter weight and the input type current or average This can be helpful when reenabling an I O unit after a loss of communication ioControl User s Guide 10 65 PROGRAMMING WITH COMMANDS Tuning Guidelines PID mistic Setting the Scan Rate The scan rate should be set as fast as possible or as fast as the controlled equipment will allow unless there are rare and unusual circumstances Setting the scan rate to be longer than the dead time will result in a PID controller that is so sluggish that it cannot adequately respond to disturbances and setpoint changes will be extremely slow There are however exceptions to this rule If the output of the PID is implemented on equipment that cannot handle fast scan changes set the PID scan loop to as fast as the equipment can handle Most control valves which are very commonly controlled by PID loops can handle 0 1 second scan rates just fine However there are definitely types of equipment that can t handle this One example would be big gates at big dams Moving one of these gates is a major event that takes a long time so one of the control goals is to minimize gate movement For the flow controllers on these
417. nguages F 1 complex loops 11 6 conditions 11 8 control structures 11 22 debugging strategies 11 30 definition 11 1 editor 11 25 for loop 11 24 functions 11 11 if statements 11 22 language reference F 1 literals F 8 logical operator 11 20 math expressions 11 3 11 19 notes for programmers F 6 numeric literals 11 15 numeric variables 11 16 pointers 11 17 precedence for operators F 9 repeat loop 11 24 string handling 11 4 strings 11 16 switch statements 11 23 syntax 11 13 F 7 F 11 tables 11 18 toolbar 11 26 troubleshooting 11 29 when to use 11 2 while loop 11 23 OptoVersion utility A 8 output point definition 3 3 disabling 10 5 P page setup for printing graphics 7 23 parallel algorithm for PID 10 60 parameters subroutine 12 1 12 5 passed in subroutine parameters 12 1 pasting block 8 12 command instruction 9 24 9 25 connection line 8 12 text block 8 12 pausing chart 7 14 peer to peer communication 10 36 10 51 permanent storage See flash memory a M permissions in Windows 2000 A 9 persistent data 9 4 persistent RAM A 3 PID loop 10 63 adding mistic 6 34 algorithms 10 60 changing 6 40 configuring 6 29 10 59 definition 10 59 10 62 deleting 6 41 determining system lag 6 59 inspecting 6 58 inspecting mistic 6 71 mistic 10 62 mistic configuration example 6 39 tuning 6 64 tuning mistic 6 71 PID Ethern
418. nication ioControl errors appear in dialog boxes on the computer running ioControl Some of these errors appear as numbers some as text and some show both numbers and text An example of an ioControl error is Timeout No response from device Another example is TCP IP Cannot connect error with an error code of 412 ioControl User s Guide B 1 So Queue Messages Queue messages indicate an error or other message during Strategy operation and they appear in the ioControl message queue For information on viewing the queue see Inspecting Control Engines and the Queue on page 5 12 Here s an example of a message queue view messages aix Number of Message s 29 Pop First Message Clear Messages Code Severity p 0 534 Info Attempt s to communicate with 1 0 Unit failed lt system _INIT_IO gt N A N A EIO_C 1 0 Unit Mixed 10 192 55 63 13 06 01 09 17 04 1 444 Eror Could not send on socket lt system INIT_IO gt N A N A EIO_C 1 0 Unit Mixed 10 192 55 63 13 06 01 09 17 04 2 User Warning Temperature exceeds valid limit Temperature_Control 16 2 null 13 06 01 09 17 04 3 12 Error Invalid table index Temperature_Control 19 2 String_Table Table String 13 06 01 09 17 04 4 415 Error Cannot divide by zero Temperature_Control Variable_Increase_Notification 1 2 null 13 06 01 09 17 04 5 415 Error Cannot divide by zero Temperature_Control Variable_Increase_Notification 1 2 null 13 06 01 09 17 04
419. nit Memory Map Commands The following commands refer to the memory map in an Opto 22 memory mapped device either a controller or an I O unit In the case of a controller brain they can refer to the device s own memory map or a memory map on another device Read Number from 1 0 Memory Map Write Number to 1 0 Memory Map Read Numeric Table from 1 0 Memory Map Write Numeric Table to 1 0 Memory Map Read String from 1 0 Memory Map Write String to 1 0 Memory Map Read String Table from 1 0 Memory Map Write String Table to 1 0 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 a SNAP Ultimate or Ethernet I O unit 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 ioControl NOTE If you are reading or writing to the device s Scratch Pad area use the O Unit Scratch Pad commands instead see page 10 51 If you are changing event messages use the I O Unit Event Message commands instead page 10 54 Before you use these commands with a SNAP PAC or SNAP LCE controller you must have already configured an I O unit to represent the controller Configure it as a SNAP UP1 M64 with the controller s IP address When you use these commands make sure
420. nits configuration steps start in the next section and tuning steps are described on page 6 58 For additional information see PID Ethernet Commands on page 10 58 and Opto 22 form 1410 PID Configuration and Tuning SNAP Ultimate 1 0 Learning Center Supplement G e ioControl For serial based mistic I O units skip to Adding a PID Loop mistic on page 6 34 For additional information see PID Mistic Commands on page 10 62 Adding a PID Loop Ethernet NOTE This section applies to SNAP Ethernet and SNAP Ultimate 1 0 units only 1 With the strategy open and in Configure mode double click the 1 0 Units folder not the individual unit s icon on the Strategy Tree 6 30 ioControl User s Guide WORKING WITH 1 0 rs The Configure 1 0 Units dialog box opens Configure I 0 Units SimplelO_Unit SNAP Mi Ethernet 10 1925 Disabled UltimatelO_ Unit SNAP M Ethernet 10 0 4 1 Disabled 2 Select the 0 unit the PID will be on and click PID Loops Configure PID Loops UltimatelO_Unit 3 Double click the lowest unused number ioControl User s Guide 6 31 6 32 WORKING WITH I O A B 1 0 Point Fuel_Display D E 0 10 F 1 0 Point Fuel Display G 1 0 Point Fuel_Display H 10000 10000 0 0 J C K N _ n Velocity o L Auto 0 0 M 1 0 P 4 Complete the fields as described in Add PID Loop Dialog Box below 5 Click OK The new PID appears in
421. nline command help 60 0 argument 1 argument 2 SetDownTimerPresetValue Minute_Timer command EnablelOUnitCausingCurrentError command no arguments Commands in OptoScript can be broken into two categories procedure commands and function commands ioControl User s Guide USING OPTOSCRIPT rs 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 j When you compare these examples to the identical commands in standard ioControl you ll notice that the returned value for the standard ioControl 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 OptoScript 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
422. nnedeciestactsctdeasussnedmseratiaesstiaees 10 32 Using Integers ssecctacistessnisaertsticchttceca cnicoskesderacenaatanmne hia Wide saasiecoei dace 10 32 USING EN ent dacar attidatatee tn sncptsican cts hates ea NEE E Ia 10 32 Controlling TROMMCUIING sci echioxtectvcescrsbacdacdenaittsaciabantat ic2Acntess oncanactdcteeanantatioteeereade 10 33 Mixing and Converting Integers and Floats cccccceseesesteteseeeseetesestesesteseseneees 10 33 iC AIA Command S sats csarserine esiteini enian in earan aea ei SEAE AASE iani 10 33 Understanding Logical COMMANAS c ccccccccsesesesescsteseseeseseeseseeseseeseseaeseaneaeees 10 34 Logical True and Logical False cesssns hhinch sy aracdac Viena oneal del dadeaccbeasaalaciatatss 10 34 Communication COMM ANOS cases sec sacaceatsatenttstestestes tacsesteshsxcvistisenestasiacivateigestelaicaelsecseliatas 10 35 Communication Handles 2 scaiacsassctckneaectonedcdacasiac desssadsssacanddeacessanantdedecd Oocbarinnacadeaiel 10 35 Using TCP Communication Handles iisi cscccccessciesstccopsbesscecinainadeatantecaniadasdasaaecameniniss 10 36 Incoming and Outgoing COMMUNICATION cece estecestetesteestesesteseseaseaeanens 10 36 TCP Communication Handle Examples cccccccsscessceeeceeseesestesesteteseeneseeee 10 38 Using Flowcharts to Control TCP IP Communication cccccceeeceseeteeeteseeees 10 39 Ethernet Connections and Ports c ccccccccccsesesesesesesesecseseeseseesescsescsteseseeseaes
423. nning StepOn Break On l 0 000 Sec The breakpoint hand appears on the block and Break On appears in the status bar 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 7 18 ioControl User s Guide WORKING WITH STRATEGIES 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 quickly set multiple breakpoints in several charts and subroutines or you can see all the breakpoints you have set at once 1 Press CTRL B or select Debug Breakpoints The Breakpoints dialog box appears showing all the breakpoints set in the strategy Block ID Block Name Block Type Add Remove Clear All Sprinklers Read Hygro meter Action Cancel Help 2 To add new breakpoints click Add Add Breakpoint BE Wait 23 hrs Action 13 Turn off sprink Action 12 Wait 5 sec Action Turn off sprink Action Wait 24 hrs Action
424. notice the module icons in the dialog box Configure 1 0 Points Sprinkler Control Modules andPoints Module icons E 00 NotUsed o A O NotUsed o ooo o o tf 02 Not Used 03 Not Used 04 Not Used 05 Not Used 06 Not Used 07 Not Used 08 Not Used NOTE On an Ethernet SNAP I O unit you can configure all the analog and digital modules on the rack at once Ona serial SNAP I 0 unit you must configure digital and analog modules separately ioControl User s Guide 6 17 WORKING WITH 1 0 5 Highlight the number that represents the module s position on the rack See the diagrams in Addressing 1 0 Units on page 6 6 Click Add Add Module xj Type Digital Output Analog Input Analog Output Module SNAP IDC5 10 32 VDCAVAC SNAP IDC5 FAST 2 5 16 VDC SNAP IDC5 FAST A 18 32 VDC SNAP IDCSD 2 5 28 VDC SNAP IDC5MA 10 32 VDCAVAC Man Auto Switch SNAP IDC5 SW Dry Contact Switch SNAP IDC5Q 4 24 VDC SNAP IDC5G 35 75 VACAYDC SNAP IDC5 HT 15 32 VDC SNAP IDC5 SW NC Dry Contact Switch SNAP IDC5FM 10 32 VDC SNAP IDCSDFM 2 5 28 VDC SNAP IACS 90 140 VDC VAC SNAP IACSA 180 280 VDCAVAC SNAP IACSMA 90 140 VDC VAC Man Auto Switch SNAP IACSFM 90 140 VDC VAC SNAP ACSAFM 180 280 VDC VAC 6 In the Add Module dialog box choose the module type and then the exact module from the lists Click OK 7 In the Configure I O Points dialog box
425. ns In OptoScript the loop is in a single block that contains one condensed instruction Ses tS oA 1 Opteg cript Powerup Test Hour x Celeste 2 e 76 Pe 4 ofco W E aes OptoScript Coa a oe eT eT while GetHours gt 8 and GetHours lt 17 do something SB ee kee wend v 4 gt 11 6 ioControl User s Guide For Case Statements USING OPTOSCRIPT 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 ioControl commands the case statement requires several sets of condition and action blocks each containing commands In OptoScript the code is all in one block I gt switch GetDayOfWeek case 1 Monday ny w 5 N nunn endswitch wi Using OptoScript for case statements saves space in the flowchart and lets you see all the possible cases in one dialog box ioControl User s Guide 11 7 USING OPTOSCRIPT For Conditions Like loops and case statements conditions can be simpler when done in OptoScript code f then if then else and if then elseif statements can all be mixed and nested as needed Here s an example of a simple f then else statement as it could be done in standard ioContro commands and in OptoScript Bele Sie alt OptoScript Code In standard ioControl commands
426. ns from the control engine to the 1 0 unit Examples of events are a timeout an input or output reaching a value or a special digital feature such as frequency or an on time totalizer reaching a value Examples of reactions include starting an on or off pulse reading and holding a value or activating or deactivating a mistic PID loop Event reactions can be configured on mistic digital and analog multifunction 1 0 units only You can configure up to 256 event reactions on a single I O unit For more information on using event reactions see Event Reaction Commands on page 10 22 1 To configure an event reaction make sure the strategy is open in Configure mode On the Strategy Tree double click the 1 0 Units folder not the individual unit s icon 2 In the Configure I O Units dialog box highlight the multifunction mistic I O unit and click the Event Reactions button The Configure Event Reaction dialog box appears showing all event reactions contained on the 1 0 unit in this example none Configure Event Reactions Type B3000 SNAP Dig Name Reaction 000 Not Used 001 Not Used 002 Not Used 003 Not Used Delete 004 Not Used v 005 Not Used off Modify Not Used Name Groups Not Used Delete Group 6 42 ioControl User s Guide WORKING WITH 1 0 re 3 If the correct I O unit is not shown select the unit from the drop down list Since only multifunction units
427. nteger Table Bit to Set Numeric Table Element Bit NumTableElementBitTest Element Index Of F Test Integer Table Bit to Test Off IsOff Point di 0 F Off Latch Set IsOffLatchSet On Point F On IsOn Point di 1 F On Latch Set IsOnLatchSet On Point F Open Outgoing OpenOut goingCommunication Communication F Communication Handle OR x or y F OR See OR F Pause Timer PauseTimer Timer P PID Loop Communication IsPidLoopCommEnabled PID Loop F Enabled Pointer Equal to Null pn null F Pointer Table Element Equal pt 0 null F to Null Raise e to Power RaiseEToPower Exponent F Raise to Power Power Raise To the F Ramp Analog Output RampAnalogOutput Ramp Endpoint Units Sec P Point to Ramp E 14 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS EE ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name Read Event Reaction Hold ReadEventReactionHoldBuffer F Buffer Event Reaction Read Number from I O Unit ReadNumFromloUnitMemMap I O Unit Mem F Memory Map address To Read Numeric Table from I O ReadNumTableFromIoUnitMemMap Length Start F Unit Memory Map Index I O Unit Mem address To Read String from I O Unit ReadStrFromloUnitMemMap Length I O Unit F Memory Map Mem address To Read String Table from I O ReadStrTableFromIoUnitMemMap Length Star
428. nter Tables IO Units E Mixed _10_Unit Points PIDs Set oven temperature to 450 degrees Docked watch window Cookie Watch nCookie_ Counter Integer 32 Variable 713 02 diInspectionPassFailSwitch Digital Input j State on OFF l On Latch OFF OFF i Off Latch OFF OFF xl ioControl Ready See Docking Windows on page 3 17 for more information e To expand or collapse watch window you have added an 1 0 unit PID loop chart or table to click its plus or minus sign oe Watch 2 Of OF x 12 Temperature Analog Input Deg O 272 8965 Expand or collapse the Sprinkler Control SNAP Mixed Ultimat tem by clicking the or Si a sign in the box 00 Switch DO Counter 05 Sprinkl Digital Output OFF Ban 12 Tempera Analog Input Deg 272 9154 Digital_Control Chart 6 76 ioControl User s Guide WORKING WITH I O Le 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
429. nter a new name and add the point H Square Root If O Point is selected at F Enable or disable square root extraction and averaging of the input value prior to the PID calculation These options are disabled by default I Output Specify the output to be driven by the PID by selecting an 1 0 point from the drop down list If it doesn t exist enter a new O point name and add the point Maximum Change Rate Specify the maximum absolute difference allowed for the output value as the result of one PID calculation For example a maximum change rate of 10 specifies that even if a PID calculation suggests an output change of 20 units the maximum change allowed during the loop will be 10 units You can use a maximum change rate to avoid sudden dramatic increases or decreases in the output value Note that the maximum change rate must be between one percent and 100 percent of the range of the output itself which is the difference between the output s high scale value L and low scale value K The value representing this full range will appear by default K Lower Clamp Output Specify the minimum value allowable for the output This value cannot be less than the zero scale value of the output module L Upper Clamp Output Specify the maximum value allowable for the output This value cannot be greater than the full scale value of the output module M Setpoint Select whether the setpoint for the PID calculation will be read fr
430. 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 Digital_Control Is Button_D3 Add On Instruction for the block 4 Modify named Button D30 fF gt gt gt en Operator g AND Close Help Command Help C oR 3 10 ioControl User s Guide WHAT IS OCONTROL ioControl Main Window ioControl title bar With a strategy open the main window in ioControl Basic and ioControl Pro looks similar to this JioControl 0 x Menu bar File Edit Configure Chart Subroutine Compile Mode Tools View Window Help a Strategy Tree Status bar OSE t Bex A LLama eenaa CEs NAS gt Ure Ys olor RB ES Ke fax Boprinkler_Contr
431. o save it shrink your strategy by using subroutines to perform common tasks 69 Invalid parameter null pointer passed to Attempted to use an uninitialized pointer or a null pointer X command was received by a command 70 Not enough data supplied Table index given is larger than the size of the table X 71 Out of persistent memory If applicable Too many persistent variables variables initialized on check length of tables download or too large a strategy archive to fit in battery backed RAM 93 I O unit not enabled Previous I O unit may have been disabled by a communication failure X communication failure may have disabled that happened earlier the unit automatically Reenable it and try again 103 Port could not be unlocked Task attempting Attempted to unlock a connection that was locked by a X to unlock the port does not match the task different task with the current lock on that port 203 Driver could not be found or loaded Communication command didn t find the driver described in X the communication handle Make sure driver name is not misspelled for example tcp must be lower case 407 File not found Attempted to save a strategy to flash but there was no strategy in RAM to save 412 TCP IP Cannot connect error Ethernet connect failed See page A 5 X B 6 ioControl User s Guide a M Description Possible Cause Q 1 0 417 Cann
432. o the person who requested the data ioControl User s Guide 10 45 PROGRAMMING WITH COMMANDS The whole operation including the FIP portions which are not covered in this code example might look like this Requesty Control Engine ioControl Strategy File System ProductRequest txt Product_Names String Table ProductRequest txt FTP Num_Widgets 2 0 Num Widgets Num_Widgets Num_Gadgets Fat a Num_Gadgets Num_Thingies um_Gadgets Num_Thingies Num_Whatnots 2 Num_Thingies Num_Whatnots 3 Num_Whatnots Get Value From Name ProductSales txt Product_Info String Table Productinfo txt _ _ _ _ _ 9556 10867 5432 DA 0 9556 23 9556 10867 5432 FTP Q 23 4 1 10867 2 5432 3 23 10 46 ioControl User s Guide PROGRAMMING WITH COMMANDS EEE M The OptoScript code in this example also makes use of the command Set Communication Handle Value to change the value of a specific communication handle during the operation Sets the value for the SetCommunicationHandleValue file r ProductRequest txt chAFile communication handle chAFile Opens the communication status OpenOutgoingCommunication chAFile handle and checks to make if status 0 then sure it opened Sets the end of message SetEndOfMessageTerminator chAFile terminator to a comma because the file to be
433. oOPCServer the PC running ioDisplay Professional the controller and the 0 units unable to communicate This 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 If one network needs maintenance for example to replace a switch you can safely shut it down using the Set Target Address commands in ioControl and options in ioDisplay Professional and OptoOPCServer Opto 22 Redundant Network PCwithtwonics PC with twoNics JP running ioDisplay PeF running ioDisplay ps PC with two NICs running Fy OptoOPCServer vre29999 vlv viv vivyo Ethernet Ethernet switch switch network 1 network 2 SNAP PAC S series controller as controls all I O units g I O units are all 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 ii k SNAP PAC R series Sensors and actuators location 1 SNAP PAC i R series Sensors and actuators location 2 ioControl User s Guide 5 7 WORKING WITH CONTROL ENGINES 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
434. oblem Try cutting either the gain or integral but not both at the same time to find out which one is causing the problem Overshoot Overshoot is usually caused by the integral being too high Gain that is too high can also cause overshoot but that is usually in conjunction with the integral being too high Any PID loop can be made to not overshoot and not oscillate if the gain and integral are set low enough but the response will be slow Performance There is a limit on how fast a good stable response can be The middle chart is the best that can be done with no overshoot and no oscillation The ones with the gain and integral too high move toward the setpoint faster but they overshoot and oscillate There will be a point that is the best the PID loop can be tuned and it will not be possible to get a faster stable response There are trade offs between having a fast response and having a stable PID loop that does not overshoot the setpoint Starting the Tuning Process for a New PID Loop A simple and safe method is to start out at a very low gain and integral lower left chart see page 10 68 Increase the gain without changing the integral until the fastest response is achieved without oscillation It still won t reach the setpoint but the key here is getting a fast response that doesn t oscillate middle left graph Now leave the gain alone and increase the integral until it reaches the setpoint without oscillating middle graph This
435. 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 ioControl User s Guide A 3 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 downloading it See page 7 4 for information on saving to flash Archiving Strategies 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 7 5 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 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 fro
436. ol Control Engines Subroutines Included Charts Variables o Numeric Variables String Variables Pointer Variables E Communication Handles Numeric Tables String Tables Pointer Tables I O Units Sprinkler_Contral ioControl Ready Since ioControl 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 ioControl 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 ioControl is in and indicates messages or errors helpful in debugging To hide or show the status bar choose View 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 ioControl 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 subroutines and to configure control engines 0 and variables ioControl User s Guide 3 11 WHAT IS IOCONTROL oo e Debug mode is u
437. om an 1 0 point or a host device the controller The setpoint is the value to which the input will be driven Your choice determines the other data required in the Setpoint section of the dialog box If you choose I O Point see the figure in step 7 for additional fields to complete N Initial Value If Host is selected at M Specify the initial value for the setpoint This value must be between the lower clamp and upper clamp values O and P The default is zero 0 Lower Clamp Setpoint If Host is selected at M Specify the lowest possible setpoint value Default 32 768 P Upper Clamp Setpoint If Host is selected at M Specify the highest possible setpoint value Default 32 767 ioControl User s Guide 6 37 WORKING WITH 1 0 Q Gain Specify the gain term P to be used in the PID calculation This value can range between 32 768 and 32 767 but must not be zero The default is one R Integral Specify the integral term I to be used in the PID calculation This value can range between zero and 32 767 The default is zero Note The product of the scan rate and the integral term must be less than or equal to 3 932 100 S Derivitive Specify the derivative term D to be used in the PID calculation This value can range between zero and 32 767 The default is zero T Enable Communication Select whether you want communication to this PID loop enabled or disabled Setting PID Loop Control Options mistic PIDs
438. ome programming experience Experienced programmers may want to see Notes to Experienced Programmers on page F 6 In this Chapter About OptoScript cece 11 1 OptoScript Expressions and Operators 11 19 When To Use OptoScript c eee 11 2 OptoScript Control Structures 0 11 22 OptoScript Functions and Commands 11 11 Using the OptoScript Editor 11 25 OptoScript SyWMAK cicccccrcssnccseassscsseses 11 13 Troubleshooting Unable To Find Errors 11 29 Troubleshooting Syntax Errors 11 29 OptoScript Data Types and Variables 11 14 Debugging Strategies with OptoScript1 1 30 About OptoScript OptoScript is a procedural type of computer language similar to Pascal C or BASIC It can be used within any ioControl strategy or subroutine to replace or supplement standard ioControl commands It does not add new functions but offers an alternative method within ioControl 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 ioControl User s Guide 11 1 USING OPTOSCRIPT i The following figure shows an example of an OptoScript flowchart block and its contents OptoScript editor OptoScript Oven_Control Block 1 sjaje oje als slala OptoScript Code if Oven_Temperature gt 450 then Oven_Alarm 1 Set the oven a
439. ommunication handle 10 42 examples 10 43 file system on the brain moving files via FTP 10 48 saving files to flash 10 17 file toolbar 3 12 finding a block in a chart 3 21 flag programming example 4 18 flash memory 6 52 saving files to 10 17 saving strategy to 7 4 floating point converting to integer 10 33 converting to string 10 30 definition 3 7 10 32 in logic 10 34 variable definition 9 2 flowchart See chart flow through logic 4 9 for loop 11 6 11 24 format File communication handle 10 42 FTP communication handle 10 48 serial communication handle 10 51 TCP communication handle 10 37 FTP directory listing 10 50 FTP communication handle 10 48 full debug definition 7 13 functions in OptoScript 11 11 G gain and offset 10 14 in PID loops 6 65 ioControl User s Guide o grammar in OptoScript F 11 H hardware requirements for ioControl 1 5 help See also troubleshooting help online 3 30 hex display mode 3 24 hiding toolbars 3 13 high density digital commands 10 6 configuring module 6 25 counting 10 7 latches 10 6 host task 4 21 definition 3 8 increasing frequency 4 22 Hungarian notation 11 14 0 changing configured point 6 29 configuring 6 16 copying configured point 6 26 deleting configured point 6 29 disabling 10 5 exporting configuration 6 3 importing configuration 6 4 in strategy design 4 2 4 4 monitoring in watch window 6 73 moving configured point
440. on SNAP 1 0 unit double click the channel you want to use Skip to step 8 If you are using a SNAP 1 0 unit notice the module icons in the Configure I O Points dialog box 5 xl 170 Unit Sprinkler_Control Type SNAP Mixed Ultimate 1 0 SNAP UP1 4 Modules and Points Type Featur Units Enabled Ref Count d 00 SNAP IDC5D 2 5 28 VDC Digital Input Modify A 01 Not Used EA 02 Not Used Delete A 03 Not Used E 04 Not Used Move Ta A 05 Not Used Ie Not Used A A roma T T T ha i nr ie Expand All Collapse All NOTE In this example a digital module has already been added in position zero This example shows an Ethernet SNAP I O unit so both digital and analog modules can be configured at the same time On a serial SNAP I O unit the digital module appears but digital and analog modules must be configured separately ioControl User s Guide 6 21 WORKING WITH 1 0 re 5 Highlight the number of the analog module s position on the rack See the diagrams in Addressing I O Units on page 6 6 Click Add Add Module xi Type Digital Output Analog Input Analog Output Module SNAP IDCS5 10 32 VDC AVAC SNAP IDC5 FAST 2 5 16 VDC SNAP IDC5 FAST A 18 32 VDC SNAP IDCSD 2 5 28 VDC SNAP IDC5MA 10 32 VDCAVAC Man Auto Switch SNAP IDC5 SW Dry Contact Switch SNAP IDC5Q 4 24 VDC SNAP IDC5G 35
441. on the toolbar or choose Configure Variables The Configure Variables dialog box opens Configure Yariables x Scope Global Type Initial Value Ref Count Description Add W Integer 32 0 3 Float 0 Modify 0 How Integer 32 Integer 32 0 Delete Down Timer 2e This dialog box lists all the variables in the strategy or subroutine that are of the type shown in the Type field 2 In the Type drop down list choose the type of variable you want to configure 3 To have data in the variable be persistent select Persistent in the Scope drop down list ioControl User s Guide 9 5 USING VARIABLES AND COMMANDS You must choose Persistent as the scope before creating the variable existing variables cannot be changed to be persistent Pointer variables and timers cannot be persistent Global is the default scope For more information see Persistent Data on page 9 4 4 If you are adding the variable to a subroutine select Subroutine in the Scope drop down list 5 To add a new variable click Add The Add Variable dialog box appears Add Variable x A Name e B Desitin Field at D varies cim rea is aerial Initialization E Initialize on strategy run Initial Value EE _ F Initialize on strategy download The figure above shows the Add Variable dialog box as it appears for string variables Fields are slightly different for other variables 6 Complete th
442. on x Select Comment Type Name I jalvaidTyes Apo Is Greater Than fallVaidTypes x Then Pulse On fallVaidTypes x a Put Status In fallVaidTypes ee Cancel Help Command Heb 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 When the Add Instruction dialog box is completed click OK ioControl User s Guide 12 11 USING SUBROUTINES 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 7 13 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 3 15 You can also set breakpoints on any subroutine block as needed See Setting and Removing Breakpoints on page 7 18 for more information Viewing Subroutines Sin
443. ond Status codes may indicate problems with a command or communication to 1 0 or they may indicate a problem in the strategy logic See List of Common Messages on page B 3 for more information Again look at the possible causes for help in fixing problems 5 Call Product Support If you cannot find the help you need in this book the joContro Command Reference or the SNAP Ethernet Based I O Units Users Guide call Opto 22 Product Support See Product Support on page 1 4 for contact information Strategy Problems If You Cannot Delete an Item Sometimes when you try to delete an item in a strategy a variable a chart an 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 A 2 ioControl User s Guide a i You can use Find to locate all references to the item you want to delete For help in using Find see Searching on page 7 30 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 3 Choose Compile Compile All 4 Choose File Save All The strategy database is rebuilt and the reference c
444. oop Disable Communication to DisableCommunicationToPidLoop PID Loop P PID Loop Disable Communication to DisableCommunicationToPoint Point P Point Disable Event Reaction DisableEventReactionGroup E R Group P Group Disable I O Unit Causing DisableIoUnitCausingCurrentError P Current Error Disable Mistic PID Output DisableMisticPidOutput Of PID Loop P Disable Mistic PID Output DisableMisticPidOut put TrackingInManualMode P Tracking in Manual Mode On PID Loop Disable Mistic PID Setpoint DisableMisticPidSetpointTrackingInManual P Tracking in Manual Mode Mode On PID Loop Disable Scanning for All DisableScanningForAllEvents On I O Unit P Events Disable Scanning for Event DisableScanningForEvent Event Reaction P Disable Scanning of DisableScanningOfEventReactionGroup E R P Event Reaction Group Group Divide x y F Down Timer Expired HasDownTimerExpired Down Timer F Enable Communication to All EnableCommunicationToAllIoPoints P I O Points Enable Communication to All EnableCommunicationToAlllIoUnits P 1 0 Units Enable Communication to EnableCommunicationToEventReaction P Event Reaction Event Reaction Enable Communication to I O EnableCommunicationTolIoUnit I O Unit P Unit Enable Communication to EnableCommunicationToMisticPidLoop PID P Mistic PID Loop Loop Enable Communication to EnableCommunicationToPidLoop PID Loop P PID Loop Enable Communication to EnableCommunicationToPoint Point P Point ioControl User s
445. or Event Enable Scan for E R Group Select the group from the drop down list Disable Scan for E R Group Disable Scan for All Events None Set MOMO Outputs See Adding a MOMO Event or Reaction mistic I O Units Only on page 6 46 6 44 ioControl User s Guide WORKING WITH 1 0 a i For this type of reaction Enter this information Start On Pulse Specify the I O point to be pulsed and the length of Start Off Pulse the pulse in seconds Select the I O point from a drop down list or specify a new name for the point and configure it Start Counter Specify the I O point to be affected Select the I O Stop Counter point from a drop down list or specify a new name for Start Quadrature Counter the point and configure it Stop Quadrature Counter Clear Counter Clear Quadrature Counter Clear On Pulse Clear Off Pulse Clear Period Clear Totalize On Clear Totalize Off Read and Hold Counter Value Read and Hold Quadrature Value Read and Hold Totalize On Value Read and Hold Totalize Off Value Read and Hold On Pulse Value Read and Hold Off Pulse Value Read and Hold Period Value Read and Hold Frequency Value For analog I O units For this type of reaction Enter this information None no reaction None Enable Scan for Event Select the event from the drop down list Disable Scan for Event Enable Scan for E R Group Select the group from the drop down list Disable Scan for E R
446. or 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 16 be open simultaneously 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 Approximately 4 MB on a SNAP PAC S1 2 MB ona engine s file system SNAP PAC P series controller or SNAP Ultimate brain or 1 MB on a SNAP LCE 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 10 17 for information on saving files to flash using ioControl 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 Commands to use with any file Commands to use with file Commands
447. or not the chart is currently paused 1 Click the Auto Step Chart button and watch the program move from block to block At one time or another your chart looks like this This chart runs continuously once the program has been started Drop the dough lt q Drop the chips 4 J Notice that in the ioControl 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 Click the Auto Step Chart button again to end auto stepping Step Off appears indicating the program is again running without interruption Now let s see how many cookies we ve produced to this point 3 On the Strategy Tree double click the numeric variable nCookie_Counter Value 138 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 138 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 ioControl User s Guide 2 27 IOCONTROL TUTORIAL subtract the number of bad cookies so that nCookie_Counter keeps track of the number of cookies sent out the door not just sent
448. ors for expressions and operators You can use an unlimited number of parentheses while GetHours gt 8 and Fan_A 1 wend too hot Send alarm if oven temperatur ine comments appear on a if Oven_Temperature gt 450 then lt separate line or after a Set the oven alarm al statement They are preceded by wo slashes and a space Clear the oven alarm Block comments not illustrated are preceded by and ollowed by Oven_Alarm 1 else Oven_Alarm 0 endif nCheck GenerateChecksumOnString 0 Get IdOfBlockCausingCurrentError sMessage Parameters arguments for a command are listed in order within parentheses following the command Commands that have no arguments must still include the parentheses nError_Block RemoveCurrentError yx Hello world FindCharacterInString 0 sGreeting nPos sGreeting An individual character can be in single quotes or in double quotes depending on its type A string must be in double quotes NOTE 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 oControl Command Reference or o
449. osine Tangent Arcsine Arccosine Arctangent Hyperbolic Sine Hyperbolic Cosine Hyperbolic Tangent In ioControl 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 ina 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 Using Floats All analog values read from an I O unit are floating point numbers floats In ioControl a float is a 32 bit IEEE single precision number ranging from 3 402824 x 108 to 3 402824 x 10 Note that this format guarantees only about six and a half digits of significance in the mantissa Therefore mathematical actions involving floats with seven or more significant digits may incur errors after the sixth significant digit For example a float to integer conversion of 555444333 0 yields 555444416 note the error in the last three digits 10 32 ioControl User s Guide PROGRAMMING WITH COMMANDS Controlling Rounding Use the Round command to control rounding Note that 1 5 rounds up to 2 1 49 rounds down to 1 To round down only divide an integer
450. osition on these racks For the larger racks standard SNAP digital modules can be placed in positions 0 7 only Each standard SNAP digital module contains four input or four output points SNAP analog modules supported by the B3000 contain either one or two points Each point on the rack is numbered when you configure the point or read or write to it you reference it by its number Each SNAP brain is really up to four logical brains in one two digital 16 channel multifunctional brains plus for a B3000 up to two analog 16 channel multifunctional brains Jumpers on the SNAP brain set the base address which must be zero four or a multiple of four The base address is the first digital address digital channels 0 15 The second digital address digital channels 16 31 is the base address plus one On a B3000 the first analog address analog channels 0 15 is the base address plus two the second analog address analog channels 16 31 is the base address plus three ioControl User s Guide 6 11 WORKING WITH 1 0 The following diagram shows the largest rack as an example Note that two numbers are shown for each analog module If you are using analog modules that contain only one point ignore the upper point number This diagram applies to N n WILE UNS ZZ Tem ey B3000 serial mistic lt u Oe OM SNAP BRS gt ORT Be sr morn C Module position 0 ae f 1 0 meita aporess 7
451. ost commonly used tools appear in a single line in the main window If you want to change the tools see Moving and Deleting Buttons on page 3 27 Moving Toolbars To move a toolbar click on its edge to outline the whole toolbar Then drag the toolbar where you want it You can place it at the top bottom left or right of the main window or of any docked window 3 26 ioControl User s Guide WHAT IS OCONTROL Le Moving and Deleting Buttons 1 Choose View Toolbars 2 In the Customize dialog box click the Commands tab Toolbars Commands Commands tab Categories m Buttons Do Be x ate SSG Select a category then click a button to see its description Drag the button to any toolbar Description Cancel Apply Help 3 In the Categories list click the name of the toolbar you want to move the button from The buttons in that toolbar appear in the Buttons area To change a button s position in its current toolbar click the button in the ioControl main window not in the dialog box and drag it to the position you want To move a button to another toolbar click the button either in the dialog box or in the main window and drag it to the toolbar in the main window where you want it To delete a button from a toolbar click the button in the main window and drag it out of its toolbar ioControl User s Guide 3 27 WHAT IS IOCONTROL ee Creating Your Own Toolbar
452. ost the same as standard ioControl 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 ioControl and in OptoScript ioControl Command OptoScript Command 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 command if it exists Here are some examples ioControl Command OptoScript Command Built In Equivalent Example 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 comment Set Nth Character SetNthCharacter 1 5 c See Appendix E for a table of all ioControl commands and their OptoScript equivalents In addition OptoScript equivalents for each command are shown in the oControl Command Reference and in the online command help 11 10 ioControl User s Guide USING OPTOSCRIPT ee Using 1 0 in OptoScript One advantage of OptoScript is that any named 1 0 point can be used directly wherever a numeric
453. ot delete any 1 0 units or points that are already there If the import file contains 1 0 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 Open the strategy into which you want to import the 1 0 configuration 2 In the Strategy Tree right click I O Units and choose Import from the pop up menu 3 Navigate to the location of the export file you created Highlight its name and click Open The 1 0 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 About I O Units 6 4 In ioControl the term 0 unit usually refers to a mounting rack with a brain or brain board and up to 16 I O modules attached The following table shows brains racks and 1 0 modules that can be used in ioControl Max Modules Compatible Racke Module types Brain Part Number The following I O units are supported in ioControl Basic and ioControl Professional SNAP B4M 4 SNAP B8M SNAP analog digital and special purpose SNAP B8MC 8 SNAP B8MC P SNAP UP1 ADS SNAP B3000 ENET SNAP B12M SNAP ENET RTC SNAP B12MC 12 SNAP B12MC P SNAP analog digital and special purpose standard digital in positions 0 7 only SNAP B16M high density digital in any position SNAP B16MC 16 SNAP B16MC P
454. ot have individual names HDD modules do not require configuration so their points do not appear in the Configure I O Points dialog box nor on the Strategy Tree Because HDD points do not have names most ioControl commands use bitmasks to read or write to them e Points on HDD modules cannot be disabled in Debug mode for simulating inputs and outputs e Counting is done differently See Counting on High Density Digital Modules below for details Counting on High Density Digital Modules On standard SNAP digital input modules any point can be configured as a counter because counting is done on the brain We refer to it as high speed counting because it can be very fast depending on the speed of the module On high density SNAP digital modules however the module itself does the counting so no configuration is necessary The module uses a 16 bit counter but the brain used with the module accumulates counts to 32 bits by periodically getting and clearing the module s counts and adding each new count to what it already has for each point Update time varies based on the number of modules on the rack and Ethernet communication demands on the brain When using ioControl User s Guide 10 7 PROGRAMMING WITH COMMANDS ioControl s signed 32 bit variables one bit of the 32 is used for the integer s sign so counts over 2 billion may not be accurate Because counting is done in the module rather than in the brain you c
455. ot open file File does not exist or filename may be incorrect 430 Invalid data range Verify high value is Invalid data passed to driver for example a point number 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 X available 32 total 438 Could not create socket Attempt to create a new Ethernet socket failed X 442 Could not accept on socket Ethernet accept failed X 443 Could not receive on socket Ethernet receive failed X 444 Could not send on socket Ethernet send failed X 531 Buffer full Attempted to write to a full buffer For a serial X communication 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 534 Attempts to communicate with I O unit failed I O unit may have lost power or network connection X X 700 PID Loop has been configured outside of You are trying to download a new strategy but a PID loop is this strategy and could conflict with this currently running on the brain Open ioManager and turn off strategy s logic the loop in Inspect mode by changing its algorithm to None 8607 Invalid protocol Attempted to set a port to an unkn
456. ou 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 ioControl User s Guide 12 7 USING SUBROUTINES re 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 ioii Subroutine Name Group Variable Increase Notification Subroutines h Subroutine s OptoScript Name Names sediinih Variable_Increase_Notification subroutine may differ from Comment those used in the strategy A 7 aN E Add 1 Integer 32 Variable Counter Add Edit Instruction 2 Greater Than Integer 32 Variable Previous_Counter Modify dialog box in the 3 Then Enter Text In String Variable Warning_Notice a trat 4 ut Status In Integer 32 Variable Wot Available Delete strategy Add Instruction aa xj z Subroutine M __ Select file name Prompt and Type parameters from the ILS subroutine define the If Integer 32 Variable Tota Count instruction in the strategy Is Greater Than fi nteger 32 Variable v Previous _Count v Then Enter Test In Sting Variable bd Count_Waming 7
457. oughput You can optimize throughput between the PC and the control engine by increasing the host task s frequency and by using design efficiencies in your strategy Increasing Host Task Frequency If you minimize the number of tasks in the queue the host task is done more frequently and all tasks get more time To minimize tasks combine processes so you have fewer charts Here s how e Determine the processes that are time critical Put these processes in charts with looping logic that runs constantly e Use subroutines for any processes that recur within the strategy A subroutine does not add an additional task it assumes the time slice of the chart that called it Make sure you check the status variable each time a subroutine is called to verify that the call was successful See Chapter 12 Using Subroutines for more information Increasing Efficiencies in Your Strategy A second way to optimize PC to Control Engine throughput is to increase efficiency in condition block loops If the condition block continually loops waiting for the condition to be true the entire time slice for the chart is used up However you can build in a slight delay by using the command Delay mSec with a value of one This command causes the chart to wait one millisecond before checking the condition again and the rest of the chart s time slice is given up while it waits The following graphic shows two conditional loops In the one on the left
458. ounts 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 mode see page 5 12 SNAP PAC S1 SNAP PAC SNAP LCE SNAP Ultimate I O R series Total memory RAM 32 MB 16 MB 16 MB 16 MB Memory used for control 32 MB 10 MB 16 MB 8 MB Memory available for strategy 16 MB 5 MB 8 MB 5 MB and variables Total battery backed RAM 8 MB 2 MB 512 KB 512 KB Battery backed RAM for control 8 MB 1 MB 512 KB 288 KB 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 7 4 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
459. ow and use the scroll bar to see all the 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 ioControl User s Guide WORKING WITH STRATEGIES View and Print a Bill of Materials You can view and print a bill of materials BOM that lists all the 1 0 units and 1 0 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 View Print Bill of Materials ioControl processes the data and puts it in the Bill of Materials window Save Search B Cookies Bill of Materials 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 l 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 AOV 27 Totals Total Brains 1 Total Modules 5 NOTE Controllers power supplies and mounting racks are not specified Contact your local distributor or Opto ZZ for help or to purchase products You may need to r
460. own mode X 8608 Port initialization failed While starting up a chart or task the default host port could X not be created All 10 000 Various descriptions Socket or network problems Check cables and and 11 000 connections to control engine cycle power to control errors engine ioControl User s Guide B 7 B 8 ioControl User s Guide mm APPENDIX C ioControl Files Introduction This appendix lists all of the ioControl file types and special files You can use this information as a reference to determine what types of files are present in your ioControl project directory when you re looking through your ioControl or project directory Files Related to a Strategy lt strategy gt idb ioControl strategy database lt strategy gt crn Run file compiled file that is sent to the control engine lt strategy gt crn1 Intermediate run file component of the run file lt strategy gt crn2 Intermediate run file component of the run file lt strategy gt crn3 Intermediate run file component of the run file lt strategy gt inc Initialization data for variables with Init on Download option component of the run file lt strategy gt inf Strategy configuration information lt strategy gt idb Temporary ioControl strategy database file lt strategy gt lidb ioControl strategy database lock file lt strategy gt per Persistent variable definitions lt strategy gt lt control engine gt cdf Control engine d
461. ownload file for special circumstances see page 7 9 lt chart name gt cht Chart lt chart name gt ccd Compiled chart code component of the run file lt chart name gt con Online compiled chart code ioControl User s Guide C 1 o lt chart name gt cxf Exported chart file lt filename gt wth Watch window file you name the file lt filename gt otg Exported 1 0 configuration file you name the file lt strategy date time gt zip Strategy archive file automatically named see Archiving Strategies on page 7 5 for file name formats Files Associated with a Subroutine lt subroutine name gt isb Subroutine lt subroutine name gt ini Subroutine configuration information lt subroutine name gt isc Compiled subroutine component of the run file lt subroutine name gt lisb Subroutine lock file Files in the ioControl Directory lt XXX gt 10 def Object definition files commands 1 0 points and 1 0 units You must not modify these files ioCtrl exe ioControl executable file ioControl cnt ioControl help contents file ioControl GID ioControl help support file created when you launch the help file ioControl hlp ioControl help file ioControl Commands cnt Commands help contents file ioControlCommands GID Commands help support file created when you launch the help file ioControlCommands hlp Commands help file ioCtrlTools dat File that lists software applications you ve configured in the Tools menu to launch f
462. pe n F 59 68 57 56 o al o a y i 63 62 61 60 SNAP Ethernet Analog and Simple Digital Systems Processors Compatible Racks SNAP PAC R2 SNAP UP1 M64 SNAP ENET S64 SNAP M series SNAP M16 SNAP M32 SNAP M48 SNAP M64 CAUTION Make certain you use a rack shown as compatible for the processor Using any other rack will severely damage the brain or controller 6 8 ioControl User s Guide WORKING WITH 1 0 Le SNAP M series mounting racks can hold up to 4 8 12 or 16 Opto 22 SNAP I O modules Any combination of analog digital serial and high density modules can be placed in any position on the rack not exceeding eight serial modules Each standard SNAP digital module contains four input or four output channels points Digital functions on this brain are limited see the brain s data sheet for specifications SNAP analog modules supported by these processors contain either two or four points Each point on the rack is numbered when you configure the point you reference it by its number The following diagram shows the largest rack as an example All modules start with the same point numbers in position zero on the rack If you are using analog modules with only two points the top two addresses for those analog modules will be empty DIGITAL I O ANALOG I O This diagram applies to SNAP PAC R2 SNAP UP1 M64 SNAP ENET S64 3210 9 20 3210 Module position 0 F 4 76 5 4 a a 765 4 L a
463. pen and click Open The strategy opens in Configure mode with the windows in the same position they were when the strategy was closed Opening a Recently Used Strategy To open a strategy you have 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 ioControl automatically start up with the strategy that was open when you exited choose Configure Options and click to put a check mark next to Load Last Strategy at Startup To have ioControl open strategies in the same mode as when you exited ioControl choose Configure Options and click to put a check mark next to Load Last Mode at Startup Opening Strategies in ioControl Basic and ioControl Professional A strategy saved in ioControl version 6 1 or less can be opened in either ioControl Basic or Professional An ioControl Basic strategy can also be opened in ioControl Professional However ioControl Professional strategies cannot be opened in Basic or in any earlier version of ioControl CAUTION Once a strategy is opened in ioControl Professional it can no longer be opened in ioControl Basic 7 2 ioControl User s Guide WORKING WITH STRATEGIES Opening an OptoControl Strategy If you are moving a Strategy from OptoControl to ioControl Professional ioControl will open it and help you convert it Although many things will convert without difficulty planni
464. pping 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 ioControl s built in OptoScript programming language Connections 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 2 8 ioControl User s Guide IOCONTROL TUTORIAL rs Opening a Block Let s see what s in a block 1 Double click the Drop Dough block The Instructions dialog box appears Instructions Dough_Chip_Control Drop Dough xj For animation in ioDisplay Move From nCookieMotionPreset Modify To dtCookieMotionTimer Delete 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 gt Close Help Command Help This block contains four instructions Move Turn On Delay Sec and Turn Off Each one has a description above it 2 Double click the Turn On instruc
465. pt At the prompt type ioControl User s Guide A 5 So ping control engine s IP address For example type ping 10 192 54 40 If data is returned from the control engine it can 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 a Choose Start Settings Control Panel and double click Network b Highlight the adapter in the list Make sure both NetBEUI and TCP IP appear just below the name of the adapter Click Properties c 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 a Choose Start Settings Control Panel and double click Network b Click the Protocols tab Make sure both NetBEUI and TCP IP are listed Highlight TCP IP and click Properties c 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 a Choose Start Settings gt Control Panel and double click Network and Dialup Connections b Right click your network card and choose Properties from the pop up menu Make sure that TCP IP is present and checked c Highlight TCP IP and click Properties Verify that the IP address and subnet mask are appropriate for your network
466. put Clamp Mistic PID Setpoint Set Mistic PID Input Disable Mistic PID Output Get Mistic PID Setpoint Disable Mistic PID Output Tracking in Manual Mode Set Mistic PID Setpoint Disable Mistic PID Setpoint Tracking in Manual Mode Get Mistic PID Output Enable Mistic PID Output Get Mistic PID Output Rate of Change Enable Mistic PID Output Tracking in Manual Mode Set Mistic PID Output Rate of Change Enable Mistic PID Setpoint Tracking in Manual Mode Get Mistic PID Scan Rate Set Mistic PID Scan Rate What is a PID 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 that is adjusted tuned for each PID loop The mathematical formulas vary but all PID systems share these fundamental concepts e They evaluate a process variable against its setpoint e They 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 I and D constants e The P and D constants need to be tuned for each system 10 62 ioControl User s Guide PROGRAMMING WITH COMMANDS Using PIDs on mistic I O Units E
467. r 64 commands are slower than integer 32 commands and should be used only for these brains 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 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 ioControl 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 informat
468. r Subroutine a siccccsccecsnccraedctssonaitsciscdvencaatsadentoseiaeadanestante 7 15 Single Stepping a ceotcedztsctnctrc vec scesedacaslacddeesitas cangutentianees kccapecteumtaciawdetacdeans 7 15 Auto oe WMI oc azcaessscasnaiasscs taasoic tacdensieqtacines tcehcaceaacose yeetea mectacatantnageinenta taianiaens 7 17 Setting and Removing Breakpoints sncccicciscisciceccasncssecesaesanscnesratseccveacanccedcectatsatasesastante 7 18 Managing Multiple Breakpoints 0 cccceccccescecesestescsteseseeseseeseseessseeseseseneseeneseens 7 19 Interpreting Elapsed TIMES ssssisssiissiissiisssiissnisssiisnissnissniinnnnnnnrinnnrinninnnnnnnnnni 7 20 Viewing and Printing Yip tho areas cee can tc tee necnese ect occ pics tantesaea eee eteaentnas 7 20 Viewing Strategy Filename and Path ccceccscssescssestesescssseseseessssstessseeeseeneseeeees 7 21 Viewing an Individual Chart or Subroutine c cccecescecsceseeteseseeseseesesteteseereseeeees 7 21 Viewing All Charts in a Strategy c cccscsscsssssscsssscssescssescsssscssescssesssesesseseeseseeseseeees 7 21 Printing Chart or Subroutine Graphics csiccic cccsscahsncsnassdduscaosnoadaasdedecsiaecdsassanacacasaaedine 7 23 Setting Up the PAGE lt a scsscencracsacatcnaceansttececcannctaciisateathilesIvescsesaestetesidhsceacascasaacesas 7 23 Previewing a Flowchart Printout c cccccccscscssessesescesescesescescstesestessetesseeessecanees 7 24 Printing One Chart or Subroutine esa acascscdnscsnntes
469. r for the 1 0 unit you want Double click the E Rs folder The Configure Event Reaction dialog box opens listing all configured event reactions Configure Event Reactions Ea iol x Type B3000 SNAP Event Reaction 000 Fill Process Box_Full Counter Start Of O 001 Fill Process Not Used Modify 002 Fill Process Not Used 003 Fill Process Not Used Delete Fill Process Not Used v Fill Process Not Used Group Name Name Add rf Name Groups Group Delete Group buttons 2 To create a group click the Name Groups button Name E R Groups xj Group Name Physical E Rs E Rs 016 to 031 E Rs 032 to 047 E Rs 048 to 063 E Rs 064 to 079 E Rs 080 to 095 E Rs 096 to 111 x Close Help Cose 3 Highlight a physical group of E Rs Click in the Group Name field and type a name Group names must start with a letter and may contain letters numbers and underscores Spaces are converted to underscores ioControl User s Guide 6 49 WORKING WITH 1 0 4 When you have finished naming groups click Close The names appear in the Group Name column of the Configure Event Reaction dialog box Configure Event Reactions i 0 x 120 Unit E3000 _Digital Type B3000 SNAP Reaction _Ref Co Start Of 0 Number Group Name 000 Fill Process Add Box_Full Counter 001 Fill Process Not Used Modify 002 Fil
470. r s Guide WORKING WITH FLOWCHARTS 5 To select more than one element do one of the following e Select the first element hold down the SHIFT key and select additional elements e Click and drag the mouse to draw a rectangle completely around the elements you want to select e 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 Elements 1 1 With the chart open and the Strategy in Configure or Online mode click the Select tool 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 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 To move several elements at once select them and then click and drag them 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
471. r write to the Scratch Pad area in the memory map of a SNAP Ultimate I 0 unit or a SNAP PAC or SNAP LCE 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 Set 1 0 Unit Scratch Pad Bits from MOMO Mask Set 0 Unit Scratch Pad Float Table Get I O Unit Scratch Pad Bits Get I O Unit Scratch Pad Float Table Set I O Unit Scratch Pad Integer 32 Element Set I O Unit Scratch Pad String Element Get O Unit Scratch Pad Integer 32 Element Get 1 0 Unit Scratch Pad String Element Set I O Unit Scratch Pad Integer 32 Table Set I O Unit Scratch Pad String Table Get O Unit Scratch Pad Integer 32 Table Get I O Unit Scratch Pad String Table Set 1 0 Unit Scratch Pad Float Element Get 1 0 Unit Scratch Pad Float Element Since these are I O unit commands when they are used for a SNAP PAC or SNAP LCE controller you must have already configured an 1 0 unit to represent the controller Configure the controller as a SNAP UP1 M64 with the IP address of the control engine 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 1 0 unit will be automatically disabled Each
472. r 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 means enabled No on a red background means disabled To change the status click one of the arrows then click Apply 4 To add the point to a watch window click Add Watch and see page 6 73 ioControl User s Guide 6 55 WORKING WITH 1 0 Inspecting Event Reactions You can review an event reaction s current state modify its status or set its Internal Values or External Values in Debug mode To monitor the event reaction in a watch window see page 6 73 To change the event reaction follow these steps 1 With the strategy running in Debug mode double click the event reaction on the Strategy Tree or double click it in the View I O Unit dialog box The Event Reaction dialog box appears showing the configuration parameters for the event reaction The title bar shows the name of the event reaction and whether scanning is occurring Control_Temp_Over_300_Degrees scanning Of x A Name ControlTemp_Over_300_Degrees Enabled i B C Unit Analog_IO_Unit Error None f D Event Type Analog Input gt Value Compare Value 200 Reaction Type Activate PID Loop VAL Event Occurring No E Event Occurred No Scan Status Event Analog Input gt Value VAL KVAL
473. re Control Variable Increase Notification 1 2 frulll 13 06 01 09 17 04 z Drag the edge of a column heading to see all the information in the column See Message Queue Information below 3 To delete the top oldest message on the list click Pop First Message 4 To delete all messages click Clear Messages 5 Close the dialog box to return to the Inspect Control Engine dialog box Any changes you have made to the queue are reflected there ioControl User s Guide 5 15 WORKING WITH CONTROL ENGINES 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 B 3 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 1 0 unit Chart shows lt system gt 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 lt sub name gt lt block number gt 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 Deb
474. reserved Ethernet port numbers at http 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 mixup 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 tcep 22004 Ethernet TCP from another control engine tcep 22005 ioControl User s Guide 10 37 PROGRAMMING WITH COMMANDS To add a communication handle see the steps starting on page 9 5 TCP Communication Handle Examples The following diagram shows an example of a communication handle value for outgoing communication Outgoing Communication SNAP Ultimate 1 0 Device A IP address 10 192 59 45 IP address 10 192 59 31 e Request communication Receives communication Communicate ae on port 22004 Communication Handle value tcop 10 192 59 31 22004 For incoming communication the communication handle value could be Incoming Communication SNAP Ultimate 1 0 Device A IP address 10 192 59 45 IP address 10 192 59 31 Request communication ee Sends communication to wi 10 192
475. rget Address State for one I O unit or Set All Target Address States for all 1 0 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 If both addresses are disabled or unavailable then communication is not possible and the I O unit becomes disabled You can find out which addresses are enabled for an 1 0 unit and which address is currently active by using Get Target Address State To use these commands you must have already designated primary and secondary IP addresses when configuring 1 0 units See page 6 12 for steps For additional information about link redundancy see Using Ethernet Link Redundancy in ioControl on page 5 6 Table Commands The table commands for 1 0 units affect the states or values of all points on the I O unit at once For example you can use the command Move 1 0 Unit to Numeric Table to read the states of all Digital Points and the values of all Analog Points on one 0 unit and place them into a table for easy retrieval Table commands move data very quickly for faster throughput Other commands relating to tables can be found in Miscellaneous Commands on page 10 21 Logical Commands on page 10 33 Mathematical Commands on page 10 32
476. riable Results in 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 JO 2 2 49 lt Length is gt 10 28 ioControl User s Guide PROGRAMMING WITH COMMANDS ee Comparison to Visual Basic and C The following table lists ioControl string commands and their equivalents in Microsoft Visual Basic and C If you are using OptoScript see Appendix F OptoScript Language Reference for additional comparisons ioControl Command Visual Basic Append Character to String S S Chr MyChar i strlen str str i MyChar str i 1 0 Append String to String S S Hello strcat str Hello Convert Hex String Number 1 amp h S sscanf str x amp iNum Convert Number to S Hex 1 sprintf str x iNum Formatted Hex String Convert Number to String S CStr 1 sprintf str d iNum sprintf str f fNum Convert String to Float F CSng S sscanf str f amp fNum fNum atof str Convert String to Integer 32 1 Clnt S sscanf str d amp iNum iNum atoi str Get Nth Character MyByte MyByte str n ASC MID Str n 1 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 str
477. riable a persistent variable see Persistent Data on page 9 4 ioControl User s Guide 9 7 USING VARIABLES AND COMMANDS 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 What happens to the variable s value when Varlable Strategy stops then starts gt Same strategy is Power is cycled through debugger or autorun downloaded Variable initialized Set to initial value Set to initial value Set to initial value on strategy run default Variable initialized Retains current value Retains current value Set to initial value on 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 If you leave this field blank the initial value is set to zero For pointer variables only When you have selected 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 For communication handles only Enter a string containing communication parameters in the correct fo
478. ring This technique works for all control characters except null 00 carriage return OD line feed 0A backspace 08 and CTRL Z 1A 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 e 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 ioControl User s Guide 10 25 PROGRAMMING WITH COMMANDS 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 Width is gt String_1 O P T JO 2 2 lt Length is 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 e Bytes of Memory Required Declared Width 4 x Declared Length 26 4 x 5 150 lt Width is gt Index 0 O P T O 2 2 UJLIT T MJA TIE I O Index 1 l n njoj vja i e I JO Index 2 Dle ljifv elri
479. rmD TuneD ScanTime PvIn 2 PvIn_1 PviIn_2 AOutput Span Gain ATermP ATermI 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 Err TermP Err TermI TunelI ScanTime Integral TermD TuneD ScanTime PvIn PviIn_1 Ideal or ISA Algorithm Output Span Gain TermP TermI TermD ioControl User s Guide 10 61 PROGRAMMING WITH COMMANDS Parallel Algorithm Output Span Gain TermP TermI TermD Interacting Algorithm Output Span Gain TermP TermI 1 TermD PID Mistic Commands The following commands are used for PID loops running on mistic 1 0 units only For PID loops on Ethernet based 1 0 units see PID Ethernet Commands on page 10 58 Get Mistic PID P Term Get Mistic PID Mode Set Mistic PID P Term Set Mistic PID Mode to Auto Get Mistic PID Term Set Mistic PID Mode to Manual Set Mistic PID Term Get Mistic PID Control Word Get Mistic PID D Term Set Mistic PID Control Word Set Mistic PID D Term Clamp Mistic PID Output Get Mistic PID In
480. rmat 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 10 35 for information and examples e fyou are talking to a serial module use the IP address of the brain the module is attached to and use the serial module s port number according to its position on the rack for example tcp 10 192 55 185 22502 See Opto 22 form 1191 the SNAP Serial Communication Module User s Guide for port numbers e fyou are talking to another SNAP Ultimate brain be aware of port numbers that are reserved for a specific protocol For more infomration see the section on Security in form 1311 the SNAP Ultimate 1 0 System User s Guide e 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 standard Ethernet port numbers refer to http www lana org assignments port numbers e fyou 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 se
481. rol 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 Naming Conventions To save trouble in the long run it s wise to establish naming conventions for charts blocks variables I 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 ioControl automatically alphabetizes these names you can plan naming schemes to place 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 e Mstr_Conveyor_Process master chart that calls others for a sub process e Call_Message_Display chart called by a master chart for a specific purpose 4 10 ioControl User s Guide DESIGNING YOUR STRATEGY 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
482. rom Numeric Table x nt 0 F Element Move from Pointer Table pn pt 0 F Element Move from String Table s st 0 P Element Move I O Unit to Numeric MoveloUnitToNumTable I O Unit Starting P Table Index Of Table Move Numeric Table Element nt1 0 nt2 5 P to Numeric Table Move Numeric Table to I O MoveNumTableToloUnit Start at Index Of P Unit Table Move to Move Numeric Table to MoveNumTableToNumTable From Table From P Numeric Table Index To Table To Index Length Move String sL 52 P Move to Numeric Table nt 0 x P Element Move to Numeric Table MoveToNumTableElements From Start Index P Elements End Index Of Table Move to Pointer pn amp n F ioControl User s Guide E 13 OPTOSCRIPT COMMAND EQUIVALENTS ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name Move to Pointer Table pt 0 amp n F Element Move to String Table Element st 0 s P Move to String Table MoveToStrTableElements From Start Index P Elements End Index Of Table Multiply x y F Natural Log NaturalLog Of F NOT not x F Not Equal to Numeric Table n lt gt nt 0 F Element Not Equal x lt gt y F NOT not x F Numeric Table Element Bit NumTableElementBitClear Element Index Of P Clear Integer Table Bit to Clear Numeric Table Element Bit NumTableElementBitSet Element Index Of P Set I
483. rom ioContro ioSnif log ioMessage Viewer log file OptoScriptlemp txt A temporary file Readme txt README text file containing information about 1oControl C 2 ioControl User s Guide APPENDIX D Sample Strategy Introduction Chapter 2 ioControl Tutorial introduced the Cookies strategy a sample project used to illustrate how ioControl 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 ZIE J PT 100 PLANT AIR LOW LEVEL VESSEL HOPPER UOWENEI ed ALARM SWITCH 100 v 101 ALARM SWITCH SOLENOID SV aX Sar SOLENOID valve 100B VALVE CONVEYOR OVEN INSPECTION TT TY STATION 102 103 TIC 102 WASTE BIN TEMPERATURE CONTROLLER ioControl User s Guide D 1 So 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
484. ror because the element at ptPointT 3 is a string and therefore does not match the variable pntl which is defined as an integer 32 pnl ptPointT 1 pfl ptPointT 2 pni ptPointT 3 OptoScript 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 ioControl commands such as Multiply Bit Shift and Greater Than or Equal are not used Using Mathematical Expressions Addition Subtraction nCount nLast_Count 2 nNumber_A nNumber_B 250 fPressure 1 5 fReading fRange fMax_Temp nTotal nMonday nTuesday 10 fMin_Temp Multiplication Division nQuantity nBoxes 12 nBoxes nCount 6 nHours nSeconds 60 60 fConversion fLimit 2 0 fMax_Speed fSpeed 16 52 Modulo division If any argument is a float it is Mixture of operators rounded to an integer before the division occurs nAvg nHrs_A nHrs_B 2 nVarl nVar2 2 nVarl fFloat2 nVar3 4 nVarl 2 nVar2 nVar3 a fFloatl 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 fFloatl fFloat2 2 3 The and operators have greater precedence than and See page F 9 for the order of precedence In the following
485. ror Handling Clamp Float Table Element High Density Digital Module Clamp Float Variable 170 Unit Clamp Integer 32 Table Element 120 Unit Event Message Clamp Integer 32 Variable 1 0 Unit Memory Map Complement 140 Unit Scratch Pad Cosine Logical Decrement Variable Divide Miscellaneous Generate Random Number PID Hyperbolic Cosine Painters Hyperbolic Sine Simulation Hyperbolic Tangent String Increment Variable Subroutines Maximum Time Date Minimum Timing Modulo Cancel Help Command Heb ioControl User s Guide 2 13 IOCONTROL TUTORIAL oe All ioControl 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 do with increasing a counter Counting sounds like math so let s try the Mathematical group 5 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 Select Instruction x Groups Instructions Absolute Value Add Arccosine Aresine Arctangent Clamp Float Table Element Clamp Float Variable Clamp Integer 32 T able Element Clamp Integer 32 Variable Complement Cosine Decrement Variable Divide Generate Random Number Hyperbolic Cosine Hyperbolic Sine Hyperbolic Tangent Analog Point Chart Communication Control Engine Digital Point Error Handling High Density Digital Module 140 Unit 140 Unit E
486. roughput cece 4 21 Steps to Design How do you get from your real world control problem to a working ioControl 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 Define the 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 Break down the larger process task into sub process tasks Break down the sub process tasks into detailed steps e Test the steps ioControl User s Guide 4 1 DESIGNING YOUR STRATEGY Next build the strategy e Configure hardware Control Engines 1 0 units 1 0 points e Determine necessary variables and configure them e Create charts one for each sub process and add instructions e 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 ioControl 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
487. rror handling commands are used to monitor errors figure out which I O unit caused an error disable or re enable the unit and clear errors and other messages from the message queue For a simple example of an error handler chart see page 4 13 For more on the message queue see Queue Messages on page B 2 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 Pointer Commands The following commands are used with pointers Move to Pointer Move to Pointer Table Move from Pointer Table Element Get Pointer From Name See also Understanding Pointers Advantages of Using Pointers Referencing Objects with Pointers 10 56 ioControl User s Guide Clear Pointer Clear Pointer Table Element Pointer Equal to NULL Pointer Table Element Equal to NULL PROGRAMMING WITH COMMANDS 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 ioControl can point to many different types of objects e Another variable e A Digital Point or object e An Analog Point or object e An O unit e Achart Pointers cannot point to other pointers however If you try to move a pointer to a pointer ioContro
488. rt 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 e To search for an instruction click Instruction Click Action or Condition and choose the instruction you want from the drop down list e To search for blocks that are not connected to other blocks click Missing Connections e To search for Condition Blocks that have no instructions click Empty Cond Blocks 4 Click Find 7 30 ioControl User s Guide WORKING WITH STRATEGIES The dialog box expands and the search results appear at the bottom m Search Scope Find Global Chart Local Digital_Contral zj 2 r Search For Print C Operand Instruction Missing Connections Empty Cond Blocks Action Condition Close Instruction Help Delay mSec 7 Select Chat Block Name Block ID Command _ _ _ _ _ Flag_Example_Chart Delay 1 msec Delay mSec Simple_Error_Handling_C Delay 100 msec Delay mSec L_ Search 2 occurrence s found results 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 printer 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 or instruction wit
489. rt 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 ioControl 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 ioControl tries to establish communication through the port If it fails it tries again as many times as specified in D Any positive integer is valid For Ethernet 3 5 seconds 3000 5000 milliseconds is a good starting point Associating the Control Engine with Your Strategy After you have defined the control engine on your PC see page 5 2 it can be associated with your Strategy 1 If you are in iolerminal close iolerminal Open the strategy in ioControl Configure mode or Online mode and choose Configure gt Control Engine 5 4 ioControl User s Guide WORKING WITH CONTROL ENGINES In the Configure Control Engines dialog box the engine s name appears in the list Configure Control Engines x Active Engine Active engine Ultimate Brain Engines Associated with Strategy List of control engines Set Active Modify Delete Download Options OK Cancel Help 2 Check to make sure the correct control engine appears in the Active Engine f
490. s Resize the dialog box to see all entries at once v Apply Add Watch Help i 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 2 To change a table entry click its index number highlight the value and type in a new value Click Apply 3 To monitor the table in a watch window click Add Watch The Add Watch Entry dialog box appears Add Watch Entry zix Name Days_Table Length F m Select Indexes To Watch cii C Single Index C Range from l to r Select Watch Window o New Open Cancel Help 4 In the Add Watch Entry dialog box do one of the following e f the watch window you want to use to monitor the table variable is open choose it from the Select Watch window drop down list e f the watch window you want is not open click Open Navigate to it and double click it to open it e lf you want to monitor the variable in a new watch window click New For help see Creating a Watch Window on page 6 73 ioControl User s Guide 9 17 USING VARIABLES AND COMMANDS 5 Select the indexes you want to watch 6 When the Add Watch Entry dialog box shows the correct items to watch and the watch window you want click OK The table variable appear
491. s 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 11 14 for help 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 7 13 ioControl User s Guide 11 29 USING OPTOSCRIPT 11 30 ioControl User s Guide CHAPTER 12 Using Subroutines Introduction This chapter shows you how to create and use subroutines In this Chapter About Subroutines ceeceees 12 1 Using SUIS sss cac ccc csercctaacantacs cosecashe 12 9 Creating SUbrOUtINGS c cece 12 3 Viewing and Printing Subroutines 12 12 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 in 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 c
492. s 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 12 2 ioControl User s Guide USING SUBROUTINES ne Creating Subroutines 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 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 72 Nesting too deep future use Drawing the Flowchart 1 In the ioControl main window with or without a strategy open choose Subroutine New The Create New Subroutine dialog box appears create new subroutine nnI I III Look in My Cookies JJe f amp ee E File name l Files of type ioControl Subroutine Files isb 7 Cancel
493. s as necessary See View PID Loop mistic Dialog below 3 To add the PID loop to a watch window click Add Watch and see page 6 73 4 To save copy or print the current plot click the Data button and choose from the popup menu View PID Loop mistic Dialog A Input Output and Setpoint current internal and external values Change each to any valid value If lower and upper clamps appear to the right of the value these clamps define the range of valid values Otherwise the valid range is defined by the 0 point itself If you can change them click Apply B Gain Integral and Derivative current internal and external values You can change the gain term to any value except zero in the range 32768 to 32767 You can change the integral and derivative terms to any value in the range zero to 32767 If you change them click Apply 6 72 ioControl User s Guide WORKING WITH 1 0 Ue C Scan Rate and Maximum Change Rates current internal and external values You can change the scan rate to any value in the range 0 1 to 6553 5 seconds You can change the maximum change rate to a value between one percent and 100 percent of the output range defined by the output s zero scale and full scale values If you change them click Apply Asterisks in an IVAL field indicate that a valid scan rate or maximum change rate hasn t been read yet usually before the strategy is run D PID execution mode A green background means Automat
494. s block and steps 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 button to turn stepping off Then close the Powerup chart 4 Double click the Charts folder on the Strategy Tree 2 24 ioControl User s Guide IOCONTROL TUTORIAL T Ma The View Chart Status dialog box appears iew Chart Status al 15 x Status Mode Breakpoint Status PausedAt Alarms Running Step Off Break Off Dough_Chip_Control Running Step Off Break Off Dough_Vessel_Pres Running Step Off Break Off Oven_Inspection_C Running Step Off Break Off Powerup Stopped Step Off Break Off Hoo 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 Click the Zoom Out button on the toolbar to view the window at a smaller percentage There are several ot
495. s c o nitirjo l Index 3 pirjolgiria m mlalbji ililtiyl aj njd Index 4 e n tlelrip r ilsje clo n njlelcit ilvlilitiy A string table is a collection of strings Each string is referred to by the name of 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 JO 2 2 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 10 26 ioControl User s Guide PROGRAMMING WITH COMMANDS 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_Stringi 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 strin
496. s flash memory eventually wears out See Saving to Flash on Every Download on page 7 5 e In 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 5 12 for more on the Inspect dialog box 7 12 ioControl User s Guide Stopping WORKING WITH STRATEGIES 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 ioManager and set the Control Engine port to 0 and then save that change to flash For more information on setting this port see form 1440 the ioManager User s Guide NOTE This action also disables communication between ioDisplay and the control engine a Strategy To stop the strategy click the Stop Strategy button a or press F3 or select Debug Stop You can also stop a strategy from the Inspecting dialog box see page 5 12 Debugging 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
497. s gray ioControl User s Guide 10 21 PROGRAMMING WITH COMMANDS Event Reaction Commands The following commands are used with event reactions on mistic 1 0 units only They cannot be used with Ethernet based O units NOTE Similar events and reactions can be configured on a SNAP Ethernet based 1 0 unit using ioManager but they can interfere with ioControl strategy logic unless you are very careful For more information see the ioManager User s Guide Opto 22 form 1440 Event Occurred Disable Scanning for Event Event Occurring Enable Scanning for Event Get Event Latches Disable Scanning for All Events Get amp Clear Event Latches Enable Scanning for All Events Clear Event Latch Disable Scanning of Event Reaction Group Clear All Event Latches Enable Scanning of Event Reaction Group Read Event Reaction Hold Buffer Event Scanning Disabled Event Scanning Enabled Understanding Event Reactions mistic 1 0 Units Only An event reaction lets you distribute control logic to an 0 unit so that some of the logic in a strategy can be run on the I O unit independently of the controller Event reactions are supported by most mistic protocol brains To verify check the data sheet for the brain you are using As the name suggests an event reaction consists of an event and a corresponding reaction The event is a state you define that the I O unit can recognize The defined state can be a combination of values inputs and outpu
498. s in the watch window 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 j x Name Pointer_Table Type Pointer Table 4 elements Initialized On Run ee 0 Total_Count a a Previous_Count 2 Status 3 Alarm Inspect Add Watch Help 2 To view the status or value of the item pointed to highlight it in the table and click the Inspect button If you need help follow the steps in Viewing Numeric and String Tables on page 9 16 Adding Commands 9 18 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 1 0 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 ioControl contains more than 500 commands you can use A command in ioControl 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 page 9 25 for steps to configure a continue block To add commands to an action
499. s that pressing the space bar or ENTER is equivalent to clicking the button Now the dialog box looks like this Edit Instruction l x Instruction Decrement Variable x Select Comment Decreases cookie count by one to account for a rejected cookie Type Name integer 32 Variable X nCookie_Counter v Cancel Help Command Hel 14 Press ENTER The dialog box closes and the new command appears in the Instructions window Instructions Oven_Inspection_Control Blow Off Lac 2 0 Modify Delete Nest Block New command Decreases cookie count by one to account for a rejected cookie Previous Block Decrement Variable Leave reject valve on for 2 seconds Delay Sec Turn off reject valve Turn Off doRejectValve nCookie_Counter Close Help Command Help 2 30 ioControl User s Guide IOCONTROL TUTORIAL aaa M 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 on the toolbar A message box appears warning you that changes have been detected and asking if you want to save them before downloading Click Yes to continue Another warning notes that the strategy name or timestamp differs from that in the control engine and asks if you want to continue Click Yes On the toolbar click the Run button
500. s with any window in ioControl you can move the Strategy Tree window by clicking and dragging the title bar you can minimize maximize or dock it by clicking buttons at the right of the title bar or you can reshape it by dragging any edge in any direction 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 A quick look at the tree reveals that our strategy includes five flowcharts in the Charts folder eight Numeric Variables and one Mixed 1 0 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 ioControl activities for example opening flowcharts ioControl User s Guide 2 5 2 6 IOCONTROL TUTORIAL 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 button J in the upper right corner of the Strategy Tree window The Strategy Tree moves into its own frame at the left side of the main window JioControl mfe x File Edt Configure Chart Subroutine Comple Mode Tools View Window Help Dee s sex ME SCSE Rmaoeo AlP ARS n PPY A
501. scssseetesesteseeteseeseseeceseetesssteeseessneees 3 15 Using Tabs to View Open Windows ccccccccccesceescsescseseseseseesesesseseesescseneaneseans 3 15 Docking WINdOWS a cated a asic ec tna heats eee aa ona a 3 17 iv _ ioControl User s Guide EE ee Splitting a Chart or Subroutine WindOW ccccccccccscscesteteseeteseeteseeesestesesteeeseeeeseees 3 18 Zooming in a Chart or Subroutine WINdOW cccceescecscsseeceseseeseseeseseeteseeteseeeees 3 20 Redrawing a Chart or Subroutine WindOW cccccceccceseesesteteseeteseetesestesesteseseeeeseees 3 21 Changing Column Width in a Dialog BOX c ccccccceceseesesestesesteseeesesesestsseseeeeseees 3 22 Sorting Data in a Dialog BOK sosccc cas cencaecrecaesacestasitnuieadeatseesaarsustinsiusineecaseiasiadaessiauuled 3 23 Customizing ioControl for Your Needs cccccccesescsssstesessseseseseseseeseseeseseesesesteneateneeeees 3 24 Setting Decimal Binary or Hex Display MOd ccceccscescstesesesesesestesesseseseseenens 3 24 Setting Hex String WOW 3 acess cunswcsmacuaniatseeuiacanineddoadan ctanadtnet hehe chsneceadsanianicescsacandse 3 25 Customizing Toolbars jeicts ins sctechcctaussiecdeaiesderatbatactcamtecianslestictaujecsabramaldeee ea hieneains 3 25 Choosing Toolbars for Your Screen Resolution cccccesceceseeceseetesesteseseeseseens 3 25 Moving TOI ANS es cede catch cet bentcsdetaninectesersenvsconasieasedinedstbCnieseactachted edocnatednactatonces 3 26 Moving a
502. se Help Command Help 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 15 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 16 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 Instructions Dough_Chip_Control Drop Dough xi Increment a counter of cookies produced Increment Variable nCookie_Counter Open the dough valve Turn On doDoughDispenseValve 4 iz Delete T Next Block Keep the dough valve open for 2 seconds Previous Block Delay Sec 2 0 zI Clann tha alear aala aal n Close Help Command Help 2 16 ioControl User s Guide IOCONTROL TUTORIAL CE Le 17 Click Close to return to the chart 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 18 Save the changes you ve made by clicking the Save Strategy button jon the toolbar Click OK to save Now we re ready to download the strategy to a control engine But first we have to tell ioControl that w
503. se the system to crash If you have trouble installing ioControl contact Opto 22 Product Support at 800 835 6786 or 951 695 3080 System Requirements Installation Requirements Here s what you need to install and run ioControl e Acomputer with at least the minimum processor required for your version of Microsoft Windows 1 GHz Pentium class or better recommended and Ethernet capability e 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 XP or Windows 2000 with SP4 workstation operating system e Atleast 128 MB RAM 256 MB recommended If you are using ioDisplay please note its requirements in the oDisplay Users Guide e Available hard disk space at least 29 MB for ioControl Basic or at least 30 MB for ioControl Professional e Compatible control engine and 1 0 unit s as shown in the following section ioControl User s Guide 1 5 WELCOME TO IOCONTROL Compatible Control Engines and I O Units The following control engine and 1 0 unit combinations are compatible with ioControl Basic and ioControl Professional as shown Using this control engine ioControl Basic l ioControl Professional supports these I O units supports these I O units SNAP PAC S series controller SNAP PAC R1 SNAP PAC R1 SNAP PAC R2 SNAP PAC R2 SNAP Ultimate I O SNAP Ultimate 1 0 SNAP Ethernet I O SNAP Ether
504. sed 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 0 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 ioControl include standard Windows buttons like New and Help as well as special buttons for ioControl functions Like the menu bar the tools that you can use depend on which mode you re in Tools that don t apply to a mode are grayed out The following toolbars are standard in ioControl To change the buttons in them or to create your own toolbar see Customizing Toolbars on page 3 25 File Toolbar New Save Copy Delete Find Help Open l Cut Paste Replace Web links ie Bah x ab ty eo User s Guide About
505. setae ee de tcencet cat at tinaapduciacevcvs ection catetantsnesel dlacleabannt Seatacttuctictatenss 7 1 Creating a New ho 131 121 eaneptee eae anee ee ee em Been aI enone err nro eee WY men eo 7 1 Opening UN INE Fat cated ai subcrh esca tcl iceads tds Sandecah cedar dance dea dacdace baer abaueestewlemiomaceenndcs 7 2 Opening an Existing Strategy sscnsessesaccacscenceacannasacsaeanaattcteunairantactastantactieatseccs uateaticceiessi 7 2 Opening a Recently Used Strategy cccecccsesescesescssescsssesseseasssescesesteseecaseseaseseenens 7 2 Loading a Strategy or Mode at Startup xcsccicuciisubvcssensslsscranhotsstaabintincdvedstecsescastanieestoies 7 2 Opening Strategies in ioControl Basic and ioControl Professional cccccceee 7 2 Opening an OptoControl Strategy oaks zsisccncsccsesacietccisdecce tesedeetesotsoacaducsasaelianepanaesdenmaie 7 3 Saving and COGIC acesctsctucacsserescacusoiatted astataseadessatietdess coat asycbuatdnedsebaacanidomoatnetnccmaccacintecdie 7 3 Saving the Strategy and All Charts ccccscecescesescsescsesessesesseseseessseesescaseseaseseaneen 7 3 Saving the Strategy and Some Charts aces cccctiniastisacnezceyeactsteneblon cose cacacduedesiesduesstecadbed 7 3 Saving the Strategy to a New Name ss sssiissiisssisssiissssisssiisssniisenirrsnrnsenirnrrrrsnrnnnn 7 4 Saving Before WODUGG ING suisireitcceiicincnninsundauniaemutidwtesnencsdiiasdics 7 4 PMS NIMES UN enian ain ee a NEE a LAN 7 4 viii ioControl User s
506. sk Active Mask I O Unit Set Time Set Time To P Set TPO Percent SetTpoPercent To Percent On Point P Set TPO Period SetTpoPeriod To Seconds On Point P Set Up Timer Target Value SetUpTimerTarget Target Value Up Timer P Set Variable False SetVariableFalse Variable P Set Variable True SetVariableTrue Variable P Set Year SetYear To P Shift Numeric Table Elements ShiftNumTableElements Shift Count Table P Sine Sine Of F Square Root SquareRoot Of F Start Continuous Square StartContinuousSquareWave On Time P Wave Seconds Off Time Seconds On Point Start Counter StartCounter On Point P Start Off Pulse StartOffPulse Off Time Seconds On P Point Start On Pulse StartOnPulse On Time Seconds On Point P Start Timer StartTimer Timer P Stop Chart on Error StopChartOnError P Stop Counter StopCounter On Point P Stop Timer StopTimer Timer P String Equal to String Table s st 0 F Element String Equal sl s2 F Subtract x y F Suspend Chart on Error SuspendChartOnError F Tangent Tangent Of F Test Equal See Equal F Test Equal Strings See String Equal F Test Greater See Greater F Test Greater or Equal See Greater Than or Equal F Test Less See Less F Test Less or Equal See Less Than or Equal F E 18 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS ns i Action Condition OptoScr
507. splay Professional and OptoOPCServer This example provides link redundancy for the Ethernet network and a separate serial control network Again note that the computers all have two NICs p l Opto 22 Redundant Network l l l PC with two NICs PC with two NICs 1 running ioDisplay running ioDisplay I l i t pane cose l oDisplay loDisplay al l I gt UEG mera a I I I bers aoi SI I I l l I l l l i PC with two NICs running l OptoOPCServer I I l l ee I E f I l I 1 1 l I l l l l I l i Ethernet switch Ethernet switch I I network 1 SNAP PAC S sorios network 2 l controller controls all I I V O units I l I Ca ele 3 I O units are connected via a serial network Serial network and are controlled by the SNAP PAC Each I O unit is connected to its own group of sensors and actuators kium addu BLL and PECETE location 3 Somos and actuators location 2 4 Ee and aera location 1 ioControl User s Guide 5 9 WORKING WITH CONTROL ENGINES Configuring Ethernet Link Redundancy Ethernet link redundancy to the control engine is easy to configure First make sure the secondary IP address has been assigned in ioManager Then in ioControl just enter both the primary and secondary IP addresses when you configure the control engine see pag
508. sssiissniissninsnrineniinnnninaninnnrrnnennnns 2 24 Auto OMIM catnisosneniniiissetseteheniia a aaa 2 27 Compiling and Downloading the Change c ccccccscscesceseseseseseseseseseseseeseseessscseseseecans 2 31 Using a Watch Window x ac axazciseesdessas ccahacacne ced cassie ececeeteenhas absnds Svkdentwnenepbees mbacbtenteseies 2 33 Closing the Strategy and Exiting cccccscseseseseseeseseesescesssesssesnssesnesescessseesssesnenesencans 2 40 Whats NEXT Ss caceiidc saci pct dct bieadansstcsascaesuadeedancte a aaea ed iauterie A AERE 2 40 Chapter 32 What Is 10COMtrol s ccccitesssiscsesteccdcanseeccesstestasscncdsansiesesaanesetissas 3 1 MOAT CRN kenninga dea T a dea 3 1 UAT AGIOS el cine dl deca wesc eicosanoid denebaceaibeds 3 1 ADOUTIOCOMTKO Seed eer nee eer ner Pere tenini AAE ee a iA AAA AELE 3 1 Control System Example cases cece seuccsnastce doncasdacinsdcaaaeedescaxcecdeedencictathcdatersacesshdetdacdendentss 3 2 General Control IG IG ci canes cee 9c bcigedan dex eno aae dae eas ahatbaanrlleeiaace ada 3 3 PRIM FIO Meema aea A A Eaa E aS REE E Eaa NER 3 3 Control Engines cas san cet shectansceh och needs acces teeta dG segse anus nb enaasechoataceeceue hawaeuceitonines 3 3 Digital and Analog Inputs and QU puts ccsccicsickseccarsecsessescaeaced xeosdsecdesdanbieladueccontssobeacss 3 3 SNAP Special Purpose 1 0 Modules c ccccccsescescescscsescsesessesessesestessstessecassseeseseenens 3 4 Key Feet sce de hice utc a men AA each ncee E ER AE OAE
509. sticPidControlWord On Mask Off P Word Mask For PID Loop IVAL Set Mistic PID Process valSetMisticPidProcessTerm To On PID P Term Loop IVAL Set Off Latch valSetOffLatch To On Point P IVAL Set Off Pulse valSetOffPulse To On Point P IVAL Set Off Totalizer valSetOffTotalizer To On Point P IVAL Set On Latch valSetOnLatch To On Point P IVAL Set On Pulse valSetOnPulse To On Point P IVAL Set On Totalizer valSetOnTotalizer To On Point P IVAL Set Period valSetPeriod To On Point P IVAL Set TPO Percent valSetTpoPercent To On Point P IVAL Set TPO Period valSetTpoPeriod Value On Point P E 12 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS es M Action Condition OptoScript Command with Arguments OptoScript Equivalent Example amp Command Name IVAL Turn Off IvalTurnOff Point P IVAL Turn On IvalTurnOn Point P Less Than Numeric Table x lt nt 0 F Element Less Than or Equal to x lt nt 0 F Numeric Table Element Less Than or Equal x lt y F Less x lt y F Listen for Incoming ListenForIncomingCommunication F Communication Communication Handle Load Files From Permanent LoadFilesFromPermanent Storage F Storage Make Integer 64 MakeInt64 High Integer Low Integer F Maximum Max Compare With F Minimum Min Compare With F Modulo x gt y F Move x y P Move 32 Bits Move32Bits From To P Move f
510. 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 in Configure mode click the Compile Changes button on the toolbar or choose Compile 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 errors are found Compiling the Entire Strategy To compile the entire strategy including all charts and subroutines in Configure mode click the Compile All button 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 7 8 ioControl User s Guide WORKING WITH STRATEGIES 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 Download Strategy The Download Progress dialog box appears and your strategy is downloaded Downloading Without Usin
511. supports the following bitwise operators bitand bitwise and bitor bitwise or bitxor bitwise xor bitnot bitwise not lt lt left shift gt gt right shift Use the bitwise and operator to and together the Hex literals can be convenient two values bit by bit nl n2 bitand 0x0002 nl n2 bitand 2 nl n2 bitand n3 Use the bitwise or operator to or together the two values Use the bitwise xor operator to xor together the two bit by bit values bit by bit nl n2 bitor 2 nl n2 bitxor 2 nl n2 bitor 0x0002 nl n2 bitxor 0x0002 nl n2 bitor n3 nl n2 bitxor n3 The eft shift operator shifts the left value s bits to the left by the right value nl n2 lt lt 2 left shift n2 s value by 2 nl 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 right shift n2 s value by 2 nl n2 gt gt n3 _ right shift n2 s value by n3 Precedence For a list of operators from highest to lowest precedence see Operators on page F 9 11 20 ioControl User s Guide USING OPTOSCRIPT a OptoScript Control Structures OptoScript provides the following structures to control the flow of logic in the code e If Statements below e Switch or Case Statements on page 11 23 e While Loops on page 11 23 e For Loops on page 11 24 e Repeat Loops on pa
512. susscasecascatcengsttadasbie naeeace eaceiameacaiansastaeaii 6 13 Changing the Baud Rate for Serial 1 0 Units cccsceceecceseeteseeesestesesteeseeneseees 6 14 Changing Configured 1 0 Units acca ces de ncestisraeceereereqsnectetacartnnaksatsaerinmiemccnaccnenasen 6 16 Deleting Configured 0 Units cc ccacdivatpacssdensnnselaelaciteinesaate ceucsiiatsnestchsancnideateachecitedastsice 6 16 Adding 0 Points tac see taceccteat ate dee dan dander uxtreeteln een aces daddetatinchacniee ack ccteenteciacaensetetinbaecss 6 16 Adding a Digital 1 0 Point sacs 2k caacssccsetcaccced caesctnednd cucivsdaieccgacensicda tae easeureidecasinecelbais 6 16 Add Digital Point Dialog BOK wiccsccicasetsicstcsesslascusaicaavhacestinsinnessetaeio arintarersnicbanat 6 20 Adding an Analog WO POM axcceasiasccancal soncetceccsadercecdbstesceccetiad es mbamnlanceuameln uations 6 21 Add Analog Point Dialog BOX scecsccscscckesstassscccensscinsccdscsbanaoesanacsceagausaatedsaiealiatccan 6 23 Configuring Special Purpose MOdUIeS c cccccscecssectesesesesesesceseseeseseesescsescseneseeneaeens 6 25 Configuring a Serial Module ccccsccssseiesdsstscecuscenssaseccactsdescseassasaescedlabs slasaciicahisbissascoes 6 25 Configuring a SNAP High Density Digital Module 0 c ccc cceccceeecesestetesteesteeseees 6 25 Changing Point Configuration scseessaxsac iess2ec erctewesaieileacees Selden astdseasshedtatveacsatctataeiathatinessitania 6 25 Moving a Configured 0 FOIE lt ssucasscivi
513. t 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 I O 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 as shown in the example above D Features To 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 1 0 point enabled or disabled on startup Enabled is the default 6 20 ioControl User s Guide WORKING WITH I O Adding an Analog I O Point 1 With the strategy open and in Configure mode double click the 1 0 Units folder not the individual unit s icon on the Strategy Tree In the Configure 1 0 Units dialog box highlight the 1 0 unit the points are on and click 1 0 Points The Configure 0 Points dialog box appears ioControl Pro only If you are using a n
514. t 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 you 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 4 19 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 PID Ethernet Commands The following commands are used with PID loops on SNAP Ethernet based 1 0 units For mistic 0 units see PID Mistic Commands on pag
515. t Command with Arguments OptoScript Equivalent Example g Command Name Set Communication Handle SetCommunicationHandleValue From To P Value Set Date SetDate To P Set Day SetDay To P Set Down Timer Preset Value SetDownTimerPreset Target Value Down P Timer Set End Of Message SetEndOfMessageTerminator Communication P Terminator Handle To Character Set HDD Module from SetHddModulefromMOMOMasks I O Unit Module F MOMO Masks Number Must On Mask Must Off Mask Set Hours SetHours To P Set I O Unit Event Message SetIoUnitEventMessageState I O Unit Event F State Message State Set I O Unit Event Message SetIoUnitEventMessageText I O Unit Event F Text Message Message Text Set I O Unit from MOMO Set IoUnitFromMomo Must On Mask Must Off P Masks Mask Digital I O Unit Set I O Unit Scratch Pad Bits SetIoUnitScratchPadBitsFromMomoMask I O F from MOMO Mask Unit Must on Mask Must off Mask Set I O Unit Scratch Pad SetIoUnitScratchPadFloatElement I O Unit F Float Element Index From Set I O Unit Scratch Pad Set IoUnitScratchPadFloatTable I O Unit F Float Table Length To Index From Index From Table Set I O Unit Scratch Pad SetIoUnitScratchPadInt32Element I O Unit F Integer 32 Element Index From Set I O Unit Scratch Pad Set IoUnitScratchPadInt32Table I O Unit F Integer 32 Table Length To Index From Index From Table Set I O Unit Scratch Pad SetIoUnitScratchPadStringElement I O Unit F String Element
516. t F Unit Memory Map Index I O Unit Mem address To Receive Character ReceiveChar Communication Handle F Receive N Characters ReceiveNChars Put In Number of F Characters Communication Handle Receive Numeric Table ReceiveNumTable Length Start at Index Of F Table Communication Handle Receive String ReceiveString Put In Communication F Handle Remove Current Error and RemoveCurrentError P Point to Next Error Retrieve Strategy CRC RetrieveStrategyCre F Round Round Value F Save Files To Permanent SaveFilesToPermanent Storage F Storage Seed Random Number SeedRandomNumber P Send Communication Handle SendCommunicat ionHandleCommand F Command Communication Handle Command Set All Target Address States SetAllTargetAddressStates Must On Mask P Must Off Mask Active Mask Set Analog Filter Weight SetAnalogFilterWeight To On Point P Set Analog Gain SetAnalogGain To On Point P Set Analog Load Cell Fast SetAnalogLoadCellFastSettleLevel To On P Settle Level Point Set Analog Load Cell Filter SetAnalogLoadCellFilterWeight To On P Weight Point Set Analog Offset SetAnalogOffset To On Point P Set Analog Totalizer Rate SetAnalogTotalizerRate To Seconds On P Point Set Analog TPO Period SetAnalogTpoPeriod To On Point P ioControl User s Guide E 15 OPTOSCRIPT COMMAND EQUIVALENTS ee Action Condition OptoScrip
517. t Mistic PID Scan Rate GetMisticPidScanRate From PID Loop F Get Mistic PID Setpoint GetMisticPidSetpoint PID Loop F Get Month GetMonth F Get Name of Chart Causing GetNameOfChartCausingCurrentError Put in P Current Error Get Name of I O Unit GetNameOfIoUnitCausingCurrentError Put in P Causing Current Error Get Nth Character GetNthCharacter From String Index x sin F Get Number of Characters GetNumCharsWaiting On Communication F Waiting Handle Get Off Latch See Off Latch Set F Get Off Pulse Measurement GetOffPulseMeasurement From Point F Get Off Pulse Measurement Get Of fPulseMeasurementCompleteStatus From F Complete Status Point Get Off Time Totalizer GetOffTimeTotalizer From Point F Get On Latch GetOnLatch On Point See On Latch Set F Get On Pulse Measurement Get OnPulseMeasurement From Point F Get On Pulse Measurement Get OnPulseMeasurementCompleteStatus From F Complete Status Point Get On Time Totalizer GetOnTimeTotalizer From Point F Get Period GetPeriod From Point F Get Period Measurement GetPeriodMeasurementCompleteStatus From F Complete Status Point Get PID Configuration Flags GetPidConfigFlags PID Loop F Get PID Current Input GetPidCurrentInput PID Loop F Get PID Current Setpoint GetPidCurrentSetpoint PID Loop F E 10 ioControl User s Guide OPTOSCRIPT COMMAND EQUIVALENTS EE ee
518. t Value Up Timer Target Time Reached 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 To allow 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 To let a 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 see Increasing Efficiencies in Your Strategy on page 4 22 Using Timers Timers are a special type of numeric variable An ioControl 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 ioControl configure a numeric variable and select the type Up Timer or Down Timer You can use any ioControl 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 ioControl 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 ioControl User s Guide 1
519. t 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 WARNING 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 delete the 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 From the Windows Start menu select Run The Run dialog box appears 2 Enter the 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 3 Select the HKEY_LOCAL_MACHINE window to make it active 4 Double click the Software folder in the HKEY_LOCAL_MACHINE window 5 Select the Opto22 folder 6 In the Security menu choose Permissions The Registry Key Permissions dialog box opens Make sure that Opto22 appears next to Registry Key at the top of the window 7 Click Add 8 In the Select Users Computers or Groups dialog box select the name of the appropriate group or domain from the Look In drop down list 9 In the Name list select the name of the user or gro
520. t literals may use scientific notation fVariablel 0 0 fVariable2 12 3 fVariable3 123 456 fVariable3 1 23456e2 fVariable3 12345 6e 2 11 14 ioControl User s Guide USING OPTOSCRIPT ne Making Assignments to Numeric Variables Values are easily assigned to variables Simple Integer 32 assignments Simple Integer 64 assignments nl 1 nnl 2164 n2 nl nn2 nnl Simple Float assignments Simple assignments between different data types fl 3 0 Types will be automatically converted to match f2 fl nl 4 0 nni nl fl nil 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 n 97 sString Chr 97 sString Chr 97 Strings can be used in the following ways String literals must be all on one line String variables sGreeting Hello world sOutgoing sIncoming When you use the Chr keyword to assign a A string can be thought of as a table of character value to a string variable you can characters The number in square either quote a character or give its ASCII
521. t this limitation produces better programming because each function has only one exit point ioControl s Target Audience Because ioControl 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 ioControl F 6 ioControl User s Guide OPTOSCRIPT LANGUAGE REFERENCE Even an experienced programmer may want to think twice before using OptoScript blocks extensively Many programmers like ioControl s simplicity not for themselves but for the field 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 oControl Consider limiting your use of OptoScript to math operations complex string manipulation and other logic most suited to scripting so you retain ioControl 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 Inst
522. t to comment out Click Add 3 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 4 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 5 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 9 24 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 11 25 ioControl User s Guide USING VARIABLES AND COMMANDS 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 2 In the Instructions dialog box click any line of the command you want to cut or copy
523. t values on strategy download contact Opto 22 Product Support 9 8 ioControl User s Guide USING VARIABLES AND COMMANDS Adding Tables See the following topics to add numeric string and pointer tables Adding Table Variables below Setting Initial Values in Tables During Strategy Download on page 9 10 Adding Table Variables 1 With the strategy or subroutine open in Configure mode click the Configure Variables button on the toolbar or choose Configure Variables The Configure Variables dialog box opens listing all variables of one type in the strategy Configure Yariables x Scope Global x Type Initial Value 2 W Integer 32 0 Float 0 Type OMERE SES Y Ref Count Description Status_Trashcan Time_of_Day Timer Integer 32 0 Integer 32 0 Down Timer In the Type drop down list choose the type of table variable you want to add To have data in the table be persistent select Persistent in the Scope drop down list Pointer tables cannot be persistent Global is the default scope For more information see Persistent Data on page 9 4 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 ioControl User s Guide 9 9 USING VARIABLES AND COMMANDS The Add Variable dialog box appears Name jl Description Type Sting Table 7 Table Length fi String Width fi
524. tVariable found in the ioControl database DigloUnitVariable MixedloUnitVariable Good examples MyInt MyInt2 PointerVariable My_Int_3 NumericTable Bad examples _MyInt OMyInt StringTable PointerTable CommunicationHandle CommandProcedure letter 1 letter A letter followed by mix of letters digits CommandProcedureNoArgs digit _ 0 and underscores The name must be a CommandFunction built in command or subroutine CommandFunctionNoArgs Good examples Sine Sine2 Sine _3 Bad examples _Sine OSine Keywords Reserved Words if for switch then to endswitch else step case elseif next break endif default Operators while Chr do wend null repeat until The following table lists operators in order of highest to lowest precedence Operator Name Meaning Comments negation not logical not bitnot bitwise not 7 multiplication division modulo division 3 subtraction addition string append assignment lt lt bitwise left shift ioControl User s Guide F 9 OPTOSCRIPT LANGUAGE REFERENCE Operator Name Meaning Comments gt gt bitwise right shift 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
525. t_Table include the following text 10 0 My_Int_Table TABLE 20 1 My_Int_Table TABLE 30 2 My_Int_Table TABLE 40 3 My_Int_Table TABLE 50 4 My_Int_Table TABLE 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 4 4 and 5 5 for elements zero through four of a float table named My_Float_Table include the following text TA 0 My_Float_Table TABLE My_Float_Table TABLE My_Float_Table TABLE My_Float_Table TABLE n 8 W N a A W N Be A W N Be My_Float_Table TABLE 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 STABLE INN Zero 1 My_String_Table STABLE INN one 2 My_String_Table STABLE SINN two ioControl User s Guide 9 11 USING VARIABLES AND COMMANDS 3 My_String_Table STABLE INN three 4 My_String_Table STABLE INN four Pointer Table Example Each index in a pointer 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
526. table variable 9 12 strategy 7 6 7 9 changing compression 7 11 without using ioControl 7 9 drawing toolbar 3 12 8 3 drum sequencers using event reactions for 10 23 E editing See changing EEPROM See flash elapsed time 7 20 as i error cannot delete item A 2 queue 5 14 B 2 status codes B 3 TCP IP cannot connect A 5 types B 1 See also troubleshooting error handling commands instructions 10 56 programming example 4 13 Ethernet connections 10 41 link redundancy 5 6 commands for 10 15 ports 10 41 event reaction adding 6 42 changing 6 50 commands 10 22 configuration example 6 48 configuring 6 42 deleting 6 51 groups 6 49 inspecting 6 56 MOMO 6 46 6 57 example case statements 4 16 11 7 complex operations 11 10 control system 3 2 counter 4 14 creating messages to display on screen 4 11 error handling chart 4 13 event reaction 6 48 File communication handle 10 43 flag 4 18 FTP communication handle 10 48 if statements 11 8 loops 11 6 mathematical expressions 11 3 mistic PID loop configuration 6 39 pointers indexing 4 19 repetitive actions 4 15 serial communication handle 10 51 string building 10 27 11 4 string data extraction 10 26 string formats 10 25 ioControl User s Guide Index 5 string table 10 26 subroutine parameters 12 8 TCP communication handle 10 38 timer 4 17 exiting See closing exporting chart 8 17 I 0 configuration 6 3 F File c
527. tcc deinen ci ec etedl dene nied in aac Smmaacsasaaders 10 25 Sample String Table 22ers eectiaxienecedcehanedvedandicssevcecsnt as deniahsentede cazactdedeanateanseotaneade 10 26 String Data Extraction EXAMS jsacccnstes sc tsaccasnapsaincccdandaasbstupaseaeabeaniaalegvasaalenicediees 10 26 Find Substring in String Example cscs cccncdasaitsaasisactecassnsstasianachacldeenendarsarseaerpees 10 27 Find Substring in String Example 2 iciccc die dsacelenardelcasinaseutinadtesemacodtidemantene 10 27 String Building Example sectcrsctretacacpsenedisetsssscacatcansssncedeatiaernstsstacsadadeadsnencensceassseaasacdeis 10 27 Move SUA Jek fs cases rd ccnsseh och nash ese ece deceadnett Soastciab covet adie seaceateatenteaeartatntee 10 27 Append Character to II hs facade ee doa hdc ea toainscinona dada ldccouatastaatentanendes 10 28 Append String to SUNG saci cescesascactcoarcctetacdacdccdceasasseadea sneetasraseca eitatesrsdntentaid coast 10 28 Append Character to String cccccccsescsesessssescsseetsssessseetsseseesssnesssnesseeeseeee 10 28 Comparison to Visual Basic and C sicsacduasesiisis orteenssslaraehstaoutensatiativessiacssetanaeaeiablentas 10 29 Convert to String GOUT AIS sc sais acaitcest shaves deneadeactdadaceateabsensedvsariiandenbecenentstives 10 30 ASCII Table eat caeccetectecanzscdacigscecataaeac gag as2isncqnesepuesedcanestasoae extcaseecsagatananeanasiatastiaaetiecss 10 31 Mathematical Commands vcsivsecseceucsecsessesnetcacantaccacman dbp cteac
528. ted 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 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 Ultimate SNAP Ethernet or SNAP Simple 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 LCE controller or SNAP Ultimate brain see Using Serial Communication Handles to Communicate with Serial Devices on page 10 50 10 36 ioControl User s Guide PROGRAMMING WITH COMMANDS EE M Outgoing Communication For outgoing communication communication you request the communication handle s value is in the format tcp lt IP address gt lt port gt Note that tcp is all lowercase letters The following table shows examples of communication handles for outgoing communication
529. tegy open and in Configure mode choose Chart mport The Automatic Chart Import dialog box appears Automatic Chart Import g s Sect 2 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 3 Click Select Navigate to the exported chart Click OK 4 Inthe 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 choose the chart to be replaced 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 8 18 ioControl User s Guide CHAPTER 9 Using Variables and Commands Introduction This chapter discusses the seven types of variables used in ioControl 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 ioControl 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 OptoScript code see Chapter 11 For a list of all standard ioControl commands and their
530. tems 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 e Numeric variables integers floats and timers e Numeric literals integers and floats Other types can be passed into the subroutine through literals however see below for more information e Numeric tables e String variables e String literals e String tables e Communication handles In ioControl Professional the following data types are also supported e For passed in items I O points I O units and pointer tables e For local items pointer variables The following data types are not supported in subroutines PID loops event reactions and charts Although most variables passed in and out of a subroutine must be of a specific type tera s that are passed nto 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 literal
531. that this example is a for 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 ioControl User s Guide 4 15 DESIGNING YOUR STRATEGY 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 ioControl 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 Sometimes 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 Here s a portion of a chart showing the case statements that control this process z L Delete j l Next Block Rs Previous Block Conveyor speed is Move Add checked and moved From Conveyor_Speed_Sensor copie
532. 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 4 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 2 From the Chart or Subroutine menu select Print Preview Graphics The preview window appears showing the image as it will print The cursor becomes a magnifying glass Next Page Prey 2A morma Zoom In Zoot Close Magnifying glass cursor Configure NUM Ai 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 Ifthe 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 7 24 ioControl User s Guide WORKING WITH STRATEGIES 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 7 23 Printing One Chart or Subroutine 1 To print one
533. tility 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 If you 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 _pelimitea added For example if you name the saved file opto_software txt the tab delimited file is named Opto_software_Delimited txt This file can be opened in Microsoft Excel or other programs to easily sort and view its contents ioControl User s Guide A 9 So ra Problems with Permissions in Windows 2000 When you set up controllers on a computer running the Microsoft Windows 2000 operating system typically you are using the computer with top level administrator privileges If someone later uses this same computer to run ioControl or ioDisplay but logs in to the computer with lower level non administrator privileges the application may not recognize control engines tha
534. ting 8 18 loop logic 4 9 looping 11 6 monitoring in watch window 6 73 naming 4 10 8 15 opening 8 14 pausing 7 14 printing commands instructions 7 25 printing graphics 7 23 replacing elements 7 31 saving 7 3 8 14 searching 7 29 status 3 7 7 21 stepping through 7 15 viewing 3 15 7 21 zooming in or out 3 20 chart element changing color or size 8 12 cutting copying and pasting 8 12 moving 8 11 selecting 8 10 closing chart 8 14 strategy 7 3 7 4 command adding 9 18 adding in OptoScript 11 27 arguments 4 7 changing 9 23 commenting out 9 24 cutting copying and pasting 9 24 9 25 definition 3 8 deleting 9 23 deleting temporarily 9 24 for continue block 9 25 groups analog point commands 10 13 chart commands 10 17 communication commands 10 35 control engine commands 10 16 error handling commands 10 56 event reaction commands 10 22 high density digital module commands 10 6 I O unit event message commands 10 54 O unit scratch pad commands 10 51 Ounit memory map commands 10 55 logical commands 10 33 mathematical commands 10 32 miscellaneous commands 10 21 P D Ethernet commands 10 58 PID mistic 10 62 pointer commands 10 56 simulation commands 10 69 string commands 10 23 time date commands 10 18 timing commands 10 19 in OptoScript 11 11 E 1 function 11 14 procedure 11 13 printing 7 25 comment 9 24 10 21 in OptoScript
535. tion handle variable 9 14 creating 6 73 event reactions 6 56 docking 3 17 6 75 message queue 5 14 monitoring pointer variable 9 16 mistic PID 6 71 monitoring table variable 9 16 9 17 numeric table variable 9 16 monitoring variable 9 14 numeric variable 9 14 opening 6 75 PID loop 6 58 while loop 11 6 11 23 pointer table variable 9 17 Windows 2000 pointer variable 9 16 permissions A 9 string table changing numeric table 9 16 string variable 9 14 X subroutine 12 13 XVAL 10 5 two copies of a chart at once 3 18 Z Ww zooming in or out 3 20 warning viewing 5 14 z order changing 8 11 ioControl User s Guide Index 13 Index 14 ioControl User s Guide
536. tion 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 Ee x Instruction Turn Or Select Comment Open the dough valve Type Name Digital Output hd doD oughDispenseYalve v Cancel Help Command Heb 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 ioControl User s Guide 2 9 IOCONTROL TUTORIAL 3 Close the Edit Instruction dialog box by clicking OK or Cancel 4 Back 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 5 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 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 button in the toolb
537. tion to the unit is disabled To enable it again you could stop the strategy and restart it or you could enable the unit in the debugger With this error handling chart however you can automatically enable the 1 0 unit and restore communication while the strategy is running The chart checks the top error in the message queue If it is an 1 0 unit error communication to the unit is enabled If it is not an l 0 unit error another action happens another chart in the strategy is stopped Two delays are built in the first one to release the time slice if an error is not found and the second one to allow the control engine time to restore communication with the 1 0 unit Simple_Enror_Handling_Chart The chart first checks to see if there s an error If not a slight delay gives the control engine time to do other tasks See Increasing Efficiencies in Your Strategy on page 4 22 for more information on using a delay in this way j Instructions Simple_I0_Unit_Error_Handler_Chart 1 0 Eg Error on lO Unit Add a itttcororisaniyo __Modiy unit error the 0 Delete Instructions Simple_10_Unit_Error_Handler_Chart Ena Eg ay ad ce oe Enable 1 0 Unit Causing Current Error Add Modify l l l l Delete C Next Block J B Previous Block Instructions Simple_IO0_Unit_Error_Handler_Chart Go to Eg unit that caused it is enabled communication to that unit is restored
538. tions are scanned by the I O unit in the order that they appear in this list 2 To move an event reaction to a different position on the I O unit use the up and down arrows in the dialog box 3 To change an event reaction s configuration double click its name to open the Edit Event Reaction dialog box Change the fields as necessary For help in completing the fields see Configuring Event Reactions on page 6 42 Deleting Event Reactions mistic I O Units Only You can delete only event reactions with a reference count of zero Be careful when you delete you cannot undo a deletion 1 Make sure the strategy is open and in Configure mode On the Strategy Tree expand the 1 0 units folder until you see the event reaction you want to delete 2 Right click the name of the event reaction and choose Delete from the pop up menu The event reaction is deleted You can also delete an event reaction in the Configure Event Reaction dialog box by highlighting it and clicking Delete Inspecting 1 0 in Debug Mode You may want to inspect or change 0 while you are running 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 6 73 ioControl User s Guide 6 51 WORKING WITH 1 0 ES Inspecting 1 0 Units 1 With the str
539. tncaactestauietecdssedvedianismatssenianactats 7 9 Downloading Without Using ioControl ccc ceccseeseseteseeseseeseseesesesessseseseeseeesens 7 9 Creating the Control Engine Download cdf File c cceccccsescssesessestesesteeeseeeees 7 9 Downloading the cdf File using ioTerminal c cccccececceeeseseeceseetesesteseseeeeseees 7 10 Downloading the cdf File Using a DOS Batch File ccc cceeecestetesteteeeees 7 10 Changing Download Compression site ccscstiaceceas nasnssincctaesaadetnomaisadiveeeaadseconslaeiaedzetesiants 7 11 Running a Strategy NTGIUANY csccscxcceacea lt ascnecacdassissacthednssccannsuts deadendstavieebendcnsapdeashacencasaaadeass 7 12 Running a Strategy Automatically Autorun 00 2 ceccecescsscesceseeseeeseeseeseeseseesteseeeseeseeseevees 7 12 Protecting a Running Strategy cscsscoscn one scceinscenyatuGl A ccsdesdistdser iinadaiaicbdatdinucaotatascaeteNaaiaces 7 13 Stopping es NY ote sens ctts ns enc necceeesacatned ceasinestrstastatintnentoavtan ausaokoutastacinsinsd teestasticlauiaesasintia 7 13 DEBUGGING coh ccc hoe cae tescetenesces hea tv doch T i 7 13 Choosing Debug Level ick aicnncctcenslehse cchaeciteebccetaxden cevdacd aaa aciantsatantenieiawensuena es 7 13 INVICTUS CEC acre ctatiescenstesapacarantasnaasentiacractnstactactsessatsusdvadnseysestessensacesss 7 14 Pausing a Chart or Subroutine cc sesssicascacsctionseacensatsactacdacd sascasncaeocaiselieisoeesddhaasddveasaass 7 14 Stepping Through a Chart o
540. 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 its 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 10 20 ioControl User s Guide PROGRAMMING WITH COMMANDS Miscellaneous Commands The following commands are used with tables and for other purposes Many of them are commonly used Comment Blo
541. to overcome the integral Since the derivative is looking ahead based on the change in slope it has a bigger picture than the integral does This interaction can be observed when the input is below the setpoint and is rising fast The integral tries to increase the output which only makes things worse while the derivative tries to decrease the output The derivative does this because at the current rate of change of the input there will be an input overshoot if the output is increased Therefore the derivative needs to be large enough to counteract the integral when necessary 10 64 ioControl User s Guide PROGRAMMING WITH COMMANDS Configuration Tips PID mistic Gain The gain value must not be zero If input engineering units are negative the output may move in the direction opposite from the one desired If so reverse the sign of the gain Integral The integral is required and must be greater than zero Input The input must not be bipolar An input range of 10 to 10 for example will not work Values such as 300 to 100 100 to 0 and 0 to 100 are acceptable If an application has a bipolar input range it will have to be rescaled to a generic range such as 0 to 100 The setpoint range will then have to match this generic input range Setting the output lower and upper clamps Setting clamps is particularly important if the device controlled by the output signal has dead areas at either end For example say the
542. to the oven 4 Close the nCookie_Counter View Variable window and click the Configure mode button on the toolbar 5 Double click the Oven_Inspection_Control chart on the Strategy Tree to open it The chart window looks something like this is chart maintains the oven temperature and rejects ookies that do not pass visual inspection he Powerup chart starts his 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 100 x 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 2 28 ioControl User s Guide IOCONTROL TUTORIAL a il 6 Double click the Blow Off block to open its instructions window Instructions Oven_Inspection_Control Blow Off i x Reset the on latch after it has been triggered Clear On Latch On Point dilnspectionPassFailSwitch Modify Turn on reject valve to blow away bad cookie Delete Turn On doRejectValve Next Black Leave reject valve on for 2 seconds Previous Block Delay Sec 2 0 Turn off reiect valwe zi Close Help Command Help This command block is executed only wh
543. to those available in Pascal BASIC and C For more information on using OptoScript see Chapter 11 and Appendix E General Notes 1 2 3 The BASIC column is based on Microsoft s Visual Basic language The Pascal column is based on Borland s ObjectPascal language 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 In 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 ioControl User s Guide F 1 t d IPIND SSN 01 U090 Function Comparison OptoScript BASIC c Pascal integer 32 decimal 23 123 123 123 integer 32 hexadecimal 0x123ABC amp H123ABC 0x123ABC amp 123ABC integer 64 decimal 23i64 Not available 123LL or 123i64 123 integer 64 hexadecimal 0x123ABCi64 Not available 0x123ABCLL or 0x123ABCi64 amp 123ABC float standard 2 34 12 34 12 34 12 34 float scientific 2 34E 17 1 234E 18 1 234E 17 12 34E 17 string hello hello hello hello character 65 Not available 65 AN TE TAt block comment Not available line comment numeric assignment n 3 n 3 n 3 n 3 numeric table assignment t 0 1 0 1 Eio L t 0
544. tomatically color coded to help you e Blue operators and control structures e Purple values e Green comments e Black commands and names of variables I O points charts and other items e 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 ioControl User s Guide 11 25 USING OPTOSCRIPT oo 3 To use a command place your cursor in the OptoScript code where you want the command to appear Click the Insert Action Command awf or Insert Condition Command co button in the toolbar Select Instruction x Groups Instructions Chart Communication 1 0 GetAnalogMax alue Communication Peer GetAnalogMinValue Control Engine GetClear4nalogMax alue Digital Point GetClearAnalogMin alue 140 Unit SetAnalogGain SetAnalogOffset SetAnalogT poPeriod Cancel Help Command Heb 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 If you know the command name you can just type it into the OptoScript code Remember that OptoScript command names may be different from standard ioControl commands See Appendix E OptoScript Command Equivalents for more information
545. trategy 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 e Click OK ioControl User s Guide USING SUBROUTINES a il The parameter appears in the Configure Subroutine Parameters dialog box above the Put Status In parameter Configure Subroutine Parameters l jol x Subroutine Name Group Variable Increase Notification Subroutines x Subroutine s OptoScript Name Variable_Inctease_Notification Reference count Comment Modify Delete we Up and down arrow buttons 6 Repeat 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 if you add or delete parameters after including a subroutine in a strategy y
546. tring Verify Reverse CRC 16 on VerifyReverseCrcl6OnString Start Value On F String String Within Limits IsWithinLimits Value Low Limit High x gt nLoLimit and x F Limit lt nHiLimit Write I O Unit Configuration WriteIoUnitConfigToEeprom On I O Unit P to EEPROM ioControl User s Guide E 19 OPTOSCRIPT COMMAND EQUIVALENTS ee Action Condition OptoScript Command with Arguments OptoScript Equivalent Example g Command Name Write Number to I O Unit WriteNumTolIoUnitMemMap I O Unit Mem F Memory Map address Variable Write Numeric Table to I O WriteNumTableToIoUnitMemMap Length Start F Unit Memory Map Index I O Unit Mem address Table Write String Table to I O Unit WriteStrTableTolIoUnitMemMap Length Start F Memory Map Index I O Unit Mem address Table Write String to I O Unit WriteStrToIoUnitMemMap I O Unit Mem F Memory Map address Variable XOR x xor y F XOR See XOR F E 20 ioControl User s Guide APPENDIX F OptoScript Language Reference Introduction This appendix includes the following reference information about the OptoScript language OptoScript Comparison with Standard Programming Languages F 1 Notes to Experienced Programmers F 6 OptoScript Lexical Reference F 8 OptoScript Grammar Syntax Reference F 11 OptoScript Comparison with Standard Programming Languages The tables on the following pages compare OptoScript functions and variables
547. trol o E Fie Edit Control Engine Debug Chart Subroutine Mode Tools view Watch Window Help 18 x Oe tBex e CSG RmGeoer Al Ae i gt m M P CEN ler or Ale S ofr dh Et Cookies EE a Cookies E Control Engines P 4 Cookie Controller Subroutines Included 5 Charts amp Alarms g Dough_Chip_Control Dough_ essel_Press Oven_Inspection_Cc amp Powerup Variables E Numeric Variables 830 bStartFlag Gl dtCookiemotiont 3 14 fDoughPressure fe FRampYalue 14 FSetpointMinusD y gt z F fol Tl chart runs inuously once the ram has been started Drop the dough Drop the chips 1P a m 0 0 E A 4 Running Step On Break Off fi896 590 Sec Cookie Watch Docked watch window C Program Files Opto22 ioProject Software In Progress 6 0 Subs Examples My Cookies Cor Now we ll trip the latch that signals a bad cookie 8 On the Strategy Tree under the I O Units folder at the bottom of the window expand Mixed_lO_Unit by clicking the plus sign at the left of the name You see a folder named Points ioControl User s Guide 2 35 IOCONTROL TUTORIAL 9 Expand the Points folder to display the digital 1 0 points configured for this 1 0 unit eo oa Communication Handles Numeric Tables String Tables 4 Pointer Tables I O Units c A Mixed_1O_Unit Points folder
548. trol differ greatly This guide includes only basic information for configuring PIDs An analog digital SNAP Ethernet I O unit supports 16 PID loops a SNAP Ultimate 1 0 unit supports 32 PID loops If you have ioControl Professional you can also use up to eight PID loops on mistic 1 0 units 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 ioControl commands PIDs and Strategies Because PIDs run on the 0 unit not the control engine PIDs run whether the ioControl Strategy is running or not Once running a PID continues running until the 1 0 unit loses power or the PID is set to Manual When you change PID configuration in ioControl remember that changes are not written to the I O unit until the strategy is downloaded and run For a SNAP Ethernet based 1 0 unit be sure to save PID configuration to flash memory following instructions for the I O unit 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 the new strategy To turn off a PID loop on a SNAP Ethernet based 1 0 unit open ioManager and use Inspect mode to change the PID s algorithm to None Each PID loop must be individually configured and tuned e For SNAP Ethernet based 1 0 u
549. 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 e Smaller details The sprinklers should turn on every Sunday and every Wednesday They should not turn on if it s raining They 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 Input Data the input provides Hygrometer Humidity percentage from 0 100 Day Day of the week Sunday through Saturday Time Hour of the day 24 hour clock 4 2 ioControl User s Guide DESIGNING YOUR STRATEGY EE l Input Data the input provides Sprinkler status Whether sprinklers are currently running on or off Input from timer Length of time sprinklers have been on in minutes 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 rep
550. ts Each time the event becomes true its corresponding reaction is executed once On a digital multifunction 1 0 unit for example any pattern of input and output states on and off can constitute an event On an analog I O unit an event could occur when an input channel attains a reading greater than a selected value Examples of reactions include turning on or off a set of outputs ramping an analog output or enabling or disabling other event reactions Event reactions are stored in each I O unit As soon as power is applied to the I O unit all event reactions for which scanning is enabled are scanned continuously in the same order in which they were configured in ioControl Since each mistic 1 0 unit can be configured with up to 256 event reactions complex tasks and sequences can be performed on an O unit For step by step instructions on configuring event reactions see page 6 42 Why Use Event Reactions e Jo reduce communication overhead between the 1 0 unit and the controller e To distribute control logic sequences to the 0 unit rather than concentrating them in the controller e To handle high speed logic functions more efficiently by distributing them to an I O unit e To increase the execution speed of a strategy in the controller 10 22 ioControl User s Guide PROGRAMMING WITH COMMANDS Typical Applications for Event Reactions e Motor starting logic e Drum sequencers e Alarms e Analog biasing e Power up seque
551. ts a 0 5 second scan rate while the right 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 Here is an example for Scan Rate TemperatureControl Yiew PID Loop scanning Name TemperatureControl Error None Input 80 24991 Gain 5 Scan Rate 3 sec Mode auo Setpoint 80 Tunel 10 Scan Counts 1479 Enable comm fres Output fo Tune D 0 Plot 1 0 Details Misc Details IvAL Velocity Algorithm Input 5 int 80 00 100 11 Data v Input Axis Output Axis Time Axis f Add Watch Save Tuning Help 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 Try various gains to see how well the system stays at setpoint and responds to setpoint changes ioControl User s Guide 6 67 WORKING WITH 1 0 oe In the example below the white arrows added for the example show where gain constants of 2 5 10 and 20 were applied TemperatureControl Yiew PID Loop scanning Name TemperatureControl Error None Input 87 5289 Gain 20 Scan Rate 11 4 sec Mode Auto 2 Setpoint 90 Tunel 0 Scan Counts 60990 Enable comm Fe Output 161 7775 Tune D 0 Plot 1 0 Details Misc Details VAL ISA Al
552. ts 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 a new strategy select File New Strategy or press CTRL N or click the New Folder button El 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 As you can see in the Files of type field ioControl files have an extension of idb ioControl User s Guide 7 1 WORKING WITH STRATEGIES 4 Click Open The new strategy is created Its Strategy Tree and Powerup charts appear in the ioControl main window For information on the main window see page 3 11 For programming information see Chapter 4 Designing Your Strategy For steps to create charts Chapter 8 Working with Flowcharts Opening a Strategy Only one strategy at a time can be open in ioControl 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 Open Strategy or press CTRL 0 or click the Open Strategy button Gi on the toolbar 2 In the Open Strategy dialog box navigate to the strategy you want to o
553. ty digital modules contain 32 points per module e The points on a standard digital input module are isolated from each other Points on high density input modules are in four groups of eight points groups are isolated from each other but points within a group are not isolated e Standard digital modules have LEDs for each point visible on the module s top high density modules do not have LEDs e Standard digital modules can be placed only in digital slots on the mounting rack high density digital modules can be placed anywhere even in slots marked Analog Only e The turn on turn off time is faster for standard digital modules than for high density modules The update time time for data to pass from the module to the brain is also faster for standard digital modules and is determined by the speed of the module itself In high density modules update time depends on the brain s analog scanner and is affected by the number of modules on the rack and how busy the brain is with Ethernet communication For more specific information on turn on turn off and update times see the data sheets for standard and high density modules You may find that inserting Delay commands in your strategy provides more accurate results especially with counters e IMPORTANT Each point on a standard digital module is given a name when configured in ioControl or ioManager and your strategy refers to the point by its name Points on high density modules do n
554. ty 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 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 five VDC This example would look like this Add Analog Point i x lz a Name Fluid _Output Description In this example units are changed to liters second and Tyee fount z lower and upper values are changed Although the module Module SNAP AOV 2 10 10 VDC Scalable z has an output of 10 to 10 volts the device attached to i Scaling the point outputs only 0 5 volts Scaling reflects the device s range In this case Clamping protects the device by ensuring that out of range voltage will never be sent to it Full Range Clamping Actual Scaled Units Moe poe Me Liters second Lower fio ooo pooo fo Upper flO 6 o o e foo Clear Default 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 De
555. u 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 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 ioControl a pointer cannot point to another pointer After you add a pointer through the Add Edit Variable Dialog Box you can use it wherever the object itself would be used Strategy The software program you create using oControl Basic or ioControl 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 ioControl systems each controlling a ioControl User s Guide 3 9 WHAT IS IOCONTROL oo different process and therefore running different strategies Or you may have two or more ioControl systems controlling identical processes in different areas and running the same strategy Variables A variable is a holding place that represents a piece of information 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
556. u 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 10 4 ioControl User s Guide PROGRAMMING WITH COMMANDS 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 ona drain if the level is too high The advantages of using a pulse command are that the point does not have to be turned off and if communication is lost to the point the point does not remain on Pulse Measurement commands measure pulses on digital input points For details see the specific
557. uble 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 from the pop up menu or select Control Engine nspect Also if a blue INFO yellow WARNING or red ERROR box appears in the strategy s status bar you can click the box 5 12 ioControl User s Guide WORKING WITH CONTROL ENGINES The Inspecting dialog box opens oix A Device Type SNAP UP1 ADS B Address 10 192 55 69 C Loader Version R5 0a D Firmware Version R6 0a Version time 16 36 08 15 September 2004 E Volatile RAM 4 99 MB free Persistent RAM 288 00 KB free F File Space Avail 2 12 MB G Device Time 13 42 31 16 September 2004 Syne time to PC H tee a J m Strategy Info K Name Sprinkler_Control Time 14 39 09 16 September 2004 L Status Running Run Stop N M Autorun Enabled Disabled kawul O Archive NOT AVAILABLE m Communication p Loop Time 5 msec Q UpTime 779 seconds 0 hours 12 minutes 59 seconds R Eros No Error Close Here you see data relating to the control engine If you are using Ethernet link redundancy in ioControl 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 5 10 for more information A Device Type Type of dev
558. uctions 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 ioControl commands See Using Logical Operators on page 11 20 for more information Logical True and Logical False ioControl 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 ioControl 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 10 32 for further inform
559. ue ntTable nIndex 10 Set the table element nindex nIndex 1 4 Increment the counter wend 11 22 ioControl User s Guide USING OPTOSCRIPT rs While loops can be nested and can contain other kinds of program statements Each while needs a matching wena at the end For example nl 0 while nl lt 100 while nl gt 50 and n1 lt 60 ntl nl nl 100 nl ni I wend ntl nl nl nl nl 1 wend 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 lt Initialize the counter repeat ntTable nIndex 10 lt gt nIndex nIndex 1 until nIndex gt 5 lt lt Set the table element Increment the counter Execute loop until condition is true Repeat loops can be nested and can contain other kinds of program statements Each repeat statement needs a matching unt ii 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
560. ug mode To monitor the PID loop in a watch window see page 6 73 To change the PID loop follow these steps 1 With the strategy running in Debug mode double click the PID loop on the Strategy Tree or double click it in the View 1 0 Unit dialog box ioControl User s Guide 6 71 WORKING WITH 1 0 The View PID Loop dialog box appears showing the configuration parameters for the PID loop and several values you can change The title bar shows the name of the PID loop and whether scanning is occurring Heater_Controller Yiew PID Loop scanning x Name Heater_Controller Eror Operation performed successfully Enable fres H IVAL VAL Lower Clamp Upper Clamp Name Input fo 84 02603 Room_Temperature A Qutput p 4 372345 fO 0 Retr L Setpoint Je4 0032 84 0032 b o o a Gain foo 200 B Integral fi fi Derivative fo fo C Scan Rate sec 2 2 NasChgRat ho f10 0 100t010 000 D Mode Rutomatic Automate Data M Input Axis Output Axis Y Time Axis M 11 14 00 0 11 16 00 0 11 18 00 0 11 20 00 0 Close App Add Watch Help 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 2 Change the field
561. ug mode the line being executed when the error occurred Object The table 1 0 unit or other object affected by the message In errors 1 and 2 above the control engine was unable to communicate with 1 0 unit EIO_C The unit s IP address is shown for easy reference Time and Date When the error occurred Inspecting Control Engines from the ioTerminal Utility You can also inspect control engines from the ioTerminal utility 1 Click the Windows Start menu and select Programs Opto22 10Project Software Tools ioTerminal The ioTerminal window appears ioT erminal x File Tools Configure View Help Ultimate Brain Number of control engines 1 5 16 ioControl User s Guide WORKING WITH CONTROL ENGINES 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 5 12 Downloading Files to the Control Engine This section discusses how to archive strategies and download Forth files directly related to a Strategy such as library or initialization files For information on using the brain s file system to store data and manipulate it within your strategy see page 10 42 Archiving Strategies Archiving strategies on the control engine provides a backup in case original Strategy files on the computer are lost Archive files are date and time stamped and zipped for compact storage T
562. um is zero which disables the feature J Output Options Choose how the PID should respond if the input goes out of range If no boxes are checked the PID will freeze output at the current value To have ioControl 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 the 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 K Algorithm Choose algorithm Velocity ISA Parallel Interacting For details on algorithms see Algorithm Choices PID Ethernet on page 10 60 ioControl User s Guide 6 33 WORKING WITH 1 0 L Mode Choose Mode Auto activates the PID Manual requires that ioControl logic or an operator control the PID 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 valu
563. unavailable the client application will automatically shift to the secondary address if the secondary address then fails it will automatically try the primary address again You can also manually change the address from within the client application See the OptoOPCServer or ioDisplay user s guide for details ioControl Professional also provides for Ethernet link redundancy from the controller to Ethernet based 1 0 units You can configure a secondary O unit IP address in case communication with the primary address fails The secondary address can be the second Ethernet network interface on a SNAP PAC R series controller or a separate I O unit If you use a separate 0 unit you may find that wiring is problematical See Commands for Ethernet Link Redundancy on page 10 15 for more information on primary and secondary I O units System Architecture for Ethernet Link Redundancy You can set up your system in several ways to take advantage of the link redundancy capability in ioControl The following diagrams show some of those ways For additional information see the user s guides for the SNAP PAC controllers For details on how ioDisplay and OptoOPCServer work with link redundancy see their user s guides 5 6 ioControl User s Guide WORKING WITH CONTROL ENGINES EEE M Ethernet Link Redundancy In this example the primary concern is that the Ethernet network may need maintenance or may fail leaving the computer running Opt
564. und unreachable or when searching a string for a particular character the character wasn t found 59 Could not receive data Command may not apply to the type of communication handle you are using for example Receive commands cannot be used with ftp comm handles Use the get option with Send Communication Handle Command instead 60 Empty stack error ioControl engine Contact Product Support See page 1 4 attempted to perform an operation that expected data on the ioControl engine stack 61 Dictionary full error ioControl engine Attempted to create a variable command or similar item dictionary is full and no more words can be when there s no room left Or large string or numeric tables defined Clear ioDisplay words using are being created in the strategy ioDisplay or ioTerminal if appropriate 62 Stack full error ioControl engine stack has The ioControl engine stack is full grown too big 64 Execute only error A command or word Contact Product Support See page 1 4 was encountered that cannot be used when compiling 66 Requested item in protected dictionary Attempted to remove a strategy when there was no strategy in the control engine 67 Out of memory To minimize the size of your No room left to create any variables or save any dataonthe X strategy reduce the number and size of stack Or an attempt was made to save the strategy to variables especially tables You can also flash without enough room in flash t
565. until the flag is cleared Instructions Flag_Example_Chart Packer busy flag set x Is Packer_Busy Variable True Hadit Delete The condition block Net Block _ checks whether the Previous Block flag has been set ia AND Close Help Command HER C OR indicating that another process is using the machine If the flag has been set the chart logic loops until it has been cleared 3 Flag_Example_Chart A g Instructions Flag_Example_Chart Set Packer_Busy flag x Set Variable True f Y This block sets the flag Packer _Busy so another io process can see that the machine is Deere busy eos a Una Oai l Set Variable False F 3 Z Packer _B When this process is E Hoa complete this block piete clears the flag ue indicating that the Meneses machine 1S NOW Previous Block available for use SS Close Help Command Help 4 18 ioControl User s Guide DESIGNING YOUR STRATEGY Pointers and Indexing This example shows 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 program and produces a large repetitive section in the flowchart It also consumes more control engine memory due to the large numb
566. up that should have control engine access and then click Add 10 If it is not already selected check Full Control in the Permission area Make sure Allow inheritable permissions from parent to propagate to this object is checked 11 Click OK A 10 ioControl User s Guide EE ee 12 Select Registry Exit to close the Registry Editor 13 Restart the computer The user or group you added can now use control engines without having administrator access ioControl User s Guide A 11 A 12 ioControl User s Guide APPENDIX B ioControl Errors and Messages Introduction This appendix discusses errors and messages you may see in ioControl 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 B 3 See ioContro Troubleshooting on page A 1 for additional help in resolving errors Types of Errors As you work in ioControl you may see three types of errors e joControl 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 ioControl Errors ioControl errors indicate a problem within ioControl that may have been reported by the control engine or may have occurred before control engine commu
567. 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 ight_Switch 0 You can turn a digital point on by assigning it any value other than zero ight_Switch 1 ight_Switch 1 ight_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 ITsOn Fan_A ioControl User s Guide 11 11 USING OPTOSCRIPT So OptoScript Syntax 11 12 Here is a sample section of OptoScript code to illustrate syntax Indentation is not required but is used for clarity Each statement is followed by a semicolon 300 0 lt 4 fPressure Table elements are put in square ntTable 2 4 brackets next to the table name nTotal ntTable 0 ntTable 1 GetHours lt 17 lt Parentheses are used as separat
568. vent Message 1 0 Unit Memory Map 140 Unit Scratch Pad Logical Miscellaneous Subroutines Time Date Timing Cancel Help Command Heb Notice that if you need information about any command you can click the Command Help button 6 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 7 Inthe Comment field type Increment a counter of cookies produced 8 Next click the arrow in the Type field the one that currently reads All Valid Types This list shows what those valid types are a float variable an integer 32 variable and an integer 64 variable 9 Counters are integers so select Integer 32 Variable Now we re going to add the integer 32 variable to increment which will be called nCookie_Counter 10 Click the arrow in the Name field which currently reads bStartFlag 2 14 ioControl User s Guide IOCONTROL TUTORIAL The drop down list shows all variables currently configured as integer 32 variables Add Instruction xj Instruction increment Variable Select Comment increment a counter of cookies produced Type Name Integer 32 Variable z X bStartFlag nChartStatus nCookieMotionPreset nLoopCounter Cancel Help Command Heb nCookie_Counter is not in the list because
569. vious Block Keep the dough valve open for 2 seconds Delay Sec 2 0 Close the dough valve Turn Off gt Close Help Command Help We ll add the new instruction command between the Turn On and Delay Sec commands 2 Click anywhere on Delay Sec to highlight this command This highlight indicates the position where the next command is added 2 12 ioControl User s Guide IOCONTROL TUTORIAL as 3 Click Add to open the Add Instruction dialog box Add Instruction a xi Instruction bsolute Value Select Comment pr Type Name OF fal Valid Types 7 jad ough esselPressure hd Put Result in fal Valid Types 7 JaoConveyarS peedControl v Cancel Help Command Help 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 xl Groups Instructions Analog Point Chart Communication Arccosine Control Engine Aresine Digital Point Arctangent Er
570. wckaebecdees F 8 Literals and Names aaccaacsibccieccettisccaesaursescoldorich a eiemeeediAadedeisned eee F 8 Keywords Reserved Words c ccccsccssssesssesssessssessssessssesessesessesessesessesessteeseteeneeenees F 9 ioControl User s Guide xvii Operators eee ene eee ee ae nes RE nn mao eS ee Tn Ore onO Nea ee eg nee F 9 OOM SIM aenar e N cate tlhe E ish clasalsee aca teaentondoesats F 10 OptoScript Grammar Syntax Reference etd acacarced ohare dal eenionaisantowiaseatialealaneces F 11 MMM SMG EEA E E E E A EE A T Index 1 xviii ioControl User s Guide CHAPTER 1 Welcome to toControl Introduction Welcome to ioControl Opto 22 s visual control language for Opto 22 Ethernet based control systems and the input output I O units that work with them ioControl 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 ioControl At the same time ioControl provides a complete and powerful set of commands as well as the OptoScript programming language to meet your most demanding industrial control needs 5 n A TM ioControl comes in two forms ioControl Basic and ioControl Professional e ioControl Basic is included in the purchase of an Opto 22 Ethernet based controller and is also available as a free download from our Web site www opto22 com ioControl B
571. 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 The object you have specified does not exist Do you wish to add it now w cma 12 Click Yes Add ariable xj Name Description Type Integer 32 m Initialization Initialize on strategy run Initial Value fo Initialize on strategy download inCookie Counter Cancel Hep Notice that the name nCookie_Counter and type Integer 32 have already been filled in ioControl User s Guide 2 15 IOCONTROL TUTORIAL 13 Add a description if you wish Leave the initial value at zero which is the default Then click OK to 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 Instructions Dough_Chip_Control Drop Dough i x For animation in ioDisplay Move From nCookieMotionPreset To dtCookieMotionTimer Modify Delete Open the dough valve Turn On Nest Block doDoughDispenseValve Previous Block LEER Increment a counter of cookies produced Increment Variable nCookie_Counter Keep the dough valve open for 2 seconds Nelav Seek zl Clo
572. 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 other variables later if necessary Variable Needed Type Name in ioControl 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 ioControl User s Guide 4 5 DESIGNING YOUR STRATEGY Creating ioControl Charts and Adding Instructions If you have already drawn the process in a flowchart this step will go faster ioControl 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 cr
573. will be used endif CloseCommunication chFTP Using Serial Communication Handles to Communicate with Serial Devices RS 232 serial connectors are located on the top of SNAP PAC controllers SNAP LCE controllers and SNAP Ultimate controller brains These ports can be used for maintenance such as loading new firmware or for Point to Point Protocol PPP communication via modem but they can also be used to send or receive data directly from a serial device such as barcode readers weigh scales or any intelligent device with a serial port Serial communication handles are used to communicate with these devices You must configure the ports specifically for this use See the oManager Users Guide for instructions On a SNAP LCE or SNAP Ultimate brain firmware version 5 1c or newer is required 10 50 ioControl User s Guide PROGRAMMING WITH COMMANDS IMPORTANT Serial communication handles are used only for direct connection to serial devices If you are connecting to serial devices through serial communication modules on the I O unit use a TCP communication handle instead See page 10 36 NOTE Serial I O units are wired to the RS 485 port on the controller and do not require serial communication handles Communication is defined when the I O unit is configured Serial Communication Handle Examples The value for the serial communication handle is in the format ser lt port number gt lt baud rate gt lt parity gt lt d
574. wing chart is also an example of TCP IP communication 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 10 40 ioControl User s Guide PROGRAMMING WITH COMMANDS Incoming_Comm_Control If the devices communicating with each other are all SNAP Ultimate I O systems 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 ioControl 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 64 on current SNAP Ultimate 0 systems The host connection is on port 22000 or 22001 and is used to communicate with the PC that runs ioControl These port numbers are reserved for th
575. 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 Temperature Too High condition block e Turn On Pump 1 or Pump 1 On action block e Pump On condition block Variable names can use Hungarian notation to indicate the type of variable since the variable type is not always apparent in its name See Variable Name Conventions on page 11 14 for a suggested list of notations Variable names might also include a way to distinguish variables used in a single chart or process from variables used by more than one chart or process If your strategy is large it s helpful to separate them Variables that are used only ina table could include the table name in their name for example Fail_Count_in_Config_Values Config_Values is the table name In 1 0 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 e Htr6_Switch_SW23B You have many heaters and the schematic reference is needed e Cnvyr_Speed_Encoder_BldgA You want all conveyors to appear together e BldgA_Cnvyr_Speed_Encoder You want all points in Building A to appear together
576. y 2 4 ioControl User s Guide IOCONTROL TUTORIAL rs 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 o rr QO 1D 2 2 a a e B f Cookies ATE Control Engines Subroutines Included Charts amp Alarms amp Dough_Chip_Control amp Dough_ essel_Pressure_Control g Oven_Inspection_Control g Powerup variables 5 Numeric Variables 840 bStartFlag dtCookiemotionTimer 34 FDoughPressureSetpoint 3 14 FRampValue 3 14 FSetpointMinusDeadband a48 nChartStatus 840 nCookieMotionPreset 840 nLoopCounter String Variables Pointer Variables Communication Handles 5 Numeric Tables E String Tables Pointer Tables I O Units 876 Mixed_IO_Lnit E Points PIDs The Strategy Tree A
577. y PID Equation PID Mmistic c cccccccscseecestssesescsessesesesesesestesesesetseseees 10 63 EUNE ey EE EE EATA AAEE E E EEEE 10 63 ntegrali N erraninsnnne ar E A EEEN 10 64 Derivative D oo cececcccceseccsccesecesesesecessesececececevscesevecececesevececevavececevavevecevavevscevenes 10 64 Integral Derivative Interaction c c ccccccccceseecetesseesesseseeseseesesestssestesesteeeseeeeseees 10 64 Configuration Tips PID mistic 0 c ccccccsccsesssssssescccseescscssesssseesseesteesseeecseeecees 10 64 Tuning Guidelines PID Mmistic 0 c cccccccsccsesscssssesssesesecsessesesscsesseecsteaesesesneseees 10 65 Setting the Scan Rate aoc assacsceshs caccceatags atmnabanadapapesscannneaadisosattaducadpatnaeadasaeia 10 65 Determining the Loop Dead Time ssssicct civcssssdsccascccasercestncclnotstavcansscaassaddaceecsiess 10 66 TONNO are ee E A 10 66 Solving Tuning Problems sscxienasevacscchecactansacsceneagiticiactsessaxnciacs tsiiantmatmedeieustiaet 10 67 Starting the Tuning Process for a New PID LOOP cceeccesesceeeteesteteseeees 10 67 Deriva tVeimsi a aloe ta a oon e 10 67 Tuning Graphs PUD ISG ss 5 canton asvaacerscap cee cestacassd asdast cebachachesacissndantandsenwiehdes 10 68 Simulation ComMmandS st dec den eae incacttcetneg ns Obese asieticactas dase detsehasseabdncdetintastonndi 10 69 Chapter 11 Using OptoScript ssciscicsscssscancssscccsisasssicessssanccessstsseaacecsstectans 11 1 VOOR SUR ete nance A rie e
578. y 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 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 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 ioControl User s Guide 6 65 WORKING WITH 1 0 3 In Debug mode double click the PID on the Strategy Tree pidO
579. you can print them separately ioControl User s Guide 7 25 WORKING WITH STRATEGIES ioControl processes the information and displays it in the Instructions window Save Search Print B Flagq_Example_Chart Instructions mlaja TITLE Chart Block Instructions STRATEGY Sprinkler_Control CHART Flag_Example_Chart DATE 08 18 01 TIME 08 10 17 JO x ACTIONS Action Block Block 0 Id 0 Exit to Packer busy flag set Id 1 There are no instructions in this action block Action Block Clear Packer _Busy flag Id 4 This action block has no exit Set Variable False Packer Busy Action Block Delay 1 msec Id 5 Exit to Packer busy flag set Id 1 Delay mSec 100 Action Block Run process Id 3 Exit to Clear Packer Busy flag Id 4 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 the search button When finished close the window Viewing and Printing Strategy or Subroutine Elements You must be in Configure mode 1 To view a summary of 0 elements and variables configured in a strategy select File View Print Database 2 To view
Download Pdf Manuals
Related Search
Related Contents
Demain se construit aujourd`hui - Chambre d`Agriculture de la Gironde 取 扱 説 明 書 パワーコンディショナ CM102 IDE and Floppy Controller utilityModule User`s Manual X2000 Kensington K60721US PDF - 543 ko - Association Georges Perec Copyright © All rights reserved.
Failed to retrieve file