Sunteți pe pagina 1din 29

6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

UsingtheLabVIEWSharedVariable
PublishDate:Mar04,2012

Overview
LabVIEWprovidesaccesstoawidevarietyoftechnologiesforcreatingdistributedapplications.Thesharedvariable
introducedinLabVIEW8isamajorstepforwardinsimplifyingtheprogrammingnecessaryforsuchapplications.This
applicationnoteisanintroductiontothesharedvariableandincludesadiscussionofitsfeaturesandperformancefrom
LabVIEW8.20throughLabVIEW2009.

TableofContents
1.CreatingSharedVariables
2.SingleProcessSharedVariable
3.NetworkPublishedSharedVariable
4.TheSharedVariableEngine
5.Performance
6.Benchmarks

1.CreatingSharedVariables
Usingthesharedvariable,youcansharedatabetweenloopsonasinglediagramorbetweenVIsacrossthenetwork.In
contrasttomanyexistingdatasharingmethodsinLabVIEW,suchasUDP/TCP,LabVIEWqueues,andRealTimeFIFOs,you
typicallyconfigurethesharedvariableatedittimeusingpropertydialogs,andyoudonotneedtoincludeconfigurationcodein
yourapplication.

Youcancreatethreetypesofsharedvariables:singleprocess,networkpublished,andtimetriggered.Thispaperdiscusses
thesingleprocessandthenetworkpublishedsharedvariablesindetail.RefertothedocumentUsingTimeTriggered
NetworkstoCommunicateDeterministicallyOverEthernetwiththeLabVIEW8RealTimeModule
(http://zone.ni.com/devzone/cda/tut/p/id/4720)formoreinformationaboutthetimetriggeredsharedvariable.Tocreatea
sharedvariable,rightclickonacomputingdevicesuchasMyComputerorarealtimetargetintheprojecttree,andselect
NewVariabletodisplaythesharedvariablepropertiesdialog.Specifytheconfigurationforthenewvariableinthedialog
presented.

Youmusthaveaprojectopentocreateasharedvariable.Toaddasharedvariabletoaproject,rightclickatarget,aproject
library,orafolderwithinaprojectlibraryintheProjectExplorerwindowandselectNewVariablefromtheshortcutmenuto
displaytheSharedVariablePropertiesdialogbox.SelectamongthesharedvariableconfigurationoptionsandclicktheOK
button.

IfyourightclickatargetorafolderthatisnotinsideaprojectlibraryandselectNewVariablefromtheshortcutmenuto
createasharedvariable,LabVIEWcreatesanewprojectlibraryandplacesthesharedvariableinside.RefertotheShared
VariableLifetimesectionformoreinformationaboutvariablesandlibraries.

Figure1showstheSharedVariablePropertiesdialogboxforasingleprocesssharedvariable.TheLabVIEWRealTime
ModuleandtheLabVIEWDataloggingandSupervisoryControl(DSC)Moduleprovideadditionalfeaturesandconfigurable
propertiestosharedvariables.AlthoughinthisexampleboththeLabVIEWRealTimeModuleandtheLabVIEWDSCModule
areinstalled,youcanusethefeaturestheLabVIEWDSCModuleaddsonlyfornetworkpublishedsharedvariables.

Figure1.SingleProcessSharedVariableProperties

DataType
Youcanselectfromalargenumberofstandarddatatypesforanewsharedvariable.Inadditiontothesestandarddatatypes,
youcanspecifyacustomdatatypebyselectingCustomfromtheDataTypepulldownlistandnavigatingtoacustomcontrol.
However,somefeaturessuchasscalingandrealtimeFIFOswillnotworkwithsomecustomdatatypes.Also,ifyouhavethe
LabVIEWDSCModuleinstalled,alarmingislimitedtobadstatusnotificationswhenusingcustomdatatypes.

AfteryouconfigurethesharedvariablepropertiesandclicktheOKbutton,thesharedvariableappearsinyourProject
Explorerwindowunderthelibraryortargetyouselected,asshowninFigure2.

http://www.ni.com/whitepaper/4679/en/ 1/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure2.SharedVariableintheProject

ThetargettowhichthesharedvariablebelongsisthetargetfromwhichLabVIEWdeploysandhoststhesharedvariable.
RefertotheDeploymentandHostingsectionformoreinformationaboutdeployingandhostingsharedvariables.
VariableReferences
AfteryouaddasharedvariabletoaLabVIEWproject,youcandragthesharedvariabletotheblockdiagramofaVItoreador
writethesharedvariable,asshowninFigure3.ThereadandwritenodesonthediagramarecalledSharedVariablenodes.

Figure3.ReadingandWritingtoaSharedVariableUsingaSharedVariableNode
YoucansetaSharedVariablenodeasabsoluteortargetrelativedependingonhowyouwantthenodetoconnecttothe
variable.AnabsoluteSharedVariablenodeconnectstothesharedvariableonthetargetonwhichyoucreatedthevariable.A
targetrelativeSharedVariablenodeconnectstothesharedvariableonthetargetonwhichyouruntheVIthatcontainsthe
node.
IfyoumoveaVIthatcontainsatargetrelativeSharedVariablenodetoanewtarget,youalsomustmovethesharedvariable
tothenewtarget.UsetargetrelativeSharedVariablenodeswhenyouexpecttomoveVIsandvariablestoothertargets.
SharedVariablenodesareabsolutebydefault.RightclickanodeandselectChangetoTargetRelativeorChangeto
AbsolutetochangehowtheSharedVariablenodeconnectstothesharedvariable.
YoucanrightclickasharedvariableintheProjectExplorerwindowandeditthesharedvariablepropertiesatanytime.The
LabVIEWprojectpropagatesthenewsettingstoallsharedvariablereferencesinmemory.Whenyousavethevariablelibrary,
thesechangesarealsoappliedtothevariabledefinitionstoredondisk.

2.SingleProcessSharedVariable

UsesingleprocessvariablestotransferdatabetweentwodifferentlocationsonthesameVIthatcannotbeconnectedby
wires,suchasparallelloopsonthesameVI,ortwodifferentVIswithinthesameapplicationinstance.Theunderlying
implementationofthesingleprocesssharedvariableissimilartothatoftheLabVIEWglobalvariable.Themainadvantageof
singleprocesssharedvariablesovertraditionalglobalvariablesistheabilitytoconvertasingleprocesssharedvariableintoa
networkpublishedsharedvariablethatanynodeonanetworkcanaccess.
SingleProcessSharedVariablesandLabVIEWRealTime
Inordertomaintaindeterminism,arealtimeapplicationrequirestheuseofanonblocking,deterministicmechanismto
transferdatafromdeterministicsectionsofthecode,suchashigherprioritytimedloopsandtimecriticalpriorityVIs,to
nondeterministicsectionsofthecode.WhenyouinstalltheLabVIEWRealTimeModule,youcanconfigureasharedvariable
touserealtimeFIFOsbyenablingtherealtimeFIFOfeaturefromtheSharedVariablePropertiesdialogbox.National
InstrumentsrecommendsusingrealtimeFIFOstotransferdatabetweenatimecriticalandalowerpriorityloop.Youcan
avoidusingthelowlevelrealtimeFIFOVIsbyenablingtherealtimeFIFOonasingleprocesssharedvariable.

InLabVIEWversionspriorto8.6,LabVIEWcreatesarealtimeFIFOthefirsttimeaSharedVariablenodeattemptstowriteto
orreadfromasharedvariable.Thisbehaviorresultsinaslightlylongerexecutiontimeforthefirstuseofeachsharedvariable
comparedwithsubsequentuses.Ifanapplicationrequiresextremelyprecisetiming,includeeitherinitialwarmupiterations
inthetimecriticallooptoaccountforthisfluctuationinaccesstimesorreadthevariableatleastonceoutsidethetimecritical
loop.InLabVIEW8.6andlater,LabVIEWcreatesarealtimeFIFOwhentheVIisreservedforexecution(whenthetoplevel
VIintheapplicationstartsrunninginmostcases),sonospecialconsiderationofthefirstexecutionoftheSharedVariable
nodeisneeded.

http://www.ni.com/whitepaper/4679/en/ 2/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure4.RealTimeFIFOEnabledSharedVariables

LabVIEWcreatesasingle,realtimeFIFOforeachsingleprocesssharedvariableevenifthesharedvariablehasmultiple
writersorreaders.Toensuredataintegrity,multiplewritersblockeachotherasdomultiplereaders.However,areaderdoes
notblockawriter,andawriterdoesnotblockareader.NationalInstrumentsrecommendsavoidingmultiplewritersormultiple
readersofsingleprocesssharedvariablesusedintimecriticalloops.

Figure5.MultipleWritersandReadersSharingaSingleFIFO

ByenablingtherealtimeFIFO,youcanselectbetweentwoslightlydifferenttypesofFIFOenabledvariables:thesingle
elementandthemultielementbuffer.OnedistinctionbetweenthesetwotypesofbuffersisthatthesingleelementFIFOdoes
notreportwarningsonoverfloworunderflowconditions.AseconddistinctionisthevaluethatLabVIEWreturnswhenmultiple
readersreadanemptybuffer.MultiplereadersofthesingleelementFIFOreceivethesamevalue,andthesingleelement
FIFOreturnsthesamevalueuntilawriterwritestothatvariableagain.MultiplereadersofanemptymultielementFIFOeach
getthelastvaluethattheyreadfromthebufferorthedefaultvalueforthedatatypeofthevariableiftheyhavenotreadfrom
thevariablebefore.Thisbehaviorisshownbelow.

Figure6.LastReadBehaviorandtheMultielementRealTimeFIFOSharedVariable

IfanapplicationrequiresthateachreadergeteverydatapointwrittentoamultielementFIFOsharedvariable,useaseparate
sharedvariableforeachreader.

3.NetworkPublishedSharedVariable

Usingthenetworkpublishedsharedvariable,youcanwritetoandreadfromsharedvariablesacrossanEthernetnetwork.
Thenetworkingimplementationishandledentirelybythenetworkpublishedvariable.

Inadditiontomakingyourdataavailableoverthenetwork,thenetworkpublishedsharedvariableaddsmanyfeaturesnot
availablewiththesingleprocesssharedvariable.Toprovidethisadditionalfunctionality,theinternalimplementationofthe
networkpublishedsharedvariableisconsiderablymorecomplexthanthatofthesingleprocesssharedvariable.Thenextfew
sectionsdiscussaspectsofthisimplementationandofferrecommendationsforobtainingthebestperformancefromthe
networkpublishedsharedvariable.
NIPSP
TheNIPublishandSubscribeProtocol(NIPSP)isanetworkingprotocoloptimizedtobethetransportforNetworkShared
Variables.
NewinLabVIEW8.5!
TheunderlyinglayerofNIPSPhasbeenrewrittentobesubstantiallymoreefficient.Onmodernmachinesrunningmodern
OSkernels,wefoundthattheperformanceofTCPwassignificantlybetterthantryingtoduplicatemuchofit'sfunctionalityin
usermode.TakingadvantageofthisinLabVIEW8.5,thelowestlevelprotocolunderneathNIPSPhasbeenrearchitectedto
http://www.ni.com/whitepaper/4679/en/ 3/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments
useTCP/IPandhasbeenthouroughlyretunedwithaneyetowardperformanceonbothdesktopsystemsandNI'sRTtargets
(seebelowforcomparativebenchmarks).TheNIPSPlayerhasremainedunchangedandsoyoushouldseeperformance
gainswithoutmodifyingyourapplication.
Importantnote:
LabVIEWwillonlyusethisnewNIPSPimplementationifitisinstalledonbothsidesofthecommunicationpipeline.In
otherwords,onlyifLabVIEW8.5orlaterisinstalledonallthetargetsinvolvedinthecommunication.Ifoneofthetargetsis
runninganolderversionofLabVIEW,thenbothwillstepdowntotheolderprotocol.
TheoryofOperationofLogosXT
Figure7illustratesthesoftwarestackofthenetworksharedvariable.Itisimportanttounderstandthisbecausethetheoryof
operationinplayhereisparticulartothelevelofthestackcalledLogosXT.LogosXTisthelayerofthestackresponsiblefor
optimizingthroughputforthesharedvariable.

Figure7.TheSharedVariableNetworkStack
Figure8showstheprinciplecomponentsoftheLogosXTtransmissionalgorithm.Inessence,itisverysimple.Therearetwo
importantactors
1.An8Kilobyte(KB)transmitbuffer
2.A10millisecond(ms)timerthread

Figure8.LogosXTActors.Thebufferwillbetransmittediffullorafter10mshasexpired
Thesenumberswerearrivedatbythoroughlyprofilingvariouspacketsizesandtimestooptimizefordatathroughput.The
algorithmisasfollows:
IFthetransmitbufferisfilledtocapacity(8KB)beforethe10mstimerfires,thenthedatainthatbufferissent
immediatelytoTCPonthesamethreadthatinitiatedthewrite.Inthecaseofthesharedvariable,thethreadwillbethe
sharedvariableenginethread.
IF10mspasseswithoutthebuffereverfillinguptocapacity,thenthedatawillbesentonthetimer'sthread.
Importantnote:Thereisonetransmitbufferforalltheconnectionsbetweentwodistinctendpoints.Thatis,allthe
variablesrepresentingconnectionsbetweentwodifferentmachineswillshareonebuffer.Donotconfusethistransmit
bufferwiththeBufferingpropertyofsharedvariables.Thistransmitbufferisaverylowlevelbufferthatmultiplexes
variablesintooneTCPconnectionandoptimizesnetworkthroughput.
Itisimportanttounderstandthefunctionalityofthislayerofthenetworkstackbecauseithassideeffectsonthecodeonyour
LabVIEWdiagram.Thealgorithmwaits10msbecauseitisalwaysmoreefficientforthroughputtosendasmuchaspossible
inasinglesendoperation.Everynetworkoperationhasafixedoverheadbothintimeandinpacketsize.Ifwesendmany
smallpackets(callitNpackets)containingatotalofBbytes,thenwepaythenetworkoverheadNtimes.Ifinstead,wesend
onelargepacketcontainingBbytes,thenweonlypaythefixedoverheadonceandoverallthroughputismuchgreater.
Thisalgorithmworksverywellifwhatyouwanttodoisstreamdatafromortoatargetatthehighestthroughputratepossible.
If,ontheotherhand,whatyouwanttodoissendsmallpacketsinfrequently,forexamplesendingcommandstoatargetto
performsomeoperationsuchasopeningarelay(1byteofbooleandata),butyouwantittogetthereasquicklyaspossible,
thenwhatyouneedtooptimizeforiscalledlatency.InLabVIEW8.5theredidnotexistahooktoforceLogosXTtoflushits
buffer.Instead,itwasvirtuallyguaranteedthattherewouldbeatleast10msoflatencybuiltintothesystemastheprogram
waitedforthetransmitbuffertobefilledbeforefinallytimingevery10msandsendingwhatdataithad.
Ifitismoreimportantinyourapplicationforlatencytobeoptimized,theninLabVIEW8.5.1,youwillfindanewfunctioninthe
SharedVariablepalettecalledFlush.vi.UsethisVItoforcethetransmitbuffersinLogosXTtobeflushedthroughtheshared
variableengineandacrossthenetwork.Thiswilldrasticallylowerlatency.
However,becauseaswasnotedabove,allsharedvariablesconnectingonemachinetooneothermachinesharethesame
transmitbuffer,bycallingFlush,youaregoingtoaffectmanyofthesharedvariablesonyoursystem.Ifyouhaveother
variablesthatdependonhighthroughput,youwilladverselyaffectthembycallingFlush.vi(Figure9).

http://www.ni.com/whitepaper/4679/en/ 4/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure9.Flush.vi

DeploymentandHosting
Youmustdeploynetworkpublishedsharedvariablestoasharedvariableengine(SVE)thathoststhesharedvariablevalues
onthenetwork.Whenyouwritetoasharedvariablenode,LabVIEWsendsthenewvaluetotheSVEthatdeployedandhosts
thevariable.TheSVEprocessingloopthenpublishesthevaluesothatsubscribersgettheupdatedvalue.Figure10
illustratesthisprocess.Touseclient/serverterminology,theSVEistheserverforasharedvariableandallreferencesarethe
clients,regardlessofwhethertheywritetoorreadfromthevariable.TheSVEclientispartoftheimplementationofeach
sharedvariablenode,andinthispaperthetermclientandsubscriberareinterchangeable.

Figure10.SharedVariableEngineandNetworkSharedVariableValueChanges

NetworkPublishedVariablesandLabVIEWRealTime
YoucanenablerealtimeFIFOswithanetworkpublishedsharedvariable,butFIFOenablednetworkpublishedshared
variableshaveanimportantbehavioraldifferencecomparedtorealtime,FIFOenabled,singleprocesssharedvariables.
Recallthatwiththesingleprocesssharedvariable,allwritersandreadersshareasingle,realtimeFIFOthisisnotthecase
withthenetworkpublishedsharedvariable.EachreaderofanetworkpublishedsharedvariablegetsitsownrealtimeFIFOin
boththesingleelementandmultielementcases,asshownbelow.

Figure11.RealTimeFIFOEnabledNetworkPublishedVariable

NetworkBuffering
Youcanusebufferingwiththenetworkpublishedsharedvariable.YoucanconfigurebufferingintheSharedVariable
Propertiesdialogbox,asshowninFigure12.

http://www.ni.com/whitepaper/4679/en/ 5/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure12.EnablingBufferingonaNetworkedPublishedSharedVariable

Withbufferingenabled,youcanspecifythesizeofthebufferinunitsofthedatatype,inthiscase,doubles.
Withbuffering,youcanaccountfortemporaryfluctuationsbetweenread/writeratesofavariable.Readersthatoccasionally
readavariableslowerthanthewritercanmisssomeupdates.Iftheapplicationcantoleratemissingdatapointsoccasionally,
theslowerreadratedoesnotaffecttheapplicationandyoudonotneedtoenablebuffering.However,ifthereadermust
receiveeveryupdate,enablebuffering.YoucansetthesizeofthebufferontheVariablepageoftheSharedVariable
Propertiesdialogbox,soyoucandecidehowmanyupdatestheapplicationretainsbeforeitbeginsoverwritingolddata.
Whenyouconfigureanetworkbufferinthedialogboxabove,youareactuallyconfiguringthesizeoftwodifferentbuffers.
Theserversidebuffer,depictedasthebufferinsidetheboxlabeledSharedVariableEngine(SVE)infigure13belowis
automaticallycreatedandconfiguredtobethesamesizeastheclientsidebuffer,moreonthatbufferinaminute.Theclient
sidebufferismorelikelytheonethatyoulogicallythinkofwhenyouareconfiguringyoursharedvariabletohavebuffering
enabled.Theclientsidebuffer(depictedontherighthandsideoffigure13)isthebufferresponsibleformaintainingthe
queueofpreviousvalues.Itisthisbufferthatinsulatesyoursharedvariablesfromfluctuationsinloopspeedornetworktraffic.
InLabVIEW8.5,networkbufferinghasundergoneachange.WiththeredesignofourlowlevelNIPSPprotocol,the
transmissionofdatabecomeslargelylossless.Again,infigure13below,thebufferintheboxlabeledSharedVariableEngine
(SVE)istheserversidebuffer.Thisbufferisutilizedonlyinthecasethatthelowlevelprotocolgetsflowcontrolled.This
shouldonlyhappeninoneoftwocases:
1.Ifyouwritedataintooneormoresharedvariablesfasterthantheclientcanacknowledgethoseincomingchanges.
2.Ifyouwritedataintooneormoresharedvariablesfasterthanthekerneldrivercanhandthatdataofftothephysicallayer
(ethernetinmostcases).
Notethatbothofthesecasesarelimitationsofnetworklayersunderneath(andoutofthecontrolof)thesharedvariable
communicationstack.

Unliketherealtime,FIFOenabled,singleprocessvariable,forwhichallwritersandreaderssharethesamerealtimeFIFO,
eachreaderofanetworkpublishedsharedvariablegetsitsownbuffersoreadersdonotinteractwitheachother.

Figure13.Buffering

Bufferinghelpsonlyinsituationsinwhichtheread/writerateshavetemporaryfluctuations.Iftheapplicationrunsforan
indefiniteperiodoftime,readersthatalwaysreadataslowerratethanawritereventuallylosedataregardlessofthesizeof
thebufferyouspecify.Becausebufferingallocatesabufferforeverysubscriber,toavoidunnecessarymemoryusage,use
bufferingonlywhennecessary.
NetworkandRealTimeBuffering
IfyouenablebothnetworkbufferingandtherealtimeFIFO,theimplementationofthesharedvariableincludesbothanetwork
bufferandarealtimeFIFO.RecallthatiftherealtimeFIFOisenabled,anewrealtimeFIFOiscreatedforeachwriterand
reader,whichmeansthatmultiplewritersandreaderswillnotblockeachother.

http://www.ni.com/whitepaper/4679/en/ 6/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure14.NetworkBufferingandRealTimeFIFOs

Althoughyoucansetthesizesofthesetwobuffersindependently,inmostcasesNationalInstrumentsrecommendsthatyou
keepthemthesamesize.IfyouenabletherealtimeFIFO,LabVIEWcreatesanewrealtimeFIFOforeachwriterandreader.
Therefore,multiplewritersandreadersdonotblockeachother.
BufferLifetime
LabVIEWcreatesnetworkandrealtimeFIFObuffersonaninitialwriteorread,dependingonthelocationofthebuffers.
Serversidebuffersarecreatedwhenawriterfirstwritestoasharedvariable.Clientsidebuffersarecreatedwhena
subscriptionisestablished.PriortoLabVIEW8.6,thisoccurredwhenaSharedVariablereadorwritenodeexecutedthefirst
time.InLabVIEW8.6andlater,thisoccurswhentheVIcontainingtheSharedVariablenodestarts.Ifawriterwritesdatatoa
sharedvariablebeforeagivenreadersubscribestothatvariable,theinitialdatavaluesarenotavailabletothesubscriber.

Figure15.BufferLifetime

BufferOverflow/Underflow
ThenetworkpublishedsharedvariablereportsnetworkbufferoverflowandunderflowconditionsinLabVIEW8.20andnewer.
TherealtimeFIFOinallversionswillindicateFIFOoverflow/underflowbyreturningerrors.AnapplicationinLabVIEW8.0or
8.0.1cancheckfornetworkbufferunderflowsintwoways.Becausethetimestampresolutionofthesharedvariableis1ms,
youcancomparethetimestampofasharedvariabletothesubsequentreadtimestamptodetectbufferunderflowswhenyou
updatethevariableatlessthan1kHz.Orthereadercanuseasequencenumberbundledwiththedatatonoticebuffer
overflows/underflows.Youcannotusethesecondapproachwithsharedvariablesusedinsideatimecriticalloopifthedata
typeisanarraybecausetherealtimeFIFOenabledsharedvariablesdonotsupporttheCustomControl(cluster)datatypeif
oneoftheelementsoftheclusterisanarray.
SharedVariableLifetime
Asmentionedearlier,allsharedvariablesarepartofaprojectlibrary.TheSVEregistersprojectlibrariesandtheshared
variablesthoselibrariescontainwheneverLabVIEWneedsoneofthosevariables.Bydefault,theSVEdeploysandpublishes
alibraryofsharedvariablesassoonasyourunaVIthatreferencesanyofthecontainedvariables.BecausetheSVEdeploys
theentirelibrarythatownsasharedvariable,theSVEpublishesallsharedvariablesinthelibrarywhetherornotarunningVI
referencesthemall.YoucandeployanyprojectlibrarymanuallyatanytimebyrightclickingthelibraryintheProject
Explorerwindow.

StoppingtheVIorrebootingthemachinethathoststhesharedvariabledoesnotmakethevariableunavailabletothe
network.Ifyouneedtoremovethesharedvariablefromthenetwork,youmustexplicitlyundeploythelibrarythevariableis
partofintheProjectExplorerwindow.YoualsocanselectToolsSharedVariableVariableManagertoundeployshared
variablesorentireprojectlibrariesofvariables.InLabview8.6theVariableManagerhasbeenreplacedbytheDistributed
SystemManagerandcanbefoundbyselectingToolsDistributedSystemManager.
FrontPanelDataBinding
Anadditionalfeatureavailableforonlynetworkpublishedsharedvariablesisfrontpaneldatabinding.Dragasharedvariable
fromtheProjectExplorerwindowtothefrontpanelofaVItocreateacontrolboundtothesharedvariable.Whenyouenable
databindingforacontrol,changingthevalueofthecontrolchangesthevalueofthesharedvariabletowhichthecontrolis

http://www.ni.com/whitepaper/4679/en/ 7/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments
bound.WhiletheVIisrunning,iftheconnectiontotheSVEissuccessful,asmallgreenindicatorappearsnexttothefront
panelobjectontheVI,asshowninFigure16.

Figure16.BindingaFrontPanelControltoaSharedVariable

YoucanaccessandchangethebindingforanycontrolorindicatorontheDataBindingpageofthePropertiesdialogbox.
WhenusingtheLabVIEWRealTimeModuleortheLabVIEWDSCModule,youcanselectToolsSharedVariableFront
PanelBindingMassConfigurationtodisplaytheFrontPanelBindingMassConfigurationdialogboxandcreatean
operatorinterfacethatbindsmanycontrolsandindicatorstosharedvariables.

NationalInstrumentsdoesnotrecommendusingfrontpaneldatabindingforapplicationsthatrunonLabVIEWRealTime
becausethefrontpanelmightnotbepresent.
ProgrammaticAccess
Asdiscussedabove,youcancreate,configure,anddeploysharedvariablesinteractivelyusingtheLabVIEWProject,andyou
canreadfromandwritetosharedvariablesusingthesharedvariablenodeontheblockdiagramorthroughfrontpaneldata
binding.Newin2009,LabVIEWalsoprovidesprogrammaticaccesstoallofthisfunctionality.

UseVIServertocreateprojectlibrariesandsharedvariablesprogrammaticallyinapplicationswhereyouneedtocreatelarge
numbersofsharedvariables.Inaddition,theLabVIEWDSCModuleprovidesacomprehensivesetofVIstocreateandedit
sharedvariablesandprojectlibrariesprogrammaticallyaswellasmanagetheSVE.Youcancreatelibrariesofshared
variablesprogrammaticallyonlyonWindowssystemshowever,youcandeploythesenewlibrariesprogrammaticallyto
WindowsorLabVIEWRealTimesystems.
UsetheprogrammaticSharedVariableAPIinapplicationswhereyouneedchangedynamicallythesharedvariablethataVI
readsandwrites,orwhereyouneedtoreadandwritelargenumbersofvariables.Youcanchangeasharedvariable
dynamicallybybuildingtheURLprogrammatically.

Figure17.UsingtheprogrammaticSharedVariableAPItoReadandWriteSharedVariables

Inaddition,withtheNetworkVariableLibraryintroductedinNILabWindows/CVI8.1andNIMeasurementStudio8.1,youcan
readandwritetosharedvariablesinANSIC,VisualBasic.NETorVisualC#.
4.TheSharedVariableEngine

TheSVEisasoftwareframeworkthatenablesanetworkedpublishedsharedvariabletosendvaluesthroughthenetwork.On
Windows,LabVIEWconfigurestheSVEasaserviceandlaunchestheSVEatsystemstartup.Onarealtimetarget,theSVE
isaninstallablestartupcomponentthatloadswhenthesystemboots.

Inordertousenetworkpublishedsharedvariables,anSVEmustberunningonatleastoneofthenodesinthedistributed
system.AnynodeonthenetworkcanreadorwritetosharedvariablesthattheSVEpublishes.AsshowninTable1,nodes
canreferenceavariablewithouthavingtheSVEinstalled.YoualsomighthavemultipleSVEsinstalledonmultiplesystems
simultaneouslyifyouneedtodeploysharedvariablesindifferentlocationsbasedonapplicationrequirements.
RecommendationsforSharedVariableHostingLocation
Youmustconsideranumberoffactorswhendecidingfromwhichcomputingdevicetodeployandhostnetworkpublished
sharedvariablesyouuseinadistributedsystem.
IsthecomputingdevicecompatiblewithSVE?
ThefollowingtablesummarizestheplatformsforwhichtheSVEisavailableandidentifiestheplatformsthatcanusenetwork
publishedsharedvariablesthroughreferencenodesortheDataSocketAPI.NationalInstrumentsrequires32MBofRAMand
recommends64MBfortheSVEonallapplicableplatforms.
NewinLabVIEW8.5
TheDatasocketAPInowsupportsNIPSPonLinuxandMacintosh.Previously,werecommendedacomplexseriesofsteps
togetsharedvariablereferencenodesworkingonthoseplatforms.Wenolongerrecommendthis.Instead,itshouldbe
muchmorestraightforwardtosimplyauthoryourclientapplicationdirectlyontheseplatformsusingDatasocket.Notethat
hostingofsharedvariablesisstillnotsupportedonLinuxnorMacintosh.

http://www.ni.com/whitepaper/4679/en/ 8/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

SVE

ReferenceNodes

DataSocketAPIw/PSP

Table1.NetworkPublishedSharedVariableCompatibilityOverview
Doestheapplicationrequiredataloggingandsupervisoryfunctionality?
IfyouwanttousethefeaturesoftheLabVIEWDSCModule,youmusthostthesharedvariablesonWindows.TheLabVIEW
DSCModuleaddsthefollowingfunctionalitytonetworkpublishedsharedvariables:
HistoricalloggingtoNICitadeldatabase.
Networkedalarmsandalarmlogging.
Scaling.
Userbasedsecurity.
Initialvalue.
TheabilitytocreatecustomI/Oservers.
IntegrationoftheLabVIEWeventstructurewiththesharedvariable.
LabVIEWVIstoprogrammaticallycontrolallaspectsofsharedvariablesandthesharedvariableengine.TheseVIsare
especiallyhelpfulformanaginglargenumbersofsharedvariables.
Doesthecomputingdevicehaveadequateprocessorandmemoryresources?
TheSVEisanadditionalprocessthatrequiresbothprocessingandmemoryresources.Inordertogetthebestperformancein
adistributedsystem,installtheSVEonmachineswiththemostmemoryandprocessingcapabilities.

Whichsystemisalwaysonline?
Ifyoubuildadistributedapplicationinwhichsomeofthesystemsmightgoofflineperiodically,hosttheSVEonasystemthat
isalwaysonline.
AdditionalFeaturesoftheSharedVariableEngine
Figure18illustratesthemanyresponsibilitiesoftheSVE.Inadditiontomanagingnetworkedpublishedsharedvariables,the
SVEisresponsiblefor:
CollectingdatareceivedfromI/Oservers.
ServingupdatathroughtheOPCandthePSPserverstosubscribers.
Providingscaling,alarming,andloggingservicesforanysharedvariablewiththoseservicesconfigured.Theseservicesare
availableonlywiththeLabVIEWDSCModule.
Monitoringforalarmconditionsandrespondingaccordingly.
I/OServers
I/OserversarepluginstotheSVEwithwhichprogramscanusetheSVEtopublishdata.NIFieldPoint5.0includesanI/O
serverthatpublishesdatadirectlyfromFieldPointbankstotheSVE.BecausetheSVEisanOPCserver,thecombinationof
theSVEandtheFieldPointI/OserverservesasanFPOPCserver.TheFieldPointinstallerdoesnotincludetheSVEitwould
havetobeinstalledbyanothersofwarecomponentsuchasLabVIEW.

NIDAQmx8.0alsoincludesanI/OserverthatcanpublishNIDAQmxglobalvirtualchannelsautomaticallytotheSVE.This
I/OserverreplacestheTraditionalDAQOPCserverandRDA.NIDAQmxincludestheSVEandcaninstallitwhenLabVIEW
isnotinstalled.

WiththeLabVIEWDSCModule,userscancreatenewI/Oservers.

Figure18.SharedVariableEngine(SVE)

http://www.ni.com/whitepaper/4679/en/ 9/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

OPC
TheSVEis3.0compliantandcanactasanOPCserveronWindowsmachines.AnyOPCclientcanwritetoorreadfroma
sharedvariablehostedonaWindowsmachine.WhenyouinstalltheLabVIEWDSCModuleonaWindowsmachine,theSVE
alsocanactasanOPCclient.YoucanbindsharedvariablesthataWindowsmachinehoststoOPCdataitemswithDSCand
bywritingtoorreadingfromthevariabletotheOPCdataitem.

BecauseOPCisatechnologybasedonCOM,aWindowsAPI,realtimetargetsdonotworkwithOPCdirectly.AsFigure19
shows,youstillcanaccessOPCdataitemsfromarealtimetargetbyhostingthesharedvariablesonaWindowsmachine.

Figure19.BindingtoOPCDataItem
5.Performance

Thissectionprovidesgeneralguidelinesforcreatinghighperformingapplicationsusingthesharedvariable.

BecausethesingleprocesssharedvariablehasanimplementationsimilartotheLabVIEWglobalvariablesandrealtime
FIFOs,NationalInstrumentshasnoparticularrecommendationsforachievinggoodperformanceforsingleprocessshared
variables.Thefollowingsectionsconcentrateonthenetworkpublishedsharedvariable.
SharetheProcessor
ThenetworkpublishedsharedvariablesimplifiesLabVIEWblockdiagramsbyhidingmanyoftheimplementationdetailsof
networkprogramming.ApplicationsconsistofLabVIEWVIsaswellastheSVEandtheSVEclientcode.Inordertogetthe
bestsharedvariableperformance,developtheapplicationsothatitrelinquishestheprocessorregularlyfortheSVEthreadsto
run.Onewaytoaccomplishthisistoplacewaitsintheprocessingloopsandensurethattheapplicationdoesnotuseuntimed
loops.Theexactamountoftimeyoumustwaitisapplication,processor,andnetworkdependenteveryapplicationrequires
somelevelofempiricaltuninginordertoachievethebestperformance.
ConsidertheLocationoftheSVE
TheRecommendationsforSharedVariableHostingLocationsectiondiscussedanumberoffactorsyoumustconsiderwhen
decidingwheretoinstalltheSVE.Figure20showsanotherfactorthatcangreatlyimpacttheperformanceoftheshared
variable.Thisexampleinvolvesarealtimetarget,butthebasicprinciplesalsoapplytononrealtimesystems.Figure20
showsaninefficientuseofnetworkpublishedsharedvariables:yougeneratedataonarealtimetargetandneedtologthe
dataprocessedlocallyandmonitoritfromaremotemachine.BecausevariablesubscribersmustreceivedatafromtheSVE,
thelatencybetweenthewriteinthehighpriorityloopandthereadinthenormalpriorityloopislargeandinvolvestwotrips
acrossthenetwork.

Figure20.InefficientUseofNetworkPublishedVariablesonRealTime

Figure21showsabetterarchitectureforthisapplication.Theapplicationusesasingleprocesssharedvariabletotransfer
databetweenthehighpriorityloopandthelowpriorityloop,reducingthelatencygreatly.Thelowprioritylooplogsthedata
andwritestheupdatetoanetworkpublishedsharedvariableforthesubscriberatthehost.

http://www.ni.com/whitepaper/4679/en/ 10/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure21.EfficientUseofNetworkPublishedVariablesonRealTime
6.Benchmarks
ThissectioncomparestheperformanceofthesharedvariabletootherapplicabledatasharingmethodsinLabVIEW,suchas
theLabVIEWglobalvariable,realtimeFIFOs,andTCP/IP.Thefollowingtablesummarizesthetestsdiscussedarepresented
inthefollowingsections.


Test

T1

T2

http://www.ni.com/whitepaper/4679/en/ 11/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

http://www.ni.com/whitepaper/4679/en/ 12/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

http://www.ni.com/whitepaper/4679/en/ 13/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

T3

http://www.ni.com/whitepaper/4679/en/ 14/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

http://www.ni.com/whitepaper/4679/en/ 15/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

http://www.ni.com/whitepaper/4679/en/ 16/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments
T4

T5

http://www.ni.com/whitepaper/4679/en/ 17/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

http://www.ni.com/whitepaper/4679/en/ 18/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

T6

http://www.ni.com/whitepaper/4679/en/ 19/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

http://www.ni.com/whitepaper/4679/en/ 20/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Table2.BenchmarkOverview

ThefollowingsectionsdescribethecodeNationalInstrumentscreatedforeachofthebenchmarks,followedwiththeactual
benchmarkresults.TheMethodologyandConfigurationsectiondiscussesingreaterdetailthechosenmethodologyforeach
benchmarkandthedetailedconfigurationusedforthehardwareandsoftwareonwhichthebenchmarkwasrun.
SingleProcessSharedVariablesvs.LabVIEWGlobalVariables
ThesingleprocesssharedvariableissimilartotheLabVIEWglobalvariable.Infact,theimplementationofthesingleprocess
sharedvariableisaLabVIEWglobalwiththeaddedtimestampingfunctionality.

TocomparetheperformanceofthesingleprocesssharedvariabletotheLabVIEWglobalvariable,NationalInstruments
createdbenchmarkVIstomeasurethenumberoftimestheVIcanreadandwritetoaLabVIEWglobalvariableorsingle
processsharedvariableeverysecond.Figure22showsthesingleprocesssharedvariablereadbenchmark.Thesingle
processsharedvariablewritebenchmarkandtheLabVIEWglobalread/writebenchmarksfollowthesamepattern.

http://www.ni.com/whitepaper/4679/en/ 21/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure22.SingleProcessSharedVariableReadBenchmarkingVI

Thecombinationread/writetestalsoincludescodetovalidatethateverypointwrittenalsocanbereadbackinthesame
iterationoftheloopwithnodatacorruption.
T1TestResults
Figure23showstheresultsofTestT1.Theresultsshowthatthereadperformanceforasingleprocesssharedvariable
islowerthanthereadperformanceforaLabVIEWglobalvariable.Thewriteperformance,andhencetheread/write
performance,ofthesingleprocesssharedvariableisslightlylowerthanthatoftheLabVIEWglobalvariable.Performanceof
singleprocesssharedvariableswillbeaffectedbyenablinganddisablingthetimestampfunctionality,soitisrecommendedto
turnthetimestampoffifitisnotuseful.

TheMethodologyandConfigurationsectionexplainsthespecificbenchmarkingmethodologyandconfigurationdetailsforthis
testset.

Figure23.SingleProcessSharedVariablevs.GlobalVariablePerformance

SingleProcessSharedVariablesvs.RealTimeFIFOs
NationalInstrumentsbenchmarkedsustainablethroughputtocomparetheperformanceoftheFIFOenabledsingleprocess
sharedvariableagainsttraditionalrealtimeFIFOVIs.Thebenchmarkalsoexaminestheeffectofthesizeofthetransferred
data,orpayload,foreachofthetworealtimeFIFOimplementations.

Thetestsconsistofatimecriticalloop(TCL)generatingdataandanormalpriorityloop(NPL)consumingthedata.National
Instrumentsdeterminedtheeffectofthepayloadsizebysweepingthrougharangeofdoubleprecisionscalarandarraydata
types.Thescalartypedeterminesthethroughputwhenthepayloadisonedouble,andthearraytypesdeterminethe
throughputfortherestofthepayloads.Thetestrecordsthemaximumsustainablethroughputbydeterminingthemaximum
sustainablespeedatwhichyoucanexecutebothloopswithnodataloss.

Figure24showsasimplifieddiagramoftherealtimeFIFObenchmarkthatomitsmuchofthenecessarycoderequiredto
createanddestroytheFIFOs.NotethatasofLabVIEW8.20,anewFIFOfunctionwasintroducedtoreplacetheFIFOSubVI's
shownhere.TheFIFOfunctionswereusedforthedatagraphedinthispaper,andperformbetterthantheir8.0.xSubVI
predecessors.

http://www.ni.com/whitepaper/4679/en/ 22/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure24.SimplifiedRealTimeFIFOBenchmarkingVI

Anequivalentversionofthetestusesthesingleprocesssharedvariable.Figure25showsasimplifieddepictionofthat
diagram.

Figure25.SimplifiedFIFOEnabledSingleProcessSharedVariableBenchmarkingVI

T2TestResults
Figure26and27showstheresultsofTestT2,comparingtheperformanceoftheFIFOenabledsingleprocessshared
variableagainstrealtimeFIFOfunctions.Theresultsindicatethatusingthesingleprocesssharedvariableismarginally
slowerthanusingrealtimeFIFOs.

Figure26.SingleProcessSharedVariablevs.RealTimeFIFOVIPerformance(PXI)

http://www.ni.com/whitepaper/4679/en/ 23/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure27.SingleProcessSharedVariablevs.RealTimeFIFOVIPerformance(cRIO9012)

NetworkPublishedSharedVariablesvs.RealTimeFIFOsandTCP/IP
Withtheflexibilityofthesharedvariable,youcanpublishasingleprocesssharedvariablequicklyacrossthenetworkwithjust
afewconfigurationchanges.Forrealtimeapplicationsinparticular,performingthesametransformationinearlierversionsof
LabVIEWrequirestheintroductionofalargeamountofcodetoreadtherealtimeFIFOsontheRTSeriescontrollerandthen
sendthedataoverthenetworkusingoneofthemanyavailablenetworkingprotocols.Tocomparetheperformanceofthese
twodifferentapproaches,NationalInstrumentsagaincreatedbenchmarkVIstomeasurethesustainablethroughputofeach
withnodatalossacrossarangeofpayloads.

Fortheprevariableapproach,thebenchmarkVIusesrealtimeFIFOsandTCP/IP.ATCLgeneratesdataandplacesitina
realtimeFIFOanNPLreadsthedataoutoftheFIFOandsendsitoverthenetworkusingTCP/IP.AhostPCreceivesthe
dataandvalidatesthatnodatalossoccurs.

Figure28showsasimplifieddiagramoftherealtimeFIFOandTCP/IPbenchmark.Again,thisdiagramvastlysimplifiesthe
actualbenchmarkVI.

Figure28.SimplifiedRealTimeFIFOandTCP/IPBenchmarkingVI

NationalInstrumentscreatedanequivalentversionofthetestusingthenetworkpublishedsharedvariable.Figure29showsa
simplifieddiagram.

http://www.ni.com/whitepaper/4679/en/ 24/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure29.SimplifiedRealTimeFIFOEnabledNetworkPublishedSharedVariableBenchmarkingVI

T3TestResults
ThissectioncontainstheresultsofTestT3,comparingtheperformanceoftherealtimeFIFOenablednetworkpublished
sharedvariabletothatofequivalentcoderelyingonrealtimeFIFOVIsandLabVIEWTCP/IPprimitives.Figure30showsthe
resultswhentheLabVIEWRealTimetargetisanembeddedRTSeriesPXIcontroller.

Figure30.NetworkPublishedSharedVariablevs.RealTimeFIFOandTCPVIPerformance(PXI)

T3ResultsindicatethatthroughputofNetworkpublishedSharedVariablesapproachesthatofTCPandthatbothare
consistentacrossmoderatetolargepayloadsizes.Thesharedvariablemakesyourprogrammingjobeasier,butthatdoes
notcomewithoutacost.Itshouldbenoted,however,thatifanaiveTCPimplementationisused,itcouldbeeasyto
underperformsharedvariables,particularlywiththenew8.5implementationofNIPSP.

T4TestResults

MemoryFootprintoftheNetworkPublishedSharedVariable
NotethatnosignificantchangestovariablefootprinthavebeenmadeinLabVIEW8.5.Therefore,thisbenchmarkwasnot
rerun.
Determiningthememoryfootprintofthesharedvariableisdifficultbecausethememoryusedbythesharedvariabledepends
ontheconfiguration.Networkpublishedsharedvariableswithbuffering,forexample,allocatememorydynamicallyasneeded
bytheprogram.ConfiguringasharedvariabletouserealtimeFIFOsalsoincreasesmemoryusagebecauseinadditionto
networkbuffers,LabVIEWcreatesbuffersfortheFIFO.Thereforethebenchmarkresultsinthispaperprovideonlyabaseline
measurementofmemory.
Figure31showsthememorythattheSVEusesafterLabVIEWdeploys500and1000sharedvariablesofthespecifiedtypes
toit.Thegraphshowsthatthetypeofvariabledoesnotaffectthememoryusageofthedeployedsharedvariables
significantly.Notethatthesearenonbufferedvariables.

http://www.ni.com/whitepaper/4679/en/ 25/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

Figure31.MemoryUsageofNetworkPublishedSharedVariableswithDifferentDataTypes
Figure32showsmemoryusageasafunctionofthenumberofsharedvariablesdeployed.Thistestusesonlyonetypeof
variable,anemptyBooleanarray.Thememoryusageincreaseslinearlywiththevariablecount.

Figure32.MemoryUsageofSharedVariablesofDifferentSizes

T5TestResults
Comparisonbetween8.2Neworkpublishedsharedvariablesand8.5variablesstreaming

InLabVIEW8.5,wehavereimplementedthebottomlayerofthenetworkprotocolusedtotransportsharedvariable
data.Itofferssignificantlybetterperformance.

Inthiscase,wehostedasinglevariableoftypeWaveformofDoublesonacRIO9012.Wegeneratedallthedata,
theninatightloop,transferredthedatatothehostwhichreaditoutofanotherwaveformsharedvariablenodeasfast
asitcould.

Youcanseefromfigure30,thatperformancehasimprovedinLabVIEW8.5byover600%forthisusecase.

Figure33.WaveformthroughputcomparisonbetweenLabVIEW8.5andLabVIEW8.20(andearlier)
http://www.ni.com/whitepaper/4679/en/ 26/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments
T6TestResults
Comparisonbetween8.2Neworkpublishedsharedvariablesand8.5variablesstreaming
Inthistest,weusedthesametwotargetsasinT5,butinsteadoftransferringasinglevariable,wechangedthedatatypetoa
doubleandvariedthenumberofsharedvariablesfrom11000,measuringthroughputalongtheway.Again,allthevariables
werehostedonthecRIO9012,incrementingdatawasgeneratedthereaswellandtransmittedtothehostwheretheywere
read.
Figure34againshowsasignificantperformanceincreasefromLabVIEW8.20toLabVIEW8.5.However,thethroughputis
significantlylessinthecaseofmanysmallervariablesthanitisforasinglelargevariableasinT5.Thisisbecauseeach
variablehasassociatedwithitafixedamountofoverhead.Whenmanyvariablesareused,thisoverheadismultipliedbythe
nubmerofvariablesandbecomesquitenoticable.

Figure34.HighchannelcountthroughputcomparisonbetweenLabVIEW8.5andLabVIEW8.20(andearlier)

MethodologyandConfiguration
Thissectionprovidesdetailedinformationregardingthebenchmarkingprocessforallthepreviouslymentionedtestsets.
T1MethodologyandConsiderations
TestT1usesasimplebenchmarkingtemplatetodeterminereadandwriteratesthroughsimpleaveragingoveralarge
numberofiterations.Eachtestexecutedatotalof500millioniterationsfortotalexecutiontimesintheorderofoneminute,
timedwithmillisecondresolution.
T1Hardware/SoftwareConfiguration

HostHardware
DellPrecision450
DualIntelXeon2.4GHzPentiumclassprocessors
1GBDRAM

HostSoftware
WindowsXPSP2
LabVIEW8.20
T2MethodologyandConsiderations
TestT2measuresthroughputbyidentifyingthemaximumsustainablecommunicationratebetweentasksrunningatdifferent
priorities.Atimedlooprunningwithmicrosecondresolutioncontainsthedataproducer.Theconsumerofthedataisafree
running,normalpriorityloopthatreadsfromtherealtimeFIFOorsingleprocesssharedvariableuntilempty,repeatingthis
processuntilacertainamountoftimeelapseswithouterrors.Thetestresultisvalidonlyifallofthefollowingstatementsare
true:
Nobufferoverflowsoccur
Dataintegrityispreserved:nodatalossesoccurandtheconsumerreceivesthedataintheorderitwassent
Timedloopisabletokeepupafteradesignatedwarmupperiodof1s

Thesingleprocesssharedvariablereceiverloopperformssimpledataintegritychecks,suchasensuringthattheexpected
numberofdatapointswerereceivedandthatthereceivedmessagepatterndoesnotlackintermediatevalues.

NationalInstrumentsconfiguredthebuffersizesfortherealtimeFIFOandsharedvariableFIFObufferstobe100elements
deepforalltestvariationsanddatatypesinvolved.
T2Hardware/SoftwareConfiguration

PXIHardware
NIPXI8196RTSeriescontroller
2.0GHzPentiumclassprocessor
256MBDRAM
Broadcom57xx(1Gb/sbuiltinEthernetadapter)

PXISoftware
LabVIEW8.20RealTimeModule
NetworkVariableEngine1.2.0
VariableClientSupport1.2.0
Broadcom57xxGigabitEthernetdriver2.1configuredinpollingmode
http://www.ni.com/whitepaper/4679/en/ 27/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments
Broadcom57xxGigabitEthernetdriver2.1configuredinpollingmode
CompactRIOHardware
NIcRIO9012controller
400MHzprocessor
64MBDRAM
CompactRIOSoftware
LabVIEW8.20RealTimeModule
NetworkVariableEngine1.2.0
VariableClientSupport1.2.0

T3MethodologyandConsiderations
TestT3measuresthroughputdirectlybyrecordingtheamountofdatatransmittedoverthenetworkandtheoveralldurationof
thetest.Atimedlooprunningwithmicrosecondresolutioncontainsthedataproducer,whichisresponsibleforwritinga
specificdatapatterntothenetworkpublishedsharedvariableorrealtimeFIFOVIs.

Forthenetworkpublishedsharedvariablecase,anNPLrunsonthehostsystemandreadsfromthevariableinafreerunning
whileloop.FortherealtimeFIFOVItest,theNPLrunsontherealtimesystem,checkingthestateoftheFIFOatagivenrate,
readingallavailabledata,andsendingitoverthenetworkusingTCP.Thebenchmarkresultsshowtheeffectofhavingthis
pollingperiodsettoeither1or10ms.

Thetestresultisvalidonlyifallofthefollowingstatementsaretrue:
Nobufferoverflowsoccur,neitherFIFOnornetwork
Dataintegrityispreserved:nodatalossesoccurandtheconsumerreceivesthedataintheorderitwassent
ThetimedloopintheTCLVIisabletokeepupafteradesignatedwarmupperiodof1s

Afterreadingeachdatapoint,theNPLforthenetworkvariabletestchecksthedatapatternforcorrectness.Fortherealtime
FIFOtest,theTCLisresponsibleforvalidationbasedonwhetherarealtimeFIFOoverflowoccurred.

Tohelpavoiddataloss,NationalInstrumentsconfiguredthebuffersizestobenosmallerthantheratiobetweentheNPLand
TCLloopperiods,withalowerboundof100elementsastheminimumsizefortherealtimeFIFObuffers.
T3Hardware/SoftwareConfiguration

HostHardware
IntelCore2Duo1.8GHz
2GBDRAM
IntelPRO/1000(1Gb/sEthernetadapter)

HostSoftware
WindowsVista64
LabVIEW8

NetworkConfiguration
1Gb/sswitchednetwork

PXIHardware
NIPXI8196RTcontroller
2.0GHzPentiumclassprocessor
256MBDRAM
Broadcom57xx(1Gb/sbuiltinEthernetadapter)

PXISoftware
LabVIEW8.5RealTimeModule
NetworkVariableEngine1.2.0
VariableClientSupport1.2.0
Broadcom57xxGigabitEthernetdriver2.1

T4MethodologyandConsiderations
InTestT4,NationalInstrumentsusednonbuffered,networkpublishedsharedvariableswiththefollowingdatatypes:double,
single,Boolean,doublearray,singlearray,andBooleanarray.
T4Hardware/SoftwareConfiguration

PXIHardware
NIPXI8196RTController
2.0GHzPentiumclassprocessor
256MBDRAM
Broadcom57xx(1Gb/sbuiltinEthernetadapter)

http://www.ni.com/whitepaper/4679/en/ 28/29
6/7/2017 UsingtheLabVIEWSharedVariableNationalInstruments

PXISoftware
LabVIEWRealTimeModule8.0
NetworkVariableEngine1.0.0
VariableClientSupport1.0.0
Broadcom57xxGigabitEthernetdriver1.0.1.3.0
T5andT6MethodologyandConsiderations
IntestT5andT6,NationalInstrumentsusednonbuffered,networkpublishedsharedvariablesoftheWaveformofDouble
datatype.
T5andT6Hardware/SoftwareConfiguration
HostHardware
64BitIntelCore2Duo1.8GHz
2GBRAM
Gigabitethernet
HostSoftware
WindowsVista64
LabVIEW8.20andLabVIEW8.5
CompactRIOHardware
cRIO9012
64MBRAM
CompactRIOSoftware
LabVIEWRT8.20andLabVIEWRT8.5
NetworkVariableEngine1.2(withLabVIEW8.20)and1.4(withLabVIEW8.5)
VariableClientSupport1.0(withLabVIEW8.20)and1.4(withLabVIEW8.5)

http://www.ni.com/whitepaper/4679/en/ 29/29

S-ar putea să vă placă și