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.

New Here? Please read this important info!!!


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

Reply
 
Thread Tools Display Modes
Old September 30th, 2006, 09:41 AM   #1
Lesa
Member
Serbia

Lesa is offline
 
Lesa's Avatar
 
Join Date: Sep 2006
Location: Novi Sad
Posts: 71
Positive edge detection in SCL (S7)

Does edge detection instruction exist in SCL or I have to write it myself?

Can it be done like this?

Code:
if x and not x_old then
     //code
end_if
x_old := x;
  Reply With Quote
Old September 30th, 2006, 11:10 AM   #2
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
You have to write it yourself as you have done so. I would create another boolean variable (called xEdgeDetected for example) and use it as follows:

Code:
xEdgeDetected:= x and not x_old;
x_old:=x;
 
if xEdgeDetected then
//code
end_if
Just to keep the edge detection logic in one place (instead of what may be a large chunk of code splitting it up) and to make it obvious what you are intending.
  Reply With Quote
Old September 30th, 2006, 11:34 AM   #3
Lesa
Member
Serbia

Lesa is offline
 
Lesa's Avatar
 
Join Date: Sep 2006
Location: Novi Sad
Posts: 71
Thanks.

You'r right, it's more readable your way.
  Reply With Quote
Old September 30th, 2006, 12:41 PM   #4
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,356
There should be F_TRIG and R_TRIG function blocks but I have never used them. See
http://www.plctalk.net/qanda/showthr...ghlight=R_TRIG

What Lesa suggested has worked for me.
  Reply With Quote
Old September 30th, 2006, 02:36 PM   #5
Lesa
Member
Serbia

Lesa is offline
 
Lesa's Avatar
 
Join Date: Sep 2006
Location: Novi Sad
Posts: 71
I tried to search "System Software for S7-300/400 System and Standard Functions" PDF for F_TRIG or R_TRIG but no result, also search S7 help but nothing.

Does S7 fully supports IEC 61131-3? In S7 help "IEC Functions" is no R_TRIG or F_TRIG?
  Reply With Quote
Old September 30th, 2006, 04:00 PM   #6
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
From the siemens web-site:

"S7-SCL is a text-based high-level language based on the IEC 61131-3 language Structured Text (ST). "

It doesn't claim to be compliant, just based on IEC61131-3
  Reply With Quote
Old September 30th, 2006, 08:11 PM   #7
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
"WAS-xxx" counts... BIG TIME!

And it will ALWAYS work!
  Reply With Quote
Old October 1st, 2006, 05:16 AM   #8
Lesa
Member
Serbia

Lesa is offline
 
Lesa's Avatar
 
Join Date: Sep 2006
Location: Novi Sad
Posts: 71
Quote:
Originally Posted by Terry Woods
"WAS-xxx" counts... BIG TIME!

And it will ALWAYS work!
Sorry, I don't understand this.
  Reply With Quote
Old October 1st, 2006, 08:00 PM   #9
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
In many cases it is a matter of acting on real input conditions. In many other cases, it is a matter of proceeding based on history.

In other words... How did the current set of input conditions come to be? And what should be done in terms of how that particular set of input conditions came to be.
  Reply With Quote
Old October 2nd, 2006, 06:59 AM   #10
Ken M
Member
Scotland

Ken M is offline
 
Join Date: Mar 2004
Location: .
Posts: 1,136
Sorry, I don't understand this either.

Give us a hint, Terry. What are you talking about?
  Reply With Quote
Old October 2nd, 2006, 06:49 PM   #11
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
Ken M,

Any system that is designed to react to nothing more than current input conditions is nothing more than a mechanical switch handler.

You might as well revert to the days when all automated mechanical activity was based on the state of a set of mechanical toggles.

In doing so, you are not taking advantage of sensory input in terms of the product being processed!

At the very least, responding to a particular signal, one that might be logically out of sequence, might potentially create a bad, if not worse, situation!

Any "SMART" System should KNOW how a process should unfold. If it doesn't unfold as expected, then, in terms of the processor, that should be a "cause-to-pause"!

How can a Processor KNOW anything??? The processor should be comparing the unfolding activity to the expected activity described in a model of that activity! If there is a discrepancy, there is a problem. It's that simple.

The "model", that is, the expectation, should be "coded in".

It's called... Human Think!

If you are controlling a system manually you can clearly see when things are not unfolding as they should. In doing so, would you ignore the fact that something is unfolding wrong??? Of course you wouldn't! You would, or should, STOP the process rather than continuing to run only making matters worse!

Do you have any idea what I'm talking about? I can explain further.
  Reply With Quote
Old October 3rd, 2006, 05:14 AM   #12
Ken M
Member
Scotland

Ken M is offline
 
Join Date: Mar 2004
Location: .
Posts: 1,136
Hi Terry,

I think I get it now.
I expected this thread to unfold along the lines of whether there was an in-built 'edge' instruction in Siemens SCL. Up to post #6 everything seemed to be OK. But then at post #7 there was an event I couldn't map in to my model of what should be happening. Lesa raised an interrupt at post #8 and I repeated the warning at post #10.

I still don't know what "WAS-xxx" is, or how it counts, and why it counts BIG TIME. And given that extent of ignorance on my part, is it any wonder that whether it ALWAYS works or not is completely lost on me? I'm guessing this is a reference to a typical error message in, say, Java like "expected xxx but was xxx "

But what has this to do with the existence of one-shots in SCL?

Still puzzled

Ken
  Reply With Quote
Old October 3rd, 2006, 08:56 AM   #13
Lesa
Member
Serbia

Lesa is offline
 
Lesa's Avatar
 
Join Date: Sep 2006
Location: Novi Sad
Posts: 71
Quote:
Originally Posted by Ken M
Hi Terry,
Lesa raised an interrupt at post #8 and I repeated the warning at post #10.
  Reply With Quote
Old October 3rd, 2006, 11:52 AM   #14
Thomas
Member
United States

Thomas is offline
 
Thomas's Avatar
 
Join Date: Mar 2003
Posts: 167
Hmmm...

I believe what Terry related with great brevity was simply coding in historical awareness: "wa_xxx" vs "is_now_xxx".
Correct me if I am wrong on this Terry, but the point is to not program solely on existing inputs.

regards,

Thomas
__________________
The doctrine of human equality rests on this:
that there is no man really clever
who has not found that he is stupid.
- G. K. Chesterton
  Reply With Quote
Old October 3rd, 2006, 03:45 PM   #15
Ken M
Member
Scotland

Ken M is offline
 
Join Date: Mar 2004
Location: .
Posts: 1,136
Thanks Thomas,

But I still can't see what that had to do with the original question or the price of wet fish. I'm just completely mystified why Terry threw it in here. It seems it could have been included in any thread and had just as much relevance.

Ken
  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
S7 SCL timer CharlesM LIVE PLC Questions And Answers 4 June 2nd, 2006 10:54 PM
S7 SCL & Graph CharlesM LIVE PLC Questions And Answers 4 May 21st, 2006 04:34 PM
S7 Scl mehkocak LIVE PLC Questions And Answers 2 October 11th, 2005 04:51 PM
S5 pos edge detection Fritz_frederix LIVE PLC Questions And Answers 6 February 17th, 2005 07:06 AM
Simple explanation of positive edge? Rembrant LIVE PLC Questions And Answers 3 July 15th, 2003 10:07 AM


All times are GMT -5. The time now is 02:22 AM.


.