Sunday, 19 March 2017

Simulation in GPSS

Objective: To study the simulation of single server window having the job arrival that can be given by the uniform distribution of 10±5. The service rate of the system is given as 8±4. Estimate the simulation for 480 time units.

This code will require the require pre knowledge of building blocks like
1.       Generate:
The syntax of generate block is given as
Generate A,B,C,D,E
Here A,B,C,D,E are operands
A = average value of uniform distribution
B = half-width of uniform distribution
C = time delay before first transaction is generated
D = maximum number of transactions generated
E = priority allocated to transactions

So on the basis of the data provided we can write it as
GENERATE 10,5



2.       As in the system the arrival may be queue so we may require to buffer job to do so we require Queue. This En-queue process is done by command Queue.
Syntax of the Queue is
QUEUE  A,B
Here A and B are the Operands
A = Name of the Queue
B= Number of Elements to be entered by default it is one.
3.       After the job has arrived the System it will occupy the processor and start its execution.
This is done by SEIZE command. This facility can be processor.
The Syntax will be
SEIZE A
A is the name of facility  

4.       The Execution of the Jobs starts and jobs is removed from the Queue
This de-queue process is given by the command DEPART
Syntax of the DEPART is

DEPART A,B
Here A and B are the Operands
A = Name of the Queue
B= Number of Elements to be entered by default it is one.
5.       The Execution  of the Job will be done at the processor and the time will advance according to the service time

The syntax of time advancement is given as
ADVANCE A,B
A = Average IAT
B= Half IAT


6.       After this job execution it is has to release the occupied resources.
This is done by RELEASE Command

 The Syntax will be

RELEASE A
A is the name of facility  


7.       Then we  Terminate the process Cycle by writing the Terminate Statement


TERMINATE A
Here is the number if value to decremented but in this case we will
Not decrease the count as it depends upon Timer.



So we have to define the timer also

The timer will consist of 2 statements
GENERATE and TERMINATE
Code snippet for the same can be written as
GENERATE 480
TERMINATE 1
Another Statement START can also be added to define the number of Runs.

The Final code for the problem is given below
GENERATE 10,8
QUEUE     JOB
SEIZE     PROC
DEPART    JOB
ADVANCE   8,4  
RELEASE   PROC
TERMINATE  
     


GENERATE  480
TERMINATE 1
START 1

Saturday, 18 March 2017

Plotting the graph for curves with infinity in Excel on line chart

The infinity is the point that never meets but in excel we have the limit of the data that is the maximum and minimum value that can be represented. For simplicity, We have assumed some table as shown below

1
Infinite
2
1.93
3
Infinite
4
3.16
5
Infinite
6
4.40
7
Infinite
8
5.64


Now if you will plot this on excel you will get a graph that can not read infinite. The excel will not be able to generate the graph properly.

So this infinity should be defined in some mathematical term. I have considered the value of tan 180oThat can be generated by using the formulae:

=tan(pi()*180/360)

Copy this value which is very large in the cells having infinite or place the formulae for +infinity.
Now using the scatter XY plot draw the curve as shown in the figure below:

Figure 1: selecting the graph from excel

The resultant graph is shown below

But it is not the actual picture the actual value have been reduced to very small value so we have to reduce the scale of the Y axis. To do this find the maximum and minimum values for the remaining values that may be suitable. We have selected max as 8 and min as 0.

Now format axis by clicking the axis as shown in the figure


Update the minimum and maximum to fixed values as shown in the figure



The resultant graph has been shown below

Here the line seems to be parallel and will meet at infinity.