What is the calculated mass of the center of gravity required to calculate the inertia force?

Hi gents,
I have tried to simulate the rotation of a robot arm and find the reaction forces on the joints.The problem is that when I try to verify if the sum of the reaction forces plus the inertia forces is 0 the inertia force has a low value and the sum of all the forces greather than 0.(the inertia force is derived from the accelerationof of the center of gravity multiplyed with the mass of the rotating arm)My question is, what is the mass related to the inertia force, the mass of the arm which rotates,or the mass of the arm plus the upper arms connected to it?! I have noticed that when multiply the acceleration with the mass of the rotating arm plus the mass of the upper elements the inertia force is bigger and the sum of all the forces in the system is closer to zero.( I have attached a photo related to the subject)

Thank you in advance,
Stefan Ion