Studio5000 UDT's with NEQ Instruction

Cangialosi24

Member
Join Date
Jul 2020
Location
N/A
Posts
6
Hello Everyone,

I'm new to programming and was looking for some assistance.

As a quick overview there is a SCADA system that sends commands to the PLC to start and stop motors, set motor speeds, etc.

I want to have logic to clear all of the BOOL type commands in the event of a communication failure to the PLC. I figured the cleanest way of doing this would be to make a UDT specifically for the commands. For example:

--------------------------------------------------------------------------------------
UDT = SCADA_CMD
-Motor1_Start BOOL
-Motor1_Stop BOOL
etc.
--------------------------------------------------------------------------------------

I planned on using a NEQ instruction to compare a tag named "CMD" of the "SCADA_CMD" data type to the value of 0. I thought that if the "CMD.Motor1_Start" tag went true, then that would set the "CMD" tag to the value of 1, causing the rung to execute.

Now I realized that you cannot use UDT's with the NEQ instruction. Does anyone have any suggestions? I wanted to try to avoid paralleling all of the commands around each other since there's more than just a few commands.

I hope I got my point across and I appreciate any input!
 
If you put all the bits you need to clear on comm fail into one DINT or an array of DINTs (if there are more than 32 of them) then you can compare each of the DINTs to zero and FLL (Fill file) with a source of zero and a length of how ever many DINTs you need to clear.

How you are detecting loss of comms with the SCADA software is unclear to me.
 
As above really, but seems extreme to hault a whole line because the Scada has lost comms, at least have a timer to give yourself some troubleshooting time before the whole lot stops.
 
Thanks for the reply! That DINT method would work great, except I don't want to lose the unique tag names. The DINT method would leave the tag names something like Command.1, Command.2, etc.

Is there a method of efficiently moving the status of each of the tags (Motor1_Start, Motor1_Stop, etc) into a DINT in which I could then compare the value of it to 0?
 
Thanks for the reply! That DINT method would work great, except I don't want to lose the unique tag names. The DINT method would leave the tag names something like Command.1, Command.2, etc.

Is there a method of efficiently moving the status of each of the tags (Motor1_Start, Motor1_Stop, etc) into a DINT in which I could then compare the value of it to 0?
You can use something called bit overlays when you create your UDT. Unfortunately they can't be created or edited in the Rslogix/Studio 5000 UI (At least they can't as of v31. I haven't tried on anything newer.) You have to edit the .L5X files directly in a text editor. I attached a sample for you that creates a UDT with a DINT called BITS and 6 named BOOL tags that reference the first 6 bits of the DINT. If you import it into a program, play around with it, and view the file in a text editor, you should be able to figure out how to change it to get the names you want.
 
You can use something called bit overlays when you create your UDT. Unfortunately they can't be created or edited in the Rslogix/Studio 5000 UI (At least they can't as of v31. I haven't tried on anything newer.) You have to edit the .L5X files directly in a text editor. I attached a sample for you that creates a UDT with a DINT called BITS and 6 named BOOL tags that reference the first 6 bits of the DINT. If you import it into a program, play around with it, and view the file in a text editor, you should be able to figure out how to change it to get the names you want.

I was able to export my UDT and edit it in notepad. I imported it back into the project and was able to make it function like I wanted to.

However as I was testing it I was getting a message whenever I would create a new tag, no matter what data type I made it. The message was along the lines of "This data type was created using the import command and it contains bit overlays". It appears to be the same message you get when you open a UDT that was edited to create the bit overlays. Except this was showing up when I created a tag, even if it was just a bool or a timer. Would you happen to have an idea why that was happening?

Thanks again for the help, I really appreciate it.
 
I was able to export my UDT and edit it in notepad. I imported it back into the project and was able to make it function like I wanted to.

However as I was testing it I was getting a message whenever I would create a new tag, no matter what data type I made it. The message was along the lines of "This data type was created using the import command and it contains bit overlays". It appears to be the same message you get when you open a UDT that was edited to create the bit overlays. Except this was showing up when I created a tag, even if it was just a bool or a timer. Would you happen to have an idea why that was happening?

Thanks again for the help, I really appreciate it.
No idea, I've used UDTs with bit overlays on basically every version between 15 and 31 and I've never seen that. If you post an export of your UDT, I'll import it and see if it does the same thing for me.
 
No idea, I've used UDTs with bit overlays on basically every version between 15 and 31 and I've never seen that. If you post an export of your UDT, I'll import it and see if it does the same thing for me.

I figured it out, I had window of the UDT with the bit overlays open behind the controller tags window. Once I closed the UDT window the warning went away. My fault!
 

Similar Topics

Hello, I have been looking for a reference for the order that a UDT is copied in the COP instruction. More specifically - I have a set of code...
Replies
5
Views
543
Hi all, Working on a project in Studio 5000 setting up a UDT to read an Input Instance from an EIP device. I have everything set up and it's...
Replies
2
Views
879
I have a Structure in my project which has a few nested UDTs. They are ultimately of type DINT. What I would like to do is copy the values out of...
Replies
5
Views
2,244
Is there a way to organize the tags that aligns with the UDT instead of alphabetically? See attached. I'd like the 'Tag' values to go from 0 to...
Replies
5
Views
1,986
The PLC program I'm monitoring has a UDT of alarm booleans. 36 in total. What I'm trying to do is monitor a few rungs, and also monitor a possible...
Replies
3
Views
1,591
Back
Top Bottom