Formula Cheat Sheet

The purpose of this document is to act as a cheat sheet for the various formula short-codes.  This is not intended as an exhaustive list of everything that can be done with formulas in Plant Focus.



Short-CodeValid DatatypesDescription
#AllIf a number is a zero but the formula is followed by the # symbolt it will be replaced with a 1 instead.
aOnce A Day, RealTime, Once A Month, Once a Shift, Optimization, LABAverage of all values including zeros.
AOnce A Day, RealTime, Once A Month, Once a ShiftThe time weighted average of all datapoints for the day (including zeros)
bOnce A Day, RealTime, Once A Month, Once a Shift, Optimization, LABAverage of all values excluding zeros.
BOnce A Day, RealTime, Once A Month, Once a ShiftThe time weighted average of all datapoints for the day excluding zeros)
cOnce A Day, RealTime, Once A Month, Once a ShiftCalculated value instead of raw value (including adjustment)
dRealTimeThe difference between the 2 most recent datapoints.
eOnce A Day, RealTimeDuration of time from NOW to the end of the selected timeframe or shift.
fOnce A Day, RealTime, Once A Month, Once a ShiftPerforms the statistical function (STDEV, MIN, MAX) that appears after f and before the PLCid. Example, fSTDEV6120 is the Standard Deviation of DOR Item 6120, including zeroes.
FOnce A Day, RealTime, Once A Month, Once a ShiftPerforms the statistical function (STDEV, MIN, MAX) that appears after F and before the PLCid. Example, FSTDEV6120 is the Standard Deviation of DOR Item 6120, NOT including zeroes.
iOnce A DayMost recent inventory running total (including adjustment)
kRealTime, Once a ShiftThe very last datapoint of the previous day, based on the start date selected.
lOnce A Day, RealTime, Once a ShiftLast value present prior to end date, regardless of start date. Only raw value will be returned, or only adjustment, if present, will be returned.
LRealTime, Once a ShiftThe next to last datapoint of the timeframe specified based on the start and end dates selected.  If no data is present within these times then no data will be returned
mOnce A Day, RealTime, Once A Month, Once a Shift, Optimization, LAB, Silo InventoryMost recent value present prior to end date. Inclusive of data on the end date.  Includes adjustments.
MRealTime, Once a ShiftThe value directly before the most recent value prior to the end date (independent of start time). If used to reference a daily datapoint it will include the adjustment.
nOnce A Day, Once A Month, Once a ShiftSum of values, does not include adjustments.
oOnce A Day, Once A Month, Once a ShiftOffset or adjustment value only.
pOnce A Day, RealTime, Once A Month, Once a Shift, Optimization, LAB, Downtime, Silo InventoryCurrent day's value (including adjustment)
qOnce A Day, RealTime, Once A Month, Once a Shift, Optimization, LABPrevious day's value. (On DOR report, cannot be a manual entry)
rOnce A DayReference value only valid on DOR admin for automated data gathering, NOT reporting, will return 0 otherwise.  Valid for IP21 only.
ROnce A Day, RealTime, Once A Month, Once a Shift, RecipeComponentID of the recipe system.
sOnce A Day, RealTime, Once A Month, Once a ShiftThe sum of InputID from shift comments
SOnce A Day, RealTime, Once A Month, Once a ShiftThe average of InputID from shift comments
tOnce A Day, RealTime, Once a ShiftDuration of time from selected start date to end date.  If selected end date is now then it will be the duration of time from start to now in minutes.
TOnce A Day, RealTime, Once a ShiftDuration of time from selected start date to end date.  If selected end date is now then it will be the duration of time from start to end date.
uOnce A Day, RealTime, DowntimeDuration of time equipment was operating between start date and end date.  If the selected end date is now it will be the duration of selected start date to now.
UOnce A Day, RealTime, DowntimeDuration of time equipment was NOT operating between start and end date.  If selected end date is now it will be the duration of selected start date to now.
vRealTimeDuration of time from the very last datapoint present in that item's data to now in seconds
VRealTimeDuration of time from the very last datapoint present in that item's data to the preceding data point in seconds
zOnce A Day, RealTime, Once A MonthThe average of all datapoints for the day excluding zeros
ZOnce A Day, RealTime, Once A MonthThe time weighted average of all datapoints for the day excluding zeros.
dowDate LabelsReturns the day of the week of the end date given DOW for date returns 'Monday' or 'Tuesday'
DOWDate LabelsReturns the day of the week of the start date given dow for date returns 'Monday' or 'Tuesday'
dateDate LabelsThis will return the text representing the end date (MM/dd/yyyy)
DATEDate LabelsThis will return the text representing the start date (MM/dd/yyyy)
datetimeDate LabelsReturns the text representing the end date (MM/dd/yyyy HH:mm)
DATETIMEDate LabelsReturns the text representing the start date (MM/dd/yyyy HH:mm)
DATEFORMAT,HH:mmDate LabelsReturns the start date formatted the way you specify after the comma
dateformat,MM/dd/yyyy HH:mmDate LabelsReturns the end date formatted the way you specify after the comma
DATEFORMATM,###,mm/dd/yyyyDate LabelsReturns the most recent timestamp of data before the start date formatted like after the comma .
dateformatm,###,mm/dd/yyyyDate LabelsReturns the most recent timestamp of data before the end date formatted like after the comma .
NOWDate LabelsReturns the current date time of the site in localized time format
NOW,HH:mmDate LabelsReturns the current time of the site formatted the way you specify after the comma.


