feat: Enhance diversity factor calculation with comprehensive lookup table in ObjectFlowDesigner

This commit is contained in:
2025-06-27 10:53:09 +02:00
parent 9e046f9fa2
commit a9dd3111df

View File

@@ -1844,9 +1844,52 @@ class ObjectFlowDesigner {
// Get diversity factor based on total number of consumers
getDiversityFactor(totalConsumers) {
if (totalConsumers === 1) return 1.0; // 100%
if (totalConsumers === 2) return 0.59; // 59%
return 0.45; // 45% for 3+
// Diversity factor lookup table - based on electrical engineering standards
const diversityFactors = {
1: 1.0,
2: 0.59,
3: 0.45,
4: 0.38,
5: 0.34,
6: 0.31,
7: 0.29,
8: 0.27,
9: 0.26,
10: 0.25,
11: 0.232,
12: 0.217,
13: 0.208,
14: 0.193,
15: 0.183,
16: 0.175,
17: 0.168,
18: 0.161,
19: 0.155,
20: 0.15,
21: 0.145,
22: 0.141,
23: 0.137,
24: 0.133,
25: 0.13,
26: 0.127,
27: 0.124,
28: 0.121,
29: 0.119,
30: 0.117,
31: 0.115,
32: 0.113,
33: 0.111,
34: 0.109,
35: 0.107,
36: 0.105,
37: 0.104,
38: 0.103,
39: 0.101,
40: 0.1,
};
// Return the specific factor or default to 0.1 (10%) for >40 consumers
return diversityFactors[totalConsumers] || 0.1;
}
// Calculate total number of consumers downstream from a node