A heating, ventilating, and air conditioning, HVAC, system, comprising: - a vapor compression system comprising a refrigerant; - a compressor of the vapor compression system configured to circulate the refrigerant through the vapor compression system; - an expansion device of the vapor compression system configured to adjust a flow of the refrigerant through the vapor compression system; and - a controller configured to operate according to a first control module to adjust a position of the expansion device based on a measured amount of superheat of the refrigerant entering the compressor to achieve a target amount of superheat, and to operate according to a second control module to adjust the position of the expansion device based on a measured discharge temperature of the refrigerant leaving the compressor to achieve a target discharge temperature, characterized in that the controller is configured to switch from the first control module to the second control module when the measured discharge temperature of the refrigerant leaving the compressor exceeds a first discharge temperature threshold for a first predetermined amount of time or when the measured discharge temperature of the refrigerant leaving the compressor exceeds a second discharge temperature threshold, wherein the second discharge temperature threshold is greater than the first discharge temperature threshold; wherein the controller is configured to switch between the first control module and the second control module based on the measured amount of superheat of the refrigerant entering the compressor and the measured discharge temperature of the refrigerant leaving the compressor; and wherein the controller is configured to switch from the second control module to the first control module when the measured amount of superheat of the refrigerant entering the compressor exceeds a first superheat threshold for a second predetermined amount of time or when the measured amount of superheat of the refrigerant entering the compressor exceeds a second superheat threshold, and wherein the second superheat threshold is greater than the first superheat threshold. - a vapor compression system comprising a refrigerant; - a compressor of the vapor compression system configured to circulate the refrigerant through the vapor compression system; - an expansion device of the vapor compression system configured to adjust a flow of the refrigerant through the vapor compression system; and - a controller configured to operate according to a first control module to adjust a position of the expansion device based on a measured amount of superheat of the refrigerant entering the compressor to achieve a target amount of superheat, and to operate according to a second control module to adjust the position of the expansion device based on a measured discharge temperature of the refrigerant leaving the compressor to achieve a target discharge temperature, the controller is configured to switch from the first control module to the second control module when the measured discharge temperature of the refrigerant leaving the compressor exceeds a first discharge temperature threshold for a first predetermined amount of time or when the measured discharge temperature of the refrigerant leaving the compressor exceeds a second discharge temperature threshold, wherein the second discharge temperature threshold is greater than the first discharge temperature threshold; wherein the controller is configured to switch between the first control module and the second control module based on the measured amount of superheat of the refrigerant entering the compressor and the measured discharge temperature of the refrigerant leaving the compressor; and wherein the controller is configured to switch from the second control module to the first control module when the measured amount of superheat of the refrigerant entering the compressor exceeds a first superheat threshold for a second predetermined amount of time or when the measured amount of superheat of the refrigerant entering the compressor exceeds a second superheat threshold, and wherein the second superheat threshold is greater than the first superheat threshold.