How to change a parameter value over time?

前端 未结 1 889
栀梦
栀梦 2020-12-20 03:16

I need to change the value of a volatile parameter over time in a simulation. I.e. in the first 30s of the simulation I need exp(400ms) after that,

相关标签:
1条回答
  • 2020-12-20 03:37

    For volatile parameters there is a pretty easy trick. Use the ? : operator along with the simTime() NED function:

    **.interArrivalTime = simTime() < 30s ? exponetntial(400ms) : exponential(800ms)
    

    or you can even chain them as ?: operator is evaluated left to right:

    **.interArrivalTime = exponential(simTime() < 30s ? 400ms : simTime() < 60s ? 800ms : 2s)
    

    would give:

    • exponential(400ms) below 30s
    • exponential(800ms) between 30 and 60s
    • exponential(2s) after 60s
    0 讨论(0)
提交回复
热议问题