help about indirect tag and dot field value

hlpang

Member
Join Date
Jul 2016
Location
shanghai
Posts
5
Hi guys, I write a script on a button's action:

interlockcheck5 is a indirect tag(I/o descrete),
gassing_hood_in and gassing hood out are (I/o descrete) B3:20/1 and B3:20/2 .
the script does not work well.


interlockcheck5.Value = gassing_hood_in.Value OR gassing_hood_out.Value ;

does anyone know why or what is the right script ?
 
Hi guys, I write a script on a button's action:

interlockcheck5 is a indirect tag(I/o descrete),
gassing_hood_in and gassing hood out are (I/o descrete) B3:20/1 and B3:20/2 .
the script does not work well.


interlockcheck5.Value = gassing_hood_in.Value OR gassing_hood_out.Value ;

does anyone know why or what is the right script ?

Using which software package?!...

Edit: I cant see you using an OR in that situation in a line of code
 
Sorry , I use wonderware intouch 12.0 . there is and "OR"
interlockcheck5.Value = gassing_hood_in.Value OR gassing_hood_out.Value ;
 
Do you want to have 1 in interlockcheck5 if gassing_hood_in is in 1 or gassing_hood_out is in 1 ??

If this is the case, use an if then else:

if gassing_hood_in==1 or gassing_hood_out==1 then
interlockcheck5=1;
else interlockcheck5=0;
endif;
 
interlockcheck5.Value = gassing_hood_in.Value OR gassing_hood_out.Value ;

I do believe that that is your problem. Your script is saying "Set the value of either gassing_hood_in OR gassing_hood_out to the value of interlockcheck5." But what determines which one it uses?? You have to tell it what to do in what situation. What do you want it to do is the first question we gotta get out of the way before we can help you.

Also, This part of your statement is a little bit confusing to me.

interlockcheck5 is a indirect tag(I/o descrete),

What do you mean by an indirect tag? If it is really an indirect tag, there is a whole tag type that is "Indirect Discrete". You set the .name value of the tag to determine which tag it actually is pointing to. I just found it strange that its an indirect tag but its IO discrete. Unless its indirect in the PLC, then it makes a little more sense.

Another tip as well, most of the time when you want to look at a value of a tag, the .value that follows the tag is implied if you just put the tag name. It's only if you want to look at a specific aspect of a tag (like .name as I mentioned above, .comment to examine the comment of the tag, etc.) that you would need to specify down to the dotlevel.

I hope I've been helpful!
 
Do you want to have 1 in interlockcheck5 if gassing_hood_in is in 1 or gassing_hood_out is in 1 ??

If this is the case, use an if then else:

if gassing_hood_in==1 or gassing_hood_out==1 then
interlockcheck5=1;
else interlockcheck5=0;
endif;

Thanks。 I know what you write is correct.

I just want to give the result of logical calculation (gassing_hood_in OR gassing_hood_out) to the indirect tag. all of the three tags mentioned are discrete.
 
I do believe that that is your problem. Your script is saying "Set the value of either gassing_hood_in OR gassing_hood_out to the value of interlockcheck5." But what determines which one it uses?? You have to tell it what to do in what situation. What do you want it to do is the first question we gotta get out of the way before we can help you.

Also, This part of your statement is a little bit confusing to me.



What do you mean by an indirect tag? If it is really an indirect tag, there is a whole tag type that is "Indirect Discrete". You set the .name value of the tag to determine which tag it actually is pointing to. I just found it strange that its an indirect tag but its IO discrete. Unless its indirect in the PLC, then it makes a little more sense.

Another tip as well, most of the time when you want to look at a value of a tag, the .value that follows the tag is implied if you just put the tag name. It's only if you want to look at a specific aspect of a tag (like .name as I mentioned above, .comment to examine the comment of the tag, etc.) that you would need to specify down to the dotlevel.

I hope I've been helpful!

Thanks for replying.

in the script , OR is a Logical OR. not a choice.
 
thank you guys, the scrip runs well.
I made a mistake cause I forgot the give the name to the indirect tag, only give the value to indirect tag(the script I mentioned). and the indirect tag is still using the tag name I gave before.
Thank you again.
 

Similar Topics

I’m working with indirect addressing and trying to make an HMI where each Rectangle Object has a tag of “A[0-127]” with a correlating Push Button...
Replies
15
Views
4,198
Hi guys, New to indirect addressing is anyone able to help me with the attached file. I have tried the pen and paper method and first I put the...
Replies
11
Views
2,480
🙃 I have been scratching my head for a couple of days on this issue. I am in the process of converting a program from rs500 to Studio 5000...
Replies
7
Views
5,622
Hello PLC gurus, i would like to ask you for your help. I have a little problem with indirect addressing, also with ST language. My problem. I...
Replies
7
Views
2,780
Some of you guys may remember I was getting some help on a roller door project a few months.. Lets say learning the ropes of what can be done...
Replies
2
Views
4,269
Back
Top Bottom