Skip to content

Commit

Permalink
change comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ayoub LABIDI <[email protected]>
  • Loading branch information
ayolab committed Jul 12, 2024
1 parent b67f72c commit 1ff94b6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/components/diagrams/diagram-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,31 @@ export const makeDiagramSorter = (diagramStates) => {
return (a, b) => sortByAlign(a, b) || sortByIndex(a, b, diagramStates);
};

const VL_DEPTH_GROWTH_RATE = 2;
// estimate the number of voltage levels for a requested depth
// based on the current depth and the previous number of voltage levels
// this allows the user to increase the depth quickly without having to wait
// for the actual number of voltage levels at each step but
// to avoid increasing the depth too much.
// we want this estimation to be slightly pessimistic to avoid bad UX of going to far
// and not being able to do the same thing step by step.
const VL_DEPTH_GROWTH_RATE = 2;
export function getEstimatedNbVoltageLevels(
currentDepth,
requestedDepth,
previousVoltagesNB
) {
// The coefficients are based on some tests and are not based on any scientific method.
// We assume that the number of vl grows exponentially
// real world exemple :
// depth : number of voltage levels
// 1 : 3
// 2 : 7
// 3 : 13
// 4 : 28
// 5 : 37
// 6 : 51
// 7 : 80
// 8 : 138
// 9 : 221
return (
previousVoltagesNB *
Math.pow(VL_DEPTH_GROWTH_RATE, requestedDepth - currentDepth)
Expand Down

0 comments on commit 1ff94b6

Please sign in to comment.