Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
478 views
in Technique[技术] by (71.8m points)

omnet++ - Changing WSM(WAVE Short Message) packet size in Veins

Does setting length of WSM via setWsmLength or adding a large payload via setWsmData makes any difference during simulation? I am trying to simulate a heavily used network, but changing any of those two values doesn't seem to make any difference. I found this, but wanted to confirm this. And If I wanted to change the size of the WSM do I have to implement it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can implement a packet for your application in a .msg file as follows:

cplusplus {{
#include "veins/modules/messages/WaveShortMessage_m.h"
}}

class WaveShortMessage;

message MyAppsPacket extends WaveShortMessage {
    string sourceAddress;           
    string destinationAddress;      
    simtime_t sendingTime;
}

Then in your code you can use the built-in setByteLength(). Use cPacket subclass for your messages because:

(cPacket is) A subclass of cMessage that can be used to represent packets (frames, * datagrams, application messages, etc). cPacket adds length (measured in * bits or bytes), bit error flag, and encapsulation capability to cMessage. * Length and bit error flag are significant when the packet travels through * a cDatarateChannel or another channel that supports data rate and/or * error modelling. *

Related Q&A which shows the casting from cMessage to cPacket.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...