pdf_report, cyflex_reporting
Background
At times there may be a need to generate a report of information from a
set of CyFlex variables on a running CyFlex system.
Two programs are available to assist with this, pdf_report and cyflex_reporting.
pdf_report will generate a pdf formatted file, cyflex_reporting will
generate readable files, for example plain text or HTML.
pdf_report
pdf_report has 3 required command line arguments and two optional ones.
- -xfdf XFDF_FILE - required - This is the PDF xfdf file.
Discussion of this file is beyond the scope of this writeup.
- -pdf PDF_FILE - required - This is the input template PDF
file.
- -output OUTPUT_PDF - required - This is the output PDF file.
- -object_name OBJECT_NAME - optional - The object name (see below)
which CyFlex variables and formatting will be addressed
under. This defaults to "facade". If specified this must be
a name and not contain special characters for example blanks.
- -connection CONNECTION - optional - Normally only used in
testing. This is the CyFlex system to connect to. This defaults
to "local" which is almost always what is desired.
cyflex_reporting
cyflex_reporting has 1 required command line argument and two optional
ones.
- -input TEMPLATE_FILE - required - This is the template file that
the output file is based on.
- -object_name OBJECT_NAME - optional - The object name (see below)
which CyFlex variables and formatting will be addressed
under. This defaults to "facade". If specified this must be
a name and not contain special characters.
- -connection CONNECTION - optional - Normally only used in
testing. This is the CyFlex system to connect to. This defaults
to "local" which is almost always the case.
cyflex_reporting outputs the report file to standard output.
Normally this will be redirected to a file.
CyFlex Variables
For both pdf_report and cyflex_reporting an input file needs to specify
CyFlex varibles that have values to be substituted into the report.
In both cases these are specified in the same way. The general format
is:
$OBJECT_NAME.FUNCTION(ARGUMENTS)
OBJECT_NAME is the name either specified on the command line with the
argument -object_name or by accepting the default "facade".
FUNCTION and ARGUMENTS are discussed below.
In the following the object_name used will be "facade".
- $facade.getStringVar("STRING") - Display the value of a string
variable named STRING.
- $facade.getLogiVarState("LOGICAL") - Display the value of a
logical variable named LOGICAL.
- $facade.getLogiVarState("LOGICAL", "true_value", "false_value")
- Display the value of a logical variable named LOGICAL as a
string depending on the value.
- $facade.getTimeStamp("DATE", "FORMAT") - Display a date value in
a specific format. FORMAT is based on Java's SimpleDateFormat
format class. Details will be added here if needed.
- $facade.getTimeStamp("DATE", $facade.getShort()) - Display a date
in "short" format.
- $facade.getTimeStamp("DATE", $facade.getMedium()) - Display a
date in "medium" format.
- $facade.getTimeStamp("DATE", $facade.getLong()) - Display a date
in "long" format.
- $facade.getTimeStamp("DATE", $facade.getFull()) - Display a date
in "full" format.
- $facade.getNumValUnits("PRESSURE") - Display a CyFlex Real
variable named PRESSURE in standard CyFlex value[units]
format.
- $facade.getNumValUnits("PRESSURE", "UNITS", "FORMAT") - Display
a CyFlex Real variable named PRESSURE in units of UNITS using a
format of FORMAT. FORMAT is based on Java's DecimalFormat class.
Typical formats might be, for example, "####.##" for 4 digits
before the decimal and 2 after the decimal. Both "UNITS" and
"FORMAT" may be null (with no quote marks. If UNITS is null then
no units conversion is done. If FORMAT is null then default
double value formatting will be done.
- $facade.getNow("FORMAT") - Display the current date in
a specific format. FORMAT is based on Java's SimpleDateFormat
format class. Details will be added here if needed.
- $facade.getNow($facade.getShort()) - Display the current date
in "short" format.
- $facade.getNow($facade.getMedium()) - Display the current
date in "medium" format.
- $facade.getNow($facade.getLong()) - Display the current date
in "long" format.
- $facade.getNow($facade.getFull()) - Display the current date
in "full" format.
It is possible to parameterize a report somewhat.
Both UNITS and FORMAT may be specified with values and then referenced
in the functions as illustrated below.
#set ($format = '###.###')
#set ($units = 'psi')
$facade.getNumValUnits("rpm", $units, $format)
Sample of cyflex_reporting
Below is a sample template file for cyflex_reporting which uses a
plain text format.
vf.getStringVar("string"): $facade.getStringVar("string")
vf.getNumValUnits("rpm"): $facade.getNumValUnits("rpm")
vf.getLogiVarState("logical"): $facade.getLogiVarState("logical")
vf.getLogiVarState("logical", "true_value", "false_value"): $facade.getLogiVarState("logical", "true_value", "false_value")
vf.getTimeStamp("date", "MM-dd-yyyy"): $facade.getTimeStamp("date", "MM-dd-yyyy")
vf.getTimeStamp("date", DateFormat.SHORT): $facade.getTimeStamp("date", $facade.getShort())
vf.getTimeStamp("date", DateFormat.MEDIUM): $facade.getTimeStamp("date", $facade.getMedium())
vf.getTimeStamp("date", DateFormat.LONG): $facade.getTimeStamp("date", $facade.getLong())
vf.getTimeStamp("date", DateFormat.FULL): $facade.getTimeStamp("date", $facade.getFull())
#set ($format = '###.###')
vf.getNumValUnits(conversion): $facade.getNumValUnits("pressure", "psi", $format)
vf.getNumValUnits(conversion): $facade.getNumVal("pressure", "psi", $format)
vf.getNumValUnits(conversion):
$facade.getNumLabelValUnits("pressure", "psi", "###.###")
This file could be processed with the command:
cyflex_reporting -input template.vm > template.out
This uses the default object_name setting of "facade".
Running the above command produced the following output.
vf.getStringVar("string"): This is a very long string value: 0
vf.getNumValUnits("rpm"): 1[IN_HG]
vf.getLogiVarState("logical"): 2
vf.getLogiVarState("logical", "true_value", "false_value"): true_value
vf.getTimeStamp("date", "MM-dd-yyyy"): 12-31-1969
vf.getTimeStamp("date", DateFormat.SHORT): 12/31/69
vf.getTimeStamp("date", DateFormat.MEDIUM): Dec 31, 1969
vf.getTimeStamp("date", DateFormat.LONG): December 31, 1969
vf.getTimeStamp("date", DateFormat.FULL): Wednesday, December 31, 1969
vf.getNumValUnits(conversion): 1.959[psi]
vf.getNumValUnits(conversion): 1.959
vf.getNumValUnits(conversion):
pressure: 1.959[psi]