Sign in to follow this  
Followers 0
Sheva_spd

ASP.Net

3 posts in this topic

Hello everyone, I have a project for ASP.net. I want to make my own SCADA for OMRON using ASP.Net with c#. Can someone help me with my problem? Thank you very much. Best Regards Surya Edited by Sheva_spd

Share this post


Link to post
Share on other sites
You can write your own FINS driver for Omron using C#, this will allow the server to communicate with an Omron PLC & postback the results to the browser. I've been meaning to find the time to do this myself as well. below is a snip of old VB code of how to make the FINS driver using a socket. attached is a copy of the FINS manual so that you will understand the commands with the PLC Option Strict Off Option Explicit On Imports System.Text Imports System.IO Imports System.Net Imports System.Net.Sockets Friend Class frmSend Inherits System.Windows.Forms.Form Dim jsok As Socket Dim plcipa, meipa As IPAddress Dim plcipend, meipend As IPEndPoint Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click Text1.Text = "" Text2.Text = "" Text4.Text = "" Text7.Text = "" txtReceived.Text = "" End Sub Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click txtSend.Text = "" End Sub Public Sub exit_Renamed_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles exit_Renamed.Click End End Sub Private Sub frmSend_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load LocalIPAddress.Text = "192.168.1.10" RemoteIPAddress.Text = "192.168.1.254" SNA1.Text = "01" 'SNA$" SA11.Text = "0A" 'SA1$ SA21.Text = "00" 'SA2$ DNA1.Text = "01" 'DNA$ DA11.Text = "FE" 'DA1$ DA21.Text = "00" 'DA2$ Dim myByte(1024) As Byte Dim tmp5(17) As Byte Dim i As Integer For i = 0 To 16 tmp5(i) = 0 Next plcipa = New IPAddress(CLng(&H100A8C0)) 'big endian of 192.168.0.1, will change later meipa = New IPAddress(CLng(&H200A8C0)) 'big endian of 192.168.0.2, will change next Try meipa = IPAddress.Parse(LocalIPAddress.Text) Catch ex As Exception MsgBox("invalid local IP address", MsgBoxStyle.Exclamation) Exit Sub End Try Try plcipa = IPAddress.Parse(RemoteIPAddress.Text) Catch ex As Exception MsgBox("invalid Remote IP address", MsgBoxStyle.Exclamation) Exit Sub End Try TextBox1.Text = plcipa.ToString TextBox2.Text = meipa.ToString plcipend = New IPEndPoint(plcipa, 9600) meipend = New IPEndPoint(meipa, 9600) jsok = New Socket(meipend.AddressFamily, SocketType.Dgram, ProtocolType.Udp) Combo1.Items.Insert(0, "0501") Combo1.Items.Insert(1, "0101800002000001") Combo1.Items.Insert(2, "01028000020000011234") Combo1.Items.Insert(3, "0101820000000001") Combo1.Items.Insert(4, "0102820000000001FFFF") Combo1.Items.Insert(5, "0701") Combo1.Items.Insert(6, "0601") Combo1.Items.Insert(7, "0101821388000035") Combo1.Text = "0501" Dim X, l, k As Integer Dim Header, tmp1, c As String Dim SID, RSV, GCT, ICF As String Text3.Text = "" k = 0 ICF = "80" GCT = "02" RSV = "00" SID = "00" Header = ICF & RSV & GCT & DNA1.Text & DA11.Text & DA21.Text & SNA1.Text & SA11.Text & SA21.Text & SID c = Header & Combo1.Text txtSend.Text = "" l = Len© ReDim tmp5((l - 2) / 2) For X = 1 To l Step 2 tmp1 = Microsoft.VisualBasic.Strings.Mid(c, X, 2) tmp5(k) = CByte(Val("&H" & tmp1)) k += 1 Next X For X = 0 To (k - 1) txtSend.Text &= Hex(tmp5(X)) & " " Next X txtSend.Refresh() jsok.SendTo(tmp5, plcipend) 'send FINS cmd HACK to bind socket Timer2.Enabled = True End Sub Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer1.Tick Text3.Text = "Timeout" End Sub Private Sub cmdSendData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSendData.Click Dim X, l, k As Integer Dim tmp5(17) As Byte Dim Header, tmp1, c As String Dim SID, RSV, GCT, ICF As String Text3.Text = "" k = 0 ICF = "80" GCT = "02" RSV = "00" SID = "00" Header = ICF & RSV & GCT & DNA1.Text & DA11.Text & DA21.Text & SNA1.Text & SA11.Text & SA21.Text & SID c = Header & Combo1.Text txtSend.Text = "" l = Len© ReDim tmp5((l - 2) / 2) For X = 1 To l Step 2 tmp1 = Microsoft.VisualBasic.Strings.Mid(c, X, 2) tmp5(k) = CByte(Val("&H" & tmp1)) k += 1 Next X For X = 0 To (k - 1) txtSend.Text &= Hex(tmp5(X)) & " " Next X txtSend.Refresh() If jsok IsNot Nothing Then jsok.SendTo(tmp5, plcipend) 'send FINS cmd Timer1.Enabled = True End Sub Private Sub socket_got_somptin(ByVal somptin() As Byte, ByVal somnum As Integer) Dim X, l, ln As Integer Dim t, c, tr, resp, R As String Timer1.Enabled = False R = "" resp = "" txtReceived.Text = "" Dim vtData() As Byte Static b(1024) As Byte Static d(1024) As String Static ascii(1024) As String Array.Clear(b, 0, b.Length) Array.Clear(d, 0, d.Length) Array.Clear(ascii, 0, ascii.Length) vtData = somptin ln = somnum For l = 1 To ln b(l) = Val(CStr(vtData(l - 1))) c = Hex(b(l)) If Len© < 2 Then c = "0" & c d(l) = c resp = resp & c Next l t = " ICF RSV GCT DNA DA1 DA2 SNA SA1 SA2 SID MRC SRC MEC SEC" & Chr(13) & Chr(10) t = t & " " & d(1) & " " & d(2) & " " & d(3) & " " & d(4) & " " & d(5) & " " & d(6) & " " & d(7) & " " & d(8) & " " & d(9) & " " & d(10) & " " & d(11) & " " & d(12) & " " & d(13) & " " & d(14) & vbCrLf Text2.Text = t For X = 15 To ln If b(X) > 31 And b(X) < 256 Then ascii(X) = Chr(b(X)) Else ascii(X) = "." End If Next X tr = "" For X = 15 To ln Step 20 tr = d(X) & d(X + 1) & " " & d(X + 2) & d(X + 3) & " " & d(X + 4) & d(X + 5) & " " & d(X + 6) & d(X + 7) & " " & d(X + 8) & d(X + 9) & " " & d(X + 10) & d(X + 11) & " " & d(X + 12) & d(X + 13) & " " & d(X + 14) & d(X + 15) & " " & d(X + 16) & d(X + 17) & " " & d(X + 18) & d(X + 19) & " | " & ascii(X) & ascii(X + 1) & ascii(X + 2) & ascii(X + 3) & ascii(X + 4) & ascii(X + 5) & ascii(X + 6) & ascii(X + 7) & ascii(X + 8) & ascii(X + 9) & ascii(X + 10) & ascii(X + 11) & ascii(X + 12) & ascii(X + 13) & ascii(X + 14) & ascii(X + 15) & ascii(X + 16) & ascii(X + 17) & ascii(X + 18) & ascii(X + 19) & vbCrLf txtReceived.Text &= tr 'Print #1, "<p>" & tr & "</p>" 'Print #2, "<p>" & tr & "</p>" Next X If d(1) = "C0" Then If d(13) = "00" AndAlso d(14) = "00" Then Text3.Text = "Successful" If d(13) <> "00" OrElse d(14) <> "00" Then Text3.Text = "Error Code " & d(13) & d(14) End If If d(1) = "81" Then 'Unsolicited message received. Text3.Text = "Unsolicited" TextBox6.Text = Val(TextBox6.Text) + 1 End If Timer1.Enabled = False End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick Dim arr(1024) As Byte Dim retval As Integer If jsok.Available > 0 Then retval = jsok.ReceiveFrom(arr, plcipend) 'recv from socket If retval <> 0 Then socket_got_somptin(arr, retval) 'call sub to process byte array Text1.Text = plcipend.Address.ToString Text4.Text = plcipend.Port.ToString Text7.Text = retval End If End If End Sub End Class FINS_M11W3421107_2.zip

Share this post


Link to post
Share on other sites
thank for your help, I will try this. I hope I can make my own SCADA by APS.Net.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0