Grand canonical ensemble of weighted networks