Tutorial Complexity

HOW TO USE ARCHESTRA WIZARDS PART 2

Published August 29, 2019 in Uncategorized - 4 Comments

HOW TO USE ARCHESTRA WIZARDS PART 2

In the last tutorial we created a simple valve symbol that contained a vertical and horizontal orientation selection using the layering wizard. We didn;t have any scripts and the single value custom property was associated with both so layering wasn’t required for that element. In this tutorial we will add 2 new public custom properties two private custom properties and a few scripts to control the valve status color.

The new complex valve will support a four color status using two inputs one for open and one for close with a status integer set in a script based on input conditions. In addition to open and closed status we will also be able to detect if the valve is traveling between positions or having a trouble condition such as a blocked valve or power outage.

Step 1 is to rename the existing graphic element groups from grpHoriz and grpVert to grpSHoriz and grpSVert for “simple” and the orientation layers from Horizontal and Vertical  to SHorizontal and SVertical as illustrated below.

Step 2 add new custom properties for the complex valve status indication as follows:

Type| Boolean | Name| CloseSW | Default Value | me.CloseSW | Visibility | Public

Type| Boolean | Name| OpenSW | Default Value | me.OpenSW | Visibility | Public

Type| Integer | Name| Status | Default Value | 0 | Visibility | Private

Type| Integer | Name| UpdateStatus | Default Value | False  | Visibility | Private

Step 3 create two new layers CHorizontal and CVertical for “complex” and then make a duplicate of the simple horizontal group which will be modified by adding a truth table to the valve color control as seen below. Create a vertical and horizontal group using this table.

 

Center all of the valve elements placing the two new complex element groups in the appropriate complex layer. 

The final step is to create the scripting necessary to control the color based on the OpenSW and CloseSW inputs.  

First, create a DataChange script for each of the valve switches OpenSW and CloseSW that will set the UpdateStatus Boolean to true any time the state of the input changes.

This will provide an event triggered method to continuously monitor the state of those two switches.

 

Each time the UpdateStatus is set to true the Update script executes to test for switches for operational conditions setting the Status integer controlling color of the valve accordingly. Valve state is controlled according to the following truth table

Line 1 of the script is tests to see if the OpenSW is true and the CloseSW is false, if true the status integer is set to 1 otherwise the next if statement evaluates to see if the valve is closed making the status integer a 2 if that condition is met. The logic continues to flow testing every state of the two inputs until the valve state is known and the status integer set to the correct value.

If you are interested in doing a complete walk through with me you can watch the video of this tutorial here.

If you haven't taken the FREE online course you can do that here.

To pe-order the digital version of Step By Step Archestra Scripting go here. (Scheduled for release in October)

Please leave me a comment if you found this useful, I am always looking for new ideas for tutorials feel free to share any frustrations you may be having that you would like to see a tutorial for.

How To Use Archestra Graphic Wizards

Published August 18, 2019 in Intermediate , Uncategorized - 0 Comments

How To Use Archestra Graphic Wizards

A very powerful and useful feature added in later versions of Archestra is the layering wizard. The layering wizard feature allows you to make versatile graphic symbols fitting multiple scenarios.

Some ways I have seen wizards used is to represent several types of motors in a single symbol, or analog displays with options to change display format when the symbol is dropped on a screen or into another symbol.

The layers can be combined to create some very complex configurations although I would caution you to keep it as simple as possible. I have also witnessed first hand the pain of trying to modify or make updates to these rather complex creations only to find myself playing the “mole game” making a change in one thing only to discover it broke something in the layering that was seemingly unrelated. Keep it simple.

For this tutorial I have chosen a simple dual orientation valve graphic, it’s a commonly used symbol and perfect for wizard layering. In the older versions of Archestra if you wanted a valve symbol to indicate both in a vertical and a horizontal position you had two choices, either place visibility on the elements activated by some external, or build two separate symbols.

Layering solves this problem by giving your symbol intelligent configuration available at design time.

Step 1 to create a simple dual orientation valve symbol is to create your symbol with the necessary elements and properties. In this example I chose to make a valve that would display green if on or dark gray if off.

A public Boolean custom property is added to the valve symbol and default object reference provided that will coincide later with an object attribute. Note: Using a custom property allows you to choose an attribute other than “me.valve” later when the graphic is dropped into a screen or symbol. 

Each valve is represented by two groups of triangle polygons grouped by orientation, vertical or horizontal, then centered on each other.

Each polygon is animated in exactly the same way using the “Value” custom property to manipulate the Fill Style between either green or dark gray.

Step 2 after completing the element animation configuration, is to establish and configure wizard layers.

