This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

DALI percentage to byte
#1
Hi,

I'm using your DALI RS485 gateway and I'm setting percentages through KNX objects (scale).

Scale goes from 0-100%, which in byte is 0-255 (00-FF). So 50% = 127 (or 128).

However, it doesn't seem like DALI is using a proportional dimming curve. When I open DALI Cockpit, which I use to program addresses on DALI networks, there's an option to send commands manually. When I opt to send a dimming value, I can select either byte value (0-255) og percentage (0-100%). However, when I increment the byte value, it doesn't increment the percentage proportionally. You can see the dimming curve at the bottom of this post. The 255 (FF) value is invalid dimming value in DALI.

Basically, the first 10 byte values (0-10) varies from 0-0.128%, but the last 10 (244-254) varies from 76.11-100%.


So whenever I write the code underneath, I'm not actually setting the lamp to 50%, but 3,12%. Is this a correct assumption? Or are you guys doing the math inside the user.dali script?
 
Code:
dalicmd('internal', 'arc', { addrtype = 'broadcast', value = 127 })

This is the code example inside your DALI RS485 manual: 

Code:
require('user.dali')
value = event.getvalue()
value = math.floor(value * 2.54)
dalicmd('internal', 'arc', { addrtype = 'group', address = 7, value = value })

50% * 2.54 = 127. So are you guys converting 127 to 229 for DALI's dimming profile (229 = 50,53%)?

