TraCIDemoRSU11p 中的初始化方法 [英] initialize method in TraCIDemoRSU11p
问题描述
我正在使用 omnetpp-5.4.1 、venes-4.7.1 、sumo-0.30.0 .我将在静脉中通过 RSU 进行模糊聚类.我在静脉/模块/中创建了一个名为 FCM 的新模块application/traci 并继承了 TraCIDemo11p 并在其中编写了聚类代码.因为要RSU启动集群,所以在工作开始时使用了TraCIDemoRSU11p中的initialize方法来调用FMC内部的方法.
I'm using omnetpp-5.4.1 , veins-4.7.1 , sumo-0.30.0 .I'm going to do fuzzy clustering by RSU in veins.I created a new module called FCM in veins/modules/application/traci and inherited the TraCIDemo11p and wrote the clustering code in it. Because I want to RSU start clustering,I used the initialize method in the TraCIDemoRSU11p to call the method inside the FMC at the start of work.
void TraCIDemoRSU11p::initialize(int stage) {
BaseWaveApplLayer::initialize(stage);
std::cout<<"starting clustering";
FCM * fcm_clustering;
fcm_clustering->clustering();
}
当我运行程序时,在程序开始时不允许运行,说finish with error",程序停止运行.在模拟开始时如何调用 RSU 的聚类?
When I run the program, it is not allowed to run at the start of the program, saying "finish with error" and the program stops running. What can I do to call the clustering by RSU at the beginning of the simulation?
请帮我解决我的问题.谢谢.
please help me to solvemy problem. Thanks.
推荐答案
您已经定义了一个指针 fcm_clustering
,但您没有对其进行初始化.因此,尝试使用它会导致内存冲突.
尝试创建FCM
对象,例如:
You have defined a pointer fcm_clustering
but you didn't initialize it. Therefore an attempt to use it ends up with memory violation.
Try to create FCM
object, for example:
FCM * fcm_clustering = new FCM();
这篇关于TraCIDemoRSU11p 中的初始化方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!