06-05-2009 02:29 PM
Ok, when I integrate Temp/Power over Temp/RunTime and graph the results in View...everything is as intended.
When I execute this code in a script I get the error following:
Call DataBlCopy("'Time/RunTime','AI\AO Data/Comp_Power'",StartIndex1, _
StartIndex2-StartIndex1,"'Temp/RunTime','Temp/Power'", 1)
' Now integrate over the range
Call ChIntegrate("[6]/[1]", "[6]/[2]", "[6]/[3]")
' Calculate the max integration result
CalculatedSUEnergy = CMax(CNo("Temp/Energy"))
Returns this error
PM Error:Type mismatch: 'ChIntegrate'
What am I doing wrong????
06-08-2009 10:11 AM - edited 06-08-2009 10:13 AM
Well, I tried recording the integration action and then cutting and pasting the resulting lines of script. I get:
Call DataBlCopy("'Time/RunTime','AI\AO Data/Comp_Power'",StartIndex1, _
StartIndex2-StartIndex1,"'Temp/X','Temp/Y'", 1)
' Now integrate over the range
Call ChnIntegrate("Temp/X","Temp/Y","Temp/Integrated") '... XW,Y,E
vs.
Call DataBlCopy("'Time/RunTime','AI\AO Data/Comp_Power'",StartIndex1, _
StartIndex2-StartIndex1,"'Temp/RunTime','Temp/Power'", 1)
' Now integrate over the range
Call ChIntegrate("[6]/[1]", "[6]/[2]", "[6]/[3]")
Not sure why, but the top one works, the bottom doesn't. The only difference is the name of channels, which I changed for other reasons. RunTime & X are [1], Power & Y are [2]
Anyhow, solved!
06-08-2009 10:20 AM
Hi Jeff,
It looks like the issue was the spelling of the function. The bottom one is missing the "n" in ChnIntegrate.
06-08-2009 11:46 AM
Thanks, Mark. Never caught it.