Scripted device

本文档详细介绍了如何通过五个步骤将自定义脚本设备添加到DCSS中,包括在database.dat文件中创建条目、创建新的设备文件、定义TCL过程等,并解释了每个步骤的具体操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Adding Scripts to the Scripting Engine

1. Create an entry in the database.dat • Set the responsibleDHS to ’self’. • Set the externalName parameter to the name of your new device file without the .tcl extension.

Alternatively you can set the externalName to standardVirtualDevice. This would make the device a motor that simply holds a position. If you select the standardVirtualDevice, then this is the only step that you need to perform, and you can restart DCSS.

2. Create the new device file in the dcss devices directory: dcss/scripts/devices The file name should be the name of the new device (as listed in the database.dat file) with a .tcl extension.

3. Within the new scripted device file define 5 TCL procedures, where deviceName is replaced by the name of the new scripted device.

• proc deviceName initialize {} This procedure is executed when DCSS starts up. This procedure may be empty, or it may be used to initialize variables associated with the scripted device. This is also the correct place to call the set_children, set_siblings, and set_observers functions as discussed in Section 6.2.

• proc deviceName set { newPosition} This is the procedure that is called when a motor configuration is initiated by the set command. The value being applied to the scripted device motor is passed in the newPosition. This procedure does not necessarily have to accept the new position, but can use the value to set other motors.

• proc deviceName move {newPosition} This is the procedure that is executed when an attempt is made to move the scripted device. The script is free to do whatever it wants, including moving other motors or calling scripted operations. If the script moves other motors, it is likely that these motors should be listed as children using the set_children command. However, this is not a requirement to moving other motors.

• proc deviceName update This procedure is called whenever the scripting engine has reason to believe that the scripted device’s current position is out of date. This happens under the following conditions: – The scripting engine receives an update an a child motor of the scripted device. – The scripting engine receives an move complete on a child motor of the scripted device. – The scripting engine receives a configuration on a child motor of the scripted device.

• proc deviceName calculate {[child1 [child2 [child3]]]} This procedure is called by the scripting engine when determining if a child motor is allowed to move to a certain position without violating the parent’s software limits. The arguments of this function are listed in the order that this function listed its children in the set_children command.

This function must accept theoretical children positions and recalculate a new position. It is common for the deviceName update command to use this procedure to update its current position using current children motor positions.

4. Restart DCSS.

 

转载于:https://www.cnblogs.com/greencolor/archive/2011/12/25/2301421.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值