An automation system for a drilling rig, the automation system comprising: a processor configured to implement computer executable instructions, the processor being: couplable to at least one of a) a rig control system, b) an electronic data recorder, and c) at least one rig sensor; configured to receive at least one of a) at least one surface operating parameter generated by the at least one rig sensor and b) at least one downhole operating parameter generated by at least one tool disposed in a wellbore; at least one input device in communication with the processor and configured to receive a user input; at least one output device in communication with the processor; and a computer memory in communication with the processor and storing computer executable instructions, that when implemented by the processor cause the processor to perform functions comprising: receiving as a function of time at least one of a) the at least one surface operating parameter b) the at least one downhole operating parameter; at least one of filtering and smoothing the at least one of a) the at least one surface operating parameter and b) the at least one downhole operating parameter to generate processed data; generating a measure of drilling energy from the processed data; identifying learning intervals based at least in part on the processed data, each learning interval including at least one of a) a transition of a drill string disposed within the wellbore from off a bottom of the wellbore to on the bottom of the wellbore, and b) at least a 5 percent change in the processed data; calculating for each of the learning intervals a distribution of the measure of drilling energy as a function of the processed data; determining from each of the distributions a minimum of the measure of the drilling energy; and, calculating a target value of the at least one of a) the at least one surface operating parameter and b) the at least one downhole operating parameter. a processor configured to implement computer executable instructions, the processor being: couplable to at least one of a) a rig control system, b) an electronic data recorder, and c) at least one rig sensor; configured to receive at least one of a) at least one surface operating parameter generated by the at least one rig sensor and b) at least one downhole operating parameter generated by at least one tool disposed in a wellbore; couplable to at least one of a) a rig control system, b) an electronic data recorder, and c) at least one rig sensor; configured to receive at least one of a) at least one surface operating parameter generated by the at least one rig sensor and b) at least one downhole operating parameter generated by at least one tool disposed in a wellbore; at least one input device in communication with the processor and configured to receive a user input; at least one output device in communication with the processor; and a computer memory in communication with the processor and storing computer executable instructions, that when implemented by the processor cause the processor to perform functions comprising: receiving as a function of time at least one of a) the at least one surface operating parameter b) the at least one downhole operating parameter; at least one of filtering and smoothing the at least one of a) the at least one surface operating parameter and b) the at least one downhole operating parameter to generate processed data; generating a measure of drilling energy from the processed data; identifying learning intervals based at least in part on the processed data, each learning interval including at least one of a) a transition of a drill string disposed within the wellbore from off a bottom of the wellbore to on the bottom of the wellbore, and b) at least a 5 percent change in the processed data; calculating for each of the learning intervals a distribution of the measure of drilling energy as a function of the processed data; determining from each of the distributions a minimum of the measure of the drilling energy; and, calculating a target value of the at least one of a) the at least one surface operating parameter and b) the at least one downhole operating parameter. receiving as a function of time at least one of a) the at least one surface operating parameter b) the at least one downhole operating parameter; at least one of filtering and smoothing the at least one of a) the at least one surface operating parameter and b) the at least one downhole operating parameter to generate processed data; generating a measure of drilling energy from the processed data; identifying learning intervals based at least in part on the processed data, each learning interval including at least one of a) a transition of a drill string disposed within the wellbore from off a bottom of the wellbore to on the bottom of the wellbore, and b) at least a 5 percent change in the processed data; calculating for each of the learning intervals a distribution of the measure of drilling energy as a function of the processed data; determining from each of the distributions a minimum of the measure of the drilling energy; and, calculating a target value of the at least one of a) the at least one surface operating parameter and b) the at least one downhole operating parameter.