| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1439 人关注过本帖
标题:力值曲线的问题
只看楼主 加入收藏
chen3bing
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:507
专家分:104
注 册:2008-11-12
结帖率:91.22%
收藏
 问题点数:0 回复次数:2 
力值曲线的问题
图片附件: 游客没有浏览图片的权限,请 登录注册

这是我力值标定的曲线。
10吨传感器,标定6个点。标定完,得到码值,还有力值。
根据力值和码值的比例关系计算采集的力值。
代码:
Private Sub CalibrateSixDot()               '标定六个点
If (StrgenthRec < ZeroDot) Then                                             '力值
   
   
    DrawValue = 0
   
     
ElseIf (StrgenthRec < FirstDot) Then
    DrawValue = LittleCoefficient * (StrgenthRec - ZeroDot) / (FirstDot - ZeroDot)
   
   
ElseIf (StrgenthRec < SecondDot) Then
     
    DrawValue = (LargeCoefficient - LittleCoefficient) * (StrgenthRec - FirstDot) / (SecondDot - FirstDot) + LittleCoefficient
   
ElseIf (StrgenthRec < ThreeDot) Then
     
    DrawValue = (ThreeCoefficient - LargeCoefficient) * (StrgenthRec - SecondDot) / (ThreeDot - SecondDot) + LargeCoefficient
   
ElseIf (StrgenthRec < FourDot) Then
   
    DrawValue = (FourCoefficient - ThreeCoefficient) * (StrgenthRec - ThreeDot) / (FourDot - ThreeDot) + ThreeCoefficient
   
ElseIf (StrgenthRec < FiveDot) Then
   
    DrawValue = (FiveCoefficient - FourCoefficient) * (StrgenthRec - FourDot) / (FiveDot - FourDot) + FourCoefficient
   
Else
   
    DrawValue = FiveCoefficient * (StrgenthRec - ZeroDot) / (FiveDot - ZeroDot)
   
   
End If
Call KNNKggkgfFormat

End Sub
StrgenthRec是实时采集的采样值,ZeroDot是第一个点标定的码值,
FirstDot是第二个点标定的码值,SecondDot是第三个点标定的码值,
 ThreeDot是第四个点标定的码值,FourDot是第五个点标定的码值,
FiveDot是第六个点标定的码值。
LittleCoefficient代表20KN,LargeCoefficient代表40KN,
ThreeCoefficient代表60KN,FourCoefficient 代表80KN,
FiveCoefficient代表100KN.
我觉得计算公式没错呀,为什么曲线是那个鸟样呢?请大神指教,谢谢!

[此贴子已经被作者于2019-8-21 10:38编辑过]

搜索更多相关主题的帖子: 力值 曲线 Then End 代表 
2019-08-19 16:59
chen3bing
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:507
专家分:104
注 册:2008-11-12
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

画的曲线是这个样子的。
2019-08-20 15:57
cuituo
Rank: 2
等 级:论坛游民
威 望:2
帖 子:28
专家分:22
注 册:2008-6-21
收藏
得分:0 
看代码没问题,测试这段代码也没问题,应该是line语句有问题,
Private Sub Command8_Click()
   
    Dim i As Integer
   
   
    '‘     Cls
    n = 400
    For i = 0 To n
        
        ReDim Preserve X(i)
        ReDim Preserve y(i)
        
    Next i
   
   
    For i = 0 To n
        
        X(i) = i
        
        y(i) = 1 / 4 * i
        
    Next i
   
   
    'Call ZuoDian(X, y)
 
    Call ZuoDian2(X, y)
   End Sub
'画数组点

Public Sub ZuoDian2(X() As Double, y() As Double)                                         '做数据点
   
    i = n + 1
    ReDim xpos(i) As Double
    ReDim ypos(i) As Double
   
    For i = 0 To n
        
        
        xpos(i) = zuo_yuliang + (X(i) / (Qmax - Qmin)) * jianjuw * wanggeNum_w
        ypos(i) = tukuang_h - xia_yuliang - y(i) / (Hmax - Hmin) * jianjuh * wanggeNum_h
        
        
        ypos(i) = jisuany(ypos(i))
        
        
        '  If y(i) <= Ymax Then
        
        DrawWidth = 4
        Picture1.PSet (xpos(i), ypos(i)), vbRed
        
        '  Else
        '   End If
        
    Next i
   
    DrawWidth = 1
   
End Sub

Public Function jisuany(y As Double)
   
    Dim StrgenthRec, ZeroDot, FirstDot, SecondDot, ThreeDot, FourDot, FiveDot, LittleCoefficient, LargeCoefficient, ThreeCoefficient, FourCoefficient, FiveCoefficient, DrawValue
   
   
    StrgenthRec = y
   
   
    ZeroDot = 0
   
    FirstDot = 20
   
    SecondDot = 40
   
    ThreeDot = 60
   
    FourDot = 80
   
    FiveDot = 100
   
   
   
   
    LittleCoefficient = 20
   
    LargeCoefficient = 40
   
    ThreeCoefficient = 60
   
    FourCoefficient = 80
   
    FiveCoefficient = 100
   
   
   
    '这是我力值标定的曲线?
    '10  吨传感器,标定6个点。标定完,得到码值,还有力值。
    '根据力值和码值的比例关系计算采集的力值?
'代码:
    '  Private Sub CalibrateSixDot()                                                         '标定六个点
   
   
    If (StrgenthRec < ZeroDot) Then                                                       '力值  小于  ZeroDot =0
        DrawValue = 0
    ElseIf (StrgenthRec < FirstDot) Then
        
        DrawValue = LittleCoefficient * (StrgenthRec - ZeroDot) / (FirstDot - ZeroDot)
        
    ElseIf (StrgenthRec < SecondDot) Then
        
        DrawValue = (LargeCoefficient - LittleCoefficient) * (StrgenthRec - FirstDot) / (SecondDot - FirstDot) + LittleCoefficient
        
    ElseIf (StrgenthRec < ThreeDot) Then
        
        DrawValue = (ThreeCoefficient - LargeCoefficient) * (StrgenthRec - SecondDot) / (ThreeDot - SecondDot) + LargeCoefficient
        
    ElseIf (StrgenthRec < FourDot) Then
        
        DrawValue = (FourCoefficient - ThreeCoefficient) * (StrgenthRec - ThreeDot) / (FourDot - ThreeDot) + ThreeCoefficient
        
    ElseIf (StrgenthRec < FiveDot) Then
        
        DrawValue = (FiveCoefficient - FourCoefficient) * (StrgenthRec - FourDot) / (FiveDot - FourDot) + FourCoefficient
        
    Else
        
        DrawValue = FiveCoefficient * (StrgenthRec - ZeroDot) / (FiveDot - ZeroDot)
        
    End If
   
    '  Call KNNKggkgfFormat
   
    jisuany = DrawValue
   
   
    'StrgenthRec是实时采集的采样值,ZeroDot是第一个点标定的码值,
   
    'FirstDot是第二个点标定的码值,SecondDot是第三个点标定的码值,
   
    'ThreeDot是第四个点标定的码值,FourDot是第五个点标定的码值,
   
    'FiveDot是第六个点标定的码值?
   
    'LittleCoefficient代表20KN,LargeCoefficient代表40KN,
   
    'ThreeCoefficient代表60KN,FourCoefficient 代表80KN,
   
    'FiveCoefficient代表100KN.
   
End Function

 
2023-01-16 01:41
快速回复:力值曲线的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018400 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved