You are to write a Python application that will simulate the effects of admission control on a single cell in a mobile cellular network as described below. Admission control is one way cellular networks improve the service provided to their customers in a mature network. During the initial roll-out of most networks, coverage was the primary goal. Cellular coverage areas were made as large as possible to minimize the number of cells needed to cover a population. Most of the time, any user who could attach to a cell would be allowed to do so since the alternative would usually be a blocked call. However, as networks have matured, there are now sufficient cells to provide adequate coverage to the vast majority of users, at leastin most urban and suburban areas. Users at or near the edges of most cells usually have a selection of cells any one of which would provide adequate coverage. Therefore, in a mature network, the emphasis shifts from providing adequate coverage for each user to providing the highest quality connection to each user. Quality is directly related to the signal to interference plus noise ratio (SINR) of the received signal. Large amounts of interference can decrease the SINR and create bit errors in the received signal. For voice calls, this can cause noticeable noise on the line. For data connections, bit errors will cause retransmission of data blocks and the network will often compensate by increasing the amount of error correction bits used, thus decreasing the effective bit rate for data. In both cases, increasing or persistent interference can cause the connection to be lost entirely. One way of improving this situation is to put some controls on the admission of users to the network. Ideally, if a cell is already operating near capacity and the addition of more users would lower performance for users already connected to the cell, the cell may wish to deny access to the new users located near the cell boundary since they can presumably find another cell to serve them. Your project will look at the effect of applying an admission control algorithm to a simple simulation of the downlink for a CDMA cell. Under CDMA, there is a direct connection between the number of users on the cell and the amount of interference experienced by each user. This will make it easier to model the interference effects of additional users. Admission control is particularly important for CDMA systems. Since the interference is closely related to the number of users, it is possible for a system to admit users thereby raising the interference level and thus cause other users to be dropped. The dropped users will usually come from the edges of the cell so the cell will appear to shrink. Of course, once some users are dropped, the interference will go down and the cell will admit more users, thus causing it to expand again. This shrink-expand-shrink-expand cycle is called “cell-breathing”. It is disruptive to users (especially at the edges of the cell) and is one of the reasons admission control procedures are needed. Your basestation will be modeled as an omnidirectional basestation which can serve users within a 10 km radius. For simplicity, we will assume that the antenna radiates isotropically so there is no need to worry about the antenna pattern . The parameters for the basestation are as follows: Basestation Height: 50 m BasestationMaximumTransmitter Power: 15.85 W = 42 dBm Line and Connector Losses: 2.1 dB Antenna Gain: 12.1 dB Carrier Frequency: 1900 MHz The CDMA system and equipment you are modeling will have the following properties: Carrier Bandwidth: 1.25 MHz Bit Rate: 12.5 kbps Processor Gain: 20 dB Noise Level: -110 dBm Required SINR: 6 dB Minimum Pilot RSL: -107 dBm Number of Available Traffic Channels: 56 Your basestation serves a population of users who are all within a 10 km radius around the basestation. The users can appear anywhere within the 10 km radius and will make calls at random during your simulation. Once they are connected to the basestation, their call/session will occupy a traffic channel until it ends (either because the call ends properly or because it drops). Users may appear anywhere within the 10 km radius at any time with equal probability (i.e. uniformly distributed about the interior of the circle), however, once they are connected to the basestation, they are assumed to remain stationary until the call ends. (Our users are good citizens who would not dream of driving a car or walking around distracted while they were on the phone). Call lengths are assumed to be exponentially distributed about the average call duration. The users will have the following properties: Call Arrival Rate: λ= 6 calls per hour Average Call Duration: 1 minute Number of Users: 1000 Your simulation should run over 2 hours with time stepincrements every second. At each time step, users who have an active call in progress must check to see that the SINR is sufficient for the call to continue. Users who do not have a call up must determine whether they will be attempting to make a call and, if so, whether they have sufficient Received Signal Level (RSL) from the basestation to decode the pilot channel and obtain the necessary parameters to attach to the network. Thus, at each second your simulation will need to make several estimates of path loss, shadowing, and fading. Assume the average path loss (PL) can be adequately modeled using the COST231 model tuned for a small city, neglecting the user height term (that is, Cm=0 and a(hm) =0 ) For a user, the RSL will be given in dBm as follows: RSL = EIRP – PL + S + F where PL is found using the COST231 formula with the distance term determined by the location of the mobile, S is the shadowing associated with the location of the mobile, F is the fading at that point in time and all values are expressed in dB (or dBm). Shadowing values should be found using a log-normal distribution (i.e. a normal [Gaussian] distribution in dB) with a mean of 0 dB and a standard deviation of 2 dB . Since shadowing varies with location but is independent of time, shadowing values should be computed for each 10m by 10m square in basestation area at the beginning of your simulation and not recomputed during the time steps. (Of course shadowing values will need to be looked up when mobiles appear and need to perform an RSL calculation). Fading values will need to be obtained every second by sampling a Rayleigh distribution. This can be done either by 1) taking the magnitude of a Gaussian complex number (if x and y are Gaussian random variables with the same standard deviation, then |x+jy| will be Rayleigh distributed), OR 2) using the Rayleigh routine from the Numpy library. Note that the values of the Rayleigh distribution should be thought of as multipliers to the received signal. Hence to use them in the power computation above for RSL, it is necessary to square them and convert to dB. That is, if x is the Rayleigh value from either of the above methods, then F = 20*log10(x). For this simulation, we will assume that a mobile can attach to the network if the RSL for the pilot channel is greater than the minimum pilot RSL which for this situation we will take to be 3 dB above the noise floor, -107 dBm. Note that the RSL in this case will be computed using the EIRP of pilot channel. To determine if a call can be maintained we must check that the SINR of a call is above the Required SINR. The Noise level is given as -110 dBm. To obtain the signal level, we start by computing the RSL as described above using the maximum EIRP of the basestation, that is, the EIRP using the maximum transmitter power. Note that both the desired signal and the interference from other users will arrive at this RSL level. However, in a CDMA system the desired signal can be de-spread using a correlator receiver. The net effect for our problem is that the signal level will be increased by the system processor gain, PG, given above: Signal_Level= RSL + PG The interference level will arrive at the same RSL since the other users are simply using other codes. These codes will not be de-spread, but their interference effects will add up, that is, the interference on the system will be proportional to the number of other users on the cell. Thus, if there are N users on the cell (including the desired user), we can convert to dB and find that Interference_Level = RSL + 10*log10(N-1) Now to compute the SINR, we must combine the Noise Level and the Interference Level. To do this, both the noise and interference must be converted to linear, added, and then converted back to dB before subtracting from the signal level. After initializing parameters, your simulation should run a loop over time in seconds. At each second, your simulation should determine what happens to the users who currently have active calls and then, for the remaining users, it should determine whether they attempt to make a call and, if so, whether they can connect to the network. For each user who has an active call up, there are several things to compute and check: 1. First we must check if the user’s call has ended. Each call should have a time counter to see if it has lasted the proper duration determined at call set up (below). If the call is done, then the user disconnects, the channel they were on is freed, and the completed call count is increased. Once a call has terminated, there is nothing else to do for that call (though it is possible that the user may attempt another call). 2. If it is determined that the call is not finished, we must see if there is sufficient SINR for it to continue. If the computed SINR is greater than or equal to the minimum SINR, then the call continues. If not, there is a problem: some of the call information or data did not go through and was lost in the noise and interference. While it would be tempting to count this as a drop, that would not be realistic. Modern systems can usually survive a few lost packets without dropping the connection. We will simulate this behavior by allowing the call to continue until we fail the SINR criterion for three consecutive seconds. Once that happens, the call will be disconnected and counted as a dropped call. Similar to the situation where a user’s call will fail the SINR test, there will be cases where the user attempts to make a call but fails the RSL test (described below). These callers will also be allowed to make 3 attempts before being recorded as a blocked call. Thus we will need to keep track of users who are attempting a call. Note that processing the second and third attempt will be similar to the first attempt (described below) For each user who does not have an active call up, we must see if they attempt to make a call, and, if so, whether the call connects: 1. To see if a user attempts a call we use the random number routines. Each user has a probability of making a call determined by λ (be careful to make sure your units make sense, since you are counting in seconds, not hours) 2. Once it has been determined that a given user is attempting to make a call, we need to see if the call connects. This is the first time we need to know where the user actually is. Since a user is assumed to be able to move anywhere within the circle when not attempting a call, the user location must be determined each time they make an initial attempt. We assume the users are uniformly distributed throughout the 10 km radius circle about the basestation. (Be careful here: it is a bit tricky to arrange it so that each point of the circle has the same probability of having a user….) 3. After the user’s location is known, we can compute the distance to the basestation and, consequently, the COST231 path loss and shadowing. These values won’t change from one time instant to the next. To get the current RSL for the pilot channel, use the EIRP of the pilot, the path loss and shadowing values just determined, and a fading value which we compute for this time and location. 4. If the RSL of the pilot is less than the minimum pilot RSL, the user cannot decode the basestation information. In most modern systems, the user equipment will not give up after one try. We will simulate this by allowing the user to make another connection attempt in the next second. If the connection fails 3 seconds in a row, then the call is blocked due to low signal strength and no further attempts are made for this user at this location (Of course, the user may try to make another call in accordance with 1) above). 5. If the RSL of the pilot channel is greater than or equal the minimum pilot RSL, the user can communicate with the basestation. However, we must still determine if there is a channel available for the user. Your simulation should take care to keep track of the number of channels currently in use. This will change during the course of even a single second as some users may complete a call while others make additional attempts or be connected prior to this user being considered. 6. If there is a channel available, then the user can set up a call. The call duration is now determined by sampling an exponential distribution with mean equal to the average call duration. As described above, your simulation must keep track of this so that it can be determined when/if the call completes successfully. The number of successful call connections should be incremented along with the number of active calls. This call should be placed on e.g. an active call list so it can be evaluated as described above in the coming seconds. 7. If there is no channel available, then the call is blocked due to channel capacity. The call attempt is abandoned, as we are assuming a blocked-call-cleared strategy for channel capacity. Your program should keep track of the number of attempted calls and the disposition of each call. This should include the following statistics: • Number of call attempts not counting retries • Number of call attempts including retries • Number of dropped calls • Number of blocked calls due to signal strength • Number of blocked calls due to channel capacity • Number of successfully completed calls • Number of calls in progress at any given time • Number of failed calls (blocks + drops) • Current cell radius (distance between the basestation and the most distant connected user) Print out your statistics every 2 minutes of simulation time. You should pay careful attention to the statistics at the end. Run your program several times, keeping track of the parameters above. Q1: what is the ratio of the number of dropped calls to the number of completed calls? What is the main reason for call failure? Are blocks for channel capacity? The program as described so far implements a system without any admission control. We can create a simple admission control system by lowering the EIRP of the pilot channel when the system demand is too high. This will cause weaker mobiles at the edge of the cell to block more often because of RSL. In a practical sense you will be forcing the cell to shrink. Your program should set a number of channels in use, Cd, above which the EIRP of the pilot will be decreased. Of course, by decreasing the strength of the pilot channel you will decrease the number of users on the system. You don’t want this number to get too low or you will be simply not serving users which you could easily handle. So, your program should also set a number of channels, Ci, below which the EIRP of the pilot will be increased. At the end of each second, your program should check the number of channels currently in use. The change in EIRP can be taken to be 0.5 dB up or down. Note that your program should never transmit more than the EIRP computed using the maximum transmitter power. Similarly, you should put a lower bound on the EIRP of the pilot of 1 W, 30 dBm. NOTE that you are only changing the EIRP of the pilot, not the EIRP on the communications channels where users have calls up.Initially, start with setting Cd to 57 and Ci to 0 which will effectively disable admission control. You can run your program and make sure it behaves in the same fashion as before. Delta_EIRP_Pilot: 0.5 dB Cd : 57 Ci: 0 Q2: Change the values of Cd and Ci to 20 and 15 respectively. What happens to your statistics? What is the ratio of dropped calls to completed calls now? How has the number of blocked calls changed? What is the effect on the cell radius? Q3: Increase the number of users to 10000 and rerun your simulation, first with no admission control (i.e. Cd and Ci set to 57 and 0 respectively) and then with the Cd and Ci values from Q2. What happens to the blocks due to channel capacity? How do they change when the Cd and Ci values change? Once you’ve completed the simulation, feel free to vary the parameters and play with it! Have fun! While the structure of the simulation is for you to decide/develop, I would recommend creating a module of functions that perform various pieces of the problem (e.g. path loss calculations, fading, SINRcalculations, etc.) and also a script to run the main simulation. The independent functions can be debugged and tested separately, which will make writing and debugging the main scripts easier. TIPS: I would recommend using some sort of data structure to keep track of mobiles with active calls. The “mobiles” in the previous sentence may also be some sort of data structure. Also, debugging programs which call random number generators can be quite challenging. It may be helpful to seed the random number generator at the beginning of your code while you debug it. See documentation for np.random.seed(). You can comment out the call to the seed function once you are done debugging. NOTE that the python random number generator seed random.seed() and the numpy random number generator seed np.random.seed() are DIFFERENT. You should consistently use only one set of random number generation routines. Please submit the Python source code implementing the simulator and scripts to run it. In addition, write and submit a short report giving the results generated by the code and the answers to the questions given in Q1, Q2, and Q3. PLEASE NOTE: in addition to correctness and functionality, the code will also be evaluated for style. Thus, you should pay attention to software design and engineering issues such as: code modularization, code block organization, variable naming, comments, efficiency, etc. I would appreciate it if you would only use Python (version 3.3 or higher) Numpy and Matplotlib to create your code. Remember: I am going to execute your code as part of your grade.