Exemplo n.º 1
0
    def __init__(self):
        ''' Constructor.
		'''
        DomainBehavior.__init__(self)

        self.state = {'status': 'IDLE', 'sigma': INFINITY}
        self.proc = 0
        self.x = {}
        self.y = {}
        self.pos = [-1] * 100
        ''' The object '''
        self.lump = Lamp()
        # The states
        self.states = [
            State(name='on', on_enter=['say_im_turned_on']),
            State(name='off', on_enter=['say_im_turned_off'])
        ]

        self.transitions = [{
            'trigger': 'illuminate',
            'source': 'off',
            'dest': 'on'
        }, {
            'trigger': 'darken',
            'source': 'on',
            'dest': 'off'
        }]

        # Initialize
        self.machine = Machine(self.lump,
                               states=self.states,
                               transitions=self.transitions,
                               initial='off')
Exemplo n.º 2
0
	def __init__(self, t0=.0, tr=.001, u=.5, m="QSS2", dq=.01):
		"""	Constructor.

			@param t0 :	initial time
			@param tr :	rise time
			@param u :	final value
			@param m :	QSS methode choise
			@param dq :	quantification level
		"""

		DomainBehavior.__init__(self)

		# State varaibles
		self.state = {	'status': 'ACTIVE', 'sigma': 0}

		# Local copy
		self.t0=t0		# initial time
		self.tr=tr		# rise time
		self.u=u		# final value
		self.m=m	# QSS methode choise
		self.dq=dq		# quantification level

		self.T = [0, self.t0, self.t0+self.tr, INFINITY]
		self.v = [0, 0, self.u, self.u]
		self.mv = [0]

		if (self.tr>0):
			self.mv.append(self.u/self.tr)
		self.mv.append(0)
		self.j = 0
    def __init__(self, m=("QSS3", "QSS2", "QSS1"), dQ=0.01, x=0.0):
        """	Constructor.

			@param m : QSS methode choise
			@param dQ : quantification level
			@param x : initial value
		"""

        DomainBehavior.__init__(self)

        # State variables
        self.state = {"status": "IDLE", "sigma": 0.0}

        # local copy
        self.m = m[0]
        self.dQ = dQ
        self.x = x

        self.u = 0.0
        self.mu = 0.0
        self.mq = 0.0
        self.pq = 0.0
        self.pu = 0.0
        self.q = self.x

        # output message
        self.msg = None
Exemplo n.º 4
0
	def __init__(self, K = [1,1]):
		"""	Constructor.

			@param K : list of weight
		"""

		DomainBehavior.__init__(self)

		# State variables
		self.state = {'status': 'IDLE', 'sigma': INFINITY}

		# Local copy
		self.K=map(float,map(eval,map(str,K)))			# matrix y=K[0]*x0+...+K[7]*x7 (QSS1 to3)

		n = len(self.K)
		try:
			from numpy import zeros

			self.Xs = zeros(n)
			self.Mxs = zeros(n)
			self.Pxs = zeros(n)

		except ImportError:

			self.Xs = [0.0]*n
			self.Mxs = [0.0]*n
			self.Pxs = [0.0]*n

		self.Y=[0.0]*3
Exemplo n.º 5
0
	def __init__(self):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		self.state = {	'status': 'IDLE', 'sigma':INFINITY}
		self.proc = 0
		self.x = {}
		self.y = {}
		self.pos = [-1]*100
		''' The object '''
		self.lump = Lamp()
		# The states
		self.states = [
    		State(name='on', on_enter=['say_im_turned_on']),
    		State(name='off', on_enter=['say_im_turned_off'])
			]

		self.transitions = [
			{'trigger': 'illuminate', 'source': 'off', 'dest': 'on'},
			{'trigger': 'darken', 'source': 'on', 'dest': 'off'}
		]
		
		# Initialize
		self.machine = Machine(self.lump, states=self.states, transitions=self.transitions, initial='off')
Exemplo n.º 6
0
    def __init__(self,
                 fileName=os.path.join(os.getcwd(),
                                       "result%d" % random.randint(1, 100)),
                 ext='.dat',
                 comma=""):
        """ Constructor.
		
			@param fileName : name of output fileName
			@param ext : output file extension
			@param comma : comma separated
		"""
        DomainBehavior.__init__(self)

        # local copy
        self.fileName = fileName
        self.ext = ext
        self.comma = comma

        #  State variable
        self.state = {'status': 'IDLE', 'sigma': INFINITY}

        for np in range(10000):
            fn = "%s%d%s" % (self.fileName, np, self.ext)
            if os.path.exists(fn):
                os.remove(fn)
Exemplo n.º 7
0
    def __init__(self,
                 fn='test',
                 token='',
                 key='',
                 username='',
                 plotUrl='',
                 sharing=['public', 'private', 'secret'],
                 fileopt=['new', 'overwrite', 'extend', 'append']):
        ''' Constructor.

			fn (string) -- the name that will be associated with this figure
			fileopt ('new' | 'overwrite' | 'extend' | 'append') -- 'new' creates a
				'new': create a new, unique url for this plot
				'overwrite': overwrite the file associated with `filename` with this
				'extend': add additional numbers (data) to existing traces
				'append': add additional traces to existing data lists
			world_readable (default=True) -- make this figure private/public
			auto_open (default=True) -- Toggle browser options
				True: open this plot in a new browser tab
				False: do not open plot in the browser, but do return the unique url
			sharing ('public' | 'private' | 'sharing') -- Toggle who can view this graph
				- 'public': Anyone can view this graph. It will appear in your profile 
					and can appear in search engines. You do not need to be 
					logged in to Plotly to view this chart.
				- 'private': Only you can view this plot. It will not appear in the
					Plotly feed, your profile, or search engines. You must be
					logged in to Plotly to view this graph. You can privately
					share this graph with other Plotly users in your online
					Plotly account and they will need to be logged in to
					view this plot.
				- 'secret': Anyone with this secret link can view this chart. It will
					not appear in the Plotly feed, your profile, or search
					engines. If it is embedded inside a webpage or an IPython
					notebook, anybody who is viewing that page will be able to
					view the graph. You do not need to be logged in to view
					this plot.
		'''
        DomainBehavior.__init__(self)

        if token != '' and key != '' and username != '':
            py.sign_in(username, key)
            trace1 = Scatter(x=[], y=[], stream=dict(token=token))
            data = Data([trace1])
            self.plotUrl = py.plot(data,
                                   filename=fn,
                                   auto_open=False,
                                   sharing=sharing[0],
                                   fileopt=fileopt[0])
            #print(self.plotUrl)
            self.s = py.Stream(token)
            self.s.open()
            # patch TIC
            self.sTime = time.time()
            self.sNbData = 0
            self.x = []
            self.y = []
        else:
            self.s = None

        self.state = {'status': 'IDLE', 'sigma': INFINITY}
Exemplo n.º 8
0
    def __init__(self, sourceName="", listValues=[]):
        """ Constructor.

			@sourceName : name of source
			@listValues : list of values
		"""
        DomainBehavior.__init__(self)

        ### local copy
        self.sourceName = sourceName
        self.__listValues = listValues

        self.T = []
        self.V = {}

        ### flags
        self.type_error_flag = True in [
            not isinstance(a, int) for a in self.__listValues
        ]
        self.file_error_flag = os.path.exists(self.sourceName)
        self.list_empty_flag = listValues == []

        ### assert
        if self.type_error_flag:
            assert True, "Please use integer in listValue parameter !"
Exemplo n.º 9
0
	def __init__(self, arrivalMeanTime = 2.0, serviceMeanTime = 1.0):
		''' Constructor.
		'''
		DomainBehavior.__init__(self) 

		self.initPhase('IDLE',0)

		self.arrivalMeanTime = arrivalMeanTime
		self.serviceMeanTime = serviceMeanTime
		self.queueLength     = 0
		self.msg             = Message(None, None)

		print('Arrival Mean Time = ' + str(self.arrivalMeanTime))
		print('Service Mean Time = ' + str(self.serviceMeanTime))

		# Mean values
		self.nbTransitions   = 0
		self.nbIncrease      = 0
		self.queueLengthSum  = 0
		self.tauIncreaseSum  = 0
		self.tauDecreaseSum  = 0

		# Affichage loi de tau Increase 
		self.repTauInc       = []
		for i in range(int(TAU_MAX/TAU_RES)) :
			self.repTauInc.append(0);
