Applies to:
PcVue version 7.20d SP3 onwards. |
||
|
||
Summary:
This document is intended for providing a solution to redundant on-line printing using PcVue. The architecture in a schema is first given to clarify the mechanism used for the two redundant line printers. Then the status of the two redundant line printers which plays the heartbeat role is further discussed in more detail. Finally a simple demo project is described as concrete as possible to demonstrate how the redundant on-line printing can properly work as expected. |
||
|
||
Details:
The architecture of the redundant on-line printing will be illustrated by the following scheme:
Then, let’s enumerate all the possible scenarios when the status of the 2 printers changes. Scenario 1: When the 2 printers are both ready for printing, only the printer 1 will play the role on On-line Printing while the printer 2 is standby. A print job generated from the log list will flow from the list buffer in PcVue to the files spooler in PrintVue, to Windows spooler of the system, and finally reach the printer device. The sequence of the print jobs that will be output to the device is certain from the Job0 to Jobi after the soft switch. Scenario 2: When the printer 1 is out of service in certain time, the soft switch 1 will be open and another will be closed, and in result the print jobi+1 will be redirected to be printed on the printer 2. The printer 2 will continue to function on printing until the printer 1 is put into service again or itself also falls in error. Once the printer 1 or 2 is switched off, there may remain some print jobs in the 3 levels of spoolers because theoretically we don’t want to lose any log print jobs, and those jobs will be printed out as soon as it recovers to work. Note that it will not be surprised at the case when the 2 printers are simultaneously printing during some period. Scenario 3: When the printer 1 recovers, it will re-take over the on-line printing funtion in spite of the printer 2 still working, i.e. the printer 2 will be closed down and reset as standby. Scenario 4: When the 2 printers are out of service at the same time, both of them will be cut off by the two switches, but there may keep some print jobs in their spoolers respectively, which will be printed out once the printers are in service again. In this case, PcVue will lose the print jobi+1 and the successive jobs, in consequence that they need rapid human intervention. While one or both of them become active again, PcVue will replay the on-line printing like scenarios 1 – 3. The status of the two redundant line printers in the heartbeat role The status of the two redundant line printers reveals a vital role in the heartbeat function for the redundant on-line printing. And however, some status of a line printer device is always not so easy to get due to the design of the Win32 spooler API. Here it is necessary to address PcVue how to detect the status of a printer at the level of Print Jobs in Windows spooler and refresh its corresponding line printer system variables. The print job status detected by Windows Spooler The status of printers and print jobs are updated by the Win32 Spooler during the despooling of a print job. At all other times, when that printer is not despooling and reports no state information by design, the printer is considered to be ready and idle. For more information please search the Microsoft wenbsite for the MSDN article “How to get the status of a printer and a print job” On the other hand, it is very important to maintain the printer driver updated to the operating system. First we should verify the fitness of the driver at the moment we add a new printer to the system. Then we need to test if the Win32 spooler can well report the status of the printer such as printing error, out of paper, offline and etc. If everything is all right, finally we can determine to go to the next step. Here is an example hint to watch the despooling of a print job. Please follow the procedure as below: Click “start / Printers and Faxes” – double click on the chosen printer. Let’s take the 2 printers for an example as follows: 1. The driver of the “EPSON LX-300+II ESC/P” printer was for Windows 2000, and thus on Windows XP, the spooler is not able to detect the status like “Out of Paper”, such that it could be a problem with the false status. 2. The driver of the “EPSON LX-300” printer was well designed for Windows XP (one of the included drivers), and therefore on Windows XP, the spooler clearly sees such a status. The printer status in PcVue There are 2 printer system variables in PcVue to manage the printer status. They are “System.Printer.x.x.Status” and “System.Printer.x.x.Jobs.Status”, and their values refresh depending on the status of printers and print jobs updated by the Win32 Spooler. Note that it may take several minutes for some kinds of printers to asynchronousely report the job status. Unfortunately, most of printers don’t return the printer status itself; this is why the value of another system variable “System.Printer.x.x.Status_Ex” is often zero, but if some drivers are well designed for Windows, it should be helpful and believable. When the status of print jobs is any one of the following values:
the value of the “System.Printer.x.x.Status” will be set to 103. Its values of zero meaning ok and 103 are essential for the heartbeat role. Note that the value of the “System.Printer.x.x.Jobs.Status” variable can be any reasonable combination of the status of print jobs, for example, you may often run into the value of 18 which means 2(error) plus 16 (printing). The solution to the redundant on-line printing The solution provided for the redundant on-line printing is driven by PcVue’s program event triggers. The simple demo project will be described in detail below. The variables We need to create 4 variables as follows: A bit log variable @LOG A bit variable for the indicator of starting project @PROJECTRUNNING Two bit variables for event triggers: @PRINTER1ERROR @PRINTER2ERROR The mimic In the mimic, it means that the main printer is printing error and out of service, and the standy printer takes over the on-line printing as expected. 2 line printers Two line printers are configured in the LPRINTER.DAT file. 1. EPSON LX-300+II ESC/P – the LPT3: port 2. Epson LX-300 – the LPT2: port The expressions on variable Two expressions on variable are configured in the EXPRV.DAT file. EXPRV,@PRINTER1ERROR,@system.printer.1.1.status == 103,,,0,0, EXPRV,@PRINTER2ERROR,@system.printer.2.2.status == 103,,,0,0, The log filters Two log filters are configured in the HISTO.DAT file. LogFilter1 – Printer1 LogFilter2 – Printer2 LOG,LogFilter1,14,32382,7,1,0,0,4096,4096,120,,1,#D/#M/#Y #h:#m:#s #E #T,,,0,0,”” LOGFORMAT,LogFilter1,”#@A1,#@A2″ LOG,LogFilter2,14,32382,7,1,0,0,4096,4096,120,,2,#D/#M/#Y #h:#m:#s #E #T,,,0,0,”” LOGFORMAT,LogFilter2,”#@A1,#@A2″ The program event triggers Two program events are configured in the EVENT.DAT file. Old format before version 8.10. “PRINTER1ERROR”,2,”REDPRINTERS”,””,”MyPrinter”,””,1,””,”ALL>ALL”,,,0,0,”” “PRINTER2ERROR”,2,”REDPRINTERS”,””,”MyPrinter”,””,1,””,”ALL>ALL”,,,0,0,”” New format for version 8.10 onwards. EVTPROG,PROGRAMEVENT1,””,0,0,””,””,”PRINTER1ERROR”,2,1,””,”ALL>ALL”,”PRINTERS”,””,”MYPRINTER”,”” EVTPROG,PROGRAMEVENT2,””,0,0,””,””,”PRINTER2ERROR”,2,1,””,”ALL>ALL”,”PRINTERS”,””,”MYPRINTER”,”” The cyclic event A cyclic is configured in the CYCLIC.DAT file to reverse the log bit to generate the print jobs. 2 s – MyLog function 2,”REDPRINTERS”,””,”MyLog”,””,1,””,,,0,0,”” The archive unit of the proprietary type An archive unit called unite is also configured in order to facilitate to store and trace the trends of the printer status. The SCADA Basic script A simple program called REDPRINTERS is given. Sub main () sub MyLog () Sub MyPrinter ( ) |
||
|
||
|
Created on: 17 Dec 2010 Last update: 13 May 2024