The shear viscosity is calculated microscopically via the Green-Kubo relation for the series of snapshots in the central region in an ongoing relativistic collision simulated via the UrQMD framework for various bombarding energies in the anticipated NICA experiments. In previous works the shear viscosity was calculated as function of temperature, while the chemical potential of baryon charge was kept constant. In present work we extract, in various time windows, the average energy density, the net baryon density and the small though nonzero net strangeness density. By fitting these parameters to statistical model, one can get temperature and both chemical potentials of baryon charge and strangeness. Simultaneously, these parameters are used as input to simulations in a box, again within the UrQMD transport model. The autocorrelations in time of the energy stress tensor are extracted, and subsequently via the Green-Kubo identities the shear viscosity coefficient of that equilibrium hadronic system is obtained. Then we calculate partial viscosity both for nucleons and pions for five collision energies from Elab = 5 to 40 AGeV. It appears that substantial part of the contribution to total shear viscosity of the system comes out from pion-nucleon and other correlators.