You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old November 11th, 2008, 08:54 AM   #1
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 556
Now we're getting somewhere, Step7 / 313C

I am now gettign closer to what I hope to be the end of this project.

The last bit to tackle involves a couple basic issues.

1) I have oil being consumed by a venturi and supplied as a fine suspended mist.

2)I can measure the drop in oil level

3)I can measure the vacuum at the venturi

4)I can read the pressure of the outlet

5)I know the size of the orifice used to limit the flow.


I have measured and scaled the analog in from the oil tank

I have recorded the first reading to use as a comparison to check the ongoing function against a standard. Additional readings are taken every X minutes and compared to this first reading.

The boss seems to think the flow of air from 10 inH2O to 46 inH2O through a given size orifice does not produce a linear flow in CFM.

We have several days of data that make it intuitivly obvious that the pressure in is linear and directly proportionate to the flow through a given orifice.

I have charted it...........now I have included this in my program.

I an taking the pressure reading before the venturi and use it to control the pressure regulator. This give X flow at various presures.

Now for the Step7 PLC question:

I have used a block that takes air pressure at the orifice and scales the flow based on the actual flow data plotted at several points on a flow bench to indicate the flow in CFM.

I then look at the amount the oil level has dropped during a period and combine the two to give a reading of how much oil is suspended in XCFM of air to give oil density.

Now I need to do this 16 times for each change in orifice. The orifice can be changed and will be different in each location but will require mechanical setup and will be noted by the HMI, so the PLC will be given the size of the orifice as a data point.

I could repeat what I have done 16 times for each orifice.

I am looking for a better way.

Can I use a function or technique in Step7 to load the new scale variables for each orifice?

I would save the MIN and MAX for input and output for each orifice. So 4 variables for each orifice and maybe an alarm band as well which would make 6 total variables.

Idealy , I would like to select, orifice X and have the FB load the correct variables based on a table of data.

I am going to look at DBs next, I suspect there is a solution here and I suspect Step7 can do it better than what I have now.

So, the small question is :

How do I use Step7 with a 313C to load a set of variables into several different memory locations when given one input bit or word.

I could just set a bit for each orifice selection and use that bit to load the other variables. That is my plan right now, pending input from this fine forum and further reading.
  Reply With Quote
Old November 11th, 2008, 09:13 AM   #2
S7Guy
Member
United States

S7Guy is offline
 
Join Date: Nov 2003
Location: Dayton, Ohio
Posts: 1,242
I'm not sure if exactly how many variables you are talking about, but there are several ways to do it.

Probably LD can give you a finished function, but off the top of my head I would look at the JL instruction. It is a very good way to access a lookup table, and is easy to manage without using a lot of pointers.

Or, if you set up your table as an array, and you know the length of each udt or variable in the array, it would be easy to calculate a pointer based on one of these 16 values.

Or maybe I'm missing what you are trying to accomplish. But like I said, if you are accessing a table, I'd look at JL.
  Reply With Quote
Old November 11th, 2008, 10:17 AM   #3
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 556
A shorter version of the question.

Here is what I have for orifice, see image orifice01.

From the data I have, the flow apears to be somewhat linear through a given orifice at various presures from 10 to 46 inH20 in the lab.

So given that the deviation from absolute linear is not a concern, I simply scaled the pressure in to the flow that was recorded out and put the result in a real number.

Now the question is: What is a nice way of doing this 16 times where the orifice size will be given and will dictate the change in variables and the varibles to be changed will be "IN_MIN, IN_MAX, OUT_MIN, OUT_MAX"? and possibly 2 additional variables for alarms. These will all be located in "FC1001".

FC1001 is just my version of scale.

"IN" is the actual pressure reading from the analog in moved to a word and defined as "real" data type.
Attached Images
File Type: bmp ORIFICE01.bmp (194.2 KB, 148 views)
  Reply With Quote
