Ejemplo n.º 1
0
def p_simpletypedeclar(p):
    '''
    simpletypedeclar : TYPENAME LPAREN listattr RPAREN
    '''
    if p[1] != 'Behaviour':
        raise Exception('Invalid entity for outer entity')

    if not checkAttributes('Behaviour', p[3]):
        raise Exception('Invalid attributes for type Behaviour')
    x = p[3][3]
    reflect = False
    repeat = False
    if x == 'LOOP':
        reflect = True
    if x == 'CONTINUOUS':
        repeat = True
    p[0] = behaviour.Behaviour(p[3][0], p[3][1], p[3][2], repeat, reflect,
                               p[3][4])
Ejemplo n.º 2
0
    def __init__(self,
                 ID,
                 market,
                 resource,
                 minAmount,
                 maxAmount,
                 underSell,
                 overSell,
                 currency=False):
        self.currency = currency
        self.ID = ID
        self.market = market
        self.resource = resource
        self.behaviour = Behaviour.Behaviour(self.market, self.resource)

        self.minAmount = minAmount
        self.maxAmount = maxAmount
        self.underSell = underSell
        self.overSell = overSell

        self.amountOfUniqueResources = resource.amountOfUniqueResources

        self.RandomizeBehavior()
Ejemplo n.º 3
0
    state = -1
    idle_time = 4
    idle_gap = 5
    active_gap = 1

    idle_event_start_time = time.time()
    active_event_start_time = time.time()

    state_start_time = time.time()

    trigger_ls = []
    active_ls = []

    trigger_index = 0

    behaviour = Behaviour()
    print('Simulation starts')
    print('*************')
    while True:
        #########################################
        #  Get triggered locations and numbers  #
        #########################################

        # for sma_id in sma_patches:
        # 	ir_out = sma_patches[sma_id].get_block_output('IRSensor_1', 'ir')
        # 	print str(sma_id) + ':' + str(ir_out.value)
        # 	if ir_out.value == 1:
        # 		trigger_key.append(sma_id)
        # 		coordinate = find_location(location_map)

        if len(trigger_ls