Help needed with comparing inputs using msg.topic

I have a system where there are 8 inlet pressure measurements from 8 different channels. In my system, I am trying to maintain the pressure in a range using hysteresis.

Here, I want the compressor to switch on even if one of 8 pressure measurement drop below a certain value (say 0.2 bar). But, I tried to connect the one output to the compressor from each input. Then realized that multiple inputs from my 8 channels are to be in a OR function to run the compressor even if one of the pressure channels are below pressure.

How can I separate the hysteresis output from each of the 8 channels to get an output turn on even if one of the pressure falls below?

I tried using msg.topic but I am making some mistake as I couldn't compare the topics.

8 channels read pressure - 8 hysteresis loops for each channel - write the output (switch on) the compressor even when one value is below set point.

I assume you receive 8 different messages, node-red handles a single message at a time, you can combine the messages using a join node. Or use context to keep track of all values and compare.

1 Like

I used global context to assign the output to a varuiable and used it for control. Thank you.

But when I use join node to form an array of the 8 inputs, how can I check if at least one of the input is 1 or ON??

Don't use array mode on the join node, use key/value mode. Then it's a simple case of logic in a function node.

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

https://nodered.org/docs/user-guide/messages

If you already have the 8 channels and 8 hysteresis nodes set to provide a 1 if they need to be switched on then you don't need anything fancy, as any node outputting a 1 should be aa signal to act - not matter where it comes from... so just wire all of them into a node that just looks for a 1... or am I missing something ?

1 Like

Possibly there needs to be a way of getting back to zero again when none of the inputs is on.

Presumably you would run for a timeout. You wouldn’t want to oscillate a compressor on/off around a set point

Hence the hysteresis nodes.

1 Like

Ithank you very much for the replies. Though I found a method, I happen to have better understand on how to improve it.

I thought having multiple inputs to one node to switch on the compressor might have contradicting signal. When I instead of having one particular output node, had 8 separate nodes that pointed to my compressor, it got on for one second or so and switched off later.

This is something that can be avoided if I have one compressor node and 8 inputs going to it (instead of 8 comp, and 8 nodes)?

I don't understand what you mean. Can you post the flow for what you have so far please so that I can better understand? So from the pressure inputs through to the compressor output. See this post for how to post your flow - How to share code or flow json

I could not reply to you as I had met with an accident and was not able to work!

Thank you for answering anyways and I found that my flow had an issue may be due to the node red version of it (v0.17.5).

Multiple inputs with opposite values for eg: 0 and 1 are the inputs to the particular node with operates the blower in my system. But, when varying inputs are given, the blower shuts off after starting for a second or so. So, I used a function with OR statement to give me an output of either 0 or 1.

[{"id":"79df6e65.866f","type":"function","z":"eda27e78.828a9","name":"OR from Inputs","func":"var A71  = global.get('A71');\n\nvar A72  = global.get('A72');\n\nvar A73  = global.get('A73');\n\nvar A50  = global.get('A50');\n\nvar A51  = global.get('A51');\n\nvar A30  = global.get('A30');\n\nvar A31  = global.get('A31');\n\nvar A32  = global.get('A32');\n\nif (A71 == 1 || A72 == 1 || A73 == 1 || A51 == 1 || A50 == 1 || A30 == 1 || A31 == 1 || A32 == 1 ){\n    msg.payload=1;\n}\nreturn msg;","outputs":1,"noerr":0,"x":470.00006103515625,"y":2744.5002641677856,"wires":[["6af1ce00.8678e4"]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.