Can somebody tell me how can i calculate the total energy of a system, let's say a planet or a star?

Can somebody tell me how can i calculate the total energy of a system, let's say a planet or a star?
You are going to have to be more specific. For example, with a planet, you can calculate its total orbital energy relative to its star by combining it kinetic energy due to its orbital speed and its gravitational potential energy. Then you could add the kinetic energy of its rotation, then any thermal energy. But if you want its energy relative to its own nonrotating frame, then you just add the rotational kinetic energy and the thermal energy. Relative to its rotating frame, you just need the thermal energy.
With a star, it is always converting matter to energy, So its total potential energy has to take into account how much mass can convert to energy before it burns out (the Earth also has some radioactive isotopes that do the same on a much smaller scale, so to be perfectly accurate with a planet's energy, you should take this into account as well).
Then of course, a star and its planets are orbiting the center of the galaxy they are in, so this has an orbital energy as well. The point is that there is no absolute reference by which you can measure the system's energy, so you have to decide which reference you are measuring it from and what you exactly mean by total energy first.
Is the observable (observed) universe a standalone system where the total energy can be calculated?
It is finite and bounded(in a dynamic way)
Of course one has to choose the physical observer's FoR to make calculations and define the volume encompassing the system.
As the system is expanding does that mean anything for total energy ?
I'm looking for that kind of energy which can affect the space. Maybe this is a topic for another forum section.
Then you are looking for the stress  energy tensor.
Janus has already given you a few very good examples of its application, there is a comprehensive list in the link above.
Thanks for the help! In which circumstances we can say that energy density is the same as a pressure?
I know that but i think they are not the same beside that
So (hope I am not too naive) when you squeeze a rubber ball you ate increasing the energy of that system?
Is that why in the GR model mass curves spacetime?
Does it put a stress on the neighbourhood by virtue of its presence in the same was as inflammation in gums can put pressure on a nerve in the tooth?
A bit like the old tune"There was 10 in the bed and the little one said Roll over"
Does "mass energy overcrowding" cause stress which can be modeled as a curvature in spacetime?
Too simple or simplistic?
A combination of understanding my mental limitations and also the practicalities of day to day living.
I am in no hurry to learn everything and am happy with occasional small victories in understanding.
Also ,when I am (as you have done) disabused of wrong assumptions I take that as a small step forward (a bit like cleaning the house with ideas rather than things)
The seeming equivalence between stress and energy was something I had never really considered before ,so thanks for that too.
« Can someone explain enthalpy H = U + pV  Homework regarding relation between friction and velocity; need my answers checked! » 