wood burning stoves 2.0*
The moose likes Java in General and the fly likes Discete Event Simulation Question (Code) ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Discete Event Simulation Question (Code) ?" Watch "Discete Event Simulation Question (Code) ?" New topic

Discete Event Simulation Question (Code) ?

Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Hello this question definite falls under Advanced.
I've created the code to to the following. Its actually 3 classes of code. Any help would be appreciated.
here what it does and hereare the problems am having with it. Thanks again for reading:
Explanation of code
This code is for Discrete Event Simulation Techniques.
The code written creates a number of classes. Mainly it has the classes MS1 , MS2 and BTS1 and BTS2,
MS1 sends signals to BTS1 and MS2 sends signals to BTS2.
MS1and BTS1 has no connection to MS2 and MTS2.
How does signals go from MS1 to BTS1? It sends the signals to the class Signals. Signals then sends the signals o the class Queue which is like a cable or line in real life. Hence a cable called queueMStoBTS which is an object of class Queue connects MS1 and BTS1.
Now the for MS2 and BTS2 the same thing happens. Except the class Signals is replaced by SignalsMS2 and Queue is replaced by class QueueMS2 and its object is queueMS2toBTS2.
Now the only connection between MS1/BTS1 and MS2/BTS2 is that when the simulation is being performed signals running from MS1 to BTS1 and from MS2 toBTS2 occurs in parallel ( at the same time).
Now the Simulation is performed for 610 time units. And every 10 time units a sample of the amount of bytes ( signals are measured in bytes ) flowing through each queue is measured and that value is put into an array which stores the value. This is done for both MS1/BTS1 and MS2.BTS2.
In the end a graph is plotted with bytes at each 10 units time VS time.
Hence am suppose to get 2 graphs at the end. One for MS1/BTS1 and MS2/BTs2.
My problem is that the simulation does not run for the full 610 time units. It stop sometimes at 3 units. And the only time the graphs can be printed is when the time unit exceeds 600 time units and since the time units never exceeds 600 the graphs are never plotted.
Could you give it a look please. I worked really hard on this one.
Thanks… Avin
And here are the classes..remember its three classes..

[ February 25, 2002: Message edited by: Avin Sinanan ]
[ February 25, 2002: Message edited by: Avin Sinanan ]
[ February 26, 2002: Message edited by: Avin Sinanan ]
[ February 26, 2002: Message edited by: Avin Sinanan ]
[ February 26, 2002: Message edited by: Avin Sinanan ]
[ February 26, 2002: Message edited by: Avin Sinanan ]

yours respectfully<br />Avin Sinanan
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
I was with you up until the code. I'm too lazy to figure it out without some formatting. If you would post it formatted with the [ code ] and [ /code ] tags I'd take another look, and I'd guess that others might be more inclined to do so as well.
Good Luck

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Hey thanks Dirk,
Ok I did the code /code thing... did I do it correct.
I never actually did the formatting thing before.
So if it isn't correct please let me know and I'll give it another try.
What does the "code" thing do by the way?
Anyway thanks again..
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Well, look at your code. Among other things, the [code] tag causes your code to be indented the way it was when you submitted it, rather than all flat against the left hand side of the page. Usually this is a good thing, as we would use indentation to show logical structure. In this case however, the indentation seems to jump about at random, without apparent logic. So it doesn't actually help anyone. I'd suggest you format the code carefully in a separate file first. Do not use tabs - ever - in code, as they are the spawn of Satan and display different widths on different computers (or even different programs), and are the primary cause of badly-formatted code. Things that look indented on one system, aren't when you move to another.
Plus, who needs 8 whole spaces of indentation per level? (On average.) I'd use 4 as an absolute maximum - with 2 being my own preference. See how wide the whole program is now above, as the tabs drive everything toward the right side of the screen? Ugh. When I have to use my horizontal scroll bar to see what a line does, there's something wrong. Use fewer spaces to indent, and that problem will go away.
On an unrelated note, what do MS1 and BTS1 mean? These names are extremely uninformative, and do nothing to help people understand what you're trying to do here.

"I'm not back." - Bill Harding, Twister
Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Ok Jim I'll format my code again and then post it up again. Thanks for the advice, it does make sense. Cause it can be annoying when someone has to use their scroll bar.
Oh MS means Mobile Station - its basically a celluar phone.
BTS means Base Transceiver Station - its the antennas that you see that receiver and send signals to and from your celluar phone. Some times you see them when you are driving in your car. They are bascially huge antennas that the celluar company uses.
As you can guess by now am doing a project on simulating a GSM celluar network, where GSM is European standard for celluar commnication and after that I have to do an IS-41 network which is the american version of GSM.
Am suppose to measure the amount of bytes being between each component in the network. An well the MS and BTS are 2 possible compoenets in the network. There are many others but I have reached that point in the project yet.
oh and since there are more than one MS and BTS I gave it the names MS1 and BTS1 and MS2 and BTS2 to keep track of how much there is in the network.
Thank again for reading and the advice.
yours resepctfully Avin Sinanan
Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Hello again,
I've edited and formatted the code. It looks a bit better now.
If its not good enough please let me know and I'll do some more formatting ok.
Thanks again for all the advice so far.
Yours respectively Avin Sinanan
Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Hey I realized I forgot to post some classes.
I just posted the missing classes ( Its within the first posting). Its about 5 extra classes. But the 5 extra classes are short.
Thanks for having some patience with me.
Yours respectuflly Avin Sinanan
subject: Discete Event Simulation Question (Code) ?
Similar Threads
How to plot a graph in Java ?
To Rob , Manfred or Dirk.. I have a request..
Could someone give this piece of code a look?
Program Anomaly
Drawing with mouse