Metadata-Version: 2.4
Name: teletraffic
Version: 1.0.0
Summary: Main teletraffic functions
Author-email: Aleksey Hmelevskoy <aleksey.hmelevskoi@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/AlekseyHmelevskoy/teletraffic.git
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# teletraffic

Python library for calculating performance measures of queueing systems using analytical formulas and simulation methods.

---

## Installation

```bash
pip install teletraffic
```

---

## Supported models and functions

### `E` — Erlang B formula
**Description:** Erlang B loss probability formula.

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers

**Result:**
- `p` — call loss probability

---

### `Hi` — Palm–Jacobaeus formula

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers
- `d` — number of busy servers

**Result:**
- `p` — call loss probability

---

### `PalmTable` — Palm loss table

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers

**Result:**
- `p` — call loss probability

---

### `M_M_V_L_an` — Analytical M/M/V/L model (Kendall–Basharin notation)

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers

**Properties:**
- `loss` — call loss probability
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the analytical M/M/V/L model

---

### `M_M_V_L_im` — Simulation M/M/V/L model (Kendall–Basharin notation)

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers
- `nz` — number of simulated calls
- `seed` — random seed (default: 0)

**Properties:**
- `loss` — call loss probability
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the simulation M/M/V/L model

---

### `EngsetTable` — Engset loss table

**Arguments:**
- `z` — offered traffic per user, [Erl]
- `n` — number of users
- `v` — number of servers

**Result:**
- `p` — call loss probability

---

### `Mi_M_V_L_an` — Analytical Mi/M/V/L model

**Arguments:**
- `z` — offered traffic per user, [Erl]
- `n` — number of users
- `v` — number of servers

**Properties:**
- `loss` — call loss probability
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the analytical Mi/M/V/L model

---

### `VM_M_V_L_PRA_an` — Analytical VM/M/V/L/PRA model

**Arguments:**
- `vz` — vector of offered traffic intensities by service class, [Erl]
- `v` — number of servers

**Properties:**
- `vloss` — vector of call loss probabilities by service class
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the analytical VM/M/V/L/PRA model

---

### `M_G_V_L_an` — Analytical M/G/V/L model

**Arguments:**
- `ts` — mean service time
- `tbr` — mean time to failure of a server
- `trec` — mean recovery time of a server
- `lmb` — arrival rate
- `v` — number of servers

**Properties:**
- `loss` — call loss probability
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the analytical M/G/V/L model

---

### `ErlangFormula2` — Erlang second formula

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers

**Result:**
- `p` — call loss probability

---

### `M_M_V_W_FF_R_an` — Analytical M/M/V/W/FF/R model

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers
- `ta` — admissible waiting time
- `ts` — mean service time

**Properties:**
- `wait` — waiting probability
- `over_wait` — probability of waiting longer than admissible time
- `avr_time` — average waiting time
- `avr_time_wait` — average waiting time for waiting calls
- `queue` — probability of a non-empty queue

**Methods:**
- `show()` — display QoS characteristics of the analytical M/M/V/W/FF/R model

---

### `M_M_V_W_FF_R_im` — Simulation M/M/V/W/FF/R model

**Arguments:**
- `z` — offered traffic from a group of users, [Erl]
- `v` — number of servers
- `nz` — number of simulated calls
- `ta` — admissible waiting time (default: 0)
- `seed` — random seed (default: 0)

**Properties:**
- `wait` — waiting probability
- `over_wait` — probability of waiting longer than admissible time
- `avr_time` — average waiting time
- `avr_time_wait` — average waiting time for waiting calls
- `queue` — probability of a non-empty queue

**Methods:**
- `show()` — display QoS characteristics of the simulation M/M/V/W/FF/R model

---

### `VM_VMl_V_L_an` — Analytical multiservice VM/VMl/V/L model (full accessibility)

**Arguments:**
- `vz` — vector of offered traffic intensities, [Erl]
- `vb` — vector of bandwidth requirements per service class, [CRU]
- `kc` — number of traffic groups
- `f` — capacity of a traffic group, [CRU]

**Properties:**
- `vloss` — vector of call loss probabilities by service class
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the analytical VM/VMl/V/L model

---

### `VM_VMl_VDg_L_an` — Analytical multiservice VM/VMl/VDg/L model (limited accessibility)

**Arguments:**
- `vz` — vector of offered traffic intensities, [Erl]
- `vb` — vector of bandwidth requirements per service class, [CRU]
- `kc` — number of traffic groups
- `f` — capacity of a traffic group, [CRU]
- `kd` — number of traffic groups accessible to each service class

**Properties:**
- `vloss` — vector of call loss probabilities by service class
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the analytical VM/VMl/VDg/L model

---

### `VM_VMl_VDg_L_im` — Simulation multiservice VM/VMl/VDg/L model (limited accessibility)

**Arguments:**
- `vz` — vector of offered traffic intensities, [Erl]
- `vb` — vector of bandwidth requirements per service class, [CRU]
- `kc` — number of traffic groups
- `f` — capacity of a traffic group, [CRU]
- `kd` — number of traffic groups accessible to each service class
- `nz` — number of simulated calls
- `strategy` — channel allocation strategy (`"МаксСвоб"`, `"МинСвоб"`, `"ПервСвоб"`)

**Properties:**
- `vloss` — vector of call loss probabilities by service class
- `serv` — carried traffic, [Erl]

**Methods:**
- `show()` — display QoS characteristics of the simulation VM/VMl/VDg/L model

---

## Quick start

```python
import teletraffic as ttt

print(ttt.E(9, 5))
print(ttt.Hi(9, 5, 3))
print(ttt.PalmTable(9, 5))

A = ttt.M_M_V_L_an(9, 5)
B = ttt.M_M_V_L_im(9, 5, 1_000_000)
B = ttt.M_M_V_L_im(9, 5, 1_000_000, 0)

print(ttt.EngsetTable(0.4, 10, 5))

C = ttt.Mi_M_V_L_an(0.4, 10, 5)
D = ttt.VM_M_V_L_PRA_an([2, 0.4], 3)
E = ttt.M_G_V_L_an(0.2, 34, 2, 44, 10)

print(ttt.ErlangFormula2(1, 3))

F = ttt.M_M_V_W_FF_R_an(1, 2, 0.05, 0.2)
J = ttt.M_M_V_W_FF_R_im(0.7, 2, 1_000_000)
H = ttt.M_M_V_W_FF_R_im(0.7, 2, 1_000_000, 0)
K = ttt.M_M_V_W_FF_R_im(0.7, 2, 1_000_000, 0, 0)

L = ttt.VM_VMl_V_L_an([10, 12], [1, 5], 3, 20)
M = ttt.VM_VMl_VDg_L_an([10, 12], [1, 5], 3, 20, 2)
N = ttt.VM_VMl_VDg_L_im([10, 12], [1, 5], 3, 20, 2, 100_000, "ПервСвоб")
```

---

## Analytical vs simulation methods

Functions ending with `_an` use analytical formulas.
Functions ending with `_im` use simulation methods.

