How to write the code of calvo pricing?

I developed a standard calvo pricing equation including marginal cost, output and price of intermediate goods, which requires totaling infinite period variables ,so I don’t know how to put it into dynare.I guess anybody could help me here.THANKS.

See New Area-Wide Model (NAWM) wage setting and