I am not entirely sure if the title is the correct way to phrase what is occurring. There is a recurring process which I decided to attempt to model using production rules similar to those used in a context-free grammar.
The real world process is a production line. It takes 1 unit, after 2 weeks, produces 1 unit, after 4 weeks, that unit will produce another unit - and also 2 of the starting units. After 4 weeks the "another unit" will produce "that unit" - and also 3 of the starting units. This continues semi indefinitely, but the range I am looking at is roughly 52 weeks.
I came up with this model of production rules
$S\rightarrow A$
$A\rightarrow S^2B$
$B\rightarrow S^3A$
I attempted to expand this so that I could formulate a generating function and solve for n=52 (52 being the 1 year mark).
$S$,$A$,$S^2B$,$S^5A$,$S^7B$, ...
However, I was unable to determine if I was taking the correct approach to solving this situation. I believe that an error here lies in the fact that the duration of time is ignored. Namely that from $S\rightarrow A$ 2 weeks elapse, from $A\rightarrow S^2B$ 4 weeks elapse, and from $B\rightarrow S^3A$ 4 weeks elapse.
In order to better understand this situation, I decided to code an example so I could at least see the totals. However, it did not lend itself to producing a summation function.
So, given all this, how is it possible to come up with a summation function instead of having to manually iterate through it like this c# approach does? Or, is there a similar/alternate approach to modeling this which will allow an easier summation process?
Please feel free to correct any misunderstandings I may have.
edits
For example:
Week 1: We have 1 unit (S). It sits for 2 weeks until it is ready to become 1 of the next type(A).
Week 3: The first unit is now here. It sits for 4 weeks until it is ready to become 1 of the next type(A). At that time, it also becomes 2 of the first type(S).
Week 7: The unit from Week 3 has now become 2 of the first type of unit(S). It also created 1 of the second type(A). The 2 units of type S will now sit for 2 weeks until they make 2 units of type A. The 1 unit of type A will now sit for 4 weeks until it makes 1 unit of type B and 2 units of type S.
Week 9: The 2 units of type S from week 7 have now sat for 2 weeks. Now they have become 2 units of type A. These two units of type A will sit for 4 weeks and produce 4 units of type S and 2 units of type B.
Week 11: The 1 unit of type A from week 7 has now sat for 4 weeks and has now made 1 unit of type B and 2 units of type S. The 1 unit of type B will sit for 4 weeks and then make 1 unit of type A and 3 units of type S. The 2 units of type S will now sit for 2 weeks and make 2 units of type A.
Also, the 2 units of type S from week 9 have now sat for 2 weeks and become 2 units of type A. These two units will sit for 4 weeks and become 2 units of type B and will also become 6 units of type S.
etc.
This can perhaps be represented by a series of recurring relations
$s(n) = a(n) + b(n) + c(n)$
$a(n) = 2*b(n-4) + 3*c(n-4)$
$b(n) = a(n-2) + c(n-4)$
$c(n) = b(n-4)$
where
$s(n) = a(n) = b(n) = c(n) = 0$ for $n < 1$
$a(1) = 1$