0

Return channel data during dynamic simulation

Hi,

Is it possible to return channel data at the same time as dynamic calculations running? For now, the data is extracted from the .out file in the end of simulation which is not good option in my case. I am considering the following option: stop the simulation at each time step and transfer data from the formed .out file to the dataframe, but it seems a rather clumsy solution and will reduce the performance of calculations.

Busbar's avatar
31
Busbar
asked 2025-01-16 02:30:11 -0500
edit flag offensive 0 remove flag close merge delete

Comments

What is the reason to do this?

perolofl's avatar perolofl (2025-01-16 05:09:23 -0500) edit

I need to disconnect generator when it become out of step

Busbar's avatar Busbar (2025-01-16 05:59:29 -0500) edit
add a comment see more comments

2 Answers

1

There is a dynamic option already for that, see below:

image description

perolofl's avatar
3.8k
perolofl
answered 2025-01-16 10:40:17 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

I usually do for loops to stop every time step if I want to return values while a simulation is still running.

For this instance, I return the bus frequency value for every timestep.

ini_time = 1
end_time = 60

# Freq Channel
psspy.bus_frequency_channel([1,6365],r"""6365_frequency""")
ierr, rval = psspy.chnval(1)

frequency = []

# Define time steps
time_step_psse = psspy.dsrval('DELT',)[1]
time_steps_pre_simul = int(math.ceil((ini_time)/(psspy.dsrval('DELT',)[1])))
time_steps_post_simul = int(math.ceil((end_time - ini_time)/(psspy.dsrval('DELT',)[1])))

for k in range(time_steps_pre_simul - 2):
    # simulation
    psspy.run(0, psspy.dsrval('DELT',)[1]*(k+1), 1,1,0)

    # read and write freq
    freq_val = psspy.chnval(1)[1]
    frequency.append(((freq_val+1)*60))

## Fault simulation
psspy.run(0, ini_time,1,1,0)
psspy.dist_machine_trip(trip_machine,r"""1""")

## Post fault simulation 
for i in range(time_steps_post_inject - 2):
    psspy.run(0, ini_time+psspy.dsrval('DELT',)[1]*(i+1), 1,1,0)
    freq_val = psspy.chnval(1)[1]
    frequency.append(((freq_val+1)*60))

This worked for me.

pjhoo2397's avatar
1
pjhoo2397
answered 2025-01-16 22:00:41 -0500
edit flag offensive 0 remove flag delete link

Comments

This is not what @Busbar wants to do!

perolofl's avatar perolofl (2025-01-17 03:46:51 -0500) edit

Basically, the answer is correct, except that I would write additional code that would evaluate the situation at each time step and disconnect devices according to the criteria I set.

Busbar's avatar Busbar (2025-01-17 04:12:40 -0500) edit

@Busbar Sorry, I misunderstood. I thought that my answer would solve your problem!

perolofl's avatar perolofl (2025-01-19 07:45:46 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer