Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Godra

Pages: 1 [2] 3 4
16

Offered AS IS.
Not recommended for production use of any sort.
Designed for Windows and intended as a quick testing tool (it also runs in Mono, see replies #7 and #8).


The attached pictures might differ from current design (see pictures in reply #6 for the latest design and the link to the latest app).

It requires that the plctag.dll file be either in the folder with the app itself or somewhere where the OS normally looks for files.
The easiest thing to do is run the app from the Debug folder or place a shortcut on the desktop.
Reply #6 offers a slightly different approach by embedding the libraries into the exe file.

The app is using libplctag library and modified C# Wrapper by Mesta Automation, here is where you can find more info about them:

- https://github.com/kyle-github/libplctag , licensed under LGPL license ( https://www.gnu.org/licenses/lgpl-3.0.en.html )
- https://github.com/mesta1/libplctag-csharp, licensed under MIT license ( http://opensource.org/licenses/mit-license.php )

Both licenses by the authors can be found in the "License" folder of this project.

Packet delay code for even reads was adopted from AdvancedHMI drivers.

Useful Info: https://www.mesta-automation.com/how-to-communicate-to-an-allen-bradley-plc-with-c-and-libplctag-ethernet-ip-library/

Tips for using this app with SLC (as tested with MicroLogix 1100 PLC):

1) Timer / Counter / Control data types are currently set to work for reading from SLC with the following format and its variants:

     T4:0.PRE, Timer, 1                        C5:0.ACC, Counter, 1                        R6:0.POS, Control, 1
     T4:0.TT, Timer, 1                          C5:0.CU, Counter, 1                          R6:0.LEN, Control, 1
     T4:0.EN, Timer, 1                          C5:0.CD, Counter, 1                          R6:0.EU, Control, 1

     Polling either of Timer / Counter / Control without sub-element specified will show 3 x 16-bit values for either.

If you really need to write then use Int16 as a Data Type instead, for example the tag would be "T4:0.PRE; Int16; 1".

2) Each Read/Write transaction Is limited to 236 bytes of data (for example, you can read up to 2 strings of 84 bytes each).

3) Bit count starts at 0 (ex. N7:0/0) and character count starts at 1 (ex. ST9:0/1). This is applicable to all PLCs.

4) An experimental support for 128-bit values (Int128 and Uint128) was also included, so you can read/write them with addressing like this: N7:0; Int128; 1


Tips for ControlLogix PLC:

1) You can get the list of Controller & Program tags with the newly added button and combobox. Program tags will be listed without "Program:MainRoutine." prefix, which you will still need to use in order to Read/Write to these tags.

2) For Timer/Counter/Control in Logix PLCs you should use addressing similar to this:

     Controller_Tag_Counter_1.PRE, DINT, 1          Controller_Tag_Timer_1.PRE, DINT, 1
     Controller_Tag_Counter_1.ACC, DINT, 1         Controller_Tag_Timer_1.ACC, DINT, 1
     Controller_Tag_Counter_1.CU, BOOL, 1          Controller_Tag_Timer_1.EN, BOOL, 1
     Controller_Tag_Counter_1.CD, BOOL, 1          Controller_Tag_Timer_1.TT, BOOL, 1
     Controller_Tag_Counter_1.DN, BOOL, 1          Controller_Tag_Timer_1.DN, BOOL, 1

This approach might work a bit faster than when using address like this: Controller_Tag_Timer_1.PRE, Timer, 1

3) Even UDT elements can be accessed individually for as long as you know the type, these would be examples from this topic https://www.advancedhmi.com/forum/index.php?topic=2545.0 :

     Orders_Pool[0].ID, DINT, 1
     Orders_Pool[0].Name, String, 1
     Orders_Pool[0].Plan_QTY, DINT, 1
     Orders_Pool[0].Time_Est, DINT, 1
 
4) The latest library version provides packet size negotiation so there is no hard limit as with SLC.


The app will rely on your knowledge of data types and tags in your PLC as well as the correct path to your device.


The attached pictures show the example of addressing, which is in the format of: Tag + Data Type + Element Count.

Arrays [x,y] and [x,y,z] are supported as well with the addressing format of: Tag + Data Type + Element Count + X + Y + Z.

Reply #6 has the link to the latest app which eliminated the need for " + X + Y + Z" part as well as some other fixes.

The attached pictures in this post also show an error caused by selecting an incorrect Data Type and typing an incorrect tag.

Also attached is the full solution.

For either of Bit/Character/BOOLArray/Array operations, the Element Count will represent the number of consecutive bits/characters/array elements.

