Misspecified model

What do you mean with time to build? In Kydland/Prescott’s paper it refers to a lag larger than one period.

Usually, you have a law of motion and a production function

k=(1-delta)*k(-1)+i; y=k(-1)^alpha*l^(1-alpha);
In this case, capital is predetermined. It gets the timing when it is determined by investment. However, production takes place using the capital determined in last period.

In your code, you have something like

suggesting housing is predetermined. However, if you have two housing stocks that are predetermined (a law of motion for each) and you define an aggregate housing stock H to be able to plot it, H is just a definition and thus gets a contemporaneous timing. At time t it is the sum of the the two predetermined stocks.

Note also that it is different, if you only assume one capital stock that can be divided into two within the period: [Timing of capital in two sector economy)