




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、iFix 的n1:iFIX中如何使用vbawsqlodc 和TheabilitytostoporstarttheSQLtask,wsqlodc,and topauseorcontinuethealarmskusedtoonly beylaunchingiFix 的n1:iFIX中如何使用vbawsqlodc 和TheabilitytostoporstarttheSQLtask,wsqlodc,and topauseorcontinuethealarmskusedtoonly beylaunchingControlandmanuallycontrollingTheabilitytoperform
2、 thiscontrolprogrammaticallyusingVBAwasaddedaspartofa SIMiFix2.5.The functioncallstoallowthisare notedandareshownbelow:DeclareFunctionTurnOnSqlTaskLibvba(ByValcmd$)AsTurnsona SQLtask. Thecmd$parameterisReturn of0is as. Currentloggedin userdlinepassedtotheSQLvesecurityrightstoon/offSAC. Ifanon-zeroer
3、rorcode isreturned,youcanusethehefixbase directorytotranslatetheerrortoa DeclareFunctionTurnOffSqlTaskLibvba()AsTurnsSQLtask. Return of0isas. Currentloggedinuser havesecurity rightstoturnon/offSAC. Ifanon-zeroerrorcodeisyou canusetheerr2str he fixbase directorytotranslate the error toaDeclareFunctio
4、nPauseAlarmODBCLibvba()As Pausesthek. Return of0is as. Currentloggedinuserdoes havetohavesecurity ThisfunctionwillexecuteregardlessoftheAllowOperatortoPauseAlarmSettingheiFIXODBCAlarm ServiceConfiguratoroftheSystemPrivateDeclareFunctionContinueAlarmODBCLibvba()As Resumesthek. Return of0is as. Curren
5、tloggedinuserdoes havetohavesecurity ThisfunctionwillexecuteregardlessoftheAllowOperatortoPauseAlarmSettingheiFIXODBCAlarm ServiceConfiguratoroftheSystemAllofthesefunctionswillblockuntiltherequestis2:iFIX如何使用vba Allofthesefunctionswillblockuntiltherequestis2:iFIX如何使用vba Description:Thissolutionshows
6、howtostartandstopatime-basedorevent-basedhe Resolution:STOP/STARTaEVENTBASEDPrivateSetVar1=GetObject(,SetVar2=End PrivateSetVar1=GetObject(,SetVar2=End STOP/IMEBASED ToStopthePrivateSetVar1=GetObjectSetVar2= End ToStartthePrivateSetVar1=GetObjectSetVar2= End 3:iFIX如何使用vba The followingEnd ToStartthe
7、PrivateSetVar1=GetObjectSetVar2= End 3:iFIX如何使用vba The followingisanleof pr ing antoaNetworkeror a pr er ndefaultpr er on the DimobjXLAsDimmyDocAsSet objXL= SetmyDoc=objXL.Workbooks.Open(C:testfilexls,myDoc.Pr opies:=1,preview:=False,ActivePr RER, pr tofile:=False, Set objXL = Nothing SetmyDoc=Nothi
8、ngIfthisscriptisusedinabackgroundschedulewithFixBackgroundServerconfiguredtorunasaService,the servicemustrununderauserinformationonthis spr ersdefined.SeeKnowledgeBaseArticlei013417forThe Pr ommandcanbeusedfortypes,etc),howeverdifferentisrequired,referforotherFIXdisplaysalarms uscodesforeachalarm he
9、AlarmSummaryLink.WhatisthemeaningofeachofPriorityFIXdisplaysalarms uscodesforeachalarm heAlarmSummaryLink.WhatisthemeaningofeachofPriority-AlarmType-1-COMM-CommunicationError(BADvalue) 1 - OCD - Open circuit detected1-OVER-Over1-UNDER-Under-ERROR-AnyS isticalDatablock -CFN-Changefromnormalalarm(digi
10、talblocksonly) 2 - COS - Change of S e alarm (digital blocks only)2-HIHI- BlockinHIHIalarm s -LOLO -Blockin LOLOalarm s -RATE-Valueexceedsrate-of-changesetting 3 - HI - Block in HI alarm s e3-LO-BlockinLOalarms e 4 - DEV - Deviation Alarm5-OK- Block innormal s 57X點(diǎn)(特別有用DimopcDriverAsNewOPCDrv.OPCSer
11、ver Dim objDriver As ObjectDimstrProgIdAsDimlngNumChannelsAsLong Dim lngChanHandlesDimDimAsDimDimDimlngNumDataBlocksAsLong Dim lngDataBlockHandlesDimDimiDimjDimDimmyvarAsLong Dim readEnablestrDRVAcronym=InputBox(Pleaseenterthedriversthreeletteracronym?&vbCrLf&strDRVAcronym=InputBox(Pleaseenterthedri
12、versthreeletteracronym?&vbCrLf&(ForEx Enter ABR for the ABR Driver), What Driver are you using?)strProgId= ellution.&strDRVAcronym&drv strProgId = Matrikon.OPC.Simulation.1SetobjDriver=lngNumChannels=opcDriver.GetChannels(lngChanHandles,strChanNames) Build Variables for SetPropertyData function.lngH
13、andle=lngDataBlockHandles(0) varProperties = Enabled varProperyData = 1opcDriver.GetPropertyDatalngChanHandles(1),varProperties,1IfreadEnable=0lngErrors=opcDriver.SetPropertyData(lngChanHandles(1),varProperties,varProperyData) End If= (lngChanHandles(1),lngDeviceHandles,lngNumDataBlocks=opcDriver.Ge
14、tDataBlocks(lngDeviceHandles(0),lngDataBlockHandles,strDataBlockNames) lngHandle = lngDataBlockHandles(0)opcDriver.GetPropertyDatalngDeviceHandles(0),varProperties,readEnable If readEnable = 0 ThenlngErrors=opcDriver.SetPropertyData(lngDeviceHandles(0),varProperties,End opcDriver.GetPropertyDatalngD
15、ataBlockHandles(0),varProperties,readEnable If readEnable = 0 ThenFori=0TolngErrors=opcDriver.SetPropertyData(lngDataBlockHandles(i),varProperties,varProperyData) Next iEnd SetopcDriver=ThefollowingsolutionexplainshowtoStartandStopa7xdriverthroughVBAcode.Thisle theABRdriver.Toimplementthisnother7.xd
16、river,changetheABRtothethreeletteracronym theotherdriverand switchthe referencet Thiscode will only workwith7xdrivers.Ifyouwant toimplement thisiscodeina newpicture needtosetareferenceellutionABRDrvOPCThiscode will only workwith7xdrivers.Ifyouwant toimplement thisiscodeina newpicture needtosetarefer
17、enceellutionABRDrvOPCServer7.20Library.Tosetareference,usethefollowingOntheSelectheVBEditorchoose ellutionABRDrvOPCServer7.20LibraryfromtheAdddbuttonstoyour pictureandname themcmdStart_ClickandThenpastethefollowingoPrivateSubSetABRDriver=End PrivateSubSetABRDriver=End Thisarticlesdescribeshowtocontr
18、ol (startorstop)the6xdriversthroughd orDOSnTheattachedapplicationDCTRL61.EXEenablesyoutodothis.BelowaretheusageUsage:ddriveracronym delayd START-starttheSTOP-stopthedriverfrompolling STOP_EXIT-stoppollingandSLEEP-setnewsleeptimeSUS- displayscurrent DELAY-WaitaNumberofmillisecondsbeforeexecutingd ( 1
19、000=SLEEP-setnewsleeptimeSUS- displayscurrent DELAY-WaitaNumberofmillisecondsbeforeexecutingd ( 1000=1 Thethedctrl61.exe mustbeacronymmustbe inALLheFIX32orDynamicsdirectory.dand lefromtheDOSprompt:dctrl60STARTlefromaiFIXVBA: lefromaFIX32script:Runtaskc:fix32dctrl60STARTThissolutionshowshowtostartand
20、stopatime-basedorevent-basedschedulehe STOP/STARTaEVENTBASEDPrivateSetVar1=GetObject(,SetVar2=End PrivateSetVar1=GetObject(,SetVar2=End STOP/IMEBASED ToStopthePrivateSetVar1=GetObjectSetVar2=STOP/IMEBASED ToStopthePrivateSetVar1=GetObjectSetVar2= End ToStartthePrivateSetVar1=GetObjectSetVar2= End 9:
21、iFIX_excelPrivate注釋: 1ADO2.023ActiveXDataObjects2.1Library(OfficeExcel9.0objectlibraries(Office4。劃= DimcDimryexcelAsDimMyDate,MyMonth,MyDay,MyHour,MyMinute,DimStartTime,EndTime,Duration,DisplayDay,s DimStartTime,EndTime,Duration,DisplayDay,s Dim Items AsTag1 = TEST Tag2=TEST1 Tag3 = Tag4= Tag5= Tag6
22、= Tag7=Tag8=2Items= MyDate=MyMonth = Month(MyDate) MyDay = Day(MyDate) MyHour = Hour(MyDate) MyMinute=MySecond=StartTime=2000& -&MyMonth & -& MyDay -1& EndTime=2000& -&MyMonth& -&MyDay -1& strQueryAvg=SelectDATETIME,VALUE,TAGFROMFIX&WHEREMODE=AVERAGEand(TAG=&Tag1&orTAG=&Tag2&orTAG=&Tag3&orTAG=&Tag4&
23、orTAG=&Tag5&_ orTAG=&Tag6&orTAG=&Tag7&orTAG=&Tag8&)&_ERVAL=01:00:00and&(DATETIME=ts&StartTime&and&_ DATETIME = ts & EndTime & )DimcnADOAsNewDimrsADOAsSetcnADO=NewcnADO.ConnectionString=DSN=FIXDynamicsHistoricalData;UID=sa;PWD=; cnADO.Open FIX Dynamics Historical Data, sa, SetrsADOSetcnADO=NewcnADO.C
24、onnectionString=DSN=FIXDynamicsHistoricalData;UID=sa;PWD=; cnADO.Open FIX Dynamics Historical Data, sa, SetrsADO=New SQLr= yexcel= Newyexcel.Visible=DimOutReportFileAsString Dim InReportFile As StringInReportFile= yexcel.Workbooks.OpenInReportFile&WhilersADO.EOFForc=0ToIfrsADO(c)Then.Cells(r,c+1).Va
25、lue=Nextr = r + 1 Endyexcel.ActiveSheet.PageSetup.Orien ion=yexcel.ActiveSheet.Pr rSize = yexcel.DisplayAlerts = False OutReportFile=InReportFile&_00&MyMonth& yexcel.DisplayAlertsyexcel.DisplayAlerts = False OutReportFile=InReportFile&_00&MyMonth& yexcel.DisplayAlerts=yexcel= SetcnADO=End 10:IFIX500
26、11:IFIXDimstrvalue7AsDimstrvaluepAs strvalue7strvalue6 strvalue6strvalue5 strvalue5strvalue4 strvalue4strvalue3 strvalue3strvalue2 strvalue2strvalue1=strvaluep=(Val(strvalue1)+Val(strvalue2)+Val(strvalue3)+Val(strvalue4)+ Val(strvalue5) + Val(strvalue6) +Val(strvalue7) / 7) END 12IFIX FIX32產(chǎn)品中,F(xiàn)IX如#
27、GS_LOGIN.NAMEIFIXVBAPrivateSubDimsUserIDAsDimsUserNameAsDimsGroupNameAsSystem.FixGetUserInfosUserID,sUserName,Text1.Caption=13:iFixPLUS版本與NTPLUS版本支持SCADA如#GS_LOGIN.NAMEIFIXVBAPrivateSubDimsUserIDAsDimsUserNameAsDimsGroupNameAsSystem.FixGetUserInfosUserID,sUserName,Text1.Caption=13:iFixPLUS版本與NTPLUS版
28、本支持SCADA。NT版本不支持SCADA。這是二者最大的區(qū)別PLUS版本的節(jié)點(diǎn)可以作為NT節(jié)點(diǎn),供NT如果NTPLUSPLUSNT兩種版本的報(bào)價(jià)都與點(diǎn)數(shù)有關(guān),不同點(diǎn)數(shù)的版本價(jià)格不同,價(jià)格隨點(diǎn)數(shù)的增加而增加,PLUS比NT14VBA窗體中實(shí)現(xiàn)定時(shí)器的功能呢?使用user32 中的timer 函數(shù):PublicDeclareFunctionSetTimerLibuser32(ByValhwndAsLong,ByValnIDEventAsLong,ByVal uElapse As Long, ByVal lpTimerFunc As Long) As LongPublicDeclareFuncti
29、onKillTimerLibuser32(ByValhwndAsLong,ByValnIDEventAsLong)As這兩個(gè)是對(duì)APISetTimerKillTimer。SetTimer(00150,AddressOfTimer_eg) KillTimer(0timerset) :DeclareFunctionmciSendStringLibm.dllAliasmciSendStringAmandAsString,ByVallpstrReturnStringAsString,ByValhwndCallbackAsLong)AssLong, DimfilenameasString Dim cmd
30、 As String filename = test.wavcmd=open&filename&typeWAVEAudioaliasMyWav Call mciSendString(cmd, 0, 0, 0)CallmciSendString(playMyWav,0,0,:DeclareFunctionsndPlaySoundLibDimfilenameasString Dim cmd As String filename = test.wavcmd=open&filename&typeWAVEAudioaliasMyWav Call mciSendString(cmd, 0, 0, 0)Ca
31、llmciSendString(playMyWav,0,0,:DeclareFunctionsndPlaySoundLibAliassndPlaySoundA(ByVallpszSoundNameAsString,ByValuFlagsAsLong)AsDimfilenameasString filename = test.wavCallsndPlaySound(filename,可以連續(xù)調(diào)用sndPlaySound 。16存歷史庫呢?本例以S 17:iFIX FIXPLC級(jí)、工業(yè)網(wǎng)級(jí)、SCADA級(jí)、LANVIEWPLC級(jí)冗余支持指對(duì)雙PLC的支持,此項(xiàng)支持ellution驅(qū)動(dòng)程序中配置,即可以將下面冗余 說的雙通道,LAN iFIX NetBIOS AutoFailOverRedundancySCADA。18:iFIX SCADA_ASCADA_B1.iFIXHMI:2iFIXRedundancy選項(xiàng)(iFIX安裝時(shí)已安裝:iFIX C 硬件連接:所有計(jì)算機(jī)通過以太網(wǎng)連接。SCADA:SCADA_ASCADA_B上的過程
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 客服話務(wù)知識(shí)培訓(xùn)課件
- 供貨合同補(bǔ)充協(xié)議
- 交通運(yùn)輸行業(yè)智能化交通規(guī)劃與建設(shè)方案
- 湖北省武漢市2024-2025學(xué)年高一上學(xué)期1月期末地理試題 含解析
- 云南省昭通市昭通一中教研聯(lián)盟2024-2025學(xué)年高一上學(xué)期期中質(zhì)量檢測生物學(xué)B試題(含答案)
- 吉林省長春市榆樹市2024-2025學(xué)年七年級(jí)上學(xué)期期末生物學(xué)試題(含答案)
- 小學(xué)低年級(jí)數(shù)學(xué)故事讀后感
- 會(huì)議記錄表格:會(huì)議記錄臺(tái)賬分類
- 季度采購管理計(jì)劃與工作推進(jìn)安排
- 辦公用品采購與供應(yīng)鏈管理協(xié)議
- 新能源概論新能源及其材料課件
- 化學(xué)化工專業(yè)英語1課件
- 裝配式建筑裝配率計(jì)算評(píng)分表
- 1.1北京市基本概況與主要文旅資源《地方導(dǎo)游基礎(chǔ)知識(shí)》(第四版)PPT
- 綜述的寫作方法與技巧課件
- 零售藥店實(shí)施GSP情況的內(nèi)審報(bào)告
- 機(jī)械設(shè)計(jì)基礎(chǔ)網(wǎng)考題庫答案 吉林大學(xué)
- 新蘇教版科學(xué)六年級(jí)下冊全冊教案(含反思)
- 觸電事故應(yīng)急處置卡
- 國際貿(mào)易運(yùn)輸方式課件
- 南陽理工學(xué)院畢業(yè)論文格式規(guī)范
評(píng)論
0/150
提交評(píng)論