You can Read/Write bits just by using a slash ("/") in the tag, like this:

- "Controller_Tag_DINT/5, DINT, 6" <-- request to read 6 consecutive bits starting at bit 5 (for Logix PLCs)
- "B3:0/0; Int16, 1" <-- request to read bit 0 (for SLC PLCs)

This would be true for tags that do allow writing otherwise it's Read only.


AdvancedHMI is still a far better choice of AB Master application.

No PLC5 features have been tested since I don't have access to that PLC (so everything defaults to SLC).

Auto mode is for reading only but will still allow the manual Read/Write operations that use the "Send" button.
Alternative choice is to have 2 separate instances of the app, one for AutoRead and one to perform writes. These should be run from separate folders and each using its own plctag.dll library.

There might be issues that I didn't notice. Do bother reporting any issues you might encounter.

The project is set to target x86 platform.
Tested as working on both 32-bit and 64-bit Windows computer.

IMPORTANT
When using any of the solutions from this topic, then make sure that it is set for x86 platform when you open it.
If it is set to "AnyCPU" or "x64" then see the reply #7 on how to obtain already compiled x64 library.


There is also an Android version of this project: https://github.com/GitHubDragonFly/TabletTest

17
Additional Components / nModbus Multi-in-1 Driver (experimental)
« on: October 30, 2019, 01:59:51 AM »
Strictly offered as experimental/testing driver, maybe for those who might need RTUoverTCP/UDP or ASCIIoverTCP/UDP protocol.

The addresses use offset of +1 (so start with 00001, 10001, 30001, 40001).

It seems to work fine but is not as optimized as Archie's drivers are and also strings are stored as 1 character per register (instead of 2).

It supports F, L, U, UL, FQ, LQ, UQ, @ and S modifiers and bit/character reading/writing (16-bit, 32-bit and 64-bit values).

The library also supports Masked Bit Writing, function code 22 (0x16H), which is currently applied in the driver.
This is also done in the code ( read the value - change the bit - write it back ) for those devices that don't support FC22.
Check the new property "SlaveSupportsFC22" which controls this feature.

SwapWords option for 64-bit values, if enabled, might present a challenge for some devices since these things don't seem to be officially defined.
Just try either of the 3 options provided for 64-bit values word order (under the SwapWords64Type property which is only active when the SwapWords property is set to True).

For a simple test, the driver did allow on-the-fly changing of the IP address or Protocol Type (back and forth from TCP to RTU type). This was done with 2 Modbus simulators running locally at the same time and 1 Modbus simulator running on a remote computer.

For those who would like to try it, create a new folder inside the AdvancedHMI (or the AdvancedHMIcs) project and add to it, as existing items, all the dlls & License & corresponding VB (or C#) driver files.
Add references to all 3 dll files to the same project, close all open forms and rebuild the solution.
Don't do this in the AdvancedHMIDrivers project since it might conflict with the Modbus namespace.

If you subscribe to the "OnConnectionEstablished" and "OnComError" events then you might see some messages as to what the current status is.
This is generally applicable to TCP protocol variants.

Have no high expectations from it. Might have bugs so do report them back.

Always try to download the latest file since I do update it but don't make an announcement about it.

Disclaimer:

This driver is just another implementation of Modbus protocol, supporting:
RTU / TCP / UDP / RTUoverTCP / RTUoverUDP / ASCIIoverRTU / ASCIIoverTCP / ASCIIoverUDP.

It is using modified nModbus .NET 3.5 libraries, Copyright (c) 2006 Scott Alexander ( https://code.google.com/p/nmodbus/ ),
licensed under MIT license ( http://opensource.org/licenses/mit-license.php ).
See the included README.txt file.

Adapted for use within AdvancedHMI application with some modified code from existing AdvancedHMI drivers.

Read the comments inside the files.

18
Tips & Tricks / Modbus TCP Simulation in Linux
« on: September 08, 2019, 10:59:39 PM »
To test AHMI in Linux environment, one can use ModbusPal java simulator, found here:

https://sourceforge.net/projects/modbuspal/files/modbuspal/RC%20version%201.6b/

I would suggest to just follow these steps:

1) Create AHMI folder inside the Home folder
2) Download ModbusPal.jar file to AHMI folder
3) Copy your project's Debug folder to AHMI folder
4) Open Terminal window and run commands to open ModbusPal (as the 1st picture shows)
5) Configure and run the ModbusPal simulation (as the 2nd picture shows):
---- Add one or more slaves
---- Add Holding registers and Coils to each slave
---- Click the "Run" button
6) Open another Terminal window and run commands to open AHMI window (as the 3rd picture shows)
---- AHMI should be configured to use the ModbusTCP driver with 127.0.0.1 address and 502 port

