38
Application of Formal Methods for Designing PLCs A Petri Net Approach Ali Pouyan Email: [email protected]

Application of Formal Methods for Designing PLCs

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Application of Formal Methods for Designing PLCs

App

licat

ion

of F

orm

al M

etho

ds

for D

esig

ning

PLC

sA

Pet

ri N

et A

ppro

ach

Ali

Pou

yan

Emai

l: ap

ouya

n@ie

ee.o

rg

Page 2: Application of Formal Methods for Designing PLCs

Pro

gram

mab

le L

ogic

Con

trolle

r -P

LC

A P

LC is

a s

peci

fical

ly d

esig

ned

digi

tal

cont

rol d

evic

e th

at a

ccep

ts in

put s

igna

ls

and

emits

out

put s

igna

ls b

ased

on

a co

ntro

l log

ic p

rogr

am.

PLC

s ar

e co

mm

only

use

d as

seq

uenc

e co

ntro

llers

in in

dust

rial a

utom

ated

sy

stem

s.

Page 3: Application of Formal Methods for Designing PLCs

Cha

ract

eris

tics

of a

PLC

It ha

s a

prog

ram

mab

le m

emor

y to

sto

re

the

inst

ruct

ions

.Th

e st

ored

inst

ruct

ions

in th

e m

emor

y ar

e us

ed to

impl

emen

t sev

eral

func

tions

su

ch a

s: lo

gic,

seq

uenc

ing,

tim

ing,

co

untin

g, a

nd a

rithm

etic

func

tions

.Th

e va

rious

func

tions

are

use

d to

con

trol

mac

hine

s or

pro

cess

es.

Page 4: Application of Formal Methods for Designing PLCs

PLC

-H

isto

ry

The

hist

ory

of P

rogr

amm

able

Log

ic

Con

trolle

rs (P

LCs)

goe

s ba

ck o

nly

as fa

r as

196

8to

the

Gen

eral

Mot

ors

Cor

pora

tion

(GM

). P

rior t

o 19

68, t

he in

dust

rial c

ontro

l fu

nctio

ns w

ere

perfo

rmed

by

cont

rol r

elay

s(C

Rs)

.

Page 5: Application of Formal Methods for Designing PLCs

CR

s D

isad

vant

ages

They

are

cap

able

onl

y of

on/

off c

ontro

l, so

the

cont

rol s

chem

e fo

r com

plic

ated

syst

ems

is

quite

exp

ensi

ve.

They

are

qui

te b

ulky

.Th

ey a

re p

ower

-hun

gry,

so

high

pow

er

cons

umpt

ion

resu

lts in

hea

t gen

erat

ion.

Whe

n a

rela

y fa

ils, t

roub

lesh

ootin

gor

loca

ting

the

faile

d re

lay

is d

iffic

ult.

They

are

har

dwire

d, s

o an

y ch

ange

in th

e co

ntro

l pro

gram

requ

ires

rela

ys to

be

rew

ired.

Page 6: Application of Formal Methods for Designing PLCs

GM

Crit

eria

for P

LCs

-196

8

Eas

ily p

rogr

amm

ed o

r rep

rogr

amm

ed

with

a m

inim

um o

f dow

ntim

e.E

asily

mai

ntai

ned.

Rug

ged

enou

gh to

ope

rate

in a

n in

dust

rial e

nviro

nmen

t.N

ot p

ower

-hun

gry.

Com

petit

ive

in c

ost.

Page 7: Application of Formal Methods for Designing PLCs

Firs

t Gen

erat

ion

PLC

s

The

maj

or c

hara

cter

istic

of t

he fi

rst

gene

ratio

n w

as th

at th

ey d

id h

ave

prim

itive

se

lf-di

agno

stic

indi

cato

rsth

at a

ided

tro

uble

shoo

ting.

As

time

prog

ress

ed, P

LCs

acqu

ired

the

capa

city

to d

o ar

ithm

etic

, man

ipul

ate

data

, an

d co

mm

unic

ate

mor

e ef

ficie

ntly

with

the

prog

ram

mer

.

Page 8: Application of Formal Methods for Designing PLCs

Toda

y’s

PLC

s

They

are

eco

nom

ical

, use

r-fri

endl

y de

vice

s th

at

have

ben

efite

d fro

m a

dvan

ces

in m

icro

proc

esso

r an

d m

emor

y te

chno

logi

es.

Toda

y’s

PLC

s ar

e ca

pabl

e of

per

form

ing

com

plic

ated

con

trol r

outin

es a

nd c

an

com

mun

icat

e w

ith o

ther

PLC

s an

d ho

st

com

pute

rs in

