double to simTime() problem

61 views
Skip to first unread message

Amr Abughazala

unread,
Dec 1, 2016, 12:58:07 PM12/1/16
to OMNeT++ Users
I searched online about the double and simTime() issue and found that all the people are struggling to have simTime() to double but I actually have the inverse problem.

<!> Error in module (inet::GateDropTailQueue) Mysimulation.switch.eth[0].queue.Queue1 (id=33) at event #364, t=2.0155: Cannot convert 2.16975e+132 to simtime_t: out of range (-9223372.036854775807,9223372.036854775807), allowed by scale exponent -12.

//omnetpp.ini
**.intervalTime = "0.00025 0.00025"
**.baseTime = 2
**.gateCycleTime = 0.005


//Ned file
double gateCycleTime;
double baseTime;
string intervalTime;


// configuration file
double intervalTime;
double gateCycleTime;
double baseTime;

scheduleAt
( baseTime , gateCycleTimemsg);
scheduleAt
( simTime() + gateCycleTime , gateCycleTimemsg);
scheduleAt
( simTime() + intervalTime[currentList] , IntervalTimemsg);

The number is too big I know but why and how should I solve that.
I read in the omnet++ Manual as well as previous questions and found the parse() function
parse(), which converts a string to SimTime

still if this might solve the problem how to use parse as I can't find related examples in the manual.

Alfonso Ariza Quintana

unread,
Dec 1, 2016, 2:04:53 PM12/1/16
to omn...@googlegroups.com

I suspect that you that you have the error in the conversion of the array of char to array of doubles.

 

**.intervalTime = "0.00025 0.00025"

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

Amr Abughazala

unread,
Dec 2, 2016, 3:58:26 AM12/2/16
to OMNeT++ Users, aari...@hotmail.com
I can see that this is possible in the manual
https://omnetpp.org/doc/omnetpp/manual/#sec:simple-modules:parameters

    const char *vstr = par("intervalTime").stringValue();
    std
::vector<double> intervalTime = cStringTokenizer(vstr).asDoubleVector();

Amr Abughazala

unread,
Dec 20, 2016, 7:36:29 AM12/20/16
to OMNeT++ Users, aari...@hotmail.com
the error was exactly that I the index of a vector was exceeding the size of vector and as a result a random number was chosen which is really high and cant be as it used as time to do next event.


On Thursday, December 1, 2016 at 8:04:53 PM UTC+1, Alfonso Ariza Quintana wrote:
Reply all
Reply to author
Forward
0 new messages