<< 点击显示目录 >> 主页 mappView帮助助手 > mappView入门简单Wiki > Event actions事件响应 |
触发触发器时执行操作。以下目标可用于操作。
OPC变量通常是PLC变量。在大多数情况下,这个变量来自PLC,但它也可以是一个远程OPC变量。使用::Program:Variable1作为局部变量和::AsGlobalPV:Variable1作为全局变量。
•SetValueBool
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueBool" value="true" />
</Target>
使用 false 重置变量
•ToggleValueBool
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.ToggleValueBool"/>
</Target>
•SetValueNumber
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueNumber" value="37.1" />
</Target>
•AddValue
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.AddValue" value="2" />
</Target>
•SetValueString
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueString" value="Hello World" />
</Target>
•SetValueDateAndTime
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueDateTime" value="2018-02-23T09:33:30Z" />
</Target>
•GetValue
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
•GetServerStatus
<ReadTarget xsi:type="opcUa.SystemAction.Read" serverAlias="extern" >
<Method xsi:type="opcUa.SystemAction.GetServerStatus" />
</ReadTarget>
可能的值为:
* SERVER_STATUS_CONNECTED 0 Server连接建立
* SERVER_STATUS_CONNECTION_FAILED 1 Server连接失败
* SERVER_STATUS_CONNECTION_LOST 2 Server连接意外丢失(例如网络错误)
* SERVER_STATUS_SHUTDOWN 3 连接断开,已关闭
每个客户端连接的会话变量Session都作为单独的数据集存在
•SetValueBool
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueBool" value="false" />
</Target>
使用 false 重置变量
•ToggleValueBool
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.ToggleValueBool" />
</Target>
•SetValueNumber
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueNumber" value="4.8" />
</Target>
•AddValue
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.AddValue" value="-4.8" />
</Target>
•SetValueString
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueString" value="Hello World" />
</Target>
•SetValueDateAndTime
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueDateTime" value="2018-02-23T09:33:30Z" />
</Target>
•GetValue
<ReadTarget xsi:type="session.VariableAction.Read" refId="Variable1" >
<Method xsi:type="session.VariableAction.GetValue" />
</ReadTarget>
•Start (Timer)
<Target xsi:type="session.TimerAction" refId="RepetitivTimer" >
<Method xsi:type="session.TimerAction.Start" interval="1000" />
</Target>
•Stop (Timer)
<Target xsi:type="session.TimerAction" refId="RepetitivTimer" >
<Method xsi:type="session.TimerAction.Stop" />
</Target>
•IsRunning (Timer)
<ReadTarget xsi:type="session.TimerAction.Read" refId="RepetitivTimer" >
<Method xsi:type="session.TimerAction.IsRunning" />
</ReadTarget>
客户端变量类似于会话变量。 会话变量Session代表会话的面板端,其中客户端变量代表客户端。 客户端变量可以是浏览器信息或连接客户端的 IP 地址。 在这种情况下,客户端是数据的来源。 它也可以是目标,例如显示一个对话框。
•OpenDialog
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.OpenDialog" dialogId="dialog1" horizontalPos="left" verticalPos="top" />
</Target>
•CloseDialog
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.CloseDialog" dialogId="dialog1" />
</Target>
•ShowMessageBox
MessageBoxType 定义了应该在消息框中显示哪些按钮。 可能的值:
AbortRetryIgnore 显示用于中止、重试和忽略的按钮。
OK 显示确认按钮。
OKCancel 显示确认和取消按钮。
RetryCancel 显示用于重试和取消的按钮。
YesNo 显示是和否的按钮。
YesNoCancel 显示是、否和取消按钮。\
MessageBoxIcon 定义要在消息框中显示的图标。 可能的值:
Asterisk, Error, Exclamation, Hand, Information, None, Question, Stop, Warning
Action ShowMessageBox 返回一个结果。 当用户在打开的消息框中按下按钮时返回此结果。 返回的结果是一个标识按下了哪个按钮的值。 按钮 ID 值
Yes 1
No 2
OK 4
Cancel 8 Abort 16
Retry 32
Ignore 64
<!-- Open message OK />-->
<EventBinding>
<Source xsi:type="opcUa.Event" refId="::AsGlobalPV:ArUser.VIS.ShowMessageBoxOK" event="ValueChanged" />
<!-- Read value from PLC />-->
<Operand name="MessageBoxText" datatype="ANY_STRING">
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::AsGlobalPV:ArUser.DAT.Status" >
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
</Operand>
<EventHandler condition="newValue" >
<Action>
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.ShowMessageBox" type="OK" message="=MessageBoxText" header="Information" icon="Information" />
</Target>
<Result>
<ResultHandler condition="result = 4">
<Action>
<Target xsi:type="opcUa.NodeAction" refId="::AsGlobalPV:ArUser.VIS.ShowMessageBoxOK" >
<Method xsi:type="opcUa.NodeAction.SetValueBool" value="false" />
</Target>
</Action>
</ResultHandler>
</Result>
</Action>
</EventHandler>
</EventBinding>
•Action.Navigate
<Target xsi:type="clientSystem.Action"> <Method xsi:type="clientSystem.Action.Navigate" pageId="mainpage" /> </Target>
•LoadContentInArea
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.LoadContentInArea" contentId="Content3" areaId="A1" pageId="MainPage" />
</Target>
The action returns the result for load successful
•LoadContentInDialogArea
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.LoadContentInDialogArea" contentId="Content3" areaId="A1" dialogId="Dialog1" />
</Target>
The action returns the result for load successful
•ChangeTheme
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.ChangeTheme" theme="MyNewTheme" />
</Target>
•Login
<EventBinding>
<Source xsi:type="opcUa.Event" refId="::Program:startLogin" event="ValueChanged" />
<Operand name="user" datatype="ANY_STRING">
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:user">
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
</Operand>
<Operand name="pwd" datatype="ANY_STRING">
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:pwd">
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
</Operand>
<EventHandler condition="newValue = 1">
<Action>
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.Login" userName="=user" password="=pwd" />
</Target>
</Action>
</EventHandler>
</EventBinding>
•Logout
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.Logout"/>
</Target>
•SetLanguage
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.SetLanguage" value="en" />
</Target>
•SetMeasurementSystem
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.SetMeasurementSystem" value="imperial" />
</Target>
•ScrollContent
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.ScrollContent" contentId="Content2" position="top" duration="2000" />
</Target>
The action returns the result for load successful
•OpenDialogAtTarget
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.OpenDialogAtTarget" dialogId="dialog1" horizontalPos="left" verticalPos="bottom" target="StartContent_Button1" horizontalDialogAlignment="left" verticalDialogAlignment="middle"/>
</Target>
这些是可以在小部件Widget上执行的操作。 有关每个小部件可以触发哪些事件的详细信息,请参阅 Automation Studio 帮助。
<Target xsi:type="widgets.brease.Button.Action" contentRefId="Content1" widgetRefId="Button1" >
<Method xsi:type="widgets.brease.Button.Action.SetEnable" value="true"/>
</Target>