Calculating tags at regular intervals (SC1)

<< Click to Display Table of Contents >>

Manual > Monitoring system construction guide > Server logic construction >

Calculating tags at regular intervals (SC1)

overview

This section explains how to perform tag calculations at regular intervals.

 

Here, we use Periodic event to perform calculations between tags in a script (SC1).

 

Action used: Script Ver1 Action

 

 

Download the sample

The creation examples shown on this page are provided with samples.

 

The sample can be downloaded from below.

 

 

Setup Procedure

Tag settings

 

1.Defines the tag to be used for the operation.
 
c_action_0092
 
As an example, we will use the tag of a virtual device.

 

Tag Name

address

the purpose

U01.F01.T01~T03

SD0005~SD0007

Tag used in the first formula

U01.F01.T04~T05

SM0006~SM0007

Tags used in the second formula

U01.F01.T06~T07

D0000 to D0001

Calculation result storage tag

 


Action Settings
 

1.Add script Ver1 action "A01".
 
c_action_0093

 
 

2.Open the properties of the A01 action and set the script from the Script tab.
 
In this example, write the following two lines of script.

 

U01.F01.T06 = U01.F01.T01 + U01.F01.T02 +U01.F01.T03

U01.F01.T07 = U01.F01.T04 And U01.F01.T05

 
The following is an example of the script editor.

 

c_action_0094

 

 


Event Settings
 

1.Create a Periodic event to execute the action. This time, the calculation will be performed every second.
 
c_action_0095

 

2.Set the execution action to "A01".
 
c_action_0350

 

 

Operation check

Please bring your application online (yellow arrow).

 

After going online, make sure that the values of U01.F01.T06 to T07 are updated.

 

 

hint

Since U01.F01.T06 to T07 are not referenced anywhere, the current values will not be displayed in the tag list of the multiview by simply switching them online.

To check the values of T06 and T07, use a view such as Tag Monitor, or right-click the tag in question and select "Tag Operations" - "Start Monitoring."