You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+43-16Lines changed: 43 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,14 @@
2
2
3
3
The documentation covers the following aspects:
4
4
5
-
[TOC]
5
+
*[Introduction](#introduction)
6
+
*[Modeling](#modeling)
7
+
+[Processes](#processes)
8
+
+[Resources](#resources)
9
+
+[Putting it together](#putting-it-together)
10
+
*[Monitoring](#monitoring)
11
+
+[Reports](#reports)
12
+
6
13
7
14
## Introduction
8
15
@@ -77,41 +84,59 @@ In any case, it is simple to extend the standard resources given that the code i
77
84
78
85
### Putting it together
79
86
80
-
Processes that interact with common resources may create highly dynamic behavior which may not be analytically tractable and thus has to be simulated.
87
+
Processes that interact with common resources may create highly dynamic behavior which may not be analytically tractable and thus have to be simulated. Sim# includes a number of samples that, while being easy to understand and simple, show how to model certain processes such as preemption, interruption, handover of resource requests and more. A short summary of the provided samples together with the highlights are given in the following:
88
+
89
+
##### [BankRenege](../src/Samples/BankRenege.cs)
90
+
91
+
- Timeout when waiting for a resource
92
+
- Track and print statistics
93
+
94
+
The bank renege sample uses a single shared resource (bank teller) that customers queue for. There is a single queue and each customer has a certain patience for waiting in the queue. When the patience has run out, the customer will leave the queue without doing business. The queue is not explicitly added to the model, but is part of the Resource that models the bank teller. This resource can automatically track statistics on the queue's length and waiting time.
81
95
82
-
It is best to look at the many samples that have been provided along with the Sim# sources to see both simple and more complex models. Here is a short summary:
- Combination of discrete (fuel pump) and continuous resource (tank)
99
+
- Use of *When*-events to react to resupply of the tank
85
100
86
-
This sample uses a single shared resource (bank teller) that customers queue for. The model shows how quitting a queue prematurely is possible, for instance because the customer has run out of patience. It also tracks and prints several statistics.
101
+
The gas station refueling sample uses both a discrete (fuel pump) and a continuous (tank) resource. Cars are queuing at the fuel pump and consume gasoline from the tank. When the tank runs below a certain threshold a truck is dispatched to refill it. *When*-events of resources were introduced as part of the Sim# 3.1 release (they are ported from the [desmod](https://desmod.readthedocs.io/en/latest/) package - an extension of SimPy). Note that the Sim# is a discrete event simulation kernel, thus there cannot be a continuous drain from the tank.
This sample uses both a discrete (fuel pump) and a continuous (tank) resource. Cars are queuing at the fuel pump and consume gasoline from the tank. When the tank runs below a certain threshold a truck is dispatched to refill it. This shows how *When*-events of resources can be used. These events have been introduced with Sim# 3.1 (they are ported from the [desmod](https://desmod.readthedocs.io/en/latest/) package - an extension of SimPy).
105
+
- Usage of Monitors to track variables in user code
91
106
92
-
*[KanbanControl](../src/Samples/KanbanControl.cs)
107
+
The kanban control sample shows how a simple production system that uses kanban can be modeled. It shows how to use monitors to track a variable of interest (the number of kanbans in stock over time).
93
108
94
-
This samples shows how a simple production system that uses kanban can be modeled. It shows how to use monitors to track a variable of interest (the number of kanbans in stock over time).
109
+
##### [MachineShop](../src/Samples/MachineShop.cs) and [MachineShopSpecialist](../src/Samples/MachineShopSpecialist.cs)
95
110
96
-
*[MachineShop](../src/Samples/MachineShop.cs) and [MachineShopSpecialist](../src/Samples/MachineShopSpecialist.cs)
111
+
- Interrupting other processes
112
+
- Usage of PreemptivePriorityResource and ResourcePool
97
113
98
-
In this model a production system with machine break-downs is described. It shows how to interrupt processes, e.g. in the case of a break-down the current job is suspended. The -Specialist model additionally shows how to use the ResourcePool to model repairman with different characteristics.
114
+
In this model a production system with machine break-downs is described. In the event of a break-down the current job is interrupted and suspended until a repairman has been dispatched to fix it. The -Specialist model additionally shows how to use the ResourcePool to model repairman with different characteristics.
The "Hello World" of simulation models. It shows how to perform repetitions and track statistical properties. It also prints the analytical properties of this system - which are known in this case.
This model describes a simple producer-consumer situation. It shows how processes may interact with each other using a Store resource.
107
130
108
-
*[SimpleShop](../src/Samples/SimpleShop.cs) and [SteelFactory](../src/Samples/SteelFactory.cs)
131
+
##### [SimpleShop](../src/Samples/SimpleShop.cs) and [SteelFactory](../src/Samples/SteelFactory.cs)
132
+
133
+
* Acquiring and releasing a resource in separate processes
109
134
110
135
These model describe a two-step production. The first step may be blocked by the second. The models should show how one process may obtain a resource, but another processes releases that resource.
111
136
112
137
## Monitoring
113
138
114
-
Monitoring is new with Sim# 3.2. Instead of following the SimPy approach which is difficult to translate to .NET. The implementation in Sim# is more akin to [Salabim](https://www.salabim.org).
139
+
Monitoring has been introduced with Sim# 3.2. Instead of following the SimPy approach which is difficult to translate to .NET. The implementation in Sim# is more akin to [Salabim](https://www.salabim.org).
115
140
116
141
There are two different kinds of monitors:
117
142
@@ -128,7 +153,9 @@ var server = new Resource(env, capacity: 5) {
128
153
};
129
154
```
130
155
131
-
Monitors may be created with ```collect: true```. This means the monitor will keep the datapoints and thus can compute median, percentiles, and print a histogram of the data. By default collect is false, which still allows computing min, max, mean, standard deviation, count, and sum in a memory efficient way.
156
+
Monitors may be created with ```collect: true```. This means the monitor will keep the datapoints and thus can compute median, percentiles, and print a histogram of the data. By default collect is false, which still allows computing min, max, mean, standard deviation, count, and sum and in a memory efficient way.
157
+
158
+
As has been mentioned above, the KanbanControl sample shows how to use monitors in the code that describes the model in order to track own variables of interest.
0 commit comments