First of all, you need a PLC Programming IDE for that. The most commonly used are Rockwell Studio 5000, Siemens TIA Portal, Rockwell CCW, CodeSYS etc.
Of this, Rockwell Studio 5000 and Siemens TIA Portal requires a license to be bought.
Rockwell CCW and CodeSYS are free softwares, and in addition they do have an inbuilt emulator which helps you to run the PLC Program without an actual hardware.
In addition, you may download a free trial of the software Factory IO, which helps you to simulate actual factory scenarios and control them using your PLC Program.