Optimization of HV LDMOS devices accounting for packaging interaction