## 3 Modelling and Implementation of the Simulation Prototype
### Model Implementation Using Modelica
#### 3.3.2 Variation Flow Simulation Using 2D-SoV  
As mentioned above, the variation flow simulation (VFS) library is developed to simulate the quality characteristics flow restricted to 2D geometric characteristics using the SoV technique. For this, LFS classes and connectors previously described are extended to incorporate variables, parameters and functions related to characteristics.  
In the VFS library, the LFS connectors are extended with additional data gathering the deviation motion vector (DMV) of the SoV technique that contain the translation and orientation errors and are transmitted together with the rest of the part or assembly data in the connector. Control_connection also includes other variables related to the measured characteristics on each inspection stage and the optimal positions for fixture locators calculated according to different control logics.  
LFS classes are also extended as follows:  
* VFS_Simulation_Scenario and VFS_Scenario_Dynamics extend the Simulation_Scenario and Scenario_Dynamics classes from the LFS library by incorporating the following parameters:  
* Additional process plan data to specify the locating scheme for each assembly or inspection stage. As shown in Figure 1, each part or subassembly is located using a 4-way and a 2-way locator.
* Geometric data that define the nominal parts' geometries and nominal locators' positions and their respective variations modelled by a normal distribution with a mean and a standard deviation. These geometric variations can be modelled as a stable distribution or as a distribution whose parameters change progressively in time. For this, different VFS_Scenario_Dynamics extensions are used.
* Measurement of uncertainties at each stage with a measurement process (assembly stations with in-process measurement capability and inspection stations), modelled by a standard deviation. In-process measurements in assembly stations will present greater uncertainties than those obtained in the inspection stations.
* VFS_Assembly_Station and VFS_Inspection_Station extend the Assembly_Station and Inspection_Station classes from the LFS library to incorporate the necessary properties and functions for computing the DMV transformations in assembly stations and measured quality characteristics in inspection stations and assembly stations with in-process measurement, according to the SoV technique.  
Moreover, this library incorporates an additional VFS_Basic_Monitor&Control class which extends the Monitor&Control class from the LFS library and executes the monitoring of the quality characteristic flow. This extension is also specialized to support different quality control loops. Specifically, for this work, the next two VFS_Basic_Monitor&Control specializations have been developed to support alternative control logics:  
* VFS_FeedForward_Monitor&Control implements the technique proposed in [10]. This control logic, named feed-forward control, uses measurement data from an early stage to calculate the optimal position of locators placed at subsequent stages to minimize deviations in the final assembly. It is important to note that this calculation is carried out individually for each assembly order. To apply this logic, it must be also considered that the fixtures of subsequent stages have actuators to adjust the position of each locator. In feed-forward control, from the measurements at stage (\(i\)-1)  
\[\mathbf{y}_{i-1}=\mathbf{C}_{i-1}\mathbf{x}_{i-1}+\mathbf{V}_{i-1}, \tag{3}\]  
the goal is to obtain the vector \(\mathbf{U}_{i}=\{u_{i},