sop

hist

icat

ed c

ontro

l net

wor

ks.

As

time

prog

ress

ed, P

LCs

acqu

ired

the

capa

city

to

do

arith

met

ic, m

anip

ulat

e da

ta, a

nd

com

mun

icat

e m

ore

effic

ient

ly w

ith th

e pr

ogra

mm

er.

Page 9: Application of Formal Methods for Designing PLCs

Toda

y’s

PLC

s -c

ontin

ued

It is

wid

ely

belie

ved

that

one

of t

he a

reas

w

here

sys

tem

s en

gine

erin

g m

etho

dsst

ill ne

ed a

con

sist

ent d

evel

opm

enti

s th

at o

f lo

gic

cont

rolle

rs.

Spe

cific

atio

n fo

rmal

ism

and

desi

gn

crite

ria a

re s

till f

ar fr

om b

asic

ana

lytic

requ

irem

ents

, in

this

are

a.

Page 10: Application of Formal Methods for Designing PLCs

Sta

tem

ent o

f the

Pro

blem

The

prob

lem

of c

ontro

l lea

ds to

the

desi

gn

of s

eque

nce

cont

rol s

oftw

are

for

auto

mat

ed d

iscr

ete

even

t dyn

amic

sy

stem

s(D

ED

S).

Seq

uenc

e co

ntro

l is

mai

nly

asyn

chro

nous

, w

ith c

oncu

rrent

con

trolt

o m

aint

ain

sync

hron

isat

ion

and

excl

ude

conf

lictin

g m

achi

ne a

ctio

ns.

Page 11: Application of Formal Methods for Designing PLCs

Sta

tem

ent o

f the

Pro

blem

The

exis

ting

(mod

ellin

g) la

ngua

ges

are

fund

amen

tally

pro

cedu

ral l

angu

ages

and

it is

stil

l diff

icul

t to

unde

rsta

ndth

e pr

ogra

m’s

be

havi

our w

hen

prog

ram

siz

ebe

com

es

larg

e.Th

ey d

o no

t pro

vide

form

al v

erifi

catio

n fo

r th

e de

sign

ed c

ontro

l sof

twar

e.

Page 12: Application of Formal Methods for Designing PLCs

PLC

Sta

ndar

d La

ngua

ges

-IE

C

IL: I

nstru

ctio

n Li

stS

T: S

truct

ured

Tex

tFB

D: F

unct

ion

Blo

ck D

iagr

amS

FC: S

eque

ntia

l Fun

ctio

n C

hart

LLD

: Lad

der L

ogic

Dia

gram

sN

one

of th

e ab

ove

lang

uage

s ar

e de

sign

m

etho

dolo

gies

, nor

are

they

wid

ely

acce

pted

or t

este

d, e

xcep

t LLD

.

Page 13: Application of Formal Methods for Designing PLCs

LLD

s

Eve

n if

LLD

sas

sum

e a

rele

vant

im

porta

nce

in th

e in

dust

rial m

arke

t, th

ere

is n

ot y

et a

sta

ndar

d in

tegr

ated

tool

, whi

ch

is s

uffic

ient

ly s

impl

e to

use

, pow

erfu

l, ve

rsat

ile, u

nam

bigu

ous,

and

with

whi

ch it

is

pos

sibl

e to

car

ry o

ut p

roof

s on

form

al

corre

ctne

ssbe

side

sth

e cl

assi

cal

valid

atio

n th

roug

hsi

mul

atio

n.

Page 14: Application of Formal Methods for Designing PLCs

Bui

ldin

g B

lock

s of

Log

ic C

ontro

llers

Logi

cal O

RLo

gica

l And

Con

curre

ncy

Syn

chro

niza

tion

Page 15: Application of Formal Methods for Designing PLCs

Logi

cal “

OR

Page 16: Application of Formal Methods for Designing PLCs

Logi

cal “

AN

D”

Page 17: Application of Formal Methods for Designing PLCs

Com

bina

tiona

l Log

ic F

unct

ions

Page 18: Application of Formal Methods for Designing PLCs

Pro

pose

d M

etho

d

We

have

pro

pose

d a

conc

eptu

al a

nd

prac

tical

met

hodo

logy

to d

esig

n co

ntro

l so

ftwar

e sy

stem

s (L

ogic

con

trolle

rs) w

ith

Pet

ri N

etth

eory

.

Page 19: Application of Formal Methods for Designing PLCs

Pro

pose

d M

etho

d

In p

artic

ular

, the

pro

pose

d sp

ecifi

catio

n fo

rmal

ism

is b

ased

on

a sp

ecia

l cla

ss o

f P

etri

nets

, tai

lore

d to

mod

el th

e co

ntro

l flo

w in

dis

cret

e sy

stem

s.

Page 20: Application of Formal Methods for Designing PLCs

Pro

pose

d M

etho

d

The

mai

n ob

ject

ive

of th

e pr

opos

ed

met

hodo

logy

is to

redu

ce th

e de

sign

effo

rt du

e to

the

com

plex

ity o

f con

trol p

robl

ems

and

to p

rovi

de d

esig

n cr

iteria

that

fit t

he

fund

amen

tal e

ngin

eerin

g ap

proa

ch to

co

mpl

exity

: the

incr

emen

tal d

esig

n.

Page 21: Application of Formal Methods for Designing PLCs

Pro

pose

d M

etho

d

The

met

hodo

logy

is b

ased

on

conc

epts

co

min

g fro

m a

num

ber o

f pro

ven

theo

rem

s.

Page 22: Application of Formal Methods for Designing PLCs

Pet

ri N

ets:

A S

naps

hot

In 1

962

Car

l Ada

m P

etri,

a G

erm

an

mat

hem

atic

ian,

intro

duce

d P

etri

nets

as

a m

athe

mat

ical

tool

for d

escr

ibin

g re

latio

ns

betw

een

cond

ition

s an

d ev

ents

.N

ow P

etri

net t

heor

y is

an

impo

rtant

fiel

d in

theo

retic

al c

ompu

ter s

cien

ce a

s a

high

le

vel f

orm

al s

peci

ficat

ion

lang

uage

.

Page 23: Application of Formal Methods for Designing PLCs

Pet

ri N

ets:

A S

naps

hot

Pet

ri ne

ts c

an b

e sh

own

grap

hica

lly u

sing

a

3-el

emen

t set

of s

ymbo

ls:

a pl

ace:

repr

esen

ted

by c

ircle

a tra

nsiti

on: r

epre

sent

ed b

y a

bar o

r a b

oxan

arc

: rep

rese

nted

as

a di

rect

ed a

rc

conn

ectin

g ei

ther

a p

lace

to a

tran

sitio

n or

a

trans

ition

to a

pla

ce

Page 24: Application of Formal Methods for Designing PLCs

Pet

ri N

ets:

A S

naps

hot

A P

etri

net s

truct

ure,

N, i

s de

fined

as

a fo

ur-

tupl

e, N

= (

P, T

, V, F

)whe

reP

∪P

= {

p1,p

2,...

, pn

} is

a fin

ite s

et o

f pla

ces,

n ≥

0,T

= { t

1,t2

,...,

tm }

is a

fini

te s

et o

f tra

nsiti

ons,

m ≥

0, (T

∪P

form

the

node

s of

N),

V ⊆

{ (P×T

)∪(T×P

)} is

a s

et o

f dire

cted

arc

s

(or a

flow

rela

tion)

, and

F : V

→ℵ

is a

mul

tiplic

ity fu

nctio

n,

ℵ=

{0,1

,2,…

}, P

∩T=

∅an

d T≠

∅.

Page 25: Application of Formal Methods for Designing PLCs

Bui

ldin

g B

lock

s of

the

Seq

uenc

e C

ontro

l

Page 26: Application of Formal Methods for Designing PLCs

Bui

ldin

g B

lock

s of

the

Seq

uenc

e C

ontro

l

Page 27: Application of Formal Methods for Designing PLCs

LLD

of a

Log

ic E

quat

ion

Y =

((X

0+X

1+X

2).(X

4.X5)

) + X

3

( Y

)

X0

X1

X2

X3

X4

X5

(b

)

Page 28: Application of Formal Methods for Designing PLCs

Pet

ri N

et M

odel

of a

Log

ic E

quat

ion

Page 29: Application of Formal Methods for Designing PLCs

Dis

adva

ntag

es

LLD

-bas

ed c

ontro

llers

bec

ome

cum

bers

ome

both

to d

esig

n an

d de

bug

whe

n ap

plie

d to

co

mpl

ex s

eque

ntia

l tas

ks in

dis

cret

e-ev

ent

man

ufac

turin

g sy

stem

s.

Whe

n a

prob

lem

is d

etec

ted

in th

e sy

stem

, ca

use-

traci

ng a

nd lo

catin

g be

com

es e

xtre

mel

y di

fficu

lt.

LLD

s do

n’t p

rovi

de a

ny to

ols

for a

naly

sis

and

perfo

rman

ce c

hara

cter

istic

s of

the

syst

em o

ther

th

an b

asic

sim

ulat

ion

for v

erifi

catio

n of

pro

gram

s.

