對于拉力機測控系統如何取得自動(dòng)參數計算程序:
對于使用已有計算的字段請使用字段編輯中的公式,VBS的自動(dòng)計算是的底層計算,需要有BASIC編程的能力。
主應用內部集成型完成了常用的大部分參數自動(dòng)計算;擴展型為用戶(hù)可編輯的程序,采用VBScript, 擴展型的程序名為: “主應用程序名.VBS” ,如 “TL.VBS” ,后綴名為VBS采用VBScript編程。
VBScript是在Internet上廣泛使用的語(yǔ)言,介紹的資料很多,本章主要介紹試驗主程序向參數自動(dòng)計算程序暴露的對象,并通過(guò)提供的例子說(shuō)明編程過(guò)程.
對象1: testdata:
對應數據庫的 testdata 表,紀錄集為所處理的一個(gè)試樣的原始紀錄,只讀;
字段:num,force,lenth,time,position,smallLength,bigLength
如 a=testdata(“force”),讀出定位紀錄上的力值
方法:movefirst 紀錄指針移到*條紀錄
movelast 紀錄指針移到zui后一條紀錄
movenext 紀錄指針移到下一條紀錄
moveprevious 紀錄指針移到前一條紀錄
findfirst <條件> 按條件找到*條紀錄
findlast <條件> 按條件找到zui后一條紀錄
findnext <條件> 按條件找到下一條紀錄
findprevious <條件> 按條件找到前一條紀錄
如 testdata.movefirst
testdata.findlast “force>100”
對象2: report:
對應數據庫的 report 表,紀錄指針已指向所處理的試樣
字段:report表的所有字段
如 a=report(“標距”),讀出本試樣的標距
report(“zui大力”)=100 給數據庫的report表的“zui大力”賦值
對象3: Used 本試樣的,內部計算好的常用的參數
屬性: forcemax As Single 此試樣的zui大力
lengthmax As Single 此試樣的zui大變形
timemax As Single 此試樣的試驗時(shí)間
num As Integer 此試樣的試樣號
positionmax As Single 此試樣的zui大位置變化
lengthAsForcemax As Single 此試樣zui大力時(shí)的變形
forceAsLengthmax As Single 此試樣zui大變形時(shí)的力
elasModule As Single 此試樣的彈性比率
timeAsforceMax As Single 此試樣zui大力時(shí)的時(shí)間
L0 As Single 此試樣的標距
對象4: MsgWindow.caption 在主程序的顯示窗中顯示.
使用VBS沒(méi)有像VB那樣的繼承開(kāi)發(fā)環(huán)境,調試比較麻煩,主程序中有部分的錯誤指示,可指出錯誤發(fā)生在那一行,哪一列;但是有時(shí)是不準確的,比如一個(gè)循環(huán)內的錯誤可能指示錯誤發(fā)生在循環(huán)結尾。
掃一掃 微信咨詢(xún)
©2024 揚州精輝試驗機械有限公司 版權所有 備案號:蘇ICP備18016239號-3 技術(shù)支持:化工儀器網(wǎng) sitemap.xml 總訪(fǎng)問(wèn)量:313252 管理登陸
電話(huà)
微信掃一掃