Today we’re going to compare and contrast Ignitions component scripting abilities and interface with those of FactoryTalk View. We will be taking a look at the programming languages each program uses, their ability to access properties of components on an HMI screen, how easy they are to implement and what support is provided for extending their functionality to achieve project specific goals.
Languages: VBA vs Jython
First, lets take a look at the capabilities of the languages that each program utilizes. FactoryTalk uses Visual Basic For Applications (VBA) and Ignition uses an implementation of Python called Jython.
Visual Basic For Applications
VBA is an implementation of Visual Basic, Microsoft’s event driven programming language, that was built specifically for automating processes inside of Windows-based applications. It provides enough functionality to do the majority of standard tasks, but implementing larger complex systems becomes impractical beyond a certain point. VBA is not a true object oriented language, instead it is object based. What this means is that it does support classes, but lacks the key feature of modern object oriented programming languages: inheritance. While you can implement Interfaces, deriving classes from your own user defined classes is not possible, which makes reusing their code more difficult and using them with overridden member methods impossible. VBA will also only run on a Windows System, limiting it strictly to Windows machines.
Jython is an implementation of Python built to run on Java which provides it access to the entire Java standard library. That means the amount of things you can do with it is only limited by the capabilities of one the most powerful, versatile object oriented languages in the industry. Python was built to be very easy to learn and clearly read. Reading a line of Python is almost like a reading a line of plain text, and its intent is immediately apparent. Because Jython is built on Java, it can run on any platform regardless of operating system.
Accessing Component Properties
Both Programs offer an interface for scripting that allows you to build expressions with little to no programming experience, however in FactoryTalk the interface is centered entirely around linking the properties of a component directly to a tag value or expression. Ignition’s interface offers the same functionality, and also makes it just as straightforward to link a components properties to properties of other components within Ignition. Lets take a look at their property panels:
They are very similar however the key difference is the Binding Icon next to every single property in Ignition’s Property Editor. This will let you bind any property to a tag value, an expression, an SQL Query or a property on another component with a few clicks. To link a components property to another component’s property on the screen is as easy as selecting the desired property from a tree view:
By comparison, in FactoryTalk View the component scripting is handled through the Animation property of a component. This can be accessed by right clicking and selecting “Animation” and choosing an animation type to open the Animation window:
Then using the Animation window to configure the tag or expression with the expression editor. The expression editor has a a set of buttons for building statements and adding pre-defined functions to your expression. You can choose the functions from a list inside the Functions popup window::
While this is incredibly helpful, it does require a little digging to find property editing, and an understanding of VBA to really be able to make full use of it. Unfortunately this list of functions is also the extent of the functions supported without programming your own solutions.
Both Programs offer solutions to extend their development environment. FactoryTalk includes a fully featured VBA IDE to add your own classes and functions to the project, and Ignition offers a python scripting environment:
Ignition takes this even further, there is a built in python interpreter for quick script testing, script libraries, and again, access to the entire Java standard library. You can easily reference any variables, classes and functions you define in your library from any screen with a single line of code. Here’s a quick example:
text="this is some text" def hello(noun): return "Hello "+noun
If this isn’t enough Inductive Automation offers a Software Development Kit that allows you to build your own “Modules” to extend the existing software’s functionality and interface to suit your needs. Anything you can program in Java, you can also add to your Ignition environment. The best part, the SDK is free. You can read more about how easy it is to start Ignition Module Development here.
By comparison, FactoryTalk offers no Script Console so we must build a page to demonstrate the comparable VBA. I’m using a simple screen with two Text Components and a Button:
Right-Clicking and selecting “VBA Code…” will bring up the VBA IDE. Because VBA is event based we must have an event to trigger each part of the code, in FTView this includes variable initialization . We will use the window loading, and the button being released as our trigger events. Our VBA Code looks like this:
Dim text As String Public Function Hello(Noun As String) Hello = "Hello " + Noun End Function Private Sub Button1_Released() Me.FindElement("Text1").Caption = Hello("Reader") Me.FindElement("Text2").Caption = text End Sub Private Sub Display_Load() text = "This is some text." End Sub
This produces the following output:
As you can see this is more than double the amount of code, and set up time, to achieve the similar results. This is a simple example, a slightly more difficult process could easily end up being much larger in VBA than in Jython. A big part of this is that Python was specifically designed with reducing the amount of code needed to accomplish any given programming task.
FactoryTalk is certainly a great tool for industrial automation, but the Ignition platform has a distinct advantage when it comes to component scripting capabilities, ease of use and the ability to extend the software’s functionality. FactoryTalk allows you to manipulate component properties with some programming required, use script builders to perform a limited set of tasks within an expression and add event driven changes to your project with VBA. Ignition allows you to bind component properties with no programming necessary, extensive programming helpers to visually build expressions in Jython and even allows you to create fully featured extensions to the software, limited only by the power of the Java platform.