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 November 19th, 2020, 05:02 PM   #1
ltwatters
Lifetime Supporting Member
United States

ltwatters is offline
 
Join Date: May 2020
Location: Wisconsin
Posts: 10
Cycle Time Alias(?), S7-1200

Hello,

First time poster and first time Siemens programmer here.

I have an S7-1212 FC I'm programming in TIA Portal V15.1 and I'm hoping there's a word or two somewhere in the program that will allow me to create an alias for the programmed cycle time of the Fail-safe Organization Block.

In other words, I want to read the programmed cycle time of a cyclic interrupt for use in my program.

My goal would be to have an FB or FC that takes five samples from an HSC and averages the pulse rate based on the cycle time, without the use of a separate database constant.

I also see other applications where this would be useful, so I figured it was worth asking.

Thank you
  Reply With Quote
Old November 20th, 2020, 04:33 AM   #2
cardosocea
Member
United Kingdom

cardosocea is offline
 
Join Date: Nov 2016
Location: Fields of corn
Posts: 1,695
Isn't this one of the variables inside the OB? Or I may be confusing with OB1? Haveyou checked the parameters inside your OB?
  Reply With Quote
Old November 20th, 2020, 05:15 AM   #3
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,049
The timed interrupt block for safety is locked. If you are a first time Siemens user then you will have bigger fish to fry and I would not worry about having to use a hard coded constant.
Attached Images
File Type: jpg 1200F.jpg (85.4 KB, 65 views)
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old November 20th, 2020, 07:18 AM   #4
mk42
Lifetime Supporting Member
United States

mk42 is offline
 
Join Date: Jun 2013
Location: MI
Posts: 2,603
The actual cycle time of the F OB is in: System Blocks -> STEP 7 Safety -> RTG1SysInfo -> F_SYSINFO -> TCYC_CURR


Note also that the 1200 HSC can be put into a frequency mode, so you might not even need to do this at all.


ALSO also, why are you sampling your HSC in your safety program? Not saying its wrong necessarily, I've just never seen that need to be a fail-safe function before. If it is just a standard process function, you could create a standard cyclic interrupt.

If you want the configured value, not the actual value, you can try the QRY_CINT instruction, called out of your main code. I know that works for standard cyclic interrupts, not sure if it works for failsafe ones as well.
  Reply With Quote
Old November 20th, 2020, 08:21 AM   #5
ltwatters
Lifetime Supporting Member
United States

ltwatters is offline
 
Join Date: May 2020
Location: Wisconsin
Posts: 10
Quote:
Originally Posted by cardosocea View Post
Isn't this one of the variables inside the OB? Or I may be confusing with OB1? Haveyou checked the parameters inside your OB?
It's a variable I can change within TIA Portal, but I'd like to be able to read it within my runtime. That way, I could do ((HSC Total)-(Previous Scan HSC Total))/(Cycle Time)x10^6=Rate. OB1 is a program cycle OB, so it does not have a programmable cycle time.

Quote:
Originally Posted by L D[AR2,P#0.0] View Post
The timed interrupt block for safety is locked. If you are a first time Siemens user then you will have bigger fish to fry and I would not worry about having to use a hard coded constant.
I think this is my last fish to fry. Most of the programming is still ahead of me, but I have a working program and all of the other self-checks I hope to implement have been tested in their own environment.

Thank you, both. I guess I'll use a hard coded constant and hope I remember to manually update it with any changes to the cycle time. Worst case scenario, my flow proofing has a greater margin of error than intended.
  Reply With Quote
Old November 20th, 2020, 08:32 AM   #6
ltwatters
Lifetime Supporting Member
United States

ltwatters is offline
 
Join Date: May 2020
Location: Wisconsin
Posts: 10
Quote:
Originally Posted by mk42 View Post
The actual cycle time of the F OB is in: System Blocks -> STEP 7 Safety -> RTG1SysInfo -> F_SYSINFO -> TCYC_CURR
My understanding is that this is a running count of the current cycle time, whereas I want the programmed interval the interrupt is supposed to run at.

Quote:
Note also that the 1200 HSC can be put into a frequency mode, so you might not even need to do this at all.
I'm using the HSC to count pulses from a flow meter to automatically fill drums. The total count is more important than the average for my application, but the average would be useful for proving that the HSC is functioning properly.


Quote:
ALSO also, why are you sampling your HSC in your safety program? Not saying its wrong necessarily, I've just never seen that need to be a fail-safe function before. If it is just a standard process function, you could create a standard cyclic interrupt.
I'm sampling the HSC in my safety program for two reasons. One, my assumption is that fail-safe memory is redundant, and so, by immediately passing the HSC count to fail-safe memory, I can monitor and proof changes to it with some semblance of integrity. Two, using the fail-safe interrupt saves me the need of having of having to use a second cyclic interrupt.

Quote:
If you want the configured value, not the actual value, you can try the QRY_CINT instruction, called out of your main code. I know that works for standard cyclic interrupts, not sure if it works for failsafe ones as well.
I'll look into that now, thank you.
  Reply With Quote
Old November 20th, 2020, 08:45 AM   #7
ltwatters
Lifetime Supporting Member
United States

ltwatters is offline
 
Join Date: May 2020
Location: Wisconsin
Posts: 10
Solution

Quote:
Originally Posted by mk42 View Post
If you want the configured value, not the actual value, you can try the QRY_CINT instruction, called out of your main code. I know that works for standard cyclic interrupts, not sure if it works for failsafe ones as well.
That seems to be exactly what I wanted and it compiles without error. Thank you for the help.
  Reply With Quote
Old November 20th, 2020, 09:46 AM   #8
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,049
I've got no code to speak of in the safety program but the cycle time is reported back as the time set for the cyclic interrupt i.e. 100ms
Attached Images
File Type: jpg ssc1.jpg (93.9 KB, 41 views)
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old November 20th, 2020, 09:52 AM   #9
mk42
Lifetime Supporting Member
United States

mk42 is offline
 
Join Date: Jun 2013
Location: MI
Posts: 2,603
Quote:
Originally Posted by l****ters View Post
I'm sampling the HSC in my safety program for two reasons. One, my assumption is that fail-safe memory is redundant, and so, by immediately passing the HSC count to fail-safe memory, I can monitor and proof changes to it with some semblance of integrity. Two, using the fail-safe interrupt saves me the need of having of having to use a second cyclic interrupt.
Fair enough, I guess. I'm curious what application that's necessary for, but I always approve of a bit of overkill.


Quote:
Originally Posted by l****ters View Post
That seems to be exactly what I wanted and it compiles without error. Thank you for the help.

Fair warning, the compiler won't check if the OB number is valid. That won't get checked until RunTime, so be on the look out once you DL.
  Reply With Quote
Old November 20th, 2020, 09:56 AM   #10
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,049
There is no separate memory for the fail safe program. If the data is not coming from a safety device I would be reluctant to process it in the safety program as if it did.
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com

Last edited by L D[AR2,P#0.0]; November 20th, 2020 at 10:01 AM.
  Reply With Quote
Old November 20th, 2020, 11:32 AM   #11
m_turk
Member
Croatia

m_turk is offline
 
Join Date: Jan 2008
Location: ZG
Posts: 206
I agree with L D[AR2,P#0.0]... I have been adding/modding enough of other peoples code to know that I'd be head scratching for a day why is this in the safety. Is someone gonna get hurt because I added the hourly flow they asked?

I'm kinda kidding, but safety is for safety...

And also, your comment that this saves you from having another OB makes me think that you are cramping everything into safety and that I really wouldn't do..
  Reply With Quote
Old November 20th, 2020, 11:55 AM   #12
ltwatters
Lifetime Supporting Member
United States

ltwatters is offline
 
Join Date: May 2020
Location: Wisconsin
Posts: 10
Quote:
Originally Posted by mk42 View Post
The actual cycle time of the F OB is in: System Blocks -> STEP 7 Safety -> RTG1SysInfo -> F_SYSINFO -> TCYC_CURR
Quote:
Originally Posted by L D[AR2,P#0.0] View Post
I've got no code to speak of in the safety program but the cycle time is reported back as the time set for the cyclic interrupt i.e. 100ms
I was mistaken, then, TCYC_CURR is the proper tag. It would be nice if the default value was updated during compilation.

Quote:
Originally Posted by mk42 View Post
Fair enough, I guess. I'm curious what application that's necessary for, but I always approve of a bit of overkill.
Quote:
Originally Posted by m_turk View Post
I agree with L D[AR2,P#0.0]... I have been adding/modding enough of other peoples code to know that I'd be head scratching for a day why is this in the safety. Is someone gonna get hurt because I added the hourly flow they asked?

I'm kinda kidding, but safety is for safety...

And also, your comment that this saves you from having another OB makes me think that you are cramping everything into safety and that I really wouldn't do..
This isn't actually for a safety system; we've had people leave wrenches in a deadman valve for a bulk fill line and flood our mixing room on multiple occasions. Management insisted that we install a fail-safe system while also refusing to buy anything expensive. Also, I consider the area of installation a Class 1 Div 1 location, although our engineer disagrees. So, I've got one flow sensor and I'm just trying to do what I can to prevent the HSC from undervaluing the flow.

Quote:
Originally Posted by L D[AR2,P#0.0] View Post
There is no separate memory for the fail safe program. If the data is not coming from a safety device I would be reluctant to process it in the safety program as if it did.
Ah, I falsely assumed Siemens achieved SIL by redundancy, as opposed to diversity. That's very useful information. Since HSCs are asynchronous, I could have run into ghost problems (failed diversity checks.) Are F-DBs only really there for simplicity and F-runtime communication then?
  Reply With Quote
Old November 20th, 2020, 12:14 PM   #13
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,049
The way siemens have implemented the safety program is to run two diverse implementations of the same logic and compare the results. Put simply, the safety compiler takes your code and re-generates it in the opposite sense. The results of the execution of the two sets of code must match - one example where you can get caught out is if you have an OB of higher priority which interrupts the safety program half way through execution and modifies a variable being used - you will then get a safety fault - make the safety program the highest priority (I generally use priority 15 so that comms will not interrupt the safety program). The safety DBs are also used for status/diag information when the CPU is communicating with safety cards.
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old November 20th, 2020, 12:41 PM   #14
ltwatters
Lifetime Supporting Member
United States

ltwatters is offline
 
Join Date: May 2020
Location: Wisconsin
Posts: 10
Quote:
Originally Posted by L D[AR2,P#0.0] View Post
The way siemens have implemented the safety program is to run two diverse implementations of the same logic and compare the results. Put simply, the safety compiler takes your code and re-generates it in the opposite sense. The results of the execution of the two sets of code must match - one example where you can get caught out is if you have an OB of higher priority which interrupts the safety program half way through execution and modifies a variable being used - you will then get a safety fault - make the safety program the highest priority (I generally use priority 15 so that comms will not interrupt the safety program). The safety DBs are also used for status/diag information when the CPU is communicating with safety cards.
I think I understand. An inverse OB is generated during compilation and run after the initial OB. The results are compared and, should a logical XOR produce any 0, the processor will fault. This does lead me to assume that each F-DB is actually two DBs stored within the same memory, in which case there is still benefit to moving my HSC count to one; I just need to make sure my value doesn't change during execution of the F-runtime Group.
  Reply With Quote
Old November 20th, 2020, 03:22 PM   #15
ltwatters
Lifetime Supporting Member
United States

ltwatters is offline
 
Join Date: May 2020
Location: Wisconsin
Posts: 10
Sample

Here's some screenshots I threw together to demonstrate what my flow-proofing would look like.
Attached Images
File Type: jpg 1.jpg (207.8 KB, 13 views)
File Type: jpg 2.jpg (152.8 KB, 11 views)
File Type: jpg 3.jpg (165.9 KB, 11 views)
File Type: jpg 4.jpg (272.4 KB, 12 views)
  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
Cycle time 38ms (Slow Scada) userxyz LIVE PLC Questions And Answers 7 May 31st, 2016 08:54 PM
set a real time clock on s7 1200 khaled123 LIVE PLC Questions And Answers 5 January 24th, 2015 05:40 PM
RS Logix - Reading period task cycle time from code Mr Modbus LIVE PLC Questions And Answers 3 October 17th, 2014 11:58 AM
Pump Time Cycle Control jmjohnson LIVE PLC Questions And Answers 4 February 1st, 2003 04:53 AM
Cycle time for a controller flukie LIVE PLC Questions And Answers 6 September 28th, 2002 09:04 AM


All times are GMT -5. The time now is 08:13 AM.


.