示例#1
0
def voter_example(nmax=5, nmin=3):
    """
        find when a real voter M/N is equivalent to a single component.
        all real voters (i.e. 1 < M < N) having `nmin <= N < nmax` are studied.

        Parameters
        ----------
        nmax: int, optional
            the maximum value of N (excluded)

        nmin: int, optional
            the minimum value of N (included)

    """
    orders = ((M, N) for N in xrange(nmin, nmax) for M in xrange(2, N))
    l = Symbol('l', positive=True, null=False)
    t = Symbol('t', positive=True)
    x = Symbol('x')
    comp = Component('C', l)

    for order in orders:
        voter = Voter(comp, order[0], order[1])
        crossing = (voter.reliability(t) - comp.reliability(t)).nsimplify()
        roots = solve(crossing.subs(exp(-l * t), x))

        print('For M = {}, N = {}'.format(*order))
        print('− {} roots: '.format(len(roots)))
        for root in roots:
            print(' − {}'.format(root))
        print()
示例#2
0
#ARCHI 3
from fiabilipy import Voter,Component
from sympy import Symbol
from fiabilipy import System
import pylab as p
p1= Component('p1',2.28e-4,0)
m1 = Component('m1', 2.94e-4,0)
m2 = Component('m2', 2.94e-4,0)
bus = Component ('bus',1e-4,0)
voter= Voter(p1,2,3)
alim1= Component ('alim1',2.28e-4,0)
voter2=Voter(alim1,2,3)

p1_b= Component('p1_b',2.28e-4,0)
bus_b= Component('bus_b',1)
voter_b=Voter(p1_b,2,2)
m1_b = Component('m1_b', 1)
alim1_b=Component('alim_b',1)
voter2_b=Voter(alim1,2,2)

S=System()

S['E']=[voter2]
S[m1]=S[m2]='S'
S[voter2]=[voter]
S[voter]=[bus]
S[bus]=[m1,m2]


Sb=System()
示例#3
0
#ARCHI 2
from fiabilipy import Voter, Component
from sympy import Symbol
from fiabilipy import System
import pylab as p

p1 = Component('p1', 2.28e-4, 0)
voter = Voter(p1, 2, 3)
m1 = Component('m1', 2.94e-4, 0)
m2 = Component('m2', 2.94e-4, 0)
bus = Component('bus', 1e-4, 0)
alim1 = Component('alim1', 2.28e-4, 0)
alim2 = Component('alim2', 2.28e-4, 0)

p1_b = Component('p1_b', 2.28e-4, 0)
voter_b = Voter(p1_b, 2, 2)
bus_b = Component('bus_b', 1)
m1_b = Component('m1_b', 1)
alim1_b = Component('alim_b', 1)

S = System()

S['E'] = [alim1, alim2]
S[alim1] = S[alim2]
S[m1] = S[m2] = 'S'
S[alim1] = S[alim2] = [voter]
S[voter] = [bus]
S[bus] = [m1, m2]

Sb = System()
示例#4
0
#ARCHI 2
from fiabilipy import Voter,Component
from sympy import Symbol
from fiabilipy import System
import pylab as p

p1= Component('p1',2.28e-4,0)
voter= Voter(p1,2,3)
m1 = Component('m1', 2.94e-4,0)
m2 = Component('m2', 2.94e-4,0)
bus = Component ('bus',1e-4,0)
alim1= Component ('alim1',2.28e-4,0)
alim2= Component ('alim2',2.28e-4,0)

S=System()

S['E']=[alim1,alim2]
S[alim1]=S[alim2]
S[m1]=S[m2]='S'
S[alim1]=S[alim2]=[voter]
S[voter]=[bus]
S[bus]=[m1,m2]


timerange=range(0,43800,100)


availability = [S.availability(t) for t in timerange]
p.plot(timerange,availability)
p.show()
示例#5
0
    def setUp(self):
        """ Here we build some standard systems we will use as test subjects
        """
        systems = {
            'simple': System(),
            'series-parallel': System(),
            'parallel-series': System(),
            'complex': System(),
            'voter': System(),
        }

        lambdas = {
            'alim': symbols('l_alim', positive=True, null=False),
            'motor': symbols('l_motor', positive=True, null=False),
        }
        mus = {
            'alim': symbols('m_alim', positive=True, null=False),
            'motor': symbols('m_motor', positive=True, null=False),
        }

        alim = [
            Component('Alim_A', lambda_=lambdas['alim'], mu=mus['alim']),
            Component('Alim_B', lambda_=lambdas['alim'], mu=mus['alim']),
            Component('Alim_C', lambda_=lambdas['alim'], mu=mus['alim']),
        ]
        motors = [
            Component('Motor_A', lambda_=lambdas['motor'], mu=mus['motor']),
            Component('Motor_B', lambda_=lambdas['motor'], mu=mus['motor']),
        ]

        voter = Voter(alim[0], M=2, N=3)

        systems['simple']['E'] = alim[0]
        systems['simple'][alim[0]] = motors[0]
        systems['simple'][motors[0]] = 'S'

        systems['series-parallel']['E'] = [alim[0], alim[1]]
        systems['series-parallel'][alim[0]] = motors[0]
        systems['series-parallel'][alim[1]] = motors[1]
        systems['series-parallel'][motors[0]] = 'S'
        systems['series-parallel'][motors[1]] = 'S'

        systems['parallel-series']['E'] = [alim[0], alim[1]]
        systems['parallel-series'][alim[0]] = [motors[0], motors[1]]
        systems['parallel-series'][alim[1]] = [motors[0], motors[1]]
        systems['parallel-series'][motors[0]] = 'S'
        systems['parallel-series'][motors[1]] = 'S'

        systems['complex']['E'] = [alim[0], alim[1], alim[2]]
        systems['complex'][alim[0]] = motors[0]
        systems['complex'][alim[1]] = [motors[0], motors[1]]
        systems['complex'][alim[2]] = motors[1]
        systems['complex'][motors[0]] = 'S'
        systems['complex'][motors[1]] = 'S'

        systems['voter']['E'] = voter
        systems['voter'][voter] = [motors[0], motors[1]]
        systems['voter'][motors[0]] = 'S'
        systems['voter'][motors[1]] = 'S'

        self.systems = systems
        self.alim = alim
        self.motors = motors
        self.voter = voter
        self.lambdas = lambdas
        self.mus = mus
#ARCHI 3

from fiabilipy import Voter,Component
from sympy import Symbol
from fiabilipy import System
import pylab as p

p1= Component('p1',2.28e-4,0)
voter= Voter(p1,2,3)
m1 = Component('m1', 2.94e-4,0)
m2 = Component('m2', 2.94e-4,0)
bus = Component ('bus',1e-4,0)
alim1= Component ('alim1',2.28e-4,0)
voter2=Voter(alim1,2,3)

S=System()

S['E']=[voter2]
S[m1]=S[m2]='S'
S[voter2]=[voter]
S[voter]=[bus]
S[bus]=[m1,m2]


timerange=range(0,43800,100)

availability = [S.availability(t)for t in timerange]
p.plot(timerange,availability)
p.show()