Jesus,
The reason your simulations take so long to run is that you have some terms with infinite precision (Pi). If you numericise the transfer function it runs a thousand times faster.
ToDiscreteTimeModel[N[AffineSS], dt, z]
putting the third argument, z, means that you want the discrete variable to be "z"
The default conversion to digital is not stable unless you lower your time step. I got reasonable short duration results with
dt = 1/50/100000;
Your u2 definition does not agree with the continuous definition. It should be:
u2 = Table[0., {z, 0, np}];
The simulation takes a long time because we are using such a tiny time step to maintain stability. np =200,000 works and exactly matches the continuous data:
Show[ListPlot[SimuDT[[1, All]], DataRange -> {0, np*dt},
PlotStyle -> Red], Plot[SimuAffine[[1]], {t, 0, np*dt}]]
You should use more stable conversion options for ToDiscreteTimeModel[]. The options are put in like this: Method->"ForwardRectangularRule"
For example:
DTAffineSS =
ToDiscreteTimeModel[N[AffineSS], dt, z,
Method -> "ForwardRectangularRule"]
The options are
{"ForwardRectangularRule", "BackwardRectangularRule", "BilinearTransform", "ZeroOrderHold", "FirstOrderHold"}
Unfortunately, there seems to be a bug for all options except ForwardRectangularRule. I would report this to Wolfram. The other options should work (and be more stable allowing for a larger timestep)
I hope this helps.
Regards
Neil