计算代码有什么问题? [英] Whats wrong in the calculations code?

查看:67
本文介绍了计算代码有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VB6程序,它从数据采集系统读取并在Excel工作表上显示。我添加了一个子模块,可以从工作表上面已经显示的值中进行3-4次以上的计算。

我的问题甚至是简单的计算,比如EBW,EIBA的行。我的手动计算我完成VB的那个错误。

我缺少什么?



代码就像

 公共  Sub  ISO13256ACOIL()'  A-Coil选项 
开启 错误 恢复 下一步
如果 TestType = 1 那么 ' 冷却测试
EBW =((IDLvgStandAirflow * ESP)* 0 。< span class =code-digit> 3918 )' Eqv。 Blower Watts
EIBA = EBW * 3 413 ' Eqv。室内BTU调整
AIC = NetIDCapacity - EIBA ' 调整室内容量
ETW = CompWatts + EBW + PumpPenalty ' Eqv.Total Watts
AIAC =(AIC + ISOAvg)/ 2 ' 调整后的ISO平均值。容量
EPPA = AIAC / ETW ' 具有泵罚款的EER
frmISO.txtEIBA.Text =格式(EIBA, #。## 将结果发送到表格ISO
frmISO.txtAIC.Text =格式(AIC, #。##' 将结果发送到表格ISO
frmISO.txtEBW.Text =格式(EBW, #。##' 将结果发送到表格ISO
frmISO.txtETW.Text =格式(ETW, #。##' 将结果发送到ISO
frmISO.txtEPPA。 Text = Format(EPPA, #。##' 将结果发送到表格ISO
frmISO.txtAIAC.Text =格式(AIAC, #。##' 发送结果形成ISO
结束 如果
如果 TestType = 2 那么 ' 加热测试
EBW =((IDLvgStandAirflow * ESP)* 0 3918 ' Eqv。 Blower Watts
EIBA = EBW * 3 413 ' Eqv。室内BTU调整
AIC = NetIDCapacity + EIBA ' 调整室内容量
ETW = CompWatts + EBW + PumpPenalty ' Eqv.Total Watts
AIAC =(AIC + ISOAvg)/ 2 ' 调整后的ISO平均值。容量
EPPA =((AIAC / ETW)/ 3 413 ' COP with Pump Penalty
frmISO.txtEIBA.Text = Format(EIBA, #。##' 将结果发送到表格ISO
frmISO.txtAIC.Text =格式(AIC, #。##' 将结果发送到ISO
frmISO.txtEBW.Text =格式(EBW, #。##' 将结果发送到表格ISO
frmISO.txtETW.Text =格式(ETW, #。##' 将结果发送到表格ISO
frmISO.txtEPPA.Text =格式(EPPA, #。##' 将结果发送到ISO
frmISO.txtAIAC.Text =格式(AIAC, #。##)< span class =code-comment>' 将结果发送到表格ISO
结束 如果
结束 Sub

解决方案

没有解决方案,此代码不完整,此例程使用列表中没有的变量。



因此,唯一的建议是在出现错误时使用调试器和变量运行此代码。



It如果您向我们提供错误消息,将会有所帮助。

请注意你的可变数据类型。

通常,变量EBW,EIBA ..应该定义为Double类型


I have a VB6 program which reads from a data acquisition systems and displays it on excel sheets. I added a sub module to do some 3-4 more calculations from the values already displayed above on the sheet.
My problem is even for simple calculations like see line for EBW, EIBA.. my manual calculations and the ones done my VB have an error.
What am I missing?

code goes like

Public Sub ISO13256ACOIL() 'A-Coil Option
On Error Resume Next
If TestType = 1 Then 'Cooling Test
    EBW = ((IDLvgStandAirflow * ESP) * 0.3918) 'Eqv. Blower Watts
    EIBA = EBW * 3.413 'Eqv. Indoor BTU Adjustment
    AIC = NetIDCapacity - EIBA 'Adjusted Indoor Capacity
    ETW = CompWatts + EBW + PumpPenalty 'Eqv.Total Watts
    AIAC = (AIC + ISOAvg) / 2 'Adjusted ISO Avg. Capacity
    EPPA = AIAC / ETW 'EER with Pump Penalty
    frmISO.txtEIBA.Text = Format(EIBA, "#.##") 'send results to form ISO
    frmISO.txtAIC.Text = Format(AIC, "#.##") 'send results to form ISO
    frmISO.txtEBW.Text = Format(EBW, "#.##") 'send results to form ISO
    frmISO.txtETW.Text = Format(ETW, "#.##") 'send results to form ISO
    frmISO.txtEPPA.Text = Format(EPPA, "#.##") 'send results to form ISO
    frmISO.txtAIAC.Text = Format(AIAC, "#.##") 'send results to form ISO
End If
If TestType = 2 Then 'Heating Test
    EBW = ((IDLvgStandAirflow * ESP) * 0.3918) 'Eqv. Blower Watts
    EIBA = EBW * 3.413 'Eqv. Indoor BTU Adjustment
    AIC = NetIDCapacity + EIBA 'Adjusted Indoor Capacity
    ETW = CompWatts + EBW + PumpPenalty 'Eqv.Total Watts
    AIAC = (AIC + ISOAvg) / 2 'Adjusted ISO Avg. Capacity
    EPPA = ((AIAC / ETW) / 3.413) 'COP with Pump Penalty
    frmISO.txtEIBA.Text = Format(EIBA, "#.##") 'send results to form ISO
    frmISO.txtAIC.Text = Format(AIC, "#.##") 'send results to form ISO
    frmISO.txtEBW.Text = Format(EBW, "#.##") 'send results to form ISO
    frmISO.txtETW.Text = Format(ETW, "#.##") 'send results to form ISO
    frmISO.txtEPPA.Text = Format(EPPA, "#.##") 'send results to form ISO
    frmISO.txtAIAC.Text = Format(AIAC, "#.##") 'send results to form ISO
End If
End Sub

解决方案

There is not solution, this code is not complete, this routine use variables that are not in the listing.

So the only advice is to run this code with debugger and the variables when you have the error.

It would help if you give us the error message.


Please pay attention to you variable data type.
Usually, variables EBW, EIBA.. should be define as Double type


这篇关于计算代码有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