Sunteți pe pagina 1din 17

BECKHOFFEL3351:Commissioning

Exampleprograms
Usingtheexampleprograms

Note

Thisdocumentcontainssampleapplicationsofourproductsforcertainareasofapplication.The
applicationnotesprovidedherearebasedontypicalfeaturesofourproductsandonlyserveas
examples.Thenotescontainedinthisdocumentexplicitlydonotrefertospecificapplications.The
customeristhereforeresponsibleforassessinganddecidingwhethertheproductissuitablefora
particularapplication.
Weacceptnoresponsibilityforthecompletenessandcorrectnessofthesourcecodecontainedin
thisdocument.
Wereservetherighttomodifythecontentofthisdocumentatanytimeandacceptnoresponsibility
forerrorsandmissinginformation.

Tableofcontents
Example1:Evaluationofaloadcell
Connectiondiagram
Startingtheexampleprogram
Procedureforstartingtheprogram
Descriptionoftheexampleprogram
Adaptationtothenumberofterminalsinuse
Descriptionofthevisualization
Dealingwithrealcharacteristicvalues
Functionsusedintheprogram
TwinCATScopeView2demonstration

Example1:Evaluationofaloadcell
Download:
InthisexampleprogramtheEL3351isusedtoevaluatethebridgevoltageVDiffthatresultsfromloadingaloadcell.

Fig.1:VisualizationexampleprogramforEL3351,mainpage

Fig.2:TwinCATScopeView2Record
Connectiondiagram
5Vcanbetakendirectlyfromtheterminaltosupplytheresistorbridge.Thisproducesthefollowingconnectiondiagram(fig.
3):

Fig.3:Connectionofaloadcellwith5VsupplyviatheEL3351

Fig.4:Connectionofaloadcellwith10VsupplyviatheEL9510
BeckhoffoffersvariouspowersupplyterminalsforthesupplyofpowertotheloadcellsofanEL3351:
Powersupplyterminal

Inputvoltage

Outputvoltage

Outputcurrent

EL9505

24VDC

5VDC1%

0,5A

EL9508

24VDC

8VDC1%

0,5A

EL9510

24VDC

10VDC1%

0,5A

EL9512

24VDC

12VDC1%

0,5A

Observethespecificationsforthevoltagesupplytotheloadcells!
Thespecificationsgivenbytheloadcellmanufacturerforthemaximumsupplyvoltagemustbe
observed!
Note

Observethespecificationsfortheparallelconnectionoftheloadcells!

Note

Thespecificationsgivenbytheloadcellmanufacturerfortheparallelconnectionmustbeobserved!
Inprinciple,loadcellsconnectedinparallelmusthavethesamenominalcharacteristicvalue,the
samenominalloadandthesameinternalresistance.

Startingtheexampleprogram
Theapplicationexampleshavebeentestedwithatestconfigurationandaredescribedaccordingly.Theuserisfreeto
changetheprogramtosuithisideasortouseonlypartofthecode.
Therefore,pleaserefertothenote"Usingtheexampleprograms".
Thefollowinghardwareandsoftwarewasusedforthetestconfiguration:
TwinCATMasterPCwithWindows7ProfessionaloperatingsystemandTwinCATversion2.11.(Build1553)
BeckhoffEK1100EtherCATcoupler,EL3773andEL9011terminals
Loadcellswithanominalcharacteristicvalueof2mV/Vandanominalloadofupto8kg
Procedureforstartingtheprogram
AfterclickingtheDownloadbutton,savethezipfilelocallyonyourharddisk,andunzipthe*.TSM(configuration)and
the*.PRO(PLCprogram)filesintoatemporaryworkingfolder
Runthe*.TSMfileandthe*.PROfiletheTwinCATSystemManagerandTwinCATPLCwillopen
ConnectthehardwareandconnecttheEthernetadapterofyourPCtotheEtherCATcoupler(furtherinformationon
thiscanbefoundinthecorrespondingcouplermanuals)
SelectthelocalEthernetadapter(withrealtimedriver,ifone)underSystemconfiguration,I/Oconfiguration,I/O
devices,device(EtherCAT)onthe"Adapter"tab,"Search..."box,selecttheappropriateadapterandconfirm(seeFig.
5a+5b)

Fig.5a:SearchingtheEthernetadapter

