Thread: Citect/cicode
View Single Post
Old January 29th, 2012, 01:48 AM   #7
joigunni
Supporting Member
Iceland

joigunni is offline
 
Join Date: Jan 2011
Location: Iceland
Posts: 52
I did not find a actual solution. In my program I have a weight scale mad by rectangle that will fill up by red color when it sense some weight. The scale is from 0 to 500 kg. In some case I want to be able to change to higher scale, like from 0 to 2000 kg. At first I put the scale setting in the “Variables Tags” to “Eng Zero Scale = 0” and “Eng Full Scale=500” but as you know there is no way to change those scale in run-time so I cleared those settings and instead made small mat-formula.

Calculated_weight= ((input_weight*3)*2000)/scale_value

// Analog input from PLC give me scale that is 0-10500,
//variable-tag scale is 0-32000
//Max weight is 2000kg
//on Max weight 2000kg I will get 10500 from PLC analog-input

if I put the scale_value to 500kg, the math will look like this:
Calculated_weight= ((10500*3)*2000)/500
Calculated_weight=126000

And if I got 500kg on PLC input, PLC will give me 2625, and the math will look like this:
Calculated_weight= ((2625*3)*2000)/500
Calculated_weight=31500
And the rectangle will be filed

If I still have 500kg on PLC input, and put the scale_valu to 1000kg, the math will look like this:
Calculated_weight= ((2625*3)*2000)/1000
Calculated_weight=15750
And the rectangle will be half filed
  Reply With Quote