CX-Supervisor Script Language - MyOMRON

11m ago
1 Views
1 Downloads
634.07 KB
168 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Elise Ammons
Transcription

CX-Supervisor Script Language

OMRON CX-Supervisor – Script Language Notice OMRON products are manufactured for use according to proper procedures by a qualified operator and only for the purposes described in this manual. The following conventions are used to indicate and classify precautions in this manual. Always heed the information provided in them. Failure to heed precautions can result in injury to people or damage to the product. DANGER! Indicates information that, if not heeded, is likely to result in loss of life or serious injury. WARNING Indicates information that, if not heeded, could possibly result in loss of life or serious injury. Caution Indicates information that, if not heeded, could result in relatively serious or minor injury, damage to the product, or faulty operation. OMRON Product References All OMRON products are capitalised in this manual. The word “Unit” is also capitalised when it refers to an OMRON product, regardless of whether or not it appears in the proper name of the product. The abbreviation “PLC” means Programmable Logic Controller and is not used as an abbreviation for anything else. Page 1

OMRON CX-Supervisor – Script Language Visual Aids The following headings appear in the left column of the manual to help you locate different types of information. Indicates information of particular interest for efficient and convenient operation of the product. 1, 2, 3 Indicates lists of one sort or another, such as procedures, checklists etc. Represents a shortcut on the Toolbar to one of the options available on the menu of the same window. OMRON, 2000 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of OMRON. All copyright and trademarks acknowledged. No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is constantly striving to improve its high-quality products, the information contained in this manual is subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in this publication. Page 2

OMRON CX-Supervisor – Script Language About this Manual This manual describes the script language syntax as a supplement to CX-Supervisor application user manual. This manual contains the following: Chapter 1 Introduction. An overview to this manual including special typographical conventions. Chapter 2 Expressions. A description of the use of expressions within scripts. Chapter 3 Scripts. An introduction to scripts and the type of scripts. Chapter 4 Functions and Methods. A detailed reference to the CX-Supervisor script language. Chapter 5 Script Examples. A description of the script language in practice, using some examples. Chapter 6 Colour Palette. A description of the colour palette that can be applied to certain script statements. Appendix A OPC Communications Control. This appendix contains a list of the available component properties and gives details of the Visual Basic script interface. Appendix B Lite Communications Control. This appendix contains a list of the available component properties and gives details of the Visual Basic script interface. Appendix C VBScript Features. This appendix provides a summary of the VBScript features available for use with the ExecuteVBScript and ExecuteVBScriptFile script functions. Appendix D Jscript Features. This appendix provides a summary of the JScript features available for use with the ExecuteJScript and ExecuteJScriptFile script functions. A Glossary of Terms and Index are also provided. Page 3

OMRON CHAPTER 1 - Introduction TABLE OF CONTENTS CX-Supervisor Page Chapter 1 – Introduction.6 Chapter 2 – Expressions .7 Chapter 3 – Scripts .10 Object.10 Page.10 Project .10 Chapter 4 – Functions and Methods.11 Points .16 Logic and Arithmetic.18 Control Statements.21 Subroutines .28 Object Commands.29 Page Commands.38 General Commands .39 Communications Commands .43 Point Commands.46 PLC Commands .55 Temperature Controller Commands .60 DDE Commands .66 Alarm Commands.70 File Commands .75 Graph Commands .82 Recipe Commands.85 Report Commands .87 Text Commands .89 Event/Error Commands .95 Printer Commands .97 Security Commands .101 Data Logging Commands.103 Database Commands.109 Page 4

OMRON CHAPTER 1 - Introduction Table of Contents Chapter 4 continued Page Serial Port Functions .122 ActiveX Functions.125 Punctuation .128 Indirection within Script Commands and Expressions .131 Point Arrays within Script Commands and Expressions .132 Using Aliases.133 Chapter 5 – Script Examples. 135 Balloon Script .135 DDE Script.138 Chapter 6 – Colour Palette . 142 Appendix A – OPC Communications Control . 143 Component Properties .143 Script Interface .143 Functions.143 Appendix B – Lite Communications Control. 145 Component Properties .145 Script Interface .145 Functions.145 PLC Memory Functions .148 Appendix C – VBScript Features . 150 Appendix D – JScript Features . 153 Glossary of Terms. 155 Index . 161 Page 5

