RSVIEW32 EXCEL reporting again

vinitch

Member
Join Date
Jun 2002
Location
Pune, india
Posts
14
Dear All,

For my new RSVIEW project , I want reporting as per following and I am very much new to VBA.My requirement is.....


1) Operator will eneter two parameters in RSVIEW graphic page
a) Data Logging interval ( in minutes)
b) For how long you want data recording ( in hours)
2) Two buttons will be there "START RECORDING" & "STOP RECORDING"
3) Operator will have to press start recording to start the procedure.
4) For example Data logging interval is 5 minutes & 8 hours is logging period
then when operator will press "START RECORING " a NEW EXCEL sheet will be created
and row 1 will have tags values ( tags will be pre-defined and pre-added.Operator will
not have a freedom to add tags)
After 5 minutes second row will be created & so on till completion of 8 hours from start
time i.e total 96 record rows will be in the excel file.
After 8 hour period, this excel file will be saved as current date&time format & closed.

Immedistely again new new excel file be opened & process repeated unless operator
presses "STOP RECORDING"

Please help.

Regards.

Vinit
 
Vinit,

Here is an RSView VBA program. It logs 10 tags once a minute, creates a new Excel file once a day at midnight (12:00 PM), using the date and time in the file name, and saves in a sub-directory called "HOT_GAS_LOG". Perhaps this can be used as an example and guide, for you to modify to suit your needs.

Public Sub WriteCSVLogFile()

Dim AIT240 As Tag
Dim F3 As Tag
Dim F5 As Tag
Dim FE171 As Tag
Dim FE172 As Tag
Dim FE256 As Tag
Dim FE257 As Tag
Dim FUELLOGTOTAL As Tag
Dim PDT240 As Tag
Dim RECIPE_START As Tag
Dim SYSTEMRUN As Tag
Dim TE142 As Tag
Dim TE171 As Tag
Dim TE200 As Tag
Dim TE210 As Tag
Dim TE108 As Tag
Dim LogDate As Date
Dim LogFile As Integer
Dim HeaderTrack As Integer
Dim HeaderPrint As Integer

On Error GoTo catch
MkDir ("C:\HOT_GAS_LOG")