Exemplo n.º 10
0
    def __init__(self):
        ''' Constructor.
        '''
        DomainBehavior.__init__(self)

        self.state = {'status': 'IDLE', 'sigma': INFINITY}
        self.proc = 0
        self.x = {}
        self.y = {}
        self.pos = [-1] * 100

        ''' The object '''
        self.objectName = ClassName()
        # The states go below
        self.states = [
			State(name='off'),
			State(name='on')
		]

        # The transition go below
        self.transitions = [
			{'trigger': 'turnOn', 'source': 'off', 'dest': 'on'},
			{'trigger': 'turnOff', 'source': 'on', 'dest': 'off'}
		]

        # Initialize below
        machine = Machine(self.objectName, states=self.states, transitions=self.transitions, initial='off')
Exemplo n.º 11
0
	def __init__(self, 	bias = 1.0,
						N = 0.9,
						M = 0.1,
						activation_f = ("tanh","sigmoid"),
						k = 1.0,
						a = -0.2,
						b = 0.2,
						fileName = os.path.join(os.getcwd(),"weights_%d"%randint(1,100)),
						learning_flag = True):
		""" constructor.
			@param bias 				= the bias value of hidden layer.
			@param activation_function 	= the type of the activation function.
			@param k					= param. for sigmoide activation function only.
			@param a					= weight initialization range [a,b]
			@param b					= weight initialization range [a,b]
			@param fileName 			= weights file
			@param learning_flag		= model status \n if true model write its weights at the end of simulation into a file then it read weights file
		"""
		DomainBehavior.__init__(self)
		self.state = {'status':'Idle','sigma':INFINITY}
		#self.simData = SingeltonData()
		#self.simData.Set({})
		
		self.dataInit = {'N':N,'M':M,'bias':bias,'activation':activation_f[0]}
		self.k = k
		self.a = a
		self.b = b
		self.msgListOut = []
		self.msgListIn = {}
		self.sim = None
		self.fileName = fileName
		self.learning_flag = learning_flag
		self.layerId = self.myID
		
		seed(0)
	def __init__(self, tol=0.0001, y0=1.0, n=1):
		'''	Constructeur
		'''
		DomainBehavior.__init__(self)

		#  Declaration des variables d'état.
		self.state = {	'status': 'IDLE', 'sigma': INFINITY}
						
		self.Y = [0.0]*3
		
		#local copy
		self.n=n
		self.tol=tol
		self.y0=y0
		
		#self.mn	= 0
		self.u	= [0.0]*self.n 
		self.mu	= [0.0]*self.n 
		self.pu	= [00.]*self.n 
		
		#self.expr=str(pow(self.Y[0],3)+self.Y[0]+pow(self.u[0],2))
		
		self.nm=0.0

		#self.expr=compile(self.expr,"","eval")
		
		# message d'arriv� qui va �tre modifier pour etre renvoye
		self.msg = None
		self.p = 0
Exemplo n.º 13
0
	def __init__(self, spaceSize = 10):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		self.spaceSize = spaceSize
		self.msg = Message(None, None)
		self.interceptLocation = (self.spaceSize*uniform(0,1), self.spaceSize*uniform(0,1))
		self.initPhase('Update', 1.0)
Exemplo n.º 14
0
	def __init__(self, filename="image.jpg"):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		### local copy
		self.fn = filename

		self.state = {	'status': 'IDLE', 'sigma':0}
Exemplo n.º 15
0
	def __init__(self):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)
		self.interactionQueue = None
		self.destinationToPort = {}
		self.msg = Message(None, None)
		self.initPhase('IDLE',0)
		self.count = 0
Exemplo n.º 16
0
    def __init__(self, minValue=0, maxValue=10, minStep=1, maxStep=1):

        DomainBehavior.__init__(self)

        self.state = {'sigma': 0}
        self.minValue = minValue
        self.maxValue = maxValue
        self.minStep = minStep
        self.maxStep = maxStep
        self.msg = Message(None, None)
Exemplo n.º 17
0
	def __init__(self):
		""" constructor.
		"""

		DomainBehavior.__init__(self)
		self.state = {	'status': 'Idel', 'sigma':INFINITY}
		self.layerId = None
		self.outError = {}
		self.sim = None
		self.msgListOut = [Message([None,None,None],0.0),Message([None,None,None],0.0)]
Exemplo n.º 18
0
	def __init__(self, fn='test', token='', key='', username='', plotUrl='',
				sharing=['public', 'private', 'secret'],
				fileopt = ['new', 'overwrite', 'extend', 'append']):
		''' Constructor.

			fn (string) -- the name that will be associated with this figure
			fileopt ('new' | 'overwrite' | 'extend' | 'append') -- 'new' creates a
				'new': create a new, unique url for this plot
				'overwrite': overwrite the file associated with `filename` with this
				'extend': add additional numbers (data) to existing traces
				'append': add additional traces to existing data lists
			world_readable (default=True) -- make this figure private/public
			auto_open (default=True) -- Toggle browser options
				True: open this plot in a new browser tab
				False: do not open plot in the browser, but do return the unique url
			sharing ('public' | 'private' | 'sharing') -- Toggle who can view this graph
				- 'public': Anyone can view this graph. It will appear in your profile 
					and can appear in search engines. You do not need to be 
					logged in to Plotly to view this chart.
				- 'private': Only you can view this plot. It will not appear in the
					Plotly feed, your profile, or search engines. You must be
					logged in to Plotly to view this graph. You can privately
					share this graph with other Plotly users in your online
					Plotly account and they will need to be logged in to
					view this plot.
				- 'secret': Anyone with this secret link can view this chart. It will
					not appear in the Plotly feed, your profile, or search
					engines. If it is embedded inside a webpage or an IPython
					notebook, anybody who is viewing that page will be able to
					view the graph. You do not need to be logged in to view
					this plot.
		'''
		DomainBehavior.__init__(self)
		
		if token != '' and key != '' and username != '':
			py.sign_in(username, key)
			trace1 = Scatter(
				x=[],
				y=[],
				stream=dict(token=token)
			)
			data = Data([trace1])
			self.plotUrl = py.plot(data, filename=fn, auto_open=False, sharing=sharing[0], fileopt=fileopt[0])
			#print(self.plotUrl)
			self.s = py.Stream(token)
			self.s.open()
			# patch TIC
			self.sTime = time.time()
			self.sNbData = 0
			self.x = []
			self.y = []
		else:
			self.s = None

		self.state = {	'status': 'IDLE', 'sigma':INFINITY}
Exemplo n.º 19
0
    def __init__(self, a=0, tm=1):
        """	Constructor.

			 @param a : Amplitude
			 @param tm : Modulating sinusoidal period
		"""

        DomainBehavior.__init__(self)

        # State variables
        self.state = {"status": "ACTIVE", "sigma": 0}

        # Local copy
        self.a = a
        self.tm = tm

        self.dt = [
            0.52576249002189,
            0.42770710237896,
            0.62266988694768,
            0.33235474394723,
            0.71465110292802,
            0.24345384677928,
            0.79816713494423,
            0.16448202528866,
            0.87006137717856,
            0.09849927665395,
            0.92767110593532,
            0.04803154181473,
            0.96890546649863,
            0.01498703066906,
            0.99229400455701,
            0.00060227626444,
            0.99701303051085,
            0.00541209560964,
            0.98289729495148,
            0.02923790417889,
            0.95044204882374,
            0.07119152689703,
            0.90079658391823,
            0.12969549084197,
            0.83574604807234,
            0.20252423831807,
            0.75767499017353,
            0.2868723108525,
            0.66950488056329,
            0.37945431748385,
            0.57459956378267,
            0.47663726221426,
        ]
        self.dt += [self.dt[31 - i] for i in range(0, 32)]
        self.dt = map(lambda x: 1.0 * x * self.tm / 32.0, self.dt)
        self.sig = 1
        self.j = -1
Exemplo n.º 20
0
    def __init__(self, maxX=8, maxY=8, forbidden=['c18','c19','c20','c28','c36','c44','c52','c51','c50'], goal='c34'):
        ''' Constructor.
        '''
        DomainBehavior.__init__(self)

        # Grid 4x3 :
        #     0    1    2    3
        #   ---------------------
        # 0 |    |    |    | +1 |
        #   ---------------------
        # 1 |    |xxxx|    | -1 |
        #   ---------------------
        # 2 |    |    |    |    |
        #   ---------------------


        # Cell (0,3) gives reward +1
        # Cell (1,3) gives reward -1
        # Cell (1,1) cannot be entered

        # Actions : Go North/South/West/East
        # Action result : 80% OK, 20% on orthogonal sides
        # eg : Go North results in : 80% North, 10%East, 10%West
        # If the move is not possible, then the agent remains on the same cell

        self.maxX = maxX;
        self.maxY = maxY;

        # Forbidden cells
        self.cellIsForbidden = []
        for x in range(self.maxX):
            self.cellIsForbidden.append([])
            for y in range(self.maxY):
                self.cellIsForbidden[x].append(False)
        for c in forbidden :
            pos = self.stateToPosition(c)
            self.cellIsForbidden[pos[0]][pos[1]] = True

        # Visits Counter
        self.counter = []
        for x in range(self.maxX):
            self.counter.append([])
            for y in range(self.maxY):
                self.counter[x].append({'visit' : 0, 'start' : 0})

        # Terminal cells
        self.goal = goal

        # State
        self.currentPosition = None

        self.msgToAgent      = Message (None, None)

        self.initPhase('IDLE', INFINITY)
 def __init__(self, minValue=0, maxValue=10, stepDuration=1):
     """ Constructor.
         @param minValue : minimum value
         @param maxValue : maximum value
         @param stepDuration : delay between 2 outputs in seconds
     """
     DomainBehavior.__init__(self)
     self.state = {'sigma':0}
     self.minValue = minValue
     self.maxValue = maxValue
     self.stepDuration = stepDuration
     self.msg = Message(None, None)
Exemplo n.º 22
0
	def __init__(self, v=1.0):
		"""	Constructor.

			@param v : constant value
		"""
		DomainBehavior.__init__(self)

		# State variables
		self.state = {'status':'ACTIVE', 'sigma':0}

		# Local copy
		self.v = v
Exemplo n.º 23
0
	def __init__(self,minValue=0,maxValue=10,minStep=1,maxStep=1):

                DomainBehavior.__init__(self)

		self.state = {
				'sigma':0
                             }
                self.minValue = minValue
                self.maxValue = maxValue
                self.minStep = minStep
                self.maxStep = maxStep
                self.msg = Message(None,None)
Exemplo n.º 24
0
	def __init__(self, expectUpdateTime=2):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		### local copy
		self.expectUpdateTime = expectUpdateTime

		### init the phase
		self.initPhase('GetUpdate', self.expectUpdateTime)
		self.sensorId = 'SensorUnknown'   
		self.missileId= 'MissileUnknown'
		self.missileStatus=None
Exemplo n.º 25
0
	def __init__(self, travelCount=10, killZone=2.0, spaceSize = 10):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		### local copy
		self.travelcount = travelCount
		self.killZone = killZone
		self.spaceSize = spaceSize

		self.count = 0
		self.loc = (self.spaceSize*uniform(0,1),self.spaceSize*uniform(0,1))
		self.initPhase('Update', 1.0)
Exemplo n.º 26
0
	def __init__(self):
		"""Constructor
		"""
		
		DomainBehavior.__init__(self)
		
		
		self.state = {'status':'Idle', 'sigma': INFINITY}
		#self.dt = INFINITY
		self.current_tpattern = 0
		self.current_vpattern = 0
		self.t_pattern = []
		self.v_pattern = []
Exemplo n.º 27
0
	def __init__(self, filename="file.py", wait=True):
		''' Constructor.

			@param filename : path of the python file to execute.
			@param wait : if true, wait until process is over
		'''
		DomainBehavior.__init__(self)

		### local coyp
		self.process_file = filename
		self.wait = wait

		self.msg = [None]*len(self.IPorts)

		self.state = {	'status': 'IDLE', 'sigma':INFINITY}
Exemplo n.º 28
0
	def __init__(self, k=1.0):
		""" Constructor.

			@param k : gain
		"""
		DomainBehavior.__init__(self)

		# state variable
		self.state = {	'status':	'IDLE', 'sigma': INFINITY}

		# Local copy
		self.k = k	# Gain y=k*x (QSS1/3)
		
		### output message
		self.msg = None
Exemplo n.º 29
0
	def __init__(self, delay=1.0):
		""" Constructor.

			@param delay : Sending delay
		"""
		DomainBehavior.__init__(self)

		# state variable
		self.state = {	'status':	'IDLE', 'sigma': INFINITY}

		# Local copy
		self.s = delay	# step
		
		### output message
		self.msg = None
Exemplo n.º 30
0
    def __init__(self, minValue=0, maxValue=10, minStep=1, maxStep=1):
        """ Constructor.

            @param minValue : minimum value
            @param maxValue : maximum value
            @param minStep : minimum step
            @maram maxStep : maximum step
        """
        DomainBehavior.__init__(self)

        self.state = {'sigma':0}
        self.minValue = minValue
        self.maxValue = maxValue
        self.minStep = minStep
        self.maxStep = maxStep
        self.msg = Message(None, None)
Exemplo n.º 31
0
    def __init__(self, minValue=0, maxValue=10, minStep=1, maxStep=1):
        """ Constructor.

            @param minValue : minimum value
            @param maxValue : maximum value
            @param minStep : minimum step
            @maram maxStep : maximum step
        """
        DomainBehavior.__init__(self)

        self.state = {"sigma": 0}
        self.minValue = minValue
        self.maxValue = maxValue
        self.minStep = minStep
        self.maxStep = maxStep
        self.msg = Message(None, None)
Exemplo n.º 32
0
	def __init__(self, nbMissile = 10, nbInterceptor=10, nbSensor=10, missileTravelCount=10, missileKillZone=2.0, missileSpaceSize=10, sensorExpectUpdateTime=2.0):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		assert(nbMissile==nbSensor)

		### lcoal copy
		self.nbMissile = nbMissile
		self.nbInterceptor=nbInterceptor
		self.nbSensor=nbSensor
		self.missileTravelCount = missileTravelCount
		self.missileKillZone=missileKillZone
		self.missileSpaceSize=missileSpaceSize
		self.sensorExpectUpdateTime=sensorExpectUpdateTime

		self.initPhase('CreateModels', 0.0)
Exemplo n.º 33
0
    def __init__(self, gamma=0.9, epsilon=0.1, alpha=0.1):
        ''' Constructor.
        '''
        DomainBehavior.__init__(self)

        # Parameters
        self.gamma       = gamma
        self.epsilon     = epsilon
        self.alpha       = alpha

        self.agentStates = []
        for i in range(64):
            state = 'c'+str(i)
            self.agentStates.append(state)

        # Reachable states according to state and action
        self.destinationStates = {}

        # Actions
        self.actions   = ['N','E','S','W']

        # Rewards depend on the task
        self.rewardMax = 4

        # Q value : expected utility of a given action A in a state S to achieve the goal defined by task T
        # Table of Q-values
        self.qValue = {}
        for s in self.agentStates:
            self.qValue[s] = {}
            for a in self.actions:
                self.qValue[s][a] = self.rewardMax # Optimistic initial conditions to make the agent want to explore all space

        # State variables
        self.currentState   = None
        self.action         = 'NewEpisode'
        self.episodeStartTime = 0
        self.meanEpisodeLength = 0
        self.nbEpisodes       = 0
        self.msgToEnv       = Message(None,None)

        self.msgToEnv.value = [{'action' : 'NewEpisode'}]
        self.initPhase('REPORT',0)

        self.fEpisode = open('episodes_flat.txt', 'w')
        self.fEpisode.write ('StartCell StartTime Length MeanLength \n')
        self.fPolicy  = open('policy_flat.txt', 'w')
