blockmass=30;

lengths=RandomReal[{0.9,1.1},{10}];
(*lengths=Table[1,{2}];*)

n=Length[lengths];

x[i_][t_]:=i+lengths[[i]]Sin[θ[i][t]]+xblock[t];

y[i_][t_]:=-lengths[[i]]Cos[θ[i][t]];

KE:=0.5Total[Table[(((x[i]'[t])^2)+((y[i]'[t])^2)),{i,n}]]+0.5blockmass ((xblock'[t])^2);

PE:=9.8Total[Table[y[i][t],{i,n}]];

fric=0.1;

power:=-fric(Total[Table[(((x[i]'[t])^2)+((y[i]'[t])^2)),{i,n}]]+((xblock'[t])^2));

θ0=30°;

power:=Total[Table[fric(1-(((θ[i][t])^2)/((θ0)^2)))(((x[i]'[t])^2)+((y[i]'[t])^2)),{i,n}]]-fric 0.0000001((xblock'[t])^2);

L:=KE-PE;

lagrange[x_]:=D[L,x[t]]-D[L,x'[t],t]+D[power,x'[t]]==0;

inits=RandomReal[{-30°,30°},{n}];
(*inits=Table[(((-1))^i)30°,{i,n}];*)

initvs=RandomReal[{-2,2},{n}];

(*initvs=Table[0,{n}];*)

diffeqs=lagrange/@Table[θ[i],{i,n}];

initeqs1=Thread[Table[θ[i][0],{i,n}]==inits];

initeqs2=Thread[Table[θ[i]'[0],{i,n}]==initvs];

blockeqns={lagrange[xblock],xblock[0]==0,xblock'[0]==((-1)/blockmass)Total[Table[lengths[[i]]Cos[inits[[i]]]initvs[[i]],{i,n}]]};

alleqs=Join[diffeqs,initeqs1,initeqs2,blockeqns];

sol=First[NDSolve[alleqs,Append[Table[θ[i],{i,n}],xblock],{t,0,tmax=200},MaxSteps->Infinity]]