Jump to content
PeterFukt

Variable output on/off-time depending on analog input

Recommended Posts

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!

 

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

  • Upvote 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

  • Upvote 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...