Our customer has some LB machines in automated cells. Because the layout of the cell the operator has to stop the cell in order to make tool wear adjustments. They wanted to be able to adjust the wear offset from outside the cell using an external computer. Because these are dedicated machines and they only need to adjust two tools the user interface was pretty easy. The only thing of any interest on the user interface side is that I bound the Max and Min settings of the Numeric Up Down controls to a calculation based on the current comp and the max comp the machine will allow. So that if the current value for X is .7 MM and the maximum allowed on the machine is 1 mm the max for the control will be set to .3 mm.

The application shown in the video below runs on their PC. To handle the remote communication I went with a WCF service hosted on the machine. Here is the contract I used for the WCF service:

Imports System.ComponentModel
Imports System.ServiceModel
Imports System.ServiceModel.Web

Public Interface IOkuma

 Function GetMachineType() As Gosiger.Utilities.enumMachineType

 Function GetToolData(ToolGroupNumber As Integer, Turret As EnumTurret) As ToolInfo

 Sub AddOffset(OffsetNumber As Integer, Axis As EnumToolWearAxis, Turret As EnumTurret, NewValue As Double)

 Function IsInInch() As Boolean

 Sub Close()

End Interface

The GetToolData method returns an object containing information about the tool group such as tool life remaining, current tool in the group etc.

Microsoft has made it much easier to work with WCF in 4.0 by adding default endpoints automatically for you like the HTTP Basic endpoint that I’m using here.  I call this sub everytime before I make a function call to make sure the channel is open and connected based on example found on SO.  The “BasicHttpBinding_IOkuma”  was automatically added to the app.config when I add the service reference.  I only had to reference it by name.

Private Sub CreateChannel()
 If _Okuma IsNot Nothing Then
 If DirectCast(_Okuma, ICommunicationObject).State = CommunicationState.Opened Then
 End If
 End If

Dim channel__1 = New OkumaServiceRef.OkumaClient("BasicHttpBinding_IOkuma", My.Settings.ConnectionAddress) '""

AddHandler DirectCast(channel__1, ICommunicationObject).Faulted, Sub(s, e) DirectCast(_Okuma, ICommunicationObject).Abort()

 DirectCast(channel__1, ICommunicationObject).Open()
 Catch generatedExceptionName As EndpointNotFoundException
 ' don't worry
 End Try

_Okuma = channel__1

End Sub

Here is a short video to show how the application works.

About jweaver

Service Tech at Gosiger Michigan. Twitter: @jon_weaver6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s