# Modeling and Simulation of a Wave Energy Converter _Nwave_
## 3 Modeling of the Device's Dynamics
### Schematization of Ratchet Gears  
A ratchet gear modeling that rope pulley only transmits the torque with forward rotation to the generator while repeating the forward and reverse rotations is required and can be simply analyzed as follows:  
The moment \(\omega_{i}\) (for \(i=1,\;2\)) is greater than \(\omega_{p}\); both are equivalent, and the torque \(\tau_{i}\) is transmitted from the rope pulley to the generator. Thereafter, at the moment that the transmitted power \(P_{i}\left(=\tau_{i}\omega_{i}\right)\) becomes negative, \(\omega_{i}\) and \(\omega_{p}\) are separated, and the torque is not delivered anymore. With the definitions of Phases 0 and 1 denoting the states for whether torque is transmitted or not, the ideal ratchet modeling can be schematized as shown in Figure 5.  
However, it is not easy to implement this modeling in the simulation, even when assumed with extremely short sampling time in the time domain analysis. At the moment of state transition, it must be concurred that \(\omega_{i}\) and \(P_{i}\) change from some positive to zero, which are the modeling errors. To overcome this difficulty, we present a ratchet modeling with the addition of the spring element, as shown in Figure 6. Let us define the angle difference between the pulleys \(i\) and \(p\) as \(\Delta Q_{i}\left(t\right)=Q_{i}\left(t\right)-Q_{p}\left(t\right)\) and also define \(\Delta Q_{i}\left(t^{*}\right)\) when \(t^{*}\) is the moment that the phase changes from 0 to 1 (\(\omega_{i}\) outpaces \(\omega_{p}\)). Then, from this moment \(t^{*}\), we assume that the pulleys \(i\) and \(p\) are connected by virtual torsion spring, and the torque between them is defined as:  
\[\tau_{i}=k_{r}\left\{\Delta Q_{i}\left(t\right)-\Delta Q_{i}\left(t^{*}\right) \right\}, \tag{17}\]  
where \(k_{r}\) is the virtual torsion spring coefficient. Figure 5: Diagram of the ideal ratchet modeling. As long as \(\Delta Q_{i}\left(t\right)\) is greater than \(\Delta Q_{i}\left(t^{*}\right)\), \(\tau_{i}\) is transmitted; otherwise, the phase changes from 0 to 1, and \(\tau_{i}\) becomes zero. This modeling distinguishes the phases via the relation between \(\Delta Q_{i}\left(t\right)\) and its certain value at the specific moment \(\Delta Q_{i}\left(t^{*}\right)\), but does not force the identification between \(\omega_{i}\) and \(\omega_{p}\), unlike the modeling without the spring element. At the phase transition moment, \(\omega_{i}\) must be greater than \(\omega_{p}\), but the gap between them is getting smaller due to the spring effect. Hence, there is no discontinuity in the \(\omega_{i}\) resulting in no impulse torque that provides the stability in the simulation. It is emphasized that the power (or torque) transmission propensity is dependent on the spring coefficient \(k_{r}\). Let us analyze the effect of \(k_{r}\) through the comparison of simple simulations by assigning arbitrary parameters and rope tensions in the PTO module. In Figure 4, the masses of counterweights \(m_{1}\) and \(m_{2}\) are assumed to be 200 kg; \(r_{1}\) and \(r_{2}\) are 1 m; \(\kappa=1\); and \(J_{g}\) is 0.1 kg\(\cdot\)m\({}^{2}\). Then, tensions on the ropes from the buoy are applied as:  
\[f_{1}=2\times 10^{3}\sin\left(\frac{2\pi}{5}t\right)+m_{1}g,\] \[f_{2}=2\times 10^{3}\sin\left(\frac{2\pi}{5}t+1.5\right)+m_{2}g.\]  
By combining (12) and (17) and substituting the assumed parameters and tensions, we can obtain the simulation results as seen in Figures 7 and 8 that \(k_{r}\) are set to 10 and \(10^{3}\), respectively. When \(k_{r}=10\), it can bee seen that \(\omega_{p}\) does not track \(\omega_{i}\), and power from the generator \(P_{g}\) also does not track the trajectory of larger value of \(P_{1}\) and \(P_{2}\). Otherwise, when \(k_{r}=10^{3}\), it results that \(\omega_{p}\) can track the trajectory of larger value of \(\omega_{1}\) and \(\omega_{2}\), and the graph for power provides the equivalent result.