OMRON CHAPTER 1 - Introduction CHAPTER 1 Introduction This reference manual describes the script language syntax as a supplement to the CX-Supervisor User Manual. It provides detailed definition of the syntax of CX-Supervisor scripts that drive project, page, object actions and CX-Supervisor expressions as used by objects and scripts. Typographic conventions used in the examples in this reference manual are as follows: Script commands and reserved words are shown in the preferred case, which may be either lower-, upper- or mixed-case. Points are shown in lower-case. Objects are shown in upper-case. The following terms are used in this reference manual: Application. A set of files, containing an executable file, that carry out certain tasks. This reference manual refers to the Microsoft Excel and Microsoft Word for Windows applications. Constant. A point or object within a script that takes only one specific value. Executable. A file that contains programs or commands, and has an ‘*.EXE’ extension. Nesting. To incorporate one or more IF THEN ELSE/ELSEIF ENDIF statements inside a structure of the same kind. Operands. Constants or point variables. Operators. Relational, arithmetic, and logical statements, for instance ‘ ’, ‘ ’ or ‘AND’. Or (‘ ’). The ‘ ’ symbol is used to represent ‘or’, where there are two or more forms of the same syntax. Point Types. Either Boolean, Integer, Real or Text. Point Variable. A point or object within a script that may take different values. Strings. Data in the form of text delimited by quotation marks (“ ”), which can be assigned to a point. The ‘{’ and ‘}’ braces. Must be inserted around the argument command or an error is reported. An error is reported if there are spaces between braces. ‘TRUE’ and ‘FALSE’. Refer exclusively to Boolean states, where Boolean state 0 is ‘FALSE’ and Boolean state 1 is ‘TRUE’. Page 6

OMRON CHAPTER 2 - Expressions CHAPTER 2 Expressions This chapter describes the use of expressions within scripts. Expressions consist of operators and operands: Operators are relational, arithmetic, logical and include many functions. Operands are constants or point variables. Expressions can be used in a script as part of a statement (refer to chapter 3, Scripts and chapter 4, Functions and Methods). However expressions can be applied to the following actions directly using the associated Expression: or Digital Expression: field: Blink. Close page. Colour Change (Analogue). Colour Change (Digital). Display Status Text. Display Text Point. Display Value. Edit point value (Analogue). Edit point value (Digital). Edit point value (Text). Enable/Disable. Horizontal move. Horizontal percentage fill. Resize height. Resize width. Rotate. Show page. Vertical move. Vertical percentage fill. Visible. The following example of a simple expression contains a point (‘redcars’) attached to a particular object with an appropriate object action, Resize (Height). At runtime, once the value of the point has been met within the attributes declared within the Active Expression Range/Required Height: fields, the current object is resized accordingly. This example is an Integer or Real example, whereby the value of the point either falls inside or outside the specified range. In this example, the point 'redcars' must fall between 0 and 40 for the expression to be met. Page 7

OMRON CHAPTER 2 - Expressions The following example of a more complex expression contains a test on point ‘position’. If ‘position’ is more than 300 in value, and ‘position’ is less than 450 in value, i.e. the value of ‘position’ is between 300 and 450, then the expression has been met, and an action is initiated (in this instance the current object is made visible if the expression is met). This example is a Boolean example, whereby either the expression is met (‘TRUE’) or not met (‘FALSE’). A Boolean value is always returned from a Digital Expression: field, as opposed to an Expression: field, which returns an Integer or Real value. Operators used within this example are fully described in chapter 4, Logic and Arithmetic. The following example of an expression contains a value point ‘prompt’ which is included at the value position denoted by a ‘#’ symbol. Page 8

OMRON CHAPTER 2 - Expressions Refer to the CX-Supervisor User Manual for detailed dialog descriptions. Page 9

OMRON CHAPTER 3 - Scripts CHAPTER 3 Scripts A CX-Supervisor script is a simple programming language used to manipulate points. Scripts can be created at different levels, at object level, page level or project level. Although the script code can be applied to all levels of script, there are subtle differences, described in the following paragraphs. Object If a script is executed as a runtime action of an object, then the script can affect the object of the action, or any other, depending on the actual content of the script. Page Page scripts are concerned with manipulating points and graphical objects that are used or included within that page. In other words page scripts are used to drive a number of actions on the occurrence of a particular event. These actions may manipulate several graphical objects on one page. Project Scripts can be applied to a project to manipulate points. These scripts are associated with events that occur throughout the whole operating session Page 10

OMRON CHAPTER 4 – Functions and Methods CHAPTER 4 Functions and Methods This chapter describes the CX-Supervisor script language syntax. It provides a detailed definition of the syntax of CX-Supervisor scripts that drive project, page and object actions, and CX-Supervisor expressions as used by objects and scripts. The following table describes the script language syntax at a glance. Function Name Function Type Type Remarks &, , , , (objects) bitwise operators statement All OP (points) statement All , -, *, /, %, , , , , , ! AcknowledgeAlarm AcknowledgeAllAlarms AcknowledgeLatestAlarm Acos Asin Atan CancelForce arithmetic operators relational operators alarm command alarm command alarm command unary function unary function unary function point command All All Scr Scr Scr All All All Scr Chr text command All ClearAlarmHistory ClearErrorLog ClearGraph alarm command event/error commands graph command All All Scr ClearLogFile ClearSpoolQueue Data Logging command printer command Scr All close CloseAlarmHistory CloseAlarmStatus CloseComponent object command alarm command alarm command comms command Scr All Scr All CloseErrorLog CloseFile CloseLogFile CloseLogView ClosePLC error command file command Data Logging command Data Logging command PLC command Scr Scr Scr Scr Scr Applies bitwise expressions Specifies an object name for modification or test. Specifies a point name for modification or test. Applies arithmetic expressions. Applies relational expressions. Acknowledges an alarm. Acknowledges all alarms. Acknowledge the latest alarm. Applies unary expression. Applies unary expression. Applies unary expression. Removes the forcing of values on a point. Displays a character based on the ASCII character set. Clears the alarm history. Clears the error log. Clears the data from a trend or scatter graph. Clears a data log file Discards any queued messages or alarms. Closes a specified page. Closes the current alarm history. Closes the current alarm status. Closes a component for a PLC (e.g. CX-Server components). Closes the currently open Error Log. Closes the open file. Closes a data log file Closes the log viewer Close communications with a PLC. colour object command OP Specifies a colour to an object. Page 11

OMRON CHAPTER 4 – Functions and Methods Function Name Function Type Type Remarks Copies the content of an array. Copies a specified file. Applies unary expression. Enables DDE functions. Sends a command to an app. via a DDE channel. Initiates a DDE conversation. Creates a DDE advise loop. Uses open DDE channel to send information. Uses open DDE channel to request information. Closes the specified DDE channel. Closes all DDE channels. Deletes the specified file. Disables an object. Prevents a group of points to be read or written. Disables communications to a point. Displays a specified page. Displays the current alarm history. Displays the alarm status of all current alarms. Displays the current Error Log. View the current recipes in the project. Downloads specified files to the PLC. Downloads a specified recipe. Edits a specified file. Displays a dialog used for editing trend graphs. Enables alarm functions. Allows use of DDE functions. All actions become subject to Error Logging. Permits a group of points to be read or written. Allows use of OLE functions. Allows use of PLC functions. Enables communications to a point. Permits printing of Alarms or messages. Exports data log and views Exports data log Applies Boolean expression. CopyArray CopyFile cos DDEEnable DDEExecute point command file command unary function DDE command DDE command All Scr All All Scr DDEInitiate DDEOpenLinks DDEPoke DDE command DDE command DDE command Scr Scr Scr DDERequest DDE command Scr DDETerminate DDETerminateAll DeleteFile disable DisableGroup DDE command DDE command file command object command point command Scr Scr Scr OP All DisablePoint display DisplayAlarmHistory DisplayAlarmStatus point command object command alarm command alarm command Scr Scr Scr Scr DisplayErrorLog DisplayRecipes DownloadPLCProgram DownloadRecipe EditFile EditGraph event command recipe command PLC command recipe command file command graph command Scr Scr All Scr All Scr EnableAlarms EnableDDE EnableErrorLogging alarm command comms command error command All Scr Scr EnableGroup point command All EnableOLE EnablePLC EnablePoint EnablePrinting ExportAndViewLog ExportLog FALSE comms command comms command point command printer command Data Logging command Data Logging command Boolean state Scr Scr Scr All Scr Scr Scr Page 12