Exemplo n.º 34
0
	def __init__(self, sourceName="", listValues=[]):
		DomainBehavior.__init__(self)

		### local copy
		self.sourceName = sourceName
		self.__listValues = listValues
		
		self.T = []
		self.V = {}

		### flags
		self.type_error_flag = True in map(lambda a: not isinstance(a, int), self.__listValues)
		self.file_error_flag = os.path.exists(self.sourceName)
		self.list_empty_flag = listValues == []
		
		### assert
		if self.type_error_flag: assert True, "Please use integer in listValue parameter !"
	def __init__(self, a=[1,1,1], f=50, phi=[0,0,0], k=20, m=["QSS2","QSS2","QSS2"]):
		"""	Constructeur.
		"""
		DomainBehavior.__init__(self)

		assert(len(a)==len(phi)==len(m))

		# Declaration des variables d'�tat (actif tout de suite)
		self.state = { 'status': 'ACTIVE', 'sigma': 0}
		# Local copy
		self.a = a
		self.f = f
		self.phi = phi
		self.k = k							# nombre de points calcul�s
		self.m = m

		self.w = 2*3.14159*self.f								# pulsation
		self.dt = 1/float(self.f)/float(self.k) 					# pas de calcul en temps
Exemplo n.º 36
0
    def __init__(self, minValue=0, maxValue=10, minStep=1, maxStep=1, start=0):
        """ Constructor.

            @param minValue : minimum value
            @param maxValue : maximum value
            @param minStep : minimum step
            @param maxStep : maximum step
			@param start : time start

        """
        DomainBehavior.__init__(self)

        self.state = {'sigma':start}
        self.minValue = minValue
        self.maxValue = maxValue
        self.minStep = minStep
        self.maxStep = maxStep
        self.msg = Message(None, None)
Exemplo n.º 37
0
    def __init__(self, sourceName="", listValues=[]):
        DomainBehavior.__init__(self)

        ### local copy
        self.sourceName = sourceName
        self.__listValues = listValues

        self.T = []
        self.V = {}

        ### flags
        self.type_error_flag = True in map(lambda a: not isinstance(a, int),
                                           self.__listValues)
        self.file_error_flag = os.path.exists(self.sourceName)
        self.list_empty_flag = listValues == []

        ### assert
        if self.type_error_flag:
            assert True, "Please use integer in listValue parameter !"
Exemplo n.º 38
0
    def __init__(self, minValue=0, maxValue=10, minStep=1, maxStep=1, start=0):
        """ Constructor.

            @param minValue : minimum value
            @param maxValue : maximum value
            @param minStep : minimum step
            @param maxStep : maximum step
			@param start : time start

        """
        DomainBehavior.__init__(self)

        self.initPhase('START', start)

        self.minValue = minValue
        self.maxValue = maxValue
        self.minStep = minStep
        self.maxStep = maxStep
        self.msg = Message(None, None)
Exemplo n.º 39
0
    def __init__(self, fusion=True, eventAxis=False):
        """ Constructor.
		
			@param fusion : Flag to plot all signals on one graphic
			@param eventAxis : Flag to plot depending event axis
		"""
        DomainBehavior.__init__(self)

        #  State variable
        self.state = {'status': 'INACTIF', 'sigma': INFINITY}

        # fusioning curve
        self.fusion = fusion
        # replace time axis with step axis
        self.eventAxis = eventAxis

        # results tab (results attribut must be defined in order to plot the data)
        self.results = {}  #OrderedDict()

        self.t = INFINITY
Exemplo n.º 40
0
 def __init__(self):
     DomainBehavior.__init__(self)
     self.state = {'status': 'INACTIF', 'sigma': INFINITY}
     self.phase = 'Free'
     self.jobsList = []
Exemplo n.º 41
0
	def __init__(self):
		"""Constructor.
		"""
		DomainBehavior.__init__(self)