Repository navigation
Expand file tree
/
Copy pathqnet.h
More file actions
executable file
·45 lines (35 loc) · 1.49 KB
/
Copy pathqnet.h
File metadata and controls
executable file
·45 lines (35 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/******************************************************************************
* File: qnet.h *
*******************************************************************************/
#ifndef QNET_H
#define QNET_H
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rngs.h" /* random number generation package */
#include "rvgs.h" /* functions for random variate generation */
#include "rvms.h"
#include "queue.h"
typedef enum {OPEN, CLOSED} qnt;
typedef enum {IDLE, BUSY} actvty;
typedef struct {double (*func)(void);} rv_func;
/* network state, defined in qnet.c: */
extern qnt type; /* either OPEN or CLOSED */
extern int num_nodes; /* number of service nodes + 1 (external) */
extern queue_type *queue; /* queue for each service node */
extern actvty *status; /* status of each server: {IDLE,BUSY} */
extern rv_func *random_time; /* arrival/service time function per node */
/* internal operations: */
void Init(void);
void Initialize(void);
int GetNextNode(int i);
double GetMeanRate(int i);
/* user operations: */
void Network(void);
void Nodes(int num);
void Connect(int from, int to, double p);
void Service(int i, double (*func)(void), double rate);
void Arrival(double (*func)(void), double rate);
void InitialState(void);
void Initial(int i, long j);
#endif /* QNET_H */