I use Veins-4a2 and I have modified the scenario of the demo example. I have added a new wsm which is ACK when a node reveives a message, it sends an ACK message to the source node. I have add this line in onData() function:
sendWSM(prepareWSM("ack", ackLengthBits, type_SCH, ackPriority, sourcenode.idNode, 2));
and I changed certainly the prepareWSM and handleLowerMsg() functions in BaseWaveApplLayer.cc, but when I execute the simulation, it crashes after 10 seconds. This is the error message:
Error in module (Mac1609_4) RSUExampleScenario.node[2].nic.mac1609_4 (id=240) at event #1196, t=9.210177776741: Model error: ASSERT: condition useSCH false in function handleUpperMsg, veins/modules/mac/ieee80211p/Mac1609_4.cc line 259.
Is that I do not have the right to reuse the SCH channel for the ACK message? How can I correct this problem please?
The 1609.4 MAC layer of Veins 4a2 can be used in one of two operation modes: single channel and multi channel. The behavior can be configured by setting this parameter of the .ned file:
// cycle between an SCH and the CCH (or stay on CCH all the time) bool useServiceChannel = default(true);
From the error message you are posting it appears you have set this parameter to false
, meaning you want the radio to always stay on the Control Channel (CCH). At the same time, the code you posted requests a message to be transmitted over a Service Channel (SCH).
You are thus requesting mutually exclusive behavior.
Veins correctly identified this and aborted your simulation.