installing sql on nt workstation - rockwell automation · web viewafter the first unsuccessful...

8
RSSql Redundancy Method Using PLC Logic Objectives: To establish a configuration for two (2) separate workstations (‘primary’ and ‘secondary’) to log mission critical data to a single table contained within a remote SQL Server computer and database. This configuration will avoid duplication of data within the table and only one (1) workstation will be logging data at any given time. This configuration is strictly for a historical data logging application. Should any component of the system malfunction or become disconnected, the logging of data will continue. The diagram below displays the hardware/software configuration used for the application.

Upload: hoangdang

Post on 08-Jul-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

RSSql Redundancy MethodUsing PLC Logic

Objectives: To establish a configuration for two (2) separate workstations (‘primary’ and ‘secondary’) to log mission critical data to a single table contained within a remote SQL Server computer and database. This configuration will avoid duplication of data within the table and only one (1) workstation will be logging data at any given time. This configuration is strictly for a historical data logging application. Should any component of the system malfunction or become disconnected, the logging of data will continue.

The diagram below displays the hardware/software configuration used for the application.

Each RSSql install is configured for the Control and Database connections as well as the Transaction Stores Data expression in the Trigger/Storage.

RSSQL Handshaking

Configuration: In order to have only one RSSql workstation logging data to the SQL database and avoid duplicate records, a handshaking method is used in conjunction with the processor. The handshaking is accomplished by using the Bind Transaction Result configuration option in the Transaction Definition of RSSql and some PLC logic. The ‘primary’ logging station will record the data into the database while each transaction result is successful. After the first unsuccessful transaction the ‘secondary’ logging station transaction trigger will be enabled with PLC ladder code.

Using the Configuration\Check List… is an easy method for checking configuration setups within RSSql.

1) In this configuration, the PLC was polled every 5 seconds for the data to be logged. At the ‘primary’ station a data point is configured to store the result of the transaction, such as N7:0, by using the Bind Transaction Result configuration. For every successful transaction the value of N7:0 will be set to 1. Once a transaction is not successful the error code (which will be any value other than 1) will be sent to N7:0. The PLC code will detect this change in value and enable the ‘log trigger’ for the ‘secondary’ RSSql station. In the case where the ‘primary’ station loses communications to the PLC and the transaction result can’t be stored, a timer is used to detect that N7:0 has remained a value other than 1 for 5 seconds and enable the ‘secondary’ logging station. Each RSSql will poll for the information, but through the trigger expression, only one RSSql station is logging data to the SQL Server.

2) Each RSSql station needs the Transaction Stores Data On True Expression configured within the Trigger And Storage Parameters screen. Example: The ‘primary’ would be N7:1==1 and the ‘secondary’ RSSql would be N7:10==1.

3) Within the PLC ladder there are 7 rungs of logic to monitor and control the values of N7:0, N7:1, N7:10, and two timers. The following ladder logic method is a functional example. Other methods may also be suitable for different applications.

A) The first rung uses an EQU comparison to set the DN bit of the timer that is monitoring how long N7:0 was not equal to 1, starts a timer which allows N7:0 to remain at 1 for 2 seconds, and clears N7:10 in case it was set to 1 from a previous failure.

B) The second rung moves the 1 value from N7:0 to N7:1 to hold as a “successful” transaction.

C) The third rung will clear N7:0 when the 2 second timer DN bit is set in preparation for the next transaction (this also causes the fourth rung to be true).

D) The fourth rung will enable a timer the first time the N7:0 value is not equal to 1 due to the 4 second timer DN bit being set. Notice that a 2 second and 4 second timer

are used for a total of 6 seconds in order to provide a 1 second buffer to avoid an “accidental” failover.

E) The fifth rung will set N7:10 to 1 whenever N7:0 is not 1 for the previous 5 seconds to enable the logging of the ‘secondary’ RSSql station and also clear the N7:1 tag which was enabling the ‘primary’ transaction storage.

F) The sixth rung is used to clear N7:10 when the ‘primary’ station is successfully logging data values again. This can be called a “failback”.

G) The last rung is a simple timer to create values logged to the database.

4) An additional option is to create a data object and column in the database that will store a STRING value that is unique to each logging station. For example, the ‘primary’ logging station will log the word “PRIMARY” into the table the ‘secondary’ will log “SECONDARY”

5) Should the connection to the database be lost, the data will be cached locally at the RSSql logging station until a database connection is established.

Conclusion: The configuration offered in this application provides a robust methodology to meet all objectives of a mission critical logging application. The configuration provides for double jeopardy situations where both a workstation and the SQL Server malfunction.