# Sequence Planner: A Framework for Control of Intelligent Automation Systems
## 2 The Sequence Planner Control Framework
### Operations  
In addition to the variables defined by the resources, another set of variables exists: _decision variables_. These define the state of the system in abstract terms for scheduling and planning which operations to execute. For example, a decision variable could be the abstract state of a particular resource, or the state of a product in the system. Sometimes decision variables can be directly measured by resources, in which case these measurements are copied into the decision variables, usually after undergoing some form of transformation (for example discretization). The resources and decision variables make up a global state transition system. **Definition 5**. : _An operation \(j\) is defined as \(o_{j}=\langle p_{j},e_{j},g_{j},a_{j},s_{j}\rangle\), where \(p_{j}\) is a precondition over the decision variables defining when the operation can start; \(e_{j}\) is a set of actions completing the operation, which are actions that modify the decision variables; and \(g_{j}\) is a goal predicate defined over the resource variables. \(a_{j}\) is a set of actions for synchronizing the operation with the resource state. Finally, the operation has an associated state variable \(s_{j}\in\{i,e,error\}\). Throughout the paper, operations are graphically depicted as in Figure 4._  
When the precondition of an operation is satisfied, the operation can start. The effect actions are then evaluated against the current state, and the difference between the current state and the next state is converted into a predicate. This predicate becomes the post-condition of the operation; e.g., if the precondition is \(x\
eq y\) and the action is \(x:=y\), then the post-condition (and thus its planning goal) becomes the valuation of \(y\) at the time of starting the operation. To enable the planning system to reach the goals of the operation \(j\), an automatic transition from the low-level goal predicate of the operation (\(g_{j}\)) is added to the global TS. See Figure 5, where \(q_{0}\), \(\ldots\), \(q_{i}\) represent different states from which states in the set defined by \(g_{j}\) can be reached, and \(p_{j}\) is the set of states reachable from \(g_{j}\) after taking the transition which updates the decision variables according to the effect \(e_{j}\). Figure 4: We use this graphical notation to visualize operations. For the operation \(j\), the precondition is \(p_{j}\), the effect is \(e_{j}\), the goal is \(g_{j}\), and the set of actions is \(a_{j}\). Sometimes the low-level goal is omitted. Figure 3: Transition system modeling the door resource. Encoding the operation effects as automatic transitions ensures that the effects will take place even if the goal state was reached without the planner. In other words, it means that if the resources are put into a state which satisfies \(p_{j}\) for some operation \(o_{j}\), the decision variables are updated automatically. This is especially useful after an error scenario, where there may not be a clear view of which operations should currently be active, but it is known which state the operator desires the system to be in, or when the system state is modified manually. To exemplify operations, we now revisit the door example. Recall that we would like to add a locking mechanism to our door. Instead of going back and rewriting the door resource and generated node, we would like to compose the door with an existing \"lock\" resource. The lock has two goal variables, \(l_{i}\in\{false,true\}\) and \(u_{i}\in\{false,true\}\), requesting whether it should be locked or unlocked. The lock does not have a sensor, and therefore the state of it must be estimated. To keep track of whether it is locked or not, the resource includes an estimated state variable \(\hat{l}\in\{unknown,false,true\}\). The lock can be locked even though it is already locked, to put it in a known state, which also applies to unlocking. This means that we must encode events using our goal states.