It's probably the easiest to use the pop up Keypad of the BasicLabel controls to change Holding registers and Coils values but you can also use the ModbusPal window to do this as well (the editor window that shows Holding registers and Coils and has "Stay on top" checkbox).

This was tested in Kubuntu 14.04 but should work in other distributions for as long as Java and Mono are installed (possibly on Raspberry Pi too).

There is an option in ModbusPal for Serial communication but is disabled until your Linux installation has RXTX java library installed and configured properly. Here is what worked in Kubuntu:

1) Use Package Manager to install librxtx-java package, which is Full Java CommAPI implementation from Sun for Serial/Parallel/RS485/Raw communication, but we will just observe Serial part.

---- this installation will only copy the following files to kind of wrong location:
RXTXcomm.jar ---> in folder /usr/share/java/
librxtxSerial.so ---> in folder /usr/lib/jni/

---- here is where they need to be so things work:
RXTXcomm.jar ---> <JAVA_HOME>/jre/lib/ext
librxtxSerial.so ---> <JAVA_HOME>/jre/lib/i386/

One could use the following command to see Java parameters including JAVA_HOME: java -XshowSettings:properties.
I ended up adding the following line to /etc/environment: JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386"

2) Copy the files:

sudo cp /usr/share/java/RXTXcomm.jar /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/RXTXcomm.jar
sudo cp /usr/lib/jni//librxtxSerial.so /usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/librxtxSerial.so

The 4th picture shows the Serial tab of ModbusPal.

Resource: http://java-buddy.blogspot.com/2013/06/setup-rxtx-jar-and-so-for-ubuntu.html

19
Additional Components / Avionics Instruments Controls (VB .Net version)
« on: September 01, 2019, 01:04:36 AM »
Thanks to the original project by Guillaume CHOUTEAU, which can be found here:

https://www.codeproject.com/Articles/27411/C-Avionic-Instrument-Controls

- Download and extract the attached 7z file (2 new folders will be created: "Resources" and "AvionicsInstrumentControls").
- Add images from the "Resources" folder as existing items to the AdvancedHMIControls project resources.
- Create a new folder inside the AdvancedHMIControls project's "PurchasedControls" folder, name it "AvionicsInstrumentControls" and add to it as existing items all the controls found in the same folder you downloaded.
- Rebuild the solution and these new controls should show in the ToolBox.

Besides for the InstrumentControl, which is a base control, all other controls are AHMI controls.
You could prevent this base control from showing in the Toolbox by adding "MustInherit" after the "Public" word.

If you try to provide values manually then remember this, in case your value is a string:
 
* AttitudeIndicatorInstrumentControl - PitchAngle and RollAngle are declared as Double so use CDbl(yourvalue)
* AirSpeedIndicatorInstrumentControl - AirSpeed  is declared as Integer so use CInt(yourvalue)
* AltimeterInstrumentControl - Altitude is declared as Integer so use CInt(yourvalue)
* HeadingIndicatorInstrumentControl - Heading is declared as Integer so use CInt(yourvalue)
* TurnCoordinatorInstrumentControl - TurnQuality and TurnRate are declared as Single so use CSng(yourvalue)
* VerticalSpeedIndicatorInstrumentControl - VerticalSpeed is declared as Integer so use CInt(yourvalue)


These controls were also discussed in this topic: https://www.advancedhmi.com/forum/index.php?topic=2488.0

20
Tips & Tricks / Quick Troubleshooting - Stick with BasicLabel
« on: August 15, 2019, 01:17:18 AM »
Archie has suggested it so many times, use BasicLabel control for troubleshooting.

It is better than other controls because it can expand to show full errors (with AutoSize set to True and make sure nothing is close to it).

Just place it next to the control you are having issues with, use the same driver and point to the same PLC address (both PLCAddressValue and PLCAddressKeypad properties).

Also, try to provide Wireshark capture as well.

