# A General Framework for Crankshaft Balancing and Counterweight Design
## 3 Tool Design
### Primary Reciprocating Forces Balancing  
The balancing of the primary reciprocating force needs, along with some of the data already used for the centrifugal balancing, the following additional inputs:  
* The total length of the primary balancing shafts (which corresponds to the distance between the outer counterweights of the shafts), \(l_{sh,1}\);The radius of the centre of gravity of the primary counterweights, \(r_{c,1}\). Such inputs can be visualised in Figure 7. For the perfect balancing of the primary reciprocating forces, as described in Section 2, two balancing shafts are needed. Each of the shafts must balance the forces and moments that the reciprocating components generate. Therefore, the first step is to create the geometry matrix for the shafts. Two main cases can originate in terms of reciprocating forces: one with the force resultant different from zero and one with the moment resultant different from zero. Based on the case, the counterweights can be one per shaft, in their mid-position, or two at the extremities. The matrices for the rotating and counter-rotating shafts can be defined as follows:  
\[CW_{1,r}(1,k)=CW(1,i)\qquad CW_{1,r}(1,k)=-CW(1,i) \tag{12}\]  
\[CW_{1,r}(2)=[-l_{sh,1}\quad l_{sh,1}]\qquad CW_{1,r}(2)=[-l_{sh,1}\quad l_{sh,1}] \tag{13}\]  
\[CW_{1,r}(3,k)=CW(3,i)\qquad CW_{1,r}(3,k)=-CW(3,i) \tag{14}\]  
where for \(k=1\), \(i=1\) and for \(k=2\), \(i=2N_{cr}\). The matrices found with these equations are the ones relative to the case when the moment resultant is different from zero. When the other case is encountered the matrix becomes a vertical array per shaft with the same \(x\) and \(z\) components for \(k=1\) and the \(y\)-component equal to zero. The single mass on each shaft can be also divided into multiple masses, if the symmetry around the mid-point of the shafts is maintained. With the matrices defined, it is then possible to formulate the equations for the computation of the masses that must be applied to the balancing shafts, \(m_{c1}\):  
\[ \begin{cases}\sum_{i=1}^{N_{cr}}m_{alt}\omega^{2}rCS(3,i)=\sum_{j=1}^{N_{cr}}m _{c,1}\omega^{2}r_{c,1}CW_{1,r}(3,j)+\\ +\sum_{j=1}^{N_{cr}}m_{c,1}\omega^{2}r_{c,1}CW_{1,cr}(3,j)\\ \sum_{i=1}^{N_{cr}}m_{alt}\omega^{2}r_{c}S(3,i)CS(2,i)=\sum_{j=1}^{N_{cr}}m_{ c,1}\omega^{2}r_{c,1}CW_{1,r}(3,j)CW_{1,r}(2,j)+\\ +\sum_{j=1}^{N_{cr}}m_{c,1}\omega^{2}r_{c,1}CW_{1,cr}(3,j)CW_{1,cr}(2,j)\end{cases}  \tag{15}\]  
where \(N_{cr,1}\) is the number of counterweights per shaft and \(m_{alt}\) is the reciprocating mass of one cylinder. We can notice that the equations for the equilibrium are two: one for the equilibrium of the forces and one for the moments. Unlike the centrifugal forces, the primary reciprocating forces do not need the definition of the two components, since they are always coincident with the cylinder axis. The first term in the equations represents the sum of the forces/moments generated by the crankshaft, meanwhile the second term is given by the sum of the total forces/moments generated by the masses \(m_{c,1}\) on the rotating and counter-rotating shafts. From Equation (15), we can then derive the following ones:  
\[ \begin{cases}m_{c,1}=\frac{\sum_{i=1}^{N_{cr}}m_{alt}rCS(3,i)}{\sum_{j=1}^{N_{ cr},1}r_{c,1}CW_{1,r}(3,j)+\sum_{j=1}^{N_{cr}}r_{c,1}CW_{1,r}(3,j)}\\ \\ m_{c,1}=\frac{\sum_{i=1}^{N_{cr}}m_{alt}rCS(3,j)CS(2,i)}{\sum_{j=1}^{N_{cr}}r_ {c,1}CW_{1,r}(3,j)CW_{1,r}(2,j)+\sum_{j=1}^{N_{cr}}r_{c,1}CW_{1,r}(3,j)CW_{1, r}(2,j)}\end{cases}  \tag{16}\]  
Similarly to the equations for the centrifugal counterweights, it is not necessary to use both equations of Equation (16) to compute the mass. Instead, the equation with a non-zero numerator must be used, since, as described earlier, the cases that are most likely encountered are those with the force resultant different from zero and one with the moment resultant different from zero. This means that the code would use, respectively, the first and second equation.