Ask Your Question
0

Return channel data during dynamic simulation

asked 2025-01-16 02:30:11 -0600

Busbar gravatar image

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.

edit retag flag offensive close merge delete

Comments

What is the reason to do this?

perolofl gravatar imageperolofl ( 2025-01-16 05:09:23 -0600 )edit

I need to disconnect generator when it become out of step

Busbar gravatar imageBusbar ( 2025-01-16 05:59:29 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2025-01-16 10:40:17 -0600

perolofl gravatar image

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

image description

edit flag offensive delete link more
0

answered 2025-01-16 22:00:41 -0600

pjhoo2397 gravatar image

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.

edit flag offensive delete link more

Comments

This is not what @Busbar wants to do!

perolofl gravatar imageperolofl ( 2025-01-17 03:46:51 -0600 )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 gravatar imageBusbar ( 2025-01-17 04:12:40 -0600 )edit

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

perolofl gravatar imageperolofl ( 2025-01-19 07:45:46 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2025-01-16 02:30:11 -0600

Seen: 1,734 times

Last updated: Jan 16