运行 omnet 时无法添加多个 .ned 目录++从它自己的壳里

发布于 2025-01-19 11:19:15 字数 2542 浏览 1 评论 0原文

我想在不打开IDE的情况下进行模拟。我检查了手册并遵循这些步骤,但我被卡住了。
我正在使用Omnetpp v5.6.2。我在我的 *.ini所在的目录中运行mingwenv.cmd,然后输入以下内容:

AFDX.exe -f C:/Workspaces/Github/AFDX/Simulations/AutoNetwork.ini -n C:/Workspaces/Github/AFDX/simulations

我得到了回报:

OMNeT++ Discrete Event Simulation  (C) 1992-2019 Andras Varga, OpenSim Ltd.
Version: 5.6.2, build: 200518-aa79d0918f, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer

Setting up Qtenv...

Loading NED files from C:/Workspaces/Github/AFDX/simulations:  1

Loading images from 'bitmaps': *: 0
Loading images from 'images': *: 0
Loading images from 'C:/omnetpp-5.6.2/images': *: 0  abstract/*: 90  background/*: 4  block/*: 320  device/*: 195  logo/*: 1  maps/*: 9  misc/*: 70  msg/*: 55  old/*: 111  status/*: 28

<

a href =“ https://i.sstatic.net/svcwq.png” noreferrer“> “

也添加了我的src目录

AFDX.exe -f C:/Workspaces/Github/AFDX/Simulations/AutoNetwork.ini -n "C:/Workspaces/Github/AFDX/simulations;C:/Workspaces/Github/AFDX/src"

所以我这次 仍然没有工作:

OMNeT++ Discrete Event Simulation  (C) 1992-2019 Andras Varga, OpenSim Ltd.
Version: 5.6.2, build: 200518-aa79d0918f, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer

Setting up Qtenv...

Loading NED files from C:/Workspaces/Github/AFDX/simulations:  1
Loading NED files from C:/Workspaces/Github/AFDX/src:  38

Loading images from 'bitmaps': *: 0
Loading images from 'images': *: 0
Loading images from 'C:/omnetpp-5.6.2/images': *: 0  abstract/*: 90  background/*: 4  block/*: 320  device/*: 195  logo/*: 1  maps/*: 9  misc/*: 70  msg/*: 55  old/*: 111  status/*: 28

”在此处输入图像描述”

与错误相反,实际上有一个AFDX :: Conndef类,并且当我使用IDE运行模拟时,它可以正常工作。

我也添加了我的项目目录结构,也许会有所帮助。

|&gt; afdx
__ |&gt; src
____ |&gt; queueinglib
______ | *.Ned
______ | *.cc
______ | *.h
____ | *.Ned
____ | *.cc
____ | *.h
____ | Conndef的东西在这里
__ |&gt;仿真
____ |&gt;结果
____ | afdx.exe
____ | autonetwork.ini
____ | autonetwork.ned
____ | makefile
__ | makefile

I want to run my simulation without opening the IDE. I checked the manual and follow the steps but I got stucked.
I am using omnetpp v5.6.2. I run mingwenv.cmd in the directory where my *.ini is and type this:

AFDX.exe -f C:/Workspaces/Github/AFDX/Simulations/AutoNetwork.ini -n C:/Workspaces/Github/AFDX/simulations

I got this in return:

OMNeT++ Discrete Event Simulation  (C) 1992-2019 Andras Varga, OpenSim Ltd.
Version: 5.6.2, build: 200518-aa79d0918f, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer

Setting up Qtenv...

Loading NED files from C:/Workspaces/Github/AFDX/simulations:  1

Loading images from 'bitmaps': *: 0
Loading images from 'images': *: 0
Loading images from 'C:/omnetpp-5.6.2/images': *: 0  abstract/*: 90  background/*: 4  block/*: 320  device/*: 195  logo/*: 1  maps/*: 9  misc/*: 70  msg/*: 55  old/*: 111  status/*: 28

and this:

error

So I added my src directory too

AFDX.exe -f C:/Workspaces/Github/AFDX/Simulations/AutoNetwork.ini -n "C:/Workspaces/Github/AFDX/simulations;C:/Workspaces/Github/AFDX/src"

This time I make it count all the ned files but still didn't work:

OMNeT++ Discrete Event Simulation  (C) 1992-2019 Andras Varga, OpenSim Ltd.
Version: 5.6.2, build: 200518-aa79d0918f, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer

Setting up Qtenv...

Loading NED files from C:/Workspaces/Github/AFDX/simulations:  1
Loading NED files from C:/Workspaces/Github/AFDX/src:  38

Loading images from 'bitmaps': *: 0
Loading images from 'images': *: 0
Loading images from 'C:/omnetpp-5.6.2/images': *: 0  abstract/*: 90  background/*: 4  block/*: 320  device/*: 195  logo/*: 1  maps/*: 9  misc/*: 70  msg/*: 55  old/*: 111  status/*: 28

enter image description here

As opposed to the error, there is an AFDX::ConnDef class actually and when I run the simulation by using the IDE, it works just fine.

I am adding my project directory structure too, maybe it'll help.

|>AFDX
__|>src
____|>queueinglib
______| *.ned
______| *.cc
______| *.h
____| *.ned
____| *.cc
____| *.h
____| ConnDef stuff is here
__|>simulations
____|>Results
____|AFDX.exe
____|AutoNetwork.ini
____|AutoNetwork.ned
____|Makefile
__|Makefile

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回梦 2025-01-26 11:19:15

这个问题包含2个问题。第一个已经被你妥善解决了。第二个(afdx::ConnDef 未找到)。与这个问题的标题或一般的 NED 文件绝对无关。 C++ 代码中缺少 ConnDef 类,或者您忘记添加 Define_Module 宏,或者您将该类放入全局命名空间中,而不是将其包含在 >afdx 命名空间。

您建议您从 IDE 或命令行运行得到不同的结果。这只能是您实际运行不同的可执行文件的情况。

检查目录树显示您在 simulations 文件夹中有一个 Makefile 和“AFDX.exe”文件,因此该文件夹被指定为源文件夹,但是它里面没有任何源文件。另一方面,src 文件夹也是一个源文件夹,虽然您没有指出,但我相信它也有一个 Makefile 和一个EXE 文件,that 是包含模型代码和 afdx::ConnDef 类的可执行文件(IDE 也会启动该可执行文件)。另一方面,您正在从 simulations 文件夹启动 EXE 文件,该文件是一个没有任何代码的空 exe...

不要在项目中同时使用两个源文件夹,除非您现在真的这样做你在做什么。只需从 simulations 文件夹中删除源指定并删除其中的 exe 和 Makefile。

使用 src 文件夹中的 EXE 从命令行启动 sim。即你会做类似的事情

cd simulations
../src/AFDX.exe -n ".;../src" AutoNetwork.ini

This question contains 2 problems. The first was properly solved by you. The second (afdx::ConnDef not found). Has absolutely nothing to do with the title of this question or with NED files in general. The ConnDef class is either missing from the c++ code, or you forgot to add the Define_Module macro, or you put that class into the global namespace instead of including it the afdx namespace.

You are suggesting that you get different results running from IDE or the commandline. This can be only, of you actually run different executables.

Checking your directory tree shows that you have a Makefile and the 'AFDX.exe' file in the simulations folder, so that folder is designated as source folder, however it does NOT have any source files in it. On the other hand, src folder is also a source folder and while you have not indicated, I believe it also has a Makefile and again an EXE file, and that is the executable that contains your model code and the afdx::ConnDef class (and the IDE also starts that executable). On the other hand, you are launching the EXE file from the simulations folder which is an empty exe without any code...

Do NOT use two source folders in a project at the same time unless you really now what you are doing. Just remove the source designation from the simulations folder and delete the exe and Makefile there.

Use the EXE in the src folder to start the sim from command-line. i.e. you would do something like

cd simulations
../src/AFDX.exe -n ".;../src" AutoNetwork.ini
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文