YasserSelima
Subscriber
Thanks for clarification.
Using DEFINE_ADJUST
Define_adjust is called before every iterations. You can check the condition at the valve and then change an integer variable between 0 and 1 ... then in the DEFINE_PROFILE check if the variable is 1 or 0.
I believe in your case, you need to close the valve based on the pressure in the last time step .. so, you need to check the pressure only one time before the time step. In the manual, there is an example that lists some commands to be done at iteration 1 only.