Old November 11th, 2008, 10:44 AM   #4
L D[AR2,P#0.0]
Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 4,542
Maybe I'm missing the point, but I'd replicate network 4 sixteen times using the different orifice select bits for each one and using the calibration constants for each orifice.
  Reply With Quote
Old November 11th, 2008, 11:05 AM   #5
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 556
Quote:
Originally Posted by L D[AR2,P#0.0]
Maybe I'm missing the point, but I'd replicate network 4 sixteen times using the different orifice select bits for each one and using the calibration constants for each orifice.
Yep you missed it.

Your sugestion is the only way I can see to do it easily with what I know now about Step7.

This repeat the block 16 times method would work, but why repeat all that?

Why not just load a set of 4 or 6 variables instead?

Like if orificeX then move var1 into "IN_MIN" etc for each variable.

This is my second idea.

But I suspect there is a way to use a DB to solve this issue which may open new understanding with Step7 that could be used elsewhere.
  Reply With Quote
Old November 11th, 2008, 11:45 AM   #6
L D[AR2,P#0.0]
Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 4,542
Sixteen sets of moves or sixteen calls - it's all pretty much the same in the scheme of things. Of course there are other methods that will reduce the number of calls but at added programming complexity.

e.g. have a look at this example:
Attached Files
File Type: zip Orifice.zip (19.8 KB, 16 views)

Last edited by L D[AR2,P#0.0]; November 11th, 2008 at 12:43 PM.
  Reply With Quote
Old November 11th, 2008, 12:34 PM   #7
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 556
Quote:
Originally Posted by L D[AR2,P#0.0]
Sixteen sets of moves or sixteen calls - it's all pretty much the same in the scheme of things. Of course there are other methods that will reduce the number of calls but at added programming complexity.
And these "other methods" would be...........
  Reply With Quote
Old November 11th, 2008, 12:44 PM   #8
L D[AR2,P#0.0]
Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 4,542
see previous post, just added one. It's a Step 7 archive so you have to retrieve it from Simatic Manager.

Last edited by L D[AR2,P#0.0]; November 11th, 2008 at 12:51 PM.
  Reply With Quote
Old November 11th, 2008, 02:07 PM   #9
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 556
Now that is very much like what I imagined..........only with alot more detail than what I imagined.

I have not gone through UDTs yet or arrays and I need to look up a couple of the STL commands you used.

Very nice.

How does one put the data into the arrays?

I don't feel comfortable using something I don't understand, so I will go through it all and hopefully be able to use it this evening.

Thanks,
  Reply With Quote
Old November 11th, 2008, 02:40 PM   #10
Dua Anjing
Member
Australia

Dua Anjing is offline
 
Dua Anjing's Avatar
 
Join Date: Feb 2008
Location: under the desk looking for a donut...
Posts: 435
My two cents worth

Quote:
Originally Posted by dahnuguy
Yep you missed it.

Your sugestion is the only way I can see to do it easily with what I know now about Step7.

This repeat the block 16 times method would work, but why repeat all that?

Why not just load a set of 4 or 6 variables instead?

Like if orificeX then move var1 into "IN_MIN" etc for each variable.

This is my second idea.

But I suspect there is a way to use a DB to solve this issue which may open new understanding with Step7 that could be used elsewhere.
You should also take into account the "ease of understanding" of your solution. There may be lots of different ways to do what you want, but don't forget that sometime in the future someone else may have to fault find your code. I always try to write my code using the Keep It Simple principle. If you have forsake some "elegance" or some really clever moves for the sake of simplicity thne one day (probably around 3 am on a sunday night) someone will thank you..
__________________
Now that food has replaced s*x in my life I can't even get into my own pants
  Reply With Quote
Old November 11th, 2008, 02:43 PM   #11
krk
Lifetime Supporting Member
England

krk is offline
 
Join Date: Aug 2004
Location: Kent
Posts: 757
Simon looks to have finished for the evening so.....

Quote:
Originally Posted by dahnuguy
How does one put the data into the arrays?
Open DB1
Menu -> View -> Data View

Add your data then save.
  Reply With Quote
Old November 11th, 2008, 03:13 PM   #12
PeterW
Member
Canada

PeterW is offline
 
Join Date: Jun 2006
Location: Edmonton
Posts: 2,418
If you want to access/change the data in an array, you have to use indirect addressing in STL, the only way to do an array in format ARRAY[OFFSET] type is to use SCL.
  Reply With Quote
Old November 11th, 2008, 05:14 PM   #13
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 556
Step7...........Step 1 = not simple ........

Quote:
Originally Posted by Dua Anjing
You should also take into account the "ease of understanding" of your solution. There may be lots of different ways to do what you want, but don't forget that sometime in the future someone else may have to fault find your code. I always try to write my code using the Keep It Simple principle. If you have forsake some "elegance" or some really clever moves for the sake of simplicity thne one day (probably around 3 am on a sunday night) someone will thank you..
I normaly use the simple simple simple rule, anybody can follow most of every program I have ever written. In fact, I normaly write and re-wrtie something until it functions, flows well on the page, and is obvious to the eye.

However, with Step7, the whole thing is so cryptic, there is no chance anyone willever be able to get into it to begin with. And if they do, and they are a Step7 programer, I am leaving lots of notes to explain everything.

I have written this project using several custom blocks that make it very easy to see the important bits without searching through all the lines and lines of conversions and moves and comparisons.

I give a paragraph of text to describe what is in the block and then you are looking at 5 or 10 pieces of data and the "big picture" comes into focus.

You Step7 guys may not realize what a big deal it is to do this. But when you go searching through brand Y for something, it can take hours to get it all sorted out. Then once you get all the bits located and sort out the how, you are left to wonder, "Did I miss something? Did this guy do this because he doesn't know what he is doing, or does it just look that way? Why would anybody do it like that?" After awhile you learn to supress the urge to just re-write it so it does work and move on.

Yeah I like simple, but with S7 that's the first thing to go out the door, so why write 27 rungs x 16 when I can use a DB, a FC, and a FB and move the one block of data I need?

Now if I locked the custom blocks...................now that would be mean.

Especialy if the next guy doesn't have a canopener..........hehe
  Reply With Quote
Old November 12th, 2008, 03:48 AM   #14
Ken M
Member
Scotland

Ken M is offline
 
Join Date: Mar 2004
Location: .
Posts: 1,137
Quote:
I normaly write and re-wrtie something until it functions, flows well on the page, and is obvious to the eye.
... and now I'll clamber aboard one of my hobby-horses.

<MOUNT>
This idea of re-writing something till it works strikes me as wrong, wrong, wrong. Put away the STEP7, the PLC-SIM. Get the pencil and paper out. Define your problem clearly. Design your solution thoroughly. Keep the iterations going within this stage. Simply start with a list of what needs to to done. Go back through this and expand on each item in the list. Do this a few times making corrections and additions as they become obvious - and they will. Gradually introduce pseudo-code to explain how these requirements will be met in the PLC. Eventually the code itself should start to drop out of the exercise, and what's more you've now already got the documentation to justify why it's done the way it is.

Unless it is an incredibly simple task I really hate the idea of just plugging bits of code in to the PLC from scratch and gradually writing nothing but corrections.

Now I know what I've described is an ideal, but you must have heard the old saying "He aimed low in life, and usually missed." Set yourself some high standards and even if you don't meet them all the time the results will be better than if you have no or low standards.
</MOUNT>
  Reply With Quote
Old November 12th, 2008, 04:36 AM   #15
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 10,798
deleted.

I missed the bit about that you want to switch one program between 16 possible datasets.

Well, I think LD gave it to you then.
__________________
Jesper

Last edited by JesperMP; November 12th, 2008 at 04:46 AM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
PID 313C Step7 Siemens dahnuguy LIVE PLC Questions And Answers 2 November 7th, 2008 01:37 PM
Please help with CPU 313C harware config. Latzi LIVE PLC Questions And Answers 27 June 5th, 2008 07:21 AM
step7 newbie timer questions d x l LIVE PLC Questions And Answers 1 February 21st, 2007 01:34 AM
Step7 MicroWin integration with Step7 adfox LIVE PLC Questions And Answers 6 September 1st, 2006 05:24 AM
step7 walters LIVE PLC Questions And Answers 4 April 14th, 2005 04:49 AM


All times are GMT -5. The time now is 04:29 AM.


.