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 August 27th, 2013, 06:24 AM   #1
rick-brinkman
Member
Netherlands

rick-brinkman is offline
 
Join Date: Dec 2012
Location: Overijssel
Posts: 21
Question Download global safety db via command-interface (C#)

Hello all,

Question:
Is it possible to download the global safety database “F-SHARED DB” by using the
Siemens command-interface in a C# application? If so, how?


Background:
I created a Windowsapplication with Visual C#.
This application is created to control a Siemens PLC (e.g. Start PLC, stop PLC and download to PLC).
Therefor I’ll make use of the Siemens command-interface.

The Windowsapplication works fine as long as I don’t try to download safety blocks. So in other words; starting, stopping the PLC or even downloading a complete PLC program (including
HW-Config with safety) without safety blocks works fine.

My problem occurs when I try to download a safety block to PLC. This is because Simatic manager generates the following (error)message (see picture below).




I noticed that the core of my problem is because the “F-GLOBAL DB” or “F-SHARED DB” isn’t present in the PLC. I know this because downloading of safety blocks works fine with the Windowsapplication when I do the following:
1. Download the safety program in the PLC with the safety utility in Simatic manager
2. Delete all safety blocks except the “F-Global DB”
3. Download all blocks with the Windowsapplication using command interface

Used Code (Simplified):
  Reply With Quote
Old August 27th, 2013, 12:48 PM   #2
Bratt
Lifetime Supporting Member
Sweden

Bratt is offline
 
Join Date: Nov 2003
Location: West Sweden
Posts: 666
The block folder itself has a download property that fires a download of the complete program. If i recall correctly it also downloads the safety program.

Code:
S7Container m_BlockFolder = m_Simatic.Projects(strProjectName).Programs(strProgramName).Next("Blocks");
m_BlockFolder.Download(S7OverwriteFlags.S7OverwriteAll);
  Reply With Quote
Old August 28th, 2013, 10:07 AM   #3
rick-brinkman
Member
Netherlands

rick-brinkman is offline
 
Join Date: Dec 2012
Location: Overijssel
Posts: 21
Exclamation

Firstly, thanks for the reply

I tried the code that you have suggested but the compiler will then generate the following error:
"Cannot implicitly convert type 'SimaticLib.IS7SWItem' to 'Simaticlib.IS7Container'."

Therefor I changed the code as shown in the picture below.




I think this code functions the same as you were implying
Unfortunately this code still can't handle safety blocks because it still gives the error that the F-Shared DB does not exist on the F-CPU.

PS. the code in the picture works indeed fine for normal blocks.
  Reply With Quote
Old August 29th, 2013, 01:56 AM   #4
Bratt
Lifetime Supporting Member
Sweden

Bratt is offline
 
Join Date: Nov 2003
Location: West Sweden
Posts: 666
It was strange that the code did not work it works for me. I am however using vb.net and not C#
Code:
    Dim m_BlockFolder As S7Container = m_Simatic.Projects(myProjectName).Programs(myProgramName).Next("Blocks")
            If m_BlockFolder.Program.ModuleState = S7ModState.S7Run Then m_BlockFolder.Program.Stop()
            m_BlockFolder.Download(S7OverwriteFlags.S7OverwriteAll)
            m_BlockFolder.Program.NewStart()
I did some tests today and the code does download safety blocks even if they are changed and recompiled but only if they have been downloaded using the safety download in step7 before.
Just like you have tried it does not download the safety if the CPU is cleared. I guess i never tried with a clean cpu before.

I will make a support request to Siemens and see if they can tell us why

Last edited by Bratt; August 29th, 2013 at 02:19 AM.
  Reply With Quote
Old August 29th, 2013, 02:11 AM   #5
rick-brinkman
Member
Netherlands

rick-brinkman is offline
 
Join Date: Dec 2012
Location: Overijssel
Posts: 21
Bratt,

Thanks again!
I already submitted a support request at the Dutch Siemens support.
And my colleague will also submit a support request at the German support.
So I don’t know if it useful to add more support request for this issue.

I will of course give feedback if I know more.

Of Course other thoughts are always welcome
  Reply With Quote
Old August 29th, 2013, 02:22 AM   #6
Bratt
Lifetime Supporting Member
Sweden

Bratt is offline
 
Join Date: Nov 2003
Location: West Sweden
Posts: 666
Quote:
Originally Posted by rick-brinkman View Post
Bratt,

I already submitted a support request at the Dutch Siemens support.
Ok!
  Reply With Quote
Old August 29th, 2013, 05:17 AM   #7
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: 5,482
Using PLCSIM you have to download the h/w config before you can download the safety blocks. I don't have access to a real plc to try this on one at the moment.
  Reply With Quote
Old August 29th, 2013, 07:23 AM   #8
rick-brinkman
Member
Netherlands

rick-brinkman is offline
 
Join Date: Dec 2012
Location: Overijssel
Posts: 21
Hello LD[AR2,P#0.0],

Thanks for the reply

I already tried what I think you’re suggesting and to be sure I tried it once again.

What I tried is the following:
I made sure that there are no safety-blocks downloaded to the PLC (i.e., the PLC doesn’t contain any program). This, of course means that there is no “F GLOBAL DB” present at the PLC. In this situation I opened the HW-config, saved & compiled the HW configuration and I downloaded the HW configuration to the PLC. Finally I looked online to check which blocks are present on the PLC and noticed there is still no “F GLOBAL DB” present or any other building block for that matter.

So back to my start position, can’t download safety blocks without the presence of an “F GLOBAL DB”.
  Reply With Quote
Old September 5th, 2013, 09:23 AM   #9
Bratt
Lifetime Supporting Member
Sweden

Bratt is offline
 
Join Date: Nov 2003
Location: West Sweden
Posts: 666
Did you receive any feedback from Siemens?
  Reply With Quote
Old September 5th, 2013, 09:36 AM   #10
rick-brinkman
Member
Netherlands

rick-brinkman is offline
 
Join Date: Dec 2012
Location: Overijssel
Posts: 21
No, unfortunately not!
I called Siemens today to check if they are still looking into it.
I’ve been told that they will call me back.

So I’m still waiting with interest but low expectations.



PS. do you know if I can check via the command interface if there is a bus failure or system failure active??
  Reply With Quote
Old September 9th, 2013, 03:21 AM   #11
Bratt
Lifetime Supporting Member
Sweden

Bratt is offline
 
Join Date: Nov 2003
Location: West Sweden
Posts: 666
One way to do this is to dump and read the diagnostic buffer with the command GetOnlineDiagBuffer. This is requires a little coding since you need to compare timestamps and filter out faults. Maybe there is an easier way to get a sum of the errors for instance reading the leds of the CPU but i don't know of it
Code:
 Dim themodule As S7Module6 = S7Program.Module
  themodule.GetOnlineDiagBuffer("pathToTxtFile")
Reading the LED's is possible with other libraries for example Libnodave.
If you are interested in this i can send you a simple vb.net application that can read the led status of the CPU over ethernet using libnodave.
  Reply With Quote
Old October 18th, 2013, 01:30 AM   #12
rick-brinkman
Member
Netherlands

rick-brinkman is offline
 
Join Date: Dec 2012
Location: Overijssel
Posts: 21
Finally got a reply from Siemens support and as promised, here is the feedback.

I quote:
The error is because off the following reason:

"Das laden des Sicherheitsprogramms muss immer über den Dialog "Sicherheitsprogramm generieren" erfolgen. Sie können nicht einzelne Safety Bausteine aus dem Bausteincontainer laden.
Über den Bausteincontainer können nur Standardbausteine geladen werden."

Basically, this means that the way I want to load the F_Global_DB is not allowed. Therefore the error".
Whit the quote, the post is answered.

Thanks All!
  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
Safety using Micrologix 1000/MSR210 safety relay dskplc LIVE PLC Questions And Answers 2 August 11th, 2013 02:30 PM
Slow-action vs Snap-action Safety Interlock Switches... Eric Nelson LIVE PLC Questions And Answers 1 July 10th, 2013 04:46 PM
Step7 download safety program Terra70 LIVE PLC Questions And Answers 3 June 13th, 2009 12:51 AM
Download Shared DB without losing Actual value Heino Geerdens LIVE PLC Questions And Answers 1 April 2nd, 2007 10:14 AM
Delete recipe in rsview file using command button?? briana banks LIVE PLC Questions And Answers 4 January 25th, 2007 01:53 PM


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


.