t = 5 #time of interest in simulation timesteps (set in settings) #setup log file for this script import logging from behaviorSim.__util.setupLog import setupLog setupLog() import behaviorSim.API as API # === === === === === === AGENT SETUP === === === === === === sim = API.getDefaultSimulation() #API.congfigureSimulation(sim,script) myAgent = API.getDefaultAgent(sim.environment) #load default agent #TODO: defaultAgent.tag = 'my very first agent' # you can not reference the agent using 'myAgent' or 'environment.agent[0]' # add agent to environment print ' === === === === === === SETTINGS === === === === === ===' print '* simulation start time (sim-time): ' + str(sim.settings.simStartTime) print '* size of time step, deltaTime: ' + str(sim.settings.deltaTime) print '\n === === === === === === INPUTS === === === === === ===' # === to get data: === #<agentName>.inputs.<desiredValue>(<desiredTime>) print '* time(t): ' + str(sim.environment.agents[0].inputs.time(t)) # don't worry about if the data is 'there' or up-to-date; all of that is handled automagically, just ask for time you want
# -*- coding: utf-8 -*- """ Created on Fri Dec 20 18:42:20 2013 @author: 7yl4r """ import unittest import behaviorSim.API as API from behaviorSim.__util.setupLog import setupLog setupLog() from behaviorSim.PECSagent.state.baseInfo.name import iterativeNamer as nameSetter from random import randrange class basicAPI_Test(unittest.TestCase): def setUp(self): self.defSim = API.getDefaultSimulation() self.defEnv = API.getDefaultEnvironment() self.defAgent = API.getDefaultAgent(self.defEnv) def test_basicLoadNoCrash(self): self.defSim = API.getDefaultSimulation() self.defEnv = API.getDefaultEnvironment()