背景:
在前陣子做基于ifix生成電力監控平台時,遇到業主提出的一個需求。關于如何在控制彈窗中,點選相應的合分閘按鈕時,優先彈出登入界面,當輸入相應的有權限使用者名和密碼後,才能操作這一要求。後實作如下:
1.在按鈕上編輯腳本:
Dim userId as string
Dim username as string
Dim groupname as string
if(system.Loginuseraname="user") then
system.Fixlogout
login
endif
system.FixGetuserInfo userid,username,groupname
if(groupname="supervisors")then
dim a as integer
a=msgbox("确認合閘?",VbOkCancel,"确認")
if a=VbOk then
writevalue "1",“[email protected]@.F_CV"
endif
endif
2.在SCU中,關于使用者管理,添加user使用者(屬于user組),添加管理者使用者admin,逾時退出時間為5分鐘(屬于supervisor組)。
3.設定時間排程。實作當監測目前無使用者登入時,預設登入user使用者,確定ifix一直有權限可以打開。
if(system.LoginUsername="") then
system.FixLogin "user","user”
endif
4.将合分閘事件以及操作人寫入報表
思路:基于事件觸發排程,當監測當相應的控制點變化時,将時間,事件名,操作人寫入資料庫即可。
總結:
基于ifix實作的這一小功能,貫穿了ifix的所有基本操作。從SCU使用者控制,到vba腳本編寫,以及排程,資料庫的相關知識。