Real Time

When using 'R' it can be used to reference Text or Numbers. When referencing Text it may not be used in a 'Display Formula', IE: c417 because the calculated results of all PLCid's must be numeric
When using 'R' in a DOR report, you can specify items that represent Text. When doing so you must specify the PLCid whose raw data value is the currently selected RecipeID
IE: R5;6,1 meaning CategoryID=5, ComponentID=6, PLCid=1's value for the report end date will be the RecipeID so we have the 3 items required to lookup recipe value.
When entering a formula you can manually override what RecipeID is chosen
IE: R5;6;1 meaning CategoryID=5, ComponentID=6, RecipeID=1 (If you specify a ,1 at the end it will ignore it)

Optimization Items

Specifier: ReturnVal
Daily Avg: 1
Daily Dev: 2
7day Avg: 3
7Day Dev: 4
30Day Avg: 5
30Day Dev: 6
Min val: 7
Max val: 8
PctLow: 9
PctHigh: 10
Upper Limit: 11
Lower Limit: 12
target: 13
Examples:

After this, you can manually specify a Recipe if so desired, do this this place a comma and seperate the recipeID's with semicolons.
Examples:
OPTa5,1
Signifies this is for the Optimization system, 'a' is just like the DOR data so we're getting the DatapointWeightedAverage, its OPTid 5, and we want the data for '1' (DailyAvg)
Note no recipe specified so it will ignore recipe specific information and return avg of all values over timeframe specified
OPTb5,1,10
Signifies this is for the Optimization system, 'b' is just like the DOR data so we're getting the DatapointWeightedAverageWithoutZeros, its OPTid 5, and we want the data for '1' (DailyAvg), and data only for recipeid 10.
OPTb5,1,10;11;12
Signifies this is for the Optimization system, 'b' is just like the DOR data so we're getting the DatapointWeightedAverageWithoutZeros, its OPTid 5, and we want the data for '1' (DailyAvg), and data for recipeid's 10,11,12.

LAB Items inported within the DOR Formula


Specifier: ReturnVal
DataValue: 1
Low Low Target: 3
Low Target: 4
Target: 5
High Target: 6
High High Target: 7
Examples:

After the 3 character LAB and the function to perform, you place the LABid
this is a completed function as of now, you can continue to customize with these options
place a comma and a number to indicate what information you want to display.

After this, you can manually specify a Recipe if so desired, do this this place a comma and seperate the recipeID's with semicolons.
Examples:
LABa5,1
Signifies this is for the LAB system, 'a' is just like the DOR data so we're getting the Datapoint Weighted Average, its LABid 5, and we want the data for '1' (DataValues)
Note no recipe specified so it will ignore recipe specific information and return avg of all values over timeframe specified
LABb5,1,10
Signifies this is for the LAB system, 'b' is just like the DOR data so we're getting the DatapointWeightedAverageWithoutZeros, its LABid 5, and we want the data for '1' (DataValues), and data only for recipeid 10.
LABb5,1,10;11;12
Signifies this is for the LAB system, 'b' is just like the DOR data so we're getting the DatapointWeightedAverageWithoutZeros, its LABid 5, and we want the data for '1' (DataValues), and data for recipeid's 10,11,12."

