Dear SUMO community.

I installed SUMO svn sources on September 2013.

I wanted to test the TraCI subscriptions, so I modified the *run* function
of the script %SUMO_HOME%\docs\tutorial\traci_tls\runner.py as follows:

def run():
    """execute the TraCI control loop"""
    traci.init(PORT)
    programPointer = len(PROGRAM)-1
    step = 0
    traci.inductionloop.subscribe("0",[tc.LAST_STEP_VEHICLE_NUMBER],0,3600)
    while traci.simulation.getMinExpectedNumber() > 0:
        traci.simulationStep()
        programPointer = min(programPointer+1, len(PROGRAM)-1)
        # no = traci.inductionloop.getLastStepVehicleNumber("0") Without
TraCI subscriptions
        no =
traci.inductionloop.getSubscriptionResults("0")[tc.LAST_STEP_VEHICLE_NUMBER]
        if no > 0:
            programPointer = (0 if programPointer == len(PROGRAM)-1 else 3)
        traci.trafficlights.setRedYellowGreenState("0",
PROGRAM[programPointer])
        step += 1
    traci.close()
    sys.stdout.flush()

As you can see, I added the command
traci.inductionloop.subscribe("0",[tc.LAST_STEP_VEHICLE_NUMBER],0,3600)
before the while loop which performs the simulation steps; and the command
no =
traci.inductionloop.getSubscriptionResults("0")[tc.LAST_STEP_VEHICLE_NUMBER]
after performing the simulation step.

>From the first to the third time steps, after the execution of the
traci.sendExact() command within traci.simulationStep(), the following
result is obtained:

'\x07\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x13\xe0\x00\x00\x00\x010\x01\x10\x00\t\x00\x00\x00\x00'

The bytes from 7 to 10 (counting from 0): x00\x00\x00\x01, indicate that
the number of subscriptions is one, so everything is OK so far. However, in
the fourth time step (in which I can see the first vehicles enter the
network), the result is:

'\x07\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00'

The bytes from 7 to 10 (counting from 0): x00\x00\x00\x00, indicate that
the number of subscriptionsis zero!!

Am I doing something wrong?

Thanks in advance!!

-- 

Andres Felipe Acosta Gil
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to