# A General Framework for Crankshaft Balancing and Counterweight Design
## 5 User-Interface  
In order to simplify the insertion of the inputs by the user, a user-interface is included in the code. The interface is designed with four tabs, each related to a specific aspect of the balancing process. The first three tabs group all the inputs needed for the balancing process, while the last one gathers all the outputs and plots relevant to the user. The first tab of the inputs group is reported in Figure 7. The inputs are divided into two panels: the first one, called \"Engine general parameters\", is referred to the configuration of the engine; meanwhile, the second panel, called \"Balancing components parameters\", includes the geometrical data strictly relative to the balancing components. Along with these inputs, two schemes of a generic crankshaft have been added, in order to provide the user with a visual indication of the necessary inputs. When the data of this tab has all been included, it is possible to switch to the next tab through the \"Next\" button on the bottom-right corner. The next tab, called \"Masses and other parameters\", which is reported in Figure 8, is composed by two other panels: one dedicated to the speed and other geometrical parameters of the engine and the other one is relative to the masses of the crank mechanism, which will be used to compute the reciprocating and rotating masses. With all the inputs for this tab defined, it is possible to initiate the balancing computation, performed by the code described in Section 3. If changes to the inputs are needed, it is possible to return to the first tab by clicking on the \"Back\" button or directly on the name of the tab. Otherwise, through the \"Compute results\" button it is possible to make the code start the balancing computations. The results computed by the main code are grouped in the fourth tab of the interface, named \"Results\". As shown in Figure 9, three panels are included: the first one, called \"Plot results\", allows one to visualise the plots for the crankshaft geometry and the resultants for all the forces and moments relative to the balancing process. Such plots enable the user to quickly check the correctness of the process and how the elements are positioned relative to each other. The second panel reports the masses for each balancing counterweight. Finally, the last panel allows for the export of the plots previously presented as separate MATLAB figures. When the results have been checked, the \"Return\" button allows one to immediately return to the first tab, so that the user can perform again the balancing computations with new inputs. Figure 8: Tab of the user-interface devoted to the definition of the geometrical parameters and the masses of the crank mechanism. Figure 7: Tab of the user-interface dedicated to the insertion of the general and balancing input data. The last tab included in the interface is relative to the characterisation of the counterweights of the crankshaft, which can be used if a more detailed design of the counterweights is desired. This tab, which is reported in Figure 10, uses parts of the main code that is used by the other tabs, with the addition of a specific section, which implements the equations described in Section 4. It can be noticed that the tab is divided into three panels: two dedicated to the inputs and one to the results. The first one, called \"Main constraining parameters\", allows the user to specify the main requirements for the design of the counterweights. These parameters are the most concerning from the design point of view, since they influence the overall performance of the engine:  
* The maximum mass of the component;
* The maximum available space for the path of the counterweight permitted by all the other components of the engine;
* The minimum balance requested by the engine. The second panel groups a set of inputs related to the fine-tuning of the geometry of the counterweight.