I am running a simulation on several loads in the 33 bus system. I am doing a while true loop using python dstcp and I am select several loads and each time I select a load I collect voltage and power and currents. I wanted to apply a fault to demonstrate that something is occuring on my values in real time, How can I fix this issue in the attachement.
Yes, it seems that you are not waiting until the solution is achieved before making other queries. The way OpenDSS-G interacts with external application is the same as OpenDSS interacts when running in parallel mode. The TCP server makes OpenDSS-G equivalent to an out-of-line server or better said, an asynchronous co-simulation partner.
The calling App (your code) and OpenDSS-G are running as separate processes, in different threads and therefore, completely independent. So, it may happen that your App goes faster than OpenDSS-G when solving a simulation step since your App is doing nothing while DSS-G is solving the system.
To solve it, you need to sync both apps. Use functions 0x52, 0x53 for such purpose, so you will be able to know if the simulation has ended before making a new query.
Best regards
Davis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I appreciate the reply, The thing is my DSTCP python program is running in a While True loop meaning it keeps running and getting the data from the loads. So how would I know at what time they should be synced to apply a fault graphically from opendss-g ?
Best Regards,
Dhiaa
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's not difficult. since the simulation time may vary depending on the simulation point and the component around, the only thing you need to do is a "wait" routine in Python, so after calling the "Step in" function you can call the "wait" routine in your program, which is nothing more than a while loop checking the simulation status (function 0x52) in intervals of 1/10 ms, is up to you. That will enhance more flexibility to your code no matter the circuit complexity loaded in DSS-G.
Best regards
Davis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am running a simulation on several loads in the 33 bus system. I am doing a while true loop using python dstcp and I am select several loads and each time I select a load I collect voltage and power and currents. I wanted to apply a fault to demonstrate that something is occuring on my values in real time, How can I fix this issue in the attachement.
Best Regards,
Dhiaa
Hello,
Yes, it seems that you are not waiting until the solution is achieved before making other queries. The way OpenDSS-G interacts with external application is the same as OpenDSS interacts when running in parallel mode. The TCP server makes OpenDSS-G equivalent to an out-of-line server or better said, an asynchronous co-simulation partner.
The calling App (your code) and OpenDSS-G are running as separate processes, in different threads and therefore, completely independent. So, it may happen that your App goes faster than OpenDSS-G when solving a simulation step since your App is doing nothing while DSS-G is solving the system.
To solve it, you need to sync both apps. Use functions 0x52, 0x53 for such purpose, so you will be able to know if the simulation has ended before making a new query.
Best regards
Davis
Hello,
I appreciate the reply, The thing is my DSTCP python program is running in a While True loop meaning it keeps running and getting the data from the loads. So how would I know at what time they should be synced to apply a fault graphically from opendss-g ?
Best Regards,
Dhiaa
Hello,
It's not difficult. since the simulation time may vary depending on the simulation point and the component around, the only thing you need to do is a "wait" routine in Python, so after calling the "Step in" function you can call the "wait" routine in your program, which is nothing more than a while loop checking the simulation status (function 0x52) in intervals of 1/10 ms, is up to you. That will enhance more flexibility to your code no matter the circuit complexity loaded in DSS-G.
Best regards
Davis