OMRON CHAPTER 4 – Functions and Methods Function Name Function Type Type Remarks Specifies the existence of a file. Locks the value of a point. Sets a point value to 0. Sets a point value to 1. Inserts text with standard ‘C’ formatting characters. Produces a report based on a report template. Retrieves a bit from a point. Retrieves the mode of a PLC. Retrieves the value of a point. Specifies the number of alarms or messages queued for printing. Specifies the number of characters in a text point. Specifies the height of an object. Specifies the horizontal fill of an object. Applies a test to a script. FileExists Force ForceReset ForceSet FormatText file command point command point command point command text command All Scr Scr Scr All GenerateReport report command All GetBit GetPLCMode GetPointValue GetSpoolCount point command PLC command point command printer command All All Scr All GetTextLength text command All height horizontal%fill IFTHEN ELSE\ELSEIF ENDIF InputPoint IsAlarmAcknowledged object command object command statement OP OP Scr point command alarm command Scr Scr IsAlarmActive alarm command Scr Left statement Scr log unary function All log10 unary function All LogError error command Scr LogEvent error command Scr Login Logout security command security command Scr Scr Message Mid move MoveFile OpenComponent text command text command object command file command comms command Scr Scr OP Scr All OpenFile file command Scr Reads a value from a point. Tests if a specified alarm has been acknowledged. Tests if a specified alarm is currently active. Extracts characters from the left of a string Calculates the natural logarithm on a number. Calculates the base-10 logarithm on a number. Logs an error message with the error logger. Logs an event message with the error logger. Logs a user into a run-time application. Logs a user out of a run-time application. Outputs a string in a message box. Extracts a substring from a string. Moves an object. Moves the specified file. Opens a component for a PLC (e.g. CXServer components). Opens the specified file. Page 13

OMRON CHAPTER 4 – Functions and Methods Function Name Function Type Type Remarks OpenLogFile OpenLogView OpenPLC OR, AND, NOT OutputPoint PlayOLE PlaySound PLCCommsFailed Data Logging command Data Logging command PLC command logical operators point command gen. command gen. command PLC command Scr Scr Scr All Scr Scr Scr All PLCMonitor PointExists PrintActivePage PrintFile PrintMessage PLC command point command gen. command file command text command Scr All Scr Scr All PrintPage PrintReport PrintScreen PrintSpoolQueue Rand Read gen. command report command gen. command printer command gen. command file command Scr All Scr All Scr Scr ReadMessage REM RETURN Right file command statement statement text command All Scr Scr Scr rotate RunApplication RunHelp SaveGraph SELECT CASE/END SELECT SelectFile SetBit SetPLCMode SetPLCPhoneNumber SetPointValue SetPrinterConfig SetupUsers ShutDown sin object command gen. command gen. command graph command statement OP Scr Scr All Scr Opens a data log file Opens the Data Log Viewer Opens communications with a PLC. Applies logical expressions. Displays the current value of a point. Plays an OLE object. Plays a sound file. Specifies if the PLC communications have failed. Monitors a PLC. Specifies the existence of a point. Prints the currently active page. Prints the specified file. Prints messages to the configured ‘Alarm/message printer’. Prints the specified page. Prints a report Prints the current display screen. Prints all queued alarms or messages. Calculates a random number. Reads data from an open file into a point. Reads text from an external file. Remarks on line or lines of script. Stops sequential execution of script. Extracts characters from the right of a string. Rotates an object. Runs the specified application. Runs the specified help file. Saves graph data to disk. Applied to complex tests. file command point command PLC command PLC command point command printer command security command gen. command unary function All All All All Scr All Scr Scr All Specifies a file name and path. Sets a specific bit from a point. Sets the mode of a PLC. Sets a phone number to a PLC. Sets the value of a point. Defines printer configuration. Defines users and passwords for Login. Terminates CX-Supervisor. Applies unary expression. Page 14

OMRON CHAPTER 4 – Functions and Methods Function Name Function Type Type Remarks Stores the current state of a trend graph. Applies unary expression. Starts the recording of a graphs data. Starts a data set logging. Stops the recording of a graphs data. Stops a data set logging. Applies unary expression. Starts or stops a temperature controller auto-tune operation. Defines how a temperature controller stores internal variables. Retrieves the temperature controller status parameter. Defines the operational mode of a temperature controller. Retrieves the temperature controller status. Resets the temperature controller. Defines the setpoint mode used by the temperature controller. Defines either auto-output mode shift or manual output mode shift. Saves data associated with the temperature controller. Performs a settinglevel function for the temperature controller. Converts a string to a numerical point value. Applies Boolean expression. Uploads programs in the PLC to specified files. Converts a numerical value into a text point. Specifies the vertical fill of an object. Displays a report Toggles the visibility of an object. Specifies the width of an object. Writes a value to an open file. Writes text to an external file. Snapshot graph command Scr sqrt StartGraph StartLogging StopGraph StopLogging tan TCAutoTune unary function graph command Data Logging command graph command Data Logging command unary function temp. controller command All Scr Scr Scr Scr All All TCBackupMode temp. controller command All TCGetStatusParameter temp. controller command All TCRemoteLocal temp. controller command All TCRequestStatus temp. controller command All TCReset TCRspLsp temp. controller command temp. controller command All All TCRunStop temp. controller command All TCSaveData temp. controller command All TCSettingLevel1 temp. controller command All TextToValue text command Scr TRUE UploadPLCProgram Boolean state PLC command Scr All ValueToText text command Scr vertical%fill ViewReport visible width Write WriteMessage object command report command object command object command file command file command OP All OP OP Scr All Page 15

OMRON CHAPTER 4 – Functions and Methods The ‘Type’ column refers to the types of script and expression the function can be applied to. ‘All’ refers to both expressions and scripts. ‘Scr’ refers to scripts only. ‘OP’ refers to Object and Page scripts only. The style of this annex is such that each element of the script language is described in turn, describing scope, syntax with remarks, typical examples and references. References are always forward; for instance, if an example contains elements not yet described, a suitable reference is included; however if an example contains elements already described, no reference is made. Points Basic Point Assignment Syntax pointname expression Remarks Argument pointname expression Description The point name to be assigned a value. The value to be assigned to pointname. The expression may be of type Boolean, Integer, Real or Text. Typical Examples count 100 The Integer or Real point ‘count’ is assigned the value 100. result TRUE The Boolean point ‘result’ is assigned the state ‘‘TRUE’’. name "Valve position" The Text point ‘name’ is assigned the associated text, contained within quotation marks. References Refer to chapter 4, Punctuation for details of the use of quotation marks. Page 16