Check:
'Check to see if the header needs to be inserted.
'HeaderTrack is an Integer bit that is set to 0 if it is 12:00 AM, otherwise set = 1.
If ((Format$(Time, "hh:mm:ss") >= #12:00:00 AM#) And (Format$(Time, "hh:mm:ss") <= #12:01:00 AM#)) Or (HeaderPrint = 0) Then
HeaderTrack = 1
Else: HeaderTrack = 0
End If

Set AIT240 = gProject.TagDb("AIT240_SCALED")
Set F3 = gProject.TagDb("F3_RUNNING")
Set F5 = gProject.TagDb("F5_RUNNING")
Set FE171 = gProject.TagDb("FE171_SCALED")
Set FE172 = gProject.TagDb("FE172_SCALED")
Set FE256 = gProject.TagDb("FE256_SCALED")
Set FE257 = gProject.TagDb("FE257_SCALED")
Set FUELLOGTOTAL = gProject.TagDb("FUELLOG_TOTAL")
Set PDT240 = gProject.TagDb("PIC240_PV_SCALED")
Set RECIPESTART = gProject.TagDb("RECIPE_START_PB")
Set SYSTEMRUN = gProject.TagDb("SYSTEM_RUN")
Set TE142 = gProject.TagDb("TE_142")
Set TE171 = gProject.TagDb("TE171_SCALED")
Set TE200 = gProject.TagDb("TE200_AVERAGE")
Set TE210 = gProject.TagDb("TE_210")
Set TE108 = gProject.TagDb("TIC108_PV_SCALED")

'Set LogDate equal to current date function.
LogDate = Date

'Get available file number
LogFile = FreeFile

'Open File for writing to and name file with format date.csv
Open "C:\HOT_GAS_LOG\" & Format$(LogDate, "mmddyy") & ".csv" For Append As #LogFile

'Insert the Header into the csv file between 12:00 and 12:01 AM (or next time program runs) and then insert the data in the correct columns.
If HeaderTrack = 1 Then
Print #LogFile, " TIME"; ","; _
"AIT-240_NOX"; ","; _
"F-3_FAN_ON/OFF"; ","; _
"F-5_FAN_ON/OFF"; ","; _
"FE-171 STACK FLOW"; ","; _
"FE-172 FUEL FLOW"; ","; _
"FE-256 SUPPLY DUCT FLOW"; ","; _
"FE-257 RETURN DUCT FLOW"; ","; _
"TOTAL FUEL USED"; ","; _
"PDT-240 PRESSURE"; ","; _
"RECIPE ON/OFF"; ","; _
"SYSTEM_ON/OFF"; ","; _
"TE-142 TEMP"; ","; _
"TE-171 STACK TEMP"; ","; _
"CHAMBER TEMP"; ","; _
"TE-210 TEMP"; ","; _
"TE-108 TEMP"; ","

'Insert data into column if the header was just inserted
Print #LogFile, Format$(Time, "hh:mm:ss"); ","; _
Format(AIT240.Value, "###0"); ","; _
Format(F3.Value, "#0"); ","; _
Format(F5.Value, "#0"); ","; _
Format(FE171.Value, "####0.0"); ","; _
Format(FE172.Value, "#0.0"); ","; _
Format(FE256.Value, "###0.0"); ","; _
Format(FE257.Value, "###0.0"); ","; _
Format(FUELLOGTOTAL.Value, "#######0"); ","; _
Format(PDT240.Value, "0.00"); ","; _
Format(RECIPESTART.Value, "#0"); ","; _
Format(SYSTEMRUN.Value, "#0"); ","; _
Format(TE142.Value, "###0"); ","; _
Format(TE171.Value, "###0"); ","; _
Format(TE200.Value, "###0"); ","; _
Format(TE210.Value, "###0"); ","; _
Format(TE108.Value, "###0"); ","
HeaderPrint = 1
Else
'If time is anything other than 12:00 and 12:01 midnight just insert the data
Print #LogFile, Format$(Time, "hh:mm:ss"); ","; _
Format(AIT240.Value, "###0"); ","; _
Format(F3.Value, "#0"); ","; _
Format(F5.Value, "#0"); ","; _
Format(FE171.Value, "####0.0"); ","; _
Format(FE172.Value, "#0.0"); ","; _
Format(FE256.Value, "###0.0"); ","; _
Format(FE257.Value, "###0.0"); ","; _
Format(FUELLOGTOTAL.Value, "#######0"); ","; _
Format(PDT240.Value, "0.00"); ","; _
Format(RECIPESTART.Value, "#0"); ","; _
Format(SYSTEMRUN.Value, "#0"); ","; _
Format(TE142.Value, "###0"); ","; _
Format(TE171.Value, "###0"); ","; _
Format(TE200.Value, "###0"); ","; _
Format(TE210.Value, "###0"); ","; _
Format(TE108.Value, "###0"); ","
End If
Close #LogFile

'If the directory already exists, skip to the next line
'Error 75 is directory already created or exists.
catch: 'Error handling routine
If Err.Number = 75 Then
Err.Clear
GoTo Check
Else:
If Err.Number = 4170 Then
Print "Error#4170--Communications driver is not available."
'roErrorTagEvent (4170) - an error occurred while waiting for the operation to complete
Err.Clear
GoTo Check
End If 'End errror #4170
Err.Clear
End If 'End errror handling
End Sub
 
If you log to an MDB file type by using RSVeiw (not DBIV, use the datalogonsnapshot in events to do what you want.

Then in an excel speadsheet create some VB to query the database file & inport the data.

A good example of this is to go to the menu, data, get external data, with this create a query, save it & run, this will fetch all data from the database then convert the query to basic within the basic editor of excel.
You can then see the format of the query, cut & paste into your vb code,modify the code to fetch data from an MDB database.
for example you could put a date/time picker form in the spreadsheet & from this select the date, put it into the query then get the data, format it into whatever format you want & diplay it on the spreadsheet
I have added an excel file + MDB, if you look at visual basic & in the module you will see a macro, I have created a number of speadsheets with date/time pickers to get data from RSV32, they use them for production info.
 
RSview 32

hello friends,

Can anyone help me with rsview32 reporting problem.
Problem with the system is not able to load the data in ACCESS file.
 

Similar Topics

Hi, I'm currently working on a RSView32 project with a SLC 5/04 (DH+). I need to do reporting (on-demand and daily) for the flow from a flow...
Replies
16
Views
11,266
Good friends, I'm new to the forum, I'm working with RSview32, someone can help me how to make a macro in VBA, to save some data in Excel. to...
Replies
6
Views
1,959
Hi Guys i have a question for you, i have a project in rsview32 which production would like to have a downtime sheet pop up which the operator...
Replies
3
Views
1,985
Hi, I have 2 problems. 1- I have an RSView32 application which contains a memory tag defined with these parameters: Min: 0 Max...
Replies
4
Views
8,998
Hi guys, It is possible to execute the Excel.exe when I click the button at RSView32? Is there anywhere we can do this without doing any VB...
Replies
8
Views
6,307
Back
Top Bottom