Downtime Items imported within DOR Formula


Specifier: ReturnVal
Circumstance: c
Scheduled: s
Incident: i
Detail code to be specified next: d
Specific Cause to be specified next: C
Specific Equipment to be specified next: E
Specific detail category to be specified next: D
Count As Stop: x
Count as Stop equals False: X
Examples:

After the 3 character DWN and the function to perform, you place the Downtime Area Number
After the formula is completed, place a comma and a number to indicate what information you want to display.
If no comma is present, it will return all downtime counts/minutes for the selected area instead of limiting to the following.
After the comma, these are your options (can use multiple read below):
c =Circumstance
s =Scheduled
i =Incident
d =Detail Code specified on each downtime event
C =This Specific Cause
E =This specific Equipment
D =This specific DetailCategory (available categories are in table: tblAreaShutdown_DetailCategories, each DetailCode is a member of a DetailCategory)
x =Include when this item is an Equipment Stop event. The Count As Stop=True on the data entry page
X =Include when this item is NOT an Equipment Stop event. The Count As Stop=FALSE on the data entry page
After this you indicate the details of each if it has any seperated by semicolons
Letters d,C,E can be used with semicolons, c,s,i cannot be.
When multiple instances are specified seperated by commas it is interperated as an AND statement meaning all cases need to be true when it gets the data
Examples:
DWNp10 This will return the total number of downtime occurrences that happened within the timeframe specified for Area 10.
DWNU10 This will return the total duration of downtime that happened within the timeframe specified for Area 10.
DWNp10,c This will return total number of circumstance events that began within timeframe specified for Area 10
DWNp10,dPI;MI This will return the total number of downtime occurrences that happened for area 10 within timeframe that were detail code PI or MI only
DWNp10,C44;45;46;47 This will return the total number of downtime occurrences that happened for area 10 within timeframe that were CAUSEID: 45 or 46 or 47
DWNp10,c,dPI;MI,C44;45;46;47 This will return total number of downtime occurrences that happened for area 10 within timeframe that were circumstances with Detail Code PI or MI and that were CAUSEID: 45 or 46 or 47.

Silo based data within DOR formula

Prefix formula with SILO the next letters can be:

p = return the value prior to the end date selected that matches the criteria exactly, if there is a record present but it does not match (for instance column0=1) it will return nothing or a 0

m = return the most recent value prior to the end date selected that matches criteria, will most likely always return a value and may not be most recent value!

The next characters are the identity of the silo we are specifying, f10r00 indicates Silo 1A


The next value is a Formula Specifier:

Tonnage Val="1"
Measured Height  Val="2"
Max Height Val="3"
Max Tonnage Val="4"
Max-Measured=Filled Height Val="5"
Selected column INT Val="6"

Admin page is located at: ~/DesignerPages/area_designer_datesStandard.aspx

Examples:
SILOpf10r00,1
Signifies this is for the current value in the silo (p) for silo number 'f10r00', for the current TONNAGE (,1)

After this, you can manually specify a COLUMN and SELECTED VALUE if so desired, to do this place a comma and seperate the SELECTED VALUES with semicolons.
Silo Unique ID's are under the "Row Layout" selection and indicated by the "RowID" column.

SILOpf10r01,1,2;3;4
Silo number 2 (SILOpf10r01), Tonnage (,1) where COLUMN# 2 (,2) (column index starts at 0, this is the product MATERIAL TYPE, see image) values selected are either 3 or 4.(;3;4) (Cement T I/II or Reclaim Clinker see image 2)


Column Layout is designated from the "Column Layout" selection.
..tblArea_DatesCBOSpecial = 'Special' Column Info
..tblArea_DatesCBOWhatMill = 'Source' Column Info
..tblArea_DatesCBOType = 'Type' Column Info
..tblArea_DatesCBOReleased = 'Released' Column Info
....Within each of these options you'll see it appropriate ID for each option.

SILOpf10r02,2,0;1
Silo number 3 (SILOpf10r02), get measured height (,2), where column0 (,0) (Status or Special) = 1 (;1) (#1 Finish Mill)


SILOmf10r03,1,2;3
Silo number 4's most recent tonnage where its column 2 (Product Type) = 3 (Reclaim Clinker)
SILOpf10r09,6;0
Silo number 10's current value selected for the column 'Special'. It will return the INT of the value selected for the column following the ;