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

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #15 on: June 28, 2018, 03:16:32 AM »
ok i will work on it step by step

first i add a ModbusTCPCom1
then i add Mutlistate1
then i add a tag ( plc address D13 ) which should be written like ( 44110 ) in the plc address of the Mutlistate1 properties
now when i start the app it shows the message correctly according to the value.

what i don`t know how to do
is how to show this message in these forms ( _0080_Alarm_Active , _0085_Alarm_History , _1001_Audit )

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #16 on: June 28, 2018, 04:31:17 AM »
look i tried to do the audit thing
so i edieted the multistat control

i add this code u have in one of the forms

Code: [Select]
Dim CurrentUser = Globals.LoginName
                    If CurrentUser = "" Then
                        CurrentUser = "None"
                    End If
                    Dim Audit_History As New AHMI_v1.Audit
                    Audit_History.Send(Globals.AuditDBPath, CurrentUser, "Alarm", Me.Messages(i).Value, "")


then i pasted it inside the multistate code under the Region "Private Methods" as like this

Code: [Select]
If m_TriggerType = 0 Then
            For i = 0 To Me.Messages.Count - 1
                If m_value = Me.Messages(i).Value Then
                    State_Ptr = i
                    StateChanged = True
                    Dim CurrentUser = Globals.LoginName
                    If CurrentUser = "" Then
                        CurrentUser = "None"
                    End If
                    Dim Audit_History As New AHMI_v1.Audit
                    Audit_History.Send(Globals.AuditDBPath, CurrentUser, "Alarm", Me.text, "")
                End If
            Next
        End If


then i rebuilt the project
and it showed as the photo in the Attachments

so this solved the audit issue for me
but if u have a better way or any advice please tell me

now i will work on the alarm page
and the connection status



Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #17 on: June 28, 2018, 07:05:33 AM »
You are obviously free to do whatever you choose, but the general purpose of audit is for tracking operator input, button presses, setpoint changes, logging in and out, etc. Alarms don't really fit that bill. There is an alarm history for that. The current active alarm and alarm history aren't designed to do what you want. Edits could be made to make it work. It sounds like you got audit to work, so you should be able to get alarms to work because they use the same database functionality.

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #18 on: June 28, 2018, 10:40:59 AM »
I thought about this more, the way I did the alarms is I used an INI file as kind of a working table.  I needed something that could retain data (think App stopping and restarting - need retention), at the time I didn't use a DB and I just never went back and changed it.  So, since there is only one file I used indexes.  I don't know of an easy way to do that with multiple controls scattered through the application.  Writing to a DB, like you did with audit is easy.  But, the active alarms is basically a datatable looking at the INI file, which is changing all of the time.  Personally, if you really want to use the current active alarm summary, then it's probably best to add multiple tags in the current datasubscriber.

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #19 on: June 28, 2018, 12:35:45 PM »
Here is an updated app that makes it easier to add alarms.  I tested, but not thoroughly.  To add open the 1st parent, select AlarmTriggers at the bottom, then edit the Items property.  There is at least one limiting factor, all tags must be the same bit length and I didn't setup arrays... maybe later.  Also, the bit length is hard coded at 16.  Honestly, this should work for most applications.  The addresses don't have to be contiguous, which is what I think you were after.  I didn't test BOOLs, my guess is they won't work.

https://drive.google.com/file/d/1dPHap6RFzRYmBOy7V87IxxzObyomJUim/view?usp=sharing


oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #20 on: June 28, 2018, 05:08:59 PM »
first thanks a lot for your help

i am trying to use it  but i did not make it work yet
i will keep trying and then i will tell u what happens

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #21 on: June 28, 2018, 06:04:56 PM »
I forgot to mention that it's using the stock datasubscriber, which only allows one comcomponent. You need to sweet talk Archie into making a datasubscriber that allows a comcomponent per item. While he's at it he can fix the data change event for arrays, currently the data change/return only works on the first element in the array, which is fairly useless.

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #22 on: June 28, 2018, 06:07:50 PM »
To test, use the numeric controls on the form, that's why I left them there.

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #23 on: June 30, 2018, 03:13:25 AM »
For those who might be interested, in one of the later posts there is the link to modified version of this latest project, which performs Integer instead of bit alarming and also can monitor multiple PLCs:

It should theoretically allow 32000+ alarms per single address.

It can be tested as it is with MODRSsim2 program (which needs to have enabled the option to "Use a separate set of registers for each station" found by clicking the "Adv. PLC Emul. settings" icon in the top right corner).

There might be bugs in the project.
« Last Edit: July 02, 2018, 09:33:57 PM by Godra »

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #24 on: June 30, 2018, 06:16:43 AM »
lovely

thanks for your help Godra and Phrog

i will keep u posted

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #25 on: June 30, 2018, 06:56:07 AM »
i tried your project Godra it reads the alarm but does not show a pop up massage and does not show it in the alarm history and active alarms

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #26 on: June 30, 2018, 07:08:54 AM »
away from the alarming thing

how did you make the project this way
when the program starts it opens (_0000_1st_Parent.vb)
but it has (_0001_Main.vb )inside it as it is a part of it ?

i read something about mdi parent and child forms

but i didn`t try it before

