"""Illustrative cost worksheet. Inputs are assumptions, not market quotes.""" import json,math from pathlib import Path SCENARIOS=[ {'name':'Modest workload','paas_infra':900,'paas_ops_hours':4,'custom_infra':600,'custom_ops_hours':16,'hourly_cost':80,'migration_cost':6000}, {'name':'Scaled workload','paas_infra':6500,'paas_ops_hours':6,'custom_infra':3100,'custom_ops_hours':24,'hourly_cost':80,'migration_cost':24000}, {'name':'More operations','paas_infra':6500,'paas_ops_hours':6,'custom_infra':3100,'custom_ops_hours':36,'hourly_cost':80,'migration_cost':24000}, ] def evaluate(s): p=s['paas_infra']+s['paas_ops_hours']*s['hourly_cost'] c=s['custom_infra']+s['custom_ops_hours']*s['hourly_cost'] savings=p-c return {**s,'paas_monthly':p,'custom_monthly':c,'monthly_savings':savings,'break_even_months':round(s['migration_cost']/savings,2) if savings>0 else None,'first_nonnegative_month':math.ceil(s['migration_cost']/savings) if savings>0 else None,'net_at_12_months':12*savings-s['migration_cost'],'net_by_month':[m*savings-s['migration_cost'] for m in range(25)]} def run(): rows=[evaluate(s) for s in SCENARIOS] assert [(r['paas_monthly'],r['custom_monthly'],r['monthly_savings']) for r in rows]==[(1220,1880,-660),(6980,5020,1960),(6980,5980,1000)] assert [r['net_at_12_months'] for r in rows]==[-13920,-480,-12000] assert [r['first_nonnegative_month'] for r in rows]==[None,13,24] assert rows[1]['net_by_month'][12]<0 and rows[1]['net_by_month'][13]>0 return {'currency':'USD','scope':'Assumed constant monthly inputs; no vendor pricing, tax, discounting or measured customer data','scenarios':rows} if __name__=='__main__': output=run();assert output==run() Path(__file__).with_name('results.json').write_text(json.dumps(output,indent=2)+'\n') print([(r['name'],r['monthly_savings'],r['break_even_months'],r['net_at_12_months']) for r in output['scenarios']])