Skip to content

bertwang123/Master_thesis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions for the programs in ShengYuan's thesis

tags: thesis, README, code

This article is the instructions of the program in ShengYuan's thesis. The purpose of the program is to compare different methods under different parameter settings in terms of different metrics. As to all the details of the methods, parameters and metrics, please refer to the thesis.

Simulation environment setting

The simulation program in the thesis is totally written and run in MATLAB. The download link and install instructions can be referred to 國立清華大學 MATLAB& Simulink 全校授權單機版安裝說明. If the further language and instructions of development environment is needed, please refer to the official webpage Help Center.

MATLAB

  • Version

    • Developed in version R2020b. The same or later version is recommended.
  • Required toolbox

    • Signal Processing Toolbox (pow2db/db2pow functions)
    • Statistics and Machine Learning Toolbox (probabilistic models)
    • Parallel Computing Toolbox (parfor)
  • Operating system

    • Developed in Windows 10 Education version 21H2. Refer to the official webpage System Requirements for other options and take note of the minimum requirements for hardware.
  • Matters needing attention for parallel computing

    • parfor is used in the program. It runs on either a single computer with multiple cores or multiple machines. The default setting is on multiple cores in local machine. For more advanced settings, please refer to Discover Clusters and Use Cluster Profiles.
    • Before run on a new simulation environment, please check the number of physical cores. Check if the CPU usage corresponds to the expected Cluster Profiles setting. Please note that the total number of threads should not be greater than the number of physical cores in the environment according to the previous document. Otherwise, the CPU performance will be reduced.
    • If Hyper-Threading is supported in hardware, the number of virtual cores is twice the number of physical ones. According to the official document What Is Parallel Computing?, the default setting is that a single physical core is used by a worker. And the setting is the best when intense computing is needed.

Instructions

After setting the parameters in simulation_option.m and MCS_table.m, all you need to do is run run.m. The former one is to set the methods and metrics, and the latter one is to set the MCS-SE-SNR table. The other simulation parameters can also be adjusted in the upper part of run.m. And this is the only main program among all. Once run.m is run, the simulation data will be save as .mat and the simulation result will be plotted.

Modification of simulation_option.m

If you want to select the simulation methods and metrics, please note:

  • selected_methods and selected_metrics are cell arrays which represent the strings of methods and metric already implemented respectively. You can select the ones you want to display and modify the arrays.

Modification of MCS_table.m

If you want to modify the elements of the MCS-SE-SNR table, please note:

  • This script does only one thing. It declares a two-dimension array.
  • The indice of rows are the serial numbers of modulation and coding schemes (MCS).
  • The first column is the number 'M' in M-ary MCS, i.e., it is log2(number of bits in a symbol). The second column is the spectral efficiency (SE) corresponding to the MCS. The last column is the corresponding signal-to-noise ratio (SNR) threshold.
  • If you want to update the table, just follow the above description and modify the elements in this array.

Modification of simulation parameters

If you want to modify the simulation parameters, please note:

  • You can directly modify the parameters in the upper part of run.m. The values correspond to the settings written in the thesis. Take a brief example to explain. If you want to reduce the number of users from 100 to 60, increase the length of mini-slot from 2 to 4 and decrease the number of simulation times from 1000 to 100, then you may modify the values like below:
   num_of_users = 4:8:60;  % the number of users from 4 to 60 increased by 8
   
   len_minislot = 4;  % the length of mini-slot
   
   num_of_instance = 100;  % the number of simulation times and take average.
  • The variable path is a string that represents the path simulation results save at. The default pattern is .\results\archive\yyyy_mmdd_HHMMSS, where 'yyyy', 'mm', 'dd' is the date and 'HH', 'MM', 'SS' is the moment when the simulation starts. The results will be saved in the innermost folder. The results will be generated phasedly with the growth of the number of users. The name of each result includes a character 'U', which represents the range of number of users currently. The purpose is to prevent data loss when the system is down unexpectedly.
  • The boolean variable plotFig is set to default value true, which means the results will be plotted as soon as the simulation is done. The simulation metrics you select in the cell array selected_metric in function sinulation_option.m will be shown and they will be saved as .fig in the path path. The purpose is to look the results up in a fast and convenient way. If you want to disable it, just set the variable plotFig to false.

Run the simulation

All you need to do is run the main program run.m. When the command window shows Overall time = xxx.xxx sec and the simulation results are generated as .mat in the path path described as above, the simulation is successfully completed.

