## 4 Reference Implementation
### Specifics of CoJoSim's Reference Implementation  
As a foundational step, a simulation software to implement the reference model had to be chosen first. SimPy [54] is widely used in academia for implementing simulation models. However, to ensure applicability, CoJoSim should be implemented in a simulation software which is also widely used in industry. Therefore, it was chosen to implement in Siemens Tecnomatix Plant Simulation (PS), version 14. (Even though the model was originally implemented in version 14 of Plant Simulation, it also runs flawlessly with the current version 17. If there are no drastic changes, it is expected to run in future versions as well.) As one of the market leaders, PS offers an object-oriented structure for mapping classes and objects in a DES, numerous predefined building blocks and the possibility to extend the building blocks using the built-in SimTalk programming language. PS can be controlled through external software by means of a component object model (COM) interface, and data can be exported, among other things, in open formats as comma-separated values [55]. CoJoSim's API uses both possibilities. Using the COM interface, methods within the implementation in PS can be triggered (marked by a blue \"M\" in a gray box in the following figures), which either return smaller data sets or nothing. Additionally, the export of larger data sets is also triggered by the COM interface and then actually exported as comma-separated values. Since DES is well suited for simulating manufacturing systems, CoJoSim was implemented in such a way. The process of implementing was based on the literature (cf. Section 2.1, especially [14; 16]). [PERSON] [55] was consulted for specifics of PS. Basically, all elements are implemented in such a way that these are classes that can be instantiated in the number required in each case. If available, existing building blocks of PS were used and adapted. If unavailable, these were complemented by methods written in the PS-integrated SimTalk programming languages. Based on the structure of CoJoSim (cf. Section 3.2), \"Wafers\" and \"FOUPs\" are generators, generating PS-elements entities (wafers) and carriers (FOUPS) which are then combined. On a given schedule, they are associated with a product type and its respective work route and released to the complex job shop (\"Release\"). The release includes the ConWIP control ensuring a consistent work in process in the complex job shop. Additional products could be easily added by adding further work routes which are structured as described in Section 3.4. As described in Section 3.2, the CJSM consists of machine groups. These machine groups are the most complex part in implementing CoJoSim in PS since they consist of multiple building blocks and methods (cf. Figure 5). Since the underlying MIMAC specifies one to twelve machines per machine group, a flow control for up to twelve machines is implemented. When instantiated, the number of machines in this specific machine group can be selected. Each machine then has a load station, a process station and an unload station. These are parametrized by the product's work route with load time, process time and unload time (cf. Section 3.4). Additionally, the machine group has an input buffer, an output buffer with processed wafers and a transport facility for the next operation in the work route. Several methods had to be implemented to control all necessary building blocks. Last but not least is the dispatcher's task, which will be described in the followingparagraph, which is to, if a machine of the machine group becomes available, select a unit/lot/batch to process next. A key element of the dispatcher is the \"DispatchmentControl\" method. In a switch-case-instruction it contains all implemented dispatching rules (cf. Section 3.4) which can be modularly complemented by additional dispatching rules or other dispatching methods. For each machine group, the dispatching rule to be used can be individually selected before running the simulation model.