Jump to content

Math in PCM


---
 Share

Recommended Posts

Below is some PCM used in a Result element.
It converts Celsius (C) to Fahrenheit (F).
(getTemperatureCorrection().temperaturePart)* 1.8) + 32)
1. I need to pass this value to a variable: "u_TempStart".
2. How do I use this in a Result element? Can I use it in a Result element?
3. I would like it converted for F.
4. "u_TempStart" is passed to PiWeb. (This part is working without the F conversion) in Post Settings.
setRecordHead("u_TempStart", (getTemperatureCorrection().temperaturePart))
getRecordHead("u_TempStart")
Any assistance is appreciated.
Link to comment
Share on other sites

Hello!

I don't think that
setRecordHead("u_TempStart", (getTemperatureCorrection().temperaturePart))
work in a result element. In general the pre- or post-settings are meant for assignments.
Why don't you put
(getTemperatureCorrection().temperaturePart)* 1.8) + 32)
in the result element directly?
As far as I know, the temperature of the workpiece is only measured at the beginning of the CNC-start.
Link to comment
Share on other sites

We are not using Compensation, we are just recording a temperature value at Start and End of the programs.
I believe you are correct that
setRecordHead("u_TempStart", (getTemperatureCorrection().temperaturePart))
will not work in a result element.
I attaching the PCM to features.

In the first temp sensor feature Post settings:
StartTemp=(getActual("u_TempStart").temperature)
StartTemp=formatL(StartTemp,3,1)
setRecordHead("u_TempStart",StartTemp)
The End temp sensor feature Post settings:
EndTemp=(getActual("u_TempEnd").temperature)
EndTemp=formatL(EndTemp,3,1)
setRecordHead("u_TempEnd",EndTemp)
Then in the last feature prior to the End temp sensor: (Forces the temp sensor to run).
getActual("Temp End").temperature
It would be a lot simpler if we could do this. (See attached image).

Climate Change.JPG

Link to comment
Share on other sites

I assume you use the workpiece senors and not the temperature probe.
You can also use a separate result element with
 readActualWPTemperature("1+2") 
for the start and end temperature.
Link to comment
Share on other sites

Please sign in to view this quote.

I'm not sure if I'm missing the point here. In my understanding you already successfully converted the value to °F and are also able to assign it to the header variable with setRecordHead.

But why do you want to use setRecordHead() in the result element formula?
I would do all the calculations in the presettings of whatever feature or characteristic and assign the result to a PCM variable:
myTemp=(getTemperatureCorrection().temperaturePart)* 1.8) + 32)
Then use the contents of the PCM variable in the result element or wherever you see fit, by just stating it in the formula:
myTemp
Or am I missing something important? 😕
Link to comment
Share on other sites

 Share

×
×
  • Create New...