Application Example Synchronize the PLC time Synchronize the PLC time with a Win7(64bit) PC
Content 1 Disclaimer... 2 1.1 For customers domiciled outside Germany / Für Kunden mit Sitz außerhalb Deutschlands... 2 1.2 Nur für Kunden mit Sitz in Deutschland... 3 2 Introduction... 4 2.1 Hardware and Software requirements... 4 2.2 Safety instructions... 5 3 PC configuration... 6 3.1 Instructions for Windows 7 (32-bit and 64-bit)... 6 4 PLC Configuration... 10 4.1 Control Builder Plus...10 4.2 AC500 CPU...10 4.3 Firmware...12 4.4 SNTP configuration...13 4.5 Communication Parameters...14 5 User program... 15 5.1 Download your program to the PLC...16 6 Modification... 17 abb ABB Automation Products GmbH 1 Application Example 25.06.2014
1 Disclaimer 1.1 For customers domiciled outside Germany / Für Kunden mit Sitz außerhalb Deutschlands Warranty, Liability: The user shall be solely responsible for the use of this application example described within this file. ABB shall be under no warranty whatsoever. ABB's liability in connection with this application example or the files included within this file, irrespective of the legal ground, shall be excluded. The exclusion of liability shall not apply in the case of intention or gross negligence. The present declaration shall be governed by and construed in accordance with the laws of Switzerland under exclusion of its conflict of laws rules and of the Vienna Convention on the International Sale of Goods (CISG)." Gewährleistung und Haftung: Der Nutzer ist allein für die Verwendung des in dieser Datei beschriebenen Anwendungsbeispiels verantwortlich. ABB unterliegt keiner Gewährleistung. Die Haftung von ABB im Zusammenhang mit diesem Anwendungsbeispiel oder den in dieser Datei enthaltenen Dateien - gleich aus welchem Rechtsgrund - ist ausgeschlossen. Dieser Ausschluß gilt nicht im Falle von Vorsatz oder grober Fahrlässigkeit. Diese Erklärung unterliegt Schweizer Recht unter Ausschluß der Verweisungsnormen und des UN-Kaufrechts (CISG)." abb ABB Automation Products GmbH 2 Application Example 25.06.2014
1.2 Nur für Kunden mit Sitz in Deutschland "Gewährleistung und Haftung: Die in diesem Anwendungsbeispiel enthaltenen Dateien beschreiben eine mögliche Anwendung der Steuerung AC500 bzw. zeigen eine mögliche Einsatzart der Steuerung. Sie stellen nur Beispiele für Programmierungen dar, sind aber keine fertigen Lösungen. Eine Gewähr kann nicht übernommen werden. Der Nutzer ist für die ordnungsgemäße, insbesondere vollständige und fehlerfreie Programmierung der Steuerungen selbst verantwortlich. Im Falle der teilweisen oder ganzen Übernahme der Programmierbeispiele können gegen ABB keine Ansprüche geltend gemacht werden. Die Haftung von ABB, gleich aus welchem Rechtsgrund, im Zusammenhang mit den Anwendungsbeispielen oder den in dieser Datei enthaltenen Dateien wird ausgeschlossen. Der Haftungsausschluß gilt jedoch nicht in Fällen des Vorsatzes, der groben Fahrlässigkeit, bei Ansprüchen nach dem Produkthaftungsgesetz, im Falle der Verletzung des Lebens, des Körpers oder der Gesundheit oder bei schuldhafter Verletzung einer wesentlichen Vertragspflicht. Im Falle der Verletzung einer wesentlichen Vertragspflicht ist die Haftung jedoch auf den vertragstypischen, vorhersehbaren Schaden begrenzt, soweit nicht zugleich ein anderer der in Satz 2 dieses Unterabsatzes erwähnten Fälle gegeben ist. Eine Änderung der Beweislast zum Nachteil des Nutzers ist hiermit nicht verbunden. Es gilt materielles deutsches Recht unter Ausschluß des UN-Kaufrechts." Only for customers with seat in Germany "Warranties and Liability: The files contained in this application sample are only describing a possible use of the AC 500 control system showing a possible kind of operation of it. These are only examples of the programming features and in no way working solutions. No warranty can be accepted. Each user himself is exclusively responsible for the correct, i.e. complete and faultless programming of the control system. In case of a partial or complete adoption of programming samples no resulting claims may be asserted against ABB. In connection with the application examples or the files contained therein any liability of ABB regardless of the legal cause shall be excluded. The exclusion of liability does not apply in the case of willful misconduct or gross negligence by ABB, claims under product liability law, in case of damage to life, body or health or breach of an essential contractual obligation. In case of breach of an essential contractual obligation the liability will, however, be limited to compensation for the foreseeable damage, that is typical for this type of contract in as far as no other exceptions are listed under sentence 2 of this subparagraph is present at the same time. An amendment of the burden of proof to the disadvantage of the user shall not be associated with this. German substantive law shall apply excluding the UN Convention on the International Sale of Goods." abb ABB Automation Products GmbH 3 Application Example 25.06.2014
2 Introduction This document refers to a few very simple examples how to synchronize the time between a PC, acting as SNTP Server and a PLC, acting as a SNTP Client. Ethernet AC500 PC 2.1 Hardware and Software requirements NOTICE The following configuration is used in this document. The newer version of hardware and software should work, however it should be tested by the user himself. All instructions in this guide are based on default settings in the PLC PS501 Control Builder Plus version 2.3.0 or later The CPU required a SNTP configuration, that means not possible with eco PLCs The CPU should have the actual firmware version 2.3.3 or later abb ABB Automation Products GmbH 4 Application Example 25.06.2014
2.2 Safety instructions Follow all safety instructions delivered with the used components: Read all safety and installation instructions of the used PLC. See the online help in CoDeSys (Help Contents Target System AC500 / S500 Introduction Overview Regulations). abb ABB Automation Products GmbH 5 Application Example 25.06.2014
3 PC configuration WARNING Changes in the Registry can lead to unexpected problems requiring you to reinstall your system. We cannot guarantee that problems arising from changes in the registry can be solved. Changes in the Registry are entirely at the user's own risk. 3.1 Instructions for Windows 7 (32-bit and 64-bit) Follow the instructions to configure your local PC as NTP server. In this way you can synchronize other devices (PLCs) with the local PC. Step 1: Stop the "Windows Time" service under START > Control Panel > (optional: System) > Administrative Tools > Services by double click on the entry and push the Stop button. Step 2: Step 3: Open the registry editor with "Start -> Run... -> regedit" Search for the entry: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\TimeProviders\NtpServer" and set the "Enabled" value to 1. abb ABB Automation Products GmbH 6 Application Example 25.06.2014
abb ABB Automation Products GmbH 7 Application Example 25.06.2014
Step 4: Search for the entry: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Config" and set the "AnnounceFlags" value to 5(decimal) Step 5: Check the IP address from the SNTP server. Search for the entry: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Parameters" and set the "NtpServer" value to 192.168.8.253,0x9. This is the IP address from the SNTP Server. This is just an example. In your case, the IP address is different. Please set here the IP address from your PC, where the SNTP server is activated. This IP must be set in the Control Builder Plus SNTP Client configuration. Step 6: Start the "Windows Time" again and set the start type to "Automatic" if not already done. abb ABB Automation Products GmbH 8 Application Example 25.06.2014
NOTICE Please check if the firewall is enabled, it must be configured to permit external access to Port 123. This is necessary because the time server service expects external request messages abb ABB Automation Products GmbH 9 Application Example 25.06.2014
4 PLC Configuration 4.1 Control Builder Plus The PLC program was written with the actual ABB Control Builder Plus version 2.3.0, SP1 This application example should also run with newer versions. 4.2 AC500 CPU Using a AC500 CPU with the actual version (images can be differ) abb ABB Automation Products GmbH 10 Application Example 25.06.2014
abb ABB Automation Products GmbH 11 Application Example 25.06.2014
4.3 Firmware Using the firmware V2.3.0 or later (images can be differ) abb ABB Automation Products GmbH 12 Application Example 25.06.2014
4.4 SNTP configuration Please expand the Communication modules and the Onboard Ethernet and click on IP_Settings. Switch to the extended settings tab. Enable the SNTP protocol and also the Client mode. The IP address for the server and backup server we will insert here is: 192.168.8.253. This IP address is the address from the SNTP server, means the server address where you get the time for your PLC. Please see Instructions for Windows 7 (32-bit and 64-bit). For the first test you can set the time interval to 60s. This is the time interval where the PLC send a SNTP request telegram to the server. The entry Wait for Sync before Run can be set, this is not necessary. If no communication with the SNTP server is possible, the PLC will not RUN. Please enable the entry Allow timejumps and set the value to 43200s. This option is just set for this test. Should be changed after this test. Please double check and change if necessary the settings for Interval and Allow timejumps in your final application. The actual settings are not recommended. WARNING Please save your settings and create configuration data. You can do that by right click on AC500 and choose Create configuration data. Now, please open CoDeSys by double click on AC500. abb ABB Automation Products GmbH 13 Application Example 25.06.2014
4.5 Communication Parameters Please choose your configuration data. Go to Online --> Communication Parameters If you are connect your PLC over Ethernet then insert the following settings: - Address (IP address from the PLC) - Port (set Port to 1201) - Motorola byteorder (Yes) abb ABB Automation Products GmbH 14 Application Example 25.06.2014
5 User program This example contains just only one function block (CLOCK) to display the actual time. With this function block it is also possible to set a new time. This is only for testing. You can change the time, wait until the time interval, set in the Control Builder Plus configuration, is over and the time in the PLC will set. This example was written with the actual version of the PS501 Control Builder Plus software. abb ABB Automation Products GmbH 15 Application Example 25.06.2014
5.1 Download your program to the PLC Please choose Online --> Login. The whole program and the configuration will be downloaded to the PLC. Now, please create a boot project. You can do that by click on Online --> Create boot project. The LED s on the PLC are flashing until be finished. abb ABB Automation Products GmbH 16 Application Example 25.06.2014
6 Modification Version Chapter Init. Modification Date V1.0 All TR First version 2014-03-13 V1.1 All TR Modifications 2014-04-01 abb ABB Automation Products GmbH 17 Application Example 25.06.2014
Doc. kind: No. o. p.: Application Example 18 Title: Lang.: SNTP - Time synchronization with a Win7 PC.docx EN Manual No. 3ADR 025 207 M0201 abb ABB Automation Products GmbH Wallstadter Str. 59 D-68526 Ladenburg Tel. : +49 62 21 / 701-1444 Fax : +49 62 21 / 701-1382 E-Mail : plc.support@de.abb.com www.abb.com/plc