# A Personalised Emotion-Based Model for Relaxation in Virtual Reality
## 4 Use Case Implementation
### Emotional Model
Finally, to model the fear of darkness or nytophobia (\(f(a_{dark})\)), we modelled it by the combination of the fire, natural light, and artificial light adaptations. The adaptation intensity of dark is give by Equation (13) and defines how dark the environment is. In this equation, \(D_{al},D_{nl}\) and \(D_{py}\) are weights for each adaptation, indicating their significance to the overall darkness intensity. \[a_{dark}=1-\frac{D_{al}\cdot a_{al}+D_{nl}\cdot a_{nl}+D_{py}\cdot a_{py}}{D_ {al}+D_{nl}+D_{py}} \tag{13}\]  
Figure 7 illustrates the behaviour of the fear functions for changing intensities of an adaptation. In this case \(s_{fear}\) is plotted out in function of \(a_{dg}\) where the intensities of fire (\(a_{py}\)) and darkness (\(a_{dark}\)) equal 0.5 and their optimal values \(py_{opt}\) and \(dark_{opt}\) respectively, equal 0. Different plots show a different optimal intensity for dog (\(dg_{opt}\)). \begin{table}
\begin{tabular}{l c c c c c c c c} \hline \(a_{x}\) & Range \(a_{x}\) & \(F_{a_{x}}\) & \(Sp_{a_{x}}\) & \(S_{ax}\) & \(Ap_{a_{x}}\) & \(A_{a_{x}}\) & \(Rp_{a_{x}}\) & \(R_{a_{x}}\) \\ \hline \(al\) & \([0,1]\) & 1 & 0 & 0 & 0 & 1 & 1 & 0 \\ \(nl\) & \([0,1]\) & 1 & 0 & 0 & 0 & 1 & 1 & 0 \\ \(lc\) & \([0,1]\) & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ \(py\) & \([0,1]\) & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ \(dg\) & \(\{0,1/2,1\}\) & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ \(ms\) & \(\{0,1\}\) & 0 & 0 & 0 & 1 & 0 & 1 & 0 \\ \(cb\) & \(\{0,1\}\) & 0 & 0 & 1 & 0 & 0 & 0 & 1 \\ \hline \end{tabular}
\end{table} 
Table 3: Summary of all possible adaptations used by the emotional model. For each of the adaptations, the value of the constants defines the presence of the emotions in the equation. Regarding stress, as explained in Section 3, it is modelled as a non-linear max function of the current fear, the possible new stress and the stress of the previous interval if the controlled breathing was enabled. Taking into account the possible adaptations, and the defined formulas in the methodology, the possible new stress has been set to be influenced by the fire (_py_) and the dog (_dg_) as formulated in Equation (9). Figure 8 illustrates an example of the calculation of stress. The figure shows stress as a function of three different adaptations: dog, fire and darkness. Each plot shows the three arguments of the maximisation function from Equation (8) and the resulting value of stress. As can be seen from the figure, in each case stress takes the greatest value of all other functions. Moreover, note how the candidate value for stress is constant in the third plot as it does not depend on the intensity of darkness. However, fear does depend on darkness in the emotional model and can overtake the candidate value resulting in an increased level of stress. The arousal is again a max function of the current values of stress, fear and the new candidate values of arousal. The candidate new arousal is based on the preference towards music, the intensity of natural light and the intensity of artificial light as defined in Equation (11). In short, arousal will only increase when fear or stress increases, and it will only decrease when the music is optimal and/or the environment is bright. Figure 9 shows the evaluation of arousal as an example. The three plots show arousal in function of music, artificial light and dog respectively. Each plot shows the 4 arguments of the maximisation and minimisation functions from Equation (10) as well as arousal itself. The plots clearly show how arousal takes the maximum of fear and stress but the minimum of the candidate arousal and previous arousal values. Indeed, as explained before, arousal decreases as music approaches the optimal value (0.8 in this case) or as the environment gets brighter. Additionally, arousal increases as fear or stress increase. Figure 8: Plots showing the calculation of stress as it depends on other functions.