SYS TEC 可編程控制器 工程實(shí)例參考(中文)_第1頁
SYS TEC 可編程控制器 工程實(shí)例參考(中文)_第2頁
SYS TEC 可編程控制器 工程實(shí)例參考(中文)_第3頁
SYS TEC 可編程控制器 工程實(shí)例參考(中文)_第4頁
SYS TEC 可編程控制器 工程實(shí)例參考(中文)_第5頁
已閱讀5頁,還剩39頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

GetintouchwithSYSTECmodules!

Allstepsdiscussedwithinthisworkshoparepracticalappliedusingtheexampleapplicationdescribedhereafter.

What’sthetask?

Firstfindoutalltechnicalandcommercialdetailsabouttheapplication…Getadescriptionorschemeaboutwhat’storealize.

· Whatarethemostimportantrequirements?Anysideconditionstoconsider?oSafetyrequirements

oSpecialIO

oRemoteaccess

oEnvironmentalconditionsoTimingissues

oAnyinteractionwithanexistingconfiguration

· Whereistheapplicationused?Howmanysystemsaregoingtobeinstalled?Anypricingissues?

· Howexperiencedisyourcustomer?

· Finally–Doesadistributedautomationsolutionmakesenseforthisapplicationscenario?

Example:

Thechallengeistoimplementasimplebow-shapedtrafficlightapplication.Thetrafficlightshallbringaregulationtoensurepedestrianstocrossthestreetsafely.Forcarsonstreettrafficisregulatedbyusingtwoblocksofindicator-lights.Forpedestriansaseparateindicatorblockisconsideredforeachsideofthestreet.Toreducedeadwaitingcyclesforcarsarequestbuttonforpedestrianshastobeimplementedonbothsidesofthestreet.AnIEC61131PLCissuggestedtoachievealowskill-levelnecessaryforprogrammingandmaintenance.Alocalserviceinterfacehastobeprovided.Additionally,aninterfaceforremoteservicingandcontrolisrequired.

Figure1:Applicationoverview

LastsavedbyArminvonCollrepponWednesday,June16,2004Page1of41

Makeanabstractofthewholeapplicationbyusingschematicdrawings.Thishelpstogetanideawhat’sactuallyneededtofindasolution.Asfaraspossibleallsideconditionsshouldbederivablefromthesedrawings.

Themainissueinthisexampleisthefardistancethathastobeovercome.

Thetypicallyusedcentralizedautomationsolutionwillleadtoahugeoverheadincabling.EverythingisdonecentralizedonthePLC.ManylocalIOsarenecessaryaswellasextensiongatewaymodulesforthatparticularsystem.

Finallythissolutionwillturnoutasmostinflexibleandpossiblymoreexpensive.Futureexpansionwillbeexpensivebecauseofcablingstructure.

Figure2:Centralizedautomationsolution

LastsavedbyArminvonCollrepponWednesday,June16,2004Page2of41

AlternativelyasolutionwithdistributedIOsbasedonaninexpensiveandopenfieldbussystemlikeCANopenissuggested.

Thissolutionbringstheadvantageof:

· Reducedcablingefforts(noroad-constructionneeded)· Separationofthetargetapplicationinfunctionalgroups· Aconfigurablefailurebehavioranddiagnosticfeatures

· SupportforCANopenmodulesprovidedbydifferentmanufacturers· Abettermodularityandflexibility

Figure3:DistributedAutomationsolution

Notimecriticalorsafetyrelevantpartsrequired.Thedistributedsolutionseemstobebestsuitableforthisapplication.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page3of41

Definetheprocess!

CANopenoffersthepossibilitytodefinesymbolicnamesforallprocessdata.Usingthisfeatureenablesyoutomakeanabstractpictureoftheapplicationprocessthatiscompletelydecoupledfromlocalissuesaspositions,distancesanddimensions.

Nextistofindoutwhatprocessdataareimportantandhavetobeaccessedfromwithinthecontrolprogram.

FunctionalGroup

1

2

3

4

5

6

7

8

9

Add-on

FunctionalDescription

Upperindicatorlightsforcars,leftside

Lowerindicatorlightsforcars,leftside

Indicatorlightsforpedestrian,leftside

