labview opc with ni opc servers - halvorsen.blog · ni opc servers a demo version should be...

24
LabVIEW OPC with NI OPC Servers Hans-Petter Halvorsen, M.Sc.

Upload: others

Post on 12-Mar-2020

62 views

Category:

Documents


0 download

TRANSCRIPT

LabVIEWOPCwithNIOPCServers

Hans-PetterHalvorsen,M.Sc.

Software

YouneedthefollowingSoftware:• LabVIEW(LabVIEWProfessionalDevelopmentSystem32-Bit:English)

• NIOPCServers

AllLabVIEWSoftwarecanbedownloadedfrom:www.ni.com/download

Youmayusethemin“EvaluationMode”ifyoudon'thaveavalidLicensekey

WriteDatatoOPCServerReadDatafromOPCServer

LabVIEWApplication#1 LabVIEWApplication#2

InthisExampleLabVIEWApplication #1andLabVIEWApplication#2areonthesamecomputer.Normallytheyarelocatedon2differentcomputersinaNetwork.

NIOPCServers

NIOPCServers

Hans-PetterHalvorsen,M.Sc.

NIOPCServersADemoversionshouldbeincludedwithLabVIEWDSCModuleorLabVIEWReal-TimeModule

UseSearchinWindows.Searchfor«OPCServers»Andselect«OPCServersConfiguration»

NIOPCServers

NIOPCServerswillthenstartandyougetaccessfromtheTaskbarinWindows.

Select“Configuration”

NIOPCServersConfiguration

HereyoumaycreateNewOPCTags.JustRight-clickandselect«NewTag»

NIOPCServers– CreateNewTag

HereIhavecreateaNewOPCTagcalled«Temperature»

OPCinLabVIEW

Hans-PetterHalvorsen,M.Sc.

TheOPCFunctionsinLabVIEW

TheDataSocketpaletteinLabVIEW: WriteDatatoOPC

ReadDatafromOPC

OpenConnectiontoOPCServer CloseConnection

toOPCServer

BrowseOPCServersandOPCItems

YoucanuseLabVIEWasanOPCclientbyconnecting toanOPCserverthrough aDataSocket connection.

OPCWriteinLabVIEW

Hans-PetterHalvorsen,M.Sc.

WriteDatatoOPCServerReadDatafromOPCServer

LabVIEWApplication#1 LabVIEWApplication#2

InthisExampleLabVIEWApplication #1andLabVIEWApplication#2areonthesamecomputer.Normallytheyarelocatedon2differentcomputersinaNetwork.

NIOPCServers

Write toOPCServerusingLabVIEW

OrspecifyURLdirectly:

1 2 3 4

WhileLoop

WhileLoop

UsetheBucketBrigade Items– becausetheycanbeusedforbothreadingandwriting

ConnecttoNIOPCServersWriteTagURLmanuallyorselectTagusing the«DataSocketSelctURL»

OPCReadinLabVIEW

Hans-PetterHalvorsen,M.Sc.

WriteDatatoOPCServerReadDatafromOPCServer

LabVIEWApplication#1 LabVIEWApplication#2

InthisExampleLabVIEWApplication #1andLabVIEWApplication#2areonthesamecomputer.Normallytheyarelocatedon2differentcomputersinaNetwork.

NIOPCServers

Read fromOPCServerusingLabVIEW

1 2 3 4

WhileLoop

WhileLoopOrspecifyURLdirectly:

ConnecttoNIOPCServersWriteTagURLmanuallyorselectTagusing the«DataSocketSelctURL»

FinalSolution

Hans-PetterHalvorsen,M.Sc.

WriteDatatoOPCServerReadDatafromOPCServer

LabVIEWApplication#1 LabVIEWApplication#2

InthisExampleLabVIEWApplication #1andLabVIEWApplication#2areonthesamecomputer.Normallytheyarelocatedon2differentcomputersinaNetwork.

NIOPCServers

RunningWriteClientandReadClientsimultaneously

ItWorks!

Hans-PetterHalvorsen,M.Sc.

UniversityCollegeofSoutheastNorwaywww.usn.no

E-mail:[email protected]:http://home.hit.no/~hansha/