generate subroutine for  parameter calculations