You are very close with the pseudo code you have. It would look like this in php:
$shipping_weight = ($ecoCart->TotalColumn('TotalWeight')) + 3; //I took out the number formatting as it should not be needed here
if($shipping_weight <= 13){
//UPSP First Class Ship Quote Server Behaviour
}else{
//UPSP Priority Mail Ship Quote Server Behaviour
}
let me know if you have any problems with this.