Modeling of Surface Segregation for Binary Alloys in Vacuum and Gas Environments: Applied to Pd-alloys