Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Write Cicode and Create Citect

Name: SCADA 2013-04-12 5:30

Practical 1 : Introduction to SCADA

OBJECTIVES:

1. To understand the concept of SCADA and familiarize with the CITECT SCADA environment

2. To create and manage projects using Citect Explorer


Creating and managing projects with Citect Explorer

The Citect Explorer is the application from which you organise your projects and launch the configuration and run-time applications. Tasks such as creating, deleting, backing up and restoring projects are fundamental to any Citect application.

Creating a new Project

The first thing you need to do when configuring Citect is to create a new project in which to store your project information.

⇨ To create a new project:

1. In the Citect Explorer, select File ǀ New Project or click on the New button

2. The following dialog will appear - fill in the relevant details: e.g : Name : Training, Description : Training Project

Hints & Tips:

To go to the next field, use the mouse cursor or press the TAB key. To go back a field press SHIFT-TAB

3. Click on OK.

Citect will now create the configuration databases that will be the building blocks of your project.

Note the new entry called Training in the Project List- this entry will contain all of the configuration information for your project.

Backing Up & Restoring a Project

⇨ To backup a project:

1. Select Tools ǀ Backup ... from the menus or click on the icon

2. The following dialog will appear- fill in the details as required

To restore a project

1. Select Tools ǀ Restore ... from the menus or click on the icon

2. The following dialog will appear- fill in the details as required.

NOTE: When backing up a project, the project is backed up to a file called ctbackup.ctz. When restoring a project look for the file that you have backep up (with the .ctz extension)

Deleting a Project

⇨ To delete a project:

1. In the Citect Explorer, click on the project that you want to delete from the Project List.

2. Select File ǀ Delete Project from the menus or select Delete Project from the context menu.

See Also:

Delete a Project in the Projects' category in Help Direct.

Exercise

1. In the Citect Explorer, backup your project to the directory C:\Temp.

NOTE: You should do this after every lab session so that you will have a backup copy in case it is accidentally deleted.

2. To simulate an accidental delete, delete your project called Training.

3. To simulate the recovery of your lost project, restore the project from C:\Temp to a new Training project that was lost. Notice that all the component of your 'lost' training project was recovered.

4. To prepare for the next part of the lab, delete your Training project.

Citect can communicate with any control or monitoring 1/0 Device that has a communication port or data highway - including PLCs (Programmable Logic Controllers), loop controllers, bar code readers, scientific analyzers, remote terminal units (RTUs), and distributed control systems (DCS). Citect communicates directly with the 1/0 Devices in your plant or factory.

Express Communications Wizard

The Express Communications Wizard enables you to quickly setup communication with a new or existing 1/0 Device:

⇨ To run the Express Communications Wizard:

1. In the Citect Explorer select the project you are working on.

2. Click on the Communications folder in the Project List.

3. Double click on the Express 110 Device Setup item in the Contents Area:

The following dialog is displayed:

By filling in the relevant information and clicking on the Next button, the Express Communications Wizard will guide you through the setup process.

Exercise

1. First, create a new project and call it TEST. The location should be C:\Temp.

2. Setup communication to an external Omron C200HE PLC using serial communication (accept the default name for the 1/0 Device - i.e. 10Dev1 ). If you are using a different type of PLC then select it instead.

The Communications Dialogs

After running the Express Communications Wizard, a set of communications dialogs are created that can be found in the Communications folder in the Citect Explorer.

The dialogs that would have been created in the previous exercise for Omron C200HS PLC connected serially are shown below:

Boards :

Board Name : BOARD1

Ports :

Board Name : BOARD1

I/O Devices

Port Name : PORT_BOARD1

Exercise

1. Open up each of the dialogs shown above from the Citect Explorer. Do this by highlighting the Communications folder in the Project List and then double clicking on the 1/0 Servers, Boards, Ports and 1/0 Devices items in
the Contents Area.

2. Go to Citect Editor and click on to the Communication menu. Select Port and change the baud rate from 19200 to 9600 (the baud rate for Omron PLC serial comm).

3. Click on the Help button for each of the communications dialogs for more information.


Testing Communications

To test that the server and 1/0 Device are communicating.

We will first define a variable tag called Green_Lamp and display its value on a graphics page. Here, we will control the green lamp ON or OFF through the Citect system.

⇨ To define a variable tag :

1. In the Citect Explorer click on the Tags folder in the Project List and double click on the Variable Tags item in the Contents Area:

2. The following dialog will be displayed:

Variable Tags

Fill in the fields of the dialog as follows:

Variable Tag Name : Green_Lamp

IO DEVICE NAME : IODev

Data Type : DIGITAL

Address : 301

If you are using a PLC other than a Omron then the Address field will be different. Check the Citect Help Topics for the correct address.

See Also:

Click on the Help button on the Variable Tags dialog to get information about each field.

3. Click Add.

⇨ To display the value of the variable tag on a graphics page:

1. Double click on the Create a new page button in Citect Explorer

or

