# Towards a Flexible Smart Factory with a Dynamic Resource Orchestration
## 3 The Orchestrator
### Architecture of the Orchestrator
The state machine overviews all the steps that need to be executed for an order to become finalised, and asynchronously invokes other components depending on the current state of an individual actor. The first component to be invoked by the Order Agent is the Process Reasoner (3a). It is provided with a product specification as the input, thus starting the reasoning phase. The main function of the Process Reasoner is to reason upon all required capabilities, steps, and order of the sequences in order to generate the process specification as an output. The process specification is a technology-agnostic and shop-floor-agnostic description, which does not include resource allocations. On the contrary, it should hold complete information about the bill of materials, quantities, timing constraints, acceptance, and completion criteria. Similar to the Customer Interface, the Process Reasoner is also one of the components implemented in a pluggable fashion so it can respond to the use-case specific requirements. Once inferred, the production process specification can be further customised using one of the supplied tools for modelling. The Modelling Tools (3b) component, as seen in Figure 2, represents two independent tools--Process Modeller and Resource Modeller--used by the Process Engineers and the Quality Engineers in the modelling phase. The main purpose of the Process Modeller is to allow alteration of the production process specification that is the product of the Process Reasoner [12]. Its utilisation allows a customer to alter the existing production processes' specifications--either previously created or inferred by the Process Reasoner--or to create a production process specification from scratch. Since product specifications might be provided in forms that are not machine-readable, the ability to manually create and edit production process specifications is of utmost importance. This way, the customer interface is being enriched or practically substituted. An example of the Process Modeller usage applied to an industrial use-case is further described in Section 4. The Knowledge Base (4) data provide the required domain production knowledge in a machine-readable form. It facilitates deductive reasoning, as it is based on well-defined and formal meta-models. KB also contains a comprehensive map of required connections in the system, both physical and logical connections among the resources. Based on these connections and the inputted processes, it provides the topology upon which an appropriate flow of operations can be created. This component is the enabler of storing the factory's specific data, such as data about resources, their capabilities and constraints, collaboration models, interface contracts, and factory logistics. KB keeps the information of all the resources on the shop floor, including the spare (e.g., tools or machines that are not currently in use but are available) or temporary unavailable (e.g., operator on a vacation, or a machine on reparation) resources. As it also preserves the semantics of processes specifications, it plays a key role in orchestrating production. Furthermore, KB provides an inference and query mechanism that can dynamically find connections between available resources. In this way, the Orchestrator can find a semantic link and orchestrate the complete production in real-time. The Resource Discovery is not considered a part of the 'Happy flow', as the KB is already populated with all available resources at the moment of the Orchestration Agent triggering. If that is not the case, this component enables the dynamic addition of resources that enter the shop floor. Smart resources report themselves upon entering the system and their specification is dynamically inserted into the KB. Ideally, every resource will have a standardised asset administration shell developed and available [20]. They will provide a semantic self-description of an asset and interaction contract specification of offered capabilities.