Requestbuttonforpedestrian,rightside

Controlunit(PLC)

Upperindicatorlightsforcars,rightside

Lowerindicatorlightsforcars,rightside

Indicatorlightsforpedestrian,rightside

Requestbuttonforpedestrian,rightside

USBgatewayforlocalaccessEthernetgatewayforremote

access

MandatoryI/Oconfiguration

3DO

3DO

2DO

1DI

None

3DO

3DO

2DO

1DI

None

OptionalI/Oconfiguration

3DIfordiagnosticpurpose

3DIfordiagnosticpurpose

2DIfordiagnosticpurpose

2DOforsummerandindicatorlight

3DIfordiagnosticpurpose

3DIfordiagnosticpurpose

2DIfordiagnosticpurpose

2DOforsummer

andindicatorlight

Table1:Descriptionoffunctionalgroups

Nowtheapplicationisdescribedwehavetodefinesymbolicnames(usedfornetworkvariables)forallprocessdataweneed.IfapplicableitisusefultocombineallIOofeachgroupintoonesingledatatype.

FunctionalGroup

1

2

3

4

6

7

8

9

ProcessIODescription

Gr01_DO_IndicatorsGr01_DI_DiagGr02_DO_IndicatorsGr02_DI_DiagGr03_DO_IndicatorsGr03_DI_DiagGr04_DI_ReqBtnGr04_DO_IndicatorsGr06_DO_IndicatorsGr06_DI_DiagGr07_DO_IndicatorsGr07_DI_DiagGr08_DO_IndicatorsGr08_DI_DiagGr09_DO_Indicators

Gr09_DI_ReqBtn

Datatype

OutputInputOutputInputOutputInput

Input(local)Output(local)OutputInputOutputInputOutputInputOutput

Input

Datasize

BYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTEBYTE

BYTE

Table2:DefinitionofNetworkVariablesforprocessdata

LastsavedbyArminvonCollrepponWednesday,June16,2004Page4of41

AllsingleelementsofeachgroupareaccessibleviaBITWISEoperationsappliedtothevariable.Tosetorunsetaremotedigitaloutputjustsetorunsettherightbitofthecorrespondingnetworkvariable.

Nowthattheapplicationisdescribedandsymbolicnamesforallprocessdataaredefineditstimetohavealookatthemodulesneeded.

Choosetherightmodules!

SYSTECoffersavarietyofgenericIOmodulesforCANopennetworks.StartingfromtinysubassembliesthatcanbeuseddeeplyembeddedinmanyOEMapplications–uptohigh-classoff-shelfdeviceswithindustryprovenIOs.Tofindtherightmodulemainlydependsonwhatcustomerdemands.

InthisexampletheCANopenIO-C12andthePLCmodule-C14areused.Usingoff-shelfunitsbringsyouahead-stepindeploymenttime.Youonlyneedtointegrateandconfigurethemoduleswithoutanydevelopmentefforts.

AnotherinterestingoptionmightbetheusageofCANopen-Chiphere.Directlyintegratedintotheelectronicoftheindicatorsub-unitnoexternalmodulesareneeded.Inpracticeitdependsonwhatlevelyoustart(i.e.developmentorsystemintegration)andwhatpartsareavailableonthemarketalready.

AsuggestionisshowninFigure3onpage3.TheremoteIOmodulesCANopenIO-C12areusedtointerfacetheindicatorblocksandbuttons.ThecontrolunitwillbeaPLCmodule-C14.AsshowninFigure3onerequestbutton(Group4)isconnectedtolocalDIOofthePLC.Theotherrequestbutton(Group9)isconnectedtoaCANopenIO-C12module.

ToreducethenumberofdevicesandnetworkvariablesitispossibletocombineIOsfrommultiplegroupsandassignthemtooneCANopendevice.However,thishighlydependsontherequiredIOconfiguration,localconditionsandtheIOmodulesavailable.

BeawarethattheconfigurationshowninFigure3isanexamplefordemonstrationonly.Itdoesnotrepresentthebestpossiblesolution.

ThegatewaysforserviceandremoteaccessareautonomousdevicesconnectedtotheCANbussomewherewithinthesystem.

TheUSB-CANmoduleandCAN-EthernetGatewayfromSYSTECarecosteffectivesolutionstoprovideinstantaccesstotheCANbusviaUSBorEthernetfeaturingtheprotocol-independenttransmissionofCANmessages.ThusthebothmodulescanbeusedwithvarioushigherlayerCANprotocols(suchasCANopen,SDS,J1939,DeviceNetorotherproprietaryprotocols).

FortheconfigurationshowninFigure3thefollowingmodulesareused:

FunctionalGroup1o2/3/4/56

7/8/9ETH

USB

Module NodeID

CANopen-C12(optional) 45hCANopen-C12 43hPLCmodule-C14 20hCANopen-C12(optional) 44hCANopen-C12 42hCAN-EthernetGateway-USB-CANmodul-

Table3:Moduleconfiguration

Oncethemoduleconfigurationisfixed,theCANopennetworkcanbesetup.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page5of41

Configurethenetwork!

AveryeasywaytoconfigureevencomplexCANopennetworksisprovidedbyProCANopen.Usetheadvantagesofagraphicaldesigntooltogetbetterresultsinshortertime.

WhenexecutedProCANopenstartswithanemptyproject.

Figure4:ProCANopenStartScreen

NowaddemptynodestoyourprojectaccordingtomoduleconfigurationshowninTable3.Tomakeclearthestructurethedevicesforbothsidesarecombinedinseparatedgroups.TheUSB-CANmodulandCAN-EthernetGatewayareautonomousandprotocolindependentworkingdevices.ThusnoCANopenconfigurationisrequiredforthesemodules.

Figure5:ProjectStructurewithemptynodes

StarttoconfiguretheemptynodesusingtheElectronicDataSheetlibrary.Double-clickanodesymboltoentertheconfigurationdialogshowninFigure6.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page6of41

Figure6:Nodeconfigurationdialog

FirstenterasymbolicdevicenameandthenodeIDtakenforthisdevicefromTable3onpage4.Thenclickonthebutton“DeviceType”toassignanEDSforthisnode.ShowstheEDSlibrary.

Figure7:EDSlibrary

LastsavedbyArminvonCollrepponWednesday,June16,2004Page7of41

FortheCANopenIO-C12moduleselectthephyPS-409Y.edsentryandclicktheOKbutton.ForthePLCmodule-C14twoEDSareapplicable.ThedifferencebetweenthetwoEDSfilesarethenumberofsupportedPDOs.

Forthisexampletheconfigurationdialogshouldbeasfollowing:

Figure8:NodeconfigurationforCANopenIO-C12

LastsavedbyArminvonCollrepponWednesday,June16,2004Page8of41

Figure9:NodeconfigurationforPLCmodule-C14

Whenallnodesgotconfigured,theprojecttreeshouldlookasshowninFigure10.

Figure10:Completeprojectconfiguration

ATTENTION!

Don’tforgettosavetheprojectforfurtheruse.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page9of41

NowthedefinedsymbolicnamesinTable2needstobesetupforuseasnetworkvariables.ProCANopenmakesthisjobeasy.Selectthenodethatyouwanttoconnectandright-clickthesymbol.SelecttheentryGraphicconnectionasshowninFigure11.

Figure11:Notesetupdialog

Thenyouhavetoselectthenodetowhichtheconnectionsshouldbeset.ThiscanbeaCANopenIO-ModuleorthePLC.Thenthewindowforgraphicalconnectionsetupappears.

Figure12:DialogwindowforGraphicalConnectionsetup

Figure12showstheDialogwindowforgraphicalconnectionsbetweentheCANopenIO-C12andthePLCmodule-C14.AsyoucanseethespaceforIOsonthePLCsideisempty.Nonetworkvariableshavebeendefinedyet.OntheleftsideallpossibleIOsfortheCANopen-C12arelisted.ThearrowsindicatetheIOtype(in/out).

TosetupanewnetworkvariableclickonaIOentryfromtheCANopenIO-C12boxandclickontheNewbuttonnext.Adialogboxwillappearwhichletsyoudefinethenameforthenetworkvariable.ChoosethenamegiveninTable2.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page10of41

ClicktheOKbuttontodefinethenetworkvariable.AlsorefertoFigure13.

