How to change a parameter value over time?

时光毁灭记忆、已成空白 提交于 2019-11-28 05:48:58

问题


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, until 60s I need exp(800ms) and after 60s exp(2s) for interArrivalTime.


回答1:


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


来源:https://stackoverflow.com/questions/31028055/how-to-change-a-parameter-value-over-time

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!