Author Topic: Sample App New Multistate with Designer and import/export  (Read 29126 times)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #30 on: June 30, 2018, 03:31:05 PM »
The project is kind of hard-coded for 4 PLCs (there are 4 ModbusTcpCom drivers).

You should still fire up MODRSsim2 just to compensate for the missing 2 PLCs.

You should try to understand the significance of using this simulator at any point in time you might be dealing with Modbus.

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #31 on: June 30, 2018, 03:32:43 PM »
in the link is an image of my first project

which in it i had 6 plc`s in 3 different cities

it worked fine the only thing i didn`t do in it is a history page and database

https://drive.google.com/file/d/13SwXp37vUaoh9ygR_X2flgGMCNHJo-Ey/view?usp=sharing



oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #32 on: June 30, 2018, 03:33:48 PM »
MODRSsim2 i don`t have it

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #33 on: June 30, 2018, 03:48:25 PM »
One other thing you need to improve on is the research.

If you just type it in the Google it will show you all possible links, the very first which should be the SourceForge page.

If you do a search in this forum then you might notice that a member DougLyons is the one who is actually maintaining it.

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #34 on: June 30, 2018, 03:59:03 PM »
but if may i ask
i gave all the  4 ModbusTcpCom drivers an ip for each one and each two have the same ip , is that the reason the connection status does not work? ?
and when i use it i will make it to show the connection status for each ModbusTcpCom separately
from now on i will work like phrog by copying and modifying  each control i need and add it to the project

and what i mean about not having that software is that i don`t need it at this step

for the alarming issue and the audit am done with it for now i got the main idea how to do it from you and Prohg


if you opened the image i add for my first project u will understand that it  takes me  along time between each step and the next

https://drive.google.com/file/d/13SwXp37vUaoh9ygR_X2flgGMCNHJo-Ey/view?usp=sharing

becouse i design the images i test them (how they look in the project ) then i move to the next step

at now i will continue working at my current project i will come back when i have another questions and to share how i did it to get your advice's

with thanks :)
« Last Edit: June 30, 2018, 04:03:25 PM by oqapsking »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #35 on: June 30, 2018, 04:16:05 PM »
If you test the project with MODRSsim2 and actually see it working then you need to try to understand that there might be something you are doing wrong when modifying it.

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #36 on: June 30, 2018, 04:21:54 PM »
ok i will work on that

thanks

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #37 on: June 30, 2018, 04:52:41 PM »

And i apologies if my English and the way i ask questions  is bad


Seriously?  I'm the idiot 'Merican who can barely understand one language.  Yeah, you're doing just fine!!

My point was just approach the question differently, no matter the language.  A lot of time people go down a path they think is correct and they will focus on that path, when in fact it's not the correct path at all.  So, if you state what you are trying to do, then people will tend to do a lot better job of giving advise.  Just my two pennies!!

James

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #38 on: June 30, 2018, 04:56:07 PM »

What i am doing here is learning more and more from the experts like you, Archie and Godra ...


Yep, props to Archie and Godra.  They are the heavy hitters on this stuff.  I'm just trying to remember what day of week it is. :)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #39 on: June 30, 2018, 05:49:13 PM »
James, this project is your work and people seem to start paying attention to it.

The rest of us are just "fooling around" and experiment with it.
 
« Last Edit: July 02, 2018, 09:36:00 PM by Godra »

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #40 on: June 30, 2018, 08:16:39 PM »

James, this project is your work and people seem to start paying attention to it.

The rest of us are just "fooling around" and experiment with it.

I don't mind one bit.  All I did was take what we did in FTViewME and make it work in AHMI, whether good or bad.  I posted it so people could use it.  I truly hope it benefits someone.  I'm sorry if my recent posts sounded crabby, I didn't mean them that way.  I just want to be efficient in the time I spend making changes. 

I really had fun making that app.  I learned a lot, I hope I somewhat got it right...

James

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #41 on: July 01, 2018, 04:32:42 PM »
This project was changed and updated so it easier supports multiple PLCs and their addresses, and here is the link:

https://www.dropbox.com/s/ek96x3h7jvt5dfd/AHMI%20Updated%20Alarming%20vBeta11%20New.7z?dl=0

Requirement for this app is to keep the alarm triggers names format as it is, "PLCxAlarmTriggers" where x is 1, 2, 3, ...
You could add numbers at the end if you wish.
You should CLOSE and RE-OPEN the form whenever you add/remove alarm triggers.

Another thing to mention would be the Alarm_Desc.ini file, inside MyHMI\Data folder, which defines alarm descriptions for all PLCs:
          * The attached picture shows the format to be used for ini sections, which is "PLCx-Address", while alarm descriptions could be anything
          * Any quantity of alarms for any address is supported (see the current project file)

As usual, it will work with MODRSsim2 simulator as it is.
« Last Edit: July 02, 2018, 09:25:35 PM by Godra »

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #42 on: July 02, 2018, 08:48:56 AM »
Here is another option for using multiple datasources for alarming.  This was thrown together and more hard coded than I would like, but it's proof of concept.  My opinion is that the alarm list should be sequential and have unique IDs, so this accomplishes that.

This first data source, I was playing around with the data types...
Code: [Select]