Figure13:Networkvariabledefinition

RepeatthisstepuntilallnetworkvariablesfromTable2aredefined.

InFigure14alldefinednetworkvariablesarelistedonthePLCside.AdditionallytheconnectionsbetweentheGroup8/9(Requestbuttonandindicators)andthePLCaredisplayed.

Figure14:Allnetworkvariabledefinitions

AtthispointtheconfigurationforyourCANopennetworkisfinished.Nowyoucansavethenetworkconfigurationtothemodulesbyselecting“Storeinnetwork”frommenuentryNetwork.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page11of41

Figure15:Storetonetwork

Makesureallcheck-buttonsaresetasshowninFigure16andclickonOKbuttontobegindownload.

Figure16:StoreConfigurationdialog

LastsavedbyArminvonCollrepponWednesday,June16,2004Page12of41

Getreallystarted!

BeforetheCANopennetworkconfigurationcanbestoredtothenetworkallmoduleshavetobeconnectedandsetupwiththevalidnodeaddressandCANbusbit-rate.PleaserefertothecorrespondingSystemManualsfortheCANopenIO-C12andPLCmodule-C14formoreinformation.

AttimeofdeliveryallboardontheSYSTECdemoboardsetuptostartimmediately.

TogetthisexamplerunningtheconfigurationneedstobedownloadedtothedemoboardprovidedbySYSTEC.Figure17showsthewayallmodulesareconnected.Youcanfindthetechnicalfact-sheetfortheIO-BoxinAppendixonpage41

ThewholesystemappearsasonelogicalCANnetwork.However,physicallytwogalvanicisolatedCANbussesareconnectedthroughthetwoCAN-EthernetGateways.

UsetheUSB-CANmodultoaccesstheCANbussystemfromanylocalhostPC.ThustheCAN-EthernetGatewaysareconnectedtroughanEthernethub,allyouneedtodoisconnectingyournetworktooneofthefreeportstoenableremoteaccessviaEthernet.

Figure17:SchematicoftheSYSTECdemoboard

TodownloadtheCANopenconfigurationtothedemoboardconnectaPCtotheUSB-CANmodulusingtheUSBcableprovided.Ifnecessarythedriverinstallationisstartedbythedevicemanager.

DownloadtheCANopennetworkconfigurationasdescribedabove.ThewarningofmissingSDO-servercanbeacknowledgedbyclickingtheOKbuttonsafely.

DuetospacelimitationsthedemoboarddoesnotincludetheCANopenIOmodulesforGroup1andGroup6.Thusthemessageoutputwindowofthe“Storetonetwork”dialogwindow(seeFigure16)willcontainerrormessagesindicatingthatthesenodescouldn’tbefound.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page13of41

Writethecontrolapplication!

AtthispointallCANopennodesareconfiguredandthenecessarynetworkvariablesaredefined.

NowtheIEC61131programhastobewritten–StarttheOpenPCSprogramandcreateanewemptyproject(File->Project->New).

MoredetailedinformationonhowtostartwithOpenPCScanbefoundontheOpenPCSQuickStartmanual.

Figure18:CreateanewProjectdialog

Assignanameforthisprojectandselectadestinationfolder,whereallfilesshallbestored.

Figure19:EmptyOpenPCSproject

LastsavedbyArminvonCollrepponWednesday,June16,2004Page14of41

Beforewestarttowritecodesometheoreticalstufftounderstandthegivenexamplecode.

Thetrafficlightapplicationshallfollowthefollowingscheme:

Init

TimerYellowbecomesTrue

Green

Yellow

StartTimerRedYellowSetYellowindicatorforcars

TimerRedYellowbecomestrue

CheckrequestbuttonsSettimerYellowifabuttowaspressedandsetWaitIndicator

TimerRedYellowbecomestrue

TimerRedbecomestrueand

pedestriansindicatorissettoRed

RedYellow

Red

StartTimerRed

SetRedindicatorforcarsSetgreenindicatorforpedestrians

SetRedindicatorforped

TimerRed afterfirsttimerevent

becomestrueandpedestriansindicatorisNOTsettoRed

StartTimerRedYellow

