To calculate Physical cell id
N(Cell ID) = 3*NID + NID
Secondary synchronisation signal in the range of 0…335 and primary synchronisation signal in 0,1,2.
from the image in 5G the PCI ranges from 0 to 1007 unlike in 4G which is upto 503 cell ids.
Location of PBCH DMRS through PCI:
PBCH DMRS location varies with PCI, for example if the SSS value is 301 and PSS is 2 then PCI value going to be
PCI = 3*301 + 2 i.e 905
now to see the location of PBCH DMRS from PCI mod 4, here 4 indicates as PBCH is in 4 different location in a SSB block.
i.e 905 mod 4 is 1.
i.e in the first symbol of the SSB block refer here for SSB. https://wirelesstheory.com/ssb-location-in-5g-standalonesa/
from here UE tries to find the PBCH by scanning the best SSB beam to decode PBCH and through MIB information.