Sign in to follow this  
Followers 0
hein123

Programming Style

2 posts in this topic

Hi I have a question about programming style. What I know is it is better to have a few sub routines grouping the functions together, like controlling valves in one moving motor in another so it is easier to debug. However my question is what is a good programming style to control the sequence of events that occur? What I currently do is do everything sequencily in steps, like step 1 is move Valve A, if valve A is forward go to step 2, then step 2 is to move Valve B, etc. This works great for troubleshooting and messages to WinCC as you know exactly in what step it is in and what has to happen next. But the problem is if the sequence is broken, then the entire sequence has to be resetted, parts have to be taken out if they are in inappropriate places, etc. So what I would like to find out is is this the best structure of doing things as I can't find any standard? Any advice would be appreciated

Share this post


Link to post
Share on other sites
You can have the best of both. I would create a function block for individual valve control that you can replicate for all the valves. Include interface bits (open and close commands, auto/manual, status) in the DB so you can control the valve from anywhere. Then create a function (subroutine) to hold all the function blocks for the valves. Then create another function for the actual sequence, and use the valve interface bits to control the valves.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0