Fig.5b:SelectionandconfirmationoftheEthernetadapter

Activationoftheconfigurationandconfirmation(Fig.6a+6b)

Fig.6a:Activationoftheconfiguration

Fig.6b:Confirmingtheactivationoftheconfiguration

Confirmingnewvariablemapping,restartinRUNmode(Fig.7a+7b)

Fig.7a:Generatingvariablemapping

Fig.7b:RestartingTwinCATinRUNmode

InTwinCATPLC,underthe"Project"menu,select"Rebuildall"tocompiletheproject(Fig.8)

Fig.8:Compileproject

InTwinCATPLC:loginwiththe"F11"button,confirmloadingtheprogram(Fig.9),runtheprogramwiththe"F5"button

Fig.9:Confirmingprogramstart

Descriptionoftheexampleprogram
Thefollowinglistprovidesanoverviewoftheabbreviationsusedinthefurthercourseofthedescription:
Powersupplyterminal

Inputvoltage

Outputvoltage

Outputcurrent

UDiff

24VDC

5VDC1%

0,5A

URef

24VDC

8VDC1%

0,5A

Emax

24VDC

10VDC1%

0,5A

Cn

24VDC

12VDC1%

0,5A

Adaptationtothenumberofterminalsinuse
TheentireprogramismodularlystructuredinsuchawaythatitcanbeadaptedwithoutmuchefforttothenumberofEL3351s
inuse.AsstandarditcanbeusedfortwoEL3351s.TheprogramisadaptedtothenumberofEL3351sinuseasfollows:an
instancemustbeaddedforeachEL3351inthemainprogram(MAIN).Thisisachievedbyinsertingthefollowinglines
afafbEL3351[2](nTerminalNr:=2,
bDeviceOk=>astDeviceStatus[2].bDeviceOK,
sDeviceStatus=>astDeviceStatus[2].sDeviceStatus);
Thenumberinsquarebracketsalwaysrepresentsthenumberoftheterminal.

Fig.10:Additionofinstances
MakesurethattheCnMaxIdxFbconstantdeclaredinthemainprogram(MAIN)isadaptedtothedesirednumberofterminals.

Fig.11:MaximumnumberofEL3351s
Furthermore,thediagnosticsoftheterminalsmustbeadapted.Thecodeisadaptedasstandardfortwoterminals:

Fig.12:EL3351diagnostics
Foreachnewterminal
ANDastDeviceStatus[2].bDeviceOK
mustbeinsertedinline61and
sAllTerminalsStatus:=CONCAT(sAllTerminalsStatus,astDeviceStatus[2].sDeviceStatus);
Inline70f.Heretoo,thenumberinsquarebracketsalwaysrepresentsthenumberoftheterminal.
Thevisualizationconsistsoftwoplaceholdervisualizations.Thesecanbeusedvariablyforanindefinitenumberofterminals.
Whatbothpageshaveincommonisthattheydisplaythestatusesofthedevicesandthechannels.Thepage
VISU_EL3351_BASICisfortheweightevaluation,whilethepageVISU_EL3351_CoEisfortheprocessingofsomeCoE
entriesandfortheevaluationoftogglebits.
ThepageVSU_EL3351isthevisualizationpage,whichistobeusedduringoperation.Asstandarditcontainstwopagesof
theplaceholdervisualizationsineachcasehence,twoterminalscanbeoperateddirectly.
ThevisualizationVSU_EL3351mustbeselectedinordertoaddnewvisualizations.Instancesoftheplaceholder
visualizationsVISU_EL3351_BASICandVISU_EL3351_CoEcanbeaddedusingtheVisualizationbutton.

Fig.13:Additionofvisualizations
Theinstancefortherespectiveterminalmustbeselectedastheplaceholderbydoubleclickingontheaddedvisualization.

Fig.14:Placeholderselectionbutton

Fig.15:Replacementoftheplaceholder
ForabetterdisplaytheFixedpropertycanadditionallybeselectedbydoubleclickingonthenewlyaddedvisualization.This
causesthesizeofthevisualizationtobeadaptedtotheoriginalsize.

Fig.16:SelectionofFixed
InordertoensurethatthepageforeditingtheCoEparametersduringoperationonlyappearswhentheGotoCoESettings
buttonispressed,anInvisiblevariablecanbesetintheVariablesfieldofthevisualization.Thecompleteentrymustlooklike
this:
NOTMAIN.afbEL3351[3].bVisuZoom
Thenumberinbracketsrepresentsthenumberoftheterminal.

