The ports are just the points along the edges in this case, the percentages between 0 and 1 along the edge. The 10x10in squares have 1 port in the middle of each side.
Here are the steps written out:
Step 1: Find as many 10x10s you can fit (1, 2, 3, 4, etc) and make the ports as if the side was the multiple of ten to fit them (10, 20, 30, 40 respectively). If your cube number is an even number (2, 4, 6) Then follow the directions below
Step 2: Next, find the overhang on either side, for example if the side has an overhang of 3 on either side (26, 46, 66, etc). Take one side (3) and divide it by 2 to get 1.5.
Step 3: Divide that by your total side length (26 46, 66, etc) and make sure you keep this number! I will be referencing this number as "o".
Step 4: Take "o" and add it to all ports between 0 and 0.5 excluding the middlemost 2 ports (one left and one right) (for example, if you have 6 ports you would add "o" to ports 1 and 2).
Step 5: Next subtract "o" from all ports between 0.5 and 1 excluding the middlemost 2 ports (out of 6 ports you would subtract "o" from ports 5 and 6).
Step 6: Divide "o" by 2 and add that number to all ports between 0 and 0.5 including the middle left port, and subtract "o"/2 from all ports between 0.5 and 1 including the middle right port.
So for example, with 6 ports you would add "o"/2 to the first 3 and subtract "o"/2 from the last 3.
First, let's try following these directions for your example (large square 48, small ones 10), to make sure I understand.
1: 48 / 10 = 4, remainder 8, so we can fit 4. Then, if we fit 4 squares together into a total height of 40, their centers (relative to the top of the top one) will be at 5, 15, 25, 35. But it appears from your explanation of "ports" that they are represented not by actual distances but by fractions of the total length, so my distances have to be divided by 40, giving 1/8, 3/8, 5/8, and 7/8, which I guess you get as decimals: 0.125, 0.375, 0.625, 0.875.
2: Because our excess is 8, I think you are taking the "overhang on either side" as 4. But you seem to be dividing by 2 again. In my original example, starting with 43, I subtracted 43-40 to get 3, which I divided in half; the 3 was the total excess, not the overhang "on each side". You may be wrong here, in virtue of not having stated how to find the "overhang". Or maybe I'm misreading something.
3: I divide my 4 by 48 and get the decimal 0.083... . That is my "o". It can be dangerous to tell mathematically challenged people to work with non-terminating decimals like this, but I'll be okay.
4: Now I shift the top port(s) down this amount, the bottom one(s) up by the same amount, and then do something different to the middle ones. This is wrong; if you have initially placed them next to one another, then you want to move all of them the same amount, so they will still be together. You should just be adding "o" to all of them; if that doesn't work, then it means you calculated something wrong. In my example, we move the centers to 0.208333, 0.458333, 0.708333, and 0.958333. The resulting absolute positions will be these times 48, namely 10, 22, 34, and 46. Hmmm ... these are not adjacent, so they are spread out too far. So your "o" (or my version of it) is wrong. And that is probably because you are using percentages of 40 and applying them to 48, which stretches out the blocks themselves.
Let's start over. I would leave the percentages for last; I'm guessing that the reason you want to start and end with percentages is that you already have some technique for finding the centers as percentages, and want to use that. I wouldn't. Here's my procedure:
I found that my blocks have to move 4 inches (half of the total excess); and I found the centers before that move to be 5, 15, 25, 35. So I just add 4 to each: 9, 19, 29, 39. Now, since you want to express these as percentages of the 48, we divide those by 48 and get 0.1875, 0.3958, 0.6042, 0.8125. Note that these differ by 0.208333, which corresponds to 10 inches, so they are adjacent.