├── wsmprop.png ├── src ├── libveins.so ├── libveins_dbg.so ├── veins │ ├── base │ │ ├── package.ned │ │ ├── utils │ │ │ ├── SimpleAddress.cc │ │ │ ├── Heading.cc │ │ │ ├── winsupport.cc │ │ │ ├── winsupport.h │ │ │ ├── NetwToMacControlInfo.cc │ │ │ ├── Coord.cc │ │ │ ├── POA.h │ │ │ ├── PassedMessage.h │ │ │ └── AntennaPosition.h │ │ ├── modules │ │ │ ├── ITrafficLightApplLayer.ned │ │ │ ├── BaseBattery.cc │ │ │ ├── ITrafficLightLogic.ned │ │ │ ├── IMobility.ned │ │ │ ├── IBaseApplLayer.ned │ │ │ ├── BaseMacLayer.ned │ │ │ ├── BaseLayer.ned │ │ │ ├── BaseWorldUtility.ned │ │ │ ├── BaseApplLayer.cc │ │ │ ├── BaseMobility.ned │ │ │ ├── IWirelessMac.ned │ │ │ ├── AddressingInterface.h │ │ │ └── BatteryAccess.cc │ │ ├── phyLayer │ │ │ ├── Antenna.cc │ │ │ └── Decider.cc │ │ ├── messages │ │ │ ├── BorderMsg.msg │ │ │ └── MacPkt.msg │ │ ├── connectionManager │ │ │ ├── IChannelAccess.ned │ │ │ ├── NicEntryDirect.cc │ │ │ ├── ConnectionManager.h │ │ │ ├── ConnectionManager.cc │ │ │ └── ConnectionManager.ned │ │ └── toolbox │ │ │ └── Spectrum.h │ ├── modules │ │ ├── package.ned │ │ ├── messages │ │ │ ├── AckTimeOutMessage.msg │ │ │ ├── Mac80211Ack.msg │ │ │ ├── DemoServiceAdvertisement.msg │ │ │ ├── AirFrame11p.msg │ │ │ ├── PhyControlMessage.msg │ │ │ ├── DemoSafetyMessage.msg │ │ │ ├── BaseFrame1609_4.msg │ │ │ ├── Mac80211Pkt.msg │ │ │ ├── TraCITrafficLightMessage.msg │ │ │ ├── Mac80211Ack_m.h │ │ │ └── AckTimeOutMessage_m.h │ │ ├── application │ │ │ └── traci │ │ │ │ ├── TraCIDemo11p.ned │ │ │ │ ├── TraCIDemoRSU11p.ned │ │ │ │ ├── MyVeinsApp.ned │ │ │ │ ├── TraCIDemoRSU11p.h │ │ │ │ ├── TraCIDemo11pMessage.msg │ │ │ │ ├── TraCIDemoRSU11p.cc │ │ │ │ ├── MyVeinsApp.h │ │ │ │ └── TraCIDemo11p.h │ │ ├── utility │ │ │ ├── HasLogProxy.cc │ │ │ ├── HasLogProxy.h │ │ │ └── MacToPhyControlInfo11p.h │ │ ├── world │ │ │ ├── traci │ │ │ │ └── trafficLight │ │ │ │ │ ├── TraCITrafficLightInterface.ned │ │ │ │ │ ├── logics │ │ │ │ │ ├── TraCITrafficLightSimpleLogic.ned │ │ │ │ │ ├── TraCITrafficLightSimpleLogic.cc │ │ │ │ │ ├── TraCITrafficLightSimpleLogic.h │ │ │ │ │ └── TraCITrafficLightAbstractLogic.h │ │ │ │ │ ├── TraCITrafficLightProgram.cc │ │ │ │ │ └── TraCITrafficLightProgram.h │ │ │ └── annotations │ │ │ │ ├── AnnotationDummy.cc │ │ │ │ ├── AnnotationDummy.ned │ │ │ │ ├── AnnotationDummy.h │ │ │ │ └── AnnotationManager.ned │ │ ├── obstacle │ │ │ ├── VehicleObstacleControl.ned │ │ │ ├── ObstacleControl.ned │ │ │ └── Obstacle.h │ │ ├── phy │ │ │ ├── Decider80211pToPhy80211pInterface.h │ │ │ └── PhyLayer80211p.ned │ │ ├── mobility │ │ │ ├── traci │ │ │ │ ├── TraCICoord.h │ │ │ │ ├── TraCIColor.h │ │ │ │ ├── TraCILauncher.h │ │ │ │ ├── VehicleSignal.h │ │ │ │ ├── TraCIScenarioManagerLaunchd.ned │ │ │ │ ├── TraCIVehicleInserter.ned │ │ │ │ ├── TraCIScreenRecorder.h │ │ │ │ ├── TraCIScenarioManagerForker.ned │ │ │ │ ├── TraCICoordinateTransformation.h │ │ │ │ ├── TraCIScenarioManagerLaunchd.h │ │ │ │ ├── TraCIMobility.ned │ │ │ │ └── TraCIScreenRecorder.ned │ │ │ ├── LinearMobility.ned │ │ │ └── LinearMobility.h │ │ ├── nic │ │ │ ├── INic80211p.ned │ │ │ └── Nic80211p.ned │ │ ├── analogueModel │ │ │ ├── PERModel.cc │ │ │ ├── SimpleObstacleShadowing.cc │ │ │ ├── PERModel.h │ │ │ ├── NakagamiFading.h │ │ │ ├── TwoRayInterferenceModel.h │ │ │ └── SimplePathlossModel.cc │ │ └── mac │ │ │ └── ieee80211p │ │ │ ├── DemoBaseApplLayerToMac1609_4Interface.h │ │ │ └── Mac80211pToPhy11pInterface.h │ ├── package.ned │ ├── visualizer │ │ └── roads │ │ │ ├── RoadsOsgVisualizer.ned │ │ │ ├── RoadsCanvasVisualizer.ned │ │ │ ├── RoadsCanvasVisualizer.h │ │ │ └── RoadsOsgVisualizer.h │ └── nodes │ │ ├── RSU.ned │ │ └── Car.ned └── makefrag ├── confronto3new.png ├── slowdown1530.png ├── examples └── veins │ ├── erlangen.png │ ├── osm.view.xml │ ├── README │ ├── emergencyLane.sumo.cfg │ ├── Default.anf │ ├── osm.polycfg │ ├── run │ ├── emergencyLane.trips.xml │ ├── EmergencyLaneScenario.ned │ ├── osm.sumo.cfg │ ├── RSUExampleScenario.ned │ ├── osm.netccfg │ ├── emergencyLane.launchd.xml │ ├── erlangen.launchd.xml │ ├── config.xml │ ├── osm.launchd.xml │ ├── erlangen.rou.xml │ ├── erlangen.sumo.cfg │ └── emergencyLane.net.xml └── README.md /wsmprop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pCappadonia/Emergency-Vehicle-V2V-Priority/HEAD/wsmprop.png -------------------------------------------------------------------------------- /src/libveins.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pCappadonia/Emergency-Vehicle-V2V-Priority/HEAD/src/libveins.so -------------------------------------------------------------------------------- /confronto3new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pCappadonia/Emergency-Vehicle-V2V-Priority/HEAD/confronto3new.png -------------------------------------------------------------------------------- /slowdown1530.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pCappadonia/Emergency-Vehicle-V2V-Priority/HEAD/slowdown1530.png -------------------------------------------------------------------------------- /src/libveins_dbg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pCappadonia/Emergency-Vehicle-V2V-Priority/HEAD/src/libveins_dbg.so -------------------------------------------------------------------------------- /examples/veins/erlangen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pCappadonia/Emergency-Vehicle-V2V-Priority/HEAD/examples/veins/erlangen.png -------------------------------------------------------------------------------- /examples/veins/osm.view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/veins/README: -------------------------------------------------------------------------------- 1 | Veins tutorial example. 2 | 3 | This simulation requires sumo-launchd to be started and listening for 4 | connections on a TCP socket, e.g. using "~/src/veins/sumo-launchd.py -vv". 5 | 6 | -------------------------------------------------------------------------------- /examples/veins/emergencyLane.sumo.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/veins/Default.anf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/veins/osm.polycfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/veins/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright (C) 2011 Christoph Sommer 5 | # 6 | # Documentation for these modules is at http://veins.car2x.org/ 7 | # 8 | # SPDX-License-Identifier: GPL-2.0-or-later 9 | # 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | # 24 | 25 | exec ../../bin/veins_run "$@" 26 | -------------------------------------------------------------------------------- /src/veins/base/package.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2013 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.base; 24 | 25 | -------------------------------------------------------------------------------- /src/veins/modules/package.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2013 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules; 24 | 25 | -------------------------------------------------------------------------------- /src/veins/base/utils/SimpleAddress.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 Fraunhofer-Gesellschaft, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Michael Lindig 24 | #include "veins/base/utils/SimpleAddress.h" 25 | -------------------------------------------------------------------------------- /examples/veins/emergencyLane.trips.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/veins/base/utils/Heading.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #include "veins/base/utils/Heading.h" 24 | 25 | namespace veins { 26 | 27 | const Heading Heading::nan = Heading(std::numeric_limits::quiet_NaN()); 28 | 29 | } // namespace veins 30 | -------------------------------------------------------------------------------- /src/veins/base/modules/ITrafficLightApplLayer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.base.modules; 24 | 25 | moduleinterface ITrafficLightApplLayer extends IBaseApplLayer 26 | { 27 | gates: 28 | inout logic; 29 | } 30 | -------------------------------------------------------------------------------- /examples/veins/EmergencyLaneScenario.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2017 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | //package veins; 24 | 25 | import org.car2x.veins.nodes.RSU; 26 | import org.car2x.veins.nodes.Scenario; 27 | 28 | network EmergencyLaneScenario extends Scenario 29 | { 30 | submodules: 31 | } 32 | -------------------------------------------------------------------------------- /src/veins/package.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2013 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // 24 | // @titlepage 25 | //

Veins Framework

26 | // 27 | // See the Veins website for a tutorial, documentation, and publications . 28 | // 29 | 30 | package org.car2x.veins; 31 | -------------------------------------------------------------------------------- /src/veins/base/modules/BaseBattery.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #include "veins/base/modules/BaseBattery.h" 26 | -------------------------------------------------------------------------------- /src/veins/modules/messages/AckTimeOutMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Gurjashan Pannu 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | namespace veins; 24 | 25 | message AckTimeOutMessage { 26 | // The corresponding WSM's tree id 27 | unsigned long wsmId = -1; 28 | // Access category on which the AckTimer is set 29 | int ac = -1; 30 | } 31 | -------------------------------------------------------------------------------- /src/veins/modules/messages/Mac80211Ack.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Gurjashan Pannu 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | cplusplus {{ 24 | #include "veins/modules/messages/Mac80211Pkt_m.h" 25 | }} 26 | 27 | namespace veins; 28 | 29 | class Mac80211Pkt; 30 | 31 | packet Mac80211Ack extends Mac80211Pkt { 32 | unsigned long messageId; // The ID of the aknowledged packet 33 | } 34 | -------------------------------------------------------------------------------- /src/veins/base/phyLayer/Antenna.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Alexander Brummer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #include "veins/base/phyLayer/Antenna.h" 24 | 25 | using namespace veins; 26 | 27 | double Antenna::getGain(Coord ownPos, Coord ownOrient, Coord otherPos) 28 | { 29 | // as this base class represents an isotropic antenna, simply return 1.0 30 | return 1.0; 31 | } 32 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/TraCIDemo11p.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2011 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.application.traci; 24 | import org.car2x.veins.modules.application.ieee80211p.DemoBaseApplLayer; 25 | 26 | simple TraCIDemo11p extends DemoBaseApplLayer 27 | { 28 | @class(veins::TraCIDemo11p); 29 | @display("i=block/app2"); 30 | } 31 | -------------------------------------------------------------------------------- /src/veins/modules/utility/HasLogProxy.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #include "veins/modules/utility/HasLogProxy.h" 24 | 25 | namespace veins { 26 | 27 | HasLogProxy::HasLogProxy(cComponent* owner) 28 | : owner(owner) 29 | { 30 | } 31 | 32 | const cComponent* HasLogProxy::getThisPtr() const 33 | { 34 | return owner; 35 | } 36 | 37 | } // namespace veins 38 | -------------------------------------------------------------------------------- /examples/veins/osm.sumo.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/TraCIDemoRSU11p.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2011 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.application.traci; 24 | import org.car2x.veins.modules.application.ieee80211p.DemoBaseApplLayer; 25 | 26 | simple TraCIDemoRSU11p extends DemoBaseApplLayer 27 | { 28 | @class(veins::TraCIDemoRSU11p); 29 | @display("i=block/app2"); 30 | } 31 | -------------------------------------------------------------------------------- /examples/veins/RSUExampleScenario.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2017 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | //package veins; 24 | 25 | import org.car2x.veins.nodes.RSU; 26 | import org.car2x.veins.nodes.Scenario; 27 | 28 | network RSUExampleScenario extends Scenario 29 | { 30 | submodules: 31 | rsu[1]: RSU { 32 | @display("p=150,140;i=veins/sign/yellowdiamond;is=vs"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/veins/modules/world/traci/trafficLight/TraCITrafficLightInterface.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.world.traci.trafficLight; 24 | 25 | simple TraCITrafficLightInterface { 26 | parameters: 27 | @class(veins::TraCITrafficLightInterface); 28 | @display("i=block/layer"); 29 | gates: 30 | inout logic; 31 | } 32 | -------------------------------------------------------------------------------- /src/veins/base/modules/ITrafficLightLogic.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.base.modules; 24 | 25 | // Interface for signal controller logic of traffic lights 26 | moduleinterface ITrafficLightLogic 27 | { 28 | parameters: 29 | @display("i=block/classifier"); 30 | gates: 31 | inout interface; 32 | inout applLayer; 33 | } 34 | -------------------------------------------------------------------------------- /src/veins/modules/world/annotations/AnnotationDummy.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // AnnotationDummy - workaround to visualize annotations 24 | 25 | #include "veins/modules/world/annotations/AnnotationDummy.h" 26 | 27 | using veins::AnnotationDummy; 28 | 29 | Define_Module(veins::AnnotationDummy); 30 | 31 | AnnotationDummy::~AnnotationDummy() 32 | { 33 | } 34 | -------------------------------------------------------------------------------- /src/veins/modules/messages/DemoServiceAdvertisement.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | cplusplus {{ 24 | #include "veins/base/utils/Coord.h" 25 | #include "veins/modules/messages/BaseFrame1609_4_m.h" 26 | }} 27 | 28 | namespace veins; 29 | 30 | class BaseFrame1609_4; 31 | class noncobject Coord; 32 | 33 | packet DemoServiceAdvertisment extends BaseFrame1609_4 { 34 | int targetChannel; 35 | string serviceDescription; 36 | } 37 | -------------------------------------------------------------------------------- /src/veins/modules/obstacle/VehicleObstacleControl.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010-2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.obstacle; 24 | 25 | // 26 | // VehicleObstacleControl models moving obstacles that block radio transmissions 27 | // 28 | simple VehicleObstacleControl 29 | { 30 | parameters: 31 | @class(veins::VehicleObstacleControl); 32 | @display("i=misc/town2"); 33 | @labels(node); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/veins/modules/messages/AirFrame11p.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2013 Michele Segata 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | cplusplus {{ 24 | #include "veins/base/messages/AirFrame_m.h" 25 | using veins::AirFrame; 26 | }} 27 | 28 | namespace veins; 29 | 30 | class AirFrame; 31 | 32 | // 33 | // Extension of base AirFrame message to have the underMinPowerLevel field 34 | // 35 | message AirFrame11p extends AirFrame { 36 | bool underMinPowerLevel = false; 37 | bool wasTransmitting = false; 38 | } 39 | -------------------------------------------------------------------------------- /src/veins/modules/world/annotations/AnnotationDummy.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // AnnotationDummy - workaround to visualize annotations 24 | 25 | package org.car2x.veins.modules.world.annotations; 26 | 27 | // 28 | // workaround to visualize annotations 29 | // 30 | simple AnnotationDummy 31 | { 32 | parameters: 33 | @display("b=70,30,oval,red,black,4"); 34 | @class(veins::AnnotationDummy); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/MyVeinsApp.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.application.traci; 24 | import org.car2x.veins.modules.application.ieee80211p.DemoBaseApplLayer; 25 | 26 | // 27 | // network description file for your Veins Application. Add parameters here 28 | // 29 | simple MyVeinsApp extends DemoBaseApplLayer 30 | { 31 | @class(veins::MyVeinsApp); 32 | string appName = default("My first Veins App!"); 33 | } 34 | -------------------------------------------------------------------------------- /src/veins/modules/messages/PhyControlMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014 Michele Segata 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | namespace veins; 24 | 25 | // 26 | // Defines a control message that can be associated with a MAC frame to set 27 | // transmission power and datarate on a per packet basis 28 | // 29 | message PhyControlMessage { 30 | //modulation and coding scheme to be used (see enum TxMCS in ConstsPhy.h) 31 | int mcs = -1; 32 | //transmission power to be used in mW 33 | double txPower_mW = -1; 34 | } 35 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/TraCIDemoRSU11p.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/modules/application/ieee80211p/DemoBaseApplLayer.h" 26 | 27 | namespace veins { 28 | 29 | /** 30 | * Small RSU Demo using 11p 31 | */ 32 | class VEINS_API TraCIDemoRSU11p : public DemoBaseApplLayer { 33 | protected: 34 | void onWSM(BaseFrame1609_4* wsm) override; 35 | void onWSA(DemoServiceAdvertisment* wsa) override; 36 | }; 37 | 38 | } // namespace veins 39 | -------------------------------------------------------------------------------- /src/veins/modules/utility/HasLogProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | #pragma once 23 | 24 | #include 25 | 26 | #include "veins/veins.h" 27 | 28 | namespace veins { 29 | 30 | /** 31 | * Helper class for logging from classes not derived from cComponent 32 | */ 33 | class VEINS_API HasLogProxy { 34 | public: 35 | HasLogProxy(cComponent* owner); 36 | const cComponent* getThisPtr() const; 37 | 38 | protected: 39 | cComponent* owner; 40 | }; 41 | 42 | } // namespace veins 43 | -------------------------------------------------------------------------------- /src/veins/modules/messages/DemoSafetyMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | cplusplus {{ 24 | #include "veins/base/utils/Coord.h" 25 | #include "veins/modules/messages/BaseFrame1609_4_m.h" 26 | #include "veins/base/utils/SimpleAddress.h" 27 | }} 28 | 29 | namespace veins; 30 | 31 | class BaseFrame1609_4; 32 | class noncobject Coord; 33 | class LAddress::L2Type extends void; 34 | 35 | packet DemoSafetyMessage extends BaseFrame1609_4 { 36 | Coord senderPos; 37 | Coord senderSpeed; 38 | } 39 | -------------------------------------------------------------------------------- /src/veins/modules/phy/Decider80211pToPhy80211pInterface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | namespace veins { 26 | 27 | /** 28 | * @brief 29 | * Interface of PhyLayer80211p exposed to Decider80211p. 30 | * 31 | * @author David Eckhoff 32 | * 33 | * @ingroup phyLayer 34 | */ 35 | class VEINS_API Decider80211pToPhy80211pInterface { 36 | public: 37 | virtual ~Decider80211pToPhy80211pInterface(){}; 38 | virtual int getRadioState() = 0; 39 | }; 40 | 41 | } // namespace veins 42 | -------------------------------------------------------------------------------- /examples/veins/osm.netccfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCICoord.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | namespace veins { 28 | 29 | /** 30 | * Coord equivalent for storing TraCI coordinates 31 | */ 32 | struct VEINS_API TraCICoord { 33 | TraCICoord() 34 | : x(0.0) 35 | , y(0.0) 36 | { 37 | } 38 | TraCICoord(double x, double y) 39 | : x(x) 40 | , y(y) 41 | { 42 | } 43 | double x; 44 | double y; 45 | }; 46 | 47 | } // namespace veins 48 | -------------------------------------------------------------------------------- /src/veins/modules/world/traci/trafficLight/logics/TraCITrafficLightSimpleLogic.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.world.traci.trafficLight.logics; 24 | 25 | import org.car2x.veins.base.modules.ITrafficLightLogic; 26 | 27 | simple TraCITrafficLightSimpleLogic like ITrafficLightLogic { 28 | parameters: 29 | @class(veins::TraCITrafficLightSimpleLogic); 30 | @display("i=block/classifier"); 31 | gates: 32 | inout interface; 33 | inout applLayer; 34 | } 35 | -------------------------------------------------------------------------------- /src/veins/base/utils/winsupport.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | /** 26 | * @file winsupport.cc 27 | * @brief Support for Win32 architectures. 28 | * @author Hermann S. Lichte 29 | * @date 2007-08-14 30 | **/ 31 | 32 | #include "veins/base/utils/winsupport.h" 33 | 34 | #ifdef _WIN32 35 | 36 | #include 37 | #include 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/veins/modules/world/annotations/AnnotationDummy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // AnnotationDummy - workaround to visualize annotations 24 | 25 | #pragma once 26 | 27 | #include "veins/veins.h" 28 | 29 | namespace veins { 30 | 31 | /** 32 | * AnnotationDummy is just a workaround to visualize annotations 33 | * 34 | * @author Christoph Sommer 35 | */ 36 | class VEINS_API AnnotationDummy : public cSimpleModule { 37 | public: 38 | ~AnnotationDummy() override; 39 | 40 | protected: 41 | }; 42 | 43 | } // namespace veins 44 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2011 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | namespace veins { 28 | 29 | /** 30 | * TraCI compatible color container 31 | */ 32 | class VEINS_API TraCIColor { 33 | public: 34 | TraCIColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); 35 | static TraCIColor fromTkColor(std::string tkColorName); 36 | 37 | public: 38 | uint8_t red; 39 | uint8_t green; 40 | uint8_t blue; 41 | uint8_t alpha; 42 | }; 43 | 44 | } // namespace veins 45 | -------------------------------------------------------------------------------- /src/veins/modules/obstacle/ObstacleControl.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010-2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.obstacle; 24 | 25 | // 26 | // ObstacleControl models obstacles that block radio transmissions 27 | // 28 | simple ObstacleControl 29 | { 30 | parameters: 31 | @class(veins::ObstacleControl); 32 | xml obstacles = default(xml("")); // list of obstacle types and obstacles to load 33 | int gridCellSize = default(250); // size of square grid tiles for obstacle store 34 | @display("i=misc/town"); 35 | @labels(node); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/TraCIDemo11pMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | cplusplus {{ 24 | #include "veins/base/utils/Coord.h" 25 | #include "veins/modules/messages/BaseFrame1609_4_m.h" 26 | #include "veins/base/utils/SimpleAddress.h" 27 | }} 28 | 29 | namespace veins; 30 | 31 | class BaseFrame1609_4; 32 | class noncobject Coord; 33 | class LAddress::L2Type extends void; 34 | 35 | packet TraCIDemo11pMessage extends BaseFrame1609_4 { 36 | string demoData; 37 | LAddress::L2Type senderAddress = -1; 38 | int serial = 0; 39 | // own data 40 | int senderID; 41 | } 42 | -------------------------------------------------------------------------------- /src/veins/base/utils/winsupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | /** 26 | * @file winsupport.h 27 | * @brief Support for Win32 architectures. 28 | * @author Hermann S. Lichte 29 | * @date 2007-08-14 30 | **/ 31 | 32 | #pragma once 33 | 34 | #ifdef _WIN32 35 | 36 | #include 37 | 38 | #define __const const 39 | 40 | typedef unsigned int uint32_t; 41 | typedef unsigned short uint16_t; 42 | typedef unsigned char uint8_t; 43 | 44 | #endif /* _WIN32 */ 45 | -------------------------------------------------------------------------------- /src/veins/modules/messages/BaseFrame1609_4.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | cplusplus {{ 24 | #include "veins/base/utils/SimpleAddress.h" 25 | }} 26 | 27 | namespace veins; 28 | 29 | class LAddress::L2Type extends void; 30 | 31 | packet BaseFrame1609_4 { 32 | //Channel Number on which this packet was sent 33 | int channelNumber; 34 | //User priority with which this packet was sent (note the AC mapping rules in Mac1609_4::mapUserPriority) 35 | int userPriority = 7; 36 | //Unique number to identify the service 37 | int psid = 0; 38 | //Recipient of frame (-1 for any) 39 | LAddress::L2Type recipientAddress = -1; 40 | } 41 | -------------------------------------------------------------------------------- /src/veins/modules/world/annotations/AnnotationManager.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // AnnotationManager - manages annotations on the OMNeT++ canvas 24 | 25 | package org.car2x.veins.modules.world.annotations; 26 | 27 | // 28 | // manages annotations on the OMNeT++ canvas 29 | // 30 | simple AnnotationManager 31 | { 32 | parameters: 33 | volatile bool draw = default(false); // draw annotations? 34 | xml annotations = default(xml("")); // annotations to add at startup 35 | @display("i=msg/paperclip"); 36 | @labels(node); 37 | @class(veins::AnnotationManager); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/veins/base/modules/IMobility.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.base.modules; 26 | 27 | // Interface for mobility modules 28 | moduleinterface IMobility 29 | { 30 | parameters: 31 | double x; // x coordinate of the nodes' position (-1 = random) 32 | double y; // y coordinate of the nodes' position (-1 = random) 33 | double z; // z coordinate of the nodes' position (-1 = random) 34 | @display("i=block/cogwheel"); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/veins/base/phyLayer/Decider.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #include "veins/base/phyLayer/Decider.h" 26 | 27 | using namespace veins; 28 | 29 | bool DeciderResult::isSignalCorrect() const 30 | { 31 | return isCorrect; 32 | } 33 | 34 | Decider::Decider(cComponent* owner, DeciderToPhyInterface* phy) 35 | : HasLogProxy(owner) 36 | , phy(phy) 37 | , notAgain(-1) 38 | { 39 | } 40 | 41 | simtime_t Decider::processSignal(AirFrame* s) 42 | { 43 | 44 | return -1; 45 | } 46 | -------------------------------------------------------------------------------- /src/veins/modules/nic/INic80211p.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.modules.nic; 26 | 27 | moduleinterface INic80211p 28 | { 29 | @display("i=block/ifcard"); 30 | gates: 31 | input upperLayerIn; // to upper layers 32 | output upperLayerOut; // from upper layers 33 | output upperControlOut; // control information 34 | input upperControlIn; // control information 35 | input radioIn; // radioIn gate for sendDirect 36 | } 37 | -------------------------------------------------------------------------------- /examples/veins/emergencyLane.launchd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/veins/base/messages/BorderMsg.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006 Telecommunication Networks Group (TKN) at Technische Universitaet Berlin, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Daniel Willkomm 24 | // part of: framework implementation developed by tkn 25 | 26 | cplusplus {{ 27 | #include "veins/base/utils/Coord.h" 28 | }} 29 | 30 | namespace veins; 31 | 32 | class noncobject Coord; 33 | 34 | // used as a self packet containing the position, direction and BorderPolicy 35 | // 36 | // @author Daniel Willkomm 37 | // 38 | packet BorderMsg 39 | { 40 | int policy; // border policy to use for the host 41 | Coord startPos; // new start position of the host 42 | Coord direction; // new direction of the host 43 | } 44 | -------------------------------------------------------------------------------- /examples/veins/erlangen.launchd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/makefrag: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Copyright (C) 2017 Rudolf Hornig 4 | # 5 | # Documentation for these modules is at http://veins.car2x.org/ 6 | # 7 | # SPDX-License-Identifier: GPL-2.0-or-later 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | # 23 | 24 | # 25 | # on windows we have to link with the ws2_32 (winsock2) library as it is no longer added to the omnetpp system libraries by default (as of OMNeT++ 5.1) 26 | # copied from INET Framework (inet-3.6.0) makefrag 27 | # 28 | ifeq ($(PLATFORM),win32.x86_64) 29 | LIBS += -lws2_32 30 | DEFINES += -DVEINS_EXPORT 31 | ENABLE_AUTO_IMPORT=-Wl,--enable-auto-import 32 | LDFLAGS := $(filter-out $(ENABLE_AUTO_IMPORT), $(LDFLAGS)) 33 | endif 34 | 35 | VEINS_NEED_MSG4 := $(shell echo ${OMNETPP_VERSION} | grep "^5" >/dev/null 2>&1; echo $$?) 36 | ifneq ($(VEINS_NEED_MSG4),0) 37 | MSGCOPTS += --msg4 38 | endif 39 | 40 | ifeq ($(WITH_OSG), yes) 41 | OMNETPP_LIBS += $(OSG_LIBS) 42 | endif 43 | -------------------------------------------------------------------------------- /src/veins/modules/world/traci/trafficLight/logics/TraCITrafficLightSimpleLogic.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #include "veins/modules/world/traci/trafficLight/logics/TraCITrafficLightSimpleLogic.h" 24 | 25 | using veins::TraCITrafficLightSimpleLogic; 26 | 27 | Define_Module(veins::TraCITrafficLightSimpleLogic); 28 | 29 | void TraCITrafficLightSimpleLogic::handleApplMsg(cMessage* msg) 30 | { 31 | delete msg; // just drop it 32 | } 33 | 34 | void TraCITrafficLightSimpleLogic::handleTlIfMsg(TraCITrafficLightMessage* tlMsg) 35 | { 36 | delete tlMsg; // just drop it 37 | } 38 | 39 | void TraCITrafficLightSimpleLogic::handlePossibleSwitch() 40 | { 41 | // do nothing - just let it happen 42 | } 43 | -------------------------------------------------------------------------------- /src/veins/base/modules/IBaseApplLayer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.base.modules; 26 | 27 | // Interface for application layer modules 28 | moduleinterface IBaseApplLayer 29 | { 30 | parameters: 31 | int headerLength @unit("bit"); // length of the application message header (in bits) 32 | gates: 33 | input lowerLayerIn; // from network layer 34 | output lowerLayerOut; // to network layer 35 | input lowerControlIn; // control from network layer 36 | output lowerControlOut; // control to network layer 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCILauncher.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2016 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | namespace veins { 26 | 27 | /** 28 | * @brief 29 | * Launches a program (the TraCI server) when instantiated. 30 | * 31 | * See the Veins website for a tutorial, documentation, and publications . 32 | * 33 | * @author Christoph Sommer 34 | * 35 | * @see TraCIMobility 36 | * @see TraCIScenarioManager 37 | * 38 | */ 39 | class VEINS_API TraCILauncher { 40 | public: 41 | TraCILauncher(std::string commandLine); 42 | ~TraCILauncher(); 43 | 44 | protected: 45 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) || defined(_WIN64) 46 | #else 47 | pid_t pid; 48 | #endif 49 | }; 50 | 51 | } // namespace veins 52 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/VehicleSignal.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Dominik S. Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/base/utils/EnumBitset.h" 28 | 29 | namespace veins { 30 | 31 | enum class VehicleSignal : uint32_t { 32 | blinker_right, 33 | blinker_left, 34 | blinker_emergency, 35 | brakelight, 36 | frontlight, 37 | foglight, 38 | highbeam, 39 | backdrive, 40 | wiper, 41 | door_open_left, 42 | door_open_right, 43 | emergency_blue, 44 | emergency_red, 45 | emergency_yellow, 46 | undefined 47 | }; 48 | 49 | template <> 50 | struct VEINS_API EnumTraits { 51 | static const VehicleSignal max = VehicleSignal::undefined; 52 | }; 53 | 54 | using VehicleSignalSet = EnumBitset; 55 | 56 | } // namespace veins 57 | -------------------------------------------------------------------------------- /src/veins/visualizer/roads/RoadsOsgVisualizer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.visualizer.roads; 24 | 25 | // 26 | // Simple support module to visualize road network as received via TraCI. 27 | // 28 | // See the Veins website for a tutorial, documentation, and publications . 29 | // 30 | // @author Christoph Sommer 31 | // 32 | // @see TraCIScenarioManager 33 | // 34 | simple RoadsOsgVisualizer 35 | { 36 | parameters: 37 | @display("i=block/segm"); 38 | @class(veins::RoadsOsgVisualizer); 39 | bool enabled = default(true); // whether to enable any of the functionality of this module 40 | string lineColor = default("firebrick4"); // line color of roads 41 | double lineWidth = default(1); // line width of roads 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/veins/base/connectionManager/IChannelAccess.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.base.connectionManager; 24 | 25 | // Common parameters for modules based on ChannelAccess class 26 | moduleinterface IChannelAccess 27 | { 28 | parameters: 29 | double antennaOffsetX @unit("m"); // Offset of antenna position (x direction) with respect to what a BaseMobility module will tell us 30 | double antennaOffsetY @unit("m"); // Offset of antenna position (y direction) with respect to what a BaseMobility module will tell us 31 | double antennaOffsetZ @unit("m"); // Offset of antenna position (z direction) with respect to what a BaseMobility module will tell us 32 | double antennaOffsetYaw @unit("rad"); // Offset of antenna orientation (yaw) with respect to what a BaseMobility module will tell us 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/veins/base/modules/BaseMacLayer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.base.modules; 26 | 27 | // Base module for every mac layer module 28 | simple BaseMacLayer extends BaseLayer like IWirelessMac 29 | { 30 | parameters: 31 | @class(veins::BaseMacLayer); 32 | int headerLength @unit(bit); // length of the MAC packet header (in bits) 33 | string address = default("auto"); // MAC address as hex string (12 hex digits), or 34 | // "auto". "auto" values will be replaced by 35 | // a generated MAC address in init stage 1. 36 | } 37 | -------------------------------------------------------------------------------- /src/veins/modules/messages/Mac80211Pkt.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | // Original author: Marc Loebbers 26 | 27 | cplusplus {{ 28 | #include "veins/base/messages/MacPkt_m.h" 29 | }} 30 | 31 | namespace veins; 32 | 33 | class MacPkt; 34 | 35 | // 36 | // Defines all fields of an 802.11 MAC frame 37 | // 38 | packet Mac80211Pkt extends MacPkt 39 | { 40 | int address3; 41 | int address4; 42 | int fragmentation; //part of the Frame Control field 43 | int informationDS; //part of the Frame Control field 44 | int sequenceControl; 45 | bool retry; 46 | simtime_t duration; //the expected remaining duration the current transaction 47 | } 48 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/TraCIDemoRSU11p.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #include "veins/modules/application/traci/TraCIDemoRSU11p.h" 24 | 25 | #include "veins/modules/application/traci/TraCIDemo11pMessage_m.h" 26 | 27 | using namespace veins; 28 | 29 | Define_Module(veins::TraCIDemoRSU11p); 30 | 31 | void TraCIDemoRSU11p::onWSA(DemoServiceAdvertisment* wsa) 32 | { 33 | // if this RSU receives a WSA for service 42, it will tune to the chan 34 | if (wsa->getPsid() == 42) { 35 | mac->changeServiceChannel(static_cast(wsa->getTargetChannel())); 36 | } 37 | } 38 | 39 | void TraCIDemoRSU11p::onWSM(BaseFrame1609_4* frame) 40 | { 41 | TraCIDemo11pMessage* wsm = check_and_cast(frame); 42 | 43 | // this rsu repeats the received traffic update in 2 seconds plus some random delay 44 | sendDelayedDown(wsm->dup(), 2 + uniform(0.01, 0.2)); 45 | } 46 | -------------------------------------------------------------------------------- /examples/veins/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/veins/modules/analogueModel/PERModel.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #include "veins/modules/analogueModel/PERModel.h" 26 | 27 | #include "veins/base/messages/AirFrame_m.h" 28 | 29 | using namespace veins; 30 | using veins::AirFrame; 31 | 32 | void PERModel::filterSignal(Signal* signal) 33 | { 34 | auto senderPos = signal->getSenderPoa().pos.getPositionAt(); 35 | auto receiverPos = signal->getReceiverPoa().pos.getPositionAt(); 36 | 37 | double attenuationFactor = 1; // no attenuation 38 | if (packetErrorRate > 0 && RNGCONTEXT uniform(0, 1) < packetErrorRate) { 39 | attenuationFactor = 0; // absorb all energy so that the receveir cannot receive anything 40 | } 41 | 42 | *signal *= attenuationFactor; 43 | } 44 | -------------------------------------------------------------------------------- /examples/veins/osm.launchd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/veins/base/utils/NetwToMacControlInfo.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 Fraunhofer-Gesellschaft, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Michael Lindig 24 | 25 | #include "veins/base/utils/NetwToMacControlInfo.h" 26 | 27 | using namespace veins; 28 | 29 | namespace { 30 | 31 | using tNetwToMacControlInfoBase = NetwToMacControlInfo; 32 | 33 | } // namespace 34 | 35 | cObject* const NetwToMacControlInfo::setControlInfo(cMessage* const pMsg, const LAddress::L2Type& pDestAddr) 36 | { 37 | tNetwToMacControlInfoBase* const cCtrlInfo = new tNetwToMacControlInfoBase(); 38 | 39 | cCtrlInfo->setDest(pDestAddr); 40 | pMsg->setControlInfo(cCtrlInfo); 41 | 42 | return cCtrlInfo; 43 | } 44 | 45 | const LAddress::L2Type& NetwToMacControlInfo::getDestFromControlInfo(const cObject* const pCtrlInfo) 46 | { 47 | const tNetwToMacControlInfoBase* const cCtrlInfo = dynamic_cast(pCtrlInfo); 48 | 49 | ASSERT(cCtrlInfo); 50 | return cCtrlInfo->getDest(); 51 | } 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Emergency-Vehicle-V2V-Priority 2 | Master's Degree final thesis project: reduce emergency vehicles travel time using V2V communications in VEINS simulator. 3 | 4 | The aim of my thesis was to design and test new heuristics to reduce emergency vehicles travel time from Modena's Hospital to anywhere in the city. 5 | The considered baseline was the "blue light device" function included in SUMO simulator, which allows Emergency Vehicles to travel disregarding traffic lights and forces vehicles to form a virtual emergency lane. 6 | 7 | Using OMNeT++ I developed custom messages which, when an Emergency Vehicle is at a certain distance, forces the traffic to behave in certain ways (our designed heuristics). 8 | 9 | ![wsmprop](wsmprop.png) 10 | 11 | By editing the TraCIDemo11p.cc file you can choose which heuristic to apply when in range: 12 | 1) Slow down vehicles to a desired speed 13 | 2) Stop vehicles 14 | 3) Force vehicles to change lanes 15 | 16 | Finally you can combine those behaviours to further improve results. 17 | 18 | We tested the heuristics in four different scenarios, from low to very high traffic (350, 600, 1200, 2000 vehicles) to verify both flexibility of usecases and the robustness of the solutions. 19 | 20 | Overall in low and medium traffic scenarios we saw an improvement of 34.63% and 76.04% respectively, achieving up to 44.97% and 80.37% improvement in all scenarios using the Slow Down function set to 30km/h. 21 | 22 | ![confronto3new](confronto3new.png) 23 | ![slowdown1530](slowdown1530.png) 24 | 25 | The example provided is set in Modena, but you can use any map you want by simple changing the OSM files (and remember to set the traffic you desire). 26 | 27 | To use the project you simply need to extract all the files provided in this repository inside your VEINS installation folder, no need for further steps. Just remember to make a backup of your src and examples folder. 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIScenarioManagerLaunchd.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2012 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.mobility.traci; 24 | 25 | // 26 | // Extends the TraCIScenarioManager for use with sumo-launchd.py and SUMO. 27 | // 28 | // Connects to a running instance of the sumo-launchd.py script 29 | // to automatically launch/kill SUMO when the simulation starts/ends. 30 | // 31 | // All other functionality is provided by the TraCIScenarioManager. 32 | // 33 | // See the Veins website for a tutorial, documentation, and publications . 34 | // 35 | // @author Christoph Sommer, David Eckhoff 36 | // 37 | // @see TraCIMobility 38 | // @see TraCIScenarioManager 39 | // 40 | 41 | simple TraCIScenarioManagerLaunchd extends TraCIScenarioManager 42 | { 43 | parameters: 44 | @class(veins::TraCIScenarioManagerLaunchd); 45 | xml launchConfig; // launch configuration to send to sumo-launchd.py 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/veins/modules/utility/MacToPhyControlInfo11p.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018-2019 Dominik S. Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/modules/utility/ConstsPhy.h" 28 | #include "veins/modules/utility/Consts80211p.h" 29 | 30 | namespace veins { 31 | 32 | /** 33 | * Stores information which is needed by the physical layer 34 | * when sending a MacPkt. 35 | * 36 | * @ingroup phyLayer 37 | * @ingroup macLayer 38 | */ 39 | struct VEINS_API MacToPhyControlInfo11p : public cObject { 40 | Channel channelNr; ///< Channel number/index used to select frequency. 41 | MCS mcs; ///< The modulation and coding scheme to employ for the associated frame. 42 | double txPower_mW; ///< Transmission power in milliwatts. 43 | 44 | MacToPhyControlInfo11p(Channel channelNr, MCS mcs, double txPower_mW) 45 | : channelNr(channelNr) 46 | , mcs(mcs) 47 | , txPower_mW(txPower_mW) 48 | { 49 | } 50 | }; 51 | 52 | } // namespace veins 53 | -------------------------------------------------------------------------------- /src/veins/base/messages/MacPkt.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2004 Telecommunication Networks Group (TKN) at Technische Universitaet Berlin, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Daniel Willkomm 24 | // part of: framework implementation developed by tkn 25 | // description: - base class for MAC layer packets 26 | // - subclass to create your own MAC layer packets 27 | 28 | cplusplus {{ 29 | #include "veins/base/utils/SimpleAddress.h" 30 | }} 31 | 32 | namespace veins; 33 | 34 | class LAddress::L2Type extends void; 35 | 36 | // A basic MAC (Media Access Control) packet format definition 37 | // 38 | // subclass if you want to create your own MAC layer packet class 39 | // 40 | // The basic MAC packet only provides source and destination address 41 | // 42 | // @author Daniel Willkomm 43 | packet MacPkt 44 | { 45 | LAddress::L2Type destAddr; // destination mac address 46 | LAddress::L2Type srcAddr; // source mac address 47 | long sequenceId; // Sequence Number to detect duplicate messages 48 | } 49 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/MyVeinsApp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/modules/application/ieee80211p/DemoBaseApplLayer.h" 28 | 29 | using namespace omnetpp; 30 | 31 | namespace veins { 32 | 33 | /** 34 | * @brief 35 | * This is a stub for a typical Veins application layer. 36 | * Most common functions are overloaded. 37 | * See MyVeinsApp.cc for hints 38 | * 39 | * @author David Eckhoff 40 | * 41 | */ 42 | 43 | class VEINS_API MyVeinsApp : public DemoBaseApplLayer { 44 | public: 45 | void initialize(int stage) override; 46 | void finish() override; 47 | 48 | protected: 49 | void onBSM(DemoSafetyMessage* bsm) override; 50 | void onWSM(BaseFrame1609_4* wsm) override; 51 | void onWSA(DemoServiceAdvertisment* wsa) override; 52 | 53 | void handleSelfMsg(cMessage* msg) override; 54 | void handlePositionUpdate(cObject* obj) override; 55 | }; 56 | 57 | } // namespace veins 58 | -------------------------------------------------------------------------------- /src/veins/modules/mac/ieee80211p/DemoBaseApplLayerToMac1609_4Interface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/base/utils/NetwToMacControlInfo.h" 26 | #include "veins/modules/utility/Consts80211p.h" 27 | 28 | namespace veins { 29 | 30 | /** 31 | * @brief 32 | * Interface between DemoBaseApplLayer Layer and Mac1609_4 33 | * 34 | * @author David Eckhoff 35 | * 36 | * @ingroup macLayer 37 | */ 38 | class VEINS_API DemoBaseApplLayerToMac1609_4Interface { 39 | public: 40 | virtual bool isChannelSwitchingActive() = 0; 41 | 42 | virtual simtime_t getSwitchingInterval() = 0; 43 | 44 | virtual bool isCurrentChannelCCH() = 0; 45 | 46 | virtual void changeServiceChannel(Channel channelNumber) = 0; 47 | 48 | virtual ~DemoBaseApplLayerToMac1609_4Interface(){}; 49 | 50 | /** 51 | * @brief Returns the MAC address of this MAC module. 52 | */ 53 | virtual const LAddress::L2Type& getMACAddress() = 0; 54 | }; 55 | 56 | } // namespace veins 57 | -------------------------------------------------------------------------------- /src/veins/visualizer/roads/RoadsCanvasVisualizer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.visualizer.roads; 24 | 25 | // 26 | // Simple support module to visualize road network as received via TraCI. 27 | // 28 | // See the Veins website for a tutorial, documentation, and publications . 29 | // 30 | // @author Christoph Sommer 31 | // 32 | // @see TraCIScenarioManager 33 | // 34 | simple RoadsCanvasVisualizer 35 | { 36 | parameters: 37 | @display("i=block/segm"); 38 | @class(veins::RoadsCanvasVisualizer); 39 | bool enabled = default(true); // whether to enable any of the functionality of this module 40 | double lineZIndex = default(-1); // z-index of all lines 41 | string lineColor = default("firebrick4"); // line color of roads 42 | double lineWidth = default(1); // line width of roads 43 | bool lineWidthZoom = default(false); // whether zooming should affect line width 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/veins/base/modules/BaseLayer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.base.modules; 26 | 27 | // 28 | // Base module for all layer modules. Defines the in and out gates 29 | // 30 | simple BaseLayer 31 | { 32 | parameters: 33 | @class(veins::BaseLayer); 34 | bool notAffectedByHostState = default(false); 35 | 36 | gates: 37 | input upperLayerIn; // from upper layer 38 | output upperLayerOut; // to uppe layer 39 | input upperControlIn; // control from upper layer 40 | output upperControlOut; // control to upper layer 41 | input lowerLayerIn; // from lower layer 42 | output lowerLayerOut; // to lower layer 43 | input lowerControlIn; // control from lower layer 44 | output lowerControlOut; // control to lower layer 45 | } 46 | -------------------------------------------------------------------------------- /src/veins/modules/phy/PhyLayer80211p.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.phy; 24 | 25 | import org.car2x.veins.base.phyLayer.BasePhyLayer; 26 | 27 | // 28 | // Adaptation of the PhyLayer class for 802.11p. 29 | // 30 | // @see DemoBaseApplLayer 31 | // @see Nic80211p 32 | // @see Mac1609_4 33 | // 34 | simple PhyLayer80211p extends BasePhyLayer 35 | { 36 | parameters: 37 | @class(veins::PhyLayer80211p); 38 | antennaOffsetZ = default(1.895 m); 39 | //defines the CCA threshold 40 | double ccaThreshold @unit(dBm) = default(-65 dBm); 41 | //enables/disables collection of statistics about collision. notice that 42 | //enabling this feature increases simulation time 43 | bool collectCollisionStatistics = default(false); 44 | //decides whether aborting the simulation or not if the MAC layer 45 | //requires phy to transmit a frame while currently receiveing another 46 | bool allowTxDuringRx = default(false); 47 | } 48 | -------------------------------------------------------------------------------- /src/veins/modules/messages/TraCITrafficLightMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | namespace veins; 24 | 25 | class DemoSafetyMessage; 26 | enum TrafficLightAtrributeType { 27 | NONE = 0; 28 | LOGICID = 1; 29 | PHASEID = 2; 30 | SWITCHTIME = 3; 31 | STATE = 4; 32 | }; 33 | 34 | enum TrafficLightChangeSource { 35 | UNKNOWN = 0; 36 | SUMO = 1; 37 | LOGIC = 2; 38 | RSU = 3;//If an RSU tries to change the values 39 | }; 40 | 41 | // NOTE: Currently only supports changes of the IDs (due to variation in field types) 42 | message TraCITrafficLightMessage { 43 | // traffic light id 44 | string tlId; 45 | // what field/attrbute of the traffic light changed? 46 | int changedAttribute @enum(TrafficLightAtrributeType); 47 | // value before the change 48 | string oldValue; 49 | // value that is to be set / was newly set 50 | string newValue; 51 | // where did the change originate 52 | int changeSource @enum(TrafficLightChangeSource); 53 | }; 54 | -------------------------------------------------------------------------------- /src/veins/base/toolbox/Spectrum.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Fabian Bronner 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "veins/veins.h" 35 | 36 | namespace veins { 37 | 38 | class VEINS_API Spectrum { 39 | public: 40 | using Frequency = double; 41 | using Frequencies = std::vector; 42 | 43 | Spectrum() = default; 44 | Spectrum(Frequencies freqs); 45 | 46 | const double& operator[](size_t index) const; 47 | 48 | size_t getNumFreqs() const; 49 | 50 | size_t indexOf(double freq) const; 51 | 52 | double freqAt(size_t freqIndex) const; 53 | 54 | friend bool VEINS_API operator==(const Spectrum& lhs, const Spectrum& rhs); 55 | 56 | friend std::ostream& VEINS_API operator<<(std::ostream& os, const Spectrum& s); 57 | 58 | private: 59 | Frequencies frequencies; 60 | }; 61 | 62 | } // namespace veins 63 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/LinearMobility.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2005 Emin Ilker Cetinbas 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // Author: Emin Ilker Cetinbas (niw3_at_yahoo_d0t_com) 24 | 25 | package org.car2x.veins.modules.mobility; 26 | 27 | import org.car2x.veins.base.modules.BaseMobility; 28 | 29 | // 30 | // This is a linear mobility model with speed, angle and acceleration parameters. 31 | // Angle only changes when the mobile node hits a wall: then it reflects 32 | // off the wall at the same angle. 33 | // 34 | // NOTE: Does not yet support 3-dimensional movement. 35 | // @see ConnectionManager 36 | // @author Emin Ilker Cetinbas 37 | // 38 | simple LinearMobility extends BaseMobility 39 | { 40 | parameters: 41 | @class(veins::LinearMobility); 42 | double speed @unit(mps); // speed of the host (in m/s) 43 | double angle @unit(deg); // angle of linear motion (degreees) 44 | double acceleration @unit(mpss); // acceleration of linear motion (m/s2) 45 | double updateInterval @unit(s); // time interval to update the hosts position (seconds) 46 | } 47 | 48 | -------------------------------------------------------------------------------- /examples/veins/erlangen.rou.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/veins/modules/analogueModel/SimpleObstacleShadowing.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #include "veins/modules/analogueModel/SimpleObstacleShadowing.h" 24 | 25 | using namespace veins; 26 | 27 | using veins::AirFrame; 28 | 29 | SimpleObstacleShadowing::SimpleObstacleShadowing(cComponent* owner, ObstacleControl& obstacleControl, bool useTorus, const Coord& playgroundSize) 30 | : AnalogueModel(owner) 31 | , obstacleControl(obstacleControl) 32 | , useTorus(useTorus) 33 | , playgroundSize(playgroundSize) 34 | { 35 | if (useTorus) throw cRuntimeError("SimpleObstacleShadowing does not work on torus-shaped playgrounds"); 36 | } 37 | 38 | void SimpleObstacleShadowing::filterSignal(Signal* signal) 39 | { 40 | auto senderPos = signal->getSenderPoa().pos.getPositionAt(); 41 | auto receiverPos = signal->getReceiverPoa().pos.getPositionAt(); 42 | 43 | double factor = obstacleControl.calculateAttenuation(senderPos, receiverPos); 44 | 45 | EV_TRACE << "value is: " << factor << endl; 46 | 47 | *signal *= factor; 48 | } 49 | -------------------------------------------------------------------------------- /src/veins/visualizer/roads/RoadsCanvasVisualizer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/base/utils/Coord.h" 28 | #include "veins/modules/utility/SignalManager.h" 29 | 30 | namespace veins { 31 | 32 | /** 33 | * @brief 34 | * Simple support module to visualize road network as received via TraCI. 35 | * 36 | * See the Veins website for a tutorial, documentation, and publications . 37 | * 38 | * @author Christoph Sommer 39 | * 40 | * @see TraCIScenarioManager 41 | * 42 | */ 43 | class VEINS_API RoadsCanvasVisualizer : public cSimpleModule { 44 | public: 45 | void initialize(int stage) override; 46 | void handleMessage(cMessage* msg) override; 47 | void finish() override; 48 | 49 | protected: 50 | veins::SignalManager signalManager; 51 | cGroupFigure* figures; 52 | 53 | cPolylineFigure* createLine(const std::list& coords, cFigure::Color color, double width, bool zoom); 54 | }; 55 | 56 | } // namespace veins 57 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIVehicleInserter.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.mobility.traci; 24 | 25 | // 26 | // Uses the TraCIScenarioManager to programmatically insert new vehicles at the TraCI server. 27 | // 28 | // This is done whenever the total number of active vehicles drops below a given number. 29 | // 30 | // See the Veins website for a tutorial, documentation, and publications . 31 | // 32 | // @author Christoph Sommer, David Eckhoff, Falko Dressler, Zheng Yao, Tobias Mayer, Alvaro Torres Cortes, Luca Bedogni 33 | // 34 | // @see TraCIScenarioManager 35 | // 36 | 37 | simple TraCIVehicleInserter 38 | { 39 | parameters: 40 | @display("i=block/source"); 41 | @class(veins::TraCIVehicleInserter); 42 | 43 | int numVehicles = default(0); 44 | bool useRouteDistributions = default(false); 45 | int vehicleRngIndex = default(0); // index of the RNG stream to be used, all random numbers concerning the managed vehicles 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/veins/base/modules/BaseWorldUtility.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.base.modules; 26 | 27 | // Basic utility module for the whole network. 28 | // Provides utility methods and information used by 29 | // the whole network as well as simulation wide 30 | // black board functionality. 31 | simple BaseWorldUtility 32 | { 33 | parameters: 34 | @class(veins::BaseWorldUtility); 35 | double playgroundSizeX @unit(m); // x size of the area the nodes are in (in meters) 36 | double playgroundSizeY @unit(m); // y size of the area the nodes are in (in meters) 37 | double playgroundSizeZ @unit(m); // z size of the area the nodes are in (in meters) 38 | bool useTorus = default(false); // use the playground as torus? 39 | bool use2D = default(false); // use a 2-dimensional world? 40 | @display("i=misc/globe"); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/veins/modules/mac/ieee80211p/Mac80211pToPhy11pInterface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/base/phyLayer/MacToPhyInterface.h" 26 | #include "veins/modules/utility/ConstsPhy.h" 27 | #include "veins/modules/utility/Consts80211p.h" 28 | 29 | namespace veins { 30 | 31 | /** 32 | * @brief 33 | * Interface of PhyLayer80211p exposed to Mac1609_4. 34 | * 35 | * @author Christopher Saloman 36 | * @author David Eckhoff 37 | * 38 | * @ingroup phyLayer 39 | */ 40 | class VEINS_API Mac80211pToPhy11pInterface { 41 | public: 42 | enum BasePhyMessageKinds { 43 | CHANNEL_IDLE, 44 | CHANNEL_BUSY, 45 | }; 46 | 47 | virtual ~Mac80211pToPhy11pInterface() = default; 48 | 49 | virtual void changeListeningChannel(Channel channel) = 0; 50 | virtual void setCCAThreshold(double ccaThreshold_dBm) = 0; 51 | virtual void notifyMacAboutRxStart(bool enable) = 0; 52 | virtual void requestChannelStatusIfIdle() = 0; 53 | virtual simtime_t getFrameDuration(int payloadLengthBits, MCS mcs) const = 0; 54 | }; 55 | 56 | } // namespace veins 57 | -------------------------------------------------------------------------------- /src/veins/base/connectionManager/NicEntryDirect.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2005 Telecommunication Networks Group (TKN) at Technische Universitaet Berlin, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Daniel Willkomm 24 | // part of: framework implementation developed by tkn 25 | // description: Class to store information about a nic for the 26 | // ConnectionManager module 27 | 28 | #include "veins/base/connectionManager/NicEntryDirect.h" 29 | #include "veins/base/connectionManager/ChannelAccess.h" 30 | 31 | using std::endl; 32 | using namespace veins; 33 | 34 | void NicEntryDirect::connectTo(NicEntry* other) 35 | { 36 | cModule* otherPtr = other->nicPtr; 37 | 38 | EV_TRACE << "connecting nic #" << nicId << " and #" << other->nicId << endl; 39 | 40 | cGate* radioGate = nullptr; 41 | if ((radioGate = otherPtr->gate("radioIn")) == nullptr) throw cRuntimeError("Nic has no radioIn gate!"); 42 | 43 | outConns[other] = radioGate->getPathStartGate(); 44 | } 45 | 46 | void NicEntryDirect::disconnectFrom(NicEntry* other) 47 | { 48 | EV_TRACE << "disconnecting nic #" << nicId << " and #" << other->nicId << endl; 49 | outConns.erase(other); 50 | } 51 | -------------------------------------------------------------------------------- /src/veins/modules/world/traci/trafficLight/logics/TraCITrafficLightSimpleLogic.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/base/utils/FindModule.h" 28 | #include "veins/modules/world/traci/trafficLight/logics/TraCITrafficLightAbstractLogic.h" 29 | #include "veins/modules/world/traci/trafficLight/TraCITrafficLightInterface.h" 30 | 31 | namespace veins { 32 | class VEINS_API TraCITrafficLightSimpleLogic : public TraCITrafficLightAbstractLogic { 33 | 34 | public: 35 | using signalScheme = std::string; 36 | 37 | protected: 38 | void handleApplMsg(cMessage* msg) override; 39 | void handleTlIfMsg(TraCITrafficLightMessage* tlMsg) override; 40 | void handlePossibleSwitch() override; 41 | }; 42 | 43 | class VEINS_API TraCITrafficLightSimpleLogicAccess { 44 | public: 45 | TraCITrafficLightSimpleLogic* get(cModule* host) 46 | { 47 | TraCITrafficLightSimpleLogic* traci = FindModule::findSubModule(host); 48 | ASSERT(traci); 49 | return traci; 50 | }; 51 | }; 52 | 53 | } // namespace veins 54 | -------------------------------------------------------------------------------- /src/veins/modules/world/traci/trafficLight/TraCITrafficLightProgram.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #include "veins/modules/world/traci/trafficLight/TraCITrafficLightProgram.h" 24 | 25 | using veins::TraCITrafficLightProgram; 26 | 27 | bool TraCITrafficLightProgram::Phase::isGreenPhase() const 28 | { 29 | // implementation taken from SUMO MSPhaseDefinition.cc 30 | if (state.find_first_of("gG") == std::string::npos) { 31 | return false; 32 | } 33 | if (state.find_first_of("yY") != std::string::npos) { 34 | return false; 35 | } 36 | return true; 37 | } 38 | 39 | TraCITrafficLightProgram::TraCITrafficLightProgram(std::string id) 40 | : id(id) 41 | , logics() 42 | { 43 | } 44 | 45 | void TraCITrafficLightProgram::addLogic(const Logic& logic) 46 | { 47 | logics[logic.id] = logic; 48 | } 49 | 50 | TraCITrafficLightProgram::Logic TraCITrafficLightProgram::getLogic(const std::string& lid) const 51 | { 52 | return logics.at(lid); 53 | } 54 | 55 | bool TraCITrafficLightProgram::hasLogic(const std::string& lid) const 56 | { 57 | return logics.find(lid) != logics.end(); 58 | } 59 | -------------------------------------------------------------------------------- /src/veins/base/connectionManager/ConnectionManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #pragma once 26 | 27 | #include "veins/veins.h" 28 | 29 | #include "veins/base/connectionManager/BaseConnectionManager.h" 30 | 31 | namespace veins { 32 | 33 | /** 34 | * @brief BaseConnectionManager implementation which only defines a 35 | * specific max interference distance. 36 | * 37 | * Calculates the maximum interference distance based on the transmitter 38 | * power, wavelength, pathloss coefficient and a threshold for the 39 | * minimal receive Power. 40 | * 41 | * @ingroup connectionManager 42 | */ 43 | class VEINS_API ConnectionManager : public BaseConnectionManager { 44 | protected: 45 | /** 46 | * @brief Calculate interference distance 47 | * 48 | * You may want to overwrite this function in order to do your own 49 | * interference calculation 50 | */ 51 | double calcInterfDist() override; 52 | }; 53 | 54 | } // namespace veins 55 | -------------------------------------------------------------------------------- /src/veins/visualizer/roads/RoadsOsgVisualizer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #ifdef WITH_OSG 26 | #include 27 | #endif // WITH_OSG 28 | 29 | #include "veins/veins.h" 30 | 31 | #include "veins/base/utils/Coord.h" 32 | #include "veins/modules/utility/SignalManager.h" 33 | 34 | namespace veins { 35 | 36 | /** 37 | * @brief 38 | * Simple support module to visualize road network as received via TraCI. 39 | * 40 | * See the Veins website for a tutorial, documentation, and publications . 41 | * 42 | * @author Christoph Sommer 43 | * 44 | * @see TraCIScenarioManager 45 | * 46 | */ 47 | class VEINS_API RoadsOsgVisualizer : public cSimpleModule { 48 | public: 49 | void initialize(int stage) override; 50 | #ifdef WITH_OSG 51 | void handleMessage(cMessage* msg) override; 52 | void finish() override; 53 | 54 | protected: 55 | veins::SignalManager signalManager; 56 | osg::Group* figures; 57 | 58 | osg::Geode* createLine(const std::list& coords, cFigure::Color color, double width); 59 | #endif // WITH_OSG 60 | }; 61 | 62 | } // namespace veins 63 | -------------------------------------------------------------------------------- /src/veins/base/modules/BaseApplLayer.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2004 Telecommunication Networks Group (TKN) at Technische Universitaet Berlin, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Daniel Willkomm 24 | // part of: framework implementation developed by tkn 25 | // description: application layer: general class for the application layer 26 | // subclass to create your own application layer 27 | 28 | #include "veins/base/modules/BaseApplLayer.h" 29 | #include "veins/base/utils/PassedMessage.h" 30 | 31 | using namespace veins; 32 | 33 | /** 34 | * First we have to initialize the module from which we derived ours, 35 | * in this case BaseLayer. 36 | * 37 | * Then we have to intialize the gates and - if necessary - some own 38 | * variables. 39 | **/ 40 | void BaseApplLayer::initialize(int stage) 41 | { 42 | BaseLayer::initialize(stage); 43 | if (stage == 0) { 44 | headerLength = par("headerLength"); 45 | } 46 | } 47 | 48 | /** 49 | * Send message down to lower layer 50 | **/ 51 | void BaseApplLayer::sendDelayedDown(cMessage* msg, simtime_t_cref delay) 52 | { 53 | recordPacket(PassedMessage::OUTGOING, PassedMessage::LOWER_DATA, msg); 54 | sendDelayed(msg, delay, lowerLayerOut); 55 | } 56 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIScreenRecorder.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2014 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | namespace veins { 28 | 29 | /** 30 | * @brief 31 | * Simple support module to take (a series of) screenshots of a simulation running in the TraCI server. 32 | * 33 | * Note that the TraCI server needs to be run in GUI mode and support taking screenshots for this to work. 34 | * 35 | * The screenshots can then be converted to a video using something along the lines of 36 | * mencoder 'mf://results/screenshot-*.png' -mf w=800:h=600:fps=25:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi 37 | * 38 | * See the Veins website for a tutorial, documentation, and publications . 39 | * 40 | * @author Christoph Sommer 41 | * 42 | * @see TraCIScenarioManager 43 | * 44 | */ 45 | class VEINS_API TraCIScreenRecorder : public cSimpleModule { 46 | public: 47 | void initialize(int stage) override; 48 | void handleMessage(cMessage* msg) override; 49 | void finish() override; 50 | 51 | protected: 52 | cMessage* takeScreenshot; 53 | }; 54 | 55 | } // namespace veins 56 | -------------------------------------------------------------------------------- /src/veins/modules/world/traci/trafficLight/logics/TraCITrafficLightAbstractLogic.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/modules/messages/TraCITrafficLightMessage_m.h" 28 | 29 | namespace veins { 30 | using omnetpp::cMessage; 31 | using omnetpp::cSimpleModule; 32 | 33 | /** 34 | * Base class to simplify implementation of traffic light logics 35 | * 36 | * already provides multiplexing of different message types to message handlers and a 37 | * special handler to be executed right before the TraCI server performs a phase switch 38 | */ 39 | class VEINS_API TraCITrafficLightAbstractLogic : public cSimpleModule { 40 | public: 41 | TraCITrafficLightAbstractLogic(); 42 | ~TraCITrafficLightAbstractLogic() override; 43 | 44 | protected: 45 | cMessage* switchTimer; 46 | 47 | void initialize() override; 48 | void handleMessage(cMessage* msg) override; 49 | virtual void handleSelfMsg(cMessage* msg); 50 | virtual void handleApplMsg(cMessage* msg) = 0; 51 | virtual void handleTlIfMsg(TraCITrafficLightMessage* tlMsg) = 0; 52 | virtual void handlePossibleSwitch() = 0; 53 | }; 54 | 55 | } // namespace veins 56 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/LinearMobility.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2005 Emin Ilker Cetinbas 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Emin Ilker Cetinbas (niw3_at_yahoo_d0t_com) 24 | // part of: framework implementation developed by tkn 25 | 26 | #pragma once 27 | 28 | #include "veins/base/modules/BaseMobility.h" 29 | 30 | namespace veins { 31 | 32 | /** 33 | * @brief Linear movement model. See NED file for more info. 34 | * 35 | * This mobility module expects a torus as playground ("useTorus" 36 | * Parameter of BaseWorldUtility module). 37 | * 38 | * NOTE: Does not yet support 3-dimensional movement. 39 | * @ingroup mobility 40 | * @author Emin Ilker Cetinbas 41 | */ 42 | class VEINS_API LinearMobility : public BaseMobility { 43 | protected: 44 | double angle; ///< angle of linear motion 45 | double acceleration; ///< acceleration of linear motion 46 | 47 | /** @brief always stores the last step for position display update */ 48 | Coord stepTarget; 49 | 50 | public: 51 | /** @brief Initializes mobility model parameters.*/ 52 | void initialize(int) override; 53 | 54 | protected: 55 | /** @brief Move the host*/ 56 | void makeMove() override; 57 | 58 | void fixIfHostGetsOutside() override; 59 | }; 60 | 61 | } // namespace veins 62 | -------------------------------------------------------------------------------- /src/veins/nodes/RSU.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2008 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.nodes; 24 | 25 | import org.car2x.veins.base.modules.BaseMobility; 26 | 27 | 28 | module RSU 29 | { 30 | parameters: 31 | string applType; //type of the application layer 32 | string nicType = default("Nic80211p"); // type of network interface card 33 | gates: 34 | input veinsradioIn; // gate for sendDirect 35 | submodules: 36 | appl: like org.car2x.veins.base.modules.IBaseApplLayer { 37 | parameters: 38 | @display("p=60,50"); 39 | } 40 | 41 | nic: like org.car2x.veins.modules.nic.INic80211p { 42 | parameters: 43 | @display("p=60,166"); 44 | } 45 | 46 | mobility: BaseMobility { 47 | parameters: 48 | @display("p=130,172;i=block/cogwheel"); 49 | } 50 | 51 | connections: 52 | nic.upperLayerOut --> appl.lowerLayerIn; 53 | nic.upperLayerIn <-- appl.lowerLayerOut; 54 | nic.upperControlOut --> appl.lowerControlIn; 55 | nic.upperControlIn <-- appl.lowerControlOut; 56 | 57 | veinsradioIn --> nic.radioIn; 58 | } 59 | -------------------------------------------------------------------------------- /examples/veins/erlangen.sumo.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIScenarioManagerForker.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2016 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.mobility.traci; 24 | 25 | // 26 | // Extends the TraCIScenarioManager to automatically fork an instance of SUMO when needed. 27 | // 28 | // All other functionality is provided by the TraCIScenarioManager. 29 | // 30 | // See the Veins website for a tutorial, documentation, and publications . 31 | // 32 | // @author Christoph Sommer, Florian Hagenauer 33 | // 34 | // @see TraCIMobility 35 | // @see TraCIScenarioManager 36 | // 37 | simple TraCIScenarioManagerForker extends TraCIScenarioManager 38 | { 39 | parameters: 40 | @class(veins::TraCIScenarioManagerForker); 41 | string commandLine = default("$command --remote-port $port --seed $seed --configuration-file $configFile"); // command line for running TraCI server (substituting $command, $configFile, $seed, $port) 42 | string command = default("sumo"); // substitution for $command parameter 43 | string configFile = default("my.sumo.cfg"); // substitution for $configFile parameter 44 | port = default(-1); // substitution for $port parameter (-1: automatic) 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/veins/modules/analogueModel/PERModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #pragma once 26 | 27 | #include "veins/veins.h" 28 | 29 | #include "veins/base/phyLayer/AnalogueModel.h" 30 | 31 | using veins::AirFrame; 32 | 33 | namespace veins { 34 | 35 | /** 36 | * @brief This class applies a parameterized packet error rate 37 | * to incoming packets. This allows the user to easily 38 | * study the robustness of its system to packet loss. 39 | * 40 | * @ingroup analogueModels 41 | * 42 | * @author Jérôme Rousselot 43 | */ 44 | class VEINS_API PERModel : public AnalogueModel { 45 | protected: 46 | double packetErrorRate; 47 | 48 | public: 49 | /** @brief The PERModel constructor takes as argument the packet error rate to apply (must be between 0 and 1). */ 50 | PERModel(cComponent* owner, double per) 51 | : AnalogueModel(owner) 52 | , packetErrorRate(per) 53 | { 54 | ASSERT(per <= 1 && per >= 0); 55 | } 56 | 57 | void filterSignal(Signal*) override; 58 | }; 59 | 60 | } // namespace veins 61 | -------------------------------------------------------------------------------- /src/veins/base/modules/BaseMobility.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.base.modules; 26 | 27 | // Module which is responsible for mobility 28 | // related information like position and movement 29 | // BaseMobility itself defines a static mobility 30 | // pattern (means only a position, no movement). 31 | // Mobility modules which extend from this module 32 | // will define more complex movement patterns. 33 | simple BaseMobility like IMobility 34 | { 35 | parameters: 36 | @class(veins::BaseMobility); 37 | bool notAffectedByHostState = default(true); 38 | double x; // x coordinate of the nodes' position (-1 = random) 39 | double y; // y coordinate of the nodes' position (-1 = random) 40 | double z; // z coordinate of the nodes' position (-1 = random) 41 | double xOrientation = default(1); 42 | double yOrientation = default(0); 43 | double zOrientation = default(0); 44 | @signal[org_car2x_veins_base_modules_mobilityStateChanged](type="veins::BaseMobility"); 45 | @display("i=block/cogwheel"); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/veins/base/connectionManager/ConnectionManager.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #include "veins/base/connectionManager/ConnectionManager.h" 26 | 27 | #include 28 | 29 | #include "veins/base/modules/BaseWorldUtility.h" 30 | 31 | using namespace veins; 32 | 33 | Define_Module(veins::ConnectionManager); 34 | 35 | double ConnectionManager::calcInterfDist() 36 | { 37 | /* With the introduction of antenna models, calculating the maximum 38 | * interference distance only based on free space loss doesn't make any sense 39 | * any more as it could also be much bigger due to positive antenna gains. 40 | * Therefore, the user has to provide a reasonable maximum interference 41 | * distance himself. */ 42 | if (hasPar("maxInterfDist")) { 43 | double interfDistance = par("maxInterfDist").doubleValue(); 44 | EV_INFO << "max interference distance:" << interfDistance << endl; 45 | return interfDistance; 46 | } 47 | else { 48 | throw cRuntimeError("ConnectionManager: No value for maximum interference distance (maxInterfDist) provided."); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/veins/base/modules/IWirelessMac.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | package org.car2x.veins.base.modules; 26 | 27 | // Base module for every mac layer module 28 | moduleinterface IWirelessMac 29 | { 30 | parameters: 31 | @class(veins::BaseMacLayer); 32 | int headerLength @unit(bit); // length of the MAC packet header (in bits) 33 | string address; // MAC address as hex string (12 hex digits), or 34 | // "auto". "auto" values will be replaced by 35 | // a generated MAC address in init stage 1. 36 | 37 | gates: 38 | input upperLayerIn; // from upper layer 39 | output upperLayerOut; // to uppe layer 40 | input upperControlIn; // control from upper layer 41 | output upperControlOut; // control to upper layer 42 | input lowerLayerIn; // from lower layer 43 | output lowerLayerOut; // to lower layer 44 | input lowerControlIn; // control from lower layer 45 | output lowerControlOut; // control to lower layer 46 | } 47 | -------------------------------------------------------------------------------- /examples/veins/emergencyLane.net.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/veins/nodes/Car.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2008 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.nodes; 24 | 25 | module Car 26 | { 27 | parameters: 28 | string applType; //type of the application layer 29 | string nicType = default("Nic80211p"); // type of network interface card 30 | string veinsmobilityType = default("org.car2x.veins.modules.mobility.traci.TraCIMobility"); //type of the mobility module 31 | gates: 32 | input veinsradioIn; // gate for sendDirect 33 | submodules: 34 | appl: like org.car2x.veins.base.modules.IBaseApplLayer { 35 | parameters: 36 | @display("p=60,50"); 37 | } 38 | 39 | nic: like org.car2x.veins.modules.nic.INic80211p { 40 | parameters: 41 | @display("p=60,166"); 42 | } 43 | 44 | veinsmobility: like org.car2x.veins.base.modules.IMobility { 45 | parameters: 46 | @display("p=130,172;i=block/cogwheel"); 47 | } 48 | 49 | connections: 50 | nic.upperLayerOut --> appl.lowerLayerIn; 51 | nic.upperLayerIn <-- appl.lowerLayerOut; 52 | nic.upperControlOut --> appl.lowerControlIn; 53 | nic.upperControlIn <-- appl.lowerControlOut; 54 | 55 | veinsradioIn --> nic.radioIn; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/veins/modules/analogueModel/NakagamiFading.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015 David Eckhoff 3 | // Christoph Sommer 4 | // 5 | // Documentation for these modules is at http://veins.car2x.org/ 6 | // 7 | // SPDX-License-Identifier: GPL-2.0-or-later 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | // 23 | 24 | #pragma once 25 | 26 | #include "veins/base/phyLayer/AnalogueModel.h" 27 | #include "veins/base/modules/BaseWorldUtility.h" 28 | #include "veins/base/messages/AirFrame_m.h" 29 | 30 | namespace veins { 31 | 32 | /** 33 | * @brief 34 | * A simple model to account for fast fading using the Nakagami Distribution. 35 | * 36 | * See the Veins website for a tutorial, documentation, and publications . 37 | * 38 | * An in-depth description of the model is available at: 39 | * Todo: add paper 40 | * 41 | * @author David Eckhoff, Christoph Sommer 42 | * 43 | * @ingroup analogueModels 44 | */ 45 | class VEINS_API NakagamiFading : public AnalogueModel { 46 | 47 | public: 48 | NakagamiFading(cComponent* owner, bool constM, double m) 49 | : AnalogueModel(owner) 50 | , constM(constM) 51 | , m(m) 52 | { 53 | } 54 | 55 | ~NakagamiFading() override 56 | { 57 | } 58 | 59 | void filterSignal(Signal* signal) override; 60 | 61 | protected: 62 | /** @brief Whether to use a constant m or a m based on distance */ 63 | bool constM; 64 | 65 | /** @brief The value of the coefficient m */ 66 | double m; 67 | }; 68 | 69 | } // namespace veins 70 | -------------------------------------------------------------------------------- /src/veins/base/utils/Coord.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2004 Telecommunication Networks Group (TKN) at Technische Universitaet Berlin, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // author: Christian Frank 24 | // part of: framework implementation developed by tkn 25 | 26 | #include "veins/base/utils/Coord.h" 27 | 28 | using namespace veins; 29 | 30 | const Coord Coord::ZERO = Coord(0.0, 0.0, 0.0); 31 | 32 | namespace { 33 | /** 34 | * On a torus the end and the begin of the axes are connected so you 35 | * get a circle. On a circle the distance between two points can't be greater 36 | * than half of the circumference. 37 | * If the normal distance between two points on one axis is bigger than 38 | * half of the size there must be a "shorter way" over the border on this axis 39 | */ 40 | static double dist(double coord1, double coord2, double size) 41 | { 42 | double difference = fabs(coord1 - coord2); 43 | if (difference == 0) 44 | // NOTE: event if size is zero 45 | return 0; 46 | else { 47 | ASSERT(size != 0); 48 | double dist = FWMath::modulo(difference, size); 49 | return std::min(dist, size - dist); 50 | } 51 | } 52 | } // namespace 53 | 54 | double Coord::sqrTorusDist(const Coord& b, const Coord& size) const 55 | { 56 | double xDist = dist(x, b.x, size.x); 57 | double yDist = dist(y, b.y, size.y); 58 | double zDist = dist(z, b.z, size.z); 59 | return xDist * xDist + yDist * yDist + zDist * zDist; 60 | } 61 | -------------------------------------------------------------------------------- /src/veins/modules/world/traci/trafficLight/TraCITrafficLightProgram.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2018 Dominik Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "veins/veins.h" 30 | 31 | using omnetpp::simtime_t; 32 | 33 | namespace veins { 34 | class VEINS_API TraCITrafficLightProgram { 35 | public: 36 | struct Phase { 37 | simtime_t duration; 38 | std::string state; 39 | simtime_t minDuration; 40 | simtime_t maxDuration; 41 | std::vector next; 42 | std::string name; 43 | 44 | bool isGreenPhase() const; 45 | }; 46 | struct Logic { 47 | std::string id; 48 | int32_t currentPhase; 49 | std::vector phases; 50 | int32_t type; // currently unused, just 0 51 | int32_t parameter; // currently unused, just 0 52 | }; 53 | 54 | TraCITrafficLightProgram(std::string id = ""); 55 | 56 | void addLogic(const Logic& logic); 57 | TraCITrafficLightProgram::Logic getLogic(const std::string& lid) const; 58 | bool hasLogic(const std::string& lid) const; 59 | 60 | private: 61 | std::string id; 62 | std::map logics; 63 | }; 64 | 65 | struct VEINS_API TraCITrafficLightLink { 66 | std::string incoming; 67 | std::string outgoing; 68 | std::string internal; 69 | }; 70 | 71 | } // namespace veins 72 | -------------------------------------------------------------------------------- /src/veins/base/modules/AddressingInterface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | /* 26 | * AddressingInterface.h 27 | * 28 | * Created on: Sep 9, 2010 29 | * Author: Karl Wessel 30 | */ 31 | 32 | #pragma once 33 | 34 | #include "veins/veins.h" 35 | 36 | #include "veins/base/utils/SimpleAddress.h" 37 | 38 | namespace veins { 39 | 40 | /** 41 | * @brief Interface for modules which assign L2 and L3 addresses for modules. 42 | * 43 | * This interface is implemented by ARP modules which rely on a certain 44 | * addressing scheme to work. 45 | * @see ArpHost for an example which demands the module's host's index as L2 and 46 | * L3 address to be able to provide a simplified ARP which is useful for 47 | * debugging purposes. 48 | * 49 | * @see BaseARP 50 | * @see ArpHost 51 | * 52 | * @ingroup netwLayer 53 | * @ingroup baseModules 54 | * 55 | * @author Karl Wessel 56 | */ 57 | class VEINS_API AddressingInterface { 58 | public: 59 | /** @brief Returns the L2 address for the passed mac.*/ 60 | virtual LAddress::L2Type myMacAddr(const cModule* mac) const = 0; 61 | 62 | /** @brief Returns the L3 address for the passed net.*/ 63 | virtual LAddress::L3Type myNetwAddr(const cModule* netw) const = 0; 64 | }; 65 | 66 | } // namespace veins 67 | -------------------------------------------------------------------------------- /src/veins/base/utils/POA.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Alexander Brummer 3 | // Copyright (C) 2018 Christoph Sommer 4 | // 5 | // Documentation for these modules is at http://veins.car2x.org/ 6 | // 7 | // SPDX-License-Identifier: GPL-2.0-or-later 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | // 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include "veins/base/phyLayer/Antenna.h" 29 | #include "veins/base/utils/AntennaPosition.h" 30 | #include "veins/base/utils/Coord.h" 31 | 32 | namespace veins { 33 | 34 | /** 35 | * @brief Container class used to attach data to Airframe s which are 36 | * needed by the receiver for antenna gain calculation (POA is short 37 | * for position, orientation, antenna). 38 | * 39 | * @author Alexander Brummer 40 | */ 41 | class VEINS_API POA { 42 | public: 43 | /** 44 | * Stores the sender's position. 45 | */ 46 | AntennaPosition pos; 47 | 48 | /** 49 | * Saves the sender's orientation. 50 | */ 51 | Coord orientation; 52 | 53 | /** 54 | * Shared pointer to the sender's antenna, which is necessary for 55 | * the receiver to calculate the gain of the transmitting antenna. 56 | * It is a shared pointer to ensure that the antenna still exists 57 | * even if the sending node is already gone. 58 | */ 59 | std::shared_ptr antenna; 60 | 61 | POA(){}; 62 | POA(AntennaPosition pos, Coord orientation, std::shared_ptr antenna) 63 | : pos(pos) 64 | , orientation(orientation) 65 | , antenna(antenna){}; 66 | virtual ~POA(){}; 67 | }; 68 | 69 | } // namespace veins 70 | -------------------------------------------------------------------------------- /src/veins/base/connectionManager/ConnectionManager.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2004 Telecommunication Networks Group (TKN) at Technische Universitaet Berlin, Germany. 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | // part of: framework implementation developed by tkn 24 | 25 | package org.car2x.veins.base.connectionManager; 26 | 27 | // Module to control all connection related stuff 28 | // 29 | // The central module that coordinates the connections between all 30 | // nodes, and handles dynamic gate creation. ConnectionManager therefore 31 | // periodically communicates with the mobility module and 32 | // ChannelAccess. 33 | // 34 | // The value maxInterfDist used here in ConnectionManager defines the upper bound of any transmission, 35 | // i.e. it can be redifined in the analogue models, but never such 36 | // that the maximal interference distance is exeeded. 37 | // 38 | // @author Steffen Sroka, Daniel Willkomm, Karl Wessel, Alexander Brummer, Christoph Sommer 39 | // @see MobilityBase 40 | // 41 | simple ConnectionManager 42 | { 43 | parameters: 44 | @class(veins::ConnectionManager); 45 | // send directly to the node or create separate gates for every connection 46 | bool sendDirect; 47 | // maximum interference distance [m] 48 | double maxInterfDist @unit(m); 49 | 50 | // should the maximum interference distance be displayed for each node? 51 | bool drawMaxIntfDist = default(false); 52 | 53 | @display("i=abstract/multicast"); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/veins/modules/analogueModel/TwoRayInterferenceModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 Stefan Joerer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/base/phyLayer/AnalogueModel.h" 26 | #include "veins/base/modules/BaseWorldUtility.h" 27 | 28 | namespace veins { 29 | 30 | using veins::AirFrame; 31 | 32 | /** 33 | * @brief 34 | * Extended version of Two-Ray Ground path loss model. 35 | * 36 | * See the Veins website for a tutorial, documentation, and publications . 37 | * 38 | * An in-depth description of the model is available at: 39 | * Christoph Sommer and Falko Dressler, "Using the Right Two-Ray Model? A Measurement based Evaluation of PHY Models in VANETs," Proceedings of 17th ACM International Conference on Mobile Computing and Networking (MobiCom 2011), Poster Session, Las Vegas, NV, September 2011. 40 | * 41 | * @author Stefan Joerer 42 | * 43 | * @ingroup analogueModels 44 | */ 45 | class VEINS_API TwoRayInterferenceModel : public AnalogueModel { 46 | 47 | public: 48 | TwoRayInterferenceModel(cComponent* owner, double dielectricConstant) 49 | : AnalogueModel(owner) 50 | , epsilon_r(dielectricConstant) 51 | { 52 | } 53 | 54 | ~TwoRayInterferenceModel() override 55 | { 56 | } 57 | 58 | void filterSignal(Signal* signal) override; 59 | 60 | protected: 61 | /** @brief stores the dielectric constant used for calculation */ 62 | double epsilon_r; 63 | }; 64 | 65 | } // namespace veins 66 | -------------------------------------------------------------------------------- /src/veins/modules/application/traci/TraCIDemo11p.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2011 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/modules/application/ieee80211p/DemoBaseApplLayer.h" 26 | 27 | namespace veins { 28 | 29 | /** 30 | * @brief 31 | * A tutorial demo for TraCI. When the car is stopped for longer than 10 seconds 32 | * it will send a message out to other cars containing the blocked road id. 33 | * Receiving cars will then trigger a reroute via TraCI. 34 | * When channel switching between SCH and CCH is enabled on the MAC, the message is 35 | * instead send out on a service channel following a Service Advertisement 36 | * on the CCH. 37 | * 38 | * @author Christoph Sommer : initial DemoApp 39 | * @author David Eckhoff : rewriting, moving functionality to DemoBaseApplLayer, adding WSA 40 | * 41 | */ 42 | 43 | class VEINS_API TraCIDemo11p : public DemoBaseApplLayer { 44 | public: 45 | void initialize(int stage) override; 46 | //own variables 47 | int nodeID; 48 | int senderID; 49 | std::string senderRoadID; 50 | 51 | int EMERGENCY_VEHICLE_NODE; 52 | 53 | protected: 54 | simtime_t lastDroveAt; 55 | bool sentMessage; 56 | int currentSubscribedServiceId; 57 | 58 | 59 | 60 | protected: 61 | void onWSM(BaseFrame1609_4* wsm) override; 62 | void onWSA(DemoServiceAdvertisment* wsa) override; 63 | 64 | void handleSelfMsg(cMessage* msg) override; 65 | void handlePositionUpdate(cObject* obj) override; 66 | virtual std::list NextRoutes(); 67 | }; 68 | 69 | } // namespace veins 70 | -------------------------------------------------------------------------------- /src/veins/modules/messages/Mac80211Ack_m.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file, do not edit! Created by nedtool 5.6 from veins/modules/messages/Mac80211Ack.msg. 3 | // 4 | 5 | #ifndef __VEINS_MAC80211ACK_M_H 6 | #define __VEINS_MAC80211ACK_M_H 7 | 8 | #if defined(__clang__) 9 | # pragma clang diagnostic ignored "-Wreserved-id-macro" 10 | #endif 11 | #include 12 | 13 | // nedtool version check 14 | #define MSGC_VERSION 0x0506 15 | #if (MSGC_VERSION!=OMNETPP_VERSION) 16 | # error Version mismatch! Probably this file was generated by an earlier version of nedtool: 'make clean' should help. 17 | #endif 18 | 19 | // dll export symbol 20 | #ifndef VEINS_API 21 | # if defined(VEINS_EXPORT) 22 | # define VEINS_API OPP_DLLEXPORT 23 | # elif defined(VEINS_IMPORT) 24 | # define VEINS_API OPP_DLLIMPORT 25 | # else 26 | # define VEINS_API 27 | # endif 28 | #endif 29 | 30 | // cplusplus {{ 31 | #include "veins/modules/messages/Mac80211Pkt_m.h" 32 | // }} 33 | 34 | 35 | namespace veins { 36 | 37 | /** 38 | * Class generated from veins/modules/messages/Mac80211Ack.msg:31 by nedtool. 39 | *
40 |  * packet Mac80211Ack extends Mac80211Pkt
41 |  * {
42 |  *     unsigned long messageId; // The ID of the aknowledged packet
43 |  * }
44 |  * 
45 | */ 46 | class VEINS_API Mac80211Ack : public ::veins::Mac80211Pkt 47 | { 48 | protected: 49 | unsigned long messageId; 50 | 51 | private: 52 | void copy(const Mac80211Ack& other); 53 | 54 | protected: 55 | // protected and unimplemented operator==(), to prevent accidental usage 56 | bool operator==(const Mac80211Ack&); 57 | 58 | public: 59 | Mac80211Ack(const char *name=nullptr, short kind=0); 60 | Mac80211Ack(const Mac80211Ack& other); 61 | virtual ~Mac80211Ack(); 62 | Mac80211Ack& operator=(const Mac80211Ack& other); 63 | virtual Mac80211Ack *dup() const override {return new Mac80211Ack(*this);} 64 | virtual void parsimPack(omnetpp::cCommBuffer *b) const override; 65 | virtual void parsimUnpack(omnetpp::cCommBuffer *b) override; 66 | 67 | // field getter/setter methods 68 | virtual unsigned long getMessageId() const; 69 | virtual void setMessageId(unsigned long messageId); 70 | }; 71 | 72 | inline void doParsimPacking(omnetpp::cCommBuffer *b, const Mac80211Ack& obj) {obj.parsimPack(b);} 73 | inline void doParsimUnpacking(omnetpp::cCommBuffer *b, Mac80211Ack& obj) {obj.parsimUnpack(b);} 74 | 75 | } // namespace veins 76 | 77 | #endif // ifndef __VEINS_MAC80211ACK_M_H 78 | 79 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCICoordinateTransformation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Dominik S. Buse 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/modules/mobility/traci/TraCICoord.h" 26 | #include "veins/base/utils/Coord.h" 27 | #include "veins/base/utils/Heading.h" 28 | 29 | #include 30 | 31 | namespace veins { 32 | 33 | /** 34 | * Helper class for converting SUMO coordinates to OMNeT++ Coordinates for a given network. 35 | */ 36 | class VEINS_API TraCICoordinateTransformation { 37 | public: 38 | using OmnetCoord = Coord; 39 | using OmnetCoordList = std::list; 40 | using TraCICoordList = std::list; 41 | using TraCIHeading = double; 42 | using OmnetHeading = Heading; 43 | 44 | TraCICoordinateTransformation(TraCICoord topleft, TraCICoord bottomright, float margin); 45 | TraCICoord omnet2traci(const OmnetCoord& coord) const; 46 | TraCICoordList omnet2traci(const OmnetCoordList& coords) const; 47 | TraCIHeading omnet2traciHeading(OmnetHeading heading) const; /**< TraCI's heading interpretation: 0 is north, 90 is east */ 48 | 49 | OmnetCoord traci2omnet(const TraCICoord& coord) const; 50 | OmnetCoordList traci2omnet(const TraCICoordList& coords) const; 51 | OmnetHeading traci2omnetHeading(TraCIHeading heading) const; /**< OMNeT++'s heading interpretation: 0 is east, pi/2 is north */ 52 | private: 53 | TraCICoord dimensions; 54 | TraCICoord topleft; 55 | TraCICoord bottomright; 56 | float margin; 57 | }; // end class NetworkCoordinateTranslator 58 | 59 | } // end namespace veins 60 | -------------------------------------------------------------------------------- /src/veins/base/utils/PassedMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #pragma once 26 | 27 | #include "veins/veins.h" 28 | 29 | namespace veins { 30 | 31 | class VEINS_API PassedMessage : public cObject { 32 | public: 33 | enum gates_t { 34 | UPPER_DATA, 35 | UPPER_CONTROL, 36 | LOWER_DATA, 37 | LOWER_CONTROL 38 | }; 39 | 40 | enum direction_t { 41 | INCOMING, 42 | OUTGOING 43 | }; 44 | 45 | public: 46 | static const char* gateToString(gates_t g) 47 | { 48 | const char* s; 49 | switch (g) { 50 | case UPPER_DATA: 51 | s = "UPPER_DATA"; 52 | break; 53 | case UPPER_CONTROL: 54 | s = "UPPER_CONTROL"; 55 | break; 56 | case LOWER_DATA: 57 | s = "LOWER_DATA"; 58 | break; 59 | case LOWER_CONTROL: 60 | s = "LOWER_CONTROL"; 61 | break; 62 | default: 63 | throw cRuntimeError("PassedMessage::gateToString: got invalid value"); 64 | s = nullptr; 65 | break; 66 | } 67 | return s; 68 | } 69 | 70 | public: 71 | // meta information 72 | int fromModule; 73 | gates_t gateType; 74 | direction_t direction; 75 | 76 | // message information 77 | int kind; 78 | const char* name; 79 | }; 80 | 81 | } // namespace veins 82 | -------------------------------------------------------------------------------- /src/veins/modules/analogueModel/SimplePathlossModel.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | #include "veins/modules/analogueModel/SimplePathlossModel.h" 26 | 27 | #include "veins/base/messages/AirFrame_m.h" 28 | 29 | using namespace veins; 30 | 31 | using veins::AirFrame; 32 | 33 | void SimplePathlossModel::filterSignal(Signal* signal) 34 | { 35 | auto senderPos = signal->getSenderPoa().pos.getPositionAt(); 36 | auto receiverPos = signal->getReceiverPoa().pos.getPositionAt(); 37 | 38 | /** Calculate the distance factor */ 39 | double sqrDistance = useTorus ? receiverPos.sqrTorusDist(senderPos, playgroundSize) : receiverPos.sqrdist(senderPos); 40 | 41 | EV_TRACE << "sqrdistance is: " << sqrDistance << endl; 42 | 43 | if (sqrDistance <= 1.0) { 44 | // attenuation is negligible 45 | return; 46 | } 47 | 48 | // the part of the attenuation only depending on the distance 49 | double distFactor = pow(sqrDistance, -pathLossAlphaHalf) / (16.0 * M_PI * M_PI); 50 | EV_TRACE << "distance factor is: " << distFactor << endl; 51 | 52 | Signal attenuation(signal->getSpectrum()); 53 | for (uint16_t i = 0; i < signal->getNumValues(); i++) { 54 | double wavelength = BaseWorldUtility::speedOfLight() / signal->getSpectrum().freqAt(i); 55 | attenuation.at(i) = (wavelength * wavelength) * distFactor; 56 | } 57 | *signal *= attenuation; 58 | } 59 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIScenarioManagerLaunchd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2012 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/modules/mobility/traci/TraCIScenarioManager.h" 28 | 29 | namespace veins { 30 | 31 | /** 32 | * @brief 33 | * Extends the TraCIScenarioManager for use with sumo-launchd.py and SUMO. 34 | * 35 | * Connects to a running instance of the sumo-launchd.py script 36 | * to automatically launch/kill SUMO when the simulation starts/ends. 37 | * 38 | * All other functionality is provided by the TraCIScenarioManager. 39 | * 40 | * See the Veins website for a tutorial, documentation, and publications . 41 | * 42 | * @author Christoph Sommer, David Eckhoff 43 | * 44 | * @see TraCIMobility 45 | * @see TraCIScenarioManager 46 | * 47 | */ 48 | class VEINS_API TraCIScenarioManagerLaunchd : virtual public TraCIScenarioManager { 49 | public: 50 | ~TraCIScenarioManagerLaunchd() override; 51 | void initialize(int stage) override; 52 | void finish() override; 53 | 54 | protected: 55 | cXMLElement* launchConfig; /**< launch configuration to send to sumo-launchd */ 56 | int seed; /**< seed value to set in launch configuration, if missing (-1: current run number) */ 57 | 58 | void init_traci() override; 59 | }; 60 | 61 | class VEINS_API TraCIScenarioManagerLaunchdAccess { 62 | public: 63 | TraCIScenarioManagerLaunchd* get() 64 | { 65 | return FindModule::findGlobalModule(); 66 | }; 67 | }; 68 | 69 | } // namespace veins 70 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIMobility.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2012 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.mobility.traci; 24 | 25 | import org.car2x.veins.base.modules.BaseMobility; 26 | 27 | // 28 | // Used in modules created by the TraCIScenarioManager. 29 | // 30 | // This module relies on the TraCIScenarioManager for state updates 31 | // and can not be used on its own. 32 | // 33 | // See the Veins website for a tutorial, documentation, and publications . 34 | // 35 | // @author Christoph Sommer, David Eckhoff, Luca Bedogni, Bastian Halmos, Stefan Joerer 36 | // 37 | // @see TraCIScenarioManager 38 | // @see TraCIScenarioManagerLaunchd 39 | // 40 | simple TraCIMobility extends BaseMobility 41 | { 42 | parameters: 43 | @class(veins::TraCIMobility); 44 | @signal[org_car2x_veins_modules_mobility_parkingStateChanged](type=veins::TraCIMobility); 45 | @display("i=block/cogwheel"); 46 | double hostPositionOffset @unit("m") = default(0.0m); // shift OMNeT++ module this far from front of the car 47 | bool setHostSpeed = default(false); // whether to update the speed of the host (along with its position) 48 | int accidentCount = default(0); // number of accidents 49 | double accidentStart @unit("s") = default(uniform(30s,60s)); // time until first accident, relative to departure time 50 | volatile double accidentDuration @unit("s") = default(uniform(30s,60s)); // duration of accident 51 | volatile double accidentInterval @unit("s") = default(uniform(30s,60s)); // time between accidents 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/veins/modules/obstacle/Obstacle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | #include "veins/veins.h" 28 | 29 | #include "veins/base/utils/Coord.h" 30 | #include "veins/modules/world/annotations/AnnotationManager.h" 31 | 32 | namespace veins { 33 | 34 | /** 35 | * stores information about an Obstacle for ObstacleControl 36 | */ 37 | class VEINS_API Obstacle { 38 | public: 39 | using Coords = std::vector; 40 | 41 | Obstacle(std::string id, std::string type, double attenuationPerCut, double attenuationPerMeter); 42 | 43 | void setShape(Coords shape); 44 | const Coords& getShape() const; 45 | const Coord getBboxP1() const; 46 | const Coord getBboxP2() const; 47 | bool containsPoint(Coord Point) const; 48 | 49 | std::string getType() const; 50 | std::string getId() const; 51 | double getAttenuationPerCut() const; 52 | double getAttenuationPerMeter() const; 53 | 54 | /** 55 | * get a list of points (in [0, 1]) along the line between sender and receiver where the beam intersects with this obstacle 56 | */ 57 | std::vector getIntersections(const Coord& senderPos, const Coord& receiverPos) const; 58 | 59 | AnnotationManager::Annotation* visualRepresentation; 60 | 61 | protected: 62 | std::string id; 63 | std::string type; 64 | double attenuationPerCut; /**< in dB. attenuation per exterior border of obstacle */ 65 | double attenuationPerMeter; /**< in dB / m. to account for attenuation caused by interior of obstacle */ 66 | Coords coords; 67 | Coord bboxP1; 68 | Coord bboxP2; 69 | }; 70 | 71 | } // namespace veins 72 | -------------------------------------------------------------------------------- /src/veins/modules/mobility/traci/TraCIScreenRecorder.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2006-2014 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.mobility.traci; 24 | 25 | // 26 | // Simple support module to take (a series of) screenshots of a simulation running in the TraCI server. 27 | // 28 | // Note that the TraCI server needs to be run in GUI mode and support taking screenshots for this to work. 29 | // 30 | // The screenshots can then be converted to a video using something along the lines of 31 | // mencoder 'mf://results/screenshot-*.png' -mf w=800:h=600:fps=25:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi 32 | // 33 | // See the Veins website for a tutorial, documentation, and publications . 34 | // 35 | // @author Christoph Sommer 36 | // 37 | // @see TraCIScenarioManager 38 | // 39 | simple TraCIScreenRecorder 40 | { 41 | parameters: 42 | @display("i=block/downarrow"); 43 | @class(veins::TraCIScreenRecorder); 44 | string dirname = default(""); // directory name for screenshots (leave blank to use ${resultdir}) 45 | string filenameTemplate = default(""); // file name for screenshots in printf syntax; the %f parameter is set to the current simulation time (leave blank to use screenshot-${runid}-@%08.2f.png) 46 | string viewName = default("View #0"); // which TraCI server view to choose 47 | double start @unit("s") = default(0s); // when to take the first screenshot 48 | double interval @unit("s") = default(.1s); // how often to take a screenshot 49 | double stop @unit("s") = default(-1s); // when to take the last screenshot (-1: never) 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/veins/modules/nic/Nic80211p.ned: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 David Eckhoff 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | package org.car2x.veins.modules.nic; 24 | 25 | import org.car2x.veins.modules.phy.PhyLayer80211p; 26 | import org.car2x.veins.modules.mac.ieee80211p.Mac1609_4; 27 | 28 | // 29 | // This NIC implements an 802.11p network interface card. 30 | // 31 | // @author David Eckhoff 32 | // 33 | // @see DemoBaseApplLayer 34 | // @see Mac1609_4 35 | // @see PhyLayer80211p 36 | // 37 | module Nic80211p like INic80211p 38 | { 39 | parameters: 40 | string connectionManagerName = default("connectionManager"); 41 | gates: 42 | input upperLayerIn; // to upper layers 43 | output upperLayerOut; // from upper layers 44 | output upperControlOut; // control information 45 | input upperControlIn; // control information 46 | input radioIn; // radioIn gate for sendDirect 47 | 48 | submodules: 49 | phy80211p: PhyLayer80211p { 50 | @display("p=69,218;i=block/process_s"); 51 | } 52 | 53 | mac1609_4: Mac1609_4 { 54 | @display("p=69,82"); 55 | } 56 | 57 | connections: 58 | radioIn --> phy80211p.radioIn; 59 | 60 | mac1609_4.lowerControlOut --> phy80211p.upperControlIn; 61 | mac1609_4.lowerLayerOut --> phy80211p.upperLayerIn; 62 | phy80211p.upperLayerOut --> mac1609_4.lowerLayerIn; 63 | phy80211p.upperControlOut --> mac1609_4.lowerControlIn; 64 | 65 | mac1609_4.upperControlIn <-- upperControlIn; 66 | mac1609_4.upperLayerIn <-- upperLayerIn; 67 | 68 | mac1609_4.upperLayerOut --> upperLayerOut; 69 | mac1609_4.upperControlOut --> upperControlOut; 70 | } 71 | -------------------------------------------------------------------------------- /src/veins/base/utils/AntennaPosition.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2018 Christoph Sommer 3 | // 4 | // Documentation for these modules is at http://veins.car2x.org/ 5 | // 6 | // SPDX-License-Identifier: GPL-2.0-or-later 7 | // 8 | // This program is free software; you can redistribute it and/or modify 9 | // it under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation; either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // 22 | 23 | #pragma once 24 | 25 | #include "veins/veins.h" 26 | 27 | #include "veins/base/utils/Coord.h" 28 | 29 | namespace veins { 30 | 31 | /** 32 | * Stores the position of the host's antenna along with its speed, so that it can be linearly extrapolated. 33 | */ 34 | class VEINS_API AntennaPosition { 35 | 36 | public: 37 | AntennaPosition() 38 | : id(-1) 39 | , p() 40 | , v() 41 | , t() 42 | , undef(true) 43 | { 44 | } 45 | 46 | /** 47 | * Store a position p that changes by v for every second after t. 48 | */ 49 | AntennaPosition(int id, Coord p, Coord v, simtime_t t) 50 | : id(id) 51 | , p(p) 52 | , v(v) 53 | , t(t) 54 | , undef(false) 55 | { 56 | } 57 | 58 | /** 59 | * Get the (linearly extrapolated) position at time t. 60 | */ 61 | Coord getPositionAt(simtime_t t = simTime()) const 62 | { 63 | ASSERT(t >= this->t); 64 | ASSERT(!undef); 65 | auto dt = t - this->t; 66 | return p + v * dt.dbl(); 67 | } 68 | 69 | bool isSameAntenna(const AntennaPosition& o) const 70 | { 71 | ASSERT(!undef); 72 | ASSERT(!o.undef); 73 | return (id == o.id); 74 | } 75 | 76 | protected: 77 | int id; /**< unique identifier of antenna returned by ChannelAccess::getId() */ 78 | Coord p; /**< position for linear extrapolation */ 79 | Coord v; /**< speed for linear extrapolation */ 80 | simtime_t t; /**< time for linear extrapolation */ 81 | bool undef; /**< true if created using default constructor */ 82 | }; 83 | 84 | } // namespace veins 85 | -------------------------------------------------------------------------------- /src/veins/base/modules/BatteryAccess.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 Technische Universitaet Berlin (TUB), Germany, Telecommunication Networks Group 3 | // Copyright (C) 2007 Technische Universiteit Delft (TUD), Netherlands 4 | // Copyright (C) 2007 Universitaet Paderborn (UPB), Germany 5 | // 6 | // Documentation for these modules is at http://veins.car2x.org/ 7 | // 8 | // SPDX-License-Identifier: GPL-2.0-or-later 9 | // 10 | // This program is free software; you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation; either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program; if not, write to the Free Software 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | // 24 | 25 | /* 26 | * BatteryAccess.cc 27 | * 28 | * Created on: Aug 26, 2009 29 | * Author: Karl Wessel 30 | */ 31 | 32 | #include "veins/base/modules/BatteryAccess.h" 33 | 34 | #include "veins/base/utils/FindModule.h" 35 | 36 | using veins::BatteryAccess; 37 | 38 | BatteryAccess::BatteryAccess() 39 | : BaseModule() 40 | , battery(nullptr) 41 | { 42 | } 43 | 44 | BatteryAccess::BatteryAccess(unsigned stacksize) 45 | : BaseModule(stacksize) 46 | , battery(nullptr) 47 | { 48 | } 49 | 50 | void BatteryAccess::registerWithBattery(const std::string& name, int numAccounts) 51 | { 52 | battery = FindModule::findSubModule(findHost()); 53 | 54 | if (!battery) { 55 | throw cRuntimeError("No battery module defined!"); 56 | } 57 | else { 58 | deviceID = battery->registerDevice(name, numAccounts); 59 | } 60 | } 61 | 62 | void BatteryAccess::draw(DrawAmount& amount, int account) 63 | { 64 | if (!battery) return; 65 | 66 | battery->draw(deviceID, amount, account); 67 | } 68 | 69 | void BatteryAccess::drawCurrent(double amount, int account) 70 | { 71 | if (!battery) return; 72 | 73 | DrawAmount val(DrawAmount::CURRENT, amount); 74 | battery->draw(deviceID, val, account); 75 | } 76 | 77 | void BatteryAccess::drawEnergy(double amount, int account) 78 | { 79 | if (!battery) return; 80 | 81 | DrawAmount val(DrawAmount::ENERGY, amount); 82 | battery->draw(deviceID, val, account); 83 | } 84 | -------------------------------------------------------------------------------- /src/veins/modules/messages/AckTimeOutMessage_m.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file, do not edit! Created by nedtool 5.6 from veins/modules/messages/AckTimeOutMessage.msg. 3 | // 4 | 5 | #ifndef __VEINS_ACKTIMEOUTMESSAGE_M_H 6 | #define __VEINS_ACKTIMEOUTMESSAGE_M_H 7 | 8 | #if defined(__clang__) 9 | # pragma clang diagnostic ignored "-Wreserved-id-macro" 10 | #endif 11 | #include 12 | 13 | // nedtool version check 14 | #define MSGC_VERSION 0x0506 15 | #if (MSGC_VERSION!=OMNETPP_VERSION) 16 | # error Version mismatch! Probably this file was generated by an earlier version of nedtool: 'make clean' should help. 17 | #endif 18 | 19 | // dll export symbol 20 | #ifndef VEINS_API 21 | # if defined(VEINS_EXPORT) 22 | # define VEINS_API OPP_DLLEXPORT 23 | # elif defined(VEINS_IMPORT) 24 | # define VEINS_API OPP_DLLIMPORT 25 | # else 26 | # define VEINS_API 27 | # endif 28 | #endif 29 | 30 | 31 | namespace veins { 32 | 33 | /** 34 | * Class generated from veins/modules/messages/AckTimeOutMessage.msg:25 by nedtool. 35 | *
36 |  * message AckTimeOutMessage
37 |  * {
38 |  *     // The corresponding WSM's tree id
39 |  *     unsigned long wsmId = -1;
40 |  *     // Access category on which the AckTimer is set
41 |  *     int ac = -1;
42 |  * }
43 |  * 
44 | */ 45 | class VEINS_API AckTimeOutMessage : public ::omnetpp::cMessage 46 | { 47 | protected: 48 | unsigned long wsmId; 49 | int ac; 50 | 51 | private: 52 | void copy(const AckTimeOutMessage& other); 53 | 54 | protected: 55 | // protected and unimplemented operator==(), to prevent accidental usage 56 | bool operator==(const AckTimeOutMessage&); 57 | 58 | public: 59 | AckTimeOutMessage(const char *name=nullptr, short kind=0); 60 | AckTimeOutMessage(const AckTimeOutMessage& other); 61 | virtual ~AckTimeOutMessage(); 62 | AckTimeOutMessage& operator=(const AckTimeOutMessage& other); 63 | virtual AckTimeOutMessage *dup() const override {return new AckTimeOutMessage(*this);} 64 | virtual void parsimPack(omnetpp::cCommBuffer *b) const override; 65 | virtual void parsimUnpack(omnetpp::cCommBuffer *b) override; 66 | 67 | // field getter/setter methods 68 | virtual unsigned long getWsmId() const; 69 | virtual void setWsmId(unsigned long wsmId); 70 | virtual int getAc() const; 71 | virtual void setAc(int ac); 72 | }; 73 | 74 | inline void doParsimPacking(omnetpp::cCommBuffer *b, const AckTimeOutMessage& obj) {obj.parsimPack(b);} 75 | inline void doParsimUnpacking(omnetpp::cCommBuffer *b, AckTimeOutMessage& obj) {obj.parsimUnpack(b);} 76 | 77 | } // namespace veins 78 | 79 | #endif // ifndef __VEINS_ACKTIMEOUTMESSAGE_M_H 80 | 81 | --------------------------------------------------------------------------------