ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:50.21KB ,
资源ID:10204128      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10204128.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(修理店仿真报告.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

修理店仿真报告.docx

1、修理店仿真报告修理店仿真报告一、实验内容和目的1、应用排队系统流程图,用C语言编制仿真程序,求解以下问题。 修理店只有一个修理工,来修理的顾客到达次数服从泊松分布,平均4人/h;修理时间服从指数分布,平均需6min。试求(随机数发生器采用float lcgrand(int stream) ,种子stream 为自己学号的最后两位。): 修理店空闲的概率; 店内有三个顾客的概率; 店内至少有一个顾客的概率; 在店内顾客的平均数; 顾客在店内的平均逗留时间; 顾客必须在店内消耗15分钟以上的概率。2、 将到达时间间隔和平均修理时间按如下要求修改后运行程序,给出运行结果。(1)平均到达时间间隔 10

2、学号的最后一位(2)平均修理时间 INT(平均到达时间间隔/3)二、程序清单/* External definitions for single-server queueing system. */#include #include /*#include lcgrand.h Header file for random-number generator. */#define Q_LIMIT 100 /* Limit on queue length. */#define BUSY 1 /* Mnemonics for servers being busy */#define IDLE 0 /*

3、and idle. */int next_event_type, num_custs_delayed, num_delays_required, num_events, num_in_q, server_status;float area_num_in_q, area_server_status, mean_interarrival, mean_service, sim_time, time_arrivalQ_LIMIT + 1, time_last_event, time_next_event3, total_of_delays;float a19, total_of_server, are

4、a_3_in_q, abv_1,area_num_in_h;FILE *infile, *outfile;/* The following 3 declarations are for use of the random-number generator lcgrand and the associated functions lcgrandst and lcgrandgt for seed management. This file (named lcgrand.h) should be included in any program using these functions by exe

5、cuting #include lcgrand.h before referencing the functions. */float lcgrand(int stream);void lcgrandst(long zset, int stream);long lcgrandgt(int stream);void initialize(void);void timing(void);void arrive(void);void depart(void);void report(void);void update_time_avg_stats(void);float expon(float me

6、an);main() /* Main function. */ /* Open input and output files. */ infile = fopen(mm1.in, r); outfile = fopen(mm1.out, w); /* Specify the number of events for the timing function. */ num_events = 2; /* Read input parameters. */ fscanf(infile, %f %f %d, &mean_interarrival, &mean_service, &num_delays_

7、required); /* Write report heading and input parameters. */ fprintf(outfile, Single-server queueing systemnn); fprintf(outfile, Mean interarrival time%11.3f minutesnn, mean_interarrival); fprintf(outfile, Mean service time%16.3f minutesnn, mean_service); fprintf(outfile, Number of customers%14dnn, n

8、um_delays_required); /* Initialize the simulation. */ initialize(); /* Run the simulation while more delays are still needed. */ while (num_custs_delayed num_delays_required) /* Determine the next event. */ timing(); /* Update time-average statistical accumulators. */ update_time_avg_stats(); /* Inv

9、oke the appropriate event function. */ switch (next_event_type) case 1: arrive(); break; case 2: depart(); break; /* Invoke the report generator and end the simulation. */ report(); fclose(infile); fclose(outfile); return 0;void initialize(void) /* Initialization function. */ /* Initialize the simul

10、ation clock. */ sim_time = 0.0; /* Initialize the state variables. */ server_status = IDLE; num_in_q = 0; time_last_event = 0.0; /* Initialize the statistical counters. */ num_custs_delayed = 0; total_of_delays = 0.0; area_num_in_q = 0.0;area_server_status = 0.0;area_3_in_q = 0.0;abv_1 = 0.0;area_nu

11、m_in_h = 0.0;total_of_server = 0.0;a19 = 0.0; /* Initialize event list. Since no customers are present, the departure (service completion) event is eliminated from consideration. */ time_next_event1 = sim_time + expon(mean_interarrival); time_next_event2 = 1.0e+30;void timing(void) /* Timing functio

12、n. */ int i; float min_time_next_event = 1.0e+29; next_event_type = 0; /* Determine the event type of the next event to occur. */ for (i = 1; i = num_events; +i) if (time_next_eventi Q_LIMIT) /* The queue has overflowed, so stop the simulation. */ fprintf(outfile, nOverflow of the array time_arrival

13、 at); fprintf(outfile, time %f, sim_time); exit(2); /* There is still room in the queue, so store the time of arrival of the arriving customer at the (new) end of time_arrival. */ time_arrivalnum_in_q = sim_time; else /* Server is idle, so arriving customer has a delay of zero. (The following two st

14、atements are for program clarity and do not affect the results of the simulation.) */ delay = 0.0; total_of_delays += delay; /* Increment the number of customers delayed, and make server busy. */ +num_custs_delayed; server_status = BUSY; /* Schedule a departure (service completion). */ time_next_eve

15、nt2 = sim_time + expon(mean_service); total_of_server += time_next_event2-sim_time;if(time_next_event2-sim_time)19)a19+; void depart(void) /* Departure event function. */ int i; float delay; /* Check to see whether the queue is empty. */ if (num_in_q = 0) /* The queue is empty so make the server idl

16、e and eliminate the departure (service completion) event from consideration. */ server_status = IDLE; time_next_event2 = 1.0e+30; else /* The queue is nonempty, so decrement the number of customers in queue. */ -num_in_q; /* Compute the delay of the customer who is beginning service and update the t

17、otal delay accumulator. */ delay = sim_time - time_arrival1; total_of_delays += delay; /* Increment the number of customers delayed, and schedule departure. */ +num_custs_delayed; time_next_event2 = sim_time + expon(mean_service); total_of_server += time_next_event2-sim_time;if(delay+time_next_event

18、2-sim_time)19)a19+; /* Move each customer in queue (if any) up one place. */ for (i = 1; i 0) abv_1 += time_since_last_event;if(server_status = BUSY) area_num_in_h += (num_in_q+1) * time_since_last_event;if(server_status = IDLE)area_num_in_h += num_in_q * time_since_last_event;float expon(float mean

19、) /* Exponential variate generation function. */ /* Return an exponential random variate with mean mean. */ return -mean * log(lcgrand(29);/* Prime modulus multiplicative linear congruential generator Zi = (630360016 * Zi-1) (mod(pow(2,31) - 1), based on Marse and Roberts portable FORTRAN random-num

20、ber generator UNIRAN. Multiple (100) streams are supported, with seeds spaced 100,000 apart. Throughout, input argument stream must be an int giving the desired stream number. The header file lcgrand.h must be included in the calling program (#include lcgrand.h) before using these functions. Usage:

21、(Three functions) 1. To obtain the next U(0,1) random number from stream stream, execute u = lcgrand(stream); where lcgrand is a float function. The float variable u will contain the next random number. 2. To set the seed for stream stream to a desired value zset, execute lcgrandst(zset, stream); wh

22、ere lcgrandst is a void function and zset must be a long set to the desired seed, a number between 1 and 2147483646 (inclusive). Default seeds for all 100 streams are given in the code. 3. To get the current (most recently used) integer in the sequence being generated for stream stream into the long variable zget, execute zget = lcgrandgt(stream); where lcgrandgt is a long function. */* Define the constants. */#define MODLUS 2147483647#define MULT1 24112#define MULT2 26143/* Set the def

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1