Fig.17:Settingthevariableforinvisible
Assoonasthemodifiedprogramhasbeentranslateditmustberescannedinthesystemmanager.

Fig.18:Rescanningtheproject
Afterthattherequiredvariablesforlinkingtheinputsandoutputsareavailable.
Thefollowingoverviewshowstheassignmentsofthevariables:

Fig.19:Assignmentsofvariablesforterminal

Fig.20:AssignmentsofvariablesforEtherCATdiagnosis
Descriptionofthevisualization
ThevisualizationfortheeditingoftwoEL3351shasthefollowingappearanceasstandard:

Fig.21:Mainpageofthevisualization
ClickingontheGotoCoESettingsbuttonontheMainpageduringoperationtakesyoutothepageonwhichtheCoE
entriescanbeset.AsmallexampleofRGBcoloreditingisopenedbyclickingontheShowRGBbutton.
SystemTime
ThecurrentWindowssystemtimeisdisplayedinthisfield.
StatusInformation
TheuppertextfielddisplaysthestatusoftheEtherCATdevice.Forfurtherinformationsee:EtherCATMasterDiagnostics
Thesecondtextfieldindicateswhetheranerrorhasoccurredintheterminalsduringoperation.Ifthisisthecase,thenumber
oftheterminalinwhichtheerrorhasoccurredisdisplayed.
DeviceStatusInformation
Thestatusoftheterminalisdisplayedhere.ThefieldwiththelabelWcStatedisplaysthestatusoftheworkingcounter.

Fig.22:WorkingCounterEL3351
AssoonasWcStateadoptsthevalue1,theterminalisnolongerparticipatingintheprocessdatatraffic.Ifvalidrealtime
communicationistakingplace,WcStatehasthevalue0.
TheInfoDatafielddisplaysthestatusoftheterminal.

Fig.23:StateEL3351
Ifthisstatusisnotequalto8,thentheterminalisnotintheOP(operational)status.Informationaboutwhichdifferentstatuses
thevaluecanadoptisprovidedbytheInfoboxinthesystemmanager(seefig.23).
BridgeStatus/SupplyStatus
Thisareainformsyouaboutthestatusofthechannelsfortheacquisitionofthebridgevoltageandthereferencevoltage.The
individualvaluestaketheformofBooleanvariables.Thereisanerrorifthevalue1isadopted.

VisualizationMain

Fig.24:VisualizationexampleprogramforEL3351,mainpage
BridgeVoltage/SupplyVoltage
ThesizeofthemeasuringsignalVDiffinmVandthereferencesignalVRefinVaredisplayedinthisarea.
Settings
Thenominalcharacteristicvalueandthenominalloadoftheconnectedloadcellmustbesetatthebeginning.Clickingonthe
respectivefieldenablesavaluetobeentered.Theinputofazeroerror(zerobalance)isoptional.
Calibration
ClickingontheCalibrationModebuttonactivatesthecalibrationmode.Thismodepermitstheautomaticdeterminationofthe
sizeofthezeroerrorandthenominalcharacteristicvalueofaconnectedloadcell.Ifthemodeisactivated,instructionsappear
inthetextfieldofthevisualizationtoguideyouthroughtheentirecalibrationprocess.Thecalibrationisstartedbyclickingon
theStartCalibrationbutton.

Fig.25:Calibrationmode:Start
Ifithasnotalreadybeendone,thenominalloadoftheconnectedloadcellmustbeenteredfirst.

Fig.26:Calibrationmode:Inputofnominalload
Ifthishasbeendone,thenextstepisinitiatedbypressingtheSavebutton.

Fig.27:Calibrationmode:Confirmationofnominalload
Thezeroerroroftheloadcellisnowdetermined.Itmustbeensuredwhendoingthisthattheloadcellisnotloaded.Ifthisis
thecaseyoucanmovetothenextstepwithSave.

Fig.28:Calibrationmode:Determiningthezeroerror
Inordertodeterminethenominalcharacteristicvalue,theloadcellmustbeloadedwithaknownreferenceweight.Thehigher
andmoreprecisethereferenceweightis,themoreprecisethenominalcharacteristicvaluewillbe.Thereferenceweightmust
beenteredintotheassociatedfield.

