## 3 Development of a Dynamic Model of the Robotino with Bond Graphs
### Building the Mathematical Model and Solving It Using the Backward Differentiation Formula (BDF)  
Before we start the simulation, we need to build the mathematical model of the hierarchical bond graph model. Starting from this root (i.e., basic) level model, we pass the model tree several times. First, we check that every component is correctly connected, and next we generate the system variables in terms of how we define its mathematical model. After that, we assess all the elementary components, reading their constitutive relations. We translate their form as described in Table 1 into the implicit forms. Thus, e.g., the constitutive relations of the left flow junction of Figure 26b are connected to the transformers, as described by the following equations:  
\[ \begin{array}{l}v_{C1y}+f_{1}-f_{2}=0,\\ f_{1}+v_{CX}\sin(\varphi_{1})=0,\\ f_{2}-v_{CY}\cos(\varphi_{1})=0.\end{array}  \tag{32}\]  
Similarly, the constitutive relations of the inertial elements in Figure 27b are expressed as:  
\[ \begin{array}{l}\frac{dp_{X}}{dt}-F_{X}=0,\\ \frac{dp_{Y}}{dt}-F_{Y}=0.\end{array}  \tag{33}\]  
Next, we translate them into the prefix form. Thus, the common infix form a + b = c is translated into the prefix form +ab, and a similar process is carried out for other expressions. In these forms, the left side of a relation can be more efficiently evaluated and translated in Microsoft's net assembly (using the cli extension of the C++ language). We collect the processed constitutive relations in a list of relations. Figure 31: The completed basic Robotino model. After all the model equations are collected, we visit them again and generate the expressions for the elements of the corresponding partial derivative matrix. We evaluate this via symbolic partial derivation. In this way, both the equations and the element of partial derivative matrix are expressed symbolically in order to improve the solution of the DAE equation. We can represent the mathematical model generated in the matrix form as:  
\[\left. \begin{array}{l}\dot{\mathbf{x}}-\mathbf{z}=0,\\ \mathbf{f}(\mathbf{x},\mathbf{y},t)=0\end{array} \right\}. \tag{34}\]  
The first equation corresponds to the inertial, capacitive, and integrator comports, and the second to the rest of the component constitutive relations. Taking the time derivation of Equation (34), we obtain:  
\[\frac{\partial\mathbf{f}}{\partial\mathbf{x}}\dot{\mathbf{x}}+\frac{\partial \mathbf{f}}{\partial\mathbf{y}}\dot{\mathbf{y}}+\frac{\partial\mathbf{f}}{ \partial t}=0. \tag{35}\]  
Taking into account Equation (34), we can write the last equation in the form:  
\[\frac{\partial\mathbf{f}}{\partial\mathbf{y}}\dot{\mathbf{y}}=-\bigg{(}\frac {\partial\mathbf{f}}{\partial\mathbf{x}}\mathbf{z}+\frac{\partial\mathbf{f}}{ \partial t}\bigg{)}. \tag{36}\]  
Thus, if the Jacobian matrix \(\frac{\partial\mathbf{f}}{\partial\mathbf{y}}\) is invertible, we can express the time-derivate of \(\mathbf{y}\) as:  
\[\dot{\mathbf{y}}=-\bigg{(}\frac{\partial\mathbf{f}}{\partial\mathbf{y}} \bigg{)}^{-1}\bigg{(}\frac{\partial\mathbf{f}}{\partial\mathbf{x}}\mathbf{z} +\frac{\partial\mathbf{f}}{\partial t}\bigg{)}. \tag{37}\]  
Therefore, the second part of Equation (34) has a differentiation index 1; taken together with the first, we deduce that (34) has an index 2 DAE (see [PERSON] et al. [88], p. 39). Well-known Backward Differentiation Formulas (BDFs) have emerged as one of the best methods for solving general DASs. [PERSON] et al. [88], pp. 54-56, showed that, when applied to a model (34), the \(k\)-step BDF (\(k<7\)) is convergent to the order of \(h^{k}\), where h is the current step size. BondSim uses only one integrator, the general form of the Backward Differentiation Formula (BDF), i.e., its variable coefficient form method [76], to solve bond graph models. In comparison, the famous DASSL uses the constant coefficient form of BDF [88].