Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/complex/traas/multiclient/data/MultiClient2.java
169771 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2017-2025 German Aerospace Center (DLR) and others.
4
// TraaS module
5
// Copyright (C) 2013-2017 Dresden University of Technology
6
// This program and the accompanying materials are made available under the
7
// terms of the Eclipse Public License 2.0 which is available at
8
// https://www.eclipse.org/legal/epl-2.0/
9
// This Source Code may also be made available under the following Secondary
10
// Licenses when the conditions for such availability set forth in the Eclipse
11
// Public License 2.0 are satisfied: GNU General Public License, version 2
12
// or later which is available at
13
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
14
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
15
/****************************************************************************/
16
/// @file MultiClient2.java
17
/// @author Jakob Erdmann
18
/// @date 2019
19
///
20
//
21
/****************************************************************************/
22
import it.polito.appeal.traci.SumoTraciConnection;
23
import de.tudresden.sumo.cmd.Simulation;
24
import de.tudresden.sumo.cmd.Vehicle;
25
import de.tudresden.sumo.cmd.Inductionloop;
26
import de.tudresden.sumo.cmd.Trafficlight;
27
import de.tudresden.sumo.objects.SumoVehicleData;
28
29
public class MultiClient2 {
30
31
public static void main(String[] args) {
32
33
34
try {
35
36
SumoTraciConnection conn = new SumoTraciConnection(9998);
37
conn.setOrder(2);
38
39
for (int i = 0; i < 3600; i++) {
40
conn.do_timestep();
41
double timeSeconds = (double)conn.do_job_get(Simulation.getTime());
42
System.out.println(String.format("Step %s", timeSeconds));
43
}
44
45
conn.close();
46
47
} catch (Exception ex) {
48
ex.printStackTrace();
49
}
50
51
}
52
53
}
54
55