Hello,
I am attempting to utilize a Python script to modify the setpoint of a PID controller during execution of a dynamic simulation. While I am able to change the setpoint as visible on the flowsheet by doing controller = Flowsheet.GetFlowsheetSimulationObject("PID-01") controller.SPValue = 3.9
this does not seem to be reflected in the simulation's calculation based on what is shown in the trend. I currently have script execution tied to "Solver Started" -- thinking that should execute every simulation iteration.
Should the PID setpoint be updating during the simulation if changed in this way? If not, is there another place or method I should be using?
Currently there is no specific event to attach to when the integrator starts or ends. "Solver Started" will be executed at every single integrator step since it the flowsheet solver is called each time. It doesn't seem to do any harm in your simulation if you do it, thankfully.
I'll add integrator events in the next version.
Regards
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am attempting to utilize a Python script to modify the setpoint of a PID controller during execution of a dynamic simulation. While I am able to change the setpoint as visible on the flowsheet by doing
controller = Flowsheet.GetFlowsheetSimulationObject("PID-01")
controller.SPValue = 3.9
this does not seem to be reflected in the simulation's calculation based on what is shown in the trend. I currently have script execution tied to "Solver Started" -- thinking that should execute every simulation iteration.
Should the PID setpoint be updating during the simulation if changed in this way? If not, is there another place or method I should be using?
Thanks!
Try
controller.AdjustValue = 3.9
Currently there is no specific event to attach to when the integrator starts or ends. "Solver Started" will be executed at every single integrator step since it the flowsheet solver is called each time. It doesn't seem to do any harm in your simulation if you do it, thankfully.
I'll add integrator events in the next version.
Regards
Daniel