1、iFIX常见问题问答iFIX常见问题问答1:iFIX中如何使用vba开启和停止wsqlodc和alarmsODBC?DescriptionThe ability to stop or start the SQL task, wsqlodc, and to pause or continue the alarms to ODBC task used to only be available by launching Mission Control and manually controlling them. The ability to perform this control programm
2、atically using VBA was added as part of a SIM for iFix 2.5. The function calls to allow this are not widely documented and are shown below: -ResolutionDeclare Function TurnOnSqlTask Lib missionvba (ByVal cmd$) As LongTurns on a SQL task.The cmd$ parameter is the command line passed to the SQL taskRe
3、turn of 0 is a success.Current logged in user must have security rights to turnon/off SAC.If a non-zero error code is returned, you can use the err2strutility in the fix base directory to translate the error to a stringDeclare Function TurnOffSqlTask Lib missionvba () As LongTurns off a SQL task.Ret
4、urn of 0 is a success.Current logged in user musthave security rights to turn on/off SAC.If a non-zero error code is returned,you can use the err2str utility in the fix base directory to translate the error to a stringDeclare Function PauseAlarmODBC Lib missionvba () As LongPauses the AlarmODBC task
5、.Return of 0 is a success.Current logged in user does NOThave to have security rights.This function will execute regardless of the Allow Operator to Pause Alarm LoggingSetting found in the iFIX ODBC Alarm Service Configurator of the System ConfigurationUtility.Private Declare Function ContinueAlarmO
6、DBC Lib missionvba () As LongResumes the AlarmODBC task.Return of 0 is a success.Current logged in user does NOThave to have security rights.This function will execute regardless of the Allow Operator to Pause Alarm LoggingSetting found in the iFIX ODBC Alarm Service Configurator of the System Confi
7、gurationUtility.All of these functions will block until the request is completed.2:iFIX如何使用vba开启和停止基于时间和事件的调度?Description:This solution shows how to start and stop a time-based or event-based schedule running in the background.Resolution:STOP / START a EVENT BASED SCHEDULETo Start:Private Sub Comman
8、dButton1_Click()Dim Var1 As ObjectDim Var2 As ObjectSet Var1 = GetObject(, FixBackGroundServer.Application)Set Var2 = Var1.System.FindObject(SchedTest1.FIXEvent1)Var2.StartEventEnd SubTo Stop:Private Sub CommandButton1_Click()Dim Var1 As ObjectDim Var2 As ObjectSet Var1 = GetObject(, FixBackGroundSe
9、rver.Application)Set Var2 = Var1.System.FindObject(SchedTest1.FIXEvent1)Var2.StopEventEnd SubSTOP / START a TIME BASED SCHEDULETo Stop the TimerObject:Private Sub CommandButton1_Click()Dim Var1 As ObjectDim Var2 As ObjectSet Var1 = GetObject (,FixBackGroundServer.Application)Set Var2 = Var1.System.F
10、indObject(Sched1.Timer1)Var2.TimerEnabled = FalseEnd SubTo Start the TimerObject:Private Sub CommandButton2_Click()Dim Var1 As ObjectDim Var2 As ObjectSet Var1 = GetObject (,FixBackGroundServer.Application)Set Var2 = Var1.System.FindObject(sched.Timer1)Var2.TimerEnabled = TrueVar2.StartTimerEnd Sub
11、3:iFIX如何使用vba进行网络打印机打印?Description:The following is an example of printing an Excel Document to a Network Printer or a printer other than the default printer on the machine.Dim objXL As ObjectDim myDoc As ObjectSet objXL = CreateObject(Excel.Application)Set myDoc = objXL.Workbooks.Open(C:testfile.xl
12、s, , True) myDoc.Printout copies:=1, preview:=False, ActivePrinter:=SERVERPRINTER, printtofile:=False, collate:=True myDoc.CloseSet objXL = NothingSet myDoc = Nothing ReferencesIf this script is used in a background schedule with FixBackgroundServer configured to run as a Service, the Fix service mu
13、st run under a user account that has printers defined. See KnowledgeBase Article i013417 for moreinformation on this configuration.The Printout command can be used for other document types (Word, PowerPoint, etc), however different syntaxis required, refer to for other examples.4:iFIX报警状态代码以及意义?Desc
14、ription:FIX displays alarm status codes for each alarm in the Alarm Summary Link. What is the meaning of each of these codes?ResolutionPriority - Alarm Type - Description1 - COMM - Communication Error (BAD value)1 - OCD - Open circuit detected1 - OVER - Over Range1 - UNDER - Under Range1 - ERROR - A
15、ny Statistical Data block alarm2 - CFN - Change from normal alarm (digital blocks only)2 - COS - Change of State alarm (digital blocks only)2 - HIHI - Block in HIHI alarm state2 - LOLO - Block in LOLO alarm state3 - RATE - Value exceeds rate-of-change setting3 - HI - Block in HI alarm state3 - LO -
16、Block in LO alarm state4 - DEV - Deviation Alarm5 - OK - Block in normal state5:如何禁止和使能7X驱动标签点(对驱动自动禁止特别有用)?Dim opcDriver As New OPCDrv.OPCServerDim objDriver As ObjectDim strDRVAcronym As StringDim strProgId As StringVariables for GetChannelDim lngNumChannels As LongDim lngChanHandlesDim strChanNam
17、esVariables for GetDevicesDim lngNumDevices As LongDim lngDeviceHandlesDim strDeviceNamesVariables for GetDataBlocksDim lngNumDataBlocks As LongDim lngDataBlockHandlesDim strDataBlockNamesDim i As IntegerDim j As IntegerDim lngErrorsDim myvar As LongDim readEnablestrDRVAcronym = InputBox(Please ente
18、r the drivers three letter acronym? & vbCrLf & (For Example: Enter ABR for the ABR Driver), What Driver are you using?)strProgId = Intellution. & strDRVAcronym & drvstrProgId = Matrikon.OPC.Simulation.1Set objDriver = CreateObject(strProgId)lngNumChannels = opcDriver.GetChannels(lngChanHandles, strC
19、hanNames)Build Variables for SetPropertyData function.lngHandle = lngDataBlockHandles(0)varProperties = EnabledvarProperyData = 1opcDriver.GetPropertyData lngChanHandles(1), varProperties, readEnable对服器1置真If readEnable = 0 ThenlngErrors = opcDriver.SetPropertyData(lngChanHandles(1), varProperties, v
20、arProperyData)End IflngNumDevices = opcDriver.GetDevices(lngChanHandles(1), lngDeviceHandles, strDeviceNames)lngNumDataBlocks = opcDriver.GetDataBlocks(lngDeviceHandles(0), lngDataBlockHandles, strDataBlockNames)lngHandle = lngDataBlockHandles(0)读工作组opcDriver.GetPropertyData lngDeviceHandles(0), var
21、Properties, readEnableIf readEnable = 0 ThenlngErrors = opcDriver.SetPropertyData(lngDeviceHandles(0), varProperties, varProperyData)End If处理工作块opcDriver.GetPropertyData lngDataBlockHandles(0), varProperties, readEnableIf readEnable = 0 ThenFor i = 0 To 1lngErrors = opcDriver.SetPropertyData(lngData
22、BlockHandles(i), varProperties, varProperyData)Next iEnd IfSet opcDriver = Nothing6:iFIX_如何使用脚本实现驱动(7x)的启动和停止?DescriptionThe following solution explains how to Start and Stop a 7.x driver through VBA code. This example uses the ABR driver. To implement this with another 7.x driver, change the ABR to
23、 the three letter acronym of the other driver and switch the reference to that driver.ResolutionThis code will only work with 7.x drivers. If you want to implement this is code in a new picture you need to set a reference to Intellution ABRDrv OPC Server 7.20 Library. To set a reference, use the fol
24、lowing steps:1) On the Tools menu in the VB Editor choose References.2) Select the Intellution ABRDrv OPC Server 7.20 Library from the list.Add two command buttons to your picture and name them cmdStart_Click and cmdStop_Click.Then paste the following code into the picture:Private Sub cmdStart_Click
25、()Dim ABRDriver As New ABRDrv.ABRServerABRDriver.StopSet ABRDriver = NothingEnd SubPrivate Sub cmdStop_Click()Dim ABRDriver As New ABRDrv.ABRServerABRDriver.StartSet ABRDriver = NothingEnd Sub 7:iFIX_如何使用脚本实现驱动(6x)的启动和停止?DescriptionThis articles describes how to control (start or stop) the 6.x drive
26、rs through VBA, Command Script, or DOS rather than in Mission Control.ResolutionThe attached application DCTRL61.EXE enables you to do this. Below are the usage instructions.Usage: DCTRL command driver acronym delay sleepwhere command is:START - start the driverSTOP - stop the driver from pollingSTO
27、P_EXIT - stop polling and exitSLEEP - set new sleep time (period)STATUS - displays current valuesDELAY - Wait a Number of milliseconds before executing this command ( 1000 = 1 second).The the dctrl61.exe must be located in the FIX32 or Dynamics directory. The command and driveracronym must be in ALL
28、 CAPS.Example from the DOS prompt: dctrl60 START MBRExample from a iFIX VBA: Shell c:fix32dctrl60 START MBRExample from a FIX32 script: Runtask c:fix32dctrl60 START MBR8:iFIX_脚本进行调度的启动和关闭方法?DescriptionThis solution shows how to start and stop a time-based or event-based schedule running in the backg
29、round.ResolutionSTOP / START a EVENT BASED SCHEDULETo Start:Private Sub CommandButton1_Click()Dim Var1 As ObjectDim Var2 As ObjectSet Var1 = GetObject(, FixBackGroundServer.Application)Set Var2 = Var1.System.FindObject(SchedTest1.FIXEvent1)Var2.StartEventEnd SubTo Stop:Private Sub CommandButton1_Cli
30、ck()Dim Var1 As ObjectDim Var2 As ObjectSet Var1 = GetObject(, FixBackGroundServer.Application)Set Var2 = Var1.System.FindObject(SchedTest1.FIXEvent1)Var2.StopEventEnd SubSTOP / START a TIME BASED SCHEDULETo Stop the TimerObject:Private Sub CommandButton1_Click()Dim Var1 As ObjectDim Var2 As ObjectS
31、et Var1 = GetObject (,FixBackGroundServer.Application)Set Var2 = Var1.System.FindObject(Sched1.Timer1)Var2.TimerEnabled = FalseEnd SubTo Start the TimerObject:Private Sub CommandButton2_Click()Dim Var1 As ObjectDim Var2 As ObjectSet Var1 = GetObject (,FixBackGroundServer.Application)Set Var2 = Var1.System.FindObject(sched.Timer1)Var2.TimerEna
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1