<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Sagatowski GmbH</title>
    <link>https://www.sagatowski.com/</link>
    <description>Recent content on Sagatowski GmbH</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 16 Dec 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.sagatowski.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>CODESYS is not open-source</title>
      <link>https://www.sagatowski.com/posts/codesys_is_not_open_source/</link>
      <pubDate>Tue, 16 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/codesys_is_not_open_source/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/2025_12_16_codesys_is_not_open_source.png&#34; alt=&#34;2025_12_16_codesys_is_not_open_source.png&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;From time to time I see posts and comments on the web saying that CODESYS is open-source.&#xA;Normally I ignore making corrections, but last week something weird happened.&#xA;We were involved in a bidding for a contract, where the buyer selected an integrator which of one of the selection criteria for the other system was that they used the open-source IDE/runtime CODESYS.&#xA;It didn&amp;rsquo;t say open.&#xA;It said &lt;strong&gt;open-source&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Soccer Goalie vs. Cristiano Ronaldo</title>
      <link>https://www.sagatowski.com/posts/soccer_goalie_vs_cristiano_ronaldo/</link>
      <pubDate>Fri, 28 Nov 2025 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/soccer_goalie_vs_cristiano_ronaldo/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/mark_rober_and_christiano_ronaldo.jpg&#34; alt=&#34;mark_rober_and_christiano_ronaldo.jpg&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Imagine my surprise when I was asked to help with building a robot supposed to play against five times FIFA player of the year &lt;a href=&#34;https://en.wikipedia.org/wiki/Cristiano_Ronaldo&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cristiano Ronaldo&lt;/a&gt;!&#xA;One of the world&amp;rsquo;s biggest YouTubers &lt;a href=&#34;https://en.wikipedia.org/wiki/Mark_Rober&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Mark Rober&lt;/a&gt; and his team asked me if I could help them with software development of a soccer goalie robot.&#xA;The question that posed itself was whether one of the best football players in the world has any chance against an industrial automation system.&#xA;Back in 1997 the super computer &amp;ldquo;Deep Blue&amp;rdquo; was the first to &lt;a href=&#34;https://en.wikipedia.org/wiki/Deep_Blue_versus_Garry_Kasparov&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;beat a world class chess master (Kasparov)&lt;/a&gt;.&#xA;In 2025, a PLC together with a motion capture system and some powerful drives had a challenge against a world class football player, Ronaldo.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Windows 10 retires. What now?</title>
      <link>https://www.sagatowski.com/posts/windows10_retires/</link>
      <pubDate>Tue, 14 Oct 2025 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/windows10_retires/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/2025_10_14_windows_10_eol.jpg&#34; alt=&#34;2025_10_14_windows_10_eol&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Windows 10 was released back in 29th of July 2015.&#xA;Today, more than 10 years after the release, Windows 10 officially retires as it will stop receiving security updates from Microsoft.&#xA;This means that any discovered vulnerabilities will not be patched, making a system running Windows 10 vulnerable for various kinds of attacks as time progresses.&#xA;What impact does it have on me as a Beckhoff/TwinCAT PLC user?&lt;/p&gt;&#xA;&lt;p&gt;It depends on whether we are referring to the &lt;strong&gt;engineering&lt;/strong&gt; or &lt;strong&gt;runtime&lt;/strong&gt; environment.&#xA;Let me clarify.&lt;/p&gt;</description>
    </item>
    <item>
      <title>TwinCAT 4024 &amp; Windows 11 24H2 BSOD</title>
      <link>https://www.sagatowski.com/posts/windows11_24h2_twincat4024_crashing/</link>
      <pubDate>Sat, 29 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/windows11_24h2_twincat4024_crashing/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/twincat_4024_and_windows_11_24h2.jpg&#34; alt=&#34;twincat_4024_and_windows_11_24h2&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are you developing projects for TwinCAT &lt;strong&gt;4024.x&lt;/strong&gt; and running them on Windows 11 (bare metal or VMs)?&#xA;&lt;strong&gt;DON&amp;rsquo;T&lt;/strong&gt; install the new Windows 24H2 update from Microsoft.&#xA;This will crash your runtime and potentially give you a &lt;a href=&#34;https://en.wikipedia.org/wiki/Blue_screen_of_death&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;BSOD&lt;/a&gt;.&#xA;Core isolation in VMs will not help.&#xA;Even though the EOL for Windows 10 is coming closer and closer (October 14, this year) Beckhoff Automation are (as of yet, maybe never?) not officially supporting Windows 11 for the TwinCAT 4024 XAR.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PLCs and test driven development</title>
      <link>https://www.sagatowski.com/posts/plcs_and_test_driven_development/</link>
      <pubDate>Mon, 26 Apr 2021 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/plcs_and_test_driven_development/</guid>
      <description>&lt;p&gt;The user base for TcUnit, the free open-source PLC/TwinCAT unit testing framework, has grown enormously.&#xA;Current estimates are that there are over 100 installations of TcUnit worldwide.&#xA;Running an open-source project has for some moments taken all my spare-time to maintain the framework, and answer all the questions from the users (I’ve added an &lt;a href=&#34;https://tcunit.org/frequently-asked-questions/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;FAQ&lt;/a&gt; since).&#xA;The most asked-for functionality of TcUnit that was missing was the possibility to run unit tests in a sequence/in order. Up to now, all tests defined in TcUnit were running in parallel, while in many use cases it was desirable to run the tests in sequence.&#xA;Thanks to several &lt;a href=&#34;https://github.com/tcunit/TcUnit/issues/95&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;fantastic contributors&lt;/a&gt; from the &lt;a href=&#34;https://github.com/tcunit/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;TcUnit community&lt;/a&gt; on GitHub, this is now available in TcUnit starting from version 1.2.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Unit testing in the world of industrial automation</title>
      <link>https://www.sagatowski.com/posts/unit_testing_in_the_world_of_industrial_automation/</link>
      <pubDate>Tue, 16 Feb 2021 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/unit_testing_in_the_world_of_industrial_automation/</guid>
      <description>&lt;p&gt;This is a joint article by me and &lt;a href=&#34;https://www.linkedin.com/in/peter-kurhajec/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Peter Kurhajec&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Unit testing is the practice of writing a test for a required functionality.&#xA;In the world of &amp;ldquo;classical&amp;rdquo; IT software development, the concept of unit testing has been around for almost two decades.&#xA;What is a standard procedure in languages such as Java, C++, .NET/C#, Python, etc. - has been completely lacking in the world of PLCs.&#xA;The world of automation did not have the proper tools, and nor did it develop any comprehensive automated testing frameworks.&#xA;Here we present two possible approaches for unit testing in Beckhoff&amp;rsquo;s TwinCAT 3.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Core dumps in TwinCAT</title>
      <link>https://www.sagatowski.com/posts/core_dumps_in_twincat/</link>
      <pubDate>Mon, 14 Dec 2020 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/core_dumps_in_twincat/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Oh no&lt;/strong&gt;!&#xA;The PLC has crashed, and we might even see the classical blue screen of death (BSOD).&#xA;We’ve all been there, and there are many reasons for why we got there.&#xA;TwinCAT is generally good at handling exceptions, and most of the time it is possible to analyze exceptions during development of software for a machine.&#xA;On a few occasions though, I’ve been in the situation where the machine has crashed, and I have not been connected to it at the moment of the crash and without any possibility to see what caused it.&#xA;In the latest version of TwinCAT (3.1.4024.11), Beckhoff have included a tool to aid with this type of problems.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Handling different versions of TwinCAT</title>
      <link>https://www.sagatowski.com/posts/handling_different_versions_of_twincat/</link>
      <pubDate>Mon, 02 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/handling_different_versions_of_twincat/</guid>
      <description>&lt;p&gt;Some time ago I wrote &lt;a href=&#34;https://www.sagatowski.com/posts/developing_code_for_different_runtimes/&#34; &gt;a post&lt;/a&gt; about developing code for different runtimes, and since then I&amp;rsquo;ve come to the realization that there is so much information missing in that blog post that I simply needed to write another one.&#xA;What&amp;rsquo;s even worse is that the information regarding development, deployment, and just general handling of several TwinCAT versions on the Beckhoff website is not that good.&#xA;I’ve talked to numerous automation engineers regarding this topic, and everyone seems to have a different understanding about it.&#xA;As I was working in a development project that had many PLCs (hundreds!) with different versions of TwinCAT, I finally had a good excuse to dive into the details of this.&#xA;With this blog post, I’d like to share some of the facts and misconceptions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Automation of TwinCAT unit tests</title>
      <link>https://www.sagatowski.com/posts/automation_of_twincat_unit_tests/</link>
      <pubDate>Mon, 07 Sep 2020 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/automation_of_twincat_unit_tests/</guid>
      <description>&lt;p&gt;Dear TwinCAT/PLC developers,&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m very happy to announce the release of the &lt;strong&gt;TcUnit-Runner&lt;/strong&gt;, an open-source tool for integration of TwinCAT unit tests into a CI/CD toolchain automation server such as Jenkins.&#xA;When &lt;a href=&#34;https://www.tcunit.org&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;TcUnit&lt;/a&gt;, the TwinCAT unit testing framework, was released back in December of 2018 I would never have imagined how widespread it would get.&#xA;Since then, I&amp;rsquo;ve received e-mails from PLC developers every week with questions, improvement suggestions or just gratitude for this &lt;a href=&#34;https://www.github.com/tcunit&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;open-source&lt;/a&gt; software.&#xA;The TcUnit framework has found its way into the full range of projects ranging from small machines to multi-billion € projects.&#xA;With this response, I would say that there definitely is a need for unit testing in the world of automation.&#xA;The adoption of TcUnit into TwinCAT projects across the globe has motivated the further development of TcUnit.&#xA;One limitation of the TcUnit framework was that it was only possible to run the unit tests locally on your development machine (or PLC), and thus needed to be run manually every time a change in the software was made.&#xA;Modern software practices advocate that software development should adhere to the practices of continuous integration/continuous delivery (CI/CD), so that tests would be run automatically when committing changes to version control.&#xA;Thus, TcUnit-Runner was developed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The five best and worst things with TwinCAT</title>
      <link>https://www.sagatowski.com/posts/the_five_best_and_worst_things_with_twincat/</link>
      <pubDate>Mon, 15 Jun 2020 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/the_five_best_and_worst_things_with_twincat/</guid>
      <description>&lt;p&gt;I have been using TwinCAT for quite some time now, and since I started developing software with TwinCAT it has changed almost everything for me as a software engineer, both as a profession and as a hobby.&#xA;This includes the programming language, development environment, software development processes, hardware, communication protocols and much more.&#xA;I have recently philosophized about how my life as a software developer has changed compared prior to doing automation software.&#xA;Overall, I would say that I can do tremendously more things (in a reasonable amount of time) with TwinCAT by myself, than I could do before when I was developing software in the &amp;ldquo;standard&amp;rdquo; programming languages.&#xA;It has given me opportunities to work with insanely fun projects that I would never have worked with if I didn&amp;rsquo;t start with PLC software development.&#xA;What I would want to share with you is a list of five things that I think Beckhoff have done right, and five things that they could improve.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Write filters in Beckhoff PLCs</title>
      <link>https://www.sagatowski.com/posts/write_filters_in_beckhoff_plcs/</link>
      <pubDate>Tue, 10 Mar 2020 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/write_filters_in_beckhoff_plcs/</guid>
      <description>&lt;p&gt;Write filters are an essential part of a PLC.&#xA;In Beckhoff PLCs write filters redirect writes from a disk/partition to RAM or another disk/partition which is flushed after reboot.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;../../images/write_filter_basic-1.png&#34; alt=&#34;Write filter basic&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;The reason why you want to have a write filter on your PLC is simple; it&amp;rsquo;s to protect the PLC from write operations.&#xA;We&amp;rsquo;ve all been in the situation where the OS is in the middle of a write, and for some reason it suddenly dies.&#xA;After a reboot the system might be corrupted.&#xA;With write filters, most changes in any applications or the operating system will not be persistent, which is often what you want in a system that runs 24/7 year after year.&#xA;By protecting volumes from writes, the filter also reduces the wear of flash media.&#xA;Because the filter puts the changes in volatile storage, it&amp;rsquo;s enough to do a simple reboot to get the system back in a well-known state.&#xA;In this post I will go through the different types of write filters and discuss some of the finds I did with the new UWF (unified write filter) that comes with the Windows 10 enterprise operating system.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Standalone PLC projects</title>
      <link>https://www.sagatowski.com/posts/standalone_plc_projects/</link>
      <pubDate>Wed, 29 Jan 2020 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/standalone_plc_projects/</guid>
      <description>&lt;p&gt;A new year has started, and what is not better to start a new blog-year by having a reader of this blog to host as a guest author?&#xA;&lt;a href=&#34;https://www.linkedin.com/in/roaldruiter&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Roald Ruiter&lt;/a&gt; will describe the functionality of standalone PLC projects in TwinCAT.&lt;/p&gt;&#xA;&lt;p&gt;In this article I want to highlight a useful and relatively new TwinCAT feature: Standalone PLC projects.&#xA;As usual, Beckhoff&amp;rsquo;s InfoSys provides a good explanation on how to setup and run such a project from scratch.&#xA;However, there is relatively little information on why the separation might be a good idea, how to separate an existing project and some of the pitfalls you might encounter.&lt;/p&gt;</description>
    </item>
    <item>
      <title>.gitignore for TwinCAT</title>
      <link>https://www.sagatowski.com/posts/gitignore_for_twincat/</link>
      <pubDate>Mon, 02 Dec 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/gitignore_for_twincat/</guid>
      <description>&lt;p&gt;Doing version control is a natural part of any software engineers daily work.&#xA;Doing version control for PLC software has historically mostly been hard, if not impossible.&#xA;As many automation manufacturers store all software in binary blobs it has not been suitable for version control.&#xA;Sometimes there have been proprietary solutions available, but it&amp;rsquo;s not until recently that a shift has started where source code is stored in plain text.&#xA;For version control, Git has gained more and more popularity for over a decade.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Logging of files to a network drives</title>
      <link>https://www.sagatowski.com/posts/logging_of_files_to_a_network_drive/</link>
      <pubDate>Mon, 11 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/logging_of_files_to_a_network_drive/</guid>
      <description>&lt;p&gt;Logging various form of data is common practice and is done in some form in more or less every industrial application.&#xA;There are various ways to store the data such as databases and different cloud services.&#xA;However, sometimes you just want to stick to the basics and store data as a file, for instance as comma separated values (CSV).&#xA;Depending on the amount of data that needs to be written, it&amp;rsquo;s usually not the best idea to do a lot of writes to the PLCs local drive because of wear and accessibility, but rather to a network drive.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The ELT and the TwinCAT automation interface – Part 3 (of 3)</title>
      <link>https://www.sagatowski.com/posts/the_elt_and_the_twincat_automation_interface_three/</link>
      <pubDate>Wed, 21 Aug 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/the_elt_and_the_twincat_automation_interface_three/</guid>
      <description>&lt;p&gt;In one subsystem of the &lt;a href=&#34;https://elt.eso.org/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;extremely large telescope (ELT)&lt;/a&gt; there are 132 Beckhoff PLCs running TwinCAT3, and this large amount has brought some interesting challenges to the ELT project.&#xA;Upgrading the entire system one PLC at a time would be time consuming and prone to errors.&#xA;When there is need for automation, the TwinCAT automation interface comes to the rescue.&#xA;In the final part we go through the steps necessary to do the actual build and deployment to the software to all PLCs.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The ELT and the TwinCAT automation interface – Part 2 (of 3)</title>
      <link>https://www.sagatowski.com/posts/the_elt_and_the_twincat_automation_interface_two/</link>
      <pubDate>Thu, 08 Aug 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/the_elt_and_the_twincat_automation_interface_two/</guid>
      <description>&lt;p&gt;In part one of this series of posts an introduction was given to a very specific problem that needed to be solved in the &lt;a href=&#34;https://elt.eso.org/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ELT project&lt;/a&gt;.&#xA;When doing software maintenance of a subsystem consisting of 132 PLCs, it&amp;rsquo;s not viable to do it manually as it would be prone to errors and be quite time consuming.&#xA;In this part of this series we will investigate the more practical problems that needs to be solved for us to do the automated deployment of the software to all PLCs.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Unit testing and PLCs</title>
      <link>https://www.sagatowski.com/posts/unit_testing_and_plcs/</link>
      <pubDate>Tue, 18 Jun 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/unit_testing_and_plcs/</guid>
      <description>&lt;p&gt;TcUnit is a unit testing framework made specifically for TwinCAT 3.&#xA;It&amp;rsquo;s an open-source project released under a &lt;a href=&#34;https://en.wikipedia.org/wiki/MIT_License&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MIT-license&lt;/a&gt;.&#xA;Since the launch of TcUnit the response from users has been overwhelming!&#xA;I&amp;rsquo;ve received tons of feedback from individuals and automation engineers from both small and large companies.&#xA;Judging by the sheer amount of e-mails received over the last half year I would say that there is a big need for a unit testing framework for PLC developers.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The ELT and the TwinCAT automation interface – Part 1 (of 3)</title>
      <link>https://www.sagatowski.com/posts/the_elt_and_the_twincat_automation_interface_one/</link>
      <pubDate>Sun, 26 May 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/the_elt_and_the_twincat_automation_interface_one/</guid>
      <description>&lt;p&gt;The extremely large telescope (ELT) is a telescope currently under design/construction.&#xA;With its 39 meter wide segmented primary mirror, once finished, it will be the largest optical telescope built.&#xA;Once it will start to collect photons it will open new frontiers and extend mankinds knowledge about the universe.&#xA;It&amp;rsquo;s a project with collaboration across the globe involving many universities, industries and organizations.&#xA;It&amp;rsquo;s a mighty instrument including many fields of engineering such as electrical-, mechanical-, optical- and software engineering.&#xA;Alright you get it.&#xA;The ELT is big, cool and everything&amp;hellip; but what does that have to do with the TwinCAT automation interface?&lt;/p&gt;</description>
    </item>
    <item>
      <title>RSS feed of Beckhoff</title>
      <link>https://www.sagatowski.com/posts/rss_feed_of_beckhoff/</link>
      <pubDate>Sun, 14 Apr 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/rss_feed_of_beckhoff/</guid>
      <description>&lt;p&gt;Found this information on the TwinCAT LinkedIn-group, but thought it&amp;rsquo;s good to share it with everyone else.&#xA;Beckhoff unfortunately don’t provide release notes with updates/bug fixes/features to new releases of TwinCAT.&#xA;They have however recently added a new RSS-feed so that it&amp;rsquo;s possible to follow new releases of TwinCAT and the different supplements.&#xA;Apparently this is going to be added to the Visual Studio start page from TwinCAT 3.1.4024, which hopefully will be released in the not-too-distant future.&#xA;The address to the feed is &lt;a href=&#34;http://www.beckhoff.com/english/rss/beckhoff-twincat-rss-feed.xml&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://www.beckhoff.com/english/rss/beckhoff-twincat-rss-feed.xml&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PLC naming conventions</title>
      <link>https://www.sagatowski.com/posts/plc_naming_conventions/</link>
      <pubDate>Mon, 11 Feb 2019 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/plc_naming_conventions/</guid>
      <description>&lt;p&gt;Name a few things that software developers always have strong opinions about and naming conventions on code is one of the things that surely will come up.&#xA;What lengths for identifiers should we use?&#xA;Should we use hungarian notation?&#xA;CamelCase or under_score case?&#xA;While programming guidelines covering these topics have been existing since the rise of the early programming languages, they are much less common for industrial control.&lt;/p&gt;&#xA;&lt;p&gt;Initially the only one that I found was &lt;a href=&#34;https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/12049944715.html&amp;amp;id=1368558850979480345&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Beckhoff&amp;rsquo;s for TwinCAT 3&lt;/a&gt;.&#xA;Most of Beckhoff&amp;rsquo;s libraries and example code used this, even though even Beckhoff themselves have not been consistent.&#xA;More recently PLCopen have &lt;a href=&#34;http://www.plcopen.org/pages/promotion/publications/downloads/press_releases/software_constr_gl_apr2016.htm&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;released their coding guidelines&lt;/a&gt; written specifically for IEC61131-3.&#xA;Just out of curiosity I decided to compare the two standards and their take on naming conventions, and comparing them to my own personal opinions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>TcUnit – A TwinCAT unit testing framework</title>
      <link>https://www.sagatowski.com/posts/tcunit_a_twincat_unit_testing_framework/</link>
      <pubDate>Mon, 10 Dec 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/tcunit_a_twincat_unit_testing_framework/</guid>
      <description>&lt;p&gt;Dear TwinCAT developers,&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m very happy to announce the release of &lt;a href=&#34;https://tcunit.org/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;TcUnit - an unit testing framework for TwinCAT 3&lt;/a&gt;.&#xA;TcUnit is an &lt;a href=&#34;https://en.wikipedia.org/wiki/XUnit&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;xUnit&lt;/a&gt; type of framework specifically done for Beckhoff&amp;rsquo;s TwinCAT 3 development environment.&#xA;This is another step in the direction of modernizing the software development practices in the world of automation.&lt;/p&gt;&#xA;&lt;p&gt;Before dwelling into the details, let me tell the background of this project.&#xA;In 2016 the development of the CorPower wave energy converter (WEC) was in an intensive phase.&#xA;Software was being finalized, tested and verified for delivery.&#xA;In a late phase of the project some critical parts of the software needed to be changed.&#xA;The changes could be isolated to a few function blocks (FB), so in an initial phase the tests simply consisted of exporting those FBs to a separate project and running them locally on the engineering PC.&#xA;The FBs were changed and executed in the engineering environment, and then online-changing the inputs and seeing whether the expected outputs were given.&#xA;After doing this for a couple of hours an important question was raised:&lt;/p&gt;</description>
    </item>
    <item>
      <title>CI/CD with TwinCAT – part 4 (of 4)</title>
      <link>https://www.sagatowski.com/posts/cicd_with_twincat_part_four/</link>
      <pubDate>Thu, 04 Oct 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/cicd_with_twincat_part_four/</guid>
      <description>&lt;p&gt;We are at the final post of this series of continous integration and delivery with TwinCAT.&#xA;We&amp;rsquo;ve accomplished setting up &amp;amp; configuring the automation server, created a TwinCAT test library project and wrote a small batch script that will be launched every time a new push has been done to the GIT repository for the library project.&#xA;Now it&amp;rsquo;s time for us to write the program that will do the actual static code analysis.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CI/CD with TwinCAT – part 3 (of 4)</title>
      <link>https://www.sagatowski.com/posts/cicd_with_twincat_part_three/</link>
      <pubDate>Tue, 28 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/cicd_with_twincat_part_three/</guid>
      <description>&lt;p&gt;In the &lt;a href=&#34;https://www.sagatowski.com/posts/cicd_with_twincat_part_two/&#34; &gt;previous post&lt;/a&gt;  we did some installation and configuration of software to support us in the automation of doing static code analysis of TwinCAT software.&#xA;We have reached a state where a Jenkins job is launched as soon as our TwinCAT library project is pushed to the Git-repository.&#xA;Even though we have a Jenkins job defined for static code analysis of TwinCAT software, it&amp;rsquo;s not doing anything yet.&#xA;This will be our next step.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Library categories</title>
      <link>https://www.sagatowski.com/posts/library_categories/</link>
      <pubDate>Thu, 16 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/library_categories/</guid>
      <description>&lt;p&gt;I like to have things structured and ordered.&#xA;This does not only include the obvious stuff as making sure to pair and match all socks after laundry, but it also includes the TwinCAT software I develop, more specifically own developed TwinCAT libraries.&#xA;&amp;ldquo;Whaaat??? What does sorting socks have to do with TwinCAT software?&amp;rdquo; you might wonder.&#xA;I&amp;rsquo;m glad you asked.&lt;/p&gt;&#xA;&lt;p&gt;One of the things that have always annoyed me is that own developed libraries always go into the category (Miscellaneous) when using the &lt;strong&gt;Library Repository&lt;/strong&gt; browser:&lt;/p&gt;</description>
    </item>
    <item>
      <title>CI/CD with TwinCAT – part 2 (of 4)</title>
      <link>https://www.sagatowski.com/posts/cicd_with_twincat_part_two/</link>
      <pubDate>Thu, 26 Jul 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/cicd_with_twincat_part_two/</guid>
      <description>&lt;p&gt;In the &lt;a href=&#34;https://www.sagatowski.com/posts/cicd_with_twincat_part_one/&#34; &gt;previous post&lt;/a&gt; we were introduced to the concept of continous integration and&#xA;continous delivery (CI/CD) in the world of PLC software development, more specifically TwinCAT development.&#xA;The conclusion is that certain processes in the process of creating software can and should be automated.&#xA;As an example, we set the goal of automating static code analysis of all TwinCAT software.&#xA;In this part of the series of CI/CD we will look into some practical matters of installing and configuring the necessary software.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CI/CD with TwinCAT – part 1 (of 4)</title>
      <link>https://www.sagatowski.com/posts/cicd_with_twincat_part_one/</link>
      <pubDate>Thu, 05 Jul 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/cicd_with_twincat_part_one/</guid>
      <description>&lt;p&gt;The development of PLC software needs to enter the 21st century.&#xA;With the increased complexity of developed systems, the amount of software that is going to be developed for a given system will continue to increase.&#xA;PLC development is partially living on an isolated island, and while most other areas of software development have been modernized, the world of PLC software engineering development is going significantly slower.&#xA;When we develop more software, there is a need for more automation to remove unecessary manual handling and in the end increase the quality of the software we develop.&#xA;Now I know that you can&amp;rsquo;t compare developing software for a web shop with developing software for a PLC that can run software that is critical and maybe even be safety-critical and one line of code can be the difference of life and death.&#xA;However, developing reliable and robust software and adhering to modern software development processes and tools does not mean they do rule each other out.&#xA;You can pick both.&lt;/p&gt;</description>
    </item>
    <item>
      <title>TwinCAT &amp; virtualization</title>
      <link>https://www.sagatowski.com/posts/twincat_and_virtualization/</link>
      <pubDate>Thu, 14 Jun 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/twincat_and_virtualization/</guid>
      <description>&lt;p&gt;Most people who have developed software have at some point or another used virtualization technology.&#xA;Software development for PLCs in a virtual environment is often overlooked, since PLC development is so close to the hardware.&#xA;Nevertheless, there are still advantages.&#xA;Working for several projects with various requirements, but where a Beckhoff PLC/TwinCAT was the common delimiter, made me ask myself &amp;ldquo;How much use of virtualization can I do for TwinCAT software development?&amp;rdquo;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Mocking objects in TwinCAT</title>
      <link>https://www.sagatowski.com/posts/mocking_objects_in_twincat/</link>
      <pubDate>Wed, 23 May 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/mocking_objects_in_twincat/</guid>
      <description>&lt;p&gt;In my earlier posts I&amp;rsquo;ve written about development of TwinCAT software using test driven development (TDD), by writing unit tests.&#xA;One of the advantages by adhering to the process of TDD is that you mostly will end up with function blocks (FBs) which have limited but well defined responsibility.&#xA;Eventually you will however have FBs that are dependent on other function blocks.&#xA;These could be FBs that are your own, or part of some 3rd party library, for example a Beckhoff library.&#xA;Further, what if this external FB relies on some other functionality such as external communication using sockets that we have no control of?&#xA;The external FBs should already be tested, we&amp;rsquo;re only interested in making sure our unit tests test our code!&#xA;What do we do?&#xA;A solution to this is to &lt;strong&gt;mock&lt;/strong&gt; the external functionality and use &lt;strong&gt;dependency injection&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The wonders of ANY</title>
      <link>https://www.sagatowski.com/posts/the_wonders_of_any/</link>
      <pubDate>Wed, 21 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/the_wonders_of_any/</guid>
      <description>&lt;p&gt;While doing software development in TwinCAT, I have always been missing some sort of generic data type/container, to have some level of conformance to generic programming.&#xA;&amp;ldquo;Generic programming&amp;hellip; what&amp;rsquo;s that?&amp;rdquo;, you may ask.&#xA;I like &lt;a href=&#34;http://www.cs.ox.ac.uk/ralf.hinze/publications/habilitation.pdf&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ralf Hinze&amp;rsquo;s description&lt;/a&gt; of generic programming:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A generic program is one that the programmer writes once, but which works over many different data types.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been using &lt;a href=&#34;https://en.wikibooks.org/wiki/Ada_Programming/Generics&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;generics in Ada&lt;/a&gt; and &lt;a href=&#34;https://en.wikipedia.org/wiki/Template_%28C%2B%2B%29&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;templates in C++&lt;/a&gt;, and many other languages have similar concepts.&#xA;Why was there no such thing available in the world of TwinCAT/IEC 61131-3?&#xA;For a long time there was a link to a type &amp;ldquo;ANY&amp;rdquo; in their data types section of TwinCAT 3, but the only information available on the website was that the &amp;ldquo;ANY&amp;rdquo; type was not yet available.&#xA;By coincidence I revisited their web page to check it out, and now a &lt;a href=&#34;https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/9007201784167563.html&amp;amp;id=2058661990612177947&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;description is available&lt;/a&gt;!&#xA;I think the documentation has done a good job describing the possibilities with the ANY-type, but I wanted to elaborate with this a little further.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Managing TwinCAT libraries</title>
      <link>https://www.sagatowski.com/posts/managing_twincat_libraries/</link>
      <pubDate>Thu, 01 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/managing_twincat_libraries/</guid>
      <description>&lt;p&gt;When being in an early phase of a project, it&amp;rsquo;s common to use &amp;ldquo;latest and greatest&amp;rdquo; of the dependencies that your software relies on.&#xA;In the beginning of a project, it&amp;rsquo;s usually low risk to built your system on the latest of everything as you&amp;rsquo;ve got plenty of time to make sure everything works as expected.&#xA;I guess that&amp;rsquo;s one of the many joys of starting a new project, you are more free and can experiment more.&#xA;But as you get closer and closer to the delivery of the project, it&amp;rsquo;s usually a good idea to start and &amp;ldquo;freeze&amp;rdquo; parts of the software.&#xA;This includes everything from own developed libraries, TwinCAT supplied libraries, drivers, TwinCAT runtime and even the operating system on the target device (which anyways doesn&amp;rsquo;t change too often).&#xA;Twenty years from now, I want to be able to compile and build the exact same executable binary that is running on that nice expensive machine right now.&#xA;When I was close to delivery of a TwinCAT project, I got some problems related to this topic.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Watchdog timer</title>
      <link>https://www.sagatowski.com/posts/watchdog_timer/</link>
      <pubDate>Thu, 01 Feb 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/watchdog_timer/</guid>
      <description>&lt;p&gt;Software engineers make mistakes.&#xA;No matter how well experienced you are, or how many unit tests you&amp;rsquo;ve written for your code, or how well reviewed the code is, we&amp;rsquo;re humans and at some point or another we&amp;rsquo;ll make mistakes.&#xA;It can be a null pointer reference, an out-of-bound indexing of an array, segmentation fault, a zero-division or any other selection of the thousands of software bugs that should not happen but will happen.&#xA;In my current area, development of wave energy converters (WEC), I don&amp;rsquo;t have the luxury of being able to easily reboot the PLC/controller if a software crash happens.&#xA;I can&amp;rsquo;t just walk up to the system, and do a power-reset.&#xA;The WEC can be far out in the ocean.&#xA;Going out on the ocean and doing any form of maintenance involves costs, which we want to avoid.&#xA;With this type of scenario, it&amp;rsquo;s time to consider a watchdog timer.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OSCAT basic library in TwinCAT</title>
      <link>https://www.sagatowski.com/posts/oscat_basic_library_in_twincat/</link>
      <pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/oscat_basic_library_in_twincat/</guid>
      <description>&lt;p&gt;If you&amp;rsquo;ve done development in TwinCAT for some time, you&amp;rsquo;ve most likely come across at least one of the &lt;a href=&#34;http://www.oscat.de/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;OSCAT libraries&lt;/a&gt;.&#xA;These are open source libraries developed in accordance to the IEC61131-3 standard.&#xA;They provide a total of three different libraries; OSCAT-Basic, OSCAT-Building and OSCAT-Network.&#xA;I&amp;rsquo;ve so far only used the OSCAT-Basic library, which provides function blocks and functions for engineering, mathematics, string handling, time/date and much more.&#xA;There is only a small problem with using the OSCAT-Basic library in TwinCAT – there is a broken reference in it!&#xA;What follows is a guide on how you can fix this so that you can fully utilize this library in TwinCAT.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Thinkpad X250 upgrade</title>
      <link>https://www.sagatowski.com/posts/thinkpad_x250_upgrade/</link>
      <pubDate>Mon, 25 Dec 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/thinkpad_x250_upgrade/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ll admit it, I&amp;rsquo;m a sucker for Thinkpad laptops.&#xA;I&amp;rsquo;ve used the Thinkpad-series laptops since ~20 years or so (when IBM still owned the brand and manufactured them).&#xA;They are high quality, they are easy to upgrade, they are maintainable, and they just got that &amp;ldquo;Engineer&amp;rdquo;-type of look over them.&#xA;Most parts in a Thinkpad are replaceable, and that&amp;rsquo;s just one of the reasons why people have them for so long time.&#xA;This is in contrast to other manufacturers which in most cases require you to send the computer in to a licensed repair-shop (no names mentioned, but one example starts with an A and ends with an E, and has PPL in between).&#xA;&lt;strong&gt;The Thinkpad laptops are simply for people that want to get shit done.&lt;/strong&gt;&#xA;That&amp;rsquo;s why I&amp;rsquo;m not surprised that you almost never see Thinkpads in trendy cafeterias, but instead where people do actual work.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test driven development in TwinCAT – Part 7 (of 7)</title>
      <link>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_7/</link>
      <pubDate>Thu, 14 Dec 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_7/</guid>
      <description>&lt;p&gt;We&amp;rsquo;re finally at the last post of this series!&#xA;Patiently we&amp;rsquo;ve written all our tests and done all our code that implements the required functionality and made sure that our code passes all the tests.&#xA;But in the end of the day, despite all the theory and coding we want our code to run on a real physical device.&#xA;Now it&amp;rsquo;s time for the favorite part of every PLC programmer, which is getting down to the hardware and micro controllers!&#xA;Let&amp;rsquo;s get to the grand finale, and test our code on a real PLC, IO-Link master and IO-Link slave.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test driven development in TwinCAT – Part 6 (of 7)</title>
      <link>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_6/</link>
      <pubDate>Thu, 07 Dec 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_6/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_5/&#34; &gt;part five&lt;/a&gt; of these series we started the implementation of the function blocks that we previously have done unit tests for.&#xA;As we have our tests, we could verify that our newly implemented code did what it is supposed to do, and thus we made our code pass the tests.&#xA;What we&amp;rsquo;ve got left is to do the implementation for three of the remaining function blocks.&#xA;Once this is done, we have implemented all the required functionality that we&amp;rsquo;ve declared that our unit tests require us to.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test driven development in TwinCAT – Part 5 (of 7)</title>
      <link>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_5/</link>
      <pubDate>Thu, 30 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_5/</guid>
      <description>&lt;p&gt;In the last post of the series of unit testing in TwinCAT we finalized our unit tests, thus creating the acceptance criteria for the expected functionality for our function blocks.&#xA;Now it&amp;rsquo;s time to do the actual implementation of the function blocks that we described in part 2 of these series.&#xA;As we have our unit tests finished, we can anytime during our development run them and check whether the implemented code passes the tests.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test driven development in TwinCAT – Part 4 (of 7)</title>
      <link>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_4/</link>
      <pubDate>Thu, 23 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_4/</guid>
      <description>&lt;p&gt;In the &lt;a href=&#34;https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_3/&#34; &gt;previous post&lt;/a&gt; we defined the general layout of our unit tests, and also did the implementation of the tests for two of the five function block that we&amp;rsquo;re going to use to verify the functionality of parsing IO-Link events.&#xA;What we&amp;rsquo;ve got left is to create test cases for the parsing of the text identity and the timestamp of the diagnostic event.&#xA;Then we also want to have a few tests that closes the loop and verifies the parsing of a complete diagnosis history message.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test driven development in TwinCAT – Part 3 (of 7)</title>
      <link>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_3/</link>
      <pubDate>Thu, 16 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_3/</guid>
      <description>&lt;p&gt;In the &lt;a href=&#34;https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_2/&#34; &gt;last post&lt;/a&gt; of this series we were looking at a use case for a certain set of functionality, more specifically creating parser function blocks for the handling of IO-Link events.&#xA;The result was a series of function blocks with defined input and output.&#xA;In this post we&amp;rsquo;ll create the unit tests that will use the function blocks that we&amp;rsquo;ve started doing.&#xA;Naturally, when defining the tests they will all fail as we don&amp;rsquo;t have the implementation code ready yet.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test driven development in TwinCAT – Part 2 (of 7)</title>
      <link>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_2/</link>
      <pubDate>Thu, 09 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_2/</guid>
      <description>&lt;p&gt;In my &lt;a href=&#34;https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_1/&#34; &gt;previous post&lt;/a&gt; I explained some of the benefits of using test driven development (TDD) while developing PLC software.&#xA;This post is the second part of a series of seven, where we will look at a real use case scenario of writing test cases prior to doing the actual implementation.&#xA;The scenario which I thought would be good for this is by creating a parser for IO-Link events.&#xA;Shortly, IO-Link is a standardized point-to-point serial communication protocol used to communicate with sensors and/or actuators.&#xA;It is not a fieldbus, but only takes care of the communication to the end device.&#xA;As it&amp;rsquo;s a fully digital protocol that on top of process data also supports services such as events and parameterization, it&amp;rsquo;s standing well prepared for the Industry 4.0 thinking.&#xA;One of the functionalities of IO-Link devices is that they can fire off events to the IO-Link master to notify that something has happened, for instance an alarm that something is wrong.&#xA;To integrate these IO-link devices (slaves) into your EtherCAT network you need an IO-Link master, which usually allows you to connect 4 or 8 IO-Link slaves.&lt;/p&gt;</description>
    </item>
    <item>
      <title>First cycle</title>
      <link>https://www.sagatowski.com/posts/first_cycle/</link>
      <pubDate>Sun, 05 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/first_cycle/</guid>
      <description>&lt;p&gt;One problem I face quite often is that I need to have some code executed only once in the first cycle of the PLC, and then never again.&#xA;Up until now I&amp;rsquo;ve always used a boolean of some sort; &lt;code&gt;bFirstCycleExecuted&lt;/code&gt;, instantiated to false and then set to true after the first cycle resulting in something like:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PROGRAM MAIN&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;VAR&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    bFirstCycleExecuted : BOOL := FALSE;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;END_VAR&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;----------------------------------------&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;IF NOT bFirstCycleExecuted THEN&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    // The code that you want to be executed at the first cycle&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    bFirstCycleExecuted := TRUE;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;END_IF&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There actually is a built-in way in TwinCAT to know whether the current cycle is the first one or not, using the global data type &lt;a href=&#34;https://infosys.beckhoff.com/english.php?content=../content/1033/globaldatatypes/714821259.html&amp;amp;id=1449094368155551069&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;PlcTaskSystemInfo&lt;/code&gt;&lt;/a&gt;.&#xA;Among other parameters in this data type is the boolean &lt;code&gt;FirstCycle&lt;/code&gt;.&#xA;In your program you have access to an array of the data type &lt;code&gt;PlcTaskSystemInfo&lt;/code&gt;, accessing it by &lt;code&gt;_TaskInfo[index_of_current_task]&lt;/code&gt;.&#xA;The index of current task can be retrieved by using the function block &lt;a href=&#34;https://infosys.beckhoff.com/english.php?content=../content/1033/tcplclib_tc2_system/27021597795180939.html&amp;amp;id=&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;GETCURTASKINDEX&lt;/code&gt;&lt;/a&gt;.&#xA;Replacing the above piece of code with our new knowledge results in:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test driven development in TwinCAT – Part 1 (of 7)</title>
      <link>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_1/</link>
      <pubDate>Thu, 02 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/test_driven_development_in_twincat_part_1/</guid>
      <description>&lt;p&gt;Test driven development (TDD) doesn&amp;rsquo;t seem to be all too common among TwinCAT-developers, which is a shame.&#xA;From my experience, TDD has a strong foothold everywhere among developers, but TwinCAT?&#xA;Not so much.&#xA;And I don&amp;rsquo;t blame them.&#xA;There are TDD frameworks for C++, C#, Ada, Python and basically any other language and/or development environment.&#xA;Do a Google search on the web on any programming language/IDE and TDD and you get thousands of results.&#xA;Do the same for TwinCAT and you&amp;rsquo;re on your own.&lt;/p&gt;</description>
    </item>
    <item>
      <title>TwinCAT static code analysis</title>
      <link>https://www.sagatowski.com/posts/twincat_static_code_analysis/</link>
      <pubDate>Thu, 12 Oct 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/twincat_static_code_analysis/</guid>
      <description>&lt;p&gt;Together with TwinCAT release 4022.0 Beckhoff released their product &amp;ldquo;&lt;a href=&#34;https://www.beckhoff.com/en-en/products/automation/twincat/texxxx-twincat-3-engineering/te1200.html&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;TE1200 – TC3 PLC Static Analysis&lt;/a&gt;&amp;rdquo;.&#xA;It&amp;rsquo;s a tool integrated in the development environment to help the developer increase the quality of the code.&#xA;Other than being able to set your own naming conventions for the code, TE1200 can be used for various rule checks, for example:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Non-assigned return values&lt;/li&gt;&#xA;&lt;li&gt;Usage of object-oriented features&lt;/li&gt;&#xA;&lt;li&gt;Unreachable code&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;There are over 100 different checks that can be enabled to either output a warning or an error.&#xA;These are configurable by the user, and the configurations can be exported.&#xA;This is particularly good when developing in teams, and having common code checks.&#xA;On top of this, TE1200 includes something called &amp;ldquo;Metrics&amp;rdquo;, which analyses your software and gives the properties of the code in different type of indicators, which for instance can be how many percentage of your code consists of comments.&#xA;In this post, I&amp;rsquo;m primarily going to focus on the naming conventions and rules, and share my initial thoughts about this product.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Commodore 64 restoration</title>
      <link>https://www.sagatowski.com/posts/commodore_64_restoration/</link>
      <pubDate>Fri, 06 Oct 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/commodore_64_restoration/</guid>
      <description>&lt;p&gt;This post has really not too much to do with TwinCAT, at least not directly.&#xA;Instead, this post will be about a computer that&amp;rsquo;s close to my heart.&#xA;So, despite not being directly related to TwinCAT, it&amp;rsquo;s about the computer which started my interest in software engineering, and ultimately led me to where I am today, therefore this post.&#xA;The Commodore 64 was my first computer.&#xA;The first version was released the same year I was born.&#xA;Rewind the time back to the mid 80s, and this was the computer that everyone had back in those days.&#xA;It was a fantastic machine back then.&#xA;1MHz clock frequency, amazing video-graphics, a whopping 64K of user RAM (hence the name) and fantastic sound (provided by the &lt;a href=&#34;https://en.wikipedia.org/wiki/MOS_Technology_6581&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SID-chip&lt;/a&gt;).&#xA;Despite the limited performance when judged by today standards, people were doing amazing stuff with it.&#xA;The game and demo-scene was flourishing.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Developing code for different runtimes</title>
      <link>https://www.sagatowski.com/posts/developing_code_for_different_runtimes/</link>
      <pubDate>Thu, 29 Jun 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/developing_code_for_different_runtimes/</guid>
      <description>&lt;p&gt;I guess you&amp;rsquo;ve seen the news, TwinCAT 3.1.4022.0 has been released.&#xA;At one point or another, when developing TwinCAT software you eventually end up in wanting to write code for the latest runtime, but still being able to do software bug fixes/releases for code running on older TwinCAT runtimes.&#xA;I thought it would be good to quickly share with you how you can work and develop multiple projects developed for different runtime versions but from the same developer machine!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Project build version in runtime</title>
      <link>https://www.sagatowski.com/posts/project_build_version_in_runtime/</link>
      <pubDate>Tue, 06 Jun 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/project_build_version_in_runtime/</guid>
      <description>&lt;p&gt;When creating TwinCAT software I&amp;rsquo;ve come across a use case where I want to print out and store the actual version of the project that the program resides in.&#xA;This can be pretty neat when you do version control, and for instance create a release of your program and want this information available somewhere in the output of the program.&#xA;I&amp;rsquo;ve had this scenario when we had a project that was continuously updated.&#xA;The test/integration team needed constant bug fixes/new software releases.&#xA;As a software engineer I needed to keep track of what version the test/integration team were actually running at a specific time.&#xA;By updating the version number in the project information I was being able to log the actual running version of the software in a database, which is important to know when going back to fault trace any strange behavior in a particular test.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Replace tabs with whitespaces</title>
      <link>https://www.sagatowski.com/posts/replace_tabs_with_whitespaces/</link>
      <pubDate>Fri, 14 Apr 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/replace_tabs_with_whitespaces/</guid>
      <description>&lt;p&gt;PLCopen has released their coding guidelines for 61131-3 structured text (ST) some time ago.&#xA;If you haven&amp;rsquo;t read that yet, I highly recommend you to do so!&#xA;Even if I don&amp;rsquo;t agree with everything, it&amp;rsquo;s still a good read and a really good initiative to consolidate all the different coding guidelines that every vendor has for their 61131-3 ST environment.&lt;/p&gt;&#xA;&lt;p&gt;Included in this is Rule L16 &amp;ldquo;Define the use of tabs&amp;rdquo;. Let me quote:&lt;/p&gt;</description>
    </item>
    <item>
      <title>New CX5140</title>
      <link>https://www.sagatowski.com/posts/new_cx5140/</link>
      <pubDate>Sun, 26 Mar 2017 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/new_cx5140/</guid>
      <description>&lt;p&gt;When I develop software I mostly do the testing on my development computer.&#xA;It is after all one of the big strengths of being able to run your code on a PC platform – it should more or less work the same on a PC based PLC.&#xA;But then there is only so much testing you can do in your development machine, at some point you still end up needing to have the real hardware.&#xA;I&amp;rsquo;ve already ended up with having some EtherCAT-slaves connected to the development computer so I decided I&amp;rsquo;ll go for a PLC to split the development computer and run-time environment completely.&#xA;As Beckhoff has released PLCs from their embedded line with Windows 10 IoT Enterprise LTSB I though that was another reason good enough to buy one and experiment with it.&#xA;Ended up with a CX5140 with 4gb of RAM and 32GB of flash-storage.&#xA;Works like a charm out of the box, and I&amp;rsquo;ve already noticed some changes compared with running a controller with Windows 7 embedded.&#xA;Since Windows 8 embedded, Microsoft have apparently replaced the FBWF (File-Based Write Filter) with the new &lt;a href=&#34;https://msdn.microsoft.com/en-us/windows/hardware/commercialize/customize/enterprise/unified-write-filter&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;UWF (Unified Write Filter)&lt;/a&gt;.&#xA;I&amp;rsquo;ll continue running/testing all my code on this controller, and will be posting new content to this blog as often as I can.&lt;/p&gt;</description>
    </item>
    <item>
      <title>61131-3 PLC on the cheap</title>
      <link>https://www.sagatowski.com/posts/61131-3_plc_on_the_cheap/</link>
      <pubDate>Sun, 06 Nov 2016 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/61131-3_plc_on_the_cheap/</guid>
      <description>&lt;p&gt;3S-Smart Software Solutions has since pretty long had a Raspberry Pi (RPI) target image available for their CODESYS runtime.&#xA;The intention was to create something that you could buy very cheap, primarily for students and such to learn how to program 61131-3.&lt;/p&gt;&#xA;&lt;p&gt;As I&amp;rsquo;m primarily working with TwinCAT 3, which is based on CODESYS, I&amp;rsquo;ve been thinking about building a really cheap 61131-3 compatible PLC based on the RPI and the CODESYS target.&#xA;I didn&amp;rsquo;t just want it to be one board laying around in my home, but I also wanted it to have the &amp;ldquo;industrial&amp;rdquo; feeling, and luckily I found a perfect development board + case for me to initialize the project.&#xA;Now that it&amp;rsquo;s finished, I have a PLC running an EtherCAT master in the CODESYS runtime for almost no money at all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>First post!</title>
      <link>https://www.sagatowski.com/posts/first-post/</link>
      <pubDate>Sun, 30 Oct 2016 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/posts/first-post/</guid>
      <description>&lt;p&gt;Webpage is up!&#xA;Here I&amp;rsquo;m going to have various information about different PLC programming tutorials.&#xA;This will mostly be in the TwinCAT 3 and CODESYS environment.&#xA;I&amp;rsquo;ve found out that there aren&amp;rsquo;t too many blogs/resources on TwinCAT 3 development.&#xA;As I&amp;rsquo;m working with mostly TwinCAT-development every day at my job I thought it would be a good idea to share some of the knowledge I&amp;rsquo;ve aquired during as time has passed.&#xA;Stay tuned!&lt;/p&gt;</description>
    </item>
    <item>
      <title>About</title>
      <link>https://www.sagatowski.com/pages/about/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/pages/about/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/drives.jpg&#34; alt=&#34;Drive control&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;We are a company providing various software &lt;a href=&#34;https://www.sagatowski.com/pages/consulting/&#34; title=&#34;Consulting&#34; &gt;consulting services&lt;/a&gt;.&#xA;Our focus is primarily in industrial automation with design, test, documentation and implementation of IEC 61131-3 software.&#xA;We also offer &lt;a href=&#34;https://www.sagatowski.com/pages/training/&#34; title=&#34;Training&#34; &gt;training&lt;/a&gt;.&#xA;We are based in Munich/Germany and in Stockholm/Sweden, but service clients across the globe.&#xA;For many years we have also been modernizing the industrial automation field by sharing our knowledge openly (&lt;a href=&#34;https://www.youtube.com/playlist?list=PLimaF0nZKYHz3I3kFP4myaAYjmYk1SowO&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;#1&lt;/a&gt; and &lt;a href=&#34;https://www.alltwincat.com&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;#2&lt;/a&gt;), and by creating &lt;a href=&#34;https://www.github.com/tcunit&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;open source software&lt;/a&gt;.&#xA;We believe that by openly sharing knowledge and committing to open source software, industrial automation as a whole field is improved.&lt;br&gt;&#xA;Need help with your automation/software project? Please &lt;a href=&#34;https://www.sagatowski.com/pages/contact/&#34; title=&#34;contact&#34; &gt;contact&lt;/a&gt; us.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Consulting</title>
      <link>https://www.sagatowski.com/pages/consulting/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/pages/consulting/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/monitor_github.jpg&#34; alt=&#34;Example image&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Need help with design, implementation, test and documentation of your software project?&#xA;We have experience in a wide variety of software stacks, but with a speciality of industrial automation software.&#xA;Since the start we have helped companies over a wide variety of industries across the world to realize their automation projects.&#xA;Want to get in touch to discuss your existing or future project? In that case, &lt;a href=&#34;https://www.sagatowski.com/pages/contact/&#34; title=&#34;contact&#34; &gt;contact&lt;/a&gt; us.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Contact</title>
      <link>https://www.sagatowski.com/pages/contact/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/pages/contact/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/keyboard.jpg&#34; alt=&#34;Keyboard&#34;&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;-address&#34;&gt;&#xD;&#xA;  📮 Address&#xD;&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#-address&#34;&gt;&#xD;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xD;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xD;&#xA;  &lt;/a&gt;&#xD;&#xA;&lt;/h3&gt;&#xD;&#xA;&lt;p&gt;Sagatowski GmbH&lt;br&gt;&#xA;Tegernseer Landstraße 205c&lt;br&gt;&#xA;81549 München&lt;br&gt;&#xA;Germany&lt;/p&gt;&#xA;&lt;h3 id=&#34;-e-mail-us&#34;&gt;&#xD;&#xA;  📧 E-mail us&#xD;&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#-e-mail-us&#34;&gt;&#xD;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xD;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xD;&#xA;  &lt;/a&gt;&#xD;&#xA;&lt;/h3&gt;&#xD;&#xA;&lt;p&gt;&lt;a href=&#34;mailto:mail@sagatowski.com&#34; &gt;mail@sagatowski.com&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Thank you</title>
      <link>https://www.sagatowski.com/pages/thankyou/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/pages/thankyou/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;../../images/keyboard.jpg&#34; alt=&#34;Keyboard&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Message has been sent.&#xA;We will do our best to come back to you within 48 hours.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Training</title>
      <link>https://www.sagatowski.com/pages/training/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://www.sagatowski.com/pages/training/</guid>
      <description>&lt;p&gt;Do you need personal training for PLC software development in &lt;a href=&#34;https://www.beckhoff.com/en-en/products/automation/twincat/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Beckhoff&amp;rsquo;s TwinCAT 3&lt;/a&gt;?&#xA;We offer courses/training for everything related to TwinCAT 3 (PLC, HMI, Motion, Vision, Safety etc.).&#xA;For more information, please &lt;a href=&#34;https://www.sagatowski.com/pages/contact/&#34; title=&#34;contact&#34; &gt;contact&lt;/a&gt; us.&lt;/p&gt;&#xA;&lt;p&gt;Don&amp;rsquo;t want to pay for learning PLC-programming?&#xA;We got you covered.&#xA;We offer the world&amp;rsquo;s most popular PLC-programming course entirely for free.&#xA;No registration.&#xA;No giving away personal details.&#xA;No country limitations.&#xA;Just watch &amp;amp; learn.&#xA;A total of 13 hours spanning over 20 videos of free training.&#xA;Click on the images below to get to the equivalent episode.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
