Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Subscribing to simulation variables
  • From: Matthew Jones <Matthew.Jones@xxxxxxxxx>
  • Date: Tue, 13 Dec 2022 12:09:06 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=rfpro.com; dmarc=pass action=none header.from=rfpro.com; dkim=pass header.d=rfpro.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XMib9tPuRT7cwGh3kgpp6XQPnH0cC8aWyHKHFDD1yG4=; b=S1yVDwj+yVPNoEOWx9UmCf2UwPkSscYStspWxEcwcdMWE5Rb8HCcninZ18RE/x7vr+ykHU8miGAIGP8qy9eLNj4D46guN+PzmDNs/DEsIeBL56RwrdxeYO0Jj51Lvit6MRlDRQV82mbVf5uey4Yg8lhwzEjS6gJC7pfhPWeJVczpKXfQiK8lj2uI9++9b9xab9H0IHyCP5IVVnAWokg7KUgdBg/v+eziPFSHFhX6n9XHn24dBGmj4sRsPVwmmUqOVqww2LKMFM4tsSFq8Lvk1AGDCEyRsKjxVD9tlbOpmDtIRc9MpEyS3wV1cWdAx2s7JHnv1Y3MdW5PlsomFHXW+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lwzmjJ8P1jLm9cTQu3TFJzaTg3qrhmGWG3EIrciFiNlAIfn7rx4v9IrQUiCx1cpnLXGjSD/5MmNDBQTrgAoM+YYeb8biIGcpE02W9z1ccD4DT/Ti91Z6LIQxCXX8E0aWHIaq1k6q+WGg1drv0W1SIAUyUjmctedkYnlZAmZGSQ5c61t8Mnozw7UJbQiJ/HZMl2ZKSaTixgMubCdOCJyrAXovGa0R2UG+KMahDmikWEkj8MPW7O8QpLnvX3xqht3i6zD4LbL1uXrZC55Qm49llukKypgvJHQwJyrUUxbOswYut7Yr6aqpwwvrtD3v+rwTyAUQ1SBqi63OhXKnPngmDw==
  • Delivered-to: sumo-user@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/sumo-user/>
  • List-help: <mailto:sumo-user-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHZDupwJ2YjzlnsGUOTPwyAzYSGmg==
  • Thread-topic: Subscribing to simulation variables

Hello,

I am trying to debug some simulation problems, from C++ code.
Our main class is 
    class TrafficModel : public TraCIAPI
and in its constructor we have this, which works:
    mStartTime = simulation.getTime();
    mDeltaTime = simulation.getDeltaT();
however, if I call
    simulation.getIDCount();
or
    simulation.getIDList();
they block and the application freezes.

What I am actually trying to do is
    const std::vector<int> varsSimulation{
      libsumo::VAR_TELEPORT_STARTING_VEHICLES_NUMBER,
      libsumo::VAR_TELEPORT_STARTING_VEHICLES_IDS,
      libsumo::VAR_TELEPORT_ENDING_VEHICLES_NUMBER,
      libsumo::VAR_TELEPORT_ENDING_VEHICLES_IDS,
      libsumo::VAR_ARRIVED_VEHICLES_NUMBER,
      libsumo::VAR_ARRIVED_VEHICLES_IDS,
    };

    simulation.subscribeContext("", libsumo::CMD_GET_SIM_VARIABLE, 99999, varsSimulation, 0, 999999999);

but this also blocks, so I was trying to work out what to pass for the first parameter to subscribeContext.

Obviously I'm doing something wrong but I can't work out what it is!
I couldn't find anything in the documentation about what the first parameter for subscribeContext means when we are dealing with the simulation scope.
Are there restrictions on when any of these methods can be called?

Thanks,

Matthew.





Matthew Jones
Senior Software Engineer
rFpro Limited

E: matthew.jones@xxxxxxxxx
W:  www.rFpro.com

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system sender. This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.


Back to the top