Script Ver1 (SC1)

<< Click to Display Table of Contents >>

Manual > Server Creation Guide > Action Edition > Action Reference >

Script Ver1 (SC1)

How to read the manual

This chapter is for reference information only.

For construction procedures, please refer to "Performing calculations between tags at regular intervals (SC1)" in the Surveillance System Construction Guide.

 

 

 

 

 

Features of this action

The Script Ver1 action can execute scripts using "SC1 syntax".

 

Script Ver1 is a simple script that performs operations between tags using operators such as + - * / < >. It is designed to be easy to use, and does not support if statements (conditional branching) or for statements (repetitive processing). If you want to perform more advanced processing, please consider using the "Script Ver2" action.

 

The following is an example of a script.

 

U01.F01.T01 = 1

U01.F01.T02 = U01.F01.T03 * (U01.F01.T04 + 1)

U01.F01.T05 = (U01.F01.T06 + U01.F01.T07 + U01.F01.T08) / 3

U01.F01.T09 = (U01.F01.T10 And U01.F01.T11) Or (U01.F01.T12 And U01.F01.T13)

 

 

hint

For information about the syntax available in Script Ver. 1, please refer to Script Ver. 1 (SC1 syntax) in the Script section.

 

hint

In Ver4, this action was simply called the "tag script" action, but in Ver5 and later, the script syntax system has been expanded and streamlined to SC1 syntax and SC2 syntax, and the name has been changed to the "Script Ver1" action.

 

 

Action Settings

The settings for this action are explained below.

 

Action specifications

Parameters

none

 

dialog

■ Script

 

Click the Select Script button (...) from the Script tab to display the script editor.

 

c_action_0351

 

 

■ Script Editor

 

Scripts are written in the script editor, which can also contain multi-line expressions.

 

c_action_0012

 

You can also edit the script in a text editor such as Notepad and then copy and paste it.

 


■ Script Editor (Advanced Settings)

 

Clicking the "Advanced Settings" button in the script editor will display a detailed settings screen for the script's operation.

 

c_action_0013

 

How to get tag values in a script

 

This is how to get the value of the tag included on the right side of the script.
 

item

Operation

Use a cached value.

The tag value is retrieved from the cache. When a cached value is used, the cached value updated by periodic communication is used for the calculation. Since a cached value is used, the calculation is performed immediately.

 

Use cached value. Read real value only the first time.

When retrieving a tag value, the latest value is read from the real value (PLC device value) only the first time it is executed, and the cached value is used from the second time onwards (default).

 

Even if periodic communication has not been performed even once immediately after going online, the real value is read the first time, so it is not possible for the value to be unavailable. Since the cached value is used other than the first time, subsequent calculations are performed immediately.

 

Get the real value for each expression.

This option obtains real values (PLC device values) for each formula. Therefore, the processing speed is the slowest, but since values are obtained from the PLC for each formula and the calculation results are written to the PLC, synchronization with the PLC values can be reliably maintained. Specify this option only if, for some reason, it is necessary to perform calculations based on the latest values each time a calculation is performed.

 

Get all the real values required for the entire formula together.

The values of all tags written in the script are retrieved from the real values (PLC device values) at once and used as the initial values for the calculation.

 

 

When communication fails in a script, retry X times
 
Specifies the number of retries when communication fails.

 

Calculate by treating the indefinite value as 0
 
Uncheck this to make the script fail if the tag quality is indeterminate (UNCERTAIN).

 

 

 

hint

In the "Advanced Settings" tab, you can specify the timing for executing a script (SC1) before an action is executed, or the timing for adjusting the execution of the action (setting the execution wait time). For details on the advanced settings of each action, see "Settings on the Advanced Settings tab of an action".