Vocp1=Table[Piecewise[{{Vbatp1[[1]],t<100},{Vbatp1[[1]]-((Vbatp1[[1]]-Vbatp1[[1000]])/359) (t-100),100≤t≤458},{Vbatp1[[1000]]-(0.05/(999-458)) (t-458),t>458}}],{t,0,999}];

Vocp1=Table[Piecewise[{{Vbatp1[[1]],t<100},{Vbatp1[[1]]-((Vbatp1[[1]]-Vbatp1[[1000]]-0.05)/359) (t-100),100≤t≤458},{Vbatp1[[1000]]+0.03,t>458}}],{t,0,999}];

Vocp1s=Table[Piecewise[{{Vbatp1[[1]],t<100},{Vbatp1[[1]]-((Vbatp1[[1]]-Vbatp1[[1000]]-0.05)/359) (t-100),100≤t≤458},{Vbatp1[[1]]-(Vbatp1[[1]]-Vbatp1[[1000]]) ((1/(1+(E^((-(t-418))/50))))),t>458}}],{t,0,999}];

Vocp1s=Table[Piecewise[{{Vbatp1[[1]],t<100},{Vbatp1[[1]]-((Vbatp1[[1]]-Vbatp1[[1000]]-0.04)/359) (t-100),100≤t≤458},{Vbatp1[[1000]],t>458}}],{t,0,999}];

mtf=Rser+((Rl s Ltrans)/(Rl+s Ltrans))+(Rc/((Rc s Ctrans)+1))

mtfm=TransferFunctionModel[{{mtf}},s]

mdtm=ToDiscreteTimeModel[mtfm,1,z]

Manipulate[ListPlot[{If[Measured,Vbatp1],Vocp1-Flatten[OutputResponse[mdtm/.{Rser->a,Rl->b,Ltrans->c,Rc->d,Ctrans->e},Ibatp1k]
]},PlotRange->{{0,1000},{3.7,4.2}},GridLines->Automatic
],{{a,0.05,"Rser"},0,0.1},{{b,0.05,"Rl"},0,0.1},{{c,5,"Ltrans"},0,10},{{d,0.05,"Rc"},0,0.1},{{e,5000,"Ctrans"},0,10000},{{Measured,False},{True,False}}]