Fig.29:Calibrationmode:Enteringthereferenceweight
ThecalibrationprocessisconcludedbypressingtheSavebutton.
ThesizeofthecalculatednominalcharacteristicvalueandzeroerrorcanbetakenfromtherespectivefieldsunderSettings.

Fig.30:Calibrationmode:Conclusion
AnewcalibrationcanbestartedbypressingtheStartCalibrationbutton.Ifthecalibrationmodeisendedbyclickingonthe
CalibrationModebutton,thecalculatedsettingsareretained.
MeasuringFunction
Onbasisofthefunctionsprovidedintheexampleprogram,theweightloadingtheloadcelliscalculatedfromthevaluesfor
thenominalload,thenominalcharacteristicvalue,themeasuringsignalandthereferencesignalandifitexistsfromthe
zeroerror.ThetareweightcanbesetviatheSetTareweightbuttonifaweightisloadingtheloadcell.Thesettareweightis
deletedbypressingtheResetTareweightbutton.Ifatareweightisset,thenetweightiscalculatedusingtheequationnet
weight=grossweighttareweight.
Supplyvoltageandcharacteristicvalueoftheloadcell

Note

Thesupplyvoltageoftheloadcellshouldbeselectedtosuititscharacteristicvalue.Themaximum
measuringrangeofthemeasuringsignalis+/20mV.Iftheloadcellhasacharacteristicvalueof2
mV/V,forexample,thenasupplyvoltageof10Vshouldbeselectedsothatthemaximum
differentialvoltageis20mV/10V.
Iftheloadcellinusehasanominalcharacteristicvalueof4mV/V,then5Vcanbetakendirectly
fromtheterminalasthesupplyvoltageinordertooptimallyexploitthemeasuringrange(as
describedinfig.3).

VisualizationCoE
TheCoEentriescanbereadandmodifiedonpage2ofthevisualizationoftheexampleprogram.

Fig.31:CoEpageofthevisualization
ClickingontheGotoMainbuttonontheCoEpageduringoperationtakesyoutothepageonwhichtheweightcalculation
takesplace.
CoEIndex8000/8010
AtthispointUserScalingcanbeactivatedandtheoffsetandgainofUserScalingcanbothbeadjusted.Valuescanonlybe
enteredifUserScalingisactivated.ThisisdonebyclickingontheOn/Offbutton.Thechangesareconfirmedbypressingthe
WriteCoEbutton.

Fig.32:ActivationofUserScaling
AfteractivatingUserScalingboththeoffsetandthegaincanbeadjusted.Allchangesmustbeconfirmedbypressingthe
WriteCoEbutton.

Fig.33:Inputofoffsetandgain
Button"ReadCoE"
PressingthisbuttoncausestheCoEentriesintheindices8000:0and8010:0tobereadoutsuccessivelyandtheirvalues
displayedonthevisualization.
Button"WriteCoE"
IfyouwishtomodifyCoEentries,youmustenterthechangesviathedisplayelements.Thechangesareconfirmedbyclicking
ontheWriteCoEbutton.
Button"SetCoEtoDefault"
ActuatingthisbuttoncausesallCoEentriestoberesettothefactorypresetvaluesanddirectlywritten.
Filter
Thefiltersettingdeterminesthefilterfrequencyandthustheconversiontimeforbothchannelsoftheterminal.Thehigherthe
filterfrequency,thefastertheconversiontime.Furthermore,thetogglebitisevaluatedoveraperiodof10seconds.Anewset
ofprocessdataispresentonbotharisingandfallingedge.AnexampleofthisisgiveninthesectionTwinCATScopeView2
demonstration.Theupdatetimeiscalculateddirectlyfromthenumberofrisingandfallingedgesofthetogglebit.
Dealingwithrealcharacteristicvalues
Thenominalcharacteristicvaluesofloadcellsaresubjecttotoleranceswhichcanbetakenfromtheassociatedcertificates.
Henceitcouldbethecase,forexample,thatthenominalcharacteristicvalueofaloadcellisspecifiedas2mV/V,butdeviates
slightlyfromthataccordingtothecertificate.Inadditiontothatthereisazeroerrorinmostcases.
Thefollowingisintendedtodescribehowtheexampleprogramcanbeadjustedwiththesevalues.Thedataoftheloadcellin
thiscalculationexampleshouldbeasfollows:
Referencevoltage:5V
Nominalcharacteristicvalue:2.12mV/V
Zeroerror:0.046mV/V
FirstofalltherealnominalcharacteristicvaluecanbeenteredintheRatedOutput(Cn)fieldandthezeroerrorintheZero
Balancefield.Anotherpossibilitytocompensatethezeroerroristoemploytheuserscaling.Theassociatedvaluemustbe
enteredintheUserScaleOffsetfield.Thefollowingcalculationsmustbeperformedinordertoobtainthevaluethatbalances
thezeroerrorfromthisexample:
Thefollowingmaximumdifferentialvoltageresultsfromfullyloadingtheloadcell:

Therawvalueofthemeasuringsignalat20mV/Vis2147483647.Hence,themaximumrawvaluethatcanbeachievedwitha
measuringsignalof10.6mVis:

Fromthis,therawvalueofthezeroerrorbecomes:

Inordertocompensatethiserror,thezeropointmustbeshifteddownwardsbypreciselythisvaluehence,24696063must
beenteredintheUserScaleOffsetfield.
VisualizationRGB
AsmallexampleofRGBcoloreditingisopenedbyclickingontheShowRGBbutton.Thecolorinwhichthetextfieldwiththe
instructionsappearsisdynamicallycomposedofthebasiccolorsred,greenandblue.Thevaluesofthesethreecolorsare

showninthiswindow,asisthecombinedvalueofallthreecolors.Thered,greenandbluecomponentscanbeadaptedusing
theregulatorsandthecombinedcolorappearsinthelowestfield.

Fig.34:RGBwindow
Functionsusedintheprogram
Checkboundsfunction
TheCheckboundsfunctionisusedintheprogrambywayofexample.Ifanoverrangeoccurswhenaccessingoneofthe
arraysused,thelowestorhighestpositionofthearrayisthenautomaticallyaccessed.Inordertodrawtheusersattentionto
thisoverrangeevent,theADSLOGDINTfunctionisadditionallyusedtooutputamessagetotheeventlog.Intheeventof
exceedingtherangeofoneofthearraysused,thefunctionwritesanentryinthesystemseventlog(fig.35).

Fig.35:TwinCATeventlogafterunderrangeevent
CheckDivReal'function
TheCheckDivRealfunctionisusedintheprogrambywayofexample.Thisfunctionautomaticallycheckstheentireprogram
forimpermissibledivisionsbyzero.Ifthisisthecase,amessageiswrittenintheeventlogoftheTwinCATsystemmanager
(fig.36).

Fig.36:TwinCATeventlogincaseofdivisionby0
TwinCATScopeView2demonstration
Below,weshowwiththeaidoftheTwinCATScopeView2programhowachangeoftheCoEparameterFilterSettings
affectsthefunctionoftheEL3351.Thevalueofthisparameterdeterminestheconversiontimeoftheterminal.Duetoanentry
intheStartupList,thedefaultsettingoftheexampleprogramis100Hz,correspondingtoaconversiontimeof42ms.

Fig.37:TwinCATStartupList
Theloadingweight(red),thetogglebit(green)andtheworkingcounter(blue)areobserved.Theloadcellisloadedtwiceby
droppingacoinontoit.FromthebeginningoftherecordingtopointBtheconversiontimeis42ms.Thefirstdroppingofthe
cointakesplaceatpointA.Duetothelowfilterconstant,theactualloadcurveisrecordedonlyverysuperficially.AtpointB
thefilterisadjustedto2000Hz,correspondingtoaconversiontimeof4ms.Theapprox.10timesmorefrequentfallingand
risingedgeofthetogglebitcanclearlybeseen.TheseconddroppingofthecointakesplaceatpointC.Theeffectofthefilter
settingonthedeflectionoftheloadisclearlyvisible.Duetothehigherconversiontimetheloadexertedontheloadcellis
measuredapprox.10timesmorefrequently,asaresultofwhichtheloadcurveisrecordedwithconsiderablygreater
precision.AtpointDcommunicationwiththeterminalisinterrupted,asaresultofwhichthevalueoftheworkingcounter
jumpsfrom0(validrealtimecommunication)to1(invalidrealtimecommunication).

Fig.38:ScopeView2Record

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