Code:
| Byte | HEX | Percentage |
|------|-----|------------|
| 0    | 00  | 0%         |
| 1    | 01  | 0.1%       |
| 2    | 02  | 0.103%     |
| 3    | 03  | 0.106%     |
| 4    | 04  | 0.109%     |
| 5    | 05  | 0.112%     |
| 6    | 06  | 0.115%     |
| 7    | 07  | 0.118%     |
| 8    | 08  | 0.121%     |
| 9    | 09  | 0.124%     |
| 10   | 0A  | 0.128%     |
| 11   | 0B  | 0.131%     |
| 12   | 0C  | 0.135%     |
| 13   | 0D  | 0.139%     |
| 14   | 0E  | 0.143%     |
| 15   | 0F  | 0.147%     |
| 16   | 10  | 0.151%     |
| 17   | 11  | 0.155%     |
| 18   | 12  | 0.159%     |
| 19   | 13  | 0.163%     |
| 20   | 14  | 0.168%     |
| 21   | 15  | 0.173%     |
| 22   | 16  | 0.177%     |
| 23   | 17  | 0.182%     |
| 24   | 18  | 0.187%     |
| 25   | 19  | 0.193%     |
| 26   | 1A  | 0.198%     |
| 27   | 1B  | 0.203%     |
| 28   | 1C  | 0.209%     |
| 29   | 1D  | 0.215%     |
| 30   | 1E  | 0.221%     |
| 31   | 1F  | 0.227%     |
| 32   | 20  | 0.233%     |
| 33   | 21  | 0.24%      |
| 34   | 22  | 0.246%     |
| 35   | 23  | 0.253%     |
| 36   | 24  | 0.26%      |
| 37   | 25  | 0.267%     |
| 38   | 26  | 0.275%     |
| 39   | 27  | 0.282%     |
| 40   | 28  | 0.29%      |
| 41   | 29  | 0.298%     |
| 42   | 2A  | 0.306%     |
| 43   | 2B  | 0.315%     |
| 44   | 2C  | 0.324%     |
| 45   | 2D  | 0.332%     |
| 46   | 2E  | 0.342%     |
| 47   | 2F  | 0.351%     |
| 48   | 30  | 0.361%     |
| 49   | 31  | 0.371%     |
| 50   | 32  | 0.381%     |
| 51   | 33  | 0.392%     |
| 52   | 34  | 0.402%     |
| 53   | 35  | 0.414%     |
| 54   | 36  | 0.425%     |
| 55   | 37  | 0.437%     |
| 56   | 38  | 0.449%     |
| 57   | 39  | 0.461%     |
| 58   | 3A  | 0.474%     |
| 59   | 3B  | 0.487%     |
| 60   | 3C  | 0.501%     |
| 61   | 3D  | 0.515%     |
| 62   | 3E  | 0.529%     |
| 63   | 3F  | 0.543%     |
| 64   | 40  | 0.559%     |
| 65   | 41  | 0.574%     |
| 66   | 42  | 0.59%      |
| 67   | 43  | 0.606%     |
| 68   | 44  | 0.623%     |
| 69   | 45  | 0.64%      |
| 70   | 46  | 0.658%     |
| 71   | 47  | 0.676%     |
| 72   | 48  | 0.695%     |
| 73   | 49  | 0.714%     |
| 74   | 4A  | 0.734%     |
| 75   | 4B  | 0.754%     |
| 76   | 4C  | 0.775%     |
| 77   | 4D  | 0.796%     |
| 78   | 4E  | 0.819%     |
| 79   | 4F  | 0.841%     |
| 80   | 50  | 0.864%     |
| 81   | 51  | 0.888%     |
| 82   | 52  | 0.913%     |
| 83   | 53  | 0.938%     |
| 84   | 54  | 0.964%     |
| 85   | 55  | 0.991%     |
| 86   | 56  | 1.018%     |
| 87   | 57  | 1.047%     |
| 88   | 58  | 1.076%     |
| 89   | 59  | 1.105%     |
| 90   | 5A  | 1.136%     |
| 91   | 5B  | 1.167%     |
| 92   | 5C  | 1.2%       |
| 93   | 5D  | 1.233%     |
| 94   | 5E  | 1.267%     |
| 95   | 5F  | 1.302%     |
| 96   | 60  | 1.338%     |
| 97   | 61  | 1.375%     |
| 98   | 62  | 1.413%     |
| 99   | 63  | 1.452%     |
| 100  | 64  | 1.492%     |
| 101  | 65  | 1.534%     |
| 102  | 66  | 1.576%     |
| 103  | 67  | 1.62%      |
| 104  | 68  | 1.665%     |
| 105  | 69  | 1.711%     |
| 106  | 6A  | 1.758%     |
| 107  | 6B  | 1.807%     |
| 108  | 6C  | 1.857%     |
| 109  | 6D  | 1.908%     |
| 110  | 6E  | 1.961%     |
| 111  | 6F  | 2.02%      |
| 112  | 70  | 2.07%      |
| 113  | 71  | 2.13%      |
| 114  | 72  | 2.19%      |
| 115  | 73  | 2.25%      |
| 116  | 74  | 2.31%      |
| 117  | 75  | 2.37%      |
| 118  | 76  | 2.44%      |
| 119  | 77  | 2.51%      |
| 120  | 78  | 2.58%      |
| 121  | 79  | 2.65%      |
| 122  | 7A  | 2.72%      |
| 123  | 7B  | 2.8%       |
| 124  | 7C  | 2.87%      |
| 125  | 7D  | 2.95%      |
| 126  | 7E  | 3.04%      |
| 127  | 7F  | 3.12%      |
| 128  | 80  | 3.21%      |
| 129  | 81  | 3.29%      |
| 130  | 82  | 3.39%      |
| 131  | 83  | 3.48%      |
| 132  | 84  | 3.58%      |
| 133  | 85  | 3.67%      |
| 134  | 86  | 3.78%      |
| 135  | 87  | 3.88%      |
| 136  | 88  | 3.99%      |
| 137  | 89  | 4.1%       |
| 138  | 8A  | 4.21%      |
| 139  | 8B  | 4.33%      |
| 140  | 8C  | 4.45%      |
| 141  | 8D  | 4.57%      |
| 142  | 8E  | 4.7%       |
| 143  | 8F  | 4.83%      |
| 144  | 90  | 4.96%      |
| 145  | 91  | 5.1%       |
| 146  | 92  | 5.24%      |
| 147  | 93  | 5.39%      |
| 148  | 94  | 5.53%      |
| 149  | 95  | 5.69%      |
| 150  | 96  | 5.85%      |
| 151  | 97  | 6.01%      |
| 152  | 98  | 6.17%      |
| 153  | 99  | 6.34%      |
| 154  | 9A  | 6.52%      |
| 155  | 9B  | 6.7%       |
| 156  | 9C  | 6.89%      |
| 157  | 9D  | 7.08%      |
| 158  | 9E  | 7.27%      |
| 159  | 9F  | 7.47%      |
| 160  | A0  | 7.68%      |
| 161  | A1  | 7.89%      |
| 162  | A2  | 8.11%      |
| 163  | A3  | 8.34%      |
| 164  | A4  | 8.57%      |
| 165  | A5  | 8.8%       |
| 166  | A6  | 9.05%      |
| 167  | A7  | 9.3%       |
| 168  | A8  | 9.56%      |
| 169  | A9  | 9.82%      |
| 170  | AA  | 10.09%     |
| 171  | AB  | 10.37%     |
| 172  | AC  | 10.66%     |
| 173  | AD  | 10.95%     |
| 174  | AE  | 11.26%     |
| 175  | AF  | 11.57%     |
| 176  | B0  | 11.89%     |
| 177  | B1  | 12.22%     |
| 178  | B2  | 12.55%     |
| 179  | B3  | 12.9%      |
| 180  | B4  | 13.26%     |
| 181  | B5  | 13.63%     |
| 182  | B6  | 14%        |
| 183  | B7  | 14.39%     |
| 184  | B8  | 14.79%     |
| 185  | B9  | 15.2%      |
| 186  | BA  | 15.62%     |
| 187  | BB  | 16.05%     |
| 188  | BC  | 16.5%      |
| 189  | BD  | 16.95%     |
| 190  | BE  | 17.42%     |
| 191  | BF  | 17.9%      |
| 192  | C0  | 18.4%      |
| 193  | C1  | 18.91%     |
| 194  | C2  | 19.43%     |
| 195  | C3  | 19.97%     |
| 196  | C4  | 20.52%     |
| 197  | C5  | 21.09%     |
| 198  | C6  | 21.68%     |
| 199  | C7  | 22.28%     |
| 200  | C8  | 22.89%     |
| 201  | C9  | 23.53%     |
| 202  | CA  | 24.18%     |
| 203  | CB  | 24.85%     |
| 204  | CC  | 25.53%     |
| 205  | CD  | 26.24%     |
| 206  | CE  | 26.97%     |
| 207  | CF  | 27.71%     |
| 208  | D0  | 28.48%     |
| 209  | D1  | 29.27%     |
| 210  | D2  | 30.08%     |
| 211  | D3  | 30.91%     |
| 212  | D4  | 31.77%     |
| 213  | D5  | 32.65%     |
| 214  | D6  | 33.55%     |
| 215  | D7  | 34.48%     |
| 216  | D8  | 35.43%     |
| 217  | D9  | 36.41%     |
| 218  | DA  | 37.42%     |
| 219  | DB  | 38.46%     |
| 220  | DC  | 39.52%     |
| 221  | DD  | 40.62%     |
| 222  | DE  | 41.74%     |
| 223  | DF  | 42.9%      |
| 224  | E0  | 44.08%     |
| 225  | E1  | 45.3%      |
| 226  | E2  | 46.56%     |
| 227  | E3  | 47.85%     |
| 228  | E4  | 49.17%     |
| 229  | E5  | 50.53%     |
| 230  | E6  | 51.93%     |
| 231  | E7  | 53.37%     |
| 232  | E8  | 54.84%     |
| 233  | E9  | 56.36%     |
| 234  | EA  | 57.92%     |
| 235  | EB  | 59.53%     |
| 236  | EC  | 61.17%     |
| 237  | ED  | 62.87%     |
| 238  | EE  | 64.61%     |
| 239  | EF  | 66.39%     |
| 240  | F0  | 68.23%     |
| 241  | F1  | 70.12%     |
| 242  | F2  | 72.06%     |
| 243  | F3  | 74.06%     |
| 244  | F4  | 76.11%     |
| 245  | F5  | 78.21%     |
| 246  | F6  | 80.38%     |
| 247  | F7  | 82.6%      |
| 248  | F8  | 84.89%     |
| 249  | F9  | 87.24%     |
| 250  | FA  | 89.65%     |
| 251  | FB  | 92.14%     |
| 252  | FC  | 94.69%     |
| 253  | FD  | 97.31%     |
| 254  | FE  | 100%       |
Reply
#2
5.001 scale object is stored as 0..255 internally so the value is sent as is with the maximum being limited to 254.
The percentage values that you've specified is the actual dimming curve that the ballast should produce. No extra calculation is needed on the control side.
Note that some ballasts have a high physical minimum dimming value so the whole range cannot be used. For RS485 gateways a script can be used to skip the lower range. For CANx-DALI this is built into the app: https://forum.logicmachine.net/showthread.php?tid=3671
Reply
#3
(27.01.2022, 07:47)admin Wrote: 5.001 scale object is stored as 0..255 internally so the value is sent as is with the maximum being limited to 254.
The percentage values that you've specified is the actual dimming curve that the ballast should produce. No extra calculation is needed on the control side.
Note that some ballasts have a high physical minimum dimming value so the whole range cannot be used. For RS485 gateways a script can be used to skip the lower range. For CANx-DALI this is built into the app: https://forum.logicmachine.net/showthread.php?tid=3671

So my statement that sending 127 as value through dalicmd() will put the dimming value to 3.12% on the lamp - without any manipulation through a script - is correct? Supposing that the lamp can handle this percentage.

In order to effectively set the lamp to 50% I'd need to send 229 as value?
Reply


Forum Jump: