adding dtdm calc function