  Electronic structure calculations were carried out on the compound
GdBaCo$_2$O$_{5.5}$. The electronic structure variation with a change in the
spin state of the Co$^{3+}$ ion in an octahedral environment has been studied.
All the insulating phases are described and possible scenarios for the metallic
ones are presented. Orbital ordering is shown to take place and the electronic
structure leading to it is determined. The Ising-like anisotropy shown
experimentally can be predicted. Also, big unquenched orbital angular momenta
are calculated and their origin is described.
