PeterFukt Posted June 21, 2016 Report Share Posted June 21, 2016 Hello, I want to add a feature in a program that I have for a Samba SM35-J-T20. Somehow, I want to trigger an output for a variable amount of time depending on an analog 0-10 V input. For example, at 1,1 V output O1 should be on for 1 second and off for 9 seconds and the time should change linear until 4,0 V where the output should be on for 10 seconds and never go off. At 4,1 V the output should start over with 1 second on and 9 seconds off. I simply have no idea how to make this happen and if it is even possible. Any bit of help would be appreciated! Link to comment Share on other sites More sharing options...
Alexander Posted June 21, 2016 Report Share Posted June 21, 2016 This is fairly complex. How often does the output change? What if the output changes while a previous timer is running? There would need to be some way to determine when to start/stop the output operation. A linearization function block can be used to scale the time output, but it will then need to be loaded into a timer block to run. Something would also need to trigger this run block. What conditions are you using to start the digital output running? Link to comment Share on other sites More sharing options...
PeterFukt Posted June 22, 2016 Author Report Share Posted June 22, 2016 It is the analog input that triggers the digital output, above 1 V the machine starts, below 1 V nothing happens. I will use a compare block for the start condition depending on the analog input. When the input reaches 1,1 V the output would run for 1 second and be turned off for 9 seconds. I have found no examples of how to make a timer with a variable running time. I'm not sure how to linearise a 0-10V input to a 0-10 sec output. Or is there some kind of function block that I can use instead? The idea is to control an electric heater on/off and depending on the 0-10V analog input, the digital output pulses on/off with various intensity in a way to control the temperature from the heater. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted June 22, 2016 MVP 2023 Report Share Posted June 22, 2016 You can use the "Store Timer/Counter Preset" function to vary the running time in any way you wish. Create the logic you need to make the timer run how you want with an ML operand. Be sure the ML is in units of 10ms (e.g. an ML value of 500 would be 5 seconds). The Store Timer/Counter Preset will allow you to assign the timer preset to the value of the ML. You'll need to have some understanding of how quickly your analog input is varying and how stable it is to properly filter that input. You might be able to simplify your logic a bit by using TE (Extended Pulse) timers. Look up Timers in the Help file for a complete explanation of how all 3 available timer functions work. Link to comment Share on other sites More sharing options...
Gabriel Franco Posted June 22, 2016 Report Share Posted June 22, 2016 Based on your latest post, what you need is a PID with PWM digital output. There are examples you can look at 1 Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted July 9, 2016 MVP 2023 Report Share Posted July 9, 2016 Hi Peter, I know this is a little old, I've been away on leave. I would be considering not using timers at all. Instead use a fast acting counter, with easy resets, and compares being done that are altered according to your input using Linearisations. Counters are a neglected item that often perform a job much better than timers, due to all the things you can do with, and do to, a rolling count. Timers essentially have one aim....to get to the stopping point. cheers, Aus Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted July 10, 2016 MVP 2023 Report Share Posted July 10, 2016 Counters are a neglected item that often perform a job much better than timers, due to all the things you can do with, and do to, a rolling count. Timers essentially have one aim....to get to the stopping point. This is good advice. I rarely use counters and I realize that I'm overlooking a powerful feature all too often. Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted July 10, 2016 MVP 2023 Report Share Posted July 10, 2016 Just to clarify, using SB15 as the basis for this counter should be sufficient. If the input is stable the count reaches an upper limit, resets to 0 and starts again. But your logic might include resets to other than 0, up to the limit, for varying inputs. I strongly suggest making some sort of flow chart before you start writing code....often just doing it in Excel make things easy as you can move cells around as you add or subtract ideas. I put an individual needed action/event into each cell....not actually how I write the code....it is a sort of overview. cheers, Aus Link to comment Share on other sites More sharing options...
PeterFukt Posted July 12, 2016 Author Report Share Posted July 12, 2016 Thanks for the advice. I haven't had time to look into this yet but I will try if I can get it working. I haven't used counters before so I must do some reading about that. Making a flow chart is also a good idea. Link to comment Share on other sites More sharing options...
PeterFukt Posted August 18, 2016 Author Report Share Posted August 18, 2016 Back from my vacation I found out that I will use the new Samba SM35-J-TA22 instead but I guess that does not change the options that I have to create the function that I want. I will look at the counter option as well as the PID with PWM digital output. I just want easy programming. 1 Link to comment Share on other sites More sharing options...
HigHTech Posted August 18, 2016 Report Share Posted August 18, 2016 Hey Peter, If you need to make a temperature control then I recommend the PID FB and PWM option. It´s really easy and works perfectly. Check in the examples files, PID then V280_Input_TC_or_PT100_output_PWM_HSO_and_FB_PWM.vlp You can copy the ladder and use in the Samba. Good luck and keep us up to date. Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted August 18, 2016 MVP 2023 Report Share Posted August 18, 2016 Hi all,But in the original post isn't the problem that there is multi-step control needed? Are you suggesting consecutive separate PIDs, Hightech? Or is there a method of doing it all in one hit? I'm curious!As an aside, I don't do PID for any of my installs because in my instances the loadings vary wildly, and the feedback speed also has large variations. I tried it in the past and spent a lot of time tweaking things. I found that although I might get a small improvement in maintaining setpoint, what was actually happening was that the mechanicals involved were swinging wildly around to achieve it, thus wearing out far more quickly, which was a significant issue. For my stuff simple linearisations of outputs works best. But I am the first to admit that other people have far more knowledge about PID than I do!cheers,Aus 1 Link to comment Share on other sites More sharing options...
HigHTech Posted August 19, 2016 Report Share Posted August 19, 2016 Hi all, But in the original post isn't the problem that there is multi-step control needed? Are you suggesting consecutive separate PIDs, Hightech? Or is there a method of doing it all in one hit? I'm curious! As an aside, I don't do PID for any of my installs because in my instances the loadings vary wildly, and the feedback speed also has large variations. I tried it in the past and spent a lot of time tweaking things. I found that although I might get a small improvement in maintaining setpoint, what was actually happening was that the mechanicals involved were swinging wildly around to achieve it, thus wearing out far more quickly, which was a significant issue. For my stuff simple linearisations of outputs works best. But I am the first to admit that other people have far more knowledge about PID than I do! cheers, Aus I can identify the following steps: less than 1 V (PID OFF) Then you have 2 PID Run scenarios: 1<PV<4 4<PV< 10 Maybe we need more information about the system. But I would try to configure 2 PID FB Link to comment Share on other sites More sharing options...
PeterFukt Posted August 19, 2016 Author Report Share Posted August 19, 2016 Thanks for the tip HigHTech. I will try and use that example in my ladder. The application has changed a bit though. Instead of using a 0-10V input, a sensor will be used and a setpoint will be set. If the value is higher than the set point, the pulsing of the output begins. For example, if I have a P-band of 5 degrees, at 2,5 degrees, the pulses will be at a maximum and above that, another output gets activated and the pulsing starts over until 5 degrees above set point is reached. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now