Author Topic: Cycle complete indicator on normally closed switch  (Read 3111 times)

Cowboy1

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Cycle complete indicator on normally closed switch
« on: July 19, 2015, 12:44:23 AM »
I would like to add a cycle complete indicator on my screen. The only way I can show the cycle is complete is by a level switch that is normally closed and is open when the cycle is complete. I tried a Annunciator1 and can't find a property that will let me configure it backwards.
Is there another way to do this?

I would also like to know if the is a way to click control the water pump like the other objects and have it highlight when it is running?

This really is a great program for somebody to have this out for free, I have purchased all the add-ons except for the latest one and I will be getting that tomorrow. So thanks to the creator or creators of this software excellent job!!!
I have attached a screenshot of the Fill and Strike Cycle of my first HMI it is going to run my home brewery.
The stuff in the lower right corner is some test stuff for a countdown timer to be used on my next screen the Mash Cycle.
I could also use some ideas to make it look better or better functionality?
It will be used outside in daylight so not sure of the best color choice for outdoors?

Any help with these issues would be greatly appreciated.

Thanks,
David


« Last Edit: July 19, 2015, 12:58:51 AM by Cowboy1 »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5361
    • View Profile
    • AdvancedHMI
Re: Cycle complete indicator on normally closed switch
« Reply #1 on: July 19, 2015, 08:11:52 AM »
You can invert boolean values by preceding the address with "NOT ". For example, you would put an address like this in PLCAddressValue:

NOT B3/0
NOT MyTag
NOT 10001

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5361
    • View Profile
    • AdvancedHMI
Re: Cycle complete indicator on normally closed switch
« Reply #2 on: July 19, 2015, 08:23:29 AM »
I would also like to know if the is a way to click control the water pump like the other objects and have it highlight when it is running?
You can modify the WaterPump.vb code without too much effort to add the PLCAddressClick functionality. If you look in Motor.vb to use as a model, look for the Property PLCAddressClick and copy those lines of code into WaterPump.vb. Then you will want to look for the Click event handler and copy that routine also. There will be another property of OutputType that also needs copied.

Try that and let me know if you need more help with it and I can go into greater detail later tonight.

Cowboy1

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Cycle complete indicator on normally closed switch
« Reply #3 on: July 19, 2015, 08:28:09 AM »
You can invert boolean values by preceding the address with "NOT ". For example, you would put an address like this in PLCAddressValue:

NOT B3/0
NOT MyTag
NOT 10001
Archie you are great with help, this worked perfectly. Almost complete with screen 1. Thanks for all you help. I have not tried the pump yet but will give it a go shortly.

Cowboy1

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Cycle complete indicator on normally closed switch
« Reply #4 on: July 19, 2015, 09:54:42 AM »
I would also like to know if the is a way to click control the water pump like the other objects and have it highlight when it is running?
You can modify the WaterPump.vb code without too much effort to add the PLCAddressClick functionality. If you look in Motor.vb to use as a model, look for the Property PLCAddressClick and copy those lines of code into WaterPump.vb. Then you will want to look for the Click event handler and copy that routine also. There will be another property of OutputType that also needs copied

Try that and let me know if you need more help with it and I can go into greater detail later tonight.
I copied the code from the motor to the water pump and when I build solution I get 3 errors:
outputType is not declared. It may be inaccessible due to it's protection level. Just so you know I copied the motor code and changed all "Motor" to "WaterPump" and pasted over the original pump code. I kept a copy in word of the original pump code if I need to put it back.

Update:  I have done some searching through the code and think there is something that needs to be setup for the water pump inherits for it to have output property? I can't find it though.

Thanks,

David
« Last Edit: July 19, 2015, 10:55:35 AM by Cowboy1 »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5361
    • View Profile
    • AdvancedHMI
Re: Cycle complete indicator on normally closed switch
« Reply #5 on: July 19, 2015, 07:45:14 PM »
Here are the pieces of code that you need to place in WaterPump.vb

Code: [Select]
    '*****************************************
    '* Property - Address in PLC to Link to
    '*****************************************
    Private m_PLCAddressClick As String = ""
    <System.ComponentModel.Category("PLC Properties")> _
    Public Property PLCAddressClick() As String
        Get
            Return m_PLCAddressClick
        End Get
        Set(ByVal value As String)
            If m_PLCAddressClick <> value Then
                m_PLCAddressClick = value
            End If
        End Set
    End Property

Code: [Select]
    '****************************
    '* Event - Mouse Down
    '****************************
    Private Sub MomentaryButton_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown

        If (m_PLCAddressClick IsNot Nothing AndAlso (String.Compare(m_PLCAddressClick, "") <> 0)) And Enabled AndAlso m_CommComponent IsNot Nothing Then
            Try
                Select Case OutputType
                    Case MfgControl.AdvancedHMI.Controls.OutputType.MomentarySet : m_CommComponent.Write(m_PLCAddressClick, 1)
                    Case MfgControl.AdvancedHMI.Controls.OutputType.MomentaryReset : m_CommComponent.Write(m_PLCAddressClick, 0)
                    Case MfgControl.AdvancedHMI.Controls.OutputType.SetTrue : m_CommComponent.Write(m_PLCAddressClick, 1)
                    Case MfgControl.AdvancedHMI.Controls.OutputType.SetFalse : m_CommComponent.Write(m_PLCAddressClick, 0)
                    Case MfgControl.AdvancedHMI.Controls.OutputType.Toggle
                        Dim CurrentValue As Boolean
                        CurrentValue = m_CommComponent.Read(m_PLCAddressClick, 1)(0)
                        If CurrentValue Then
                            m_CommComponent.Write(m_PLCAddressClick, 0)
                        Else
                            m_CommComponent.Write(m_PLCAddressClick, 1)
                        End If
                    Case Else

                End Select

                If tmrError.Enabled Then
                    tmrError.Enabled = False
                End If
            Catch ex As Exception
                DisplayError("WRITE FAILED!" & ex.Message)
            End Try
        End If
        Me.Invalidate()
    End Sub
Code: [Select]
    '****************************
    '* Event - Mouse Up
    '****************************
    Private Sub MomentaryButton_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        If (m_PLCAddressClick IsNot Nothing AndAlso (String.Compare(m_PLCAddressClick, "") <> 0)) And Enabled AndAlso m_CommComponent IsNot Nothing Then
            Try
                Select Case OutputType
                    Case MfgControl.AdvancedHMI.Controls.OutputType.MomentarySet : m_CommComponent.Write(m_PLCAddressClick, 0)
                    Case MfgControl.AdvancedHMI.Controls.OutputType.MomentaryReset : m_CommComponent.Write(m_PLCAddressClick, 1)
                End Select
            Catch ex As Exception
                DisplayError("WRITE FAILED!" & ex.Message)
            End Try
        End If

        Me.Invalidate()
    End Sub
Code: [Select]
    Private m_OutputType As MfgControl.AdvancedHMI.Controls.OutputType = MfgControl.AdvancedHMI.Controls.OutputType.MomentarySet
    Public Property OutputType() As MfgControl.AdvancedHMI.Controls.OutputType
        Get
            Return m_OutputType
        End Get
        Set(ByVal value As MfgControl.AdvancedHMI.Controls.OutputType)
            m_OutputType = value
        End Set
    End Property