I am afraid I cannot provide any insight into it but I have occasionally
seen this kind of behavior on my setup i.e. the simulator starts up, creates
motes but when I try to run the simulation with resume it doesn't do
anything.

On 5/25/07, Marek Jawurek <[EMAIL PROTECTED]> wrote:

Hi Sarfraz,

I am afraid I did not elaborate. Not only the serialforwarder complains
but I get this output message with simcore.sim.stop() enabled:

SimComm: TossimInitEvent received (10 motes)... initializing system.
SimComm: Pausing system for TossimInitEvent
status: Simulation paused
Starting new simulation <== my output
Current parameters [[MoteParamter:0]] [MoteParamter:10] <== my output
[[MoteParamter:1]]
status: Simulation resumed <== my output from here on
0 DebugMsgEvent [0: I am node zero and I start the show]
1 DebugMsgEvent [1: I am node 1 and I am waiting for some action]
2 DebugMsgEvent [2: I am node 2 and I am waiting for some action]
3 DebugMsgEvent [3: I am node 3 and I am waiting for some action]
Simulation stopped <== my output until here
status: Connecting to simulator... <== simdriver output
status: Connection to simulator failed <== simdriver output


When I disable simcore.sim.stop(), the simulation starts 3 times, but
the third time no node produces dbg events. Thus my simulation hangs
there indefinetely. I let my DBGEventHandler output 4 messages and then
remove the handler and stop the simulation.


This is my code:

def startSimulation(self,simulationFunc):
    print "Starting new tossim instance"

simcore.sim.exec("build/pc/main.exe",self.moteNumberParameter.getCurrent(),
"-b=0")

    permLeft=True
    while permLeft:
      self.stopSimulationV=False
      print "Starting new simulation"
      print "Current parameters "+str(self.moteParameters)+"
"+str(self.moteNumberParameter)+" "+str(self.scriptParameters)

      # create Hash from script Parameters
      hash={}
      for p in self.scriptParameters:
        hash[p.getName()]=p.getCurrent()

      simulationFunc(self.stopSimulation,hash) # I provide a method
self.stopSimulation which enables the simulationFunc to set
self.stopSimulationV to True so that the simulation is stopped in the
next lines
      while not self.stopSimulationV:
        time.sleep(0.2)
      print "Simulation stopped"
      #simcore.sim.stop() <=== important line
      simcore.sim.reset()
      while len(simcore.motes)==0: # here I wait for the mote list to be
populated again, I take it as a sign for the simulator being ready
        time.sleep(0.2)
        print "Sleeping"
      permLeft=self.permutate(self.scriptParameters)
      print "Simulation resetted"
    simcore.sim.stop()
    print "SIMULATIONS FOR ALL SCRIPT PARAMS PERFORMED"


ne=0
stopF=None
handlerid=None


def simHandler(event):
  global ne,stopF,handlerid

  print ne,event
  ne+=1
  if ne > 3:
    interp.removeEventHandler(handlerid)
    stopF()

# this is the function provided as simulationFunc to startSimulation()
def simulation(stopper,param):
  global stopF,ne,handlerid
  ne=0
  handlerid=interp.addEventHandler(simHandler,DebugMsgEvent)
  simcore.sim.resume()
  stopF=stopper







Am Freitag, den 25.05.2007, 13:06 +1000 schrieb Sarfraz Nawaz:
>  It seems that tossim's serial forwarder is complaining. You can try
> to run the simulator with -nosf and see if you run into the same
> problem or not.
>
> On 5/24/07, Marek Jawurek <[EMAIL PROTECTED]> wrote:
>         Hi there,
>         I attempt to run several simulations controlled by a python
>         script. The
>         idea is not to recreate the tossim simulator for every run but
>         to reset
>         the simulation and start over.
>         The problem is that apparently when I stop tossim with
>         simcore.sim.stop() I get :
>
>         [EMAIL PROTECTED] died - restarting
>         (java.io.EOFException)
>
>
>         When I only use simcore.sim.reset() then the simulator doesn't
>         crash but
>         apparently the motes are not restartet. Are these known
>         issues ? I read
>         something about problems in reset in the archives but it was
>         from 2004.
>
>         I use a recent (2 weeks old) tinyos-1.x cvs version.
>
>         Marek
>
>
>         --
>         Marek Jawurek <[EMAIL PROTECTED]>
>
>         _______________________________________________
>         Tinyos-help mailing list
>         [email protected]
>
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
>
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
--
Marek Jawurek <[EMAIL PROTECTED]>


_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to