Forum Replies Created
-
AuthorPosts
-
BamKR
ParticipantI am setting 145 value using value from plc stopwatch from value 144. TimeUpdate() is called on output formula on channel 150 from automatic module when input state is changing on plc. Everytime when input state is changing, I replace value on channels by 1 moving up.
public double UpdateTimes() { double time1 = Val(145); double time2 = Val(146); double time3 = Val(147); double time4 = Val(148); double time5 = Val(149); double newTime = Val(144); SetVal(149, time4); SetVal(148, time3); SetVal(147, time2); SetVal(146, time1); SetVal(145, newTime); double average = (time1 + time2 + time3 + time4 + time5) / 5.0; SetVal(151, average); double average_time = (Val(103) * 60) / Val(143); SetVal(153, average_time); return average; }
-
This reply was modified 5 months, 3 weeks ago by
BamKR.
BamKR
ParticipantYes, but when I don’t make self-reference, value is not displayed on channels. Maybe you know what I am doing wrong ? I am using setvalue function in formula but it is not enough.
BamKR
ParticipantHello,
I think I solved problem, values in formula wasn’t displayed till i put in input formula Val(cnl). For example, on channel [115] Value 1 I put input formula Val(115), and for other channel also like on img.
BamKR
ParticipantHi,
Finally works how it should, I think i tried solve this problem from wrong side.
First I changed formula
public int test1() { int result = 0; SetVal(29, 1); SetVal(30, 1500); SetVal(49, 1); SetVal(50, 1); SetVal(52, 1); result = 1; return result; }
After I changed configuration at channel [31] where works formula on output, everythings works ok. I defined code tag and device on channel 31, before I done always all configurations on channel 52 where value is being set by formula. It is litlle bit strange for me why it works when I defines parameters on channel 31 (code, device) but no works when I do it for channel 52 while the formula refers to this channel. I thought all configurations should be done for channel which is referred in formula but configuration should be done on channel which execute formula, I’m right?
Thanks for help.
BamKR
ParticipantThanks for answer.
You mean to specify tag code and device in channels configuration or in formula? In channel configuration I definied all this parameters. Like on image:
and formula after correction
public int test1() { SetVal(29, 1); SetVal(30, 1500); SetVal(49, 1); SetVal(50, 1); return 0; SetVal(52, 1); return 1; }
?
-
This reply was modified 5 months, 3 weeks ago by
-
AuthorPosts