# A General Framework for Crankshaft Balancing and Counterweight Design
## 3 Tool Design
### Centrifugal Forces Balancing  
Once the matrices for the crankshaft and relative counterweights have been created, the next step that the code undertakes is the computation of the mass of each counterweight, which is assumed the same for each counterweight. This assumption seems reasonable since, given the similarity among cylinders belonging to the same engine and the symmetry of the crankshaft, a uniform distribution of the counterweight masses is the best option to avoid additional unbalance. The method used for the calculation starts from the equations of equilibrium, both of forces and moments, and expresses them using the matrices previously defined.  
The equations of equilibrium that we can define are four, two for the forces and two for the moments:  
\[\begin{cases}\sum_{i=1}^{N_{cr}}m_{rot}\omega^{2}rCS(1,i)=\sum_{j=1}^{2N_{cr}}m _{c}\omega^{2}r_{c}CW(1,j)\\ \sum_{i=1}^{N_{cr}}m_{rot}\omega^{2}rCS(3,i)=\sum_{j=1}^{2N_{cr}}m_{c}\omega^{2} r_{c}CW(3,j)\\ \sum_{i=1}^{N_{cr}}m_{rot}\omega^{2}rCS(1,i)CS(2,i)=\sum_{j=1}^{2N_{cr}}m_{c} \omega^{2}r_{c}CW(1,j)CW(2,j)\\ \sum_{i=1}^{N_{cr}}m_{rot}\omega^{2}rCS(3,i)CS(2,i)=\sum_{j=1}^{2N_{cr}}m_{c} \omega^{2}r_{c}CW(3,j)CW(2,j)\end{cases} \tag{10}\]  
where \(r_{c}\) is the radius of the centre of gravity of the crankshaft counterweights. The first two equations are the equilibrium of the forces, the first being for the \(x\)-component and the second for the \(z\)-component; the last two equations, instead, are for the moments, in this case around the \(x\) and \(z\) axis. We can also see that the first term of each equation represents the resultant of forces and moments generated by the cranks, while the second term is for the counterweights resultants. From these equations it is possible to derive an equation to obtain the needed unknown quantities. For instance, fixing \(r_{c}\) to a given value, one can derive \(m_{c}\):  
\[\begin{cases}m_{c}=\frac{\sum_{i=1}^{N_{cr}}m_{rot}rCS(1,i)}{\sum_{i=1}^{2N_{cr} }r_{c}CW(1,j)}\\ m_{c}=\frac{\sum_{i=1}^{N_{cr}}m_{rot}rCS(3,i)}{\sum_{i=1}^{2N_{cr}}r_{c}CW(3, j)}\\ m_{c}=\frac{\sum_{i=1}^{N_{cr}}m_{rot}rCS(1,i)CS(2,i)}{\sum_{i=1}^{2N_{cr}}r_{c}CW(1,i) CW(2,j)}\\ m_{c}=\frac{\sum_{i=1}^{N_{cr}}m_{rot}rCS(3,i)CS(2,i)}{\sum_{j=1}^{2N_{cr}}r_{c}CW(3, j)CW(2,j)}\end{cases} \tag{11}\]  
It must be noted that not all of these equations are needed to find the counterweight mass, but just one is necessary. However, it is important to consider them all, initially, because some crankshaft configurations have a null resultant of the forces and others a null resultant of the moments. Therefore, the equation that must be used from the set in Equation (11) is the one that has a numerator different from zero.  
A particular situation that can be encountered is when all of the resultants previously defined are null. This means that both in terms of forces and in terms of moments around the mid-point of the crankshaft, the engine is balanced. However, this usually happens in relatively long crankshafts, like 4 and 6 cylinder in-line engines, in which each half-crankshaft can create unbalancing moments. In this case, the code will automatically recognise the situation and compute the masses of the counterweights based on the same equations but considering only half of the crankshaft: this is managed by having the sums in Equation (10) starting from one and reaching \(N_{cr}/2\) and \(N_{cr}\) for the crank and counterweights term, respectively.