Jump to content

Joe Tauser

MVP 2023
  • Posts

    2,860
  • Joined

  • Last visited

  • Days Won

    308

Everything posted by Joe Tauser

  1. Very interesting indeed. I second your recommendation to watch this video so people who aren't familiar with ChatGPT can get a feel for it. My app engineer has been looking at ChatGPT and feeding it questions about Arduino code for his home projects, and it's very capable. I had fun watching the video and got the impression that the poster was a big fan of Beckhoff, Structured Text, and Function Block programming. It answered his initial simpler questions well but when he got more specific it started locking up (due to server overloading) and the replies got more vague or outright incorrect. Us old dogs have our feet firmly planted in ladder programming. If one has previous experience in other languages such as C++ or Python then Structured Text or Function Block is probably easier. I'd be curious to other user's preferences and opinions on this. So I made a ChatGPT account and asked it to do some ladder logic on my favorite, the State Machine. Here's my first try: I don't know about you guys, but this doesn't look like any ladder code I've ever seen. Maybe my question was too generic, but the ladder method in the various offerings of IEC-61131-3 that I've used look about the same. Certainly very readable. So I got more specific. Surely ChatGPT was familiar with Allen Bradley. Here's what I got: Uh, no. WTF is that? Of course then I tried Unitronics. It over-ran the screen so I copied the actual code- Light_Control IF (State=1) THEN OUT_0=0; OUT_1=0; TMR_0.Start; END_IF IF (TMR_0.TimeOut) THEN TMR_0.Stop; TMR_1.Start; OUT_0=0; OUT_1=1; END_IF IF (TMR_1.TimeOut) THEN TMR_1.Stop; OUT_0=1; OUT_1=0; TMR_2.Start; END_IF IF (TMR_2.TimeOut) THEN TMR_2.Stop; State=2; END_IF IF (State=2) THEN OUT_0=0; OUT_1=0; TMR_3.Start; END_IF IF (TMR_3.TimeOut) THEN TMR_3.Stop; TMR_4.Start; OUT_0=0; OUT_1=1; END_IF IF (TMR_4.TimeOut) THEN TMR_4.Stop; OUT_0=1; OUT_1=0; TMR_5.Start; END_IF IF (TMR_5.TimeOut) THEN TMR_5.Stop; State=1; END_IF It looks like it over-rode my request for ladder code and wrote something in Java. Overall, I'm not too worried about AI getting into my wallet. PLCs are too diverse and too specialized for the AI programmers to chase down the subtle details of each brand, language and model. Is AI going to do the field startup? I think not. That is, until this guy becomes a reality- Joe T.
  2. Maybe, if the particular Siemens you're using supports the Modbus protocol on a separate RS232 or RS485 serial port. That's a question for your Siemens dealer. The only thing Profibus and Modbus have in common is they both end in "bus". Someone else on the forum can describe it much better than I. I just know it as "the purple cable". Google is your friend- https://control.com/forums/threads/difference-between-modbus-and-profibus.31231/#:~:text=Profibus has certain protocol features,not the same as Profibus). Joe T.
  3. This is interesting. On my system under C:\Windows\SysWOW64 I have both Actbar2.ocx and Actbar3.ocx. I have no idea why those files aren't there from the Visilogic installation but here you go. Joe T. Actbar2.ocx Actbar3.ocx
  4. I'm guessing your product is such that the work can be restarted. I would use a State Machine and define a "pause state" that will turn everything off but remember the state number of where you stopped. Take a look at this thread- Joe T.
  5. @Piet - You should really start a new thread on this unless your question has something to do with RS232 motor control communications. Joe T.
  6. I am 99.9% certain that Unitronics proper is not going to make it easy to buy somebody else's product, especially Siemens. If you're looking for help on this I'd go to one of the general purpose PLC forums and ask. Joe T.
  7. You've also got your RHR status (MI 52) at one address after your destination (MI 51) so you're going to stomp on yourself when you read a vector larger than one. Set your status address much higher, like at MI 100. Joe T.
  8. It was the port number. I didn't even think of that when I was putting the example program together. By default, Unitronics assigns port 502 to socket 2 and sets it as a TCP Modbus slave. By also assigning port 502 to socket 3 without manually assigning something else to socket 2 we left the PLC in a position where it didn't know whether to shit or go blind. It was late at night and I didn't have test hardware in front of me. Joe T.
  9. First let's get our Visilogic versions straight here. I created the example in 9.8.65, but I was unable to open what you re-posted. I'm guessing you have the latest version of Visilogic (9.8.96) so I'm downloading that. Unitronics changes the database revision from time to time and older versions can't open something saved with newer stuff. Usually an O/S update in the PLC accompanies this. They have a really nifty tool called the Version Swapper that lets you manage different programs on different machines created at different times, but that discussion can be found elsewhere on the forum. Also, it's good programming practice to modify the name of a program any time you change and save it. Add the date to the end or something. Let's list out the basics- 1. The PLC is set to IP 192.168.1.110. If you're on a network with a router that has DHCP turned on make sure this address hasn't already been assigned. Don't ask how I know to check for this. You can tell by pinging that address from your PC with the PLC disconnected. 2. Socket 3 is set to TCP Master at port 502. I put this in my example but it may be a problem, as Socket 2 defaults to a Modbus Slave also at port 502. I changed the port for Socket 3 to 503. It is perfectly fine to use port 503 on the Master to talk to port 502 on the Slave. Yes, this is confusing. 3. The Turck data sheet doesn't tell us what the Slave ID is, so I'm guessing it's 1. Is there a web interface for it that allows you to set this? It may not matter, but then again it might. Have a go at it with this program. Joe T. Modbus TCP Master JT 1.19.23.vlp
  10. You haven't given yourself a lot of room to control here. It will work better if you set your process value to 0-3000 and use a virtual decimal point at xx.xx for pressure. Joe T. Pressure_PWM - Copy JT.vlp
  11. You can't hang the Modbus Read block on the rail. It's initiating a communication every scan and not giving it time to respond. In Modbus TCP land you also have to connect the socket first. If you lose the connection you'll have to trigger your connect logic again. If your application is continuous data transfer, you can leave it connected to the socket. If it's periodic or you change to a different Modbus slave, you'll have to disconnect first before you connect to the new slave. There's an example at Help->Examples->Version 900->Project Examples->Communications->Ethernet->Ethernet MODBUS IP->V280_Ethernet_TCP_MODBUS_IP_Master.vlp. Unfortunately you can't convert a V280 to an SM70, so I did a little hacking and made it into an SM70 for you. I don't know what your IP addresses are so you'll have to go into the blocks and edit those. Don't be confused by the V700 examples. That's a different animal with a built-in Ethernet port and the port numbers and system bits are different. Joe T. Modbus TCP Master.vlp
  12. 1. Look at the Modbus examples in the directory above to see how to use Modbus in Visilogic. 2. Determine what you want to do to "operate this regulator". Start? Stop? Control Speed? Ramp Speed? You need to be more specific. 3. Look at the Omron manual starting on page 281 to determine in the internal Modbus addresses you'll need. 4. Try writing the program to achieve what you want. When you run into trouble post your program (.vlp file) here with specific questions. Joe T.
  13. When you install Visilogic, a whole bunch of example programs are also installed. They can be accessed from the main menu under Help->Examples If you want to take a look at the actual directory for the Modbus examples have a look here: If you want more help on your Omron MX2, post a link to the manual describing the Modbus communication for it. Joe T.
  14. At the beginning of the video I thought that might be a Star Destroyer poking it's nose out to finish us all. 🥵 The way this year's gone I wouldn't be surprised. Joe .
  15. Translated - In fact, I am looking for an absolute encoder preferably with binary output. What I'm looking for is capturing the value of the encoder [0-360] at the instant that a flag on the shaft passes through an inductive sensor This is repeated on each turn of the axle, it is for a synchronization project between the two axles The captured value will be used as the "Master" synchronization position In effect, I seek that this capture value is the same, that it does not have variation [Like the one with an incremental encoder using the numeric reserved to generate 0-360 grads If you put the network above in an interrupt subroutine you can read the encoder when the input goes true and do whatever conversion is needed to get a 0-360 output value. As Kratmel pointed out, a rotation rate of 1.2 rev/sec will present a frequency of 5120 Hz on the LSB, or about . As I mentioned above, the best you can do is is a 2.5 ms window during which time 13 pulses will pass, giving you a precision of 13 / 4096 = 0.3 %, or 1.14 degrees. This may or may not be acceptable to you. It would probably be easier and more accurate to run a regular single channel or quadrature encoder into the HSC inputs of the PLC, doing a reset in the code on each revolution. The HSC inputs are rated at 20 kHz input frequency which is more than adequate for what you are trying to do. Joe T.
  16. Interrupts won't give instant information in this application. The fastest interrupt is 1.25 mS and you need to be able to see the on and the off state of the input so you double the time. So using interrupts you'll get a maximum input frequency of 1/.0025s = 400 Hz. The original question was "can I read an absolute encoder?" The answer is yes, you can. Since it's an absolute encoder you won't be missing any pulses. The data you read will be good. You didn't say what the encoding is, but it's probably Gray Code which you will have to write logic to decode. You can put this logic in the interrupt routine if it's not too complicated. The real question is whether a 2.5 ms response time is acceptable for your application. Joe T.
  17. The pointer register is updated immediately. The equal block in the next rung will solve TRUE if the condition is met. Sometimes my State Machines run too fast and will zip through all the steps before the communication blocks (which are separate threads) update. Interlocking the State scan with "done" bits is crucial. Even so, every now and then I add a short (50 ms) timer between steps to slow things down and allow a couple of scans to happen so other parts of the program have time to react to the data I've received. Joe T.
  18. Let's start with your second question first. Don't trigger the TCP Connect Continuously. Each time you call the block it will spool a new Connect. If there was already a Connect in progress you will destroy that effort with the new call. You just have to wait a little bit. Using my State Machine method in my Modbus TCP Reads subroutine (Step #10), first I tap the Connect block with a pulse every 100 ms, which is a long time in Ethernet land. When the socket's .IsConnected bit comes on I move onto the next step - In my Modbus subroutine, there's a lot of blah, blah, blah in-between connecting the socket and listening for the response, which occurs in Step #40 - You don't trigger the TCP Client Rx block, you enable it. It will sit and listen until something comes in at which time it will set the Response Received bit (Output D). At that point the listening stops. Whatever comes in will be in the buffer, it's actual contents are irrelevant. That's up to you to decode them elsewhere. In my program I move onto the next step and deal with the buffer contents. Then I clear it out and reset the response received bit. If you're only dealing with one device you can leave the socket connected and re-enable the Rx block. In my case I'm talking to multiple slaves so I disconnect and start the process over with a different slave ID. Joe T.
  19. You didn't mention the model of the PLC, but I'm assuming you've downloaded the software and tried to upload the program. Unfortunately, you are basically screwed on this. There is no way to get into a Unitronics PLC and upload program without the password. The only thing you can do is start over and blow out the existing program with a new one. Joe T.
  20. Yes, you do need to use the PID AUTO-TUNE block for PID control. Do not ask why - it is a Uni-Mystery. But you don't have to run the PID A. TUNE AUTO-TUNE function. It will work fine if you just call the configuration block on the first scan, set your own PID parameters, and then just call the RUN block. Joe T.
  21. What exactly does this mean? Are you using a prox with magnets on a wheel? If so, you may be running into the response time of the sensor. You've got I0 configured as Pulse and Direction. Do you have a Direction input on I1? Put a scope in the input to the PLC and see what the waveform looks like. Joe T.
  22. Probably. The pressure will track the temperature. I'd still display the value. Joe T.
  23. If I read your response correctly, you're only heating air. You didn't say what the volume of the tank was, but for purposes of discussion let's say that 300W is plenty of heat for your temperature needs. I'm also assuming the heating element is either designed for heating air or is integrated into the tank and there's no limit on how hot it can get. Let's have some fun on a Sunday night and look at this from a thermodynamics design standpoint. I refer to the ideal gas law, or pV=nRT. https://en.wikipedia.org/wiki/Ideal_gas_law This is actually one of the things you learn in school that is useful in real life. It can be re-written as P1V1 / T1 = P2V2 / T2 . In your case, the volume is constant so it can be eliminated from the equation, so P1 / T1 = P2/ T2 . If you're doing this by the book P is in Pascals and T is in Kelvin. We'll use ambient absolute pressure and temperature at sea level as a starting point, so P = 14.7 psia = 1.01 x 105 Pa and T = 70F = 294 K. Your maximum pressure is 15 psi, which is 29.7 psia = 2.04 x 105 Pa. Now let's see how hot we need to get the air to hit your 15 psi limit: 1.01 x 105 / 294 = 2.04 x 105 / T2 . T2 = 593 K = 607 F. So what you're trying to do is possible. The gas law is a linear equation, so it really doesn't matter whether you point the loop at temperature or pressure. I would use pressure as the input to the PID loop as you've indicated this is what you care about. Adding selector logic over-complicates things. I would put a simple compare block on the temperature to disable the pressure control if it gets too hot. I took a quick look at your program and you'll want to feed the output of your Pressure loop into a PWM block for the heater. Look at the Help on the PWM block for a better understanding, but I modified some parameters in some of your blocks for you. You typically want the cycle time to be one second and the PWM cycle time units are 2.5 ms, so the cycle time value is 400. The block is looking for an input of 0-100.0%, or 0-1000 from the PID block. The RTD input will return a value with 0.1 deg C resolution, so either modify your displays or divide it by 10 before you do anything. Before you call AutoTune, manually set your Proportional band to 10.0%, or 100. The AutoTune will modify it. You called the Heater output coil O0 in two different places, which is a big PLC no-no. The coil will be in the state where it was last called; in your program this is the temperature loop. So if the pressure loop is calling for heat but the temperature loop is not the output will be off. I disabled the net in Temperature Loop for now. Your Linear block is configured correctly. Since the input to the PID block is scaled pressure, you set the Low and High limits to your scaled values. Let us know what other questions you have. I modified your program in Visilogic 9.8.94. Joe T. sp JT.vlp
  24. This reminds me of chamber controls I did to cure rubber. First you need to define your selector rules. Which is more important? Do you really need PID control? What is the tolerance of your temperature and pressure? What type of fluid are you heating? Does it have a high specific heat like water or a lower one like oil? If it's oil or something else, what is the watt density of the heating elements? Or are you using steam? Details, details..... Joe T.
×
×
  • Create New...