Cost analysis and calculation