DLB

MrPLC Member
  • Content count

    46
  • Joined

  • Last visited

Everything posted by DLB

  1. I am fairly new to PLC Programming and hope that I may be able to get some advice you guys :) However, I have around 18 months experience building SCADA systems which means I have a sort of overall understanding as to how PLC Programming is done. I have an upcoming task which is to involve some PLC coding. I don't have the exact details yet of it yet but I expect that is going to be mainly focused on transferring data from one PLC to another (ControlLogix, so development will be done under RSLogix5000 I guess?). I have yet to be explained exactly what data is being passed between the 2 PLC's but please could somebody explain to me the steps taken to read from/write to another PLC? I have been looking into the MSG function and the Message data type but I've not yet been unable to build up a clear representation as to how these are used. Any help and advise would be massively appreciated! Thanks
  2. Hi, Please could someone explain how faults are usually dealt with in PLC Logic? I know this is a pretty general question. I have a process that runs as a continual task (which I have developed using Use Cases in the Functional Specification for the system). but I don't know how to efficiently code for alternate scenarios ie when the continual process doesn't run smoothly. I have some code together but feel as though I could be doing things better and wondered how more experiences programmers deal with these scenarios. Also I am currently using a GuardLogix PLC but I am unsure when I should be using Safety routines? I'm fairly new to PLC programming so if you could keep replies as simple as possible that would be really good :) Thanks
  3. Am I right in thinking that you can't pass arguments into a subroutine (SR Section) in Unity Pro? I am using v8 and can't seem to find a way of doing it. I want a reusable function that I can just call on demand, so a subroutine is perfect. But I need to call it with different parameters. Will have to be a DFB is this isn't possible, I guess.
  4. Hi, I've been handed some PLC code and asked to make some modifications. The mods are minor but naturally I need to test them and use simulation mode to make sure it's good to go before it gets downloaded to the hardware on site. I've used RSLogix5000 quite a lot but I am new to Unity Pro S (using v5.0) and could do with some help. When I am in simulation mode and the simulated hardware is running I see I can use animation tables to force tag values. This works for normal tags but I don't seem to be able to force things within DFBs. For example, the mods I have made are to an SFC Transition Section. In the transition section is a simple AND block. I need the output of the AND block (and consequently the transition) to be TRUE so to do so, I need to force all of the inputs to the AND. However one of the inputs is an output variable from a DFB (ie "DFBName.VariableName") and it will not allow me to force it. Is there any way I can do this? If not then I guess the only way to achieve it is to follow this tag back through the DFB and force other tags to eventually get it to the value I need? Only thing is I did this and I run into the same issue: I need to force tags which Unity won't allow me to. The documentation for Unity doesn't seem great at first glance and I can't seem to get what I need from it. Any help would be great! Cheers
  5. I am using an OpenOPC client to talk to RSLinx to read and write PLC tag values. I'm finding that I occasionally get cached data returned when I do a PLC read. As an example, I have a Boolean tag that I can see on a PLC trace has dropped from 1 to 0, but I still get a 1 when I read via OpenOPC for a period of time before I get the most up to date value of 0 returned. I’ve noticed my PLC topic configurations in RSLinx have the “Polled Messages (mSec)” parameter (Data Collection tab) set to 1000ms. However, my OpenOPC clients set the update rate argument to 100ms whenever they read anything, which I thought would override the update rate specified in the RSLinx topic configuration, is that correct? After noticing this I changed the RSLinx Topic configuration so that poll rates match on both Server and Client, but I won’t know for a while whether it has helped or not. However, if my understanding of the client poll rate overriding the server poll rate is correct then I guess it won’t make much difference. Also, I'm seeing 2 other issues which I guess could be related but I am unsure: - I am seeing active topics/groups hanging around in RSLinx after I've closed all OPC connections (which looking at the OpenOPC code, should remove all groups: “self.remove(self.groups())”). I'm not really sure what is going on here? - I'm seeing a few RSLinx communication errors with the description of “Desc: A DDE/OPC Client has passed an invalid server handle while attempting a Remove Item call. Handle value is 0x79ac130.” i) How can I figure out what is causing this? ii) Is it logical to think that this could be related to the above issue where some groups aren’t being removed? iii) Snipped of an RSLinx communication error log below ---------------------------------------------------------------------------------------------------------------- -none- : -none- : 11/29/13 - 01:12:05 : 00h Items: -none- Type: READ Mfg: Allen-Bradley PlcType: Desc: A DDE/OPC Client has passed an invalid server handle while attempting an Async IO Read call. Handle value is 0x79ac130. Number of occurrences: 814 Last Error occurred: 11/29/13 - 07:59:02 -none- : -none- : 11/29/13 - 08:07:00 : 00h Items: -none- Type: READ Mfg: Allen-Bradley PlcType: Desc: A DDE/OPC Client has passed an invalid server handle while attempting a Remove Item call. Handle value is 0x79ac130. Number of occurrences: 1 Last Error occurred: 11/29/13 - 08:07:00 ---------------------------------------------------------------------------------------------------------------- Any help would be brilliant. Thanks.
  6. Thanks My2c. From what you say then, lowering the poll rate in the OPC topic configuration in RSLinx may actually make a difference? If I understood your comments correctly, the 1000ms I have in the RSLinx sort of dictates the servers "best effort". Right? I have lots of logs so plan to try and correlate the handle errors in the RSLinx log to test logs showing the data we were attempting to read at the time the error occured.
  7. Sounds like you need OpenOPC: http://openopc.sourceforge.net/ We have an automated test framework written in Python that we use to create tests which poke the PLC and read back data to check that things are functioning as we expect. OpenOPC allows you to read and write data via any OPC server. It's very easy to use and so is Python if you haven't ever used it.
  8. PLC Integration

    OpenOPC (Python library) is a really simple way to read tags. I use it for automated testing. http://openopc.sourceforge.net/
  9. That's great. The example makes it really clear!
  10. I'm running Unity Pro and need some help writing some ladder to control the mode of some equipment (via DO) with delays in place to stop mode switching happening too fast. I essentially need the program to decide what mode it should be in (based on inputs) and then switch the PLC to that mode (by setting specific outputs), providing it has not been in the previous mode for less than a given amount of time. On paper this seems like an extremely simple task yet I can't seem to put together something that works. I'm relatively new to writing my own PLC code but I am familiar with it. I've spent more time looking at other peoples code for one reason or another and discussing the design, but haven't had much experience designing my own logic from scratch. I think it would really help me if someone could give me a simple and general example to cover what I'm trying to do. Maybe something that switches between 3 modes based on a combination of 3 inputs, but won't switch until the current mode has been in place for X seconds. Thanks in advance for any help.
  11. Hi, I have an image that I am looking to transfer from 1 PLC to another (say PLC1 to PLC2 for example). From PLC 2 it will be read by a HMI and displayed on screen. If the image is converted to a Byte array and passed from PLC1 to PLC2, what is the easiest way to convert this array back into an image? I will be displaying the image in Citect and don't imagine that it is clever enough to deal with this. I have thought about using DDE & RSLinx Classic to read the byte array elements into Excel, then use VBA to write the byte array to a file. Citect would then open the file as an image. Has anyone got any better ideas? Or even any info on the method I've described? **EDIT** It's just dawned on me that Citect supports VBA functions. Maybe I could just code the conversion from Byte Array back to image file in a Citect VBa file? Thanks
  12. Hi, I am trying to gather information on serial communication using a Modicon M340 and Modbus. I have never worked with serial comms or an M340 before and I have some really basic questions: 1. Modbus is a serial communications protocol that can be used over RS422. Is this correct? 2. How do you code the PLC to transfer data to another device over Modbus? Is there an instructions set which allows the message to be configured easily? 3. What is the difference between RS422, RS485 and RS232 and can they all be used to transfer data over Modbus? 4. I have heard of Modbus RTU, Modbus Plus, Modbus TCP/IP, can anyone give a clear brief description of each? I apologise if some of these questions are very general. I want to make sure I have the basics straight in my head before I go any further with things. Thanks
  13. Hi dimmitrisd, I'm not sure if I quite understand what you mean? Please can you try and explain it again and I will do what I can to help? The Modbus work I have been doing however is a little different. I have been working with a PC running some custom software which needed a Modbus TCP driver writing for it. I've not been doing the PLC side of things but what I do know is that the M340 acting as Modbus Slave shouldn't need any configuration. Just give it an IP and connect over the RJ45 Modbus port. Does this help at all?
  14. Thanks DanW! I'll check out that forum now :)
  15. Aha, i understand what you mean now. However we are going to be using RSLogix5000 :) Reading the data from the PLC won't be a problem, it is the coding (Cicode or VBA) to build the array elements back into a file that I am unsure of.
  16. I'm not sure quite what you mean? Do you mean list the elements of the byte array in a data file and read them from there? The way I am looking at it is that the PLC will have a register holding an byte array. If I read the array from the PLC like I read any other tag, I then need to make Citect process the array elements into a file and give it the correct extension (.jpg/.bmp). I'm thinking that a VBA function might be able to handle this?
  17. Brilliant! Thanks for that. Since posting I have been doing some reading online and your post has pretty much summarised everything I have read which is exactly what I was looking for. Thanks! Next stop is writing a Modbus TCP/IP driver. I need to read/write data from/to a PLC over modbus, from a PC running a custom piece of software (ie not a SCADA package with a built in Modbus TCP/IP driver). Anybody had any experience with this?
  18. The original image will most likely be of JPG or BMP format. I am told that the image file will be converted to an array of bytes. I am unsure of the model of the PLC which will create this byte array from the image file (which is originally stored on a the disk of a device acting as a DVR), but it will be passed to an Allen Bradley ControlLogix over a Rockwell DF1 radio link. The ControlLogix is where I need to read the byte array from and read the array elements back into a the correct file format. When the system is under development I will know for definite which type of image file (JPG or BMP) is being used so will know of the extension to apply to the built file. The image will then be displayed on a SCADA terminal running Citect. I know that Citect supports the display of BMP files. If it does not support JPG files then an image of that format will require further processing to convert it to BMP. If anyone else can think of a better solution to passing the image down the chain to Citect I'd be glad of it. I think the reason for the current situation is due to network segregation, ie the SCADA terminal is unable to see the first PLC (the one that holds the initial byte array representing the image file). I understand the concept seems a little unorthadox but it's not my call as to how the image is dealt with. I'm just investigating someone elses idea :)
  19. Hi, A complete n00b question, but how do I set a boolean to zero? I presumed I could jyst use the CLR instruction but it threw up an error. Then I realised it doesn't work with a BOOL. The way I understand it is that if I have a rung with an XIC and an output coil on the BOOL tag (lets call it bool1), when the rung is energised the bool will go high/true/1. Then, when the rung is not energised, bool1 will fall back to zero. Is this correct? If so, I can't see how I can use this in my ladder routine as I don't want it to toggle between 0 and 1 everytime the tag on the XIC changed. I just want to set it to zero, then manually set it to 1 again further down the line when some other conditions are met. I realise this is probably incredibly simple and I'll kick myself when someone posts the solution but it has got the better of me Thanks
  20. Thanks daba! As with Alaric's post, yours is really helpful :) It's always the simple things that trip me up!
  21. I asked the same question to a colleague who is providing me with the bye array on the second PLC. It's my job to try and get it built back up into an image file. I'm still not entirely sure why the image is not being hosted elsewhere so that the SCADA terminal can read it or even why it isn't FTP'd directly from the CCTV system that is grabbing the image to the SCADA terminal. That part is out of my hands at the moment, I just need to find the most efficient way of building the byte array back up into an image file. Any help would be great :)
  22. Some really interesting points there. Some that I hadn't even considered! I'll can see that I'll be referring back to this post in the future :) Thanks!
  23. I'm using RSLogix5000 and have a bit of an odd warning. Whenever I verify the controller all is fine barring this one warning. I've been ignoring it for a while now but have decided to try and get to the bottom of it. As you can see from the attached screenshot, it is a pretty self explanatory warning in that it believes there is a program that does not have a main routine associated with it. Only problem is, I can't see where this is. When I left click the warning it launches the Program Properties window on the Configuration tab, prompting me to assign a main routine. You can see from the screen shot that there are no available routines. Hopefully there is enough information shown on the screen shot for someone to be able to help. Thanks
  24. I'm very happy to see now blue entries in the verification results anymore :) Thanks for your help! Hopefulyl less people will make the same daft mistake if they see this thread!