You are here: Core Reference > Coding > Logic > Add Processed Historic Values to Ladder Diagrams

Add Processed Historic Values to Ladder Diagrams

You can add processed historic values (historic values that have been calculated using a historic algorithm) to your Ladder Diagrams. This may be useful if you need to use a daily average or some other calculated value as part of the ladder Logic.

To add a processed historic value to a Ladder Diagram:

  1. Display the Add Direct Variable window by performing one of these procedures:

    Either:

    1. In the Variables list (above the Ladder Diagram in the ladder display), select the Direct tab.
      A list of the Ladder Diagram's direct variables is shown.
    2. Right-click on the direct variable that you want to use again.
      A context sensitive menu is displayed.
    3. Select the Add option.
      The Add Direct Variable window is displayed.

    Or:

    1. In the Variables list (above the Ladder Diagram in the ladder display), select the Direct tab.
      A list of the Ladder Diagram's direct variables is shown.
    2. Right-click on the direct variable that you want to use again.
      A context sensitive menu is displayed.
    3. Select the Add option.
      The Add Direct Variable window is displayed.
    4. In the Name field, enter a suitable name for the variable.
  2. Use the Tag Type combo box to define whether the variable is Read Only, Write Only, or Read/Write.
  3. Select the browse button next to the Tag field.
    A context sensitive menu is displayed.
  4. Select the OPC Historic Tag option to display the Select Historic Tag window.

  5. Expand a Root Group folder. Each Root Group folder represents a system.
  6. Expand the group folders until you locate the item that has the required historic data.
    This is the item that has the historic data that you want to use as a value on your Ladder Diagram.

  7. Select the item. This will associate the variable tag with the historic data of the selected database item.
  8. Use the check box and combo boxes at the bottom of the Select Historic Tag window to define the time span and historic algorithm:
    • Relative—Use to determine whether a relative or absolute reference is used to reference the item's historic tag.
      • Check the check box to use a relative reference to the item's historic tag. The reference will work as long as the location of the selected database item remains the same in relation to the Ladder Diagram.
      • Clear the check box to use an absolute reference. The reference will only work when the selected database item remains in the current location.
    • Algorithm—Choose the type of historic calculation that ClearSCADA uses to process the historic data.
    • Start Date—Choose or enter the start time for the range of historic values. The Ladder Diagram can only use historic values that have been recorded after the selected date.

      You can choose from the following default options or you can enter a start time:

      • M—The time period starts at the beginning of the current minute.
      • M-1M—The time period starts at the beginning of the previous minute.
      • H—The time period starts at the beginning of the current hour.
      • H-1H—The time period starts at the beginning of the previous hour.
      • D—The time period starts at the beginning of the current day.
      • D-1D—The time period starts at the beginning of the previous day.
      • W—The time period starts at the beginning of the current week.
      • W-1W—The time period starts at the beginning of the previous week.

      To enter a start date, simply enter the time in the OPC format. For example, if you want the start date to be 3 weeks prior to the start of the current week, enter W-3W.

    • Interval—Enter or choose the duration of the time period. The Ladder Diagram will only use those historic values that were recorded after the start date and within the specified interval. For example, if the Start Date is H and the Interval is 30M, the time period is 30 minutes after the start of the current hour. Any historic values that were recorded for the item outside of this time period are disregarded.

      As with the Start Date, you can choose from the list of default intervals, or you can enter your own interval in the OPC time format. If the Interval is set to 0, the program cannot be executed.

  9. Select the OK button to confirm your selection and close the Select Historic Tag window.
  10. On the Add Direct Variable window, use the Type combo box to choose the type of value for the historic variable. The type of value that you select has to be appropriate for the type of database item. For more information, see Built-In Data Types.
  11. Leave the Retained check box clear. The Retained feature is designed to be used with internal variables. When selected, it allows the internal variable to be stored and transferred to other servers (in a multi-server setup).

    For more information on the Retain feature, see Using the RETAIN Keyword in an ST Program.

  12. Use the No Cache check box to determine whether the program uses the latest value or the initial value for a variable on each execution. If you check the No Cache check box, the program will use the latest value for the variable rather than the default value. If you clear the No Cache check box, the program will use the default value for the variable on each execution.

    The No Cache feature is especially useful with variables that are used as counts. For more information on the No Cache feature, please refer to Using VAR NOCACHE to Prevent Cached Values Being Used in an ST Program.

  13. Select the OK button to confirm your selections and close the Add Direct Variable window.
  14. Select the historic variable in the Variables list (Direct tab) and keep the left-hand mouse button pressed down.
  15. Drag the historic variable from the Variables list onto the Ladder diagram.
    A context sensitive menu is displayed.
  16. Select the option that corresponds with the type of internal variable that you are adding to the Ladder diagram (see Ladder Diagram Components).
    A new contact or coil is added to the Ladder diagram, depending on the option you selected. The contact or coil represents the internal variable.

ClearSCADA 2015 R2