Hello,
This might be a simple matter of using an expression correctly:
I am trying to get the 3 sigma and Cpk values for certain process parameters. I am running a script which aggregates the tag history using the SimpleAvg and StdDev methods, this works fine. in order to calculate the Cpk, I had also planned on calculating it via expression tag with the following expression:
//Cpk = min(USL - μ, μ - LSL) / (3σ)
//where USL and LSL are the upper and lower specification limits,
//μ is the process mean, and σ is the process standard deviation.
value1 = ({[.]HeightUSL}-{[.]HeightAvg})
value2 = ({[.]HeightAvg}-{[.]HeightLSL})
value3 = (3*{[.]HeightDev}) //3 sigma
value4 = (value1 / value3) //value used if value1 is lower
Value5 = (value2 / value3) //value used if value2 is lower
if(value1 < value2, value4, value5) //checks if value1 or value2 is lower
The tag is showing an “error_configuration” message. How can I fix or improve this expression?
Do you know any simpler method of getting to the Cpk values?
Thanks