I'm looking for advice on how to fix a script that I have inherited.
I have no experience with ASPECT but I have some programming experience, none of this looks very foriegn, it just takes me a little time.
Here's my scenario:
I have an ABB Taylor Mod 300 DCS that used to have 2 printers, since then we've "upgraded" the printer setup, connected both printer serial outputs via DB25-DB9 Null modems (I'm pretty sure)to a computer running windows 2000. We're using Procomm as the terminal and there are two scripts running. Each is set up for a different COM port (1 or 2).
Com 1 comes from the DCS and this printer handles alarms, which come in and out at any time. A typical capture looks like this (partial):
LOGGER1 - 09 APR 09 PAGE 2
09:02:28 CWPH02 COOLING TWR PH MES HI 8.0033 A3 8.0000
09:14:33 MUF10 MU MINIFLOW VALVE CNTL PID OUT_MODE CHANGED FROM MANUAL TO AUTO BY BILLY-BOB
09:15:50 CWPH02 COOLING TWR PH MES ACK BY DON
.... and so on....
COM 2 is a printer that handles all of the periodic reports, and the *.txt file that it currently (when the planets align, and everything works right) looks like:
BILLING-0500 01 APR 22 04:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
BILLING-10AM 01 APR 22 09:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
BILLING-1600 01 APR 22 15:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
BILLING-2400 01 APR 22 23:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
Here are the scripts:
COM1 (Logger)
;*************************************************************************
;* Messages.WAS 8/23/00 *
;* *
;* An ASPECT script for initializing logger capture file for a MOD 300 *
;* system using a PC for the printer. *
;* I have initiated the file save in a subdirectory of Mod300 based on *
;* on the year. ie C:\Mod300\2000\*.txt etc *
;* Windows conditions: Regional settings for date mm/dd/yyyy *
;* Startup: *
;* Target: "C:\Program Files\Procomm Plus\Aspect\Messages.wax" *
;* Start in: "C:\Program Files\Procomm Plus\aspect" *
;* Tested using burst of 400 messages with a 1ms txpace value *
;* and 10 second pause to check for date. Lost no messages and overlap *
;* was minimal. Used no hardware or software flow control. *
;* I have provided for a copy of the closed archive to go to the "S" *
;* network drive but I have not been able to prove that it will work. *
;* It can be removed if it does not work. *
;* Make sure that there is a directory on the "s" drive S:\Mod300 *
;* Under the Mod300 directory, make a directories for S:\Mod300\2000 *
;* S:\Mod300\2001 .... 200x for as many years as may be required *
;*************************************************************************
proc main
string CapturePathRoot
string CapturePath
string ArchiveFileName
string DateStr
string SaveDateStr
string Month
string sYear
string lYear
string Day
string SourceF
string DestF
string Str1
string Str2 = "\"
string Str3
string Str4
string Str5
string Str6
Integer SaveDateNum
CapturePathRoot = "C:\DCS\al"
CapturePath = "C:\DCS\al\2001"
ArchiveFileName = "01_04_00.txt"
clear
locate 0 0
set terminal type 30
set port parity odd
set port databits 7
set port baudrate 4800
set txpace 50
set duplex FULL
set port softflow OFF
set port hardflow OFF
set modem connection "direct connect-Com1"
set terminal scroll ON
set statusline ON
set terminal blockcursor ON
set terminal Autosize FONT
set terminal fontname "Courier"
set terminal fontsize 12
set terminal frame OFF
set terminal linewrap ON
set terminal rows 48
set terminal columns 132
set terminal rxcr CR
set terminal sbpages 1000
set terminal scrollmethod NORMAL
set terminal stripbit8 OFF
set terminal tabstops 8
set terminal viewcursor ON
set terminal update FAST
set terminal rawprint OFF
set terminal backspace NONDEST
set quickselect ON
set actionbar top "logger.pwb"
set capture recordmode screen
set capture overwrite OFF
set capture query OFF
set capture path CapturePath
set aspect ctrlbreak ON
set terminal rxcr CR
If failure
mkdir CapturePathRoot
mspause 50
mkdir CapturePath
set capture path CapturePath
endif
NewArchive:
DateStr = $DATE
SaveDateStr = $DATE
atoi SaveDateStr SaveDateNum
substr Month DateStr 0 2
substr Day DateStr 3 2
substr sYear DateStr 8 2
substr lYear DateStr 6 4
strupdt ArchiveFileName Month 0 2
strupdt ArchiveFileName Day 3 2
strupdt ArchiveFileName sYear 6 2
strupdt CapturePath lYear 10 4
Str1 = CapturePath
Str4 = "S:\Mod300\"
Str5 = lYear
Str6 = ArchiveFileName
set capture path CapturePath
If failure
mkdir CapturePath
set capture path CapturePath
endif
set capture file ArchiveFileName
capture on
CheckDate:
DateStr = $DATE
if strncmp SaveDateStr DateStr 10
pause 10
goto CheckDate
else
capture off
mspause 200
;* This section can be commented out if the copy to drive "s" does not work
Str3 = ArchiveFileName
strcat Str1 Str2
strcat Str1 Str3
SourceF = Str1
Str4 = "f:\Mod300\"
strcat Str4 Str5
strcat Str4 Str2
strcat Str4 Str6
DestF = Str4
;*if not copyfile Sourcef Destf
;*errormsg "Couldn't copy file `"%s`"!" Sourcef
;*endif
;* End of network drive copy
goto NewArchive
endif
endproc
COM2 (Reports):
;*************************************************************************
;* Messages.WAS 8/23/00 *
;* *
;* An ASPECT script for initializing logger capture file for a MOD 300 *
;* system using a PC for the printer. *
;* I have initiated the file save in a subdirectory of Mod300 based on *
;* on the year. ie C:\Mod300\2000\*.txt etc *
;* Windows conditions: Regional settings for date mm/dd/yyyy *
;* Startup: *
;* Target: "C:\Program Files\Procomm Plus\Aspect\Messages.wax" *
;* Start in: "C:\Program Files\Procomm Plus\aspect" *
;* Tested using burst of 400 messages with a 1ms txpace value *
;* and 10 second pause to check for date. Lost no messages and overlap *
;* was minimal. Used no hardware or software flow control. *
;* I have provided for a copy of the closed archive to go to the "S" *
;* network drive but I have not been able to prove that it will work. *
;* It can be removed if it does not work. *
;* Make sure that there is a directory on the "s" drive S:\Mod300 *
;* Under the Mod300 directory, make a directories for S:\Mod300\2000 *
;* S:\Mod300\2001 .... 200x for as many years as may be required *
;*************************************************************************
proc main
string CapturePathRoot
string CapturePath
string ArchiveFileName
string DateStr
string SaveDateStr
string Month
string sYear
string lYear
string Day
string SourceF
string DestF
string Str1
string Str2 = "\"
string Str3
string Str4
string Str5
string Str6
Integer SaveDateNum
CapturePathRoot = "C:\DCS\rw"
CapturePath = "C:\DCS\rw\2001"
ArchiveFileName = "01_04_00.txt"
clear
locate 0 0
set terminal type 30
set port parity odd
set port databits 7
set port baudrate 4800
set txpace 50
set duplex FULL
set port softflow OFF
set port hardflow OFF
set modem connection "direct connect-Com2"
set terminal scroll ON
set statusline ON
set terminal blockcursor ON
set terminal Autosize FONT
set terminal fontname "Courier"
set terminal fontsize 12
set terminal frame OFF
set terminal linewrap ON
set terminal rows 48
set terminal columns 132
set terminal rxcr CR
set terminal sbpages 1000
set terminal scrollmethod NORMAL
set terminal stripbit8 OFF
set terminal tabstops 8
set terminal viewcursor ON
set terminal update FAST
set terminal rawprint OFF
set terminal backspace NONDEST
set quickselect ON
set actionbar top "reports.pwb"
set capture recordmode screen
set capture overwrite OFF
set capture query OFF
set capture path CapturePath
set aspect ctrlbreak ON
set terminal rxcr CR
If failure
mkdir CapturePathRoot
mspause 50
mkdir CapturePath
set capture path CapturePath
endif
NewArchive:
DateStr = $DATE
SaveDateStr = $DATE
atoi SaveDateStr SaveDateNum
substr Month DateStr 0 2
substr Day DateStr 3 2
substr sYear DateStr 8 2
substr lYear DateStr 6 4
strupdt ArchiveFileName Month 0 2
strupdt ArchiveFileName Day 3 2
strupdt ArchiveFileName sYear 6 2
strupdt CapturePath lYear 10 4
Str1 = CapturePath
Str4 = "\\powerplant1\projects\DCS\Reports\"
Str5 = lYear
Str6 = ArchiveFileName
set capture path CapturePath
If failure
mkdir CapturePath
set capture path CapturePath
endif
set capture file ArchiveFileName
capture on
CheckDate:
DateStr = $DATE
if strncmp SaveDateStr DateStr 10
pause 10
goto CheckDate
else
capture off
mspause 200
;* This section can be commented out if the copy to drive "s" does not work
Str3 = ArchiveFileName
strcat Str1 Str2
strcat Str1 Str3
SourceF = Str1
Str4 = "f:\Mod300A\"
strcat Str4 Str5
strcat Str4 Str2
strcat Str4 Str6
DestF = Str4
;*if not copyfile SourceF DestF
;*errormsg "Couldn't copy file `"%s`"!" SourceF
;*endif
;* End of network drive copy
goto NewArchive
endif
endproc
_______________________________________________________________________
So the way I see it, once the script is started, it creates a capture file based on the date, then reads from the com port to the capture buffer until the date string changes (as it compares DateStr to SaveDateStr) once the date changes, within 10 seconds, it 'capture off's, dumping the capture buffer to the file, and creates a new capture file and opens a new capture buffer....
At least that is how it was intended to work.
Both scripts run concurrently.
Regarding the Reports file there are a lot of problems:
The most common one is that the terminal locks up after a few days and the capture buffer stays the same day after day, creating identical files until someone notices it.
I tried to place a new label above all of the "set" statements only to find out that breaks the script, so I copied that whole block of initializing set's down right before goto NewArchive, with the thoughts that perhaps that would prevent the terminal from locking up, and to perhaps ensure that each day gets a fresh start with no garbage. I've been unlucky. It worked like I wanted as I tested by manually printing each of the four reports and using the computer clock to change the date... But over the weekend, it didn't work well. Only the 1600 report went through to the capture file.
Also, I'm able now to recreate a problem that has been reported in the past where a report prints out just fine in the procomm window, but when it's 'capture off' time, a chunk out of the middle of one of the reports, usually the last one, ends up missing in the final file... I tried experimenting with 'mspause 200's length to try to remedy this, but I have not been able to figure it out so far.
I'd like to eventually send custom reports that I can have processed into excel, to eliminate operator data entry but judging from my problems so far, I'm a long way off
I can modify the reports to send a special character sequence, allowing a loop in the script to detect the end of each individual report and 'capture off' and append to the file each time if that is a better way. I'm willing to roll my sleves up here, I'm just looking for some guidance. Ultimately I want a text file for each day with the logger alarms for that entire day. And I want the same thing for the reports. Is the framework I'm working with a good one to build from? or is there a better overall process? We dont use the section for copy to drive "s" yet, but we would like to be able to at some point.
Thanks in advance for any help or guidance you may have.
I have no experience with ASPECT but I have some programming experience, none of this looks very foriegn, it just takes me a little time.
Here's my scenario:
I have an ABB Taylor Mod 300 DCS that used to have 2 printers, since then we've "upgraded" the printer setup, connected both printer serial outputs via DB25-DB9 Null modems (I'm pretty sure)to a computer running windows 2000. We're using Procomm as the terminal and there are two scripts running. Each is set up for a different COM port (1 or 2).
Com 1 comes from the DCS and this printer handles alarms, which come in and out at any time. A typical capture looks like this (partial):
LOGGER1 - 09 APR 09 PAGE 2
09:02:28 CWPH02 COOLING TWR PH MES HI 8.0033 A3 8.0000
09:14:33 MUF10 MU MINIFLOW VALVE CNTL PID OUT_MODE CHANGED FROM MANUAL TO AUTO BY BILLY-BOB
09:15:50 CWPH02 COOLING TWR PH MES ACK BY DON
.... and so on....
COM 2 is a printer that handles all of the periodic reports, and the *.txt file that it currently (when the planets align, and everything works right) looks like:
BILLING-0500 01 APR 22 04:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
BILLING-10AM 01 APR 22 09:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
BILLING-1600 01 APR 22 15:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
BILLING-2400 01 APR 22 23:59 PAGE 1
PRELIMINARY REVENUE MONITORING REPORT
POWER PLANT COGEN
CURRENT CURRENT DCS TAG #
*POWER*
U1 TOTAL MW HRS 526.68 MWH 32.967 NET MW U1 GROSS 33.786 1EEJ11-NT
U2 TOTAL MW HRS 489.55 MWH 30.769 NET MW U2 GROSS 31.966 2EEJ11-NT
U3 TOTAL MW HRS 430.40 MWH 26.984 NET MW 3EEJ11-NT
TOT TOTAL MWH TO NPC 1446.6 MWH 90.720 NET MW PLANT GROSS 92.736
TOT MWH TO NPC PER NPC METER 1418.4 MWH EEYY64
TOT MWH IMPORTED FROM NPC 0.0000 MWH EEYY63
AUX U1 AUX LOAD TOTAL 12.603 MWH 0.8193 MW
U2 AUX LOAD TOTAL 17.912 MWH 1.1965 MW
SUM OF AUX LOAD TOTALS 30.515 MWH 2.0159 MW
U2 NAT GAS TOTAL 284.36 KLBS 396.69 KSCFH 2FQG
U1 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1FGF20
U2 NAT GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2FGF20
AUX BLR #1 GAS TOTL 0.0000 KSCF 0.0000 KSCFH VOLCANO-NGAS
AUX BLR #2 GAS TOTL 0.0000 KSCF 0.0000 KSCFH BUD_BLR_NGAS
PLANT NAT GAS TOTL PER SPC METER 13598 KSCF 853.50 KSCFH FGF02
HYD U1 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 1HXF20
U2 H2 GAS DUCT TOTL 0.0000 KSCF 0.0000 KSCFH 2HXF20
TOTAL HYDROGEN RECEIVED 46.986 KSCF 0.0000 KSCFH HXF01
DECATHERMS OF HYDROGEN RECEIVED 14.729 MBTUS
OIL TOTAL FUEL OIL 0.0000 KLBS
*STEAM*
HP U1 HP STEAM FLOW TOTAL 2087.0 KLBS 131.20 KPPH 1HSF02
U2 HP STEAM FLOW TOTAL 2068.0 KLBS 130.05 KPPH 2HSF02
IP U1 IP STEAM MADE TOTL 270.42 KLBS 17.134 KPPH 1ISF02
U2 IP STEAM MADE TOTL 262.47 KLBS 17.155 KPPH 2ISF02
EXT CUSTOMER1 EXT STEAM TOTAL (NORMAL) 11.580 KLBS 0.0000 KPPH ESF12
CUSTOMER1 EXT STEAM TOTAL (AUX) 0.0000 KLBS 0.0000 KPPH ESF101
CUSTOMER2 EXT STEAM TOTAL 201.71 KLBS 14.859 KPPH OS-FT-STM
*CONDENSATE*
CUSTOMER1 CONDENSATE RETURN (2-4) TOTL 7.9159 KGALS 0.0000 GALS PCF01
CUSTOMER1 CONDENSATE RETURN (1ST) TOTL 2.2285 KGALS 0.0000 GALS PCF02B
CUSTOMER2 CONDENSATE RETURN 0.0000 KGALS 0.0000 GALS OS-FT-COND
*WATER*
SERVICE (RAW) WATER FLOW TOTAL 348.43 KGAL 392.53 GALS SWF01
POTABLE WATER 5.7751 KGAL 5.8000 GALS PWF01
DI WATER FROM PIONEER -0.910 KGAL -0.960 GALS DI-PCA-METR
WASTE WASTE WTR TO TANK 0.0000 GALS 0.0000 GALS WWF06
WASTE TO EVAP POND 0.0000 GALS ?0.0000 GALS WWF09
* * WASTE WTR TANK > PIONEER 0.1706 KGALS 0.1333 GALS WWF01
*TANK LEVELS*
FUEL OIL TANK 127250 GALS 16.967 % FULL FOL05
WASTE WATER TANK 25.784 FEET 64.459 % FULL WWL05A
PROCESS WATER TANK 392230 GALS 60.343 % FULL RWLY05
MAKE UP WATER TANK 131893 GALS 82.433 % FULL MUL02
*MISC.*
UNIT 1 NH3 TOTAL 294.69 KLBS 19.504 LBS/HR 1NHF05
UNIT 2 NH3 TOTAL 298.76 KLBS 15.769 LBS/HR 2NHF05
U1 TOTAL FIRED HOURS 45.900 HRS
U2 TOTAL FIRED HOURS 45.400 HRS
Here are the scripts:
COM1 (Logger)
;*************************************************************************
;* Messages.WAS 8/23/00 *
;* *
;* An ASPECT script for initializing logger capture file for a MOD 300 *
;* system using a PC for the printer. *
;* I have initiated the file save in a subdirectory of Mod300 based on *
;* on the year. ie C:\Mod300\2000\*.txt etc *
;* Windows conditions: Regional settings for date mm/dd/yyyy *
;* Startup: *
;* Target: "C:\Program Files\Procomm Plus\Aspect\Messages.wax" *
;* Start in: "C:\Program Files\Procomm Plus\aspect" *
;* Tested using burst of 400 messages with a 1ms txpace value *
;* and 10 second pause to check for date. Lost no messages and overlap *
;* was minimal. Used no hardware or software flow control. *
;* I have provided for a copy of the closed archive to go to the "S" *
;* network drive but I have not been able to prove that it will work. *
;* It can be removed if it does not work. *
;* Make sure that there is a directory on the "s" drive S:\Mod300 *
;* Under the Mod300 directory, make a directories for S:\Mod300\2000 *
;* S:\Mod300\2001 .... 200x for as many years as may be required *
;*************************************************************************
proc main
string CapturePathRoot
string CapturePath
string ArchiveFileName
string DateStr
string SaveDateStr
string Month
string sYear
string lYear
string Day
string SourceF
string DestF
string Str1
string Str2 = "\"
string Str3
string Str4
string Str5
string Str6
Integer SaveDateNum
CapturePathRoot = "C:\DCS\al"
CapturePath = "C:\DCS\al\2001"
ArchiveFileName = "01_04_00.txt"
clear
locate 0 0
set terminal type 30
set port parity odd
set port databits 7
set port baudrate 4800
set txpace 50
set duplex FULL
set port softflow OFF
set port hardflow OFF
set modem connection "direct connect-Com1"
set terminal scroll ON
set statusline ON
set terminal blockcursor ON
set terminal Autosize FONT
set terminal fontname "Courier"
set terminal fontsize 12
set terminal frame OFF
set terminal linewrap ON
set terminal rows 48
set terminal columns 132
set terminal rxcr CR
set terminal sbpages 1000
set terminal scrollmethod NORMAL
set terminal stripbit8 OFF
set terminal tabstops 8
set terminal viewcursor ON
set terminal update FAST
set terminal rawprint OFF
set terminal backspace NONDEST
set quickselect ON
set actionbar top "logger.pwb"
set capture recordmode screen
set capture overwrite OFF
set capture query OFF
set capture path CapturePath
set aspect ctrlbreak ON
set terminal rxcr CR
If failure
mkdir CapturePathRoot
mspause 50
mkdir CapturePath
set capture path CapturePath
endif
NewArchive:
DateStr = $DATE
SaveDateStr = $DATE
atoi SaveDateStr SaveDateNum
substr Month DateStr 0 2
substr Day DateStr 3 2
substr sYear DateStr 8 2
substr lYear DateStr 6 4
strupdt ArchiveFileName Month 0 2
strupdt ArchiveFileName Day 3 2
strupdt ArchiveFileName sYear 6 2
strupdt CapturePath lYear 10 4
Str1 = CapturePath
Str4 = "S:\Mod300\"
Str5 = lYear
Str6 = ArchiveFileName
set capture path CapturePath
If failure
mkdir CapturePath
set capture path CapturePath
endif
set capture file ArchiveFileName
capture on
CheckDate:
DateStr = $DATE
if strncmp SaveDateStr DateStr 10
pause 10
goto CheckDate
else
capture off
mspause 200
;* This section can be commented out if the copy to drive "s" does not work
Str3 = ArchiveFileName
strcat Str1 Str2
strcat Str1 Str3
SourceF = Str1
Str4 = "f:\Mod300\"
strcat Str4 Str5
strcat Str4 Str2
strcat Str4 Str6
DestF = Str4
;*if not copyfile Sourcef Destf
;*errormsg "Couldn't copy file `"%s`"!" Sourcef
;*endif
;* End of network drive copy
goto NewArchive
endif
endproc
COM2 (Reports):
;*************************************************************************
;* Messages.WAS 8/23/00 *
;* *
;* An ASPECT script for initializing logger capture file for a MOD 300 *
;* system using a PC for the printer. *
;* I have initiated the file save in a subdirectory of Mod300 based on *
;* on the year. ie C:\Mod300\2000\*.txt etc *
;* Windows conditions: Regional settings for date mm/dd/yyyy *
;* Startup: *
;* Target: "C:\Program Files\Procomm Plus\Aspect\Messages.wax" *
;* Start in: "C:\Program Files\Procomm Plus\aspect" *
;* Tested using burst of 400 messages with a 1ms txpace value *
;* and 10 second pause to check for date. Lost no messages and overlap *
;* was minimal. Used no hardware or software flow control. *
;* I have provided for a copy of the closed archive to go to the "S" *
;* network drive but I have not been able to prove that it will work. *
;* It can be removed if it does not work. *
;* Make sure that there is a directory on the "s" drive S:\Mod300 *
;* Under the Mod300 directory, make a directories for S:\Mod300\2000 *
;* S:\Mod300\2001 .... 200x for as many years as may be required *
;*************************************************************************
proc main
string CapturePathRoot
string CapturePath
string ArchiveFileName
string DateStr
string SaveDateStr
string Month
string sYear
string lYear
string Day
string SourceF
string DestF
string Str1
string Str2 = "\"
string Str3
string Str4
string Str5
string Str6
Integer SaveDateNum
CapturePathRoot = "C:\DCS\rw"
CapturePath = "C:\DCS\rw\2001"
ArchiveFileName = "01_04_00.txt"
clear
locate 0 0
set terminal type 30
set port parity odd
set port databits 7
set port baudrate 4800
set txpace 50
set duplex FULL
set port softflow OFF
set port hardflow OFF
set modem connection "direct connect-Com2"
set terminal scroll ON
set statusline ON
set terminal blockcursor ON
set terminal Autosize FONT
set terminal fontname "Courier"
set terminal fontsize 12
set terminal frame OFF
set terminal linewrap ON
set terminal rows 48
set terminal columns 132
set terminal rxcr CR
set terminal sbpages 1000
set terminal scrollmethod NORMAL
set terminal stripbit8 OFF
set terminal tabstops 8
set terminal viewcursor ON
set terminal update FAST
set terminal rawprint OFF
set terminal backspace NONDEST
set quickselect ON
set actionbar top "reports.pwb"
set capture recordmode screen
set capture overwrite OFF
set capture query OFF
set capture path CapturePath
set aspect ctrlbreak ON
set terminal rxcr CR
If failure
mkdir CapturePathRoot
mspause 50
mkdir CapturePath
set capture path CapturePath
endif
NewArchive:
DateStr = $DATE
SaveDateStr = $DATE
atoi SaveDateStr SaveDateNum
substr Month DateStr 0 2
substr Day DateStr 3 2
substr sYear DateStr 8 2
substr lYear DateStr 6 4
strupdt ArchiveFileName Month 0 2
strupdt ArchiveFileName Day 3 2
strupdt ArchiveFileName sYear 6 2
strupdt CapturePath lYear 10 4
Str1 = CapturePath
Str4 = "\\powerplant1\projects\DCS\Reports\"
Str5 = lYear
Str6 = ArchiveFileName
set capture path CapturePath
If failure
mkdir CapturePath
set capture path CapturePath
endif
set capture file ArchiveFileName
capture on
CheckDate:
DateStr = $DATE
if strncmp SaveDateStr DateStr 10
pause 10
goto CheckDate
else
capture off
mspause 200
;* This section can be commented out if the copy to drive "s" does not work
Str3 = ArchiveFileName
strcat Str1 Str2
strcat Str1 Str3
SourceF = Str1
Str4 = "f:\Mod300A\"
strcat Str4 Str5
strcat Str4 Str2
strcat Str4 Str6
DestF = Str4
;*if not copyfile SourceF DestF
;*errormsg "Couldn't copy file `"%s`"!" SourceF
;*endif
;* End of network drive copy
goto NewArchive
endif
endproc
_______________________________________________________________________
So the way I see it, once the script is started, it creates a capture file based on the date, then reads from the com port to the capture buffer until the date string changes (as it compares DateStr to SaveDateStr) once the date changes, within 10 seconds, it 'capture off's, dumping the capture buffer to the file, and creates a new capture file and opens a new capture buffer....
At least that is how it was intended to work.
Both scripts run concurrently.
Regarding the Reports file there are a lot of problems:
The most common one is that the terminal locks up after a few days and the capture buffer stays the same day after day, creating identical files until someone notices it.
I tried to place a new label above all of the "set" statements only to find out that breaks the script, so I copied that whole block of initializing set's down right before goto NewArchive, with the thoughts that perhaps that would prevent the terminal from locking up, and to perhaps ensure that each day gets a fresh start with no garbage. I've been unlucky. It worked like I wanted as I tested by manually printing each of the four reports and using the computer clock to change the date... But over the weekend, it didn't work well. Only the 1600 report went through to the capture file.
Also, I'm able now to recreate a problem that has been reported in the past where a report prints out just fine in the procomm window, but when it's 'capture off' time, a chunk out of the middle of one of the reports, usually the last one, ends up missing in the final file... I tried experimenting with 'mspause 200's length to try to remedy this, but I have not been able to figure it out so far.
I'd like to eventually send custom reports that I can have processed into excel, to eliminate operator data entry but judging from my problems so far, I'm a long way off
I can modify the reports to send a special character sequence, allowing a loop in the script to detect the end of each individual report and 'capture off' and append to the file each time if that is a better way. I'm willing to roll my sleves up here, I'm just looking for some guidance. Ultimately I want a text file for each day with the logger alarms for that entire day. And I want the same thing for the reports. Is the framework I'm working with a good one to build from? or is there a better overall process? We dont use the section for copy to drive "s" yet, but we would like to be able to at some point.
Thanks in advance for any help or guidance you may have.