News:

  • July 01, 2026, 01:37:44 AM

Login with username, password and session length

Author Topic: Where to start and good design  (Read 18997 times)

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Where to start and good design
« on: April 03, 2015, 05:19:29 PM »
Hello,
I am starting to program a waste water treatment plant.  This one is really small, 5000gpd on a single skid for residential sewage.  However it is an advanced membrane system with aeration blowers, circulation pumps, permeate pumps, pressure, flow, level, prox switches, float switches , temperature, DO, ORP and pH, VFDs, motorized valves, solenoid valves, proportional valves, plus remote access via cellular modem.

I have done extensive programming for the old DL305 platform, DL205 using stage logic and have done loads of these systems using AB Logix 500 on Slc500 and Logix 5000 on a CompactLogix PLC using Point block I/O. However this time since it was my choice, I have settled on using the Do-More Terminator I/O platform.  I also have used the C-More panels extensively. I have the wiring schematic complete and the PLC wiring will actually finish in a day or two. The problem is that it has been 2 years since I last did PLC program and I am in really big hurry to get this new system running, like yesterday or the week before!  Sound familiar?

PLCs allow lots of ways to get the job done and it easy to go off in a direction that later you realize boxed you in so I need to answer some basic questions before I start typing away. The PLC needs to monitor and alarm, perform a frequent backwash cycle and a fairly extensive automated chemical cleaning process, clearly a candidate for stage programming.  In my previous programs I never used any I/O directly, always writing inputs to internal relays and memory locations and triggering all outputs by internal relays or defined memory.  This made monitoring and revising I/O very easy.  I ussually start programming by defining all the I/O. Is this still a good practice with DoMore?  Is this Program logic or Task logic? It needs to happen every scan for most I/O. I'm thinking it is a Task, any downside to that?

How about Analog I/O?  Should I write the WX words into a Real then use that everywhere in the program?  Should I write a Speed word into the WY register and use Speed everywhere in the program?

I will need PID control of pumps and blowers. Is the code for that a Program or a Task? The blowers run all the time, the pumps all cycle on and off through various steps in the process.

Thanks,

Gary H. Lucas
Innovative Treatment Products

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Where to start and good design
« Reply #1 on: April 03, 2015, 05:23:26 PM »
Also,
Anyone got a code example they are willing to share?  Just reading some code helps me work through the thought process.  Couldn't find any real code examples in help.

Thanks,

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Where to start and good design
« Reply #2 on: April 03, 2015, 06:35:05 PM »
There are several program examples listed in the Do More section of this forum. click the examples header at top of the page. 
As far as reading inputs and writing to outputs, I use the built in system tasks called TopOfScan and BottomOfScan. I move my inputs into C memory in TopOfScan, and move C memory into outputs in BottomOfScan.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Where to start and good design
« Reply #3 on: April 04, 2015, 12:55:29 PM »
 That makes sense, and I'll take a look at the samples.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Where to start and good design
« Reply #4 on: April 04, 2015, 01:03:36 PM »
+1 on what plcnut suggested.  I do sometimes use I/O directly in the program, but when I don't, I use the same system tasks he suggests to connect I/O to internal memory.  The MAPIO instruction is specifically for doing what you're talking about.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Where to start and good design
« Reply #5 on: April 04, 2015, 01:58:02 PM »
If you are doing sequential event driven logic, use stages in programs. Break it up.  You can have 128 stages in each program. If you are doing a continuing process For instance if you were monitoring a feedback signal from a tach, to calculate and control motor speed, then that would be a good place to use a task. You can turn tasks on and off. Its different than the Rockwell Tasks and Programs. Don't use that model. What I always do is determine what your Programs and Tasks are and when they occur. I do a crude block diagram and then work on the pieces.  The more you break it up, the more portable your code will be going to the next job. You can also try the Directsoft to Domore converter on your old code from the 205, it might save you time.

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Where to start and good design
« Reply #6 on: April 04, 2015, 09:34:04 PM »
I don't have any old code to start from. All my previous work on this type of plant was for a previous employer and it was all AB.  I have written up detailed process description though and know this process really well. So it looks like I will have a Program for the normal filtering process with a Task to do the backwash function which is intermittent, and a second Program for the cleaning process with stages for all the steps in that process. During cleaning the filtering process is halted. I will probably need a shutdown program as that involves multiple draining and flushing steps. So logically this all seems to make sense.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Where to start and good design
« Reply #7 on: April 04, 2015, 09:40:58 PM »
To me, tasks make sense for things that trigger system tasks and for things that run asynchronously of your main process, or else continuously but at a low priority relative to a single scan.   For everything else, I use programs.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Where to start and good design
« Reply #8 on: April 05, 2015, 07:14:50 PM »
Another question. Logix 5000 has user defined variables that you can predefine all the variables used for say a VFD drive.  Using that type of variable for each VFD creates all the needed variable names.  Any way to something similar in Do-More?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Where to start and good design
« Reply #9 on: April 06, 2015, 12:26:24 AM »
Another question. Logix 5000 has user defined variables that you can predefine all the variables used for say a VFD drive.  Using that type of variable for each VFD creates all the needed variable names.  Any way to something similar in Do-More?

Not yet, but that will be in a future version.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Where to start and good design
« Reply #10 on: April 06, 2015, 06:20:53 AM »
I am not a Logix5000 user, so I'm not sure how close this will be. But one thing you can do, is to set up some user defined blocks like:
MotorRun0-9,
MotorSpeed0-9,
MotorAmps0-9,
etc.
This will allow all the parameters for 10 drives to be organized in blocks.
Now you can access each parameter using either a variable index: SET (MotorRun [V2-1]), or you can hard code each one: MOVE V2000 To MotorSpeed3.
Etc.
« Last Edit: April 06, 2015, 08:49:46 AM by plcnut »
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Where to start and good design
« Reply #11 on: April 06, 2015, 12:44:49 PM »
Okay,
I just didn't want to start doing things and find out I was missing a better method.  This program will be the basis for quite few jobs in the future and I want it as modular and maintainable as possible.  Simply using comments and long names go a long way.  I still do occasional maintenance on some complex  DL 205 code I wrote about 15 years ago and I am SO GLAD I took the time to comment that thoroughly!

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Where to start and good design
« Reply #12 on: April 06, 2015, 01:03:10 PM »
Okay,
I just didn't want to start doing things and find out I was missing a better method.  This program will be the basis for quite few jobs in the future and I want it as modular and maintainable as possible.  Simply using comments and long names go a long way.  I still do occasional maintenance on some complex  DL 205 code I wrote about 15 years ago and I am SO GLAD I took the time to comment that thoroughly!

The first lines of DirectSoft were written 23 years ago. One of our jokes here is: "Be sure to document your code very well for the other guy, because he might end up being you."
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO