Simulating a discrete event with probability x

A

Affan

Hi,
I am writing a discrete event simulator and want to simplify the
analysis of multipath by trigging an arrival of multipath based on a
the receiver distance from sender- say 'd'- and a simulation
parameter, say mpParam which gives the fraction of maximum range
within which the reflecting surface is located (I know gross
simplifications!). Note that for fraction beyond 1, there is no need
for any event to be triggered as it will not be strong enough to be
received (for sure). Based on the direct distance to the receiver and
the multipath distance I want to make the probability of a multipath
being triggered to be inversely proportional to the sq. of the
distance.

Since the trigerring of the event is a binary decision I am little
confused how to code this. Currently I am doing the following (but it
doesnt feel/seem right!, thats why I am asking here) (RAND_UNIFORME is
a macro giving random # b/w 0,1)

distance = (*nodePosition).getDistance(gNodeInfoVector[nodeIter]);

timerInfo.timeLeft_ = (timeTicks)( distance*SEC_TO_TIMETICK/
(SPEED_MPS));

tcbPtr = new Event(timerInfo); //set event for direct path

float decisionMP=(RAND_UNIFORME+mpParam)*(1-pow((MAX_RANGE/distance),
2));

if(decisionMP <0.5){//only if the threshold is greater than what is
expected at the receiver do we have a multipath signal arriving at the
receiver.. assume a 2 ray model for multipath
double multipathDistance, surfaceHeight;
surfaceHeight=mpParam*MAX_RANGE;
multipathDistance=2*sqrt(((surfaceHeight*surfaceHeight)+
(distance*distance/4)));//gemoetry calc for multipath calculation

timerInfo.timeLeft_ = (timeTicks)
( multipathDistance*SEC_TO_TIMETICK/(SNDSPEED_MPS));
tcbPtr = new Event(timerInfo);//set event for multipath

}

Any suggestions would be more than welcome.

Thank you.

Affan
 
V

Victor Bazarov

Affan said:
I am writing a discrete event simulator [..]

Since the trigerring of the event is a binary decision I am little
confused how to code this.

What's the algorithm? Can you write it in pseudo-code? If you can,
please do, we can help you convert it into C++ code. If you cannot,
ask in 'comp.programming'. Here we talk C++, not general programming.

V
 
A

Affan

Affan said:
I am writing a discrete event simulator [..]
Since the trigerring of the event is a binary decision I am little
confused how to code this.

What's the algorithm? Can you write it in pseudo-code? If you can,
please do, we can help you convert it into C++ code. If you cannot,
ask in 'comp.programming'. Here we talk C++, not general programming.

V
posted to comp.programming.. as the issue is algorithmic not about
coding.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,085
Latest member
cryptooseoagencies

Latest Threads

Top