1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

NC2000 system operation manual vol4

288 1,6K 9

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 288
Dung lượng 8,46 MB

Nội dung

Theuser manual is divided into four parts: the first volume introduces the installationprocess of NC2000 and the operating system, including, and the installation andconfiguration proces

Trang 1

Maintenance Manual of NC2000 computer monitoring system

(V2.0)

Maintenance Manual IV

State Network Research Institute, Nanjing Automation Research

Institute of Automatic Control

Trang 2

NARI, Nanjing Automation Co., Ltd.

June 2006

Trang 3

Copyright Notices

The copyright of "NC2000 computer monitoring system user manual" is belonded

to NARI,Nanjing Automation Co., Ltd Without the written permission of NARI,Nanjing Automation Co., Ltd., everyone shall not copy or spread any part of thismanual in any form, using any means (electronic or mechanical, includingphotocopying or recording), or for any purpose

, is the registered trademark of Nanjing NARI GroupCorporation

(c) Copyright 2004 is belonded to NARI, Nanjing Automation Co., Ltd All rightsare reserved, and all reproductions are rejected

Trang 4

System software NC2000 is the power system computer control system software of

a new generation, which is completed and has accumulated the monitoring softwareexperience of many years, after NARI Access has been used in a number of powerplants in our country by NARI Nanjing Automation Co., Ltd The System introducesCLINET / SERVER architecture and supports for different hardware, operating systemand relational database systems Because the development approach is object-orientedand covers both the design and development process, users can use it more convenientlyand intuitively

The main objective of this manual is to enable users to fully grasp theinstallation、 usage 、 maintenance methods and procedures of NC2000 system Theuser manual is divided into four parts: the first volume introduces the installationprocess of NC2000 and the operating system, including, and the installation andconfiguration process of NC2000; the second volume is the user operation manual ofNC2000 system and introduces operation methods of NC2000 in details; the thirdVolume introduces the usage of the configuration tool of NC2000 and the usage of theconfiguration software which is united by NC2000 system; the fourth volume is themaintenance manual of the system and introduces all aspects which need to bemaintained and the methods and procedures of maintance

We hope that through this user manual, the readers can grasp the NC2000 systemand ensure the system to operate more securely, reliablely and stablely, and makegreater contribution to the automation construction of power systems

Trang 5

Manual constitute

This manual is composed by six chapter

1 A brief description of the software architecture of NC2000 system

2 Introduce the basic Linux/Unix command and Linux utility

3 Introduce the Solaris system commands and tools when manage and maintain

4 Introduce the command in Windows platform in common use

5 The tutorial of MySql relational database management and maintenance

6 The technical of import and exportp of oracle relational database and theintroduction of the maintenance tool of Sqlplus

Handbook agreement

This manual keeps to the following agreement:

1 All the headings is in bold type

2 If the title followed by a "conditions", it means that the content behind the headingrequired by the body is necessary under certain conditions

【 Note 】 That means readers should pay attention to those which need to payattention

Trang 6

【Warning】 That means readers should pay attention to certain matters, otherwise theywill cause serious error.

Trang 7

Chapter I NC2000 Monitoring System Software 1

1.1 The Architecture of NC2000 Monitoring System Software 1

1.1.1 Constitution of NC2000 monitoring system software 1

1.1.2 Directory of NC2000 monitoring system 2

1.2 The background process of NC2000 monitoring and control system 4

1.2.1 The running environment of background process 4

1.2.2 Background Process of Monitoring System 10

1.2.3 The Data Stream of NC2000 System 15

1.3 The Communication Drivers of NC2000 System 16

1.3.1 The Header File of NC2000 system Driver 16

1.3.2 The common NC2000 system communication driven library function 20 Chapter II Functional Specification of Linux Operating System 43

2.1 Linux System Commands 43

2.1.1 Commonly Used Command Explain of Linux System 43

2.2 utility Linux system tools 77

2.2.1 RedHat Linux 9 package management tools 77

2.2.2 users and configuration groups of RedHat Linux 9 79

2.2.3 RedHat Linux 9 Network Configuration Computers need a network connection to communicate with other computers It is achieved by recognizing the operating system interface card (such as: Ethernet card, ISDN modems, token ring), and configuring the interface to connect to the network 91

2.2.4 Network File System (NFS) 105

2.2.5 RedHat Linux 9 basic firewall configuration 113

2.2.6 The RedHat Linux 9 controlling of accessing to services 122

Chapter III Utility of Solaris 9 Operation System 130

3.1 Solaris 9 System Commands 130

Trang 8

3.1.1 boot command and parameters under the case of Solaris Unix OK 130

3.2 The Utility in Solaris 9 154

3.2.1 Admintool tools 154

3.2.2 program package command 161

