PID a control of a simple plant- Code issue

Greetings all,
I am trying to simulate a simple plant by verifying the out of the plant when controlled with a PID controller The plant is 1/s(s+1). I
converted it in the z-domain. Then, designed a Gc(z) as 9.15*(z-.9802)/(z-.8187). The closeloop step response of the system gives satisfactory results. But when I run it in simulink with my s-function, I don't get the same results. I tryed looking over every line of my code, but I am not able to the discrepancy.
I'd appreciate your help, thanks in advace.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
bxa132203 wrote:

Your problem may be , when you discretizing the continuouse-time PID controller to a discrete-time controller, the approximation is too bigger.
In fact, you have designed a Sampled-data control system where the continous-time plant controlled by a digital controller, a lots of paper have pointed out the so called analog design method which you adopted may a poor method. So you can design the controller using another method ,and you may be get the desired result.
Alternative method: You can adjust the sampling period in the matlab MDL file, perhaps, you can derive the right result.
Good luck to you !
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
bxa132203 wrote:

How did you convert it to the z domain?
What was your result?
What sampling rate are you using?
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.