OMRON CHAPTER 4 – Functions and Methods Further Point Assignment Syntax pointname expression Remarks Argument Description pointname expression The point name to be assigned a value. The value to be assigned to pointname. The expression may be of type Boolean, Integer or Real and can include other points, logical or arithmetical expressions. Mathematical precedence is applied as follows: Parenthesis (highest). Unary minus and NOT logical operator. Multiplication, division and modulus. Addition and subtraction. Greater than, less than, greater than or equal to, and less than or equal to relational operators. Shift Left (SHL) and Shift Right (SHR). Equal to and not equal to relational operators. Bitwise AND, XOR, OR. AND logical operator, OR logical operator (lowest). Typical Examples lift height rate/5.0 The Integer or Real point ‘lift’ is assigned the value calculated by the value of point ‘rate’ divided by 5, plus the value of point ‘height’. Precedence can be changed by the introduction of parenthesis. lift lift - 0.2 The Integer or Real point ‘lift’ is assigned the value calculated by the current value of point ‘lift’ minus 0.2. distance distance * time The Integer or Real point ‘distance’ is assigned the value calculated by the current value of point ‘distance’ multiplied by point ‘time’. References Refer to chapter 4, Logic and Arithmetic for details of the use of arithmetic and logic functions. Refer to chapter 4, Punctuation for details of the use of parenthesis. Page 17

OMRON CHAPTER 4 – Functions and Methods Logic and Arithmetic Arithmetic Operators Syntax pointname expression Remarks Argument pointname expression Description The point name to be assigned a value based on an arithmetical expression. The value to be assig

A detailed reference to the CX-Supervisor script language. Chapter 5 Script Examples. A description of the script language in practice, using some examples. Chapter 6 Colour Palette. A description of the colour palette that can be applied to certain script statements. Appendix A OPC Communications Control. This appendix contains a .

Related Documents:

0307 Supervisor Personnel/Staff Development: 0308 Supervisor Planning/Research and Evaluation (Testing) 0309 Supervisor Adult Education: 0310 Supervisor Athletics 0311 Supervisor Audio-Visual Aids: 0312 Supervisor Art 0313 Supervisor Business: 0314 Supervisor English 0315 Supervisor Foreign Languages: 0316 Supervisor Health/Physical Education

script. Fig. 1 shows examples of the same TCC characters in all five major styles. Figure 1. Standard script, clerical script, seal script, cursive script, and semi-cursive script (From left to right) The standard script is used in daily life. The clerical script is similar to stan

Supervisor Engine III Catalyst 4006 240 10/ 100/1000 5 Cisco Catalyst 4006 Supervisor III Supervisor Engine III 2/3/4 48Mpps PPE FFE Supervisor Supervisor Engine III 1 Supervisor III 64Gbps 2 3 5 4 6 WS-C4006 WS X4014 PPE FFE PLD 线路卡 数据包内存 1 1 2 1. PM PM ISL 802.1q 256 256

Automation Engine 2. The Script Runner Tool The Automation Engine does not actually run your custom script: the task communicates with an Automation Engine Script Runner. Attention: As mentioned in Scripting Concept, the 'Run Script' task can run the script on the AE server itself (a Windows Script or batch file) or it could use a standalone Script

The Kannada language is written using the Kannada script, which evolved from the 5th-century Kadamba script. The oldest form of Kannada script begins in 3rd century B.C. The first popular and well-known Kannada script was called Kadamba script used by the Kadamba dynasty during 5th century A.D. Buhler, the famous epigraphist says that the

Amadeus (4) Shaffer, Peter Script Amen Corner, The Baldwin, James Script America Play, The Parks, Suzan-Lori Script America Play, The Parks, Suzan-Lori Bound Script American Buffalo Mamet, David Anthology Nine Plays of the Modern Theatre 400 American Buffalo (2) Mamet, David Script

Transactional Analysis (TA) and Script Theory Ego States Life Positions Script Content Script Process Script Winning Non-Winning Losing After Always Almost Open Until Ended Never . The Script and Life

The asset management plan also includes: clear links to (or incorporates) the organisation’s capital/procurement plan long-term (5-10 years) needs based on the direction of travel for the organisation the gap between the current and future asset base, and the way this will be addressed in the form of asset acquisitions and disposals, by each asset category plans for .