# Library in Everyday Operation

The scenario **`everyday`** of the **[library](/docs/synthevents/library)** is a library in everyday operation: **readers** who borrow, renew, return, and pay, and a **librarian** who looks after the stock. Its rules and its opening hours keep the time zone **`Europe/Berlin`**. Its figures are set **by hand and coarsely**, as what a library like this plausibly does, not measured from any real one.

## The Library's Policy

| Policy | Value |
|---|---|
| Time zone | `Europe/Berlin` |
| Loan period | 21 days |
| Renewals per loan | at most 2 |
| Late fee | 50 cents per started day overdue |

So `borrowedUntil` lies 21 days after the day a loan starts or is renewed, in Berlin, and a copy returned three days late costs 150 cents.

## Opening Hours

The library is open **Monday to Friday from 10 a.m. to 7 p.m.** and **on Saturday from 10 a.m. to 2 p.m.**, and closed on Sunday, on its own wall clock. On a weekday, most readers come **late in the afternoon**, and on Saturday **around noon**. The last reader comes in a quarter of an hour before closing time.

## Taking Over the Stock

The library existed before its records were kept here, so a run begins by **taking over its stock**: **three copies for every reader**, imported as `book-imported` one after the other, a few milliseconds apart, from the beginning of the range on, as a migration runs.

The readers start once the import is done, with their first visits spread over the weeks that a loan and a pause take, so that the library does not open to a crowd. Until the first loans come back, a data set is somewhat quieter than later on.

## The Works

The works are **composed rather than taken from real books**: a title of the scenario's own words, after a handful of patterns, an author's name from a generator of names, and an ISBN from a generator of digits that no other work in the data set has.

How much a work is wanted is drawn once, after a long tail, so that **a few works are much in demand** and most are borrowed now and then. A work in demand has more copies, but **fewer than its demand would call for**, so readers crowd around the most wanted works and are refused now and then.

## The Readers

- A reader comes back **around the day a loan is due**: mostly a few days before, now and then late, which costs a fee. Most readers pay it at once, and the rest at their next visit.
- While a loan may be renewed, readers **renew** it now and then instead of bringing the copy back.
- Once they have brought everything back, they **pause** for about as long as is their habit, which is drawn for each reader once.
- Then they come to borrow **one to three works**: first those they could not get before, then others, as often as each is wanted.
- When every copy of a work is out, they **try again** at a later visit, and give up after a few tries.

## The Librarian

The librarian comes **every Tuesday morning**. In a year, he **acquires** about a tenth of the stock, half of it new works and half of it more copies of works in demand, and **withdraws** about half as many copies, choosing copies of works that hardly anyone wants.

## What This Means for the Data

- The **population** of the scenario is counted in **readers**. The stock grows with them, and the librarian reckons in shares of the stock, so the number of events grows in proportion to the number of readers.
- Apart from the import at the beginning, the events happen during the **opening hours** of the library, in Berlin time. Their `time` is in UTC, so a visit at 6 p.m. in winter has a `time` of 5 p.m.
- A reader who is **refused**, such as because every copy of a work is lent, leaves no event. What you see of it is a later `book-borrowed`, or none.
