# Revision history [back]

Some ideas:

Do not mix running simulation with plotting. Use a second script (or loop) to perform the plotting. Plotting within a loop, if not coded properly, is known to eat memory.

Run the code outside PSSe GUI. Increase bus allocation to its max. -> psspy.psseinit(buses=200000).

Minimize commands within the main loop. save the case after:

ierr = psspy.tysl(0) #solving the converted case
ierr = psspy.sav('case_cnv.sav')   #as example


save a snap file after defining the channels:

       ierr = psspy.bus_frequency_channel([-1, bus])
ierr = psspy.snap([-1,-1,-1,-1,-1],'case.snp')   #as example


and move all that code before the main loop, since it does not change per iteration. Within the loop, load the converted case and load the snp file. This way previous memory allocation and temporary files in the background may be deleted.