Posts: 26
Threads: 9
Joined: Nov 2015
Reputation:
0
Hello,
I would like to convert a numeric (percentage) to 3 digital outputs (group addresses). For example i want to make the first DO to be 1 when the percentage is between 5-30%, the second between 35-70% and the third between 75-100%.
I want this to control o fcu.
Is there any idea how to do this.
Thank you
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
You have gaps between 30..35 and 70..75. Is this intended? Do you want to have hysteresis between these values?
Posts: 26
Threads: 9
Joined: Nov 2015
Reputation:
0
i have gaps, because i want to ensure that the digital outputs will never be energized simultaneously.
Hysterisis is a good idea.
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
I would improve this a bit as now you can have (shortly) 2 high contacts..
First write to false before writing anything to true (5-30% and 35-70% are not doing that)
Even a better way to do this is to have a “switch on” delay in the ETS application so you have a second pauze before a contact is closed.
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
I would not use os.sleep in this script as you can have weird behavior when the input value is changed within a second (script can run in paralell), use 1 second “on delay” in the application of your actuator.
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
It should be fine if the % value probably comes from a PID script where control value is sent every X seconds.