Home
Login
Register
Search
Home
49144839 Vijeo Cicode Course v7
49144839 Vijeo Cicode Course v7
March 24, 2018 | Author: Jose Medina | Category:
Parameter (Computer Programming)
,
Array Data Structure
,
Variable (Computer Science)
,
Integer (Computer Science)
,
Subroutine
DOWNLOAD
Share
Report this link
Comments
Description
Cicode Programming<Instructor’s Name> Objectives Good Understanding & Competent in Use of Cicode Be Able to Use Cicode in Commands and Expressions Apply Learning to Your Own Site or Project Be Able to Write Your Own Cicode Functions Know How to Debug Your Own Cicode Functions This Presentation is © 2005 – 2007 Citect Pty Ltd Agenda - Day 1 Welcome Introduction to Cicode Variable Operators Used in Cicode The Cicode Editor Writing Simple Functions Using Cicode Variables Conversion Functions Include Files Agenda .Day 2 Conditional Executors Cicode Return Functions Arrays Debugging Your Code . Training Facilities Emergency Exits Ladies’ & Gents’ Kitchen Breaks / lunch Mobile Phones Compendium . Welcome Introduce trainer Students introduce self Name Employer Current Citect or SCADA experience Expected outcomes from training . Training Agreement It’s OK to…. Express ideas Challenge the facilitator Offer examples Question Relax . Training Agreement Trainer’s role Start and end on time Professionally facilitate the exchange of information and knowledge Allow time for (and encourage) input Listen non-defensively Help you learn . Training Agreement Your role Be on time Participate Learn in your own way Provide honest open feedback Enjoy yourself . mouse as required Environmental conditions Lighting Air conditioning Rest and relaxation Regular movement Eye strain .Ergonomics Desks and chairs Adjust to your comfort level Relocate screen. keyboard. Introduction to Cicode Chapter 2 . Introduction to Cicode Chapter Overview Commands. Expressions and Functions Use Commands to Control Processes Display Data from Expressions . pointers.What is Cicode? A programming language! A means of extending the functionality of Vijeo Citect projects Interact with variable tags Exchange data with external sources Create complex formulae Why do we need it? When we are unable to achieve the required outcome by configuring graphics pages For the programmers in the audience: It’s like any high-level language. but without complex structures. recursion or inheritance . Cicode Project Pre-configured project: Cicode_Milk . Pasteurisation Page . Chapters Page . Restore Milk Project Restore Milk project from the folder supplied by your facilitator Run Milk project Test Pasteurisation page Compile the project and then run the Computer Setup Wizard (express) View Chapters page . Commands Cicode Commands can be issued: Manually Operator types in commands Clicking on a button or object on a graphics page Automatically Operator logs in or out of the runtime system A graphics page is opened or closed An alarm is triggered In a report When an event is triggered . Cicode Commands Single statement or group of statements . Open Chapters Page Create buttons to turn Silo Agitator off and on . Create 2 buttons in the Chapters Page Compile and Test by switching to the Chapters Page to view results . Plant1_Pump=0 . Oven_Temp=10 .Setting Variables Execute Command Digital Tag Change status of Tag Analog Tag Set value of Tag Variable1=value Variable1=Variable2 Plant1_Pump=1 . Oven_Temp=Kettle_Temp. . String Variables Set variable BATCH_NAME = “Bread” Literal strings must be enclosed in quotation marks . Expressions Any combination of variables, operators, and statements which evaluate to some result 8 + 4 Motor_Speed / 5 Calculations in a Cicode statement Result = Operand1 + Operand2 – Operand3 Displaying Data Displayed Value changes as value of expression changes Value changes Expression changes Multiple Statements Multiple statements can be separated by a semi-colon ; Kettle_Temp=10 ; Oven_Temp=Kettle_Temp ; Batch_Name=“Bread” ; Multiple statements Add a prompt TIC_P4_PV = TIC_P1_PV + TIC_P2_PV . Prompt("Calculation is Finished") . Operator Input Define keyboard Command as a Key sequence F2 signals start of Key Sequence Key Sequence ending in ENTER Allows up to 3 characters to be entered . Arg2) Argument #1 Argument #2 <F2> 123 . 345 <enter> .Arguments Arg1 provides input to variables by Keyboard entry Conveyor_Speed=Arg1 Variable Argument #1 Conveyor_Speed=ArgValue1 Argument #1 Checks for Numeric value DoThisThenDoThat(Arg1. Enter Keyboard Key Definition Change Misc1 properties . Arg2 …) Name of the Function Arguments passed to the function Prompt(“Shutdown”) Shutdown() .Calling Functions Definition Function A general term used for a subroutine Parentheses identifies statement as function FunctionName(Arg1. Calling functions . Function Information Look up in online help Prompt Shutdown PageDisplay . 1 or many arguments Prompt(“Press F1 for Help”) Arguments passed Place double to quotes around any string passed the function to a function JunkFunction(“1st Argument”.“2nd Argument”) .Passing Data to Functions Functions can support 0. Add Key sequence to project RBUTTON_UP executes command anywhere on page Not RBUTTON_CMD_UP Search capability . Invoke external programs from within Vijeo Citect ag r D & ck a i l C to nd a 2. Copy & Paste to Vijeo Citect 1. Find Excel in Windows Explorer . mm ow o C ind W 3. “ABC”) Login ID Password . .Multiple Arguments All arguments must be listed Separate arguments with a comma Argument order is important Strings are “quoted” Login(“Manager”. Passing Numeric Arguments Both Integers and Floating Point numbers can be passed to a function INT REAL . 580.512+8+1.“Valve_Cool_CMD") Name of Popup window Location on screen Mode of Popup window Tag .150. AssWin("!Valve". not variable string itself DspStr .Passing Variable Arguments When variables are used as arguments Value of variable is passed.Displays a string at a specified AN DspStr(25.”TextFont”. COAL_LEVEL).”TextFont”. Animation Point number Display using this font Value of COAL_LEVEL variable will Display DspStr(25. “COAL_LEVEL”). COAL_LEVEL string will Display – as its “quoted” . Recipe) AN 326 . DspStr(326. "ControlLimits". ” + FullName() ) .Returning Data Functions can return a value to the calling statement Success 0 Failure error number or Data As in: Result of ‘FullName’ used as a parameter to ‘Prompt’ date() Prompt(“Hello. %Tag%.%Tag%=FormNumPad("Enter".0) Pass Value from num-pad into Tag variable Title given to number pad Value passed if cancelled Mode – standard in this case . Execute Function on Startup Message(“Startup”.64) Custom Mode Modify .“Hello Select World”. +32767) Integer_Variable = 34 Integer_Variable = -1274 Integer_Variable1 = Integer_Variable2 + 3 Strings (Up to 255 characters) String_Variable = “apple” String_Variable = “string variable” String_Variable1 = String_variable2 + “more text” .k.Summary of Variables Digital (a.a. Boolean or Logical) Digital_Variable = 0 Digital_Variable = 1 Digital_Variable1 = Digital_Variable2 Integer (-32768 . Data Types Fred Variable PLC variable Cicode variable “Fred” Fred() Function [Fred] String Path substitution Array index {Fred} Field definition Compile error context . Chapter 2 .Summary Questions What are the two mechanisms to activate a command? What is a Cicode expression? What character is used to combine several tasks? What is the syntax to call a function? What is the result of enclosing a tag in doublequotes? How do you set a system start-up function? . Introduction to Cicode Chapter Summary Setting variables Using expressions Operator input Passing data to functions Returning data from functions . Variable Operators Chapter 3 . Variable Operators Chapter Overview Classes of Operators in Cicode Order of Precedence . Classes of Operators Mathematical Operator Description + Addition (for numeric value) + Concatenation (for string variables) - Subtraction * Multiplication / Division MOD Modulus (Remainder) . IntToStr() function Used where function only accepts strings Use a function like IntToStr() Prompt(“ Value ” + IntToStr(Tag_1)) . MOD Operator TIC_P2_PV = TIC_P4_PV MOD 10 Concatenation Message(”P2" . 64) . ”TIC_P2_PV = " + IntToStr(TIC_P2_PV) . Logical Operators Operator Description Operator AND Logical AND Binary OR Logical OR Binary NOT Logical NOT Unary XOR Logical XOR Binary Operator ‘True’ returns Operator ‘False’ returns 1 0 . Truth Tables AND 0 1 OR 0 1 0 0 0 0 0 1 1 0 1 1 1 1 . Truth Tables XOR 0 1 0 0 1 1 1 0 NOT 0 1 1 0 . Agitator_Silo_V = Agitator_Alfast_V AND Centrifuge_Clar_V Agitator_Silo_V will be turned on ONLY when both Agitator_Alfast_V and Centrifuge_Clar_V are turned on. . Create multi-state text object . Bit Operators Standard bit operators 11011 AND 1101 = 01001 Operator Description BITAND Bitwise AND BITOR Bitwise OR BITXOR Bitwise XOR . Relational Operators Tests the relationship between two values Operator Description = is equal to <> is not equal to < is less than > is greater than <= is less than or equal to >= is greater than or equal to . Create advanced alarm . # Display tag1 as three digits before and one digit after the decimal point Operator Description : (colon) String Format .Format Operator Convert numeric values into formatted strings Tag1 : ###. ##EU S Exponential notation #s### +1.## +0023 +23 + 23.54 EU Engineering units #.Format Operators Specifier Description Function Use Example # The hash character The number of characters to display to the right of the AN #### + 23 +472213 0 Zero Padding #0## - Minus Justification #-### . Period Decimal notation ###.234e+01 2 . TIC_P3_PV:###. Format Operator TAG Format Message(“P3" .##.64) . BITXOR . > . <= . BITOR.Operator order of Precedence Order Operator 1 () 2 NOT 3 * . / . MOD 4 : 5 +. <> 8 AND 9 OR 10 BITAND.- 6 < . >= 7 = . OR Tag_1 (Tag_1 OR (Tag_2 AND (NOT Tag_3))) . AND Tag_2 3. NOT Tag_3 2.Precedence Examples Tag_1 OR Tag_2 AND NOT Tag_3 1. Test Order of Precedence Centrifuge_Clar_V = NOT Agitator_Silo_V AND Agitator_Alfast_V . How do you test the relationship between two values? How do you convert numeric values into formatted strings? Why are brackets used in formulas? .Chapter 3 .Summary Questions Name two of the classes of operators used in Cicode. Variable Operators Chapter Summary Mathematical operators Logical operators Relational operators Order of precedence . The Cicode Editor Chapter 4 . The Cicode Editor Chapter Overview Starting the Cicode Editor Compile. Run and Debug Your Code File Navigation Features Code Editing Tools Dockable Windows and Toolbars Changing Preferences . Starting the Cicode Editor Click on Cicode Editor icon Select New Cicode page . Context Sensitive Help M Cursor anywhere on ‘Logout’ term Hit <F1> Key . Open the Cicode Editor Save as Training . Compile & Run GoTo button provided Provides line number where error occurred Error shown GoTo error Compile & Run Compile only . GoTo Errors Compiler points to error Click GoTo Button Error Condition . FUNCTION ChangeValue() TagValue1=10 END FUNCTION ChangeValue() TagValue1=10 END ERROR . New Editor Features Colour Coding Auto Indenting Comment / Uncomment feature . Enhanced File Navigation Tabs give 3 different views View open Files . Changing Toolbars Click and drag to reposition toolbars Right Click toolbar area background Adds New toolbars . Indent and Comment Indent Comment Select text Click comment icon Outdent Uncomment . 0 DATE 02/12/04 01/04/05 AUTHOR DESCRIP B.Comments Comment your code constantly Preface every Cicode file with /* DESCRIPTION: Function to do this and that More description here */ // // // // // // REV 1.Rabbitt Add BlowUpIkea() function NOTES: All functions will be written in Cicode project given in the courses FUNCTION DoThisAndThat() ! Function starts here Int iCounter // Local loop counter C-style ‘block comments’ (dangerous! What about overlap?) C++ style comments Line comments .0 2.Bob Original I. Breakpoint Right Click .Bookmarks & Breakpoints Left Click .Bookmark Toggle Bookmark Clear Next Previous . Experiment with bookmarks comments and indents Use Comments Liberally .nAN = ANbyName(“WebBrowser”) . DspSetTip(nAN. “My Web Browser”) . List Functions Context sensitive function list <ctrl> <space> Right Click in text Select List Functions . Intellisense Autoprompt Typing function and opening bracket displays Autoprompt Function list displays Autoprompt . 2)) .REAL FUNCTION AreaOfCircle(REAL rRadius) RETURN (3. END _______________________________________ Function Test() AreaOfCircle(20) END .141 * Pow(rRadius. Preferences Customising Cicode Editor View | Preferences To change options Cicode Preferences Chapter 4 - Summary Questions How can you view files easily? Why use bookmarks and breakpoints? How can you change the look of the code window? The Cicode Editor Chapter Summary Starting the editor Goto errors File navigation Editing tools Function tools Preferences . Cicode Functions Chapter 5 . Cicode Functions Chapter Overview Simple Functions Structure of a Function Public & Private Functions Declaring & Naming Functions Statements Void Functions Cicode Variables Include Files . Simple Functions PUBLIC FUNCTION IncCounter() IF Count < 100 THEN COUNT=COUNT + 1. END END Scope of Function Public or Private Start of Function Name of Function Start of Code End of IF statement End of Code . ELSE COUNTER = 0 . Finished GOODBYE . ELSE Remain Seated.Function Syntax – Pseudocode HELLO StandUp() IF told THEN Stand Up . Function Elements Scope Declaration Name Statement . Scope PUBLIC Default Shared across Project PRIVATE Only works within Cicode file where written . END .Declaring Functions Indicates beginning and end of function code Scope FUNCTION FunctionName() Statement . Naming Functions Up to 32 characters Do not use reserved words Case insensitive Use CamelCase UpperCamelCase lowerCamelCase Scope FUNCTION FunctionName() Statement . END . ELSE PROMPT(“Mash Pump Off”). END END .Statements Perform the “work” in the function Statements PUBLIC FUNCTION StatementExample() IF MASH_PUMP THEN PROMPT(“Mash Pump On”). END END . ELSE PROMPT(“Mash Pump Off”).Void Functions Do not return any data to the calling function PUBLIC FUNCTION VoidExample() IF MASH_PUMP THEN PROMPT(“Mash Pump On”). END HTA. Message(“Alarm”.HH PUBLIC FUNCTION AudAlarm() DspPlaySound(“[RUN]:Tada.48).0).wav”.H OR HTA.PUBLIC FUNCTION MyDateTime() MISC1=Date(3). MISC2=Time(1). END .”Holding Tube too Hot”. FUNCTION AverageEx1() TIC_P2_PV = (TIC_P1_PV + TIC_P4_PV) / 2 END . REAL PLC Registers Computer Memory SILO_LEVEL value iAverage OVEN_TEMP value rArea STRING_TAG value sMyName .STRING Integers .Cicode Variables Located in Computer memory Temporary data storage Data Types Strings .INT Real Numbers . Declaring Cicode Variables Like Variable Tags – a Data Type must be specified for Cicode Variables Global. Module. Local . Cicode Variable Syntax Syntax: SCOPE DATATYPE NAME = INITIALVALUE Global Module Local STRING INT REAL Variable Name Initialize Variable GLOBAL STRING sMyString = “” ! Null Value . . END RETURN iStatus . INT FUNCTION GlobalExample(String sPage) INT iStatus . iStatus = PageDisplay(sPage) .Global Cicode Variables Valid across all Cicode files and all include projects Maintenance more difficult Local variables preferred GLOBAL STRING gsDefaultPage = “MIMIC” . IF iStatus <> 0 THEN PageDisplay(gsDefaultPage) . Module Cicode Variables Specific to the file where it is declared Default for Cicode variables Declare before functions use it Multiplies maintenance issues . Local Cicode Variables Specific to function where declared Any variable defined within a function is local by default (no prefix required) Only valid while function executes Local variables take precedence if name conflict occurs . Local Cicode Variables PUBLIC INT FUNCTION LocalExample() INT iAverage . RETURN iAverage END . iAverage=(TAG1 + TAG2) /2. Variable Naming Standards Hungarian Notation Initial (lowercase) letter describes variable usage Coined by Charles Simonyi of Microsoft Applications Hungarian vs. System Hungarian System Hungarian Notation Apps Hungarian Notation Prefix Interpretation Prefix Interpretation i. n Integer p Pump (on/off) r Real t Temperature s String x Horizontal coord o Object (activeX) y Vertical coord h Handle (int) c Control variable . “Holding Tube Too Cold") .wav". “Oven Temp".FUNCTION AudAlarm2(STRING sFile. STRING sMessage) DspPlaySound(sFile.sMessage. END Button AudAlarm2("C:\WINDOWS\Media\chimes. Message(sTitle. STRING sTitle.48).0). Converting Cicode Variables Convert Data Types for further processing Input() StrToInt() IntToStr() RealToStr() StrToInt() StrToReal() Calculations +-*/ . Places) Number: The floating-point number to convert Width: The width of the entire string Places: Number of decimal places in the string Message(“Holding Tube”.RealToStr(TIC_HOLD_PV.6. Use RealToStr function Need to convert number to string for use by message() function RealToStr(Number. Width.345 .64) Eg the specification 6.3 can store 12.3). operator can input a // single value (Title. // Displays dialog box. Default) LIC_Silo_PV=StrToInt(sTag)."Enter a value". Enter a value into a Tag FUNCTION OperatorInput() STRING sTag //sTag is a string sTag=Input("ENTER". Prompt. // Convert sTag value to string and place in // LIC_Silo_PV variable END .""). 5) . Format. UTC) TimeToStr(Cent_RT. Display Time Cent_RT is the accumulator TimeToStr(Time. Include Files Command field limited to 128 Characters Include Files accommodate a single complex statement sequence Any valid DOS filename Convention: Filename.cii Referenced by: @<filename> DO Include <> . Create an Include file Use Notepad <Alarms.cii> AudAlarm2(C:\WINDOWS\Media\chimes. “Holding Tube Too Cold”) .wav. “Holding Tube”. Chapter 5 .Summary Questions How many built-in functions are supplied with Vijeo Citect? What are the four basic elements of Functions? How and why use the Private function attribute? What is ‘declaring a function?’ How many characters can be used in a function name? What is ‘the statement?’ What are Void functions? What is a Cicode variable? . Cicode Functions Chapter Summary Elements of a function Void functions Cicode variables Converting and formatting variables Include files . Conditional Executors Chapter 6 . Conditional Executors Chapter Overview Four conditional executors IF FOR WHILE SELECT CASE IF Statement Execute code based on result of a test IF .. THEN or IF test expression THEN True Statements ; END - Or IF test expression THEN True Statements ; ELSE False Statements ; END IF .. THEN .. ELSE Use IF .. THEN .. ELSE statement FUNCTION IF_Example1() IF Centrifuge_Clar_V = 1 THEN Message(“Clarifier Status”, “Running”,64) ELSE Message(“Clarifier Status”,”Stopped”,64) END END sOnMessage . STRING sOffMessage) // If Tag1 is on then display ‘On’ popup IF iTag1 = 1 THEN Message(sTitle . Use IF THEN ELSE using Cicode variables FUNCTION // set data types for variables in this function IF_Example2(INT iTag1.64) // End of IF statement END // End of Function END . STRING sTitle.64) ELSE // Tag is 0 – display ‘Off’ Popup Message(sTitle . STRING sOnMessage. sOffMessage . END Exp1 + + ++ + + Exp2 Count Statements .FOR Loop Execute statements a number of times Variable used as counter Start Count Value End Count Value FOR variable = expression1 TO expression2 DO Statements . Sleep & SleepMS // Sleep for 1 second Sleep(1) // Sleep for 500 milliseconds SleepMS(500) . Sleep(2). // Set Counter to count 10 levels FOR Counter = 0 TO 9 DO // Add 1 to counter TagX = tagX + 1. // End of FOR loop END END .FOR Loop Execute statements a number of times FUNCTION IncrementLevel() // Counter is an Integer INT Counter . INT iPV. Use sleep(1) to delay the loop . iSP = LIC_Balance_SP.FUNCTION FOR_ExampleX() INT Counter. INT iSP. iPV = LIC_Balance_PV. INT iSP. INT iPV. iPV = LIC_Balance_PV. iSP = LIC_Balance_SP. FOR Counter = iPV TO iSP . END END . Increase LIC_Balance_PV FUNCTION FOR_Example1() INT Counter. SleepMS(300).1 DO LIC_Balance_PV = LIC_Balance_PV + 1. FOR Counter = iSP TO iPV . iPV = LIC_Balance_PV. Decrease LIC_Balance_PV FUNCTION FOR_Example2() INT Counter. SleepMS(300). INT iSP.1 DO LIC_Balance_PV = LIC_Balance_PV . END END .1. INT iPV. iSP = LIC_Balance_SP. IF LIC_Balance_PV > LIC_Balance_SP THEN FOR Counter = iSP TO iPV .1. SleepMS(300).FUNCTION FOR_Example3() INT Counter. INT iPV.1 DO LIC_Balance_PV = LIC_Balance_PV . iPV = LIC_Balance_PV. INT iSP. SleepMS(300). iSP = LIC_Balance_SP. END ELSE FOR Counter = iPV TO iSP-1 DO LIC_Balance_PV = LIC_Balance_PV + 1. END END END . WHILE Loop Execute statements while condition is true WHILE Expression DO Statements ; END WHILE Trigger DO Count = Count + 1 ; Sleep(1) ; END Decrement LIC_Balance_PV while Pump_Feed_CMD is true Set LIC_Balance_PV to 100 when Pump_Feed_CMD is false FUNCTION WHILE_Example1() WHILE Pump_Feed_CMD = 1 AND LIC_Balance_PV > 20 DO LIC_Balance_PV = LIC_Balance_PV -1; SleepMS(500); END LIC_Balance_PV = 100 Pump_Feed_CMD = 0 !optional END Select Case Statement Executes one of a choice of statements SELECT CASE Expression CASE CaseExpression1,CaseExpression2 Statements ; CASE CaseExpression3 TO CaseExpression4 Statements ; CASE IS > CaseExpression5 , IS < CaseExpression6 Statements ; CASE ELSE Statements ; ! nothing satisfied END SELECT <> ‘Catcher’ for when no other Case clause matches IS <=14 IS > iTestValue IS < “cherries” . 5. “oranges” Specifies inclusive range of values.=.Case Expressions Case Keyword (none) . TO IS ELSE Description Example Expression 6 iTestValue “Monday” Multiple discrete matches 3. iTestValue1 “apples”. 3 TO iTestValue “apples” TO “oranges” “Friday” TO “friday” Use with <. Smaller value placed before TO keyword. 8 iTestValue.>.<=.>=. CASE 3 MISC2 = "WEDNESDAY". CASE 2 MISC2 = "TUESDAY". CASE 5 MISC2 = "FRIDAY". CASE ELSE Message(" Invalid ". CASE 1 MISC2 = "MONDAY". END SELECT END .FUNCTION WhatDayIsIt() SELECT CASE Delivery_Day CASE 0 MISC2 = "SUNDAY". CASE 6 MISC2 = "SATURDAY".“Not a valid number". CASE 4 MISC2 = "THURSDAY".64). Chapter 6 . depending on the result of an expression?’ .Summary Questions What are the two formats of the IF statement? Why is the FOR loop used? Why is the WHILE loop used? Which statement is used to execute one of several groups of statements. Conditional Executors Chapter Summary IF statement FOR loop WHILE loop SELECT CASE statement . More Cicode Functions Chapter 7 . More Cicode Functions Chapter Overview Return Functions Cicode Arrays Comments . Return Functions Return functions return data to calling function HowAreYou() RETURN(“I am fine”) . Return Functions Must declare the returning Data type Function Called Evaluate Statements & store in memory Result returned & Stored in Tag or Variable . END PUBLIC STRING FUNCTION CurrentRecipe() Blah.Functions Returning Values Return Values Return Values Data Type returned PUBLIC INT FUNCTION ReturnExample() Blah. Return(3). END . Return(“Full Cream Milk”). Create Function FUNCTION AverageEx1() TIC_P2_PV = (TIC_P1_PV + TIC_P4_PV) /2 END Return Function INT ! return data type is Integer FUNCTION AverageEx2() RETURN (TIC_P1_PV + TIC_P4_PV) /2 ! return expression END . Create Function – AverageEx3() INT FUNCTION AverageEx3(INT iTagX. INT iTagY) RETURN (iTagX + iTagY)/2 END . END . RETURN StrToInt(sTag).""). Change OperatorInput() to a Return function INT FUNCTION EnterTagValue() STRING sTag sTag=Input("ENTER"."Enter a value". Pizza_Area = rArea. END .Bugs – Part 1 // Return the area of a circle into Pizza_Area given the // radius in Pizza_Size // Note the use of local variables and database variables FUNCTION AreaofPizza() rArea = pi()* POW(Pizza_Size.2). 2). rArea = pi()* POW(Pizza_Size. Answers // Return the area of a circle into Pizza_Area given the // radius in Pizza_Size // Note the use of local variables and database variables FUNCTION AreaofPizza() real rArea. END What about Pizza_Area & Pizza_Size? Probably a Variable tag or a global variable. judging by the usage . Pizza_Area = rArea.Bugs – Part 1. Bugs – Part 2 // This function will convert the diameter of the variable // tag from inches to centimetres // This is a RETURN function.54 END . FUNCTION InchToCent(REAL a) REAL rCent rCent=a*2. RETURN(rCENT) END . REAL FUNCTION InchToCent(REAL a) REAL rCent. Answers // This function will convert the diameter of the variable // tag from inches to centimetres // This is a RETURN function.54. rCent=a*2.Bugs – Part 2. Sleep(3). END .Bugs – Part 3 // Show the value of Pizza_Area on the prompt line. Prompt(""). FUNCTION PromptPizza(REAL rRealValue) Prompt("The area of the Pizza is " + rRealValue). Answers // Show the value of Pizza_Area on the prompt line.Pizza is " + rRealValue:##. Sleep(3).6. FUNCTION PromptPizza(REAL rRealValue) Prompt("The area of the Pizza is " + RealToStr(rRealValue. Prompt("").###) . END Alternate: .3))...Bugs – Part 3. Individual elements are accessed by index using a consecutive range of integers A B C INT Apartment[4] Unit Unit Unit Unit A B C D … … … … Apartment[0] Apartment[1] Apartment[2] Apartment[3] D Index[0] Index[1] Index[2] Index[3] .Arrays Arrays hold equally-sized data elements. of the same data type. Arrays INT MyArray[10] INT Count . For Count = 0 to 9 do MyArray[Count]=Count+1 . END . ”is”.Initialising an Array STRING Array[5]=“This”.”a”.”string”.”array”. Array is satisfied as: Array[0]=“This” Array[1]=“is” Array[2]=“a” Array[3]=“string” Array[4]=“array” . INT IntArray[4][3][2] .Array Dimensions Arrays can have more than one dimension INT MyArray[Dim1Size][Dim2Size][Dim3Size] = Values . REAL Result[5][2] . ! List ! 2-D Table ! 3-D Table . STRING StrArray[5] . Using Arrays Arrays are declared as Module or Global (cannot be declared locally) Placed at the beginning of a Cicode file Do not exceed the bounds of the array You cannot pass an entire array into a Cicode function . STRING FUNCTION RecipeSelection() END . “Skim". “Lite". “Sport". “High protein". Assign text description to numeric Tag STRING sRecipeArray[5] = “Full Cream". sRecipe = Input("Recipe Number". CASE ELSE Message("Error". SELECT CASE iRecipe CASE 0 TO 4 RETURN sRecipeArray[iRecipe].64).STRING sRecipeArray[5] = “Full Cream". “Skim". “High protein". “Sport". END SELECT END .""). iRecipe = StrToInt(sRecipe)."Enter a number between 0 and 4"."Not a valid number". INT iRecipe. “Lite". STRING FUNCTION RecipeSelection() STRING sRecipe. Comments Comment .Comment and Comment again ! Single Line Comment Function() /* Multiple Line comments Can extend over several lines End comment block with a delimiter .Cannot be started on the same line as a statement */ Function2() // Another style of comment // Begin each line with forward slashes . Chapter 7 .Summary Questions What does a return function do? What is an Array? Why should comments be included in all Cicode files? . More Cicode Functions Chapter Summary Return functions Debugging code Arrays Comments . Cicode Debugger Chapter 8 . Cicode Debugger Chapter Overview Starting the Debugger Debug Options Debug your Code . Citect Kernel Covered in Intermediate Course Core of the Vijeo Citect system Low-level diagnostic and debugging Use with extreme care Secure access – over-rides all other security measures Command Line interface . Cicode Editor in Debug Mode Open Debug Toolbar Right-Click on blank area of toolbar . Open and test Pizza page Toggle Breakpoints . .”NUMBER”) .sPizzaNumber. To DevFind(hDev.”NUM”) . Find Errors From DevFind(hDev.sPizzaNumber. Advanced Stepping . What are they? .Chapter 8 .Summary Questions Explain debug mode. There are three tools to control stepping through functions. Cicode Debugger Chapter Summary Cicode editor environment Advanced stepping . Did we Achieve the Objectives? Good Understanding & Competent in Use of Cicode Be Able to Use Cicode in Commands and Expressions Apply Learning to Your Own Site or Project Be Able to Write Your Own Cicode Functions Know How to Debug Your Own Cicode Functions . SCADA Training Roadmap Technical Skill Requirement Customisation & Design Networking & Architecture Upgrade & New Features Cicode Programming Vijeo Citect Configuration . com/evaluation .citect.End of Course Questions Certificates CCSE Certification Course evaluation www.
Report "49144839 Vijeo Cicode Course v7"
×
Please fill this form, we will try to respond as soon as possible.
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Copyright © 2024 DOKUMEN.SITE Inc.