在数据手册中,SNVT_switch的解释是这样的:
A structure reporting a percentage level or load value and a discrete on/off state. Separate fields report the percentage value and state. This type should be used
for both discrete (on/off) and analog control.
The value field is used to control the load's value, i.e. position, speed, or intensity, the state field being used to control whether the load is on or off(enabled or disabled).
When used as the output of a discrete sensor device, the OFF state is represented by a SNVT_switch network variable with state = FALSE and value = 0. The other discrete states are represented by state = TRUE and value > 0. When used as the output of a two-state sensor device, the ON state is represented by state =TRUE and value = 200 (meaning 100%).
When used as the input of a two-state discrete actuator, a SNVT_switch network variable with state = TRUE will be interpreted as the ON state if value > 0, and as the OFF state if value = 0. Additionally, a SNVT_switch input network variable with state = FALSE should be interpreted as the OFF state, whether ornot value = 0. A state value of 0xFF indicates the switch value is undefined.
根据英文中的介绍,这个开关量可以表示百分比电平,负载变量和离散开关状态。在snvt的定义中,这是一个结构体类型。里面定义了value和state两个成员变量。
state的值使用true和false表示的,value的值可以是连续的或者不连续的。
猜想:用于控制信号的时候,应该使用input模式
疑问:在smartserver所涉及的页面中,是否可以用鼠标控制state和value呢?
在我做的项目中,用的都是离散开关状态。但是需要用到三个控制信号,ON OFF STANDBY,如果snvt_lev_disc真的过时了的话,必须使用snvt_switch来代替,这是一个不大不小的麻烦啊。