In the Options pane of the Valve graphic editor select the new folders icon and create an option folder named “orientation”. This will become a configurable property available in the symbol property window at design time.

Now, select the Orientation folder you just created clicking the Add Choice icon  making two choices one named “Horizontal” the other named “Vertical” this will appear in the Orientation property as drop down items at design time.

Now when switching to the Layers menu you will find that  a layer has been created for each of the choices associated with your Orientation choice group.

Each layer has a folder for associated Custom Properties, Graphic Elements, and Named Scripts.

In this example we will need to associate our two symbol groups with appropriate layer folder, since we are not using any scripts that folder is left empty and since our custom property is global to both layers it will associate with both by default. (Note: Once a script, element, or property has been associated with a layer it will only be available to the layer its associated with.)

To associate the two valve element groups all we need to do is drag and drop the group from the Elements pane to the Layers pane.

Now that the two groups are associated properly the valve symbol is complete.

One other thing I wanted to mention is that the small “eyeball” icon  is used to make the layer visible or not while you are working in the symbol. If I want to know how the graphic will appear for each choice I only need to click the eyeball next to the group and toggle its visibility state.  The eyeball on the Layer bar toggles visibility for all layers .This feature is only used at design time with no effect on the symbol at runtime.

When in use the valve graphic orientation is selected from the choice group drop down.

I hope this tutorial has helped you, please leave a comment.  If you would like to learn more about this tutorial you can find the video version of it on my YouTube channel here.

My Free Online training course is here.

I am getting ready to launch the book Step By Step Archestra Scripting in October, I am offering a couple of one time bonuses to anyone pre-ordering the book.  If you pre-order now you will get access to the companion online course at no additional charge and one year access to the online support forum I am launching at the same time. 

You can pre-order the book Step By Step Archestra Scripting here.

How To Use Archestra Template Toolbox

Published August 11, 2019 in Uncategorized - 0 Comments

How To Use Archestra Template Toolbox

The Template Toolbox allows you to manage template structures with ease.  The goal of System Platform is to allow modeling of object structure after the process, machine or device. In this example I’m going to keep it simple so let’s take a look at how we can model a valve as a template structure.

A typical motorized valve like the one pictured here can be commanded to open or close with switch feedback to tell you if the valve has completed its travel to either limit.

One possibility for object structure in the Archestra galaxy to accommodate this model would be to create a container object for the valve itself then create individual objects for command output and switch feedback as shown below.

While the advantage of this method of representation is a clearly defined structure the presence of hundreds of these objects presents problems of maintaining and creation of new structures that can be time consuming or error prone. 

This is where using the Template Toolbox to manage the structure becomes invaluable. The structure can easily be created inside a template tool set as shown below to create a template structure that can be maintained as a group. To create a new instance all that is required it right clicking the $Valve template and selecting “Create New Instance”.

When the new instance of the $Valve template is created it is created as a group, each template and sub template has a new instance created in the correct order.

In the derivation view we see that each of the sub templates assigned to $Valve master template are now represented as a dotfield such that $Valve.ClosedCmd, $Valve.ClosedSW, $Valve.OpenCmd, and $ValveOpenSW become elements of the master template.

As each new instance of the master $Valve template are created each of the sub element instances are also added. In this way each sub template can be located quickly from the galaxy derivation view by right clicking the template and selecting “Synchronize Views”.

Synchronize view only works between the Template Toolbox view and the Derivation view.

Once the view has been synchronized simply change to the  deployment view tab to see the total object structure as it exists on the target platform.

For a short video tutorial of how this all works click here.

To take my Free basic Archestra training course click here.

Using Alarm Client Filter Favorites

Published August 4, 2019 in Intermediate , Uncategorized - 0 Comments

Using Alarm Client Filters

One of my subscribers asked me to take a look at an issue he was having with the Alarm Client object in Archestra. He wanted to have multiple queries for narrowing down the alarms visible in the alarm history based on the area structure in the alarm model view.

He mentioned that he had read the Alarm Client guide and believed he was following it correctly yet he was unable to filter that alarms like he wanted to.

I know the alarm guide uses examples with the radio button component to switch queries at run time, but please allow me to show you another method which can be just as effective and I believe a bit easier to implement.

The method I’m going to show you is the favorite alarm query established at design time. In this example I configure r area filters and one “All” areas filter triggered with a radio button and data change script.

The key element in this strategy is to pre-configure the queries you want use for narrowing the alarm summary/history. In this case I created 4 area queries matching the areas defined in the model view each one representing a different generator set and another named “All” to show all alarms. The figure below shows the Query Filter dialog.

Once the alarm client query filters are configured you're ready to configure the radio button selector and associated scripting. The figure below shows the configuration for the radio button group. Create a string property on the host symbol named “FavoriteString” which becomes the reference for setting the filter favorite. As each radio button is selected the corresponding filter name is loaded into the “FavoriteString” property which in turn triggers a data change script.

The Data Change script executes the AlarmClient.Favorite method which is the secret sauce to this strategy for alarm filtering. As the filter name is presented the alarm client switches to use the indicated pre-configured alarm filter delivering the desired result.

Another script is placed in the show graphic area to set defaults when the alarm client first presents to the user. The next two figures below show the scripting configuration.

Once these steps have been completed the alarm client is ready for connection to the A2ALMDB.

For a more detailed look at how this method of alarm filtering is implemented you can head over to my you tube channel and watch this video for a complete demonstration.

If you are interested in learning more I offer a free online Archestra training course here.

Simple Push Button Graphic

Published July 28, 2019 in Beginner - 2 Comments

Simple? Maybe not.

Last week I received the following email from a subscriber asking what seemed like a very simple question.

“I am new to Wonderware but have 20 years experience with other platforms.

I can’t find anywhere to get good information on symbol creation.

I want a direct action button, with text that changes color based on a tag different from the action tag.

It seems that something so simple is not a standard selection from the toolbox.”


At first glance I thought yes, this is a simple thing but as I examined it and thought about how I might implement such a thing I came to a couple of conclusions.

First, the reason Wonderware doesn’t have such constructions available ready-made is that the power of Archestra is the flexibility which is why a library of Archestra symbols is included with the install, to provide a variety of pre-made symbols for your use.

The other thing I realized was that implementation of a graphic symbol however simple is dependent upon the overall graphic strategy at play in your galaxy. Therefore unfortunately until you have a grasp for that underlying template structure nothing is simple.

What underlying structure am I talking about you might ask?

Archestra graphics symbols are static templates, and while you can certainly use them in a stand alone environment they are designed to complement Archestra objects. So right out the chute the first question has to be is this a standalone Wonderware implementation or is the symbol used with System Platform? The implementation is totally different for each.

I’m assuming this user is asking about a graphic symbol that will be used with an underlying object.

Now, back to the question of underlying structures, the structure I’m referring to is object template structure. Object template structure and screen content delivery have been implemented many different ways, some companies have elected to embed symbols in the object template while others have chosen to create symbols that are not embedded ever, yet others have decided to use both embedded and non embedded symbols and everything in between.

All of this stuff makes a seemingly simple question complicated.

In answer to the person asking this question I am going to present a simple structure for implementation to explain how I would create a simple direct action command button with a text label that changes color based on another input.

Before We Get Started

I will create two versions for this example, version 1 is a direct command button with a Boolean two color option. The second version uses an integer to provide a 4 color option.

Before I describe the implementation of the direct button I am going to explain the method for content delivery to InTouch.

These examples are done in Archestra Version 2014 R1 implementation in other versions may vary. Also, the wizard capability would allow us to make a single symbol capable of having both behaviors, for this example I will keep them separate. If anyone would like to see how these two could be incorporated into a single graphic using wizards let me know.

For these examples I am going to create a “screen” symbol that will be embedded into an InTouch Window, the button symbol will then be “dropped” into the screen graphic and referenced to an object from the IDE.

I will present each example in two sections, a “Graphic Symbol” section and an “Object Template” section. The graphic symbol is created to work hand in glove with an Archestra object, as I said already if you are not using System platform the implementation is going to be slightly different.

Direct Button Two Color

