{"id":3529,"date":"2025-04-18T11:32:23","date_gmt":"2025-04-18T11:32:23","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3529"},"modified":"2025-06-10T11:52:04","modified_gmt":"2025-06-10T11:52:04","slug":"pid-theory-the-control-model","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/","title":{"rendered":"PID theory: The control model"},"content":{"rendered":"\n<p>The actual PID controller is implemented in a SPLat (or any other digital controller) as a bunch of numerical calculations. There are several ways of performing the necessary calculations, depending on the exact &#8220;circuit configuration&#8221; your program is emulating. The program we use implements the configuration in the diagram.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"191\" src=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif\" alt=\"\" class=\"wp-image-3530\"\/><\/figure>\n\n\n\n<p>In this diagram the circles represents summations or subtractions. Hence the left-hand circle calculates the setpoint minus the process feedback minus the derivative to produce an error signal. Arguably the derivative should be subtracted in the righthand &#8220;summer&#8221;, but this way produces slightly simpler code and works just as well. The error is multiplied by Ap (proportional gain) in the green box and integrated in the yellow box, then the two are added together to produce the final controller output.<\/p>\n\n\n\n<p>In the actual programs the derivative is calculated in slightly round-about way. Instead of calculating the difference between successive input samples (which would be the &#8220;natural&#8221; way of doing it), we put the input through one of the time constant calculations we have been studying earlier, to calculate a moving average, then subtract that from the direct input to get the derivative. For this reason the differentiator has an associated time constant Td (&#8216;Derivative time&#8217;) as well as a gain setting Ad.<\/p>\n\n\n\n<p>The integrator is implemented as an ongoing adding up of the error at each sample, times a scaling factor. The factor specifying integral is &#8216;Integral time&#8217; &#8211; Ti &#8211; which is the time it takes for the output to ramp an amount equal to the prevailing controller error.<\/p>\n\n\n\n<p>The error amplifier is just a multiplication by Ap.<\/p>\n\n\n\n<p>The calculation, performed each sampling interval, goes like this:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Let Kd = the factor required to get a time constant of Td<\/li>\n\n\n\n<li>Call the process feedback &#8220;Input&#8221;<\/li>\n<\/ul>\n\n\n\n<p>Then:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>New_LPFin = Old_LPFin * (1-Kd) + Input * Kd (this is the moving average of the input, which in electronics parlance is the input lowpass filtered.<\/li>\n\n\n\n<li>Derivative = Input &#8211; New_LPFin<\/li>\n\n\n\n<li>Old_LPFin = New_LPFin (for next time)<\/li>\n\n\n\n<li>Error = SetPoint &#8211; Input &#8211; Derivative * Ad<\/li>\n\n\n\n<li>Integral = Integral + Error<\/li>\n\n\n\n<li>Output = Error * Ap + Integral<\/li>\n<\/ol>\n\n\n\n<p>In practice, there is one other wrinkle. In our code we limit the range of integral values to the valid range of output values (the integrator is designed to &#8220;saturate&#8221;). This combats &#8220;<a href=\"http:\/\/www.google.com\/search?hl=en&amp;lr=&amp;ie=UTF-8&amp;safe=off&amp;q=integrator+wind+up&amp;spell=1\">integrator windup<\/a>&#8220;, where the integrator can build up excessive values if the process is slow to respond due to saturation elsewhere.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The actual PID controller is implemented in a SPLat (or any other digital controller) as a bunch of numerical calculations. There are several ways of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3516,"menu_order":8,"template":"","class_list":["post-3529","spl_knowledgebase","type-spl_knowledgebase","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PID theory: The control model - SPLat Controls<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PID theory: The control model - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"The actual PID controller is implemented in a SPLat (or any other digital controller) as a bunch of numerical calculations. There are several ways of...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T11:52:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"500\" \/>\n\t<meta property=\"og:image:height\" content=\"191\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/\",\"name\":\"PID theory: The control model - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif\",\"datePublished\":\"2025-04-18T11:32:23+00:00\",\"dateModified\":\"2025-06-10T11:52:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#primaryimage\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif\",\"contentUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif\",\"width\":500,\"height\":191},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials, application notes and white papers\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Tutorial: PID control with SPLat\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"PID control: Theory\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"PID theory: The control model\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"name\":\"SPLat Controls\",\"description\":\"OEM Embedded Machine Controllers\",\"publisher\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\",\"name\":\"SPLat Controls\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"contentUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"caption\":\"SPLat Controls\"},\"image\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PID theory: The control model - SPLat Controls","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"PID theory: The control model - SPLat Controls","og_description":"The actual PID controller is implemented in a SPLat (or any other digital controller) as a bunch of numerical calculations. There are several ways of...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T11:52:04+00:00","og_image":[{"width":500,"height":191,"url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif","type":"image\/gif"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/","name":"PID theory: The control model - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#primaryimage"},"image":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#primaryimage"},"thumbnailUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif","datePublished":"2025-04-18T11:32:23+00:00","dateModified":"2025-06-10T11:52:04+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#primaryimage","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif","contentUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2025\/04\/The-control-model.gif","width":500,"height":191},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/pid-theory-the-control-model\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Tutorials, application notes and white papers","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/"},{"@type":"ListItem","position":3,"name":"Tutorial: PID control with SPLat","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/"},{"@type":"ListItem","position":4,"name":"PID control: Theory","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-pid-control-with-splat\/pid-control-theory\/"},{"@type":"ListItem","position":5,"name":"PID theory: The control model"}]},{"@type":"WebSite","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","name":"SPLat Controls","description":"OEM Embedded Machine Controllers","publisher":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization","name":"SPLat Controls","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","contentUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","caption":"SPLat Controls"},"image":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase"}],"about":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/types\/spl_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/users\/1"}],"up":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3516"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}