예제 #1
0
파일: nets.py 프로젝트: jssosa10/GSIPN
def create1oo2(params):
    net = pn.GSIPN()
    net = createChannel(1, net, params)
    net = createChannel(2, net, params)
    net.add_place('A', 1)
    net.add_place('U', 0)
    net.add_place('NCCF', 1)
    net.add_place('CCF', 0)
    net.add_transition('t1',
                       t_class='exp',
                       rate=params['lambda_de'],
                       predicate='not (c1 or c2)')
    net.add_transition('t2',
                       t_class='exp',
                       rate=params['mu_de'],
                       predicate='c1 or c2')
    net.add_transition('t3',
                       t_class='exp',
                       rate=params['lambda_dd'] * params['beta'],
                       predicate='(c1 and c2)',
                       assertion='ccf = True')
    net.add_transition('t4',
                       predicate='ccf1 and ccf2',
                       assertion='ccf1=False\nccf2=False\nccf=False')
    net.add_inArc('A', 't1')
    net.add_outArc('U', 't1')
    net.add_inArc('U', 't2')
    net.add_outArc('A', 't2')
    net.add_inArc('NCCF', 't3')
    net.add_outArc('CCF', 't3')
    net.add_inArc('CCF', 't4')
    net.add_outArc('NCCF', 't4')
    net.add_varible('r', 2)
    net.add_varible('ccf', False)
    return net
예제 #2
0
파일: nets.py 프로젝트: jssosa10/GSIPN
def create1oo1(params):
    net = pn.GSIPN()
    net.add_place('w', 1)
    net.add_place('d', 0)
    net.add_place('r', 0)
    net.add_place('u', 0)
    net.add_place('ru', 0)
    net.add_place('A', 1)
    net.add_place('U', 0)
    net.add_transition('t0',
                       t_class='exp',
                       rate=params['lambda_dd'],
                       assertion='c = not c')
    net.add_transition('t1', predicate='r>0', assertion='r-=1')
    net.add_transition('t2',
                       t_class='exp',
                       rate=params['mu_dd'],
                       assertion='r+=1\nc = not c')
    net.add_transition('t3',
                       t_class='exp',
                       rate=params['lambda_du'],
                       assertion='c = not c')
    net.add_transition('t4', predicate='r>0', assertion='r-=1')
    net.add_transition('t5',
                       t_class='exp',
                       rate=params['mu_du'],
                       assertion='r+=1\nc = not c')
    net.add_transition('t6',
                       t_class='exp',
                       rate=params['lambda_de'],
                       predicate='not c')
    net.add_transition('t7',
                       t_class='exp',
                       rate=params['mu_de'],
                       predicate='c')
    net.add_inArc('w', 't0')
    net.add_outArc('d', 't0')
    net.add_inArc('d', 't1')
    net.add_outArc('r', 't1')
    net.add_inArc('r', 't2')
    net.add_outArc('w', 't2')
    net.add_inArc('w', 't3')
    net.add_outArc('u', 't3')
    net.add_inArc('u', 't4')
    net.add_outArc('ru', 't4')
    net.add_inArc('ru', 't5')
    net.add_outArc('w', 't5')
    net.add_inArc('A', 't6')
    net.add_outArc('U', 't6')
    net.add_inArc('U', 't7')
    net.add_outArc('A', 't7')
    net.add_varible('c', True)
    net.add_varible('r', 1)
    return net
예제 #3
0
파일: nets.py 프로젝트: jssosa10/GSIPN
def create242(params):
    net = pn.GSIPN()
    net = createChannel(1, net, params)
    net = createChannel(2, net, params)
    net = createChannel(3, net, params)
    net = createChannel(4, net, params)
    net = createChannel(5, net, params)
    net = createChannel(6, net, params)
    func_predicate = '(((c1 or c2 or c3) and c4) or c5 or c6)'
    neg_func_predicate = 'not (((c1 or c2 or c3) and c4) or c5 or c6)'
    ccf_predicate = 'c1 and c2 and c3 and c4 and c5 and c6'
    ccf_assertion = 'ccf1=False\nccf2=False\nccf3=False\nccf4=False\nccf5=False\nccf6=False'
    net.add_place('A', 1)
    net.add_place('U', 0)
    net.add_place('NCCF', 1)
    net.add_place('CCF', 0)
    net.add_transition('t1',
                       t_class='exp',
                       rate=params['lambda_de'],
                       predicate=neg_func_predicate)
    net.add_transition('t2',
                       t_class='exp',
                       rate=params['mu_de'],
                       predicate=func_predicate)
    net.add_transition('t3',
                       t_class='exp',
                       rate=params['lambda_dd'] * params['beta'],
                       predicate=ccf_predicate,
                       assertion='ccf = True')
    net.add_transition('t4', predicate=ccf_predicate, assertion=ccf_assertion)
    net.add_inArc('A', 't1')
    net.add_outArc('U', 't1')
    net.add_inArc('U', 't2')
    net.add_outArc('A', 't2')
    net.add_inArc('NCCF', 't3')
    net.add_outArc('CCF', 't3')
    net.add_inArc('CCF', 't4')
    net.add_outArc('NCCF', 't4')
    net.add_varible('r', 8)
    net.add_varible('ccf', False)
    return net
예제 #4
0
파일: example.py 프로젝트: jssosa10/GSIPN
import gsipn as pn
import numpy as np
net = pn.GSIPN()
net.add_place('w',1)
net.add_place('d',0)
net.add_place('r',0)
net.add_place('A',1)
net.add_place('U',0)
net.add_transition('t0',t_class='exp',rate=0.0000022,assertion='c = not c')
net.add_transition('t1',predicate='r>0',assertion='r-=1')
net.add_transition('t2',t_class='exp',rate=0.0001,assertion='r+=1\nc = not c')
net.add_transition('t3',t_class='exp',rate=0.000001, predicate = 'not c')
net.add_transition('t4',t_class='exp',rate=0.0001,predicate = 'c')
net.add_inArc('w','t0')
net.add_outArc('d','t0')
net.add_inArc('d','t1')
net.add_outArc('r','t1')
net.add_inArc('r','t2')
net.add_outArc('w','t2')
net.add_inArc('A','t3')
net.add_outArc('U','t3')
net.add_inArc('U','t4')
net.add_outArc('A','t4')
net.add_varible('c',True)
net.add_varible('r',1)
res = []
for x in range(1000):
	marks = net.simulate(1000)
	z = 0
	for mark in marks:
		z+= mark['U']*1.0/len(marks)