SetYellowindicatorforcaSetRedindicatorforpedestrians

Figure20:Trafficlightapplicationstatemachine

Thereisoneinitialstateandfouroperationalstatesthatcorrespondtotheindicatorphasesofatrafficlight.Thestateswitchesarecompletelycontrolledbytimertransitions.IEC61131offersvariousprogramminglanguagestoimplementtheapplication.Toachieve

highestefficiencyitispossibletouseallprogramminglanguageswithinoneproject.Soyoucanchoosethemostsuitablelanguageforeveryparticularpartofyourapplication.

Forexampleitisveryconvenienttoimplementthestate-machinestructureinSFC(SequentialFunctionChart).BecauseSFCisbasedonStepsandTransitionsyouonlyhavetoimplementthecodeforthesinglestepsandtodefinethetransitions.YoucandesignthelogicalstructureintheSFCeditorveryeasily.Thiscombinationsavesalotofprogrammingoverheadbecauseyouonlyneedtofocusonyouractualapplication.

TogiveyouanexamplethetrafficlightdemowasimplementedinSFCandST(StructuredText).Forbothpartsthevariabledeclarationisnearlythesame.Thebigsavingsintimecomewiththecodingstyle.WhileinStructuredTexttheapplicationstatemachineandthebasicfunctionalityhastobeimplementedbytheprogrammer,inSFCthisisdonebyconnectingblocksforstepsandtransitions.ThecodearoundtheSFCgraphisgeneratedbyOpenPCS.

SetupanCANopenconnectiontothePLC

BeforewestarttowritecodeConnectionhastobesetupforCANopencommunicationtothePLC.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page15of41

ThereforechooseentryConnectionsfromPLCmenu.

TheConnectionSetupdialogappears(Figure21).

Figure21:ConnectionSetupdialog

ClickonNewtocreateanewconnectiontoyourPLC.Thedialogwindow“EditConnection”appears(Figure22).Assignanewuniquenameforthisconnection.TheexamplegiveninFigure22usesthePLCnodeIDandCANbusbitratetoformtheconnectionname.ThisisusefulifmorethanonePLCislocatedinyourCANnetwork.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page16of41

Figure22:Editconnectiondialog

Nextselectadriverforthisconnection.FroSYSTECPLCsusethestandarddriverasshowninFigure23.ClickonOKtoconfirmtheselecteddriver.

Figure23:Selectdriverdialog

NextthenetworksettingsforCANopenhavetobeconfigured.ClickonsettingstoopentheConnectionconfigurationdialog.ChooseCANopenasnetworkprotocolandclickonthebuttonGlobalSettings.ThenetworkconfigurationdialogfortheCANopenprotocolappears.SelecttheCANbusinterfaceused(USB-CANmodulforthedemoapplication).IfmorethanoneUSB-CANmodulisconnectedtoyourPCentertheUSBdeviceIDforthemoduletouse.FinallycheckwhethertherightCANbusbaudrateisset.ConfirmyourchangesbyclickingOK.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page17of41

Figure24:CANopennetworkconfiguration

LastbutnotleasttheCANopennodeIDforyourPLChastobeset.ClickonbuttonSelectNodetoopenthefollowingdialog.EntertherightNodeaddress(thedefaultaddressof0x20hisfineforthedemoapplication).TheotherConnectionSettingsarereservedforspecialPLCtypesforcustomerextensions.Thesesettingsmustnotbechanged!

Figure25:SelectCANopentargetNodedialog

ClickonOKandclosetheConnectionSetup.Thenewconnectionisnowavailable.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page18of41

WritingtheStructuredTextDemo-Application

Addanewfiletoyourprojecttostartwithimplementation.TostartwithStructuredTextselectSTicononprogramtabsheet,assignafilenameandclickOK.

Figure26:CreateanewFiledialog

AnewPOU(ProgramOrganizationUnit)forSTisaddedtoyouremptyproject.

Nowyoucanstarttoenterthecode.Firstbegintodefinethevariablesneeded.ThenetworkvariableshavetobedefinedinVAR_EXTERNALsection.ToenablethelinkertoresolvethevariablesyouneedtoassigntherightDCFfileforthisPLC.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page19of41