Private Sub AlarmTriggers1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles AlarmTriggers1.DataChanged

        Dim x1 As String = AlarmTriggers1.PLCAddressValueItems(0).LastValue
        If x1 <> "" Then
            AlarmArray(0) = Convert.ToInt32(x1)
            Console.WriteLine(AlarmArray(0))
            Active_Alarms(e.PlcAddress, AlarmArray(0), 0)
        End If

        Dim x2 As String = AlarmTriggers1.PLCAddressValueItems(1).LastValue
        If x2 <> "" Then
            AlarmArray(1) = Convert.ToInt32(x2)
            Console.WriteLine(AlarmArray(1))
            Active_Alarms(e.PlcAddress, AlarmArray(1), 1)
        End If

    End Sub


2nd data source...
Code: [Select]

    Private Sub AlarmTriggers2_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles AlarmTriggers2.DataChanged

        Dim x1 As String = AlarmTriggers2.PLCAddressValueItems(0).LastValue
        If x1 <> "" Then
            AlarmArray(2) = Convert.ToInt32(x1)
            Console.WriteLine(AlarmArray(2))
            Active_Alarms(e.PlcAddress, AlarmArray(2), 2)
        End If

        Dim x2 As String = AlarmTriggers2.PLCAddressValueItems(1).LastValue
        If x2 <> "" Then
            AlarmArray(3) = Convert.ToInt32(x2)
            Console.WriteLine(AlarmArray(3))
            Active_Alarms(e.PlcAddress, AlarmArray(3), 3)
        End If

    End Sub


So, I basically created tags (array) to hold the values of both data sources so everything is back in a logical order.  Then service the alarm code...

Code: [Select]

    Private Sub Active_Alarms(ByRef PLCAddress As String, ByRef PLCValue As String, ByRef i As Integer)

        If AlarmActiveini Is Nothing Then
            AlarmActiveini = New IniFile(AlarmActivePath)
        End If

        Dim Binary_Offset As Integer
        Binary_Offset = i * Binary_Length
        Dim dt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")

        For b = 0 To Binary_Length - 1
            Dim Shelved = AlarmActiveini.ReadValue("Alarm " & b + Binary_Offset & "", 7) 'Read Alarm Shelved State
            If Shelved = "" Then
                AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 7, 0) 'If NULL/Nothing Then Set to a number (0)
            End If
            If (PLCValue And (1 << b)) <> 0 Then
                Dim result = AlarmActiveini.ReadValue("Alarm " & b + Binary_Offset & "", 3) 'Read Alarm Active State
                If result <> "1" Then
                    AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 4, dt) 'If Alarm Active State Is Not 1 Then Set Active Time To Now
                    AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 1, b + Binary_Offset) 'Set alarm #
                    Dim Count = AlarmActiveini.ReadValue("Alarm " & b + Binary_Offset & "", 8) 'Get Alarm Historical Count
                    If Count = "" Then
                        AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 8, 1) 'If NULL/Nothing Then Set to a number (1)
                    Else
                        AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 8, Count + 1) 'Increment count by 1
                    End If

                    Dim a = b + Binary_Offset
                    If Alarm_Quantity >= a AndAlso Alarm_Quantity > 0 Then 'Ignore alarm banner if alarm is greater than the alarm quantity
                        alarmName = AlarmActiveini.ReadValue("Alarm " & b + Binary_Offset & "", 2)
                        If Globals.Show_New_Alarm_Popup AndAlso Not Splash_Screen.Visible Then
                            Alarm_Banner.Alarm_Queue(dt, alarmName, b + Binary_Offset) 'Send alarm to list for alarm banner display
                        End If
                    End If
                    If Globals.Alarms_Text_To_Speech Then
                        If Not AlarmSpeechbw.IsBusy Then
                            AlarmSpeechbw.RunWorkerAsync()
                        End If
                    End If
                End If

                AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 3, 1) 'Set Alarm Active State To 1
            Else
                Dim result = AlarmActiveini.ReadValue("Alarm " & b + Binary_Offset & "", 3) 'Read Alarm Active State
                Dim time = AlarmActiveini.ReadValue("Alarm " & b + Binary_Offset & "", 4) 'Read Alarm Fault Time
                If result <> "0" AndAlso time <> "" Then
                    AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 5, dt) 'If Alarm Active State Is Not 0 Then Set Reset Time To Now
                    Dim alarmID = b + Binary_Offset
                    If Alarm_Quantity >= alarmID AndAlso Alarm_Quantity > 0 Then 'Ignore alarm history if alarm is greater than the alarm quantity
                        Alarm_History_Data(alarmID)
                    End If
                    If Globals.Show_New_Alarm_Popup AndAlso Not Splash_Screen.Visible Then
                        Alarm_Banner.Alarm_Search_Clear(b + Binary_Offset) 'Send alarm id to alarm banner list to clear if shown
                    End If
                End If
                AlarmActiveini.WriteValue("Alarm " & b + Binary_Offset & "", 3, 0) 'Set Alarm Active State To 0
            End If
        Next

        Populate_Active_Alarms_Table()

    End Sub


There are obviously things to clean up with this, but just wanted to share.

James

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #43 on: July 02, 2018, 06:24:27 PM »
This last project was updated again and is now fully automated in adding/removing alarm triggers.
DataSubscribers had to be modified for this change.

See the previous post for description and the link to the project.
« Last Edit: July 02, 2018, 09:22:12 PM by Godra »

nzflex

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #44 on: July 03, 2018, 04:18:56 PM »
How would I add this control to my project ??