From GNTTYPE.ORG
CODE 31
Trouble Code 31 indicates that the Wastegate Solenoid may not be functioning correctly. The wastegate solenoid is controlled by a Pulse Width Modulated (PWM) signal from the ECM. The ECM controls turbo boost by varying the PWM waveform (duty cycle) to the wastegate. The wastegate responds by bleeding off exhaust pressure upstream of the turbine, thus controlling boost pressure.
The conditions for setting this code are:
the ECM is commanding a solenoid duty cycle of between 5% and 94%, and
no electrical feedback is being received from the solenoid, and
the above conditions are met for 2 seconds.
Typical causes for this code include:
1) Poor or corroded connections between the ECM and the wastegate solenoid
2) Open or shorted solenoid
3) Defective, sticking or maladjusted wastegate linkage
4) Defective ECM
Ensure correct operation of other engine subsystems, including but not limited to the TPS and MAF sensors and check the wastegate actuation hardware.
Since you said other things were replaced, you may want to make sure TPS and IAC are set correctly and like said above make sure everything else is operating properly. Good Luck!!
BTW, this link is the place to go to learn.
www.gnttype.org