<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WinCC Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/tag/wincc/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Fri, 04 Sep 2026 19:53:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://static.dmcinfo.com/wp-content/uploads/2025/04/site-icon-150x150.png</url>
	<title>WinCC Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>DMC Updates Siemens Open Library with SIMATIC WinCC Unified</title>
		<link>https://static.dmcinfo.com/blog/15754/dmc-updates-siemens-open-library-with-simatic-wincc-unified/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Thu, 16 Jan 2025 12:53:34 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Unified]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/15754/dmc-updates-siemens-open-library-with-simatic-wincc-unified/</guid>

					<description><![CDATA[<p>DMC recently updated the Siemens Open Library, which was updated to include SIMATIC WinCC Unified support. The free, open-source Siemens Open Library was developed by DMC in partnership with Siemens as a development resource for the Siemens community. It has been downloaded more than 12,000 times. &#160; The Siemens Open Library is a tool in [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/15754/dmc-updates-siemens-open-library-with-simatic-wincc-unified/">DMC Updates Siemens Open Library with SIMATIC WinCC Unified</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">DMC recently updated the <a href="https://openplclibrary.com/#latest-versions" target="_blank">Siemens Open Library</a>, which was updated to include SIMATIC WinCC Unified support. The free, open-source Siemens Open Library was developed by DMC in partnership with Siemens as a development resource for the Siemens community. It has been downloaded more than 12,000 times. &nbsp;</p>



<p class="wp-block-paragraph">The Siemens Open Library is a tool in helping industrial companies face the opportunities and challenges of modernization. DMC added HMI elements and faceplates for Siemens SIMATIC WinCC Unified, an integrated visualization system, to the code library to help users improve the digitalization and transparency of their industrial machines and operations.&nbsp;</p>



<p class="wp-block-paragraph">“From the start, our goal has been to help standardize and accelerate Siemens PLC and HMI development among integrators, OEMs, and end-users when modernizing their automation and control systems and solutions,” said Nick Shea, DMC Senior Director, Automation.&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="Device Faceplates in the Siemens Open Library" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Siemens-Open-Library-IconFaceplates.png"><br>
<em>Device Faceplates in the Siemens Open Library</em></p>



<h2 id="h-what-is-wincc-unified-nbsp" class="wp-block-heading">What is WinCC Unified?&nbsp;</h2>



<p class="wp-block-paragraph">WinCC Unified is a visualization system that links data from production’s operational technology (OT) with IT enterprise intelligence systems and other parallel PC applications running at the control system layer. This data is displayed in a holistic operating concept offering transparency across operations.&nbsp;</p>



<p class="wp-block-paragraph">DMC decided to upgrade the Siemens Open Library after Siemens released its SIMATIC WinCC Unified System in 2022 as part of TIA Portal v16. The library is now updated for TIA Portal V18 and V19.&nbsp;</p>



<p class="wp-block-paragraph">“With WinCC Unified’s feature-rich Javascript functions, the Library is much more usable for future-proofing PLC and HMI automation capabilities,” said Carl Remler, DMC Senior Project Engineer. “It also makes cross-platform development much easier and faster by enabling the programming of lightweight and maintenance-free HTML5 web clients.”&nbsp;</p>



<p class="wp-block-paragraph">According to Remler, “WinCC Unified enables a near object-oriented engineering approach to designing and configuring production lines and processes. This means engineers can define the characteristics of plant assets just once and reuse them as instances in hierarchically structured operations.”&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="WinCC Unified folder in the Siemens Open Library" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Siemens-Open-Library-WinccUnifiedFolder.png"><br>
<em>WinCC Unified folder in the Siemens Open Library</em></p>



<h2 class="wp-block-heading" aria-level="2" paraeid="{da00c237-1381-4cac-87e8-c60f2e0dcff4}{223}" paraid="1809092165" role="heading">Advantages of WinCC in the Siemens Open Library&nbsp;</h2>



<p class="wp-block-paragraph"><p paraeid="{da00c237-1381-4cac-87e8-c60f2e0dcff4}{235}" paraid="819162968">SIMATIC WinCC Unified brings three key advantages to the Siemens Open Library.&nbsp;</p></p>



<ul class="wp-block-list" role="list">
 

<li aria-setsize="-1" data-aria-level="1" data-aria-posinset="0" data-font="Aptos" data-leveltext="•" data-list-defn-props="{&quot;134224900&quot;:false,&quot;335551671&quot;:0,&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Aptos&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;•&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}" data-listid="2" role="listitem">
 

<p class="wp-block-paragraph" paraeid="{da00c237-1381-4cac-87e8-c60f2e0dcff4}{247}" paraid="1290887047"><strong>Single visualization system &nbsp;</strong><br />
 Featuring open interfaces with continuous scalability, WinCC Unified can scale for all use cases. It can provide HMIs for control panels on machines or for complex solutions where PCs communicate via API with third-party OT and IT systems.&nbsp;</p>


 </li>


</ul>



<ul class="wp-block-list" role="list">
 

<li aria-setsize="-1" data-aria-level="1" data-aria-posinset="1" data-font="Aptos" data-leveltext="•" data-list-defn-props="{&quot;134224900&quot;:false,&quot;335551671&quot;:0,&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Aptos&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;•&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}" data-listid="2" role="listitem">
 

<p class="wp-block-paragraph" paraeid="{65bc113e-958f-404a-9810-9d141bd87ed1}{26}" paraid="2030722330"><strong>Future-proofing applications&nbsp;</strong><br />
 Whether they&rsquo;re used onsite or remotely, WinCC Unified offers functionality across all HMI platforms. Using the latest technology like HTML5, JavaScript and SVG, WinCC Unified powers HMI platforms from tablets to machine control panels to system PCs.&nbsp;</p>


 </li>


</ul>



<ul class="wp-block-list" role="list">
 

<li aria-setsize="-1" data-aria-level="1" data-aria-posinset="2" data-font="Aptos" data-leveltext="•" data-list-defn-props="{&quot;134224900&quot;:false,&quot;335551671&quot;:0,&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Aptos&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;•&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}" data-listid="2" role="listitem">
 

<p class="wp-block-paragraph" paraeid="{65bc113e-958f-404a-9810-9d141bd87ed1}{40}" paraid="1321501536"><strong>Consistent usability &nbsp;</strong><br />
 WinCC Unified delivers faster and easier training for engineers and operators by using the same controls across all platforms. This simplifies engineering and ensures the best user experience.&nbsp;</p>


 </li>


</ul>



<p class="wp-block-paragraph"><p paraeid="{65bc113e-958f-404a-9810-9d141bd87ed1}{40}" paraid="1321501536"><img decoding="async" alt="Pump, Motor, and Tank Graphics in the Siemens Open Library" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Siemens-Open-Library-Pump-Graphics.png"><br>
<em>Pump, Motor, and Tank Graphics in the Siemens Open Library</em></p></p>



<p class="wp-block-paragraph"><p paraeid="{65bc113e-958f-404a-9810-9d141bd87ed1}{40}" paraid="1321501536">Other benefits that DMC has found using WinCC Unified include easier script debugging and modernized out-of-the-box styles. Additionally, the &#8220;openFaceplateInPopup&#8221; function automatically creates faceplate popups during runtime to speed up development and improve project organization. &nbsp;</p></p>



<p class="wp-block-paragraph"><p paraeid="{65bc113e-958f-404a-9810-9d141bd87ed1}{40}" paraid="1321501536"><img decoding="async" alt="Hopper level bar" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Siemens-Open-Library-HopperLevelBar.png">&nbsp;<img decoding="async" alt="VFD pop up" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Siemens-Open-Library-VFDPopup.png"><br>
<em>Left: hopper level bar; Right: VFD pop-up</em></p></p>



<p class="wp-block-paragraph"><p paraeid="{65bc113e-958f-404a-9810-9d141bd87ed1}{40}" paraid="1321501536"><img decoding="async" alt="Opening the Siemens Open Library in TIA Portal V19" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Siemens-Open-Library-V19.png"><br>
<em>Opening the Siemens Open Library in TIA Portal V19</em></p></p>



<p class="wp-block-paragraph">DMC looks forward to more opportunities help users modernize their industrial plants and operations using the Siemens Open Library and WinCC Unified. According to Shea, “With all the many advanced capabilities WinCC Unified provides DMC, we can expand our creative horizons on keeping our customers competitive and profitable today and futureproofing them with the flexibility and scalability they need for [tomorrow].”&nbsp;</p>



<div class="wp-block-group alignwide has-custom-light-blue-background-color has-background is-layout-flow wp-container-core-group-is-layout-dbd34961 wp-block-group-is-layout-flow" style="border-radius:20px;margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50);padding-right:0;padding-bottom:var(--wp--preset--spacing--50);padding-left:0">
<div class="wp-block-columns alignwide are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-43efaee5 wp-block-columns-is-layout-flex" style="padding-right:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:85%">
<h3 class="wp-block-heading has-text-align-left" id="h-have-an-upcoming-project-dmc-can-help-you-take-the-next-step"><strong>Accelerate Siemens HMI Development with Open, Reusable Tools</strong></h3>



<p class="has-text-align-left wp-block-paragraph" id="h-need-help-turning-ideas-into-outcomes-automation-project-to-the-next-level-contact-us-today-to-learn-more-about-our-solutions-and-how-we-can-help-you-achieve-your-goals">Learn more about our capabilities in <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/" data-type="page" data-id="420">Automation</a> for standardizing PLC and HMI development with the Siemens Open Library and <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming/" data-type="page" data-id="500">SIMATIC WinCC</a> Unified.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:15%">
<div class="wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-2236275c wp-block-buttons-is-layout-flex">
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-base-contrast-color has-text-color has-link-color wp-element-button" href="https://static.dmcinfo.com/contact/">Contact Us</a></div>
</div>
</div>
</div>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/15754/dmc-updates-siemens-open-library-with-simatic-wincc-unified/">DMC Updates Siemens Open Library with SIMATIC WinCC Unified</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>DMC&#8217;s Drinkbot Gets an HMI Upgrade to WinCC Unified</title>
		<link>https://static.dmcinfo.com/blog/16188/dmcs-drinkbot-gets-an-hmi-upgrade-to-wincc-unified/</link>
		
		<dc:creator><![CDATA[Evan Ripperger]]></dc:creator>
		<pubDate>Fri, 28 Jun 2024 13:18:26 +0000</pubDate>
				<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Drink Bot]]></category>
		<category><![CDATA[DrinkBot]]></category>
		<category><![CDATA[Siemens]]></category>
		<category><![CDATA[Simatic]]></category>
		<category><![CDATA[Simulation]]></category>
		<category><![CDATA[Unified]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/16188/dmcs-drinkbot-gets-an-hmi-upgrade-to-wincc-unified-14/</guid>

					<description><![CDATA[<p>Introduction The DMC Drinkbot is a robotic bartender powered by Siemens automation hardware. It was originally created in the DMC Denver office in 2016 using a Siemens S7-1200 PLC interfaced by a 7&#8243; SIMATIC Comfort Panel. Eight years after creation as Siemens has begun to phase out their COMFORT HMI Panels, DMC wanted to give [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/16188/dmcs-drinkbot-gets-an-hmi-upgrade-to-wincc-unified/">DMC&#8217;s Drinkbot Gets an HMI Upgrade to WinCC Unified</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 id="h-introduction" class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">The DMC Drinkbot is a robotic bartender powered by Siemens automation hardware. It was originally created in the DMC Denver office in 2016 using a Siemens S7-1200 PLC interfaced by a 7&#8243; SIMATIC Comfort Panel.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="687" height="419" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-1.png" alt="DMC Drinkbot 2024 WinCC upgrade" class="wp-image-35665" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-1.png 687w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-1-300x183.png 300w" sizes="(max-width: 687px) 100vw, 687px" /></figure>



<p class="wp-block-paragraph">Eight years after creation as Siemens has begun to phase out their COMFORT HMI Panels, DMC wanted to give Drinkbot an HMI upgrade. We received a new MTP700 Unified Comfort Panel that runs TIA Portal V19 WinCC Unified programs to show off the latest and greatest of Siemens HMI technology. This guide will walk through the steps taken to upgrade Drinkbot and the new features developed.</p>



<h2 id="h-background-and-operational-overview" class="wp-block-heading"><strong>Background and Operational Overview</strong></h2>



<p class="wp-block-paragraph">The DMC Drinkbot uses PROFINET communication for a Siemens G120 VFD drive controlled by an S7-1200 PLC. The user can choose drinks on a SIMATIC key panel or the MTP700 Unified Comfort Panel HMI that this blog focuses on. The user can choose between 44 standard drink recipes made from 8 bottles of alcohol and 6 mixers. There is also a custom drink option where the user can select any ingredient available based on the current configuration of the Drinkbot.&nbsp;</p>



<figure class="wp-block-image size-full"><img decoding="async" width="452" height="491" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-2.png" alt="DMC Drinkbot HMI Closeup Main Screen" class="wp-image-35667" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-2.png 452w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-2-276x300.png 276w" sizes="(max-width: 452px) 100vw, 452px" /></figure>



<p class="wp-block-paragraph">Without replacing any bottles on the machine, the ability to make alcoholic drinks can be toggled. If the Drinkbot is taken to an event where alcohol is not permitted, the bottles may also be swapped out for flavored syrups and soda water to make “Italian sodas”. The Italian soda switch overrides the selectable recipes limiting the machine to the new available ingredients. The settings screen for these configurations is accessible by selecting the DMC logo in the upper left corner where the user can view alarms and diagnostics and change the machine mode. The motion axis of the Drinkbot can also be manually operated for demonstration and debugging purposes.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="608" height="359" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-3.png" alt="Drinkbot WinCC Settings and Diagnostics Navigation" class="wp-image-35668" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-3.png 608w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-3-300x177.png 300w" sizes="(max-width: 608px) 100vw, 608px" /></figure>



<p class="wp-block-paragraph">For a detailed history of the development of Drinkbot, refer to the following two blogposts.</p>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/blog/23327/dmc-engineers-serve-up-a-siemens-s7-powered-drinkbot/">DMC Engineers Serve up a Siemens S7 Powered DrinkBot </a></p>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/blog/20875/adding-siemens-mindsphere-tracking-to-the-dmc-drinkbot/">Adding Siemens MindSphere Tracking to the DMC DrinkBot</a></p>



<h2 id="h-data-2-unified" class="wp-block-heading"><strong>Data 2 Unified</strong></h2>



<p class="wp-block-paragraph">About half of the work for creating the Unified program was accomplished using the Data2Unified tool by Siemens. This tool does a great job taking an older Comfort program and converting it to Unified, maintaining the basic layout and functionality of most HMI Elements and Controls. For some deprecated elements, the tool will even generate custom VBA scripting to maintain original functionality.</p>



<p class="wp-block-paragraph">There are current limitations to this tool as the conversion will notably not create alarm lists, faceplates, and navigation elements. Additionally, due to WinCC Unified’s aspect flexibility, it is typically worth touching up the screens’ layout and aesthetics. The custom scripting that is auto-generated may also need to be redone as more efficient element functions can be created manually without scripts. Typically, the automatically generated scripts will function as intended, but the script will be written in unconventional and overcomplicated language. Double-checking these scripts and replacing them with standard functions where applicable is good practice.</p>



<p class="wp-block-paragraph">After running the conversion, most of the Drinkbot settings screens were recreated to match the previous comfort program to maximize the ease of configuring the system during events. The cleaning sequence screens that use basic elements were converted seamlessly into Unified. Settings screens, like the alarms and diagnostics, were easily replaced with drop-in standard Siemens resources.</p>



<p class="wp-block-paragraph">The bulk of the work left out by the tool was completed when modernizing the faceplates for drink selection and the recipe management system talked about in the following section. &nbsp;</p>



<h2 id="h-recipe-conversion" class="wp-block-heading"><strong>Recipe Conversion</strong></h2>



<p class="wp-block-paragraph">In the Comfort program, there was a built-in recipe management feature that the developer could create their own data type and store recipes locally on the HMI panel to be written onto the PLC when selected. In the Drinkbot Comfort HMI the recipe list included 44 drinks detailing their ingredients and quantities.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="435" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-4.png" alt="Drinkbot Comfort HMI Recipe Data Records" class="wp-image-35672" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-4.png 975w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-4-300x134.png 300w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-4-768x343.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<p class="wp-block-paragraph">This recipe feature was a convenient way to store information and access data to be written into the instructions of the PLC. In WinCC Unified, this feature was removed, so this storage was recreated using a user-defined type and a data block on the PLC.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="974" height="580" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-5-1.png" alt="Drinkbot WinCC Unified Recipe UDT DataBlock" class="wp-image-35673" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-5-1.png 974w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-5-1-300x179.png 300w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-5-1-768x457.png 768w" sizes="(max-width: 974px) 100vw, 974px" /></figure>



<p class="wp-block-paragraph">The dbHMI data block stores all of the original recipe data using integers to signify ingredient quantities and a single string for the name of the recipe. Memory on the PLC is conserved by these simple UDTs, provided that the bottle setup in the Drinkbot is always the same. For simplicity, to set up the Drinkbot, the user consults a printout that lists all of the ingredient bottle positions. The string and 18 integers are then fed to the HMI through a multiplexed array 11 recipes at a time.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="967" height="415" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-6.png" alt="DrinkBot WinCC Unified HMI multiplex tag" class="wp-image-35676" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-6.png 967w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-6-300x129.png 300w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-6-768x330.png 768w" sizes="(max-width: 967px) 100vw, 967px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="663" height="393" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-7.png" alt="Drinkbot WinCC HMI Closeup main screen" class="wp-image-35695" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-7.png 663w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-7-300x178.png 300w" sizes="(max-width: 663px) 100vw, 663px" /></figure>



<p class="wp-block-paragraph">The 11 recipes are selected to be read based on the page of the HMI drink list the user is currently reading. The last display recipe on the page is number 12 that is left intentionally blank. A custom drink faceplate is opened when the custom button is pressed that displays all possible ingredients in the Drinkbot. The user can select how many of each ingredient to make their drink based on if alcohol is toggled on or the Drinkbot is displaying Italian Sodas. Once completed the ‘Make Drink’ button populates the display recipe 12 and once the Drinkbot completes the cycle the recipe is cleared.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="656" height="386" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-8.png" alt="DrinkBot Unified HMI Custom drink screen" class="wp-image-35696" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-8.png 656w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-8-300x177.png 300w" sizes="(max-width: 656px) 100vw, 656px" /></figure>



<p class="wp-block-paragraph">To access standard drinks that access one of the stored recipes, 11 faceplate buttons are displayed on each page. These simple faceplates display the drink name based on page number and intake the recipe parameters once selected. They serve as an in between display button to open a nested faceplate that will display the selected drink in detail. The nested standard drink faceplate used in reading and writing recipe data is talked about in the next section.</p>



<p class="wp-block-paragraph"><strong>Faceplates and Scripting </strong></p>



<p class="wp-block-paragraph">In the Comfort HMI, having a local way to manage the recipes within the HMI made development simpler as a single popup recipe screen could read the ingredients for each drink and display all possible options at once in a matrix.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="505" height="372" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-9.png" alt="Drinkbot Comfort HMI Recipe Popup Screen" class="wp-image-35697" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-9.png 505w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-9-300x221.png 300w" sizes="(max-width: 505px) 100vw, 505px" /></figure>



<p class="wp-block-paragraph">The Drinkbot is intended to be used at live events in a fast paced setting so for the WinCC update, the drink recipe popup should prioritize readability and information efficiency. The new Unified program uses a standard drink faceplate that only displays ingredients used in a particular drink recipe.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="509" height="306" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-10-1.png" alt="DrinkBot WinCC HMI Recipe Nested Faceplate" class="wp-image-35702" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-10-1.png 509w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-10-1-300x180.png 300w" sizes="(max-width: 509px) 100vw, 509px" /></figure>



<p class="wp-block-paragraph">The maximum ingredient amount in the original 44 drinks was 3 alcohols and 3 mixers. Custom scripting is used to take the recipe fed into the faceplate and populate the drink name plus the ingredients with their amounts. The script takes in the name and amount of each drink in ounces and automatically fills out each box for how many ingredients exist in each recipe. The user then has controls to make the drink and stop the process midway if needed.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="678" height="470" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-11-1.png" alt="Drinkbot Siemens MTP700 SIMATIC HMI Recipe Faceplate" class="wp-image-35703" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-11-1.png 678w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-11-1-300x208.png 300w" sizes="(max-width: 678px) 100vw, 678px" /></figure>



<p class="wp-block-paragraph">For taking Drinkbot to events where alcohol is not an option, the machine can also be configured to dispense “Italian sodas” using soda water and flavored syrup. Selecting this mode locks the display page to an Italian soda mode and makes the button faceplates open a nested Italian soda faceplate. All Italian soda recipes only include up to two syrups and eight ounces of soda so the faceplate is simplified and resized.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="468" height="279" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-12.png" alt="Drinkbot WinCC HMI Italian Soda Main" class="wp-image-35704" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-12.png 468w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-12-300x179.png 300w" sizes="(max-width: 468px) 100vw, 468px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="457" height="276" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-13.png" alt="Drinkbot WinCC HMI Italian Soda Recipe" class="wp-image-35705" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-13.png 457w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-13-300x181.png 300w" sizes="(max-width: 457px) 100vw, 457px" /></figure>



<p class="wp-block-paragraph">For information on how to create a faceplate in WinCC unified, refer to the guide here: <a href="https://static.dmcinfo.com/blog/18140/creating-faceplates-in-wincc-unified/">Creating Faceplates in WinCC Unified</a></p>



<h2 id="h-conclusion" class="wp-block-heading"><strong>Conclusion</strong></h2>



<p class="wp-block-paragraph">The updated HMI program improves the usability and functionality of the COMFORT version. The custom scripted nested faceplates using the new recipe storage system in Unified make it easier to order a drink. To celebrate the completion of the WinCC Unified upgrade the DMC Chicago office had a happy hour party to have the Drinkbot make cocktails and entertain.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="518" height="466" src="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-14.png" alt="Drinkbot Party at DMC Chicago Office" class="wp-image-35706" srcset="https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-14.png 518w, https://static.dmcinfo.com/wp-content/uploads/2024/06/drink-robot-14-300x270.png 300w" sizes="(max-width: 518px) 100vw, 518px" /></figure>



<div class="wp-block-group alignwide has-custom-light-blue-background-color has-background is-layout-flow wp-container-core-group-is-layout-dbd34961 wp-block-group-is-layout-flow" style="border-radius:20px;margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50);padding-right:0;padding-bottom:var(--wp--preset--spacing--50);padding-left:0">
<div class="wp-block-columns alignwide are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-43efaee5 wp-block-columns-is-layout-flex" style="padding-right:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:85%">
<h3 class="wp-block-heading has-text-align-left" id="h-have-an-upcoming-project-dmc-can-help-you-take-the-next-step"><strong>DrinkBot Gets a Fresh Pour with WinCC Unified</strong>.</h3>



<p class="has-text-align-left wp-block-paragraph" id="h-need-help-turning-ideas-into-outcomes-automation-project-to-the-next-level-contact-us-today-to-learn-more-about-our-solutions-and-how-we-can-help-you-achieve-your-goals">Learn more about our <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/" data-type="page" data-id="420">Automation</a> capabilities in utilizing <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming/" data-type="page" data-id="500">Siemens HMIs</a> with modern faceplates, custom scripting, and recipe management.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:15%">
<div class="wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-2236275c wp-block-buttons-is-layout-flex">
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-base-contrast-color has-text-color has-link-color wp-element-button" href="https://static.dmcinfo.com/contact/">Contact Us</a></div>
</div>
</div>
</div>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/16188/dmcs-drinkbot-gets-an-hmi-upgrade-to-wincc-unified/">DMC&#8217;s Drinkbot Gets an HMI Upgrade to WinCC Unified</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Simulating Siemens WinCC Unified HMI with Real PLC Data</title>
		<link>https://static.dmcinfo.com/blog/16194/simulating-siemens-wincc-unified-hmi-with-real-plc-data/</link>
		
		<dc:creator><![CDATA[Evan Ripperger]]></dc:creator>
		<pubDate>Wed, 26 Jun 2024 17:39:53 +0000</pubDate>
				<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[S7ONLINE]]></category>
		<category><![CDATA[Siemens]]></category>
		<category><![CDATA[Simatic]]></category>
		<category><![CDATA[Simulation]]></category>
		<category><![CDATA[Unified]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/16194/simulating-siemens-wincc-unified-hmi-with-real-plc-data/</guid>

					<description><![CDATA[<p>In this blog we will explore&#160;simulating a Siemens WinCC Unified Version 19 HMI program using data from a connected physical PLC. In TIA version 19, the Siemens Communication Settings&#160;tool or Set PG/PC Interface&#160;is the easiest way to configure the online access path for the PC simulation to communicate with your hardware. The Simatic Step 7 [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/16194/simulating-siemens-wincc-unified-hmi-with-real-plc-data/">Simulating Siemens WinCC Unified HMI with Real PLC Data</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In this blog we will explore&nbsp;simulating a Siemens WinCC Unified Version 19 HMI program using data from a connected physical PLC. In TIA version 19, the Siemens Communication Settings&nbsp;tool or Set PG/PC Interface&nbsp;is the easiest way to configure the online access path for the PC simulation to communicate with your hardware.</p>



<p class="wp-block-paragraph">The Simatic Step 7 manager uses the S7ONLINE access point for communication on the PC/PG interface. By default, the access path on S7ONLINE is set to none as simulating a WinCC HMI program will run disconnected of the PLC program through Simatic manager. The HMI in this state will not display tags read from the PLC but will use HMI local tags and should be fully navigable.</p>



<h2 id="h-connection-parameters" class="wp-block-heading">Connection Parameters</h2>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Screenshot-2024-06-26-131614.png" alt="Siemens Communication Settings Windows Control Panel"/></figure>



<p class="wp-block-paragraph">The easiest tool to use for&nbsp;establishing a simulator connection is the Siemens Communication Settings&nbsp;tool located in the control panel. Opening the tool will provide you with all possible connection modules on the computer as well as their respective parameters and diagnostics tools. From the address menu you can configure your IP address in the network connections menu of your PC.</p>



<p class="wp-block-paragraph">To establish simulator-hardware connection, open the Access points&nbsp;menu. Select S7ONLINE and open the dropdown arrow. From here you can select the interface parameter which should match the same pathway that the PC uses to communicate with the hardware. The module property should auto populate and match the network connection name you configured.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Screenshot-2024-06-26-132435.png" alt="Siemens Communication Settings Tool"/></figure>



<p class="wp-block-paragraph">In older versions of TIA Portal there is an interface configuration tool found in the Windows control panel named Set PG/PC Interface. From here, you can set the same pathway that will enable communication between the simulator and PLC.</p>



<p class="wp-block-paragraph">After opening the tool, navigate to the Access path tab and select S7ONLINE as the access point. In the box below you will see all available interfaces for the path to take. Select the module in the list that matches the communication method you are using to talk to your hardware.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Screenshot-2024-06-26-161956.png" alt="Set PG/PC Interface tool"/></figure>



<p class="wp-block-paragraph">After selecting the correct module, you can close the tool and launch your WinCC simulation from Simatic Manager or TIA Portal. Provided that you are in contact, the S7ONLINE point should update your simulation with real data coming from the PLC.</p>



<h2 id="h-troubleshooting" class="wp-block-heading">Troubleshooting</h2>



<p class="wp-block-paragraph">If the Set PC/PG tool opens but does not display the S7ONLINE access point, it may be resolved by downloading a Siemens PC_Identifier&nbsp;hotfix support package linked below.</p>



<p class="wp-block-paragraph"><a href="https://support.industry.siemens.com/cs/document/109812676/simatic-s7-plcsim-advanced-v4-0-service-pack-1-hotfix-1?dti=0&amp;lc=en-WW" target="_blank">SIMATIC S7-PLCSIM Advanced V4.0</a></p>



<p class="wp-block-paragraph">Troubleshooting the PLC connection can follow the same path as a typical process to go online with hardware. Ensure that you have a stable ethernet connection to the PLC you are attempting to communicate with. On the S7ONLINE path that you configured, note the module name that auto populated when the interface parameter was assigned. In your Windows taskbar search &#8220;view network connections.&#8221;&nbsp;Then, in this menu locate the ethernet driver that has the same module name as on the S7ONLINE path you are trying to use. In the popup window, go to properties then IPv4 and assign your own IP address on the same subnet and mask as the desired PLC. Once complete you should be able to ping the IP of your PLC from the command prompt.</p>



<p class="wp-block-paragraph">If the simulated instance of your HMI still does not communicate with the PLC, stop the simulation and verify that the PC/PG interface selected when trying to go online with the PLC is the same as configured in either of the tools. Redownloading the program and verifying run mode is active may also assist with troubleshooting measures.</p>



<div class="wp-block-group alignwide has-custom-light-blue-background-color has-background is-layout-flow wp-container-core-group-is-layout-dbd34961 wp-block-group-is-layout-flow" style="border-radius:20px;margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50);padding-right:0;padding-bottom:var(--wp--preset--spacing--50);padding-left:0">
<div class="wp-block-columns alignwide are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-43efaee5 wp-block-columns-is-layout-flex" style="padding-right:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:85%">
<h3 class="wp-block-heading has-text-align-left" id="h-have-an-upcoming-project-dmc-can-help-you-take-the-next-step"><strong>Test WinCC Unified HMIs with Live PLC Data</strong></h3>



<p class="has-text-align-left wp-block-paragraph" id="h-need-help-turning-ideas-into-outcomes-automation-project-to-the-next-level-contact-us-today-to-learn-more-about-our-solutions-and-how-we-can-help-you-achieve-your-goals">Learn more about our Siemens <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/" data-type="page" data-id="441">PLC</a> and <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/" data-type="page" data-id="497">HMI</a> capabilities in WinCC Unified simulation, and our expertise in <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/" data-type="page" data-id="420">Automation</a>.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:15%">
<div class="wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-2236275c wp-block-buttons-is-layout-flex">
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-base-contrast-color has-text-color has-link-color wp-element-button" href="https://static.dmcinfo.com/contact/">Contact Us</a></div>
</div>
</div>
</div>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/16194/simulating-siemens-wincc-unified-hmi-with-real-plc-data/">Simulating Siemens WinCC Unified HMI with Real PLC Data</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 10 &#8211; Panel Nesting and $-Parameters</title>
		<link>https://static.dmcinfo.com/blog/19860/getting-started-with-wincc-oa-part-10-panel-nesting-and-parameters/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Mon, 22 Jun 2020 17:09:40 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/19860/getting-started-with-wincc-oa-part-10-panel-nesting-and-parameters/</guid>

					<description><![CDATA[<p>Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the prior installments before proceeding: Way back in Part 3 of “Getting Started with WinCC OA”, we investigated the basics of panel creation and development by adding objects and configuring their properties. In [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/19860/getting-started-with-wincc-oa-part-10-panel-nesting-and-parameters/">Getting Started with WinCC OA: Part 10 &#8211; Panel Nesting and $-Parameters</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the prior installments before proceeding:</p>



<ul class="wp-block-list">
<li><a href="https://static.dmcinfo.com/blog/21725/getting-started-with-wincc-oa-part-1-creating-opening-a-project/">Part 1: Creating and Opening a Project</a></li>



<li><a href="https://static.dmcinfo.com/blog/21697/getting-started-with-wincc-oa-part-2-folder-structure-gedi-layout/">Part 2: Folder Structure and Gedi Layout</a></li>



<li><a href="https://static.dmcinfo.com/blog/21531/getting-started-with-wincc-oa-part-3-panels-the-basics/">Part 3: Panels | The Basics</a></li>



<li><a href="https://static.dmcinfo.com/blog/21450/getting-started-with-wincc-oa-part-4-panel-scripting-environments-and-quicktest/">Part 4: Panel Scripting Environments and QuickTest</a></li>



<li><a href="https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/">Part 5: Scripting Syntax</a></li>



<li><a href="https://static.dmcinfo.com/blog/21256/getting-started-with-wincc-oa-part-6-para-overview-and-datapoint-creation/">Part 6: Para Overview and Datapoint Creation</a></li>



<li><a href="https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/">Part 7: Interacting with Datapoints via Scripting</a></li>



<li><a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Part 8: Libraries</a></li>



<li><a href="https://static.dmcinfo.com/blog/20143/getting-started-with-wincc-oa-part-9-color-database-and-high-performance-best-practices/">Part 9: Color Database &amp; High Performance Best Practices</a></li>
</ul>



<p class="wp-block-paragraph">Way back in <a href="https://static.dmcinfo.com/blog/21531/getting-started-with-wincc-oa-part-3-panels-the-basics/">Part 3 of “Getting Started with WinCC OA”</a>, we investigated the basics of panel creation and development by adding objects and configuring their properties. In Part 10, we&#8217;ll dive back into the world of panels by looking at panel nesting and the mechanism with which we pass information from one panel to its nested counterpart: $-Parameters.</p>



<h2 class="wp-block-heading" id="h-panel-references-embedded-panels">Panel References/Embedded Panels</h2>



<p class="wp-block-paragraph">Panel references are used to insert or nest existing panels (reference panels) into other panels (parent panels). This is useful for creating commonly repeated objects like valves or motors and utilizing them in larger systems. If changes are made to the original panel, all references will similarly update within their parent panel.</p>



<p class="wp-block-paragraph">To create a panel reference, simply drag a panel from the Project View tree onto the working space of another panel.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="278" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/1-embedded-panels.png" alt="1 embedded panels" class="wp-image-19837" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/1-embedded-panels.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/1-embedded-panels-300x93.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/1-embedded-panels-768x237.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<h2 class="wp-block-heading" id="h-parameters">$-Parameters</h2>



<p class="wp-block-paragraph">Often, developers will want a reference panel to receive specific properties from its parent panel (including, but not limited to, colors, types, and text); This is done via $-Parameters(dollar parameters). <strong>$-Parameters</strong> are defined in reference panel scripting simply by placing a “$” in front of a variable name. Whenever a reference panel is added to a parent panel, a <strong>“Reference Defining”</strong> popup will appear and the user can configure $-Parameters as they choose. $-Parameters can be later changed by either:</p>



<ol class="wp-block-list">
<li>Double-clicking the panel reference to bring up the “Reference Defining” popup</li>



<li>Changing the $-Parameters directly in the panel properties</li>
</ol>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="625" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/2-motor-panel.png" alt="2 motor panel" class="wp-image-19838" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/2-motor-panel.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/2-motor-panel-300x208.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/2-motor-panel-768x533.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<h2 class="wp-block-heading" id="h-example">Example</h2>



<p class="wp-block-paragraph">To continue with our evolving example panel from prior “Getting Started with WinCC OA” installments, let’s now assume that we now have three motors that we want to use with our TestPanel. With two additional motors, we must first add additional datapoints in Para to represent the new motors’ PLC tags. Simply add two new datapoints (“myMotor2” and “myMotor3”) underneath our “myDatapointType” datapoint type.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="642" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/3-motor-datatype.png" alt="3 motor datatype" class="wp-image-19839" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/3-motor-datatype.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/3-motor-datatype-300x214.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/3-motor-datatype-768x548.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">Now that we have our additional motors configured in Para, we’ll want to create three references of TestPanel in another parent panel. However, our current TestPanel is configured to work only with the<strong> “myMotor”</strong> datapoint.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="256" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/4-motor-speed-script.png" alt="4 motor speed script" class="wp-image-19840" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/4-motor-speed-script.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/4-motor-speed-script-300x85.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/4-motor-speed-script-768x218.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">To utilize our TestPanel as a re-usable reference, we must first incorporate flexibility and allow the panel to use a variety of datapoints, not just “myMotor”. How might we do this? With $-Parameters.</p>



<p class="wp-block-paragraph">To implement a $-Parameter within our TestPanel script, we’ll assign the $-Parameter <strong>“$motorDpe”</strong> to the internal string variable <strong>“motorDpe”</strong> and then replace every occurrence of the text “myMotor” with the variable “motorDpe.” With this modification, we may pass in “myMotor”, “myMotor2”, and “myMotor3” into the TestPanel to substitute for the string “motorDpe.”</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="320" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/5-motor-dep.png" alt="5 motor dep" class="wp-image-19841" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/5-motor-dep.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/5-motor-dep-300x107.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/5-motor-dep-768x273.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">CTRL Script (WinCC OA)</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>#uses "OpenLibrary/Enums/MotorStatusType"
#uses "ColorConst"

string motorDpe = $motorDpe;

//=============================== Panel initialization =========================================
initializePanel()
{
  //Whenever rSpeed or rMaxSpeed changes, call the function "onSpeedChange"
  dpConnect("onSpeedChange", motorDpe + ".rSpeed", motorDpe + ".rMaxSpeed");

  //Whenever iStatus changes, call the function "onStatusChange"
  dpConnect("onStatusChange", motorDpe + ".iStatus");

  //Set rectangle's label text to its motor dpe
  setValue("motorLabel", "text", motorDpe);
}


//=============================== Text Field Command =========================================
//Textbox is selected and user keys "Enter"
void textboxCmd()
{
  //Assign the textbox's text value to rMaxSpeed
  dpSet(motorDpe + ".rMaxSpeed", maxSpeedTextbox.text);
}


//=============================== On Speed / Max Speed Value Change =================================
void onSpeedChange(string speedDp, float speedValue, string maxSpeedDp, float maxSpeedValue)
{
  //Define the variable whose value will be assigned to iStatus
  int iStatusValue;

  //Determine what value to assign iStatusValue (and subsequently "myMotor.iStatus")
  switch (speedValue)
  {
    //If "myMotor.rSpeed" is 0, set iStatusValue to 0
    case 0:
      iStatusValue = (int)MotorStatusType::Stopped;
      break;

    //Otherwise, if "myMotor.rSpeed" > "myMotor.rMaxSpeed", set iStatusValue to Estop status int
    //           if not, set iStatusValue to Forward status int
    default:
      iStatusValue = ((speedValue >= maxSpeedValue) ? (int)MotorStatusType::Estop : (int)MotorStatusType::Forward);
      break;
  }

  //Assign iStatusValue's value to "myMotor.iStatus"
  dpSet(motorDpe + ".iStatus", iStatusValue);

  //Set the maxSpeedTextbox and speedTextbox's test to their respective values
  //NOTE: dpValToString ensures the units we assigned earlier in the series are displayed.
  //      Simply using &lt;Textbox>.text = &lt;speedValue> will work, but will not display appropriate units
  maxSpeedTextbox.text = dpValToString(motorDpe + ".rMaxSpeed", maxSpeedValue, true);
  speedTextbox.text = dpValToString(motorDpe + ".rSpeed", speedValue, true);
}

//=============================== On Status Change =========================================
void onStatusChange(string statusDp, int statusValue)
{
  //Define the variable whose value will be assigned to the rectangle's color property
  string rectangleColor;

  //Determine color to assign to rectangle based off iStatus
  if (statusValue == (int)MotorStatusType::Stopped)
  {
    rectangleColor = STOPPED_COLOR;
  }

  if (statusValue == (int)MotorStatusType::Estop)
  {
    rectangleColor = ESTOPPED_COLOR;
  }

  if (statusValue == (int)MotorStatusType::Forward)
  {
    rectangleColor = FORWARD_COLOR;
  }

  //Assign selected color to rectangle
  setValue("rectangle", "backCol", rectangleColor);
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #9CDCFE">#uses</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;OpenLibrary/Enums/MotorStatusType&quot;</span></span>
<span class="line"><span style="color: #9CDCFE">#uses</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;ColorConst&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">string motorDpe = $motorDpe;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">//=============================== Panel initialization =========================================</span></span>
<span class="line"><span style="color: #DCDCAA">initializePanel</span><span style="color: #D4D4D4">()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #6A9955">  //Whenever rSpeed or rMaxSpeed changes, call the function &quot;onSpeedChange&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">dpConnect</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;onSpeedChange&quot;</span><span style="color: #D4D4D4">, motorDpe + </span><span style="color: #CE9178">&quot;.rSpeed&quot;</span><span style="color: #D4D4D4">, motorDpe + </span><span style="color: #CE9178">&quot;.rMaxSpeed&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">  //Whenever iStatus changes, call the function &quot;onStatusChange&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">dpConnect</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;onStatusChange&quot;</span><span style="color: #D4D4D4">, motorDpe + </span><span style="color: #CE9178">&quot;.iStatus&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">  //Set rectangle&apos;s label text to its motor dpe</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">setValue</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;motorLabel&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;text&quot;</span><span style="color: #D4D4D4">, motorDpe);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">//=============================== Text Field Command =========================================</span></span>
<span class="line"><span style="color: #6A9955">//Textbox is selected and user keys &quot;Enter&quot;</span></span>
<span class="line"><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">textboxCmd</span><span style="color: #D4D4D4">()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #6A9955">  //Assign the textbox&apos;s text value to rMaxSpeed</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">dpSet</span><span style="color: #D4D4D4">(motorDpe + </span><span style="color: #CE9178">&quot;.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">maxSpeedTextbox</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">text</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">//=============================== On Speed / Max Speed Value Change =================================</span></span>
<span class="line"><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">onSpeedChange</span><span style="color: #D4D4D4">(</span><span style="color: #4EC9B0">string</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">speedDp</span><span style="color: #D4D4D4">, </span><span style="color: #569CD6">float</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">speedValue</span><span style="color: #D4D4D4">, </span><span style="color: #4EC9B0">string</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">maxSpeedDp</span><span style="color: #D4D4D4">, </span><span style="color: #569CD6">float</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">maxSpeedValue</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #6A9955">  //Define the variable whose value will be assigned to iStatus</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">int</span><span style="color: #D4D4D4"> iStatusValue;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">  //Determine what value to assign iStatusValue (and subsequently &quot;myMotor.iStatus&quot;)</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">switch</span><span style="color: #D4D4D4"> (speedValue)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #6A9955">    //If &quot;myMotor.rSpeed&quot; is 0, set iStatusValue to 0</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">case</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">:</span></span>
<span class="line"><span style="color: #D4D4D4">      iStatusValue = (</span><span style="color: #569CD6">int</span><span style="color: #D4D4D4">)</span><span style="color: #4EC9B0">MotorStatusType</span><span style="color: #D4D4D4">::Stopped;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">    //Otherwise, if &quot;myMotor.rSpeed&quot; &gt; &quot;myMotor.rMaxSpeed&quot;, set iStatusValue to Estop status int</span></span>
<span class="line"><span style="color: #6A9955">    //           if not, set iStatusValue to Forward status int</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">default</span><span style="color: #D4D4D4">:</span></span>
<span class="line"><span style="color: #D4D4D4">      iStatusValue = ((speedValue &gt;= maxSpeedValue) ? (</span><span style="color: #569CD6">int</span><span style="color: #D4D4D4">)</span><span style="color: #4EC9B0">MotorStatusType</span><span style="color: #D4D4D4">::Estop : (</span><span style="color: #569CD6">int</span><span style="color: #D4D4D4">)</span><span style="color: #4EC9B0">MotorStatusType</span><span style="color: #D4D4D4">::Forward);</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">  //Assign iStatusValue&apos;s value to &quot;myMotor.iStatus&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">dpSet</span><span style="color: #D4D4D4">(motorDpe + </span><span style="color: #CE9178">&quot;.iStatus&quot;</span><span style="color: #D4D4D4">, iStatusValue);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">  //Set the maxSpeedTextbox and speedTextbox&apos;s test to their respective values</span></span>
<span class="line"><span style="color: #6A9955">  //NOTE: dpValToString ensures the units we assigned earlier in the series are displayed.</span></span>
<span class="line"><span style="color: #6A9955">  //      Simply using &lt;Textbox&gt;.text = &lt;speedValue&gt; will work, but will not display appropriate units</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">maxSpeedTextbox</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">text</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">dpValToString</span><span style="color: #D4D4D4">(motorDpe + </span><span style="color: #CE9178">&quot;.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, maxSpeedValue, </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">speedTextbox</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">text</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">dpValToString</span><span style="color: #D4D4D4">(motorDpe + </span><span style="color: #CE9178">&quot;.rSpeed&quot;</span><span style="color: #D4D4D4">, speedValue, </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">//=============================== On Status Change =========================================</span></span>
<span class="line"><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">onStatusChange</span><span style="color: #D4D4D4">(</span><span style="color: #4EC9B0">string</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">statusDp</span><span style="color: #D4D4D4">, </span><span style="color: #569CD6">int</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">statusValue</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #6A9955">  //Define the variable whose value will be assigned to the rectangle&apos;s color property</span></span>
<span class="line"><span style="color: #D4D4D4">  string rectangleColor;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">  //Determine color to assign to rectangle based off iStatus</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #569CD6">int</span><span style="color: #D4D4D4">)</span><span style="color: #4EC9B0">MotorStatusType</span><span style="color: #D4D4D4">::Stopped)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = STOPPED_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #569CD6">int</span><span style="color: #D4D4D4">)</span><span style="color: #4EC9B0">MotorStatusType</span><span style="color: #D4D4D4">::Estop)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = ESTOPPED_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #569CD6">int</span><span style="color: #D4D4D4">)</span><span style="color: #4EC9B0">MotorStatusType</span><span style="color: #D4D4D4">::Forward)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = FORWARD_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">  //Assign selected color to rectangle</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">setValue</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;rectangle&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;backCol&quot;</span><span style="color: #D4D4D4">, rectangleColor);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<p class="wp-block-paragraph"><strong>NOTE:</strong> $-Parameters can be interspersed throughout our code; wherever a $-Parameter is referenced, the value passed in from the parent panel will take its place. DMC’s best practices, however, entail using a $-Parameter only once by assigning an internal variable to the $-Parameter and then using said variable within the panel’s script. In the case a $-Parameter needs to have its name changed, the modification only needs to be made once in the panel code.</p>



<p class="wp-block-paragraph">Now that our TestPanel is configured to accept a variety of datapoints (of type “myDatapointType”), we may now begin creating panel references.</p>



<ol class="wp-block-list">
<li>Create a parent panel called <strong>“ParentPanel.”</strong></li>



<li>Drag a <strong>“TestPanel”</strong> into the “ParentPanel” working space</li>



<li>Add the datapoint <strong>“myMotor”</strong> to the <strong>“$motorDpe”</strong> value field
<ul class="wp-block-list">
<li>This can be done in the reference panel&#8217;s &#8220;Reference defining&#8221; popup</li>



<li>Or in the reference panel&#8217;s Property editor</li>
</ul>
</li>



<li>Repeat steps 2 and 3 for the datapoints <strong>“myMotor2”</strong> and <strong>“myMotor3.”</strong></li>
</ol>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="329" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/7-parent-panel.png" alt="7 parent panel" class="wp-image-19842" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/7-parent-panel.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/7-parent-panel-300x110.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/7-parent-panel-768x281.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="has-text-align-center wp-block-paragraph"><strong>Or</strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="508" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/8-property-editor.png" alt="8 property editor" class="wp-image-19843" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/8-property-editor.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/8-property-editor-300x169.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/8-property-editor-768x433.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">Congratulations! You’ve created a parent panel with three reference panels. If any changes are made to TestPanel, those changes would propagate into the parent panels’ references. Let’s test this.</p>



<p class="wp-block-paragraph">Since it’s not evident which panel reference refers to which motor, we’ll make a couple of modifications within TestPanel. We’ll first add a primitive text object over our rectangle (name ‘motorLabel’, set Foreground Color to ‘Base_White’, change the text to ‘Motor Dpe’, and center the text over the ‘rectangle’ object) to serve as a label.</p>



<p class="wp-block-paragraph">Additionally, we’ll add a <strong>setValue</strong> command to the panel initialization in Scope Lib to populate the label with the correct motor dpe.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="401" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/9-motor-test-panel.png" alt="9 motor test panel" class="wp-image-19844" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/9-motor-test-panel.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/9-motor-test-panel-300x134.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/9-motor-test-panel-768x342.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="546" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/10-test-panel-props.png" alt="10 test panel props" class="wp-image-19845" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/10-test-panel-props.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/10-test-panel-props-300x182.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/10-test-panel-props-768x466.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="609" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/11-test-panel-script.png" alt="11 test panel script" class="wp-image-19846" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/11-test-panel-script.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/11-test-panel-script-300x203.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/11-test-panel-script-768x520.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">Upon opening ParentPanel (if ParentPanel is already open, close it so that the working space’s reference panels can be updated) and running QuickTest, you’ll notice the new panel titles are now labeled “myMotor”, “myMotor2”, and “myMotor3.”</p>



<p class="wp-block-paragraph">Furthermore, you’ll notice that changing rSpeed and rMaxSpeed in each of the datapoints (myMotor, myMotor2, and myMotor3) all reflect on their appropriate panels.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="704" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/12-all-motors.png" alt="12 all motors" class="wp-image-19847" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/12-all-motors.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/12-all-motors-300x235.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/12-all-motors-768x601.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<h2 class="wp-block-heading" id="h-additional-parameter-features">Additional $-Parameter Features</h2>



<p class="wp-block-paragraph"><u><strong>Optional parameters</strong></u></p>



<p class="wp-block-paragraph">By default, $-Parameters are required to be passed down from parent panel to reference panel. When a reference panel is created, its dollar parameters will, by default, be self-defined.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="450" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/13-panel-parameter.png" alt="13 panel parameter" class="wp-image-19848" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/13-panel-parameter.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/13-panel-parameter-300x150.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/13-panel-parameter-768x384.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="670" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/14-motor-properties.png" alt="14 motor properties" class="wp-image-19849" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/14-motor-properties.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/14-motor-properties-300x223.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/14-motor-properties-768x572.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">If no alternative $-Parameter is provided, the panel in runtime will generate an error (assuming the parent panel does not become a reference panel itself).</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="151" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/15-parameter-script.png" alt="15 parameter script" class="wp-image-19850" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/15-parameter-script.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/15-parameter-script-300x50.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/15-parameter-script-768x129.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">However, if an underscore is placed directly after the “$”, the parameter then becomes optional. When a reference panel is created, its optional dollar parameters are not automatically defined.</p>



<p class="wp-block-paragraph">Optional parameters are accessible in the “Reference defining” popup under the “optional” tab or along with other $-Parameters in the Property Editor.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="400" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/16-blank-parameter.png" alt="16 blank parameter" class="wp-image-19851" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/16-blank-parameter.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/16-blank-parameter-300x133.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/16-blank-parameter-768x341.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph"><u><strong>Specifying $-Parameter Data Types</strong></u></p>



<p class="wp-block-paragraph">$-Parameters can be designated to have specific data types according to their names’ prefixes:</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="584" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/17-character-types_1.png" alt="17 character types 1" class="wp-image-19852" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/17-character-types_1.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/17-character-types_1-300x195.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/17-character-types_1-768x498.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="453" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/18-data-types.png" alt="18 data types" class="wp-image-19853" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/18-data-types.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/18-data-types-300x151.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/18-data-types-768x387.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph"><u><strong>Specifying $-Parameter Parameter Types</strong></u></p>



<p class="wp-block-paragraph">Fun Fact of the Day: Clicking the ellipsis in the reference defining panel calls a popup that assists the user in a $-Parameter selection. This is only done, however, if a $-Parameter does not adhere to a data-type-specifying convention (and is therefore labeled as “[unknown]”). From this<strong> “Menu” </strong>popup, one can choose to open the <strong>“DP-Selector”</strong>, <strong>“DPE-Selector”</strong>, <strong>“Color-Selector”</strong>, <strong>“Panel-Selector”</strong>, <strong>“Font-Selector”</strong>, or <strong>“Keyword-Selector”</strong> (if applicable).</p>



<p class="wp-block-paragraph"><strong>NOTE:</strong> The “DP-Selector” only allows the user to select the highest level of a datapoint structure while the “DPE-Selector” allows the user to select the datapoint or any of its respective elements.</p>



<p class="wp-block-paragraph"><br>
<em>Reference Defining Panel</em></p>



<p class="wp-block-paragraph"><br>
<em>DP-Selector</em></p>



<p class="wp-block-paragraph"><br>
<em>DPE-Selector</em></p>



<p class="wp-block-paragraph"><br>
<em>Color-Selector</em></p>



<p class="wp-block-paragraph"><br>
<em>Panel-Selector</em></p>



<p class="wp-block-paragraph"><br>
<em>Font-Selector</em></p>



<p class="wp-block-paragraph">Similar to how the naming convention allows $-Parameters to be defined as specific datatypes, the naming convention also allows users to specify $-Parameters’ parameter types. If a $-Parameter contains the name “dp”, “dpe”, &#8220;color”, &#8220;panel&#8221;, or “font”, the ellipses click will bypass the “Menu” panel and navigate directly to the appropriate selector.</p>



<p class="wp-block-paragraph"><strong>NOTE:</strong> If a user were to specify a data type and a parameter type for a specific $-Parameter, the parameter type would take precedence and the $-Parameter would be considered an “[unknown]” data type.</p>



<p class="wp-block-paragraph">For example, “$sMyDpe” would be considered an unknown (as opposed to a string) and open the DPE-Selector.</p>



<p class="wp-block-paragraph"><strong>NOTE 2:</strong> If a user has a lack of foresight and includes multiple parameter types in their $-Parameter name, then a selector will open in the following priority:<br>
<strong>Dpe &gt; dp &gt; panel &gt;&nbsp;color &gt; font</strong></p>



<p class="wp-block-paragraph">For example, “$myColorDpe” would open the DPE-Selector as opposed to the Color-Selector.</p>



<p class="wp-block-paragraph">Now that we’ve reviewed the wonders of panel embedding and started learning the magic of $-Parameters, it’s time to further our knowledge of panels. In the next edition of “Getting Started with WinCC OA”, we’ll dive into another form of panel references, Child Panels (i.e. Popups), and how $-Parameters are used in that context.</p>



<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>



<ul class="wp-block-list">
<li><a href="https://static.dmcinfo.com/blog/19540/getting-started-with-wincc-oa-part-11-panels-child-panels-popups/">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>



<li><a href="https://static.dmcinfo.com/blog/18628/getting-started-with-wincc-oa-part-12-modules-and-embedded-modules/">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/19860/getting-started-with-wincc-oa-part-10-panel-nesting-and-parameters/">Getting Started with WinCC OA: Part 10 &#8211; Panel Nesting and $-Parameters</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 9 &#8211; Color Database and High Performance Best Practices</title>
		<link>https://static.dmcinfo.com/blog/20143/getting-started-with-wincc-oa-part-9-color-database-and-high-performance-best-practices/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Fri, 06 Mar 2020 15:31:57 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/20143/getting-started-with-wincc-oa-part-9-color-database-and-high-performance-best-practices/</guid>

					<description><![CDATA[<p>Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding: In Part 9 of “Getting Started with WinCC OA,” we’ll look at the Color Database and the implementation of color-based concepts presented in “The High Performance HMI Handbook” [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/20143/getting-started-with-wincc-oa-part-9-color-database-and-high-performance-best-practices/">Getting Started with WinCC OA: Part 9 &#8211; Color Database and High Performance Best Practices</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding:</p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>



<li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>



<li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels | The Basics</a></li>



<li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>



<li><a href="/latest-thinking/blog/id/9906/getting-started-with-wincc-oa-part-5--scripting-syntax">Part 5: Scripting Syntax</a></li>



<li><a href="/latest-thinking/blog/id/9921/getting-started-with-wincc-oa-part-6--para-overview-and-datapoint-creation">Part 6: Para Overview and Datapoint Creation</a></li>



<li><a href="/latest-thinking/blog/id/9944/getting-started-with-wincc-oa-part-7--interacting-with-datapoints-via-scripting">Part 7: Interacting with Datapoints via Scripting</a></li>



<li><a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Part 8: Libraries</a></li>
</ul>



<p class="wp-block-paragraph">In Part 9 of “Getting Started with WinCC OA,” we’ll look at the Color Database and the implementation of color-based concepts presented in “The High Performance HMI Handbook” by Bill R. Hollifield, Dana Oliver, Eddie Habibi, and Ian Nimmo.</p>



<h2 id="h-what-is-a-color-database" class="wp-block-heading">What is a Color Database?</h2>



<p class="wp-block-paragraph">The color database is where project colors are defined and stored. Project colors can be separated into and organized via different databases. Recall the OA folder structure and panel view tree outlined in <a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a>,&nbsp;color databases are stored within the ColorDB folder and can be accessed in Gedi via the Color Database element in the Project View tree.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/1-colordb.png" alt="color database"/></figure>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/2-projectview-color.png" alt="color project view"/></figure>



<h2 id="h-creating-a-database" class="wp-block-heading">Creating a Database</h2>



<p class="wp-block-paragraph">To create a color database, simply right click the <strong>“Color Database”</strong> Project View tree element and select<strong> “Add New Color Database.”</strong> For our example, we’ll call this color database <strong>“Project Base.”</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/3-addnew.png" alt="create database"/></figure>



<h2 id="h-creating-a-color-database-color" class="wp-block-heading">Creating a Color Database Color</h2>



<p class="wp-block-paragraph">To add a color, right-click the color database that will house said color and select <strong>“Add New Color.”</strong> For our example, we’ll create the following colors within the “Project Base” database:</p>


<table style="width:100%; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; margin-bottom:40px;">
<tbody>
<tr style="text-align:center;">
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Name</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>RGB</strong></th>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Base_Red</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">166, 20, 3</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Base_Blue</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">46, 56, 255</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Base_Green</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">82, 197, 33</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Base_DarkGrey</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">93, 93, 93</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Base_White</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">247, 247, 247</td>
</tr>
</tbody>
</table>


<p class="wp-block-paragraph">If following along, feel free to adjust the colors’ RGB values as you see fit.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/4-addnewcolor.png" alt="add new color"/></figure>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/5-colorselector.png" alt="select color"/></figure>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/6-projectbase.png" alt="project base"/></figure>



<h2 id="h-creating-color-database-aliases" class="wp-block-heading">Creating Color Database Aliases</h2>



<p class="wp-block-paragraph">Programmers use aliases to identify color database colors under different names. Using aliases helps maintain color consistency throughout a project, makes code more readable, and prevents cluttering within color databases</p>



<p class="wp-block-paragraph">DMC’s best practices involve creating a color database of base colors to serve as a project color foundation. All other color databases will consist of aliases of these base colors.</p>



<p class="wp-block-paragraph">Before creating an alias, we’ll first create a new color database called <strong>“Device Status.”</strong> Within the “Devices Status” color database, we’ll create an alias called <em><strong>DeviceStatus_Estopped</strong></em>&nbsp;and assign it <strong><em>Base_Red</em>.</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/7-alias.png" alt="color alias"/></figure>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/8-9newcolor.png" alt="new color saving"/></figure>



<p class="wp-block-paragraph">In addition, we’ll create<strong> <em>DeviceStatus_Stopped</em></strong>&nbsp;as<strong> <em>Base_Blue</em></strong>&nbsp;and <strong><em>DeviceStatus_Running</em>&nbsp;</strong>as <strong><em>Base_Green</em>.</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/10-namedcolors.png" alt="nsamed colors"/></figure>



<p class="wp-block-paragraph">Now that we’ve created new device status colors let’s apply them to our example from Parts 7 and 8. In <a href="/latest-thinking/blog/id/9944/getting-started-with-wincc-oa-part-7--interacting-with-datapoints-via-scripting">Part 7 &#8211; Interacting with Datapoints via Scripting</a>, we created a simple rectangle (represents a motor device) and assigned it a “Red” background-color within its project properties. Now that we have designated status colors, let’s give it a <em><strong>DeviceStatus_Stopped</strong></em>&nbsp;default color.</p>



<p class="wp-block-paragraph">In reality, this color will only be visible while editing in Gedi as the example code automatically assigns the rectangle a new color in runtime. Regardless, we’ll still apply the color.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/11-backgroundcolor.png" alt="backgruond colors"/></figure>



<p class="wp-block-paragraph">Recall that in <a href="/latest-thinking/blog/id/10014/getting-started-with-wincc-oa-part-8--libraries">Part 08 – Libraries</a>, we created a control file that defined a variety of color constants. Instead of defining the constants as primary OA colors “red,” “blue,” and “green,” we can re-define them as our newly created aliases in the “ColorConst.ctl” file.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/12-conststring.png" alt="code"/></figure>



<h2 id="h-the-high-performance-hmi" class="wp-block-heading">The High Performance HMI</h2>



<p class="wp-block-paragraph">The High Performance HMI is a concept presented in “The High Performance HMI Handbook” by Bill R. Hollifield, Dana Oliver, Eddie Habibi, and Ian Nimmo. The book focuses on developing human-machine interfaces in a way that maximizes operators’ situational awareness and increases HMI functionality and efficiency. Though topics in the book stretch from ideal screen topology to control room distractions, I found it worthwhile to highlight some basic ideas on color selection in this blog post.</p>



<p class="wp-block-paragraph">According to “The High Performance HMI Handbook”</p>



<ul class="wp-block-list">
<li>Color should be used to draw the operators’ attention and highlight abnormal situations</li>



<li>Color blindness is a prevalent condition that must be taken into account when selecting colors. For those that are color blind, color combinations such as green + red and blue + purple are often hard to differentiate.</li>
</ul>



<p class="wp-block-paragraph">For example, consider the following color schemes in device objects in DMC’s WinCC OA Open Library:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/13-hmilevels.png" alt="hmi levels"/></figure>



<p class="wp-block-paragraph">The standard color scheme is generally what those unfamiliar with High Performance HMI concepts might consider ideal and preferable. However, note what the same layout looks like when passed through a color-blind simulator application:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/14-colorbline.png" alt=""/></figure>



<p class="wp-block-paragraph">Note that the standard<strong> “Active” </strong>and <strong>“Fault” </strong>states are nearly indistinguishable to those with deuteranopia (green-blindness). All High Performance HMI colors are easily differentiable. Also, the High Performance scheme uses color to draw an operator’s attention to a faulted state and leaves normal operation in greyscale colors.</p>



<h2 id="h-creating-alternative-color-schemes" class="wp-block-heading">Creating Alternative Color Schemes</h2>



<p class="wp-block-paragraph">Color schemes allow users to overwrite color definitions and allows for color transitioning. This can be helpful when shifting between “day” and “night” modes, for example. For the purposes of this tutorial, we’ll create a High Performance color scheme that that overwrites our <em><strong>DeviceStatus_Stopped</strong></em> and <strong><em>DeviceStatus_Forward</em></strong> aliases with alternative high performance colors.</p>



<p class="wp-block-paragraph">To create a <strong>color scheme</strong>, right-click the Color Databases element and select<strong> “Add New Color Scheme Folder.”</strong> We’ll name this color scheme, “High Performance Colors.”</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/15-add-new-scheme-folder.png" alt="new folder"/></figure>



<p class="wp-block-paragraph">Within a color scheme folder, you can define colors and their respective color databases. Within the “High Performance Colors” color scheme folder, we’ll create a color database titled <strong>“DeviceStatus”</strong> and define aliases <em><strong>DeviceStatus_Stopped</strong></em> as <em><strong>Base_DarkGrey</strong></em> and <strong><em>DeviceStatus_Forward</em> </strong>as<strong> <em>Base_White</em>.</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/16-highperformance-colors.png" alt="high performance colors"/></figure>



<p class="wp-block-paragraph">Everything under the Color Databases element and not in a color scheme folder is considered the default color/database. <strong>When a color scheme is “Active,” any conflicting colors within the color scheme folder will overwrite its default color counterpart.</strong></p>



<p class="wp-block-paragraph">Since DeviceStatus_Running and DeviceStatus_Stopped are defined within the High Performance Colors, the&nbsp;<strong><em>Base_White</em></strong> and <strong><em>Base_DarkGrey</em></strong> will represent those color aliases respectively when the “High Performance Colors” are active. <strong><em>Base_Red</em></strong> will continue to represent the <strong><em>Device_Status_Estopped</em></strong> since there is no definition within the “High Performance Colors” scheme.</p>



<h2 id="h-activating-color-schemes" class="wp-block-heading">Activating Color Schemes</h2>



<p class="wp-block-paragraph">There are several ways of activating color schemes within a project:</p>



<p class="wp-block-paragraph"><u><strong>Activate in Gedi</strong></u><br>
To activate a color scheme in Gedi, simply right click its respective folder and select “<strong>Activate Color Scheme.</strong>” To activate the default scheme, simply perform the same action but right-clicking on a default color. This is a good way of testing different color schemes during development.</p>



<p class="wp-block-paragraph"><u><strong>Activate via Scripting</strong></u><br><br>Color schemes can be altered during runtime by using the function</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Plaintext</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>colorSetActiveScheme(&lt;Color Scheme>)Show more lines</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">colorSetActiveScheme(&lt;Color Scheme&gt;)Show more lines</span></span></code></pre></div>



<p class="wp-block-paragraph">Where &lt;Color Scheme&gt; is a string of the folder name. To activate the default color scheme, simply use empty quotes. Enabling color schemes via scripting is ideal for switching between color schemes during runtime.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/17-active-color-scheme.png" alt=""/></figure>



<p class="wp-block-paragraph"><u><strong>Activate via Config File</strong></u><br><br>The config file will be covered more in-depth in subsequent “Getting Started with WinCC OA” installments. However, it’s important to note that a color scheme can be activated by implementing the following line within the [ui] section of the config file:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Plaintext</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>activeColorScheme = &lt;Color Scheme></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">activeColorScheme = &lt;Color Scheme&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">Where &lt;Color Scheme&gt; is a string of the folder name. Like activating color schemes via scripting, the default color scheme is represented with empty quotes. With that said, it is not necessary to activate the default color scheme via the config file since, as the default, it’s already active upon startup.</p>



<p class="wp-block-paragraph">Activating color schemes via the config file is ideal if a project will use only one non-default color scheme.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/18-colorconfig.png" alt="color configurations"/></figure>



<h2 id="h-example-project-colors" class="wp-block-heading">Example Project Colors</h2>



<p class="wp-block-paragraph">Going back to the example project, we can run a quick test of our panel to view our new default colors. Since we’re working primarily in Gedi, we can activate the High Performance color scheme by right-clicking the “High Performance Colors” folder and activating the color scheme. Here’s how our rectangle’s color has changed over time:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/19-all-colors.png" alt="OA blue green and red"/></figure>



<p class="wp-block-paragraph"><strong>_dpdoesnotexist</strong></p>



<p class="wp-block-paragraph">WinCC OA comes with an array of accessible and usable colors that can be found within the base OA project. While most colors aren’t important enough to know, the “_dpdoesnotexist” color bears heavy significance in the development and debugging. In default OA objects (and ideally any other user-generated content like DMC’s WinCC OA Open Library), the “_dpdoesnotexist” color will display if the object’s user-specified datapoint or datapoint element does not exist within the project.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/20-DP-DNE.png" alt=""/></figure>



<p class="wp-block-paragraph"><br>
<span style="font-size:20px;"><span style="margin-left: 150px;">Native OA Object in GEDI</span><span style="margin-left: 90px;">Native OA Object with Invalid DPE in QuickTest</span></span></p>


<div class="clear:both">&nbsp;</div>


<p class="wp-block-paragraph">Now that we’ve covered colors and color databases, let’s jump back to panel development. In the next edition of “Getting Started with WinCC OA,” we’ll cover panel nesting and passing parameters from panel to reference panel using $-parameters.</p>



<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>



<ul class="wp-block-list">
<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://static.dmcinfo.com/blog/20143/getting-started-with-wincc-oa-part-9-color-database-and-high-performance-best-practices/">Getting Started with WinCC OA: Part 9 &#8211; Color Database and High Performance Best Practices</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 8 &#8211; Libraries</title>
		<link>https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Wed, 23 Oct 2019 11:47:40 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Libraries]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/</guid>

					<description><![CDATA[<p>Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, I recommend that you read the respective installments before proceeding: Now that we have a basic understanding of scripting and how to interact with datapoints, we’re ready to move beyond panel scripting environments and create globally accessible code. [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Getting Started with WinCC OA: Part 8 &#8211; Libraries</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, I recommend that you read the respective installments before proceeding:</p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>



<li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>



<li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels | The Basics</a></li>



<li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>



<li><a href="/latest-thinking/blog/id/9906/getting-started-with-wincc-oa-part-5--scripting-syntax">Part 5: Scripting Syntax</a></li>



<li><a href="/latest-thinking/blog/id/9921/getting-started-with-wincc-oa-part-6--para-overview-and-datapoint-creation">Part 6: Para Overview and Datapoint Creation</a></li>



<li><a href="/latest-thinking/blog/id/9944/getting-started-with-wincc-oa-part-7--interacting-with-datapoints-via-scripting">Part 7: Interacting with Datapoints via Scripting</a></li>
</ul>



<p class="wp-block-paragraph">Now that we have a basic understanding of scripting and how to interact with datapoints, we’re ready to move beyond panel scripting environments and create globally accessible code. In Part 8 of “Getting Started with WinCC OA,” we’ll explore how we can use libraries to create globally accessible functions, enumerations, constants, etc.</p>



<h2 class="wp-block-heading" id="h-what-are-libraries">What are Libraries?</h2>



<p class="wp-block-paragraph">Control libraries are files that hold code that may be accessed by other scripts within a project. Simply put, they hold globally usable code. One may ask, “Why would we want to use libraries?”</p>



<p class="wp-block-paragraph">Libraries prevent developers from having to rewrite or copy/paste existing code, allow changes to be made quickly and efficiently, and ensure consistency within a project. Let’s jump back quickly to the example used in “Part 7: Interacting with Datapoints via Scripting.” Say we used the same enumeration “StatusType” in several panels in addition to the one we created.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/enum-status-type.png" alt="status type"/></figure>



<p class="wp-block-paragraph">Without libraries, we’d need to copy and paste this enumeration in all of our panels’ ScopeLibs for further use. If we wanted to alter the enumeration to:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/enum-alteration.png" alt="altering enumination"/></figure>



<p class="wp-block-paragraph">We’d need to remember every instance of where this function was used, go back in the code, and modify StatusType appropriately. When the number of places we use StatusType increases, the more re-work would be needed to make the change.</p>



<h2 class="wp-block-heading" id="h-how-are-libraries-made">How are Libraries Made?</h2>



<p class="wp-block-paragraph">To create a control library, simply right click “Libraries” in the project view tree and select “Add New CTRL Library.”</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/add-new-lib.png" alt="add new library"/></figure>



<p class="wp-block-paragraph">Anything created in the resulting .ctl file can be appropriately referenced throughout the program. To continue from Part 7&#8217;s example, we’ll generate two .ctl files: one for a global<strong> StatusType</strong> and another for <strong>device colors.</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ctl-files.png" alt="ctl files"/></figure>



<p class="wp-block-paragraph"><strong>StatusType.ctl should contain:</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/statustype-ctl.png" alt="status type stl"/></figure>



<p class="wp-block-paragraph"><strong>ColorConst.ctl should have:</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/color-ctl.png" alt="color const ctl"/></figure>



<p class="wp-block-paragraph">None of these libraries do anything, however, if they’re not implemented within a program.</p>



<h2 class="wp-block-heading" id="h-how-is-library-content-implemented">How is Library Content Implemented?</h2>



<p class="wp-block-paragraph">Libraries are not initially accessible from a program’s script. The control library file must first be loaded into a project for it to be usable. To do so, you must implement the following line:</p>



<pre class="wp-block-code"><code>
	#uses &lt;.ctl file&gt;
</code></pre>



<p class="wp-block-paragraph">Once a control file is specified, a script may use any and all items within said .ctl file. To implement our control libraries within our example, we’ll modify our ScopeLib’s code as follows:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Python</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>#uses "StatusType"
#uses "ColorConst"

//=============================== Panel initialization =========================================
initializePanel()
{
  //Whenever rSpeed or rMaxSpeed changes, call the function "onSpeedChange"
  dpConnect("onSpeedChange", "myMotor.rSpeed", "myMotor.rMaxSpeed");

  //Whenever iStatus changes, call the function "onStatusChange"
  dpConnect("onStatusChange", "myMotor.iStatus");
}


//=============================== Text Field Command =========================================
//Textbox is selected and user keys "Enter"
void textboxCmd()
{
  //Assign the textbox's text value to rMaxSpeed
  dpSet("myMotor.rMaxSpeed", maxSpeedTextbox.text);
}


//=============================== On Speed / Max Speed Value Change =================================
void onSpeedChange(string speedDp, float speedValue, string maxSpeedDp, float maxSpeedValue)
{
  //Define the variable whose value will be assigned to iStatus
  int iStatusValue;

  //Determine what value to assign iStatusValue (and subsequently "myMotor.iStatus")
  switch (speedValue)
  {
    //If "myMotor.rSpeed" is 0, set iStatusValue to 0
    case 0:
      iStatusValue = (int)StatusType::Stopped;
      break;

    //Otherwise, if "myMotor.rSpeed" > "myMotor.rMaxSpeed", set iStatusValue to Estop status int
    //           if not, set iStatusValue to Forward status int
    default:
      iStatusValue = (speedValue >= maxSpeedValue) ? (int)StatusType::Estop : (int)StatusType::Forward;
      break;
  }

  //Assign iStatusValue's value to "myMotor.iStatus"
  dpSet("myMotor.iStatus", iStatusValue);

  //Set the maxSpeedTextbox and speedTextbox's test to their respective values
  //NOTE: dpValToString ensures the units we assigned earlier in the series are displayed.
  //      Simply using &lt;Textbox>.text = &lt;speedValue> will work, but will not display appropriate units
  maxSpeedTextbox.text = dpValToString("myMotor.rMaxSpeed", maxSpeedValue, true);
  speedTextbox.text = dpValToString("myMotor.rSpeed", speedValue, true);
}

//=============================== On Status Change =========================================
void onStatusChange(string statusDp, int statusValue)
{
  //Define the variable whose value will be assigned to the rectangle's color property
  string rectangleColor;

  //Determine color to assign to rectangle based off iStatus
  if (statusValue == (int)StatusType::Stopped)
  {
    rectangleColor = STOPPED_COLOR;
  }

  if (statusValue == (int)StatusType::Estop)
  {
    rectangleColor = ESTOPPED_COLOR;
  }

  if (statusValue == (int)StatusType::Forward)
  {
    rectangleColor = FORWARD_COLOR;
  }

  //Assign selected color to rectangle
  setValue("rectangle", "backCol", rectangleColor);
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #6A9955">#uses &quot;StatusType&quot;</span></span>
<span class="line"><span style="color: #6A9955">#uses &quot;ColorConst&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== Panel initialization =========================================</span></span>
<span class="line"><span style="color: #D4D4D4">initializePanel()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Whenever rSpeed </span><span style="color: #569CD6">or</span><span style="color: #D4D4D4"> rMaxSpeed changes, call the function </span><span style="color: #CE9178">&quot;onSpeedChange&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  dpConnect(</span><span style="color: #CE9178">&quot;onSpeedChange&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Whenever iStatus changes, call the function </span><span style="color: #CE9178">&quot;onStatusChange&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  dpConnect(</span><span style="color: #CE9178">&quot;onStatusChange&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;myMotor.iStatus&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== Text Field Command =========================================</span></span>
<span class="line"><span style="color: #D4D4D4">//Textbox </span><span style="color: #569CD6">is</span><span style="color: #D4D4D4"> selected </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> user keys </span><span style="color: #CE9178">&quot;Enter&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">void textboxCmd()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Assign the textbox</span><span style="color: #CE9178">&apos;s text value to rMaxSpeed</span></span>
<span class="line"><span style="color: #D4D4D4">  dpSet(</span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, maxSpeedTextbox.text);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== On Speed / Max Speed Value Change =================================</span></span>
<span class="line"><span style="color: #D4D4D4">void onSpeedChange(string speedDp, </span><span style="color: #4EC9B0">float</span><span style="color: #D4D4D4"> speedValue, string maxSpeedDp, </span><span style="color: #4EC9B0">float</span><span style="color: #D4D4D4"> maxSpeedValue)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Define the variable whose value will be assigned to iStatus</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4"> iStatusValue;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Determine what value to assign iStatusValue (</span><span style="color: #C586C0">and</span><span style="color: #D4D4D4"> subsequently </span><span style="color: #CE9178">&quot;myMotor.iStatus&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">  switch (speedValue)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    //If </span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">is</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #4EC9B0">set</span><span style="color: #D4D4D4"> iStatusValue to </span><span style="color: #B5CEA8">0</span></span>
<span class="line"><span style="color: #D4D4D4">    case </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">:</span></span>
<span class="line"><span style="color: #D4D4D4">      iStatusValue = (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Stopped;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    //Otherwise, </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4"> &gt; </span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #4EC9B0">set</span><span style="color: #D4D4D4"> iStatusValue to Estop status </span><span style="color: #4EC9B0">int</span></span>
<span class="line"><span style="color: #D4D4D4">    //           </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">not</span><span style="color: #D4D4D4">, </span><span style="color: #4EC9B0">set</span><span style="color: #D4D4D4"> iStatusValue to Forward status </span><span style="color: #4EC9B0">int</span></span>
<span class="line"><span style="color: #D4D4D4">    default:</span></span>
<span class="line"><span style="color: #D4D4D4">      iStatusValue = (speedValue &gt;= maxSpeedValue) </span><span style="color: #F44747">?</span><span style="color: #D4D4D4"> (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Estop : (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Forward;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Assign iStatusValue</span><span style="color: #CE9178">&apos;s value to &quot;myMotor.iStatus&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  dpSet(</span><span style="color: #CE9178">&quot;myMotor.iStatus&quot;</span><span style="color: #D4D4D4">, iStatusValue);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Set the maxSpeedTextbox </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> speedTextbox</span><span style="color: #CE9178">&apos;s test to their respective values</span></span>
<span class="line"><span style="color: #D4D4D4">  //NOTE: dpValToString ensures the units we assigned earlier </span><span style="color: #569CD6">in</span><span style="color: #D4D4D4"> the series are displayed.</span></span>
<span class="line"><span style="color: #D4D4D4">  //      Simply using &lt;Textbox&gt;.text = &lt;speedValue&gt; will work, but will </span><span style="color: #569CD6">not</span><span style="color: #D4D4D4"> display appropriate units</span></span>
<span class="line"><span style="color: #D4D4D4">  maxSpeedTextbox.text = dpValToString(</span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, maxSpeedValue, true);</span></span>
<span class="line"><span style="color: #D4D4D4">  speedTextbox.text = dpValToString(</span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4">, speedValue, true);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== On Status Change =========================================</span></span>
<span class="line"><span style="color: #D4D4D4">void onStatusChange(string statusDp, </span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4"> statusValue)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Define the variable whose value will be assigned to the rectangle</span><span style="color: #CE9178">&apos;s color property</span></span>
<span class="line"><span style="color: #D4D4D4">  string rectangleColor;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Determine color to assign to rectangle based off iStatus</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Stopped)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = STOPPED_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Estop)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = ESTOPPED_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Forward)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = FORWARD_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Assign selected color to rectangle</span></span>
<span class="line"><span style="color: #D4D4D4">  setValue(</span><span style="color: #CE9178">&quot;rectangle&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;backCol&quot;</span><span style="color: #D4D4D4">, rectangleColor);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<p class="wp-block-paragraph"><strong>Note that:</strong></p>



<ul class="wp-block-list">
<li>I added the #uses prompts</li>



<li>I removed StatusType enum definition from ScopeLib (since it’s applied via library)</li>



<li>I added color constants (also applied via library)</li>
</ul>



<p class="wp-block-paragraph">With the color constants and StatusType enum defined in libraries, other panels and scripts may use them at will.</p>



<p class="wp-block-paragraph">Now that we have a solid understanding of how to make and implement control libraries, we’ll continue in our OA exploration by investigating color databases and learning how we can use them to create and use custom colors.</p>



<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>



<ul class="wp-block-list">
<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10093/getting-started-with-wincc-oa-part-9--color-database-and-high-performance-best-practices">Part 9: Color Database &amp; High-Performance Best Practices</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Getting Started with WinCC OA: Part 8 &#8211; Libraries</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 7 &#8211; Interacting with Datapoints via Scripting</title>
		<link>https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Fri, 16 Aug 2019 13:38:21 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/</guid>

					<description><![CDATA[<p>Welcome back to &#8220;Getting Started with WinCC OA&#8221;! If you aren&#8217;t familiar with the series&#8217; previous topics, it&#8217;s recommended that you read the respective installments before proceeding: Now that we have a solid understanding of datapoints and basic scripting, it&#8217;s time to combine the two! In Part 7 of the &#8220;Getting Started with WinCC OA,&#8221; [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/">Getting Started with WinCC OA: Part 7 &#8211; Interacting with Datapoints via Scripting</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">Welcome back to &ldquo;Getting Started with WinCC OA&rdquo;! If you aren&rsquo;t familiar with the series&rsquo; previous topics, it&rsquo;s recommended that you read the respective installments before proceeding:</p>

<ul class="wp-block-list">
 <li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>
 <li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>
 <li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels | The Basics</a></li>
 <li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>
 <li><a href="/latest-thinking/blog/id/9906/getting-started-with-wincc-oa-part-5--scripting-syntax">Part 5: Scripting Syntax</a></li>
 <li><a href="/latest-thinking/blog/id/9921/getting-started-with-wincc-oa-part-6--para-overview-and-datapoint-creation">Part 6: Para Overview and Datapoint Creation</a></li>
</ul>

<p class="wp-block-paragraph">Now that we have a solid understanding of datapoints and basic scripting, it&rsquo;s time to combine the two! In Part 7 of the &ldquo;Getting Started with WinCC OA,&rdquo; we&rsquo;ll investigate utilizing and manipulating datapoints within our OA scripts.</p>

<h2 class="wp-block-heading">Referencing A Datapoint Element</h2>

<p class="wp-block-paragraph">A datapoint element is referenced by: <strong>&lt;parent dp(s)&gt;.&lt;dpe&gt;</strong></p>

<p class="wp-block-paragraph">For example, the elements of the dp &ldquo;myMotor&rdquo; are given by:</p>

<ul class="wp-block-list">
 <li>&ldquo;myMotor.iStatus&rdquo;</li>
 <li>&ldquo;myMotor.rSpeed&rdquo;</li>
 <li>&ldquo;myMotor.rMaxSpeed&rdquo;</li>
</ul>

<h2 class="wp-block-heading">Using Datapoint Values within Scripts</h2>

<p class="wp-block-paragraph">Using scripts, we can link items in our panels to the datapoints that live in the db folder. The fundamental functions utilized in datapoint-scripting interaction include:</p>

<ul class="wp-block-list">
 <li>dpGet()</li>
 <li>dpSet()</li>
 <li>dpConnect()</li>
</ul>

<p class="wp-block-paragraph"><u><strong>dpGet()</strong></u></p>

<p class="wp-block-paragraph">dpGet() is used to assign a datapoint element&rsquo;s value to an existing script variable and takes the form: <strong>dpGet(&lt;dpe&gt;, &lt;variable&gt;);</strong></p>

<figure class="wp-block-image"><img decoding="async" alt="motor status" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/motor-istatus.png"  /></figure>

<p class="wp-block-paragraph">With this dpGet, the variable iStatus will take on the value of myMotor.iStatus.</p>

<p class="wp-block-paragraph"><u><strong>dpSet()</strong></u></p>

<p class="wp-block-paragraph">dpSet() is used to assign a value or a script variable&rsquo;s value to a datapoint value and takes the form: <strong>dpSet(&lt;dpe&gt;, &lt;value&gt;);</strong></p>

<figure class="wp-block-image"><img decoding="async" alt="dpe equal to 1" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/dpe-equal-1.png"  /></figure>

<p class="wp-block-paragraph">With this dpSet, the dpe value of myMotor.iStatus will be set to 1.</p>

<p class="wp-block-paragraph"><u><strong>dpConnect()</strong></u></p>

<p class="wp-block-paragraph">dpConnect() is used to call a function whenever a specified dp value changes. It takes the form:<br />
<strong>dpConnect(string &lt;callback function&gt;, string &lt;dpe&gt;)</strong></p>

<p class="wp-block-paragraph">The callback function of a dpConnect must be defined in a specific manner:<br />
<strong>&lt;returnType&gt; &lt;callbackFunction&gt;(string &lt;dpe&gt;, &lt;type&gt; &lt;dpeValue&gt;)</strong></p>

<figure class="wp-block-image"><img decoding="async" alt="connect datapoint" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/dpConnect.png"  /></figure>

<p class="wp-block-paragraph">With this dpConnect, the function <strong>&ldquo;onStatusChange&rdquo;</strong> will execute when the value of <strong>myMotor</strong>. <strong>iStatus </strong>changes. When <strong>&ldquo;onStatusChange&rdquo;</strong> executes, the function will have the string <strong>&ldquo;myMotor.iStatus&rdquo;</strong>&nbsp;(given by the variable <strong>statusDp</strong>) and the value of&nbsp;<strong>myMotor. iStatus</strong>&nbsp;(given by the variable <strong>statusValue</strong>) at its disposal.</p>

<h2 class="wp-block-heading">Example</h2>

<p class="wp-block-paragraph"><span style="font-size:larger;"><u><strong>Setting Up the Panel</strong></u></span></p>

<p class="wp-block-paragraph">Let&rsquo;s revisit our lovely red/green square example and pair it with our newly-created datapoints! Our example will include the following three main objects and their respective behavioral objectives:</p>

<ul class="wp-block-list">
 <li>Rectangle (i.e. our motor device icon)
 <ul class="wp-block-list" style="list-style-type:circle;">
  <li>Color is blue (stopped color) when rSpeed is 0</li>
  <li>Color is green (forward color) when 0 &lt; rSpeed &lt; rMaxSpeed</li>
  <li>Color is red (errored color) when rSpeed &gt; rMaxSpeed</li>
 </ul>
 </li>
 <li>Speed textbox
 <ul class="wp-block-list" style="list-style-type:circle;">
  <li>Displays rSpeed</li>
 </ul>
 </li>
 <li>Max speed textbox
 <ul class="wp-block-list" style="list-style-type:circle;">
  <li>Displays rMaxSpeed</li>
  <li>User can set rMaxSpeed value</li>
 </ul>
 </li>
</ul>

<p class="wp-block-paragraph">We&rsquo;ll start out by removing the previously-used buttons and adding in some primitive text, a label (used for value display), and text field (used for value display and modification).</p>

<figure class="wp-block-image"><img decoding="async" alt="para test panel" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/para-test-panel.png"  /></figure>

<p class="wp-block-paragraph"><span style="font-size:larger;"><u><strong>Writing the Script</strong></u></span></p>

<ol class="wp-block-list">
 <li>Ensure the panel&rsquo;s <strong>&ldquo;Initialize&rdquo; event</strong> still has the following code:

 <pre class="wp-block-code"><code>
	main()
{
  initializePanel();
}
</code></pre>
 </li>
 <li>Insert the following code within <strong>maxSpeedTextbox&rsquo;s &ldquo;Command&rdquo; event</strong>:
 <pre class="wp-block-code"><code>
	main()
{
  textboxCmd();
}
</code></pre>
 </li>
 <li>Add the following script to the panel&rsquo;s <strong>&ldquo;ScopeLib&rdquo;</strong>:
 <pre class="wp-block-code"><code>
enum StatusType
{
  Stopped = 0,
  Estop   = 1,
  Forward = 2
};

//=============================== Panel initialization =========================================
initializePanel()
{
  //Whenever rSpeed or rMaxSpeed changes, call the function &quot;onSpeedChange&quot;
  dpConnect(&quot;onSpeedChange&quot;, &quot;myMotor.rSpeed&quot;, &quot;myMotor.rMaxSpeed&quot;);

  //Whenever iStatus changes, call the function &quot;onStatusChange&quot;
  dpConnect(&quot;onStatusChange&quot;, &quot;myMotor.iStatus&quot;);
}


//=============================== Text Field Command =========================================
//Textbox is selected and user keys &quot;Enter&quot;
void textboxCmd()
{
  //Assign the textbox&apos;s text value to rMaxSpeed
  dpSet(&quot;myMotor.rMaxSpeed&quot;, maxSpeedTextbox.text);
}


//=============================== On Speed / Max Speed Value Change =================================
void onSpeedChange(string speedDp, float speedValue, string maxSpeedDp, float maxSpeedValue)
{
  //Define the variable whose value will be assigned to iStatus
  int iStatusValue;

  //Determine what value to assign iStatusValue (and subsequently &quot;myMotor.iStatus&quot;)
  switch (speedValue)
  {
    //If &quot;myMotor.rSpeed&quot; is 0, set iStatusValue to 0
    case 0:
      iStatusValue = (int)StatusType::Stopped;
      break;

    //Otherwise, if &quot;myMotor.rSpeed&quot; &gt; &quot;myMotor.rMaxSpeed&quot;, set iStatusValue to 1
    //           if not, set iStatusValue to 2
    default:
      iStatusValue = (speedValue &gt;= maxSpeedValue) ? (int)StatusType::Estop : (int)StatusType::Forward;
      break;
  }

  //Assign iStatusValue&apos;s value to &quot;myMotor.iStatus&quot;
  dpSet(&quot;myMotor.iStatus&quot;, iStatusValue);

  //Set the maxSpeedTextbox and speedTextbox&apos;s test to their respective values
  //NOTE: dpValToString ensures the units we assigned earlier in the series are displayed.
  //      Simply using &lt;Textbox&gt;.text = &lt;speedValue&gt; will work, but will not display appropriate units
  maxSpeedTextbox.text = dpValToString(&quot;myMotor.rMaxSpeed&quot;, maxSpeedValue, true);
  speedTextbox.text = dpValToString(&quot;myMotor.rSpeed&quot;, speedValue, true);
}

//=============================== On Status Change =========================================
void onStatusChange(string statusDp, int statusValue)
{
  //Define the variable whose value will be assigned to the rectangle&apos;s color property
  string rectangleColor;

  //Determine color to assign to rectangle based off iStatus
  if (statusValue == (int)StatusType::Stopped)
  {
    rectangleColor = &quot;blue&quot;;
  }

  if (statusValue == (int)StatusType::Estop)
  {
    rectangleColor = &quot;red&quot;;
  }

  if (statusValue == (int)StatusType::Forward)
  {
    rectangleColor = &quot;green&quot;;
  }

  //Assign selected color to rectangle
  setValue(&quot;rectangle&quot;, &quot;backCol&quot;, rectangleColor);
}
</code></pre>
 </li>
 <li>Be sure to review and understand the example script</li>
</ol>

<h2 class="wp-block-heading">Running the Example Code</h2>

<p class="wp-block-paragraph">Run the panel in QuickTest Module and open/view the<strong> &ldquo;myMotor&rdquo;</strong> datapoint in Para. Upon modifying the Motor Speed Limit textbox and pressing &apos;Enter&apos; on the keyboard, we can see the <strong>rMaxSpeed </strong>value change in Para.</p>

<figure class="wp-block-image"><img decoding="async" alt="motor speeds" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/motor-speed-1-2.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value-500.png"  /></figure>

<p class="wp-block-paragraph">Upon modifying <strong>rSpeed</strong> in Para (simulating a linked PLC tag change), we can see the rectangle&rsquo;s color change from green as <strong>0 &lt; rSpeed &lt; rMaxSpeed</strong> and then to red as <strong>rSpeed &gt; rMaxSpeed</strong>:</p>

<figure class="wp-block-image"><img decoding="async" alt="rspeed -" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/rspeed-original-value.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value-400.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value-600.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/all-color-panels.png"  /></figure>

<p class="wp-block-paragraph">Now that we have a basic understanding of scripting and how to interact with datapoints, we&rsquo;re ready to expand our horizons beyond the boundaries of panel scripting environments and write code that is accessible globally in our OA program.</p>

<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>

<ul class="wp-block-list">
 <li><a href="/latest-thinking/blog/id/10014/getting-started-with-wincc-oa-part-8--libraries">Part 8: Libraries</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10093/getting-started-with-wincc-oa-part-9--color-database-and-high-performance-best-practices">Part 9: Color Database &amp; High-Performance Best Practices</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
  <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>

<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/">Getting Started with WinCC OA: Part 7 &#8211; Interacting with Datapoints via Scripting</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Alarm Acknowledgment in WinCC Comfort and Advanced</title>
		<link>https://static.dmcinfo.com/blog/21200/alarm-acknowledgment-in-wincc-comfort-and-advanced/</link>
		
		<dc:creator><![CDATA[John Williams]]></dc:creator>
		<pubDate>Wed, 24 Jul 2019 07:46:30 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Alarm Acknowledgement]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21200/alarm-acknowledgment-in-wincc-comfort-and-advanced/</guid>

					<description><![CDATA[<p>In this blog, I will walk through the&#160;built-in options for alarm acknowledgment in WinCC Comfort and Advanced and give example situations in which you might choose different ones. Creating an Alarm The first thing we need to do is create an alarm in WinCC. This is done through the &#8220;HMI Alarms&#8221; editor in TIA Portal. [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21200/alarm-acknowledgment-in-wincc-comfort-and-advanced/">Alarm Acknowledgment in WinCC Comfort and Advanced</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In this blog, I will walk through the&nbsp;built-in options for alarm acknowledgment in WinCC Comfort and Advanced and give example situations in which you might choose different ones.</p>



<h2 class="wp-block-heading" id="h-creating-an-alarm">Creating an Alarm</h2>



<p class="wp-block-paragraph">The first thing we need to do is create an alarm in WinCC. This is done through the <strong>&#8220;HMI Alarms&#8221;</strong> editor in TIA Portal. WinCC accesses all alarms by specifying a bit address in an HMI tag. This means you can group alarms in a couple of ways:</p>



<p class="wp-block-paragraph">1. Add all alarms to an unoptimized data block as Booleans, then create a single HMI tag that is a <strong>word </strong>array with the same length as the block</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="395" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarmed-Cathy-ACK.png" alt="Alarmed Cathy ACK" class="wp-image-21189" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarmed-Cathy-ACK.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarmed-Cathy-ACK-300x132.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarmed-Cathy-ACK-768x337.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph"><em><cite>Data block &#8211; Unoptimized&nbsp;</cite></em></p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="82" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-2.png" alt="Alarm ACK 2" class="wp-image-21190" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-2.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-2-300x27.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-2-768x70.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph"><em><cite>HMI tag &#8211; this is&nbsp;an array of word with the appropriate size</cite></em></p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="104" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-3.png" alt="Alarm ACK 3" class="wp-image-21191" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-3.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-3-300x35.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-ACK-3-768x89.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph"><em><cite>Alarms – this is a link to the correct address of the relevant alarm</cite></em></p>



<p class="wp-block-paragraph">2. Group alarms into other data types, such as <strong>Word</strong>, <strong>DWord</strong>, <strong>Dint</strong>, etc.</p>



<p class="wp-block-paragraph">DMC developed the <a href="https://openplclibrary.com/" target="_blank">Siemens Open Library</a>, which has&nbsp;a function&nbsp;that automatically will combine 16&nbsp;bits into a word</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="660" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-4.png" alt="Alarm 4" class="wp-image-21192" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-4.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-4-300x220.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-4-768x563.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph"><i>Move alarms into the bits of the alarm word</i></p>



<figure class="wp-block-image size-full"><img decoding="async" width="869" height="96" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/WordAlarm_1.png" alt="WordAlarm 1" class="wp-image-21193" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/WordAlarm_1.png 869w, https://static.dmcinfo.com/wp-content/uploads/2025/05/WordAlarm_1-300x33.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/WordAlarm_1-768x85.png 768w" sizes="(max-width: 869px) 100vw, 869px" /></figure>



<p class="wp-block-paragraph"><i>Each alarm corresponds to a bit in the word</i></p>



<p class="wp-block-paragraph">Option one can be effective when you&#8217;re creating alarms for a large number of devices. The <a href="https://openplclibrary.com/" target="_blank">Siemens Open Library</a>&nbsp;includes a windows application that will automatically generate a list of alarms from an unoptimized DB that can be directly imported into the alarm editor. This eliminates the hassle of having to create each of the alarms individually.&nbsp;Option two can be useful when you want to group alarms by device or subsystem. Each word can correspond to a specific device, which can be useful for checking device state on the PLC or displaying it on the HMI.</p>



<h2 class="wp-block-heading" id="h-local-acknowledgement-on-hmi">Local Acknowledgement on HMI</h2>



<p class="wp-block-paragraph">If you do no other configuration, the default acknowledgment setup is that all information about alarm state/acknowledgment is stored locally on the HMI. There are a few&nbsp;possible states for an alarm:</p>



<ol class="wp-block-list">
<li>Incoming
<ul class="wp-block-list">
<li>An alarm condition is present; no acknowledgement has occurred</li>
</ul>
</li>



<li>Incoming/Acknowledged
<ul class="wp-block-list">
<li>An alarm condition is present; acknowledgment has occurred</li>
</ul>
</li>



<li>Incoming/Outgoing
<ul class="wp-block-list">
<li>Alarm condition was present, then went away before the alarm was acknowledged</li>
</ul>
</li>
</ol>



<p class="wp-block-paragraph"><strong><u>Alarm display colors</u></strong></p>



<p class="wp-block-paragraph">Using the Alarms group tab of the editor, you can customize colors and display information for each of these acknowledgment states. Important note:&nbsp;you must enable colors in runtime settings or they will not be displayed.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="348" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-5.png" alt="Alarm 5" class="wp-image-21194" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-5.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-5-300x116.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-5-768x297.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph"><strong><u>Alarm Groups</u></strong></p>



<p class="wp-block-paragraph">By default,&nbsp;each alarm must be acknowledged individually. To change this, assign the alarms to groups in the alarm editor. Acknowledging one alarm in the group will acknowledge all the other alarms in that group as well.</p>



<p class="wp-block-paragraph"><strong><u>Acknowledgment Button</u></strong></p>



<p class="wp-block-paragraph">There are two ways to acknowledge alarms. The first is using the button built into the alarm viewer. The other way is by configuring a custom button with the <strong>“AlarmViewAcknoweldgeAlarm” </strong>event.</p>



<h2 class="wp-block-heading" id="h-hmi-acknowledgement-bit-pass-acknowledgment-information-from-hmi-to-plc">HMI Acknowledgement Bit – Pass Acknowledgment Information from HMI to PLC</h2>



<p class="wp-block-paragraph">The HMI acknowledgment word is used to pass the acknowledgment status of an alarm from the HMI to the PLC. It must be a bit in a tag that is different than the alarm’s trigger tag. When acknowledgment of the alarm occurs on the HMI, the bit on the PLC is set to one. It will stay high until the alarm condition goes away, then occurs again. A diagram displays this below:</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="348" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-6.png" alt="Alarm 6" class="wp-image-21195" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-6.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-6-300x116.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-6-768x297.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">This bit is useful if you want to use the acknowledgment status as a pre-requisite for clearing the alarm condition on the PLC.</p>



<p class="wp-block-paragraph"><u><strong>Multiple HMI Considerations</strong></u></p>



<p class="wp-block-paragraph">If multiple HMIs are part of the project, and each has a separate alarm viewer, any of the HMIs can acknowledge the alarm and set the HMI Acknowledgment bit. However, this information is stored locally on each HMI &#8211; the acknowledgement is not passed to the other HMIs. This disparity in information means that if one HMI acknowledges an alarm, it will still display as unacknowledged on a different HMI until this is also acknowledged there.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="517" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7.png" alt="Alarm 7" class="wp-image-21196" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7-300x172.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7-768x441.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<h2 class="wp-block-heading" id="h-plc-acknowledgment-bit-pass-acknowledgement-information-from-plc-to-hmi">PLC Acknowledgment Bit – Pass Acknowledgement Information from PLC to HMI</h2>



<p class="wp-block-paragraph">The PLC acknowledgment bit is used to acknowledge alarms by passing down a bit from the PLC. When you set the bit on the PLC, the acknowledgement status of the associated alarm&nbsp;is updated on the HMI. This is useful as it allows multiple HMIs to keep their alarm acknowledgments in sync. A single PLC tag/bit is used as the PLC acknowledgement bit on all the HMIs, so each of them receives acknowledgements in sync.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-8.png" alt=""/></figure>



<p class="wp-block-paragraph">One disadvantage of this approach is that it makes individual alarm acknowledgment, that is the ability to choose which alarm is going to be acknowledged by highlighting it in the alarm viewer, more difficult. When using the built-in acknowledgment in the alarm viewer (as you must with the HMI ack bit), a user can highlight/select a specific alarm to acknowledge.</p>



<p class="wp-block-paragraph">However, there is no way to tell the PLC which alarm is currently highlighted, which prevents individual acknowledgement via PLC. Generally, when using this acknowledgment scheme, we have used a global alarm acknowledge button that automatically acknowledges&nbsp;all available alarms. Alternatively, we&#8217;ve grouped the alarms by system, and had a separate acknowledgement button for each system.</p>



<p class="wp-block-paragraph">Important note: the acknowledgment bit must stay high long enough for the HMI to see it. We will normally pulse it on for a short duration (e.g. 1 second if the HMI tag update rate is 1s). This ensures each of the HMIs has time to see the tag&#8217;s value change.</p>



<p class="wp-block-paragraph">The PLC acknowledgment bit is required to be in the same tag as the actual alarm bit. We have a couple of approaches to get around handle this:</p>



<p class="wp-block-paragraph"><u><strong>Approach 1:&nbsp;Unoptimized db with Structs</strong></u></p>



<p class="wp-block-paragraph">The first way is to create an <strong>unoptimized </strong>DB with all alarm conditions at the top, and an identical structure at the bottom for alarm acknowledgment.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="517" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7.png" alt="Alarm 7" class="wp-image-21196" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7-300x172.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-7-768x441.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">You can then access this DB as an array of words on the HMI, as discussed above.&nbsp;To configure the acknowledgment, use the bit in the first structure as the alarm bit, and the bit in the second structure as the plc acknowledgment bit. Then, set the plc acknowledgment bit high on the PLC to globally acknowledge the alarm on all HMIs.</p>



<p class="wp-block-paragraph"><u><strong>Approach 2:&nbsp;Alarm Word</strong></u></p>



<p class="wp-block-paragraph">Another approach is to use Words for your alarms and keep them in a normal db. In this case, we generally group alarms by system or device, and use the first half of the word for the alarm conditions and the second half of the word for acknowledgments:</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="284" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-10.png" alt="Alarm 10" class="wp-image-21199" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-10.png 900w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-10-300x95.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/Alarm-10-768x242.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p class="wp-block-paragraph">&nbsp;</p>



<p class="wp-block-paragraph">Overall, WinCC Comfort and Advanced give you several options for alarm acknowledgment. I hope this blog helps you implement it in your project!</p>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">WinCC Expertise</a>&nbsp;and <a href="https://static.dmcinfo.com/contact">contact us</a> today&nbsp;to get started on your next project.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21200/alarm-acknowledgment-in-wincc-comfort-and-advanced/">Alarm Acknowledgment in WinCC Comfort and Advanced</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 6 &#8211; Para Overview and Datapoint Creation</title>
		<link>https://static.dmcinfo.com/blog/21256/getting-started-with-wincc-oa-part-6-para-overview-and-datapoint-creation/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Thu, 11 Jul 2019 13:55:11 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21256/getting-started-with-wincc-oa-part-6-para-overview-and-datapoint-creation/</guid>

					<description><![CDATA[<p>Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding: db Folder Recap Before we dive into Para, let’s review the db folder. In Part 2 of the “Getting Started with WinCC OA” series, we described the db [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21256/getting-started-with-wincc-oa-part-6-para-overview-and-datapoint-creation/">Getting Started with WinCC OA: Part 6 &#8211; Para Overview and Datapoint Creation</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding:</p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>



<li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>



<li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels &amp;&nbsp;The Basics</a></li>



<li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>



<li><a href="/latest-thinking/blog/id/9906/getting-started-with-wincc-oa-part-5--scripting-syntax">Part 5: Scripting Syntax</a></li>
</ul>



<h2 class="wp-block-heading" id="h-db-folder-recap">db Folder Recap</h2>



<p class="wp-block-paragraph">Before we dive into Para, let’s review the db folder. In <a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2 of the “Getting Started with WinCC OA”</a> series, we described the db folder as:</p>



<p class="wp-block-paragraph">“The db folder contains all of OA’s user-defined datapoints and internally-used datapoints. These datapoints, analogous with PLC “tags,” hold and retain values that can be used by OA as well as connected PLCs. The user interface for these datapoints is called ‘Para’.”</p>



<h2 class="wp-block-heading" id="h-what-is-para">What is Para?</h2>



<p class="wp-block-paragraph">Para is a graphical interface in Gedi used to view, create, and edit datapoint types, datapoints, and datapoint elements that are stored in the db folder. “What are datapoint types, datapoints, and datapoint elements?” you may ask.</p>



<ul class="wp-block-list">
<li>Datapoint type <strong>(dpt)</strong>: A datapoint type is a defined structure consisting of variable types, substructures, and/or other data point types.</li>



<li>Datapoint <strong>(dp)</strong>: Data points are instances of a specified data point type. These data points physically hold the information outlined by their respective types.</li>



<li>Datapoint element <strong>(dpe)</strong>: Data point elements are the components of a specific data point. Data point elements and data points are fairly synonymous and can often be used interchangeably.</li>
</ul>



<p class="wp-block-paragraph">If this only makes partial sense, fear not. Things will become more clear as we walk through the following example:</p>



<h2 class="wp-block-heading" id="h-creating-a-datapoint-type">Creating a Datapoint Type</h2>



<ol class="wp-block-list">
<li style="margin-bottom:20px;">To access Para, simply click the<strong> &ldquo;Para&rdquo; </strong>icon located within the project toolbar.

<figure class="wp-block-image"><img decoding="async" alt="para icon" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/para-icon.png"  /></figure>


<figure class="wp-block-image"><img decoding="async" alt="datapoint parameters" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/datapoint-parameteres-1.png"  /></figure>

</li>



<li style="margin-bottom:20px;">To create a data point type, right-click the <strong>Para Tree</strong> and select <strong>&ldquo;Create datapoint type.&rdquo;</strong><br />
 

<figure class="wp-block-image"><img decoding="async" alt="create datapoint type" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/create-data-point-1.png"  /></figure>

</li>



<li style="margin-bottom:20px;">The first &ldquo;folder&rdquo; structure in the Dp-Type Editor will be the name of the datapoint type, so name it accordingly.</li>



<li style="margin-bottom:20px;">To add elements to the data point type, right-click the <strong>dpt</strong> and select <strong>&ldquo;Add node.&rdquo;</strong><br />
 

<figure class="wp-block-image"><img decoding="async" alt="add node" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/add-node.png"  /></figure>

</li>



<li style="margin-bottom:20px;">Added nodes, by default, take the form of a structure. By right-clicking on a node and hovering over <strong>&ldquo;Element &ndash; Type&rdquo;</strong>, the user can configure each node to take on a desired variable type or even another datapoint type.

<figure class="wp-block-image"><img decoding="async" alt="element types" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/element-type.png"  /></figure>

</li>



<li style="margin-bottom:20px;">Through adding, renaming, and re-typing nodes, the following datapoint type can be configured:

<figure class="wp-block-image"><img decoding="async" alt="datapoint config" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/configuring-datapoint.png"  /></figure>

</li>
</ol>



<p class="wp-block-paragraph">We’ve successfully made a datapoint type! However, this structure doesn’t physically exist as a usable entity to store data. For that, we must create a datapoint.</p>



<h2 class="wp-block-heading" id="h-creating-a-datapoint">Creating a Datapoint</h2>



<ol class="wp-block-list">
<li style="margin-bottom:20px;">To create a datapoint, simply right-click the datapoint type and select <strong>&ldquo;Create datapoint&rdquo;</strong><br />
 

<figure class="wp-block-image"><img decoding="async" alt="create datapoint" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/creating-datapoint-type.png"  /></figure>

</li>



<li style="margin-bottom:20px;">Once named (our example names the datapoint<strong> &ldquo;myMotor&rdquo;)</strong>, a new datapoint will appear underneath its respective datapoint type.<br />
 <u><strong>Note</strong></u>&nbsp;that the datapoint contains all the elements defined in the datapoint type. These elements of a specific datapoint are called datapoint elements.

<figure class="wp-block-image"><img decoding="async" alt="my motor" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/mymotor.png"  /></figure>

</li>



<li style="margin-bottom:20px;">To manipulate a datapoint element&rsquo;s value, simply click on the<strong> dpe</strong>, change its <strong>&ldquo;Original value&rdquo;,</strong> and click <strong>&ldquo;Apply&rdquo;.</strong>

<figure class="wp-block-image"><img decoding="async" alt="apply attributes" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-attributes.png"  /></figure>

</li>
</ol>



<h2 class="wp-block-heading" id="h-datapoint-configuration">Datapoint Configuration</h2>



<p class="wp-block-paragraph">Once created, datapoints and their respective elements can be configured to have specific user-defined properties such as units, ranges, and descriptions, addresses, trending archives, etc. To get started with OA, most of these configurations will not be covered. However, it’s beneficial to note their existence and how to change datapoint properties. For this blog series, we’ll look simply at unit configuration as a relevant example.</p>



<ol class="wp-block-list">
<li style="margin-bottom:20px;">Under rSpeed&rsquo;s dropdown, click<strong> &ldquo;_common&rdquo;</strong></li>



<li style="margin-bottom:20px;">Under the <strong>&ldquo;Unit&rdquo;</strong> field, type in <strong>&ldquo;rpm&rdquo;</strong> and click <strong>&ldquo;Apply&rdquo;</strong></li>



<li style="margin-bottom:20px;">Repeat for <strong>rMaxSpeed</strong></li>
</ol>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/common-unit.png" alt="apply unites"/></figure>



<p class="wp-block-paragraph"><strong>NOTE:</strong> The underscore in “_common” or any other config/datapoint signifies that the item is an internal, non-user-defined datapoint.</p>



<h2 class="wp-block-heading" id="h-wincc-oa-import-tag-tool">WinCC OA Import Tag Tool</h2>



<p class="wp-block-paragraph">For WinCC OA projects that communicate with and use tags of PLCs, it becomes extremely tedious to create, edit, and link OA tags in the manner outlined above. Luckily, DMC has created a WinCC OA Import Tool that aids in importing tags from a TIA Portal project into WinCC OA. Find more info on it in our <a href="https://openplclibrary.com/" target="_blank">Siemens Open Library</a>.</p>



<p class="wp-block-paragraph">Now that we have a few datapoints configured, it’s time to utilize and manipulate them within our scripts! We’ll explore interacting with datapoints in the next installment of “Getting Started with WinCC OA.”</p>



<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9944/getting-started-with-wincc-oa-part-7--interacting-with-datapoints-via-scripting">Part 7: Interacting with Datapoints via Scripting</a></li>



<li><a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Part 8: Libraries</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10093/getting-started-with-wincc-oa-part-9--color-database-and-high-performance-best-practices">Part 9: Color Database &amp; High-Performance Best Practices</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21256/getting-started-with-wincc-oa-part-6-para-overview-and-datapoint-creation/">Getting Started with WinCC OA: Part 6 &#8211; Para Overview and Datapoint Creation</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 5 &#8211; Scripting Syntax</title>
		<link>https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Tue, 25 Jun 2019 14:33:24 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Syntax]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/</guid>

					<description><![CDATA[<p>Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding: In Part 5 of the “Getting Started with WinCC OA,” we’ll investigate the basics of OA’s scripting syntax. Once scripting syntax is understood, we can begin programming and [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/">Getting Started with WinCC OA: Part 5 &#8211; Scripting Syntax</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding:</p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>



<li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>



<li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels &amp; The Basics</a></li>



<li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>
</ul>



<p class="wp-block-paragraph">In Part 5 of the “Getting Started with WinCC OA,” we’ll investigate the basics of OA’s scripting syntax. Once scripting syntax is understood, we can begin programming and adding functionality to our panels.</p>



<h2 id="h-the-basics" class="wp-block-heading">The Basics</h2>



<ul class="wp-block-list">
<li>Every executable statement must end with a semicolon;</li>



<li>// Use two forward slashes to comment out the remaining portion of a line</li>



<li>Ctrl + D will comment out a line of code</li>



<li>Ctrl + Shift + D will un-comment out a line of code</li>



<li>Ctrl + E will open all of a selected panel’s scripts</li>
</ul>



<h2 id="h-variables" class="wp-block-heading">Variables</h2>



<p class="wp-block-paragraph">OA supports many types of variables. The most used of which are:</p>


<table style="width:100%; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; margin-bottom:40px;">
<tbody>
<tr style="text-align:center;">
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Type</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>OA Name</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Array of &lt;type&gt;</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Comment</strong></th>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Any Type</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">anytype</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_anytype</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Adapts to the type of the first variable assigned to it</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Boolean</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">bool</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_bool</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">0, 1, true, or false</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Character</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">char</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_char</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Enumeration</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">enum</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&#8212;&#8211;</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Floating Point</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">float</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_float</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Integer</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">int</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_int</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">String</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">string</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_string</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Time</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">time</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_time</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Shape</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">shape</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_shape</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Pointer to a graphic element</td>
</tr>
</tbody>
</table>


<p class="wp-block-paragraph">Variable definitions take the form of:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Type> &lt;variableName>;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;Type&gt; &lt;variableName&gt;;</span></span></code></pre></div>



<p class="wp-block-paragraph">Variables can be given initial values:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Type> &lt;variableName> = &lt;intialValue>;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;Type&gt; &lt;variableName&gt; = &lt;intialValue&gt;;</span></span></code></pre></div>



<p class="wp-block-paragraph">Multiple variables can be defined for a single type:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Type> &lt;variable1Name>, &lt;variable2Name>, …;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;Type&gt; &lt;variable1Name&gt;, &lt;variable2Name&gt;, …;</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/bool-function-1.png" alt="bool function"/></figure>



<p class="wp-block-paragraph">Variables must be defined before use, but can be so:</p>



<ul class="wp-block-list">
<li>At the beginning of a script</li>



<li>Within a function</li>



<li>Within a statement</li>



<li>Within a function’s parameter structure</li>
</ul>



<p class="wp-block-paragraph">Best practice tip: Variable names should utilize camelCase or PascalCase and clearly indicate the variable’s function.</p>



<p class="wp-block-paragraph"><strong>Casting</strong><br>
Casting is a way of interpreting a variable or value as an alternate type. This is done simply by preceding the target variable with “(&lt;target type&gt;)”. Casting is especially helpful with enumerations (which will be discussed later in this blog post).</p>



<p class="wp-block-paragraph"><strong>Constants</strong><br>
Constants are defined in a manner similar to that of variables. However, by designating something as a constant, OA ensures that the value cannot be modified within a script. To designate a variable as a constant, simply place “const” before the type name.</p>



<p class="wp-block-paragraph"><u>Note:</u><strong>&nbsp;</strong>DMC’s best practice standards include capitalizing all constants.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/const-function-2.png" alt="const function"/></figure>



<p class="wp-block-paragraph"><strong>Functions</strong><br><br>Functions take the following form:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;returnType> &lt;functionName>(&lt;parameterType> &lt;parameter>, ...)
{
    // Function content

    return &lt;returnedItem>;
    // Required unless the return type is "void"
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;returnType&gt; &lt;functionName&gt;(&lt;parameterType&gt; &lt;parameter&gt;, ...)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #6A9955">    // Function content</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">return</span><span style="color: #D4D4D4"> &lt;returnedItem&gt;;</span></span>
<span class="line"><span style="color: #6A9955">    // Required unless the return type is &quot;void&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/myfunction-3.png" alt="function"/></figure>



<p class="wp-block-paragraph"><strong>Note:&nbsp;returnType</strong> takes the form of any variable type or is “void”</p>



<p class="wp-block-paragraph"><strong>Logic Operators</strong><br>
The following operators can be used in WinCC OA scripting:</p>


<table style="width:100%; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; margin-bottom:20px;">
<tbody>
<tr style="text-align:center;">
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Operator</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Symbol</strong></th>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">AND</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&amp;&amp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">OR</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">||</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">NOT</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">!</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">==</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Greater than</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&gt;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Greater than or equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&gt;=</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Less than</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&lt;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Less than or equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&lt;=</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Not equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">!=</td>
</tr>
</tbody>
</table>


<p class="wp-block-paragraph"><strong>Statements</strong><br><br>WinCC utilizes the traditional of IF, ELSE, FOR, WHILE, and SWITCH statements as follows:<br><br><u>IF and ELSE statements:</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly> if(&lt;Boolean condition>)
{
    &lt;code>;
}
else
{
    &lt;code>;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4"> </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4">(&lt;Boolean condition&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"><span style="color: #C586C0">else</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/if-else-4.png" alt="if else statement"/></figure>



<p class="wp-block-paragraph"><u>FOR Loop:</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>for(&lt;initialization of condition>; &lt;Boolean testing condition>; &lt;target variable modification>)
{
    &lt;code>;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #C586C0">for</span><span style="color: #D4D4D4">(&lt;initialization of condition&gt;; &lt;Boolean testing condition&gt;; &lt;target variable modification&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/for-loop-5.png" alt="for loop"/></figure>



<p class="wp-block-paragraph"><u>WHILE Loop:</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>while(&lt;Boolean condition>)
{
    &lt;code>;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #C586C0">while</span><span style="color: #D4D4D4">(&lt;Boolean condition&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/while-function-6.png" alt="while statement"/></figure>



<p class="wp-block-paragraph"><u>SWITCH Statement</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>switch(&lt;target variable>)
{
    case &lt;value 1>:
        &lt;code>
        break;
    •••
    case &lt;value n>:
        &lt;code>
        break;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #C586C0">switch</span><span style="color: #D4D4D4">(&lt;target variable&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">case</span><span style="color: #D4D4D4"> &lt;value </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">&gt;:</span></span>
<span class="line"><span style="color: #D4D4D4">        &lt;code&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">    •••</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">case</span><span style="color: #D4D4D4"> &lt;value n&gt;:</span></span>
<span class="line"><span style="color: #D4D4D4">        &lt;code&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/strings-integers.png" alt="switch function"/></figure>



<p class="wp-block-paragraph"><u>Bonus Round: Ternary Statements</u><br><br>Ternary statements are condensed ways of writing simple if-else statements. They take the form:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;conditional statement> ? &lt;value returned if true> : &lt;value returned if false> </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;conditional statement&gt; ? &lt;value returned </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">&gt; : &lt;value returned </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">false</span><span style="color: #D4D4D4">&gt; </span></span></code></pre></div>



<p class="wp-block-paragraph"><strong>Enumerations</strong><br>
Enumerations should be used to make code easier to interpret. For example, say there exists an integer variable, called iStatus, that indicates the condition of a motor where:</p>



<ul class="wp-block-list">
<li>0 = stopped</li>



<li>1 = Error</li>



<li>2 = Running Forward</li>
</ul>



<p class="wp-block-paragraph">Say we want the rectangle from our prior example (representing the motor) to change color based on the iStatus variable. A series of IF statements could be written:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/rectangle-color-8.png" alt="if function"/></figure>



<p class="wp-block-paragraph">The program will work as expected, setting the rectangle’s background color to either grey, red, or white depending on the iStatus value. But someone troubleshooting or reviewing the code may be slowed as the code isn’t explicit as to what each iStatus case represents. This is where enumerations come in.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/enum-function-9.png" alt="enum function"/></figure>



<p class="wp-block-paragraph">The enumeration <strong>“StatusType”</strong> has been implemented to make the code more explicit. Note that the enumeration has been cast as an integer to ensure that iStatus is given an integer to which it can compare.</p>



<p class="wp-block-paragraph">Even further, constants have also been utilized for redundant clarity and (for reasons we’ll discuss later in this series) consistency.</p>



<p class="wp-block-paragraph">What would even improve the code further? If you guessed “switch statement”, you’d be correct. While, in theory, this would be true, an unfortunate “feature” of WinCC OA is that its switch statements can’t handle casting. So while the following code would be optimal, saving and implementing it is not possible.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/open-library-function-10_1.png" alt="istatus"/></figure>



<p class="wp-block-paragraph">Now that the basics of scripting syntax have been covered, we’re ready to progress to the next aspect of scripting in WinCC OA: Para. In the next installment of “Getting Started with WinCC OA”, we’ll investigate the Para tool, OA tags, and how to interact with said tags.</p>



<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9921/getting-started-with-wincc-oa-part-6--para-overview-and-datapoint-creation">Part 6: Para Overview and Datapoint Creation</a></li>



<li><a href="/latest-thinking/blog/id/9944/getting-started-with-wincc-oa-part-7--interacting-with-datapoints-via-scripting">Part 7: Interacting with Datapoints via Scripting</a></li>



<li><a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Part 8: Libraries</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10093/getting-started-with-wincc-oa-part-9--color-database-and-high-performance-best-practices">Part 9: Color Database &amp; High-Performance Best Practices</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/">Getting Started with WinCC OA: Part 5 &#8211; Scripting Syntax</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