Check the results and plots

  • The aforementioned .mat will save the current variables in the workspace. Loading .mat can check every value in the current simulation, including the three-dimension array sim_results which saving the final results and other variables used during the program operation. The array sim_results can be referred to Simulation results in Important data structure.
  • The folder ..\fig saves the source files (.m) of figures shown in Section 6.3 Simulation results in the thesis. Each file name corresponds to the serial number of figure in the thesis. Running the files directly can obtain the same figures as the ones in the thesis. Besides, we use the function my_export() saved in .\Matlab_function\my_export.m on these files. Please refer to do's and don'ts of my_export() before you use it.

Program structure

Functions in the programs call each other if they need. The functionality of mainbody.m is to unify all the programs and generate the results. run.m inputs all the parameters to mainbody.m and obtain the results from it.

Program flow

No matter which method, the proposed one or the compared one, is being run consists of a set of methods. A set of methods includes two phases. Phase I is the method of User Grouping. It varies from method to method. Phase II is the method of Group Scheduling. There are also different methods in this phase. The details of these methods can be referred to the thesis.

Important data structure

channel_gain_matrix

A one-dimension array saving sorted channel coefficients of all users.

modulation_requirement

A table saving different SINR thresholds and the minimum number of RBs needed for a 32-byte packet transmission. The details can be referred in Section 4.1 in the thesis.

grouping_result

A one-dimension array saving the group numbers of all users.

schedule_result

A three-dimension table saving the scheduled resource table.

  • The first dimension represents frequency bands.
  • The second dimension represents time slots.
  • The third dimension represents the number of pages. A page consists of 6 frequency bands and 7 mini-slots (0.5 ms) in the thesis.

Simulation results

A three-dimension array saving the following elements as an example:

  • The first dimension: different methods from the proposed one to OMA scheme.
  • The second dimension: different metrics from the number of resource blocks (NRB) to the throughput (TP).
  • The third dimension: different number of users from 4 to 100.

How to modify the program

If you want to modify the proposed method, compared method or simulation metrics, you should start from simulation_option.m and mainbody.m. You can imitate the original codes to maintain the existing structure. Feel free to add or modify functions if you need.

How to add a new method

After implementing a new method as a function, add a line of code to call the new function in mainbody.m. Besides, use updateTable.m to save the variable which saving the temporary results of the new method into the two-dimension array.

How to add a new metric

You can refer to the way written in the simulation_option.m, which uses strings to represent the metrics. Then add a new variable to save the desirable value. Like we mentioned above, don't forget to use updateTable.m to save the variable which saving the temporary results of the new method into the two-dimension array. Finally, if you set the value of plotFig in run.m to true (default), you need to modify figCreate.m and add a plotting function in .\figCreate. The above modification can be referred to the existing plotting function and figCreate.m.

Program functionality

Briefly explain the functionality of each program. Sorted in alphabetical order.

calc_reliability.m

To calculate the reliability of different methods.

calc_responseTime.m

To calculate the response time of different methods.

calc_throughput.m

To calculate the throughput of different methods.

calc_turnaroundTime.m

To calculate the turnaround time of different methods.

cell_deployment.m

To deploy the location of the base station (BS). We set the number of BS to 1 in the simulation.

channel_gain_initialization.m

To calculate channel coefficients of all the users.

figCreate.m

To plot the different metrics among differents methods.

linear_programming.m

To solve the linear programming problem.

mainbody.m

The main program. We have described above.

A script saving the corresponding modulation schemes, spectral efficiency and SNR thresholds.

modulation_decision_Origin.m

The compared method of deciding modulation scheme in User Grouping.

modulation_decision_Our.m

The proposed method of deciding modulation scheme in User Grouping.

randomized_user_position.m

To deploy the location of users randomly.

requirement_calculation.m

To calculate the different SINR thresholds and the minimum number of RBs needed for a 32-byte packet transmission corresponding to different modulation schemes saved in modulation_requirement.

run.m

The only executable program. Including the simulation parameters and plotting commands.

scheduling_Origin.m

The compared method in Group Scheduling.

scheduling_Our.m

The proposed method in Group Scheduling.

To save the desirable metrics and methods for the simulation.

updateTable.m

To update the newly added metrics and methods.

user_grouping_2NOMA.m

The method of grouping for 2-NOMA scheme in User Grouping.

user_grouping_Our.m

The proposed method of grouping in User Grouping.

About

Master Thesis: URLLC

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published