Variance computation

Good afternoon Prof. Pfeifer,
I am computing the welfare losses of my NK model, to do so, I wrote:
as in your GITHUB example for Gali 2015 (Chapter 4).
On the other hand, I am also computing the variance decomposition (the one that appears after “stoch_simul”),
Now my question is: in the first case (variance.pi(ii)=oo_.var(pi_pos,pi_pos)), what is the logic behind the computation of this variance? is the unconditional variance?
In the second case (variance decomposition), is that also based on the unconditional variance (to compute the contribution of each shock)?

Thanks in advance for your answer

Please see the Dynare manual. oo_.var and oo_.variance_decomposition store the unconditional moments/objects.