Page 30: Application of Formal Methods for Designing PLCs

Dis

adva

ntag

es

In th

e co

ntex

t of a

gile

man

ufac

turin

g sy

stem

s, in

whi

ch c

ontro

l seq

uenc

es n

eed

to b

e re

gula

rly m

odifi

ed, t

o m

eet t

he

dyna

mic

ally

cha

ngin

g re

quire

men

ts o

f the

ou

ter e

nviro

nmen

t, LL

D-b

ased

seq

uenc

e co

ntro

llers

are

not

read

ily a

dapt

able

to th

e ch

ange

s ne

eded

to fu

lfil t

he s

yste

m

spec

ifica

tion

chan

ge.

Page 31: Application of Formal Methods for Designing PLCs

Pet

ri N

et M

odel

vs.

LLD

Mod

el

Bot

h th

eore

tical

ly a

nd p

ract

ical

ly, a

form

al

(PN

) mod

el o

f a c

ircui

t tha

t can

be

anal

ysed

and

ver

ified

is a

lway

s pr

efer

red

to a

LLD

sta

tic g

raph

.Th

e dy

nam

ics

of a

sys

tem

can

be

stud

ied

thro

ugh

the

trans

ition

firin

gs a

nd

dist

ribut

ion

of to

kens

in a

PN

mod

el.

Page 32: Application of Formal Methods for Designing PLCs

Cha

ract

eriti

csof

the

Pro

pose

d A

ppro

ach

Ther

e is

no

need

to c

onst

ruct

sep

arat

e m

odel

s (m

odul

es) o

f diff

eren

t con

trol

ta

sks

and

mer

ge th

em to

bui

ld u

p an

ex

pand

ed s

yste

m. T

he s

yste

m is

ex

pand

ed b

y kn

ittin

g th

e co

ntro

l tas

ks

to th

e ba

sic

proc

ess

in a

str

uctu

ral

rule

-bas

ed in

crem

enta

l fas

hion

whi

lepr

eser

ving

the

desi

red

prop

ertie

s.

Page 33: Application of Formal Methods for Designing PLCs

Cha

ract

eris

tics

of th

e P

ropo

sed

App

roac

h

The

logi

c co

ntro

ller c

an b

e de

sign

ed a

t an

y le

velo

f abs

trac

tion.

Fur

ther

mor

e, a

de

taile

d ex

pand

ed s

yste

m c

an b

e re

duce

dto

a s

yste

m w

ith h

ighe

r lev

el

of a

bstr

actio

nac

cord

ing

to c

erta

in

rule

s.

Page 34: Application of Formal Methods for Designing PLCs

Cha

ract

eris

tics

of th

e P

ropo

sed

App

roac

h

It is

a ru

le-b

ased

app

roac

h w

hich

can

be

impl

emen

ted

(cas

t to

code

) as

a C

AD

tool

for l

ogic

con

trol

ler d

esig

n

Page 35: Application of Formal Methods for Designing PLCs

Exa

mpl

e

Con

side

r a m

anuf

actu

ring

cell

cons

istin

g of

a re

volv

ing

benc

h w

ith th

ree

wor

ksta

tions

: loa

ding

, dril

ling,

and

qua

lity

cont

rol a

nd u

nloa

ding

. The

revo

lvin

g be

nch

is ro

tate

d to

put

the

piec

es u

nder

co

rrect

mac

hine

s. T

hree

pro

cess

es c

an

prog

ress

con

curre

ntly

, ie.

, loa

ding

, dril

ling,

an

d qu

ality

con

trol.

Page 36: Application of Formal Methods for Designing PLCs

Exa

mpl

e -1

o p1t1

t3p4

t4p5

t5p6

p2t2

p3t6

p7t7

Basic

task

(pro

cess

)-drill

ing

The

drilli

ng ta

sk m

odel

led

by a

Pet

ri N

et

Page 37: Application of Formal Methods for Designing PLCs

Exa

mpl

e -2

o p1t1

t3p4

t4p5

t5p6

p2t2

p3t6

p7t7

p8t8

p9t9

p10

Inte

grat

ing

the

load

ing

task

to th

e sy

stem

Page 38: Application of Formal Methods for Designing PLCs

Exa

mpl

e -3

o p1

t1t3

p4

t4p

5t5

p6

p2

t2p

3t6

p7

t7

p8

t8p

9t9

p1

0

p1

1

t10

p1

2

t11

p1

3

t12

p1

4

t13

p1

5

t14

p1

6t1

5p

17

t16

ext

ern

al

en

ab

ling

si

gn

al

The

final

mod

el a

fter i

nteg

ratin

g qu

ality

con

trol t

ask