so in this project how did u do it ?
can you show me the way?

usually my projects depends on images and panels
each page i need i create a form for it and change form button

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #27 on: June 30, 2018, 08:50:03 AM »
Your pictures show "No Communication to PLC" ... did you use MODRSsim2 program for your test?

If not, then try it first and set it as suggested ... once this works then try making changes to have it work with your PLCs.

Phrog30

  • Guest
Re: Sample App New Multistate with Designer and import/export
« Reply #28 on: June 30, 2018, 01:00:23 PM »
How about we back up a bit...

What is being requested?  Is it how to do alarms, is how to use the multistate, is it to change forms?

1.  I'm being Capt. Obvious, the multistate is a multistate.  It displays a state.  It has nothing to do with alarms.  Since it's read only, it doesn't need auditing.  So, I'm more than happy to tweak the control, but I'm not going to spend time making it work with alarms.

2.  Alarming... In it's simplest part, it's binary.  An alarm is either on or off.  There are many ways to do alarming.  Over the years, I found the best to be mapping in the PLC to bits and the HMI reads the words (arrays) then breaks them back apart to display an alarm text.  Using bits or integer triggers in the HMI is SOOO stupid.  If you want to use integer triggers, be my guest but I will not spend time on it.  What I currently have in place WILL work for you.  You simply map the state to a bit in the PLC.  That's is it.  Done.  The hard part here is that you have multiple PLC's.  No problem, I can get that working for you if you are interested.  But, it will be bit array triggering, not bit or integers.  So, let me know if you are interested and I can throw something together.  Also let me know if I confused you on mapping to bits in the PLC, I can try and form an example.

3.  Yes I use MDI parents.  There are many ways to do what I did, I found this the easiest.  For multi display applications, I only have to have one form that may, or may not, be displayed on multiple screens at once.  I have a property that is set to allow multiple instances.  There is nothing to set up, it just works.  I have buttons that are designed to change forms and it works with the multi display functionality.  Look at the main form (with a house) button, that is an example.  This has been the more desired layout of HMI for my customers. So, each form has it's own navigation set.  Another option is to use a global footer/header/side bar.  What I didn't like about this is if you have a button that takes you to a screen, that button is still there once you change.  Why?  You can't go there anymore than you already are.  You could write code to hide it, but why?  This way you can have forms with many buttons, or forms with just one.  You simply drag and drop any way you like... done!

So, I think we need to ask questions a little better.  Don't ask how you do something.  Ask, I would like to do "x", what's the best way to do it.  Because the way you may have in mind, might not be the best, or even good... like using a multistate for alarming. :)

James

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: Sample App New Multistate with Designer and import/export
« Reply #29 on: June 30, 2018, 03:04:00 PM »
I connected it to the plc not to the simulator
I have set up two testing plcs so in the image
each two multistate is connected to a plc
And each one is set to a diffrent register


Mr Progh for my projrct us didn't have any problem with working with multi plcs at the same time
What i am doing here is learning more and more from the experts like you, Archie and Godra and am not saying that to complement  any one
Am always looking to learn more and when i see a project that i like i start asking questions  to understand how it is done

This is the second project on vb net i make
In the one am working on i am connected to 6 plcs and the hmi is on more than one computer at the same time and they are working fine
But your project and the way you made it
It looks and works more professional ,  and thats what i need

For the alarming i never had a problem  of using multistate to show it to the user
And to tell you the truth there is another step am going to work on which  is the Audit page will recieve data from another pc's so it will be working as one pc i a server and the others are clients

And to tell the truth am at this time more of a designer  than a programer
I will attach image of my first project when i get to my laptop so you can understand what am to
And i apologies if my English and the way i ask questions  is bad

And am really  thankful  for your help guys ☺️