21
Open Discussion / AdvancedHMI in the Browser
« on: April 08, 2018, 06:08:40 PM »
It is kind of possible to get AHMI run in the Internet browser, a combination of WPF and VB Net (or C#) as per these instructions:

https://www.codeproject.com/Articles/31429/Embedding-a-NET-WinForms-Application-in-an-Interne


The final AHMI screen is interactive but the drivers seem to be blocked by the browser.


For this to work, as in the attached picture, I also had to:

- remove AdvancedHMIcs project from the solution
- choose WPF browser app for VB instead of for C#
- convert the author's Page1 code from C# to VB Net and then comment out the namespace
- set all other projects to target Net Framework 4.5
- reference all these AHMI projects in the WPFHost project and also include AHMI dll references
- change the AdvancedHMI project's compile option for Target CPU from x86 to AnyCPU
- set the AdvancedHMI project's security to full trust
- un-check the WPFHost project's publish option to use ".deploy" file extensions

Currently, it seems to work fine with the Internet Explorer browser while Google Chrome only offered to save the file (the author of the article used Mozilla Firefox browser).

Just an attempt to bring AHMI closer to possibly being run remotely via web.

Here is Page1.xaml.vb code (converted and modified from the original):

Code: [Select]
Imports System.Windows.Controls
Imports System.Windows.Forms.Integration
Imports MfgControl.AdvancedHMI

''' <summary>
''' Interaction logic for Page1.xaml
''' </summary>
Public Class Page1
    Inherits Page

    Private mainForm As MainForm = New MainForm

    Public Sub New()
        MyBase.New()
        InitializeComponent()
        windowsFormsHost.Width = Me.mainForm.Width
        windowsFormsHost.Height = Me.mainForm.Height
        Me.mainForm.TopLevel = False
        windowsFormsHost.Child = Me.mainForm
    End Sub

End Class

22
Attached here is Mono compatible BasicTrendChart control based on ZedGraph (licensed under LGPL-2.1 which is attached).

Do read the comments inside the class since it requires the ZedGraph.dll to work.

It is intended to be used as Value/Time graph.
The X Axis is set for Auto Scaling.
PLCAddressValue can be shown in the Series Title (see the picture). Just set the GraphSeriesTitleIncludeAddress property to True.

Special Notes:
* Mono Environment - All mouse interactions with the graph are disabled since the app could crash.
* Windows Environment - Additional feature: Double-clicking the graph will start/stop its updating with new points.
* General - setting the Y-axis Max or Min values will prevent the axis from auto scaling so the graph will get cut off if it goes above/below those points.


23
Attached here is the Mono compatible ChartBySampling control based on ZedGraph (licensed under LGPL-2.1 which is attached).

Do read the comments inside the class since it requires the ZedGraph.dll to work.

It is intended to be used as the Value/Time graph.
The X Axis is set for Auto Scaling.
If you populate the Name property of any of the PLCAddressItems then it will be shown in the Series Title (see the picture).

Special Notes:
* Mono Environment - All mouse interactions with the graph are disabled since the app could crash.
* Windows Environment - Additional feature: Double-clicking the graph will start/stop its updating with new points.
* General - setting the Y-axis Max or Min values will prevent the axis from auto scaling so the graph will get cut off if it goes above/below those points.

24
Additional Components / Mono Serial Drivers - DF1 and ModbusRTU
« on: January 13, 2018, 07:55:46 PM »
***  Provided  AS  IS  ***

These drivers should be seen as an alternative option until Archie considers providing his own (<< AHMI drivers from 3.99y+ version have been updated to support Mono so try them first).

There is no support for these drivers but do feel free to report bugs and/or provide feedback.

Purely for experimental purposes targeting Mono environment, possibly a good use for Raspberry Pi users ...
Don't be surprised if your program crashes at any point in time or if it remains stable for hours/days/weeks.

These would generally be the steps to follow in order to use these drivers (there are the latest updated dll files as well as ModbusTCP driver in one of the posts below):

-   Update each AHMI project to target Net Framework 4.5 (I have not seen any issues as a consequence of doing this and I did it because both drivers are targeting the same framework)
-   Add the attached dll files as existing item to the AdvancedHMIDrivers/Support folder and reference them both in each AHMI project
-   Rebuild the solution
-   Add the SerialDf1MonoForSLCMicroCom.vb file as existing item to the AdvancedHMIDrivers/AllenBradley folder
-   Add the ModbusRTUMonoCom.vb file as existing item to the AdvancedHMIDrivers/Modbus folder
-   Rebuild the solution
-       These new drivers should show in the Toolbox

Try using fresh AHMI project for all this or a copy of your existing project.

Check the attached picture for controls which appear to be working properly in Mono (some other controls not shown might work as well). This is a screenshot of my test with Raspberry Pi -> USB2RS232 Cable (USB-1761-CBL-PM02) -> MicroLogix 1100 (DF1 on Channel0). I had these devices communicate for hours and the app never crashed.

These drivers work in Windows as well but should never really be used instead of the existing AHMI drivers.

DLL's are created to use common components from the AHMI project so try not to use them as standalone.

Maybe try the updated version of these drivers, found in Reply #5.


25
This is intended for those who might find it either interesting or useful or both.

Not necessarily that all MicroLogix 1100 controllers will have all these features available.

This test setup had MicroLogix 1763-L16BBB rev. B controller together with USB-1761-CBL-PM02 programming cable (USB to round mini DIN 8-pin) as well as ethernet cable, all connected to the same PC which also had ModRSsim2 simulator to provide Slave stations for Modbus RTU Master feature.

This particular controller allows for parallel communication on both channels, Channel1 (ethernet) and Channel0 (serial).
The good side of Channel0 is that it offers either DF1 or Modbus RTU Slave/Master protocol setting, as the attached picture shows.

If Modbus RTU Slave is selected first then it will create data files to be used within ladder program (Coils and Contacts should be of Binary type while Input and Holding registers should be of Integer type). When Modbus RTU Master is selected then you should have the ModRSsim2 simulator connect directly to the COM port of the USB-1761-CBL-PM02 programming cable (or whatever cable you might be using).

RSLogix Micro will have to be used in order to make any changes.

The files can be downloaded from this post, since this sample app was used for testing:

https://advancedhmi.com/forum/index.php?topic=1813.msg10971#new

Do read whatever comments were included in the sample ladder program or the test app screen.

26
Tips & Tricks / Serial Port Emulators
« on: December 30, 2017, 12:18:57 PM »
For those of you who might need them:

com0com (FREE): https://sourceforge.net/projects/com0com/files/
64-bit signed version here:  https://pete.akeo.ie/2011/07/com0com-signed-drivers.html

tty0tty (Linux): https://github.com/freemed/tty0tty

Free Virtual Serial Ports: https://freevirtualserialports.com/

Virtual Serial Ports Emulator (32-bit version is FREE): http://www.eterlogic.com/Products.VSPE.html

27

This control should be used by those who can understand its functionality, generally for testing/troubleshooting purposes.
If not set properly then it could possibly create a potential hazard in a production environment, so be careful of whether to use it at all.


Could be used for quick writes to any address from its collection, which is populated by the designer/user.

The context menu, which pops up on the right-click of the mouse, will have the current address selected.
It can also show/hide the OutputType submenu to allow for its quick change (and will have the current OutputType selected).
Every time the WriteValue output type is selected then a new form will pop up offering to change the current ValueToWrite.

There is also a property to display the current value of the selected PLC address as a text on the button (which turns this button into a sort of BasicLabel).

Do report any bugs if found.

28
Could be used for a quick read/write access to any address from its collection (which is populated by the user).

The context menu, which pops up on the right-click of the mouse, will have the address selected for the currently shown value, as the attached picture shows.

PLCAddressValue doesn't have to be populated for as long as at least 1 address has been entered in the PLCAddressKeypad collection or unless you wish to see the value of a specific address at startup.

KeypadFontColor will only be applied to the AlphaKeyboard and will not have effect on the Keypad. This since KeypadV2, which is used in the latest editions of AHMI, might have slightly odd "invisible characters" issue until the mouse is hovered over.

This particular version of the modified BasicLabel has new default CommentSeparators value, which is " ~ " (space-tilde-space), as the attached picture shows.

There are some new properties:
- "SetPrefixAsCurrentPLCAddress", so the currently selected address And/Or its description can be seen on the label along with the value (this is determined by another new property "SetPrefixAs"), as the attached picture shows
- "SetReadOnlyMode" property which prevents writes thus has the BasicLabel only show the value of the currently selected PLCAddress

Important!
As of this last edit, which also included new picture and updated file, since Archie has updated drivers for string reading/writing then you should stick with the file from this post and just read the rest of the posts in this topic so you can understand how everything evolved with the time.
It is sufficient to just add this new control as existing item to the PurchasedControls folder inside the AdvancedHMIControls project, close all open forms and rebuild the solution.

29
Additional Components / HVScrollBar
« on: November 12, 2017, 03:29:07 PM »
Attached here is the AHMI version of the HVScrollBar mentioned in this post:

https://forum.advancedhmi.com/index.php?topic=1202.msg6437#msg6437

The attached control is standalone and doesn't require the control from the mentioned post (it already includes it).

Should be especially useful for touchscreen devices.

It reads/writes to the same PLC address (behaves pretty much the same as NumericUpDownHMI control from other topic).

The vertical scrollbar still has minimum at the top and maximum at the bottom (still not sure how to resolve this).

30
Open Discussion / C# Version of AHMI (v3.99x)
« on: November 12, 2017, 02:58:09 AM »
To avoid any licensing technicalities the link to this version was removed.

Pages: 1 [2] 3 4