add the condition p > 0 in DAEditorEnergyAD, then the stability of this approach is improved.