Archive (sac) File Text Format

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: User Guide ➔ Reports ➔ Archive Reporter ➔ Archive (sac) File Text Format

Archive Reporter Archive Editor Archive (sac) File Text Format

Introduction

The Archive Reporter is used with Dynamic projects to report data directly to a database or CSV text file while a project is running.

The user specifies how many tables of data are required, the frequency of reporting (each table may be reported at a user specified time) and the tags that are reported in each table. These settings are recorded in a text (sac) file.

SysCAD contains an Archive Editor to edit this file. If the Edit button on the Project Settings Archive tab page is pressed then the Archive Editor is launched.

The sac file can still be viewed and edited with a text editor such as Notepad, Notepad++, Textpad, etc., outside of SysCAD, if required. The file format follows the standard INI text file format, which allows the file to be manually edited or programmatically generated/manipulated.

Notes:

  • The sac file must have the extension .sac
  • Any text between a semicolon(;) and the rest of the line is treated as a comment.
  • If the manually edited sac file is opened with the Archive Editor inside SysCAD, some formatting in the file will be changed.

Archive Text File Syntax

Example Archive (sac) File

An example SysCAD Archive Configuration file (text file with the .sac extension) is as follows:

;=============================================================
;=====         SysCAD Archive configuration file         =====
;=============================================================
[Options]
DBFile     = $Prj\Archive.db3
AllowAccess= 0
;=============================================================

[Columns]
DateTime   = 0
Date       = 1
Time       = 1
ElapsedHMS = 0
ElapsedDbl = s
Command    = 0
Type       = 1
Tag        = 1
Source     = 1
IDNo       = 0
IterNo     = 0
CallNo     = 0
SeqNo      = 0
Message    = 1

;=============================================================
[MessageLog] ; System table
On         = 1
Format     = DB
;=============================================================

[EventLog] ; System table
On         = 1
Format     = DB
;=============================================================

[Table1]
Name       = Daily
On         = 1
Format     = DB-SQLITE
Period     = 24:00:00
Offset     = 0:00:00
Field1     = "Steps",                       PlantModel.Stats.Steps, Current
Field2     = "Tank1 Level (%)",             TNK_1.Lvl (%),          Current
Field3     = "Tank1 Level Difference (%)",  TNK_1.Lvl (%),          CurrentDiff
Field4     = "Tank1 Min Level (%)",         TNK_1.Lvl (%),          Minimum
Field5     = "Tank1 Max Level (%)",         TNK_1.Lvl (%),          Maximum
Field6     = "Tank1 Ave Level (%)",         TNK_1.Lvl (%),          Average
Field7     = "Total Tank Feed",             TNK_1.QFeed.QMt (kg/s), Sum
Field8     = "Total Tank Feed since start", TNK_1.QFeed.QMt (kg/s), SumTotal

[Table2]
Name       = Monthly
On         = 1
Format     = CSV
Path       = $Prj\Archive
Trigger1   = "Monthly",                     $Dyn.DateRec.Month,     Delta=0.1
Field1     = "Steps",                       PlantModel.Stats.Steps, Current
Field2     = "Month",                       $Dyn.DateRec.MonthDesc, String
Field3     = "Tank1 Level (%)",             TNK_1.Lvl (%),          Current
Field4     = "Tank1 Level Difference (%)",  TNK_1.Lvl (%),          CurrentDiff
Field5     = "Tank1 Min Level (%)",         TNK_1.Lvl (%),          Minimum
Field6     = "Tank1 Max Level (%)",         TNK_1.Lvl (%),          Maximum
Field7     = "Tank1 Ave Level (%)",         TNK_1.Lvl (%),          Average
Field8     = "Total Tank Feed",             TNK_1.QFeed.QMt (kg/s), Sum
Field9     = "Total Tank Feed since start", TNK_1.QFeed.QMt (kg/s), SumTotal
[Table3] Name = Mass Balance for Period On = 1 Format = CSV Path = $Prj\Archive Trigger1 = "1 tonne of Feed", P_001.Qo.Total.QMt (t), Delta=1 Field1 = "Steps", PlantModel.Stats.Steps, Current Field2 = "Simulation Time", PlantModel.Stats.SimulationTime (s), Current Field3 = "Total Feed (t)", TNK_001.QFeed.QMt (t/s), Sum Field4 = "Total Output1 (t)", P_002.Qo.QMt (t/s), Sum Field5 = "Total Output2 (t)", P_003.Qo.QMt (t/s), Sum Field6 = "Tank1 Initial Mass (t)", TNK_001.Content.InitMt (t), Current Field7 = "Spilt from Tank1 (t)", TNK_001.Content.Spill.Rate (t/s), Sum Field8 = "Vented from Tank1 (t)", TNK_001.Content.Vent.Rate (t/s), Sum Field9 = "Tank1 Current Mass (t)", TNK_001.Mt (t), Current ;MassBalance:TotalFeed=TotalOut+SurgeAccumulation+Spilt+Vented ;MassBalance:Field3=(Field4+Field5)+(Field9-Field6)+Field7+Field8
[Table4] Name = Mass Balance from Beginning On = 1 Format = CSV Path = $Prj\Archive Trigger1 = "1 tonne of Feed", P_001.Qo.Total.QMt (t), Delta=1 Field1 = "Steps", PlantModel.Stats.Steps, Current Field2 = "Simulation Time", PlantModel.Stats.SimulationTime (s), Current Field3 = "Total Feed (t)", TNK_001.QFeed.QMt (t/s), SumTotal Field4 = "Total Output1 (t)", P_002.Qo.Total.QMt (t), Current Field5 = "Total Output2 (t)", P_003.Qo.Total.QMt (t), Current Field6 = "Tank1 Total Mass Change (t)", TNK_001.Content.DeltaMt (t), Current Field7 = "Spilt from Tank1 (t)", TNK_001.Content.Spill.Rate (t/s), SumTotal Field8 = "Vented from Tank1 (t)", TNK_001.Content.Vent.Rate (t/s), SumTotal Field9 = "Tank1 Current Mass (t)", TNK_001.Mt (t), Current ;MassBalance:TotalFeed=TotalOut+SurgeAccumulation+Spilt+Vented ;MassBalance:Field3=(Field4+Field5)+Field6+Field7+Field8
[Table5] Name = Monthly Reporting On = 1 Format = CSV Path = $Prj\Archive Trigger1 = "Monthly", $Dyn.DateRec.Month, Delta=0.1 Field1 = "Simulated Time", TNK_001.Lvl (%), Time Field2 = "Total Simulated Time", TNK_001.Lvl (%), TimeTotal Field3 = "Seconds > 50%", TNK_001.Lvl (%), Time(>,50) Field4 = "Minutes > 50%", TNK_001.Lvl (%), Time(>,50,m) Field5 = "Total Minutes > 50%", TNK_001.Lvl (%), TimeTtl(>,50,m) Field6 = "Seconds 10%<Level=<90%", TNK_001.Lvl (%), TimeInRange(>,10,<=,90) Field7 = "Total Seconds 10%<Level=<90%", TNK_001.Lvl (%), TimeInRangeTotal(>,10,<=,90) Field8 = "Minutes Level<=10% or Level>90%", TNK_001.Lvl (%), TimeOutRange(<=,10,>,90,m) Field9 = "Total Minutes Level<=10% or Level>90%", TNK_001.Lvl (%), TimeOutRangeTotal(<=,10,>,90,m)

The above example consists system settings, system tables and five tables of user specifications:

Table 1) "Daily" - Data for the eight fields will be recorded at 24 hour intervals (at midnight) and placed in a table called Daily in the Archive.db3 database file which is stored in the project folder. Use Offset to report results at an alternative daily time such as 8:00am or 5:00pm.

Table 2) "Monthly" - Data for the nine fields will be recorded when the month changes and placed in a csv file called Monthly.csv which is stored in the Archive subfolder in the project folder.

Table 3) "Mass Balance for Period" - Data for the nine fields will be recorded every time the flow in pipe P_001 increases by 1 tonne and placed in a csv file called Mass Balance for Period.csv which is stored in the Archive subfolder in the project folder. The two lines at the end of the table in green are comments. This table provides the data required to perform a mass balance around tank 1 for each reporting period.

Table 4) "Mass Balance from Beginning" - Data for the nine fields will be recorded every time the flow in pipe P_001 increases by 1 tonne and placed in a csv file called Mass Balance from Beginning.csv which is stored in the Archive subfolder in the project folder. The two lines at the end of the table in green are comments. This table provides the data required to perform a mass balance around tank 1 from the beginning of the simulation run.

Table 5) "Monthly Reporting" - Data for the nine fields will be recorded when the month changes and placed in a csv file called Monthly Reporting.csv which is stored in the Archive subfolder in the project folder. This table demonstrates the use of the time functions.

System Settings and Tables

Examples of system settings and tables are given in the example above. Most options can only be enabled (=1) or disabled (=0). The exception to this is the Elapsed Time (ElapsedDbl) which can be 'Off' (= ), 'Days' (=d), 'Hours' (=h), 'Minutes' (=m), or 'Seconds' (=s).

For more detail on these fields refer to System Settings.

Reporting Options

Examples of the reporting options for individual tables are given in the example above.

The first Table specified must be '[Table1]' and subsequent Tables must be '[Table2]', '[Table3]', etc. You cannot skip a value.

For more detail on these fields refer to Reporting Options.

Notes:

  • Each table can only have one format but within the same archive file, different tables can have different formats
  • The project folder can be specified in the Path as $Prj. e.g. Path = $Prj\Archive
  • The valid range for number of significant digits written to CSV & TXT files is 2-17. If the user specifies a number outside this range, SysCAD will range it back to the minimum or maximum value without changing the sac file.
  • If no triggers or period are specified then the table will not accumulate data.
  • If no Fields are entered then the table will still be created.

All table entries are optional except the Name. In the absence of any specification the following defaults are used:

Defaults
On = 1
Format = DB-MSACCESS (with Path = $Prj)
Path = $Prj\Archive (only relevant if Format has been specified as CSV or TXT)
SigDigits = 16 (only relevant if Format has been specified as CSV or TXT)
Clear = Rewind
Offset = 0:00:00

Trigger Options

Examples of triggers are given in Tables 2-5 in the example above.

There can be any number of triggers but the first trigger in a table must be 'Trigger1', followed by 'Trigger2', 'Trigger3', etc. You must not skip any values.

If the conditions of any of the triggers are met, then the fields will be reported.

The triggers are numbered and include three terms as shown below, a description, a SysCAD tag and the Trigger Test.

TriggerNN = "Description", SysCADTag, TriggerTest

For more detail on these fields refer to Trigger Options.

Note: The = Value part of the Trigger Test is optional and has a default value = 1.0 if it is not included.

Field Options

Examples of fields are given in all five of the data tables the example above.

The first field in a table must be 'Field1', followed by 'Field2', 'Field3', etc. You must not skip any values.

The general format for a field is shown below:

FieldNN = "FieldName", SysCADTag, Function, [MeasurePoint, FirstPoint]

Notes:

  • MeasurePt is optional. The default is EndPt.
  • FirstPoint is optional. The default is IgnoreFirst.

For more detail on these fields refer to Field Options.