How to rollup cycle time and setup time of operations and set that value to a process plan property


I have a property called 'duration' in mpp_ProcessPlan and i would like to fill that Property value with sum of cycle time + setup time of all the operations associated with a process plan. how to write server side method for relationship Types. I went through Programmers Guide but i couldn't able to understand.