Sie sind auf Seite 1von 16

Vijeo Citect Cicode Programming

Study Guide
Version 7.30

Schneider-Electric Pty (Australia) Ltd

78 Waterloo Road
Macquarie Park
NSW 2113
Australia
DISCLAIMER

Schneider Electric makes no representations or warranties with respect to this manual and, to the maximum extent permitted by law, expressly limits its liability for
breach of any warranty that may be implied to the replacement of this manual with another. Furthermore, Schneider Electric reserves the right to revise this
publication at any time without incurring an obligation to notify any person of the revision.

The information provided in this documentation contains general descriptions and/or technical characteristics of the performance of the products contained herein.
This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability of these products for specific user applications. It is
the duty of any such user or integrator to perform the appropriate and complete risk analysis, evaluation and testing of the products with respect to the relevant specific
application or use thereof. Neither Schneider Electric nor any of its affiliates or subsidiaries shall be responsible or liable for misuse of the information that is
contained herein. If you have any suggestions for improvements or amendments or have found errors in this publication, please notify us.

All pertinent state, regional, and local safety regulations must be observed when installing and using this product. For reasons of safety and to help ensure compliance
with documented system data, only the manufacturer should perform repairs to components.

When devices are used for applications with technical safety requirements, the relevant instructions must be followed.

Failure to use Schneider Electric software or approved software with our hardware products may result in injury, harm, or improper operating results.

Failure to observe this information can result in injury or equipment damage.

© 2006 - 2013 Schneider Electric. All rights reserved.

Schneider Electric

Vijeo Citect Cicode Programming Study Guide

INTRODUCTION AND LEGAL NOTICE

Your purchase of this official Vijeo Citect Upgrade Training Manual entitles you to undertake the Vijeo Citect Upgrade training course.

Satisfactory completion of the course evaluation is mandatory for you to obtain a Schneider Electric certificate of completion of the training course.

The contents of this manual are proprietary to Schneider Electric and all rights, including copyright, are reserved by Schneider Electric. No part of this document may
be reproduced in any form or by any means, electronic or mechanical, including photocopying, without express written permission of Schneider Electric.

Schneider Electric will not accept any liability for action taken in reliance on this training manual.

TRADEMARKS

Schneider Electric has made every effort to supply trademark information about company names, products and services mentioned in this manual. Trademarks shown
below were derived from various sources.

Vijeo Citect, CitectSCADA, Cicode, Vijeo Historian, CitectHistorian, and Ampla are trademarks owned by Schneider Electric Industry SAS or its affiliated
companies. All other trademarks are the property of their respective owners.

ActiveX, Excel, Internet Explorer, Microsoft .NET, SQL Server, Windows, Windows Server, Windows XP, Windows Vista and Windows 7 are either registered
trademarks or trademarks of Microsoft® Corporation in the United States and/or other countries.

SafeNet Sentinel is a trademark of Sentinel, Inc.

VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions.

PI is a registered trademark of OSIsoft, Inc.

General Notice:

Some product names used in this manual are used for identification purposes only and may be trademarks of their respective companies.

Validity Note

The present documentation is intended for qualified technical personnel responsible for the implementation, operation and maintenance of the products described. It
contains information necessary for the proper use of the products.

Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel. No responsibility is assumed by Schneider Electric for any
consequences arising out of the use of this material.

A qualified person is one who has skills and knowledge related to the construction and operation of the electrical equipment and installations and has received safety
training to recognize and avoid the hazards involved.

May 2013 Edition for v7.30

Manual Release 1

ii Version 7.30 May 2013


Contents
CHAPTER 1: V7.30 CICODE PROGRAMMING EXAM TOPICS OVERVIEW ............. 1-1

Function Structure.......................................................................................................... 1-3


Variables, Datatypes and Data Structures ...................................................................... 1-4
Flow Control .................................................................................................................. 1-5
Logic .............................................................................................................................. 1-6
Statements ...................................................................................................................... 1-7
Input and Output ............................................................................................................ 1-8
Parameter Passing .......................................................................................................... 1-9
Error Handling ............................................................................................................. 1-10
Debugging .................................................................................................................... 1-11
Programming Standards ............................................................................................... 1-12

Vijeo Citect Cicode Exam Manual Release 1 iii


Chapter 1: v7.30 Cicode Programming Exam
Topics Overview

Introduction Cicode Programming is the second of the CSCE exams. This exam is based
around information that is covered in the Cicode Programming Course .

This Chapter Covers These Topics:

 Function Structure 1-3


 Variables, Datatypes and Data Structures 1-4
 Flow Control 1-5
 Logic 1-6
 Statements 1-7
 Input and Output 1-8
 Parameter Passing 1-9
 Error Handling 1-10
 Debugging 1-11
 Programming Standards 1-12

Vijeo Citect Cicode Exam Manual Release 1 1-1


Cicode Development Environment

Programming Cicode is a simple, easy-to-use computer programming language designed


Language especially for plant monitoring and control applications. It is a structured
language similar to Visual Basic or 'C', however you need no previous
programming experience to use it.

Using Cicode, you have access to all real-time data (variables) in the Vijeo
Citect project, and all Vijeo Citect facilities - variable tags, alarms, trends,
reports, and so on. You can use Cicode to interface to various resources on the
computer, such as the operating system and communication ports.

Cicode supports advanced features including pre-emptive multi-tasking, multi-


threads, and remote procedure calls that will be discussed later in this course.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Create and save Cicode function libraries.
 Experiment with the automated layout functionality within the editor.
 Use comments to disable sections of cicode.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - The Cicode Editor.

1-2 Version 7.30 May 2013


Function Structure

User Functions Vijeo Citect is supplied with over 600 in-built functions. One or a combination
of these functions can usually perform most tasks in your system. However,
where system functionality cannot be achieved with in-built functions, you can
write your own functions.

A Cicode function is a small program that may contain a collection of


statements, variables, operators, conditional executors, and functions, in fact, of
all the elements of Cicode.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Revise the syntax of Cicode functions.
 Make a small Cicode program to create a standard Microsoft ActiveX
Listbox at runtime, and fill this listbox with three items, and then select
one of these items, and then store the value of the item in a DiskPLC
variable.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Cicode Function syntax.


 Vijeo Citect Help Topic - Converting and Formatting Cicode
Variables.

Vijeo Citect Cicode Exam Manual Release 1 1-3


Variables, Datatypes and Data Structures

Operators Cicode is used to manipulate data and perform tasks. Data manipulation is
achieved using five classes of operators. These are the Mathematical, Bit,
Logical, Relational and Format operators.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Review the Cicode Programming Training manual.
 Create Global, Module and Local variable declarations along with
assigning default values to the declared variables.
 Determine maximum array size limits.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Using Variables.


 Vijeo Citect Help Topic - Using Arrays.
 Vijeo Citect Help Topic - Variable declaration.

1-4 Version 7.30 May 2013


Flow Control

Four Conditional The statements that control decisions and loops in your functions are called
Executors conditional executors. Cicode uses four conditional executors: IF, FOR, WHILE
and SELECT CASE.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Review the syntax of the four types of Conditional Executor in Cicode.
 Create functions that test the functionality of the Conditional Executors.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Working with Conditional Executors.

Vijeo Citect Cicode Exam Manual Release 1 1-5


Logic

Use of Logic in Cicode supports the use of all major Logical operators: AND, OR, XOR, NOT.
Cicode

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Create simple logic statements to test the order of precedence and also
to be sure that you understand how statements are executed.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Using Logical Operators

1-6 Version 7.30 May 2013


Statements

Doing the Work Statements are used to execute Cicode Functions and also to assign values (or
the results of Cicode Functions) to variables and to Variable Tags.

Statements also include the ability to exchange information between variable of


differing datatypes - for instance converting an Integer to a String or vice versa.

The various operators (addition, subtraction, multiplication etc) have an order of


precedence (they are not executed left-to-right or right-to-left)

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Review the Order of Precedence of Operators.
 Create Cicode fragments to assign values and call functions.
 Confirm your knowledge of datatype conversion functions.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Working with Operators.


 Vijeo Citect Help Topic - Converting and Formatting Cicode
Variables.
 Vijeo Citect Help Topic - Order of Precedence of Operators.

Vijeo Citect Cicode Exam Manual Release 1 1-7


Input and Output

Interact with the In addition to acting on data sourced from the plant via Variable Tags, there are
Operator occasions when it is necessary to interact with the operator in order to either
request values (perhaps the name of the next recipe or the adjusted setpoint
value for some parameter) or to provide other information - often via the prompt
field on the screen.

Generally, the Input and the Prompt Cicode functions are used for this, although
others are also available.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Understand the datatype of the various input and output functions and
be familiar with how to ensure data is sent or received in the necessary
datatype.
 Be familiar with key sequences for data input.
 Test the use of the ArgX and ArgValueX items.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Defining Key Sequences for Commands.


 Vijeo Citect Help Topic - Input.
 Vijeo Citect Help Topic - Prompt.
 Vijeo Citect Help Topic - FormNumPad.

1-8 Version 7.30 May 2013


Parameter Passing

Provide In order to make Cicode Functions flexible and reusable, it is normal to provide
Information for a a list of parameters for them to work with as arguments to the function. Clearly
Function to work the only alternative would be to define some large list of fixed Global variables.
with
When passing parameters to a function, the programmer must make sure that
the parameters appear in the correct order and have the proper datatypes.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Create Cicode Functions with default parameters for use when the
parameter is not provided.
 Call functions with missing parameters.
 Test the application of datatypes to function parameters.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Parameters.


 Vijeo Citect Help Topic - Function Argument Structure.

Vijeo Citect Cicode Exam Manual Release 1 1-9


Error Handling

Deal with There are many situations where your programs must handle unexpected events.
Problems These might range from a file not existing when you request to open it to
attempting to read from a non-existent array item.

You should write your software to minimise these issues as much as possible
and also to gracefully handle the ones you can't catch.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Defensive Programming.


 Vijeo Citect Help Topic - Using Cicode Programming Standards.

1-10 Version 7.30 May 2013


Debugging

Cicode Editor as The Cicode Editor can function in debug mode, to analyse running Cicode.
a Debugger Debugging Cicode requires that Vijeo Citect is running, though you can turn
debugging on and off as required. The operation of the debugger is controlled
through Debug Options, with some options only taking effect on startup.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Review how the Cicode language supports multi-tasking and pre-
empting.
 Review the use of the Cicode Editor in Debug mode.
 Add some breakpoints to the program you created earlier and use the
Cicode debugger to step through it, by breakpoint and line by line.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Debugging Cicode.


 Vijeo Citect Help Topic - Using breakpoints.
 Vijeo Citect Help Topic - Stepping through code.

Vijeo Citect Cicode Exam Manual Release 1 1-11


Programming Standards

Fundamentals of One of the critical aspects to follow on from the earlier concepts of Error
Good Design Handling and Defensive Programming is "Good Design."

the better designed your software is, the easier it will be to deal with errors and
exceptions.

Software should be written with as much of the code hidden as PRIVATE


functions in order to not accidentally call functions which have not been
configured for global use. Similarly, unless a variable must be made available
globally, it should be declared as a MODULE variable or even kept local to a
function.

Suggested Use these suggested exercises to increase your understanding of the topic.
Exercises
 Experiment with declaring PUBLIC and PRIVATE Functions.
 Investigate the difference between Blocking and Non-Blocking
functions.
 Read widely on programming techniques.

Further Reading Use the following references to assist your understanding of the topic.

 Vijeo Citect Help Topic - Function Scope.


 Vijeo Citect Help Topic - Formatting Functions.

1-12 Version 7.30 May 2013

Das könnte Ihnen auch gefallen