OpenresourcepropertiesfromPLCmenuandselecttherightPCLtype,connectionundDCFfile.

TheDCFfileisgeneratedbyProCANopenandcanbefoundinthecorrespondingProCANopenProjectfolder.Toeasy-upfindingtherightDCFfiletheycontaintheCANopennodeIDindecimalforthedevicetheydescribe.ForthedemoapplicationthePCLdecimalnodeIDis32.FurthermoreselecttheOptimizationmethod:Sizeonly.Thisproducesverysliminterpretercodewhichisonlinedebuggable.ForreleaseselectoptimizationSpeedonlytoproduceveryfastandefficientNativecode.

ForamoredetailedintroductiontonetworkvariablesandtheSYSTECCANopenfunctionalitypleasereadtheSYSTECManualL-1008e–CANopenExtensionforIEC61131.

Noweverythingissetuptoimplementyourapplicationcode.

Note

YoualsocanfindthecompleteIEC61131-3codefortheStructuredTextdemoinAppendix1onpage29.

Todeploy,testanddebugyourcodeyouhavetoassignittoaResourceonthePLC.EveryresourceistobeunderstoodasaseparatePLCunit.EveryresourcecanhandlemultiplePLCprograms/tasksinvariousTaskTypes(cyclic,timer,interrupt-driven).ThisgivesyoutheadvantageofrunningmultitaskingapplicationsonSYSTECPLCs.Youcandefinemultipleresourcesforoneproject(choosefromOthers-tabsheetinFile->Newdialog)butonlyonecanbesetactive.Whenanewresourceisdefined,theconnectionandPLCtypehastobeconfiguresintheResourceconfigurationdialog.

However,definingmultipleresourcesallowsverycomfortableprojectmanagementformanydifferentPLCs.YoucanreusecodeandPLCprogramsbylinkingthePOUtomultipleresources.

Figure27showstheonlinedebugwindowsofthedemoprojectwithtworesourcesassigned.WhileoneresourceholdstheSTdemoapplicationtheotherholdstheSFCdemo.Forbothresourcesthesameconnectionisused.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page20of41

Figure27:Demoapplicationprojectwithmultipleresources

ThePLCprogramneedstogetcompiledbeforeitisdownloadedtothePLC.Clickontherebuildbuttonorselectentry“BuildactiveResource”fromthePLCmenu.Theoutputwindowshowsthecompilerandlinkeroutput.

AfterthePLCprogramwascompliedsuccessfullyyoucangoonlinetothePLCtodownloadtheresource.OpenPCSrecognizeswhetherthePLCprogramonPCandonthePLCdiffers.IfsoaConfirmationdialogappearstoconfirmthedownloadandoverwritingtheoldprogram.

OncetheprogramisdownloadedtothePLCyoucanusethetoolbarbuttonsshownbelowtocontroltheprogram.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page21of41

WritingthesequentialFunctionChartDemo-Application

AddanewSFCfiletoyourexistingproject.SelecttheSCFiconfromtheprogramtabsheetinthenewfiledialogwindow.AssignafilenameandclickOK.

Note

YoualsocanfindthecompleteIEC61131-3codefortheSFCdemoinAppendix2onpage33.FindtheSFCgraphforthetrafficlightapplicationonpage39.

Figure28:CreateanewSFCfile

ThenewSFCfileisaddedtoyourprojectandlooksasfollowing:

LastsavedbyArminvonCollrepponWednesday,June16,2004Page22of41

YoucansafelytakethevariabledefinitionfromthestructuredTextdemoapplication.AsingleStep-Transitionrelationisgiven.Theinitialstepismandatoryandholdsallinstructionstoinitializeyourapplication.GotomenuInserttoaddadditionalstepsandtransitionsaswellasjumpstothegraph.OpenPCStakescareoftheSFCconsistencyoftheblocksadded.Tofillthestepsandtransitionswithcodejustdouble-clickontheitemtochange.AllcodehastobeinsertedasILcode(InstructionList).TheusageofILallowsforaveryefficientcodedesign.

OfcoursealsomorecomplexcodewritteninSTispossible.ThereforeitisthebestwaytobuildseparatefunctionsandinterfacethesefunctionsviaILfromwithintheSFCblocks.Thisalsoincreasesmodularity,readabilityandreusabilityofcode.

Whentheprojectissavedorsyntaxischecked,OpenPCStransformsallcodenotwritteninILtoanIL-basedfileformat.ThismakesitpossibletoextracttheILforcomplexcodefromthisintermediatefiles.Thefileextensionforthesefilesis*.poe.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page23of41

Debugyourapplication

OpenPCSfeaturesaverycomfortableonlinedebuggerinterfaceincluding· Breakpoints

· Single-stepandSingle-cycleexecution· Variablewatching,settingandforcing

·Program-flowforgraphicalprogramminglanguages·FullyintegratedOfflineSimulatorforSYSTECPLCs

Seeallvariablesandfunctionblocksforthecurrentresource

Seeyour

Variabledefinitions

Keepaneyeonyourprogramflowinreal-time

Addvariablestoyourwatchlist

Figure29:OpenPCSonlinedebuggingfeatures

Toeditthevalueofavariableclickonthevariablelocatedinsourcewindoworonthewatch-list.Toaddavariabletothewatch-listdouble-clickthevariableontheresourcebrowser.

TheSYSTECOfflineSimulatorprovidesthesamefunctionsasarealPLC.OnlyCANopencommunicationisnotenabled.However,itispossibletocompileandrunaPLCprogramthatcontainsnetworkvariables.

Figure30:TheSYSTECOfflineSimulator

LastsavedbyArminvonCollrepponWednesday,June16,2004Page24of41

Getdeeplyembedded-LowLeveldebuggingonCANbus

Toseewhat’supontheCANbusyoucanusethePCANExplorertool.ThisprogramprovidesverycomfortablefunctionstotraceandlogCANmessages.ItworkswithvariousCANhardwareincludingSYSTEC’sUSB-CANmodulandCAN-EthernetGateway.YoucanalsosendCANmessagesinvariouswaysincludingcyclicrepeatedtransmissionsandremoteframes.

EspeciallyifyoushouldencounterproblemsontheCANbusoraCANnodeisnotrespondingthePCANExplorerisavaluabletoolfordiagnostics.

Figure31:PCANExplorer3

ThefollowinglistingshowsthetrafficlightapplicationfromCANbuspointofview(shortened).ToexplaintheCANmessagescommentboxeswereadded.Allvaluesthatchangearehighlightedandcolorized.

LastsavedbyArminvonCollrepponWednesday,June16,2004Page25of41

;D:\Projekte\Traffic_Light_Demo\CANopen\PCAN_Traces\20040612_2204.log;

;Starttime:12.06.200422:02:22.859;PCAN-Net:ETHC_192_168_010_231

;

;Columnsdescription:;~~~~~~~~~~~~~~~~~~~~;+-Messagenumber

;| +-Time(absolute)

;| | +-Typeofevent ReqBtnpressedon;| | | +-MessageID(hex) Group9

;| | | | +-Lengthofmessage

;| | | | |+-Messagedata(hex)

Group9

;| | | | || ReqBtnreleasedon

;++--+--++-+--------------222:02:23.4793Rx 298 40001605F

322:02:23.6512Rx 298 40000E05F

indicatorfor

pedestrians

522:02:23.7137Rx 297 5040900605F PLCsetsWAIT

622:02:23.7294Rx 296 109

722:02:23.8074Rx 297 5040900E05F1822:02:28.7917Rx 297 5020900E05F3622:02:36.8697Rx 297 5010400E05F

3722:02:36.8853Rx 296 104 PLCsetsYELLOW

7022:02:51.9319Rx 297 5010100E05F indicatorforcars

7122:02:51.9476Rx 296 101

10022:03:05.1504Rx 297 5040100E05F

PLCsetsREDindicatorforcarsandGREENforpedestrians

PLCsetsREDforpedestrians

PLCsetsGREENindicatorforcars

LastsavedbyArminvonCollrepponWednesday,June16,2004Page26of41

SetuptheOPCinterface

OneofthefeaturesofOpenPCSisanintegratedOPCserverinterfacetoenableconnectionfromanyOPCapplication.TheOPCserverusestheOnlineServerofOpenPCSt

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論