3.2.3 Installation and Management of system patch 177

3.3 Shell programming instructions 182

3.3.1 programme shell scripts 183

3.3.2 Reference table and script examples 226

Chapter IV Practical Help of Windows Operating System 240

4.1 DOS command 240

4.1.1 Commands of directory operation 240

4.1.2 Disk operation command 243

4.1.3 File operation commands 247

4.1.4 Other commands 252

4.2 Detail explain of utility command of windows 254

4.2.1 explanation of network command 254

4.2.2 Windows command Guinness 270

Trang 9

Chapter I NC2000 Monitoring System Software 1.1 The Architecture of NC2000 Monitoring System Software

1.1.1 Constitution of NC2000 monitoring system software

NC2000 system monitoring software is mainly omposed of two parts, the Front Human-Computer Interaction program and Backgrounds background program.The Human-Computer Interaction program mainly provides the screen display, reports, briefings, and other interactive query curve graphic display and operating functions;the Background program provides the communication between the computer monitoring system and the external device, the management of NC2000 database,the management

of historical database and other kinds of background processes.The two programs exchang of data through the way of multicast

Figure 1-1

Because each node has different function,the required deployment of NC2000 system software are also different.The chart below shows the NC2000 system software architecture:

Trang 10

Figure 1-2 The Human-Computer Interaction of program of NC2000 system procedures are

developed by Java.The class of inport is nc2000 ncconsole StartMenu,and after starting, relating various functions of human-computer interaction by implementating

nc2000.ncconsole Human-computer interaction of NC2000 system mainly include:

information of briefing, the screen showed ,list and Report inquiries, optical character display, AGCAVC parameter query, editing of sequence control program, database edit and so on

At the node do not need to run the human-computer interaction should not run the human-computer interaction process of NC2000 system.The communication among the various nodes of NC2000 monitoring system, as well as external communications are realized by the background context,and different roles of the computer nodes, the deployment of background processes will be slightly different The role of the

background process playing will be described in a special chapter

1.1.2 Directory of NC2000 monitoring system

Directory of NC2000 monitoring system software is as follows:

Trang 11

Above all is a simple role of the directory and description.The follows is a functionindication specific documents of directory under certain commonly used directory

1 ~ / data / resource directory.For example,when configurate communication drivers in DB-databese of NC2000,and the driver name does not appear in the drop-down menu list,you can manually edit the file in this directory, "drvlist.properties", in order to adding new drivers at the end of the file.The format of the file can be defined as other

Trang 12

3 ~ / projects.xxx / db directory The "config.sys" is the file whice read the

configuration of NC2000 system node.The "agc_ *.properties" is the default

configuration file whice the AGCAVC program has to read "x.x.x.13 x." is the objects script file of the DB-database,and is explained by the program "ooexpr"

4 ~ / projects.xxx / userinfo directory.The "defaultagcavc.properties" is the default configuration file whice the AGCAVC program has to read, Recording the

number,name and other information of Plant Station which is managed by AGC, (text file, you can manually edit) "Defaultrundsp properties" record default screen file whicecan be start directly under the "screen" window "screen" menu bar after NC2000 systemstarting, (text file, you can manually edit)

5 ~ / projects.xxx / XXX directory.XXX stands for a project name.The establishment ofXXX is required by the plant whice has many stations,and the graphics files and

sequence control program is placed in this directory

6 ~ / ~ / projects.xxx / drvconfig directory.NC2000 system "Communication Interface" function to generate The communication configuration file whice is generated by the NC2000 system"Communication Interface" is stored in this directory.The file "xxx.txt"

is a text file whice contain configuration of the communications point ,and can be opened by a text editor

1.2 The background process of NC2000 monitoring and control system

1.2.1 The running environment of background process

To smoothly run NC2000 background process monitoring system, the minimum configuration requirements are as follows:

850MHz Intel Pentium III processor or equivalent processor

512MB RAM

Trang 13

10GB free disk space

The minimum configuration mentioned here is required by only running the basic background monitoring system NC2000 procedures.In the configuration of NC2000 monitoring system,Generally communications only the ommunications and the host do not need to run the Front Human-Computer Interaction program The communication is only responsible for communication between NC2000 system and the external

system,and the background program running on it do not need to consume too many resources,therefore the communication only has the general hardware configuration.But

as a host,the background process of NC2000 system need to deal with much more complex data than communication, but also need to ensure that the system must run in asecurity and stability status, so its hardware configuration is also much higher.Typically,the running of NC2000 monitoring system requires the host minicomputer or server configuration

1.2.1.2 Software platform of NC2000 background program system execution

The of developmentNC2000 system background process are based on C-language

of Unix or Linux (compatible with standardized POSIX.1).Tested, the software

platforms whice is applicable to the background program of NC2000 including: RedHatLinux 9, Sun Solaris 8, Sun Solaris 9 for Sparc, Sun Solaris 10 for Sparc and Sun Solaris 10 for x64.To run the Front HCI of NC2000 system, also need to insall a Java virtual machine that require higher version than JRE5.0.0_1

1.2.1.3 The composition of the background program

The background program of NC2000 systems mainly includes the following programs: dbload, client, server, red_m, mam, drvman and various types of driver, engine, lsdmn, ooexpr, st_clock and so on

1.2.1.4 Setting of Environment variable

For the smooth running of NC2000 monitoring system software, you need to

configurate some parameters of the system environment variables Generally,during the installation of NC2000 system, we will set up the user"nari",and the running script language is "csh", at the sametime,should also set up the user's home directory The

Trang 14

environment variable required by the normal operation of NC2000 monitoring system software is usually defined in the file "Cshrc" under the user's home

directory,"nari".The self-starting file of NC2000 system is defined in ".login"(in Linux systems) or" startdt" (in Solaris system)

The fllowing is a nice setting "Cshrc" file:

alias a alias

a s 'source ~/.cshrc'

#setenv LANG C

setenv XAPPLRESDIR /data/resources

setenv WINDOWS /usr/bin/X11

setenv EBTRC /usr/ebt/bin/ebtrc.global

setenv JCC "javac -deprecation -g:none -O -nowarn -d /bin"

a dtext '/usr/ebt/bin/dtext'

umask 002

# This is the path for Motif/Sunview:

set path=( /usr/local/bin /opt/SUNWspro/bin ~/exe /usr/ccs/bin /usr/bin/mme /usr/bin /usr/ucb /etc /usr/etc /usr/man /usr/sccs /usr/dt/include/Xm /usr/dt/bin /usr/include

$HOME/exe $WINDOWS /usr/sbin /usr/i18n/mule/bin)

# added for openwin

setenv F1H $HOME/data/lib

setenv LD_LIBRARY_PATH

/usr/ucb/lib:/usr/dt/lib:/usr/lib:/usr/ucblib:/usr/local/lib:

#setenv JAVA_FAST64_VM True

setenv JAVA_HOME /usr/java

setenv CLASSPATH $F1H/dx.jar:$F1H/JLex.jar:$F1H/java_cup.jar:$F1H/jbcl.jar:

$F1H/dx3.0.jar:$F1H/mediaplayer.jar:$F1H/multiplayer.jar:$F1H/customizer.jar:$F1H/jmf.jar:$F1H/glf.jar:

setenv CLASSPATH

$F1H/F1J8Swing.jar:$F1H/jh.jar:$F1H/F1J8_zhs.jar:$F1H/xalan.jar:$F1H/infobus.jar:

Trang 15

setenv CLASSPATH

$F1H/jcfield450K.jar:$F1H/NetComponents.jar:$F1H/dbswing.jar:$F1H/

sunjce_provider.jar:$F1H/lb.jar:$F1H/kernel.jar:$CLASSPATH

setenv WINMGR /usr/bin/X11/mwm

setenv MANPATH /usr/local/man:/usr/share/man

setenv MANPATH

/opt/SUNWconn/man:/opt/SUNWrtvc/man:/opt/SUNWsmtv/ShowMeTV/man:/opt/SUNWvts/man:/opt/SUNWspci2/man:/opt/SUNWspro/man:/opt/SUNWste/man:${MANPATH}

# 8/6/91 Added for running exec's from ~/work/bin, Chinese character editor

# 10/3/91 But some files are dependent on path so don't like this addition

#set path=(/usr/ucb/ $path ~/work/bin /usr/bin/mme/ /usr/bin/mtools)

set path=($path /usr/ucb/ ~/work/bin /usr/bin/mme/ /usr/bin/mtools/sbin )

# normal ' backward `

a sprompt 'set prompt="$USER@`hostname`[\\!]:"'

#settings for interactive shells

a sel 'setenv LINES \!*'

a sem 'alias more "more -n\!*"'

a pcset 'sem 33; sel 34'

Trang 16

a open 'chmod go+r'

a shut 'chmod go-r'

setenv exepath ~/exe/

setenv LIBSRC "-I $HOME/txt/libipc -I $HOME/txt/libncdb -I $HOME/txt/libdrv -I $HOME/txt/libntool"

# -modified by icelee 2005.3.15 -#

set _DB_BASE_TYPE=`awk -F: '{ if($1 == "oracle") print $1;}' < /etc/passwd`

Trang 17

set _DB_BASE_HOME=`awk -F: '{ if($1 == "oracle") print $6;}' < /etc/passwd`

if { test "X$_DB_BASE_TYPE" = "X" } then

setenv DB_BASE_TYPE mysql

else

setenv DB_BASE_TYPE oracle

endif

if { test "$DB_BASE_TYPE" = "oracle" } then

setenv ORACLE_BASE $_DB_BASE_HOME

#setenv ORACLE_BASE /usr/users/oracle

setenv ORACLE_HOME $ORACLE_BASE/product

setenv ORA_NLS33 $ORACLE_HOME/ocommon/nls/admin/data

setenv ORACLE_HELP $ORACLE_HOME/help/admin/resource

#setenv ORACLE_SID ora9`/usr/sbin/clinfo -n`

#setenv EPC_DISABLED false

setenv NLS_LANG american_america.ZHS16GBK

#setenv NLS_LANG AMERICAN_AMERICA.ZHS16CGB231280

setenv ORACLE_OWNER oracle

set path=($ORACLE_HOME/bin $path)

setenv LD_LIBRARY_PATH

$ORACLE_HOME/lib:$ORACLE_HOME/network/lib:$ORACLE_HOME/javavm/admin:$LD_LIBRARY_PATH

setenv CLASSPATH $ORACLE_HOME/sqlj/lib/runtime.zip:$ORACLE_HOME/sqlj/lib/translator.zip:$CLASSPATH

setenv CLASSPATH $ORACLE_HOME/jdbc/lib/classes111.zip:

Trang 18

source login

endif

1.2.2 Background Process of Monitoring System

1.2.2.1 the starting of background process

Background programs of NC2000 system are stored in the exe directory whice is under the home directory of nari users.For different roles of the computer nodes, the deployment of background processes will be slightly different The nodes of NC2000 monitoring system are divided into 3 basic categories:Host, operator and

communication.The following is the background process that kinds of nodes required torun and the sequence of boot

Host:

Operator :

Communication:

Typically, we will make the sequence of start into a shell ,for exzample,

"startmain", "startop "or "startcom / startyd" whice is stored in "~ / exe" directory ("~"stand for nari user's home directory ) When NC2000 is started, the corresponding procedures are also started automatically one by one

Above all, we can see that the background procedure host equired are significantly more than other types of computer nodes The the function of these procedures will be introduced in the next section

1.2.2.2 Introduction for Uses of Background Process

We can see from the last ection, basic background procedures of NC2000

dblo

ad client server red_m mam lsdmn

ooexpr

drvman

agcdrv

agcavc

engine

dbloa

d client server red_m mam agcdrv drvman

Trang 19

including: dbload, client, server, red_m and mam The following diagram outlines the main purpose of these procedures:

Red_m has the same function as red_a ,and the two-network system configuration need to start the two processes simultaneously.red_m is the Net-based process, and red_a is the supplemented Net process.A single net system only need to start red_m.In addition ,red_m also responsible for consistency of network time, so need to have superuser-property

Except of the basic background process there is a number of processes whice mustdeal with the special mission, they include:

Trang 20

lsdmn:the management process of logicality source,in NC2000 DB-database,it is responsible for management of quotion relations of logicality source among all

responsible for automatic generation control

agcdrv: responsible for sending AGC data of the host and receiving it at the other nodes

Drvman: the management process of kinds of driver process,it is responsible to the management of communication process among host,LCU,communication and external communications equipment

st_clock: GPS clock synchronization receiver process,it is CPS responsible for receiving data of CPS clock synchronization Generally,it is running on the

communication

start_svc: shell of the process starting of the process of the NC2000 historical databese.NC2000 system it is responsible for the starting of related process of NC2000 historical DB-databese.These processes include: hsvr_log, hsvr_mn, hsvr_smp,

DB-hsvr_red and so on

【Note】 NC2000 historical database systems have to run on oracle or mysql database.Currently,In accordance with the verification,there is several relational DB-database systems applicable to NC2000 historical DB-databese ,including:oracle 8i, oracle 9i, mysql-4.0, mysql-5.0 version.Before the operation of NC2000 historical database system process ,you need to make sure that oracle Services or mysql Services Services has been running

In addition to the above main background procedures, exe directory also includes anumber of practical orders of NC2000 system,including:

sh_data:

Trang 21

sh_data use for looking for or setting parameters status of the point in NC2000 real-time database system Usage format: sh_data xxxxx.xx (point code Parameter code).For example,To check the power value of No 1 generator (point is

number1.1.2.1.6, and code-named of parameters is 59), examples are as follows:

sh_data 1.1.2.1.6.59

If you want to manually set the parameters of a measuring point,on the premise of meeting set value(Measuring point parameters can be written with no other background process refurbishing this parameters),and using the setting format:sh_data

xxxxx.xx.xxx。As shown above,sh_data 1.1.2.1.6.59 60.0 express that the power value

of No 1 generator is evalued 60.0

node_t:

node_t :the order show node status of NC2000 system in the local view,as shown

in the following figure

Figure 1 - 5You can see that there is only one host in this NC2000 system,and the node status

is STANDALONE(operating independently,and there is other possible node

status,including:dead,backup,main and so on.)In the system network ,that net 0 is 1 show the net 0 is ok,and the net is 0 show there is some problem in net 1 The "used " is

0 means the main net is net 0

proc_t:shows the occupancy of the NC2000 system-mail,as shown in the followingfigure

Trang 22

Chart shows the process PID No., QID No., QMUN queue and processes name.redsw_test:

1.2.3 The Data Stream of NC2000 System

After the brief introduction to you the background program of NC2000

system,now we want to make an other brief introduction in the way of the NC2000 system data stream that how the NC2000 system operate through the coordinate of programs

Trang 23

Black arrow line - the direction of the local data stream.

Green arrow line - the direction of data stream in networks

The black connecting line - the connection line from the main process to its process

sub-The figure above show the relations among data streams of processes on the nodes

of NC2000 system.The nodes including host node,op node and LCU node.Because the node status in the system are different, it contains the different processes and has

different role.In the figure the op node request of sercice from the host server through the process of the Client,so the host server processes fork the corresponding sub-processserver to handle the requestion.NC2000 main data processing system is by the client, server process through the way of TCP / IP.In addition, the DB-database information can also be transfered by the process of mam in the way of multicast and broadcast.It should be noted that database synchronization of each network node is also by host mam process in the way of multicast

1.3 The Communication Drivers of NC2000 System

In the implementation NC2000 system project, that our technical staff mostly faced

is preparation and revision of the driver.In the following sections ,we will make a more detailed explanation in API which is interrelated to NC2000 system and communicationdrivers and the definition of C structure,and hope that can help you to parpare the relevant programs

The basic data structure NC2000 system is as same as NARIAcc , with DIN, AIN, PID and other similar functions NARIAcc block.Also add some special block with some new functions.At the time of writing drivers, they generally only use DIN, AIN, PID, PIN, AOUT, DOUT, MODULE such as function block,and these function blocks

is basically no change, same with drv_DIN, drv_AIN, drv_PIN, drv_DOUT,

drv_MODULE ansd so on

1.3.1 The Header File of NC2000 system Driver

1.File: ~ / include / newdb.h

The file focused on the definition of the AIN, DIN and other functional blocks

Trang 24

DATA_STRUCT used to access the data in the database, and used in the external communications driver.

DBS_KEY ,points Key, each point the database has a unique DBS_Key, the value identified in the database configurating

2.File: ~ / include / dbhead.h

The file focused on the definition of head information in buffer of Nc2000 system DB-database

3.File: ~ / include / libdrv.h

The file mainly defines the driver-related structure information

A)PORT_INFO: port information

Driver is used to describe the serial or network equipment information which is used in communication between driver and peripheral devices

typedef struct {

char *file; // name of the device opend by the driver

//Corresponds to serial communication, the value should be a serial device //Corresponds to the network communications, the value should be Network Address

int ID; //Unused

int fd; //device number to open file

unsigned network:1; //1: file is a network address

unsigned udp: 1; //1: The network protocol to use UDP communication (reserved)unsigned mca:1; //1: The network protocol to use Multicast communications (reserved)unsigned tcp:1; //1: The network protocol using TCP communication (default)

unsigned error:1; //Open the device error

unsigned pad:11; //Unused

unsigned port:16; //If the network == 1, port specified the port number

int pointCount; //The number of measuring points

char dest_node_name[NAME_SIZE + 1]; // Can be used to express the Network communication node

Trang 25

char filename[NAME_SIZE + 1]; //Configuration file or Remote data filesFBStruc *pFB[]; //Measuring point

} PORT_INFO;

B)LOCATE_INFO: positioning information

It is used to describe positioning information relevant to the driver

typedef struct{

short plant; //-p, Plant No

short lcu; //-l, LCU number (start from 1)

short UnitNo; //-u, driver ID No

short ICNNo; //-I, internal network number (for Modcell)short TargetIndex; //-t, driving the index number (internal use)unsigned char Address; //-a, driver Address No

char pad[3];

} LOCATE_INFO;

C)POINT_MAP:The measuring point information

typedef struct {

FBStruc **pPoint; //Measuring point

unsigned short count; //Measuring point No

unsigned char fType; //Types of measuring point

unsigned char pad1;

char tag[NAME_SIZE+1]; // tagname (ip)

unsigned char output; //0: Downlink messages, 1: uplink messagesunsigned char din; //0:remote,1:telemetering

unsigned char soe; // 1: SOE

unsigned char pin; // 1: PIN

Trang 26

unsigned char data;

unsigned char convert; // Whether or not transform coefficient by ABunsigned char func_code;

#ifdef SUN

unsigned char pad8:1;

unsigned char pad7:1;

unsigned char pad6:1;

unsigned char pad5:1;

unsigned char pad4:1;

unsigned char pad3:1;

unsigned char pad3:1;

unsigned char pad4:1;

unsigned char pad5:1;

unsigned char pad6:1;

unsigned char pad7:1;

unsigned char pad8:1;

#endif

unsigned short sno; //Top No

unsigned short boardno; //Plate No

unsigned short slotno; //Slot No

unsigned short occno; //Point No

float coeA; // A coefficient

float coeB; // B coefficient

float lowoutput;

float highoutput;

Trang 27

E) DRV_SET_MSG:DO message format

Descending order for event-driven The specific definition is descriped in the

document

F)File:~/include/libipc.H

The document mainly defines the message-related structure

information MSG_BUF is definited as same as NARIAcc

1.3.2 The common NC2000 system communication driven library function

1、 SYS_DB *map_db(): [~/txt/libncdb.c]

The function make the shared memory address map to the address space of application.When Successful return a pointer "SYS_DB", otherwise return NULL

2、 int msg_init(char *processname); [~/txt/libipc/ipclib.c]

int msg_send(MSG_BUF *msgp, int time_out, int dest_flag,

int pp_flag, int ret_flag);

int msg_recv(MSG_BUF *msgp, int timeout);

int msg_delete();

The four functions have the same definition with NARIAcc

In addition,"dest_flag" can use the following macro definition [~ / include / msg_info.h]

Trang 28

SND_DEST_LOCAL 1 // Sent to the local

SND_DEST_MAIN 2 // Sent to the remote main

SND_DEST_RED 4 // Sent to the remote backup

SND_DEST_MAIN_RED 6 // Sent to the remote main and backup

SND_DEST_PEER 8 //Sent to the contralateral parallel node

SND_DEST_LOCAL_PEER 9 //(SND_DEST_LOCAL | SND_DEST_PEER)

"pp_flag" Can use the following macro definition:

SND_PP_MAIN //Send only under the local host status

SND_PP_RED //Send only under the backup status

SND_PP_MAIN_RED (SND_PP_MAIN | SND_PP_RED) //Send under the local host

or slave State

"ret_flag" can use the following macro definition:

SND_RET_NO // Do not send the counter-information

SND_RET_YES // Send the counter-information

3、 int drvInitDrv(int argc, char *argv[], int down_config, int notAppendPid)

the length of msg_size = msg_data

msg_data = the number of modified setting value n (int)

Tagpath(char 〔24〕)

Trang 29

Type (int)

Data

Notes:

〔Type = Short, data with the short-type〕

〔Type = Field, data with type int〕

〔Type = Int, data with type int〕

〔Type = Long, data with the long-type〕

〔Type = Float, data with the float type〕

〔Type = Double, data with the double-type〕

〔Type = Tstring, the data is the char array type , length 128, fill the shortage with zero〕

Type values are defined at sysdef.h

notAppendPid: localProcName and process_name definit the return value of

parameters

4:process_name = argv[0](basename)

2:process_name = argv[0] + “_” +_LCU English name

1:process_name = argv[0] + “_” + portInfo.dest_node_name

0:process_name = argv[0] + “_” + pid

The function do the following operate:

A) Call drvGetArgumentOption (int argc, char * argv []), analysis argc, and argv command line arguments (), in this step ,fill the structure of portInfo and locationInfo.Command-line parameters are defined as follows:

-p: specify Plant No

-L: specify generate No

-U: the designated driver ID No

-I: specify ICNNo No

-M: specify ModuleNo No

-S: specify serial device name and its related parameters

-N: specify network address and port number

Trang 30

-D: specify goal node name No

-T: specify index number of driver

Above parameters all generated from drive configuration program ,except that "-t " generated from "dbload"

B) mapping shared memory address (call SYS_DB * map_db ())

C) Registration the pid of driver

D) Analysis of the port information (call int drvAnalyzePortInfo (argv [0]))

E) loaded the driver-related points information (called int drvLoadPoint ())

F) obtain the driver process_name

G)obtain the local alias, deposited in the Medium aliasName (call int

get_local_aliasname (char *))

H) initialization message queue (call int msg_init (char * localProcName))

I)obtain the information number of SIG_USR1 (called void sigset (int sig, void (* function )())) - exit_exe

J)register the driver to all measuring points (called int drvRegistDriver ())

5 int drvInitPort();[~/txt/libdrv/drvCom.c]

Port initialization: If it is a serial port connection, it will open the corresponding

equipment, and set the relevant parameters If it is a network,it will set up the related connection

Return Value: when Successful ,return equipment number

when fail,return -1

6.void drvClosePort ();[~/txt/libdrv/drvCom.c]

Turn off the port: If the port has been opened, then closed it

7.int drvWriteCommStat(int comport, int offline) ;[~/txt/libdrv/drvCom.c]

Writing communication port status

comport: corresponds to the bit0-bit in MODULE

Offline: 1: offline 0: Online

8 FBStruc *drvGetPoint(int plant, int lcu, int point , int type) ;[~/txt/libdrv/drvCom.c]Obtain the measuring point

Trang 31

plant: Plant No.

lcu: Unit No

point: Point No

type: the type of measurement points (fAIN, fDIN, fSOE, fPID etc.)

Return Value: when Successful ,return pointer which point at the corresponding to measuring point

Otherwise, return NULL

9 POINT_MAP *drvGetPointMap(int lcuNo, int ioType) ;[~/txt/libdrv/drvCom.c]Obtain the index table of the Measuring point

lcuNo: Unit No

ioType: the type of measurement points (fAIN, fTIN, fDIN, fSOE, fPID, fMODLE, fDOUT, fAOUT and so on)

Return value: when successful return the map table of the measuring point,Otherwise return NULL

Map tablesof measuring points are defined as follows (defined in libdrv.h):

Typedef struct (

FBStruc ** pPoint; //pointer array point to measuring points

unsigned short count;//The number of measuring points

unsigned char fType; //measuring point type

unsigned char pad1; / / unused

Short plant; / / Plant No

Short lcuNo; / / Unit No

) POINT_MAP;

10 .int drvSendMsg(int comID, unsigned char *msg, int len, int timeOut)

Send data to the designated equipment

ComID: device descriptor of the specified port Msg: data buffer

Len: Data length

TimeOut: time-limited If timeOut ≤ 0, it will be open

Return the length of the send data

Trang 32

11 int drvReadMsg(int comID,char *pMsg, int len, int timeOut)

Receive data from the specified device

ComID: device descriptor of specified port

PMsg: data buffer

Len: Data length

TimeOut: time-limited If timeOut ≤ 0, it will be open

Return the length of received data

12 The following functions are defined in ~ / txt / libncdb / libndrv.c

void drv_AIN (AIN *pFB, float RawData, int quality);

void drv_AIN1(AIN *pFB, float RawData, int quality, int alarm_flag);

Writing AIN database

pFB: the designated corresponding measured points

RawData: specified send value

Quality: the specified quality

Alarm _flag: warning signs

void drv_DIN (DIN * pFB, int RawData, int quality);

void drv_DIN1 (DIN * pFB, int RawData, int quality, int alarm_flag);

Writing DIN database parameters Ibid

void ain_alarm (AIN * pFB, int hour, int minute, int second, int state, float RawData)Function is same with drv_AIN, when warning, will use the specified hour,minute, second

void din_alarm(DIN *pFB, int hour, int minute, int second, int ms, int RawData)Function is same with drv_AIN, when warning, will use the specified hour, minute, second

void drv_DOUT (DOUT * pFB, int RawData)

Writing out status

PFB: point to out point

RawData: out status

Void drv_MODULE (MODULE * pFB, int RawData)

Trang 33

Writing module status

PFB: point to module

RawData: module status (0 for normal ,otherwise abnormal)

void drv_PIN (PIN * pFB, int RawData, int quality)

Writing Pulse value

int msg_alarm (char * msg, int hour, int minute, int sec);

Alarm, and log in the operation list of the entire plant

Msg: Alarm information

Hour: the specified hours

Minute: the specified minute

Sec: the specified second

If hour <= 0 will use the current system time

int msg_alarm_log(char *msg, int toPlant, int toLcu, int toTableTag, int hour,int minute, int sec);

Alarm, and log in to a specific list

msg: Alarm information

ToPlant: the specified Plant No

ToLcu: the specified generator No

toTableTag: specify list, it has the following value〔~ / include / commsg.h〕:

ALM_OPER_LOG / / operation list

ALM_DIAG_LOG / / self-diagnosis list

ALM_SOE_LOG / / accident list

ALM_FAIL_LOG / / Failure List

ALM_AIN_LOG / / list of the more complex restrictions

ALM_DIN_LOG / /state change list

ALM_AUX_LOG / / set start and stop Des table

ALM_AGC_LOG / / AGC operation table

ALM_SEQ_LOG / / flow information table

ALM_RELAY_LOG / / protection action information table

Trang 34

Hour: the specified hours

Minute: the specified minute

Sec: the specified second

If hour <= 0 will use the current system time

void Write_Log(char *msg_log_data, int alarm_table, int msgwin, int log,unsigned plant_no, unsigned lcu_no);

msg_log_data: Alarm information

alarm_table: specify list, it has the following value〔~ / include / commsg.h〕:

ALM_OPER_LOG / / operation list

ALM_DIAG_LOG / / self-diagnosis list

ALM_SOE_LOG / / accident list

ALM_FAIL_LOG / / Failure List

ALM_AIN_LOG / / list of the more complex restrictions

ALM_DIN_LOG / /state change list

ALM_AUX_LOG / / set start and stop Des table

ALM_AGC_LOG / / AGC operation table

ALM_SEQ_LOG / / flow information table

ALM_RELAY_LOG / / protection action information table

msgwin: bulletin of warning informationLog: Log in police information

Plant_no: designated Plant No

Lcu_no: designated generator No

void Self_Write_Log(char *msg_log_data, int alarm_table, int msgwin, int log, short year, short month, short day, short hour, short min,short sec, short ms, unsigned

plant_no, unsigned lcu_no)

The parameters are idem

13 Int loadExtFile (char * filename) [~ / txt / libdrv / drvExt.c]

ExtComTag * extTagInfo = NULL;

Read the dynamic configuration file

14 LoadExtPoint () [~ / txt / libdrv / drvExt.c]

Trang 35

obtain the dynamic pointer

15 Int registExtDriver (localProcName) [~ / txt / libdrv / drvExt.c]

Remote communication program registers to "rmtsoe" inoder to receive REMOTE_SOEmessage

16 Int unregistExtDriver (localProcName) [~ / txt / libdrv / drvExt.c]

Remote communication program registers to "rmtsoe" inoder to write-off the receiving

of REMOTE_SOE message

17 Void freshExtData (int idx, int * changedDICount, int * changedEICount) [~ / txt / libdrv / drvExt.c]

Refrurbish the data of dynamic points

18 Void drvExtCommitWrite (int idx) [~ / txt / libdrv / drvExt.c]

Sending the downstream data of dynamic points, the program must first purchase the signs of extTagInfo [idx]

Writting a system application program ,the dricer neede the following header files of NC2000:

newdb.h, dbhead.h, commsg.h, msg_info.h, libipc.h, libdrv.h

Therefore,in the head of program files, in addition to the necessary system header files, also need the following line:

The file "make"need to connect to the following library file

libncdb.a, libipc.a, libdrv.a

Therefore, in the file "make" ,mke sure that the variable value of PGM_LIB 1.3.3 NC2000 common format of communications driver in NC2000 System

Trang 36

extern PORT_INFO portInfo;

extern LOCATE_INFO locationInfo;

extern POINT_MAP *drvGetPointMap(int , int);

POINT_MAP *pSOE_Index, *pAIN_Index, *pPIN_Index, *pDOUT_Index,

*pMOD_Index, *pPID_Index, *pCTRL_Index;

int main(int argc, char *argv[]) {

/ * Initialize driver: the driver is scheduled to receive the value modified message of the measuring point, the driver "processname" use pid as suffix * /

if (drvInitDrv (argc, argv, 1, 0)! = 0) return -1;

/ * Initialize the measuring point index * /

InitPointIndex ();

/ * Initialize port * /

if ((portID = drvInitPort ()) <0) exit_exe (0);

Trang 37

/ * Main cycle, receive and dispose the message * /

* The following two functions tdeal with exit

* They call function "exit_exe" after receiving the signal SIG_USR1* /

Trang 38

for (i=0; i<count; i++) {

memcpy(tagpath, msg_data+offset, 24); offset += 24;

attr = rConvertTagpathToDBK(tagpath, &pdbk);

memcpy(&type, msg_data+offset, 4); offset += 4;

Trang 40

case DOUT_PULSE: //Pause dout

case DOUT_HOLD: //Hold dout

IntWrite(dsm.plant, dsm.lcu, dsm.point, fDOUT, OUTPUT, 1);

break;

case DOUT_CONTROL: //Control Command

printf("%s : Receive Control command[%s %s]\n", localProcName,

printf("%s : Cancel dout command\n", localProcName);

pDOUT = (DOUT *)drvGetPoint(dsm.plant, dsm.lcu, dsm.point, fDOUT);

if (pDOUT != NULL && pDOUT->Stat.PulseType != DOUT_CONTROL)

IntWrite(dsm.plant, dsm.lcu, dsm.point, fDOUT, OUTPUT, 0);

break;

case DN_CMD_PID_SETPOINT: // PID SETPOINT

printf("%s : PID set value [%d %f]\n", localProcName, dsm.type, dsm.fvalue);

Ngày đăng: 21/05/2015, 08:26

TỪ KHÓA LIÊN QUAN

w