iFIX常见问题.docx
《iFIX常见问题.docx》由会员分享,可在线阅读,更多相关《iFIX常见问题.docx(16页珍藏版)》请在冰豆网上搜索。
iFIX常见问题
iFIX常见问题集iFIX常见问题集合
1:
iFIX中如何使用vba开启和停止wsqlodc和alarmsODBC?
Description
TheabilitytostoporstarttheSQLtask,wsqlodc,andtopauseorcontinuethealarmsto
ODBCtaskusedtoonlybeavailablebylaunchingMissionControlandmanuallycontrollingthem.
TheabilitytoperformthiscontrolprogrammaticallyusingVBAwasaddedaspartofaSIMfor
iFix2.5.Thefunctioncallstoallowthisarenotwidelydocumentedandareshownbelow:
-
Resolution
DeclareFunctionTurnOnSqlTaskLib"missionvba"(ByValcmd$)AsLong
'TurnsonaSQLtask. Thecmd$parameteristhecommandlinepassedtotheSQLtask
'Returnof0isasuccess. Currentloggedinusermusthavesecurityrightstoturn
'on/offSAC. Ifanon-zeroerrorcodeisreturned,youcanusetheerr2str
'utilityinthefixbasedirectorytotranslatetheerrortoastring
DeclareFunctionTurnOffSqlTaskLib"missionvba"()AsLong
'TurnsoffaSQLtask. Returnof0isasuccess. Currentloggedinusermust
'havesecurityrightstoturnon/offSAC. Ifanon-zeroerrorcodeisreturned,
'youcanusetheerr2strutilityinthefixbasedirectorytotranslatetheerrortoastring
DeclareFunctionPauseAlarmODBCLib"missionvba"()AsLong
'PausestheAlarmODBCtask. Returnof0isasuccess. CurrentloggedinuserdoesNOT
'havetohavesecurityrights.
'Thisfunctionwillexecuteregardlessofthe"AllowOperatortoPauseAlarmLogging"
'SettingfoundintheiFIXODBCAlarmServiceConfiguratoroftheSystemConfiguration
'Utility.
PrivateDeclareFunctionContinueAlarmODBCLib"missionvba"()AsLong
'ResumestheAlarmODBCtask. Returnof0isasuccess. CurrentloggedinuserdoesNOT
'havetohavesecurityrights.
'Thisfunctionwillexecuteregardlessofthe"AllowOperatortoPauseAlarmLogging"
'SettingfoundintheiFIXODBCAlarmServiceConfiguratoroftheSystemConfiguration
'Utility.
'Allofthesefunctionswillblockuntiltherequestiscompleted.
2:
iFIX如何使用vba开启和停止基于时间和事件的调度?
Description:
Thissolutionshowshowtostartandstopatime-basedorevent-basedschedule
runninginthebackground.
Resolution:
STOP/STARTaEVENTBASEDSCHEDULE
ToStart:
PrivateSubCommandButton1_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,"FixBackGroundServer.Application")
SetVar2=Var1.System.FindObject("SchedTest1.FIXEvent1")
Var2.StartEvent
EndSub
ToStop:
PrivateSubCommandButton1_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,"FixBackGroundServer.Application")
SetVar2=Var1.System.FindObject("SchedTest1.FIXEvent1")
Var2.StopEvent
EndSub
STOP/STARTaTIMEBASEDSCHEDULE
ToStoptheTimerObject:
PrivateSubCommandButton1_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,"FixBackGroundServer.Application")
SetVar2=Var1.System.FindObject("Sched1.Timer1")
Var2.TimerEnabled=False
EndSub
ToStarttheTimerObject:
PrivateSubCommandButton2_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,"FixBackGroundServer.Application")
SetVar2=Var1.System.FindObject("sched.Timer1")
Var2.TimerEnabled=True
Var2.StartTimer
EndSub
3:
iFIX如何使用vba进行网络打印机打印?
Description:
ThefollowingisanexampleofprintinganExcelDocumenttoaNetworkPrinteroraprinterotherthanthe
defaultprinteronthemachine.
DimobjXLAsObject
DimmyDocAsObject
SetobjXL=CreateObject("Excel.Application")
SetmyDoc=objXL.Workbooks.Open("C:
\testfile.xls",,True)
myDoc.Printoutcopies:
=1,preview:
=False,ActivePrinter:
="'\\SERVER\PRINTER",printtofile:
=False,collate:
=True
myDoc.Close
SetobjXL=Nothing
SetmyDoc=Nothing
References
IfthisscriptisusedinabackgroundschedulewithFixBackgroundServerconfiguredtorunasaService,theFix
servicemustrununderauseraccountthathasprintersdefined.SeeKnowledgeBaseArticlei013417formore
informationonthisconfiguration.
ThePrintoutcommandcanbeusedforotherdocumenttypes(Word,PowerPoint,etc),howeverdifferentsyntax
isrequired,refertoforotherexamples.
4:
iFIX报警状态代码以及意义?
Description:
FIXdisplaysalarmstatuscodesforeachalarmintheAlarmSummaryLink.Whatisthemeaningofeachofthesecodes?
Resolution
Priority-->AlarmType-->Description
1-->COMM-->CommunicationError("BAD"value)
1-->OCD-->Opencircuitdetected
1-->OVER-->OverRange
1-->UNDER-->UnderRange
1-->ERROR-->AnyStatisticalDatablockalarm
2-->CFN-->Changefromnormalalarm(digitalblocksonly)
2-->COS-->ChangeofStatealarm(digitalblocksonly)
2-->HIHI-->BlockinHIHIalarmstate
2-->LOLO-->BlockinLOLOalarmstate
3-->RATE-->Valueexceedsrate-of-changesetting
3-->HI-->BlockinHIalarmstate
3-->LO-->BlockinLOalarmstate
4-->DEV-->DeviationAlarm
5-->OK-->Blockinnormalstate
5:
如何禁止和使能7X驱动标签点(对驱动自动禁止特别有用)?
DimopcDriverAsNewOPCDrv.OPCServer
DimobjDriverAsObject
DimstrDRVAcronymAsString
DimstrProgIdAsString
''VariablesforGetChannel
DimlngNumChannelsAsLong
DimlngChanHandles
DimstrChanNames
''VariablesforGetDevices
DimlngNumDevicesAsLong
DimlngDeviceHandles
DimstrDeviceNames
''VariablesforGetDataBlocks
DimlngNumDataBlocksAsLong
DimlngDataBlockHandles
DimstrDataBlockNames
DimiAsInteger
DimjAsInteger
DimlngErrors
DimmyvarAsLong
DimreadEnable
'strDRVAcronym=InputBox("Pleaseenterthedriver''sthreeletteracronym?
"&vbCrLf&"(ForExample:
EnterABRfortheABRDriver)","WhatDriverareyouusing?
")
'strProgId="Intellution."&strDRVAcronym&"drv"
'strProgId="Matrikon.OPC.Simulation.1"
'SetobjDriver=CreateObject(strProgId)
lngNumChannels=opcDriver.GetChannels(lngChanHandles,strChanNames)
''BuildVariablesforSetPropertyDatafunction.
lngHandle=lngDataBlockHandles(0)
varProperties="Enabled"
varProperyData="1"
opcDriver.GetPropertyDatalngChanHandles
(1),varProperties,readEnable
'对服器1置真
IfreadEnable="0"Then
lngErrors=opcDriver.SetPropertyData(lngChanHandles
(1),varProperties,varProperyData)
EndIf
lngNumDevices=opcDriver.GetDevices(lngChanHandles
(1),lngDeviceHandles,strDeviceNames)
lngNumDataBlocks=opcDriver.GetDataBlocks(lngDeviceHandles(0),lngDataBlockHandles,strDataBlockNames)
lngHandle=lngDataBlockHandles(0)
'读工作组
opcDriver.GetPropertyDatalngDeviceHandles(0),varProperties,readEnable
IfreadEnable="0"Then
lngErrors=opcDriver.SetPropertyData(lngDeviceHandles(0),varProperties,varProperyData)
EndIf
'处理工作块
opcDriver.GetPropertyDatalngDataBlockHandles(0),varProperties,readEnable
IfreadEnable="0"Then
Fori=0To1
lngErrors=opcDriver.SetPropertyData(lngDataBlockHandles(i),varProperties,varProperyData)
Nexti
EndIf
SetopcDriver=Nothing
6:
iFIX_如何使用脚本实现驱动(7x)的启动和停止?
Description
ThefollowingsolutionexplainshowtoStartandStopa7.xdriverthroughVBAcode.Thisexampleuses
theABRdriver.Toimplementthiswithanother7.xdriver,changetheABRtothethreeletteracronymof
theotherdriverandswitchthereferencetothatdriver.
Resolution
Thiscodewillonlyworkwith7.xdrivers.Ifyouwanttoimplementthisiscodeinanewpictureyou
needtosetareferencetoIntellutionABRDrvOPCServer7.20Library.Tosetareference,usethefollowingsteps:
1)OntheToolsmenuintheVBEditorchooseReferences.
2)SelecttheIntellutionABRDrvOPCServer7.20Libraryfromthelist.
AddtwocommandbuttonstoyourpictureandnamethemcmdStart_ClickandcmdStop_Click.
Thenpastethefollowingcodeintothepicture:
PrivateSubcmdStart_Click()
DimABRDriverAsNewABRDrv.ABRServer
ABRDriver.Stop
SetABRDriver=Nothing
EndSub
PrivateSubcmdStop_Click()
DimABRDriverAsNewABRDrv.ABRServer
ABRDriver.Start
SetABRDriver=Nothing
EndSub
7:
iFIX_如何使用脚本实现驱动(6x)的启动和停止?
Description
Thisarticlesdescribeshowtocontrol(startorstop)the6.xdriversthroughVBA,CommandScript,
orDOSratherthaninMissionControl.
Resolution
TheattachedapplicationDCTRL61.EXEenablesyoutodothis.Belowaretheusageinstructions.
Usage:
DCTRLcommanddriveracronymdelay[sleep]
wherecommandis:
START-startthedriver
STOP-stopthedriverfrompolling
STOP_EXIT-stoppollingandexit
SLEEP-setnewsleeptime(period)
STATUS-displayscurrentvalues
DELAY-WaitaNumberofmillisecondsbeforeexecutingthiscommand(1000=1second).
Thethedctrl61.exemustbelocatedintheFIX32orDynamicsdirectory.Thecommandanddriver
acronymmustbeinALLCAPS.
ExamplefromtheDOSprompt:
dctrl60STARTMBR
ExamplefromaiFIXVBA:
Shellc:
\fix32\dctrl60"STARTMBR"
ExamplefromaFIX32script:
Runtaskc:
\fix32\dctrl60"STARTMBR"
8:
iFIX_脚本进行调度的启动和关闭方法?
Description
Thissolutionshowshowtostartandstopatime-basedorevent-basedschedulerunninginthebackground.
Resolution
STOP/STARTaEVENTBASEDSCHEDULE
ToStart:
PrivateSubCommandButton1_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,"FixBackGroundServer.Application")
SetVar2=Var1.System.FindObject("SchedTest1.FIXEvent1")
Var2.StartEvent
EndSub
ToStop:
PrivateSubCommandButton1_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,"FixBackGroundServer.Application")
SetVar2=Var1.System.FindObject("SchedTest1.FIXEvent1")
Var2.StopEvent
EndSub
STOP/STARTaTIMEBASEDSCHEDULE
ToStoptheTimerObject:
PrivateSubCommandButton1_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,"FixBackGroundServer.Application")
SetVar2=Var1.System.FindObject("Sched1.Timer1")
Var2.TimerEnabled=False
EndSub
ToStarttheTimerObject:
PrivateSubCommandButton2_Click()
DimVar1AsObject
DimVar2AsObject
SetVar1=GetObject(,