Shuffle Logic for analog input and four digital output

Thread Starter

Jilson Jose

Joined May 22, 2016
3
Hello,

I have been trying to find a possible way to build an application to shuffle 4 outputs using logic gates.
Input is analog value that from 1-4 and based on each value,each output should be turned on.
at the same time it should be shuffled. (it could be in any random order )

Thank you
 

WBahn

Joined Mar 31, 2012
29,978
You need to describe what you want in better detail.

When you say that your input is an analog value from 1 to 4, 1 to 4 what? Volts? If so, there is not "each value", it's analog. What do you want to happen when the input is 2.427 V, for instance?

Then what does it mean for "each output should be turned on"?

As best I can tell, as the input rises you first want one of the four outputs to be on, then two, then three, then all four, with the specific outputs being seemingly random. Is that close?
 

MisterBill2

Joined Jan 23, 2018
18,170
You need to describe what you want in better detail.

When you say that your input is an analog value from 1 to 4, 1 to 4 what? Volts? If so, there is not "each value", it's analog. What do you want to happen when the input is 2.427 V, for instance?

Then what does it mean for "each output should be turned on"?

As best I can tell, as the input rises you first want one of the four outputs to be on, then two, then three, then all four, with the specific outputs being seemingly random. Is that close?
The description of the desired function certainly is inadequate. A bar-graph driver IC could provide the sequential selection as the voltage rises, but not in a random manner. So a much clearer description of the actual desired function is needed before any correct advice is possible.
 

Thread Starter

Jilson Jose

Joined May 22, 2016
3
You need to describe what you want in better detail.

When you say that your input is an analog value from 1 to 4, 1 to 4 what? Volts? If so, there is not "each value", it's analog. What do you want to happen when the input is 2.427 V, for instance?

Then what does it mean for "each output should be turned on"?

As best I can tell, as the input rises you first want one of the four outputs to be on, then two, then three, then all four, with the specific outputs being seemingly random. Is that close?
Problem:

The function of this is to turn on four heat pumps based on heating stage count.

An application (Degree Minutes) determines the requirement for heating need and there are 4 heating stages since there are 4 heat pumps.

Initially if there is a heating need, the DM app will give an Int value 1 and one heat pump is turned on.

If one HP can’t reach the set point, the Degree Minute application will give value 2 based on which the two HP should be turned on and will be trying to reach the set point and the same goes with 3rd and 4th heating stages.

When 4 HP’s are working and there is an overshoot, the DM will goes to 3rd heating stages, during which only 3 HP would be working.

If they are switch on in sequentially, there would be irregular working hrs on HP’s so to overcome this issue the whole process should be able to shuffle the working of heat pump in such a way that, heat pumps will have roughly same working hours.


Whole process should be done using logic gate as the PLC uses Functional Block Diagram
 

Thread Starter

Jilson Jose

Joined May 22, 2016
3
The description of the desired function certainly is inadequate. A bar-graph driver IC could provide the sequential selection as the voltage rises, but not in a random manner. So a much clearer description of the actual desired function is needed before any correct advice is possible.
Problem:

The function of this is to turn on four heat pumps based on heating stage count.

An application (Degree Minutes) determines the requirement for heating need and there are 4 heating stages since there are 4 heat pumps.

Initially if there is a heating need, the DM app will give an Int value 1 and one heat pump is turned on.

If one HP can’t reach the set point, the Degree Minute application will give value 2 based on which the two HP should be turned on and will be trying to reach the set point and the same goes with 3rd and 4th heating stages.
 

WBahn

Joined Mar 31, 2012
29,978
So where is this analog value coming from?

Why can't you work with the integer value that the DM produces?

How often does your DM produce a value?

How often do you want the assignments to change?

Why can't you put the necessary logic in the functional diagram of your PLC?

Conceptually, just set the number of bits you need in a nibble (4-bit value) and then rotate then shift them by an amount that increments at each activation.

An easy way to do this is something like the following:

Code:
unsigned byte onMap[5] = {0x00, 0x11, 0x33, 0x77, 0xFF};

unsigned byte shift = 0;

unsigned byte DMvalue;

unsigned byte HPcommand;

while (TRUE)
{
   DMvalue = getDMValue()
   HPcommand = onMap[DMValue] >> shift;
   if (timeToRemap())
      shift = (shift + 1) & 3;
}

There are lots of ways to do this, including using interrupts instead of the polling approach shown above.

The lowest four bits of the HPcommand value are the signals to turn on the four heat pumps.

By just shifting the assignments incrementally, each pump's usage should average out the same as with random assignments.
 
Top