Graphic Symbol

  1. Create a Symbol and name it DirectButtonV1

  2. Create Two Custom Properties (Custom Properties allow for good isolation of the IO reference and is a best practice when building graphic symbols)

    1. Data Type: Boolean | Name: Command | Default Value: me.Command

    2. Data Type: Boolean| Name:  LabelColor | Default Value: me.LabelColor

  3. Select the Button graphic from the toolbox and drag into the symbol graphic drawing area of the IDE.

  4. Change the button graphic name to “btnCommand” (it's always a good idea to be descriptive rather than just leaving things default names especially when you return six months from now)

  5. The text property of the button will have something in it, delete that text we are going to create a text animation separately.

  6. Double Click the Button, Add a pushbutton animation and Configure as follows:

    1. States: Boolean | Boolean: Command| Action: Direct| Everything else is default

  7. Select the Text graphic from the toolbox and drag into the symbol graphic drawing area.

  8. Change the name of the text graphic to “txtLabel”.

  9. Double Click the Text graphic, Add a TextStyle animation and configure as follows:

    1. States: Boolean | Color Value On: Dark Blue| Color Value Off: Black| Font On: Arial 14pt Bold| Font Off: Arial 14pt Bold

Object Template

  1. Create an Object Template from $UserDefined and name it $DirectButtonV1

  2. Create two Boolean Field Attributes

    1. Attribute Name: Command Action| Description: Command | Input Source : me.udaCommand (This will be used for testing normally this is where the reference to your IO reference goes) Everything else is default.

    2. Attribute Name: LabelColor | Description: Label Color Action | Input Source: me.udaLabelColor | Everything else is default.

  3. Create two Boolean UDA’s for test purposes.

    1. udaCommand

    2. udaLabelColor

Direct Button Multi Color

Graphic Symbol

  1. Create a Symbol and name it DirectButtonV2
  2. Create Two Custom Properties (Custom Properties allow for good isolation of the IO reference and is a best practice when building graphic symbols)
    1. Data Type: Boolean | Name: Command | Default Value: me.Command
    2. Data Type: Integer| Name:  LabelColor | Default Value: me.LabelColor
  3. Select the Button graphic from the toolbox and drag into the symbol graphic drawing area of the IDE.
  4. Change the button graphic name to “btnCommand” 
  5. The text property of the button will have something in it, delete that text we are going to create a text animation separately.
  6. Double Click the Button, Add a pushbutton animation and Configure as follows:
    1. States: Boolean | Boolean: Command| Action: Direct| Everything else is default
  7. Select the Text graphic from the toolbox and drag into the symbol graphic drawing area.
  8. Change the name of the text graphic to “txtLabel”.
  9. Double Click the Text graphic, Add a TextStyle animation and configure as shown in the figure below:

I hope this has been helpful for understanding implementation of a “simple” button with a label that has color controlled from a separate action source. A video version of this tutorial can be found on my You Tube channel.

Let me know if you receive value from this small tutorial and if you have anything you would like explained or demonstrated please let me know in the comments or email me at charles@charlesvance.com

Video tutorials on my You Tube channel can be accessed here.

The Free Archestra Programming Mini Course is here.

TutorialDataGrid

Supercharge Archestra
Using C# and .Net Client Controls.

Simple Data Grid Batch Scheduler Tutorial: Part 1

The SBS (Simple Batch Scheduler) allows the user to connect with a predefined database storing a record of scheduled batches including Batch ID, Batch Name, Equipment Name, Batch Start Time and Batch End Time. Later tutorials in this series will build on the idea and provide a means for accessing other data grids representing other data sets such as IO tags associated with the named batch equipment and other details about the batch and how it performed. 

A feature of  Archestra System Platform is the ability to import binary compiled Dynamic Link Libraries (DLL’s) into the galaxy. Once imported the DLL is converted into an Archestra Script Function Library or aaSLIB file. These libraries are then immediately available for use in any of the Archestra Graphic script functions.

The cousin to imported Dynamic Link Libraries is the Windows Custom User Control known in the galaxy as a “Client Control”. The client control allows import of graphical user interfaces designed and implemented in other .Net languages, the most widely used is probably the Data Grid View control, but there are many others and each are available for use in the Archestra galaxy.

This Tutorial is a Step-By-Step walk through illustrating the build, import and implementation of a very simple batch scheduler using the Windows Data Grid View connected to an MSSQL database.

This tutorial demonstrates:

  • MSSQL Database and Table creation.
  • Creation and Implementation of Windows Data Grid View Custom User Control.
  • Creation of Browseable Properties in Windows Custom User Control.
  • Import and Implementation of Windows Custom User Control in Archestra Graphics.
 This tutorial is not intended as a comprehensive discussion but rather is designed as a simple explanation and illustration of complex concepts in a way that can be understood and followed.
The student is expected to take the results of the tutorial and use it as a foundation to build upon. 

All source code for this tutorial is available to download. Click the download button at the bottom of this tutorial.

STEP 1: Create and Configure the MSSQL Data Base and Data Table.

Archestra System Platform is heavily dependent upon MSSQL each galaxy has an associated Database for management for management of all internal object creation and deployments. Alarm history is also managed using an MSSQL Database. Earlier versions of Wonderware Archestra require creation of the “ALMDB” and configuration of an associated Intouch application to “pump” alarms into the database. Later versions integrate the alarms automatically into the “A2ALMDB” while latest versions encourage storing alarms in the Wonderware Historian.

For purposes of the tutorial we will create a new database named “Tutorial” in the local SQL Server where Archestra is installed. Care must be taken when connecting to MSSQL Server that all firewall and network configurations allow connection to the database. The assumption in this tutorial is that the deployed view app has permission and access to connect to the local SQL Server.

Make sure the SQL Management Studio is installed on your development computer, this program is essential for doing MSSQL database creation and configuration. See the image below:

when you locate the SQL Server Management Studio Icon for your version of MSSQL click on the icon to open the studio. You should see the image below:

My SQL Server contains a number of galaxy databases, the galaxy I'm using for this tutorial is the "ArchestraScripting" database.  I have already created a database for this tutorial named "Tutorial" it's the last one in the list of databases in the Object Explorer illustrated above.

To create a new database right-click on the Databases folder right under the SQL server, in my case it's the folder underneath the "CHARLES-PC" icon.  When you right-click the folder you will see a dialog with several options, choose the "New Database..." option.  

Enter the name of the new database and choose an account with rights to the database as owner then click "OK".  In my example I'm going to use the wwUser account. I'll show you how to configure the wwUser account after we finish creating the database.

The new database will look like the Tutorial database in the image on the left below, there will not be any tables in the new database. Our next step is to run the SQL Query script as seen in the right hand view to create a new table named "Batches" with the necessary fields to complete this tutorial. 

After executing the SQL query script it may be necessary to disconnect and re-connect to the database to see the new table.  Once the new table is created we need to add data to the first record to setup the tutorial. Right-Click the table name and choose the "Edit Top 200 Rows" option. The row edit view appears in the table edit view pane. Next plug a "1" in the BatchID field, "Batch1" in the BatchName field, "Equip1" in the EquipName field, "0:0:0" in the StartTime field, and "0:0:0" in the EndTime field. 

Now that we have created the Tutorial database and its "Batches" table it's time to set the wwUser account up for this database. First, browse to and expand the "Security" folder. One of the accounts will be wwUser. Right-click the wwUser account and select "Properties". When the property window appears select "UserMapping" and the "Tutorial" database. Make sure the "dbowner" checkbox is checked.

STEP 2: Create Windows User Control Data Grid View.

This step requires us to use Microsoft Visual Studio to create a C# program that will eventually be imported into the galaxy as a custom client control. The professional versions of Microsoft Visual Studio IDE all have the Windows User Control Library available, but I want this tutorial to be accessible to everyone so I am going to use the free version of the Microsoft Visual Studio IDE. Click here to download it.

Unfortunately, the community and express versions of the IDE don't come with the Windows Control Library loaded so we have to do a bit of gymnastics to make that happen. I have a video explaining exactly how to install the Window User Control Library here. I used the 2015 version but the 2017 version works the same way. Go ahead and download Microsoft Visual Studio IDE Community 2017 version and use the video walk through to get the Windows User Control Library loaded then let's get started with the IDE.

Open the Visual Studio Editor and click File/New/Project as illustrated below.  The Dialog on the right will appear. Click "Windows Control Library", change name to "TutorialDataGrid" and click "OK". 

When the IDE opens it will look empty, we need to do a couple of thongs before diving in. First, select the "Solution Explorer" tab in the bottom right corner of the IDE. This displays the "UserControl1.cs" item in the upper right. Double-Click the item to show the User Control development area. You should now see the image illustrated below. Congratulations! you just created a new Custom Windows User Control! Of course it doesn't do anything but we will change that now.

Now we are going to personalize the user control a bit, right-click "UserControl.cs" and select "rename" option type "TutorialDataGrid" and click the Enter key.  

Now that we have the user control named we can start working on the control itself. I increased the size of the control by clicking and dragging one corner down to the right. This gives us plenty of room to work with. 

On the left side of the IDE there is a list of Custom Controls, we need to click, drag and drop the "DataGridView" inside the user control on the IDE work space then center it up leaving a bit of space at the bottom for a few buttons we will add later as shown below. Select the properties tab in the lower right then scroll to the upper right and change the name of the data grid view object to "dgvTable".

Now we can add a list box for status messages named "lstStatus". Drag and drop it from the toolbox on the left into a position below the data grid previously placed in the user control. 

Next are the buttons we will use for manipulating the data table, we are going to drag and drop a button from the toolbox and place it between the list box and the data grid evenly spaced for a clean visual presentation. The buttons to add are:

  • Update - btnUpdate
  • Add Row - btnAddRow
  • Delete Row - btnDeleteRow
  • Commit - btnCommit

These functions form the basis for our simple batch scheduler.  The images below show the completed buttons.

After placing the buttons on the user control there is one more small item to add that will \help tremendously as we do the development of this control.  We are going to add a way to track which version we are working on. Keeping up with versions will make life a whole lot better removing doubts whether a particular modification was made to a code set. to that we will drag a label to the upper right corner and rename it "lblVersion". I will the text property to "Version" this isn't necessary since the Text property is will eventually display the actual assembly version information but I will do this to keep it clear in the code and static graphic what the label is there to represent at run time.

Adding code to the project

Now its time to start writing some code. Don't worry If you are unfamiliar with the C# language, just follow along and I will explain what each code example does. I will provide a source code download at the end of this tutorial. Each code snippet is shown using github gists which are downloadable. To access the code behind the control from the Visual Studio IDE right click the user control design view and select "View Code" as shown below.

Selecting "View Code" reveals the *.cs file containing the script controlling behavior of the user control. The first thing you will see when you will see in anew project is the base auto generated code, see the code below.

Namespace and .Net Libraries

We will build out the User Control class in sections but first we need to make sure we have all of the necessary .Net libraries or Namespaces that contain the .net methods we will be using in this project. This is also where we will put the description section to provide basic information and revision tracking for this class. The following code block shows the namespace code and class description.

Class Variables and Objects

Class variables and objects establish things at the beginning of the class that will be needed later on in our code. Variables may need a default value and objects will need to be created as new instances in memory using "instantiation".

In our example we have added the following declarations, for clarity an underscore is pre-pended to the variable name to distinguish as a custom property variable :

Database Class

The Database class is used to access the database directly. Our User Control will use this class to commit changes and create the connection object.

Add Row Button is used to add a new row into the table.

Delete Row Button is used to delete a row into the table. Note - the delete row feature is immediate there is no need to commit the change, the row is deleted from the data table directly.

Commit Button is used to Commit all changes to the database.

I am going to add a private edit mode method that gets used internally to the user control. We need to control visibility of the buttons and this is a good way to have one place for doing that. Add the private edit mode method after the button code.

Complete User Control Class Code

Now we are ready to bring it all together, the following code snippet is the completed User Control Class CS file.

STEP 3: Test Windows User Control Data Grid View.

Great!  Congratulations!  You have completed build out of the Simple Batch Scheduler User Control and now we need to test it to make sure it works as expected before we import into the Archestra galaxy. But first we need to update the version of the user control dll so we can track any changes we make during testing. From the solutions tab select the TutorialDataGrid class and right-click the choose properties. Click the Assembly Information button and a version control dialog will appear. Set the DLL version at 1.2.0.0 2.0.0.0 as shown in the images below

To test the User Control we will create a Windows Form project and import the user control into it. Start by creating a new VS17 project select Windows Form App as your template type then name it testTutorialDataGrid. See the image below.

When you click the OK button you will be in the Form App IDE, right-click in the toolbox on the left side and select "choose items". Then a dialog with a list of components appears, select "Browse". See the two images below.

When the browse file window appears browse to the location where the dll for the user control is located and click Open.

We should now see the TutorialSqlGrid as a choice in the Toolbox. Click and Drag the control onto our form. You should be able to verify the version of the control matches the version we set in our DLL at 1.2.0.0 2.0.0.0  

After dropping the TutorialDataGrid user control we will need to add some components to the Form in order to test our creation.  I added the following items to the form:

  1. Button named btnEdit with text "EDIT".
  2. Label to display "Batch ID".
  3. Text Box named txtBatchID, center aligned text.
  4. Label to display "Batch Name".
  5. Text Box named txtBatchName, center aligned text.
  6. Label to display "Equipment Name".
  7. Text Box named txtEquipName, center aligned text.
  8. Label to display "Batch Start Time".
  9. DateTimePicker named dtStart, ShowUpDown = true, Format = HH:mm:ss.
  10. Label to display "Batch End Time".
  11. DateTimePicker named dtEnd, ShowUpDown = true, Format = HH:mm:ss.

Complete Test Form Code

Testing the SQL Data Grid User Control

Click the start button in the visual studio IDE header to start the form.

When the form starts click the Edit button to initiate edit mode. The buttons below the grid will appear. Click the add row button to add rows to the data grid then click the Commit button to update the new rows to the database.

Clicking the vertical bar to the left of  the BatchID cell in the data grid selects the entire row, as you click each row notice that the form controls are updated with the grid data by the events we added to the control. To update the information in the data grid select a row, modify the data in the form control and click the Edit button then the Update button. The changes have now been sent from the form over to the data grid in the user control via the custom properties we added. However, the changes are not committed to the database until the Commit button is pressed. In the example below I renamed batch and equipment names to match the Batch ID.

Now that basic testing is completed we are ready to import the TutorialSqlGrid user control into Archestra as a Client Control.

STEP 4: Import User Control Data Grid View into Archestra Galaxy.

Start the Archestra IDE choosing Galaxy/Import/Client Control. A file browse dialog will appear. Browse to the location where you saved the TutorialDataGrid project DLL and click "Open".

If you did everything correctly you should see a new client control in the graphic toolbox with the same name as your imported DLL, in this example the new client control name is "TutorialDataGrid".

Because we did all the testing in a Windows Form application the setup and configuration in Archestra is basic and straight forward.  I created a new graphic tool set named "Tutorial3" and a new graphic symbol named Tutorial3DataGrid.  Click the "Embed Graphic" option at the top of the IDE, select the new client control and drop it onto the symbol page.

All that remains to "connect" the Data Grid to our galaxy is adding a few controls and an OnShow script.

OnShow Script

The OnShow script establishes default value for the data grid. Script each of the properties with information needed to connect to the database and table.

Edit Button

The Edit button activate the data grid edit mode making all of the grid buttons visible. Each button on the client control will execute internally and reset the edit mode Boolean property.

Edit Box for Batch ID

The BatchID edit box provides a means to update Archestra. Notice that one line of code in the OnShow script disables the BatchID edit box, this is done because BatchID is intended as a read-only property.

Edit Box for Batch Name

The BatchName edit box provides a means to update Archestra and the data grid with new batch name information. Each time a row in the data grid is selected the edit box is updated, similarly changing data in the Archestra edit box updates the associated cell in the client control when Edit mode is active and the "UPDATE" button is pressed.

Edit Box for Equipment Name

The EquipName edit box provides a means to update Archestra and the data grid with new equipment name information. Each time a row in the data grid is selected the edit box is updated, similarly changing data in the Archestra edit box updates the associated cell in the client control when Edit mode is active and the "UPDATE" button is pressed.

Date Time Picker for Batch Start Time

The BatchStartTime DateTimePicker provides a means to update Archestra and the data grid with new batch start time information. Each time a row in the data grid is selected the edit box is updated, similarly changing data in the Archestra edit box updates the associated cell in the client control when Edit mode is active and the "UPDATE" button is pressed.

Date Time Picker for Batch End Time

The BatchEndTime DateTimePicker provides a means to update Archestra and the data grid with new batch end time information. Each time a row in the data grid is selected the edit box is updated, similarly changing data in the Archestra edit box updates the associated cell in the client control when Edit mode is active and the "UPDATE" button is pressed.

Completed Project Edit Mode False

All that remains to complete this tutorial is to create a screen in the View Application template and embed the Tutorial3DataGrid symbol into it and deploy. When the data grid first appears it will attempt to connect to the database and table configured in the on show script. Initially edit mode is false so none of the client control buttons are visible. 

Completed Project Edit Mode True

Pressing the Edit Mode button sets the edit mode Boolean property true activating edit mode making client control buttons visible. From edit mode active it's possible to update rows, add rows, or delete rows. None of the changes are committed to the database until the commit button is pressed.

This concludes the simple data grid tutorial.  I hope this has been helpful to you, if you wish to download the entire project you can all of the source files from my github here.

Video tutorials on my youtube channel can be accessed here.

The Free Archestra Programming Mini Course is here.

What To Do When the Archestra Intouch® Alarm Banner Stops Working

If you or your users have ever experienced a situation where the alarm banner is totally empty of ANY alarms and you KNOW there are alarms active, your system may experiencing an unintended consequence of session zero isolation.  You can reboot the HMI and sometimes that might work but usually the only way to fix this issue is to re-deploy the view app but eventually the HMI seems to do it again at random times. What is going on?

Starting with Windows Vista, Microsoft implemented Session zero isolation, meaning Windows services (System Platform) may only use session zero while GUI’s (Intouch® View) can never run in session zero. Microsoft did this to improve security making it more difficult for malware coming in via the user interfaces to attack operating system components.

However, what this created for Archestra® deployments is a situation where the Intouch alarm manager and the system platform alarm manager race each other to the door. Sometimes the legacy alarm manager wins the race leaving our Archestra® alarm manager out in the cold and the empty alarm banner is the result.

There are other reasons for alarms not displaying properly (i.e., platform alarm provider checkbox not checked, corrupted Intouch installation, etc.) but this is the most common reason and has a quick fix via a registry edit which should be a part of your implementation plan in any case.

If you see an entry in the SMC logger like this: Unable to register. SLSSVC does not support two instances of AlarmMgr with the same name. Please see the Tech Note about configuring Windows Vista and later to support both InTouch and AppServer alarms on the same computer.”

It's a dead give away that this is what is causing your alarm banner to be empty. Unfortunately, this message isn’t always present when the session isolation problem is in action.  Other logger messages indicating alarm manager not connected to the galaxy may point you in the right direction as well, but the best bet is to just apply the registry fix as a preventative measure.

Wonderware® implemented hot fixes for the issue but I have personally seen this problem continue to present itself in version 2014, 2014 R2 and 2014 R2 with patch 2.

The solution?  Apply Tech Note 570.

If you are a registered user of the Wonderware development website then you can find Technote 570 here.

While there is a hotfix that will apply the necessary registry edit to incorporate the fix is a relatively simple manual edit to the registry that can be implemented with a few minutes of work.

CAUTION: Always backup your computer hard drive before making any changes to the registry!

The first step to making the registry edit is to determine if your operating system is 32 bit or 64 bit. The easiest way to find that information is to right click the Computer item on the Windows Start menu, the image below is what should appear:

As you can see, my computer is a 64 bit operating system. This let’s me know which location I will need to make the registry edit to fix this problem.

The solution that Wonderware came up with is to add a new DWORD key named Session0LegacyMode set to equal zero for system platform or 1 for legacy operation.

On 32 bit systems navigate to the registry path for the Alarm Manager at:

HKLM\Software\Wonderware\AlarmManager

64 bit systems navigate to the following location:

HKLM\Software\Wow6432Node\Wonderware\AlarmManager

When you have browsed to the correct location make sure the Session0LegacyMode key is set to zero if using system platform, if the key isn’t there you will need to add it by right clicking and selecting “New/DWORD”

When you finish it should look like this:

Now that’s all there is to it!

Except… what if you are in a production environment with a couple hundred view apps deployed and each deployed computer is in use and cannot be interrupted? Not to mention that if working remotely you will need to login to each computer take the Intouch view offline and navigate around to get this registry edit completed? What then? Since all deployed platform view nodes will need this registry edit it could take weeks to do them all.

There is a better method. first obvious thought might be to do a remote registry edit, or perhaps use power shell, but what if the corporate firewall rules prevent those type edits across the network? What then?

What I did was to create an object that uses a script to execute a batch file on its platform that automatically creates the Session0LegacyMode DWORD key for you. I also added another script to check to see if the Session0LegacyMode key already exists and what it’s value is. Each script is triggered by attributes using the object viewer giving you complete control of the process.

STEP 1:  Create the batch file that will be copied into a temporary location on the target computer hard drive, somewhere we can easily trigger it from a deployed object, I chose to place the batch file on the C:\ Drive then deleted it when finished. I created two batch files, one for 32 bit edits and the second for 64 bit edits.

The 32 bit batch file is named Session0LegacyMode.bat and when opened using notepad it loooks like this:

The 64 bit version of the registry edit batch file looks like this, notice we added "Wow6432Node" in the registry file path :

STEP 2: Create an object template for the deployed registry edit management.
The $Session0LegacyMode object template is derived from the $UserDefined template with the following scripts and attributes.
Attributes:
b_AddKey Boolean
b_GetMode32 Boolean
b_GetMode64 Boolean
s_SessionValue String

Scripts:

AddKey Script 

AddNode32 Script

AddNode64 Script

After building the SessionLegacyMode template to use it create an instance and deploy it to the platform where you need to modify either check for the Session0LegacyMode key or add one if it doesn't exist.

Then move the Session0LegacyMode.BAT file to the C:\ Drive of the Computer hosting the platform.

Right click the deployed object and select the "View in Object Viewer" option.

When the object viewer appears it will take a few seconds to fully discover the path to your object be patient allowing the auto-discovery process to finish. When it stops the contents to our Session0LegacyMode object will be in the contents window. Now locate and drag and drop  each of the user defined attributes created in the object into the watch window (or right click selecting "Add To Watch"). See graphic image below:

Once the attribute is in the watch window double click it or Select "Modify" from the right click options then select "true" and click "apply". This will execute the batch file we placed in the C:\ drive inserting the new key. 

When complete the attribute will automatically return to false condition, this may take a few seconds. If it does not automatically return to false make sure the batch file is in the right place.

To check the registry remotely click the b_getMode64 (if 64 bit OS) and repeat the process. Select "true" and click "apply".

If the add key operation was successful the s_SessionValue will indicate a "0". 

Checking the registry before the b_AddKey attribute is set retrieves the value in the Alarm Manager registry, if the key is not present the attribute will not return to zero.

The image below shows what the object viewer looks like after a successful key insertion and check using the b_GetMode32 attribute.

Clicking the download button gives you the Session0LegacyMode template as an aaPkg file with registry batch file and all scripts as text files.

If this tutorial has been helpful to you please tell a friend. Find the video version of this tutorial on my You Tube channel.

If you are interested in learning more about Archestra Enroll in my Free Course by clicking the button below.