Click on the New button in the Graphics Builder.

2. If you double clicked Create a new page then go straight to step 3, otherwise, click the Page button when the following dialog is displayed:

3. Make your selection from the Use Template dialog:

For a test page, select :

Style : standard

Linked : tick

Title Bar : tick

Resolution : Default

Template : Normal

4. Click on OK.

5. Draw a button on the page by selecting the Button tool from the toolbox.

6. Move the mouse to where you want the button to start and press (and hold) the mouse button. Drag the mouse to where you want the button to finish and release the mouse button.

 ↘

7. The following dialog will be displayed (if it is not displayed then use the mouse to double click on the button you just drew):

In the Text field type ON Green Lamp as shown above.

8. Click on the Input tab (at the top of the dialog) and the following dialog will be displayed:

In the Action list click the Up check box and in the Up command field type Green_Lamp = 1.

9. Click on OK.

10. Draw another button by repeating steps 5 to 9- for this button type OFF Green Lamp in the Text field and Green_Lamp = 0 in the Up command field.

11. Select the Text tool from the toolbox and move the cursor to a point near the buttons you drew- by doing this we will draw some text to display the value of the Green_lamp tag.

12. Press the space bar once and then click the left mouse button. A dialog will be displayed (if it is not displayed then use the mouse to double click on the object you just drew).

13. Click on the Appearance tab along the top of the dialog and then click on the Display Value tab at the right of the dialog.

In the ON text when field type Green_Lamp (as a defautt the Type should already be set as On / Off), in the OFF text field type OFF and in the ON text field type ON.

14. Click on OK.

15. Click on the Save button on the tool bar to save the page. Select Test from the Project list and then type Test in the Page field.

16. Click on OK. Remember to set to Memory 10 before testing the project

17. Run the Computer Setup Wizard.

18. Click on the Run Project button to run and test the project. Click on the ON and then the OFF buttons to see the effect.

Exercise

1. Now, create a lamp on the graphics editor to monitor the red lamp status from Citect. First, create and add another variable tag (Refer to earlier section To define a variable tag) with the followings:

Variable Tag Name : Red_Lamp I/O Device Name : IODEV1, Data Type : DIGITAL, ADDRESS : 300

2. Select the Symbol Set to create an indicator lamp to represent the physical red lamp. Add Red_Lamp to the dialog box ON symbol when as indicated in the diagram below. Click Apply and OK.

3. Create two buttons : one to turn ON the Red lamp and one to turn OFF the Red lamp.

4. Click on the Save button on the tool bar to save the page.

5. Click on the Run Project button to run and test the project. Clicking on the buttons will activate the Red lamp ON or OFF according to which button is being clicked.

Name: SCADA 2013-05-12 23:55

Citest Directory :

Alarms.ci

//    FILE:        Alarms.ci
//
//
//    DESCRIPTION:    This file contains various functions that show how
//            you can customise the way alarms behave.
//            If you want to attach Operator Comments to Alarms
//            or change analog alarm properties by selecting them
//            from an alarm list then the following functions can
//            be copied to your project.
//
//    NOTES:        If you don't want the above then you don't need any
//            of the cicode shown here.
//   

//     ---------------------        Attach Comment Functions     ------------------------
//
//    FUNCTION:    SetEventAn
//
//    DESCRIPTION:    Remembers the Animation Number selected by the
//            operator. This function is called via the left mouse
//            button (PageWide Keyboard) when the user clicks on a
//            Alarm in the list.

INT    hEventAn;

FUNCTION
SetEventAn()
    int    hAn;

    hAn = KeyGetCursor();
    IF hAn <> -1 THEN
        hEventAn = hAn;
    END
END

//    FUNCTION:    GetEventAn
//    RETURN VALUE:    hEventAn

INT       
FUNCTION   
GetEventAn()   
    Return(hEventAn);   
END

//    FUNCTION:    AttachComment
//
//    DESCRIPTION:    Attach a comment to a alarm summary.

FUNCTION
AttachComment(int hFault)
    int    hAn;
    string    sFault;

    sFault = FaultCondition(hFault);
    IF hEventAn <> -1 THEN
        hAn = KeyGetCursor();
        KeySetCursor(hEventAn);
        AlarmComment(sFault);   
        KeySetCursor(hAn);
    END
END

//    FUNCTION:    FaultCondition
//
//    DESCRIPTION:    Get the reason for the fault. If fault is less than
//            5 get a standard fault from the array of fault
//            messages, otherwise get the reason from the user.
//   
//    NOTE:        The @() characters define strings that can be
//            translated at runtime.

STRING    sFaults[6] = "", "@(Electrical)", "@(Mechanical)", "@(Operational)", "@(Process)", "@(Other)";

STRING
FUNCTION
FaultCondition(int hFault)
    string    sFault;

    IF hFault < 5 THEN
        RETURN sFaults[hFault];
    ELSE
        RETURN Input("@(Alarm Comment)", "@(Enter the reason for the alarm)", "");
    END
END


//    FUNCTION:    AlarmMoveCursor
//
//    DESCRIPTION:    This function is used to move an object to indicate the Alarm
//            that is currently selected.
//   
//    REVISION    15 April 98    Steve Schilg    Modified Cursor Offset.
//
//    AN        First AN of Alarm list
//    Count        Number of Alarms in the Alarm List
//    ObjAn        Animation Number of Object to be moved
//   
//    RETURN VALUE    None.


FUNCTION
AlarmMoveCursor(INT AN,INT Count, INT ObjAn)
INT hAn,X,Y;
   
    hAn    =    KeyGetCursor();                !Get AN currently in Focus
    IF (hAn >= AN) AND (hAn <= (AN+Count)) THEN    !Check if in range
        DspAnGetPos(hAn,X,Y);                !Get XY co-ordinates of AN
        DspAnMove(ObjAn,X-9,Y+5);            !Move Object
    END
END

//    FUNCTION:    ResetEventAn
//
//    DESCRIPTION:    Resets the hEventAn variable so that the Alarm
//            Select Cursor does not point to the last selected An.
//            Called on Page Entry or Exit.

FUNCTION
AlarmResetEventAn()
    hEventAn=0;
END

//    FUNCTION:    AlarmSelected
//
//    DESCRIPTION:    Checks if there is a Alarm displayed at the AN where the
//            Alarm Select Cursor is positioned.
//    AN        First AN of Alarm list
//    Count        Number of Alarms in the Alarm List
//
//    RETURN VALUE:    TRUE if alarm selected, FALSE if no Alarm  selected


INT
FUNCTION
AlarmSelected(Int An,Int Count)
    IF StrLength(AlarmGetDsp(GetEventAn(), "Tag")) > 0 AND
            (GetEventAn() >= An) AND (GetEventAn() <= (Count+An)) THEN
        Return(1);
    ELSE
        Return(0);
    END
END

!---------------------------- Set Analog Alarm Thresholds -------------------------

// The following Function should be called from a alarm list that shows all configured alarms.
// You need to set up an alarm page that shows all alarms but is not updated when the status of an alarm is
// changed. To do this use a button with the command AlarmSetInfo(21,3,4)


INT iRecNo;
STRING sHighHigh,sHigh,sLow,sLowLow,sDeadBand,sDeviation,sRate;

FUNCTION
AlarmSet()
INT  hAn;
STRING sTag,sName,sEnab,sDisab;
    SleepMS(250);       
    KeySetCursor(GetEventAn());   
    hAn = KeyGetCursor();
       
    sTag = AlarmGetDsp(hAN, "Tag");

    IF StrLength(sTag) > 0 THEN
       
        sName    =AlarmGetDsp(hAN, "Name");
        iRecNo    =StrToInt(AlarmGetDsp(hAN, "RecNo"));
   
        sHighHigh=AlarmGetThreshold(0);       
        sHigh    =AlarmGetThreshold(1);   
        sLow    =AlarmGetThreshold(2);
        sLowLow    =AlarmGetThreshold(3);
        sDeadBand=AlarmGetThreshold(4);
        sDeviation=AlarmGetThreshold(5);
        sRate    =AlarmGetThreshold(6);

        FormNew("Alarm Tune",30,12,0);
       
        FormPrompt(0,0,"Tag");
        FormPrompt(11,0,": "+sTag);
        FormPrompt(0,1,"Name");
        FormPrompt(11,1,": "+sName);

        FormRadioButton(0,2,"Enable",sEnab);
        FormRadioButton(11,2,"Disable",sDisab);

        FormInput(0,3,"High High     ",sHighHigh,10);
        FormInput(0,4,"High          ",sHigh,10);
        FormInput(0,5,"Low           ",sLow,10);
        FormInput(0,6,"Low Low       ",sLowLow,10);
        FormInput(0,7,"DeadBand      ",sDeadBand,10);
        FormInput(0,8,"Deviation     ",sDeviation,10);
        FormInput(0,9,"Rate of Change",sRate,10);

        FormButton(0 ,11,"   OK   ", 0, 1);
        FormButton(12,11," Cancel ", 0, 2);

        IF FormRead(0)=0 THEN
            KeySetCursor(hAn);   

            IF AlarmGetDsp(hAN, "Tag")= sTag THEN    !Check Still pointing to same AN
                AlarmSetThreshold(0,sHighHigh);
                AlarmSetThreshold(1,sHigh);
                AlarmSetThreshold(2,sLow);
                AlarmSetThreshold(3,sLowLow);
                AlarmSetThreshold(4,sDeadBand);
                AlarmSetThreshold(5,sDeviation);
                AlarmSetThreshold(6,sRate);
           
                IF sDisab="1" THEN
                    AlarmDisable(0,0);
                END
                IF sEnab="1" THEN
                    AlarmEnable(0,0);
                END
            ELSE
                Message("Warning", "Alarms Changed - Please Select Alarm Again",48);
            END
        END
    END
END

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List