+ All Categories
Home > Documents > RBucher_ScilabTec

RBucher_ScilabTec

Date post: 16-Aug-2015
Category:
Upload: rizkie-denny-pratama
View: 215 times
Download: 3 times
Share this document with a friend
Description:
Scilab
50
Rapid Controller Prototyping Linux RTAI Scicos Implementation Examples Conclusions Targeting the Scicos Codegenerator for embedded applications Ing. Roberto Bucher Scuola Universitaria Professionale della Svizzera Italiana (SUPSI) Paris - 1.7.2009
Transcript

RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsTargetingtheScicosCodegeneratorforembeddedapplicationsIng. RobertoBucherScuolaUniversitariaProfessionaledellaSvizzeraItaliana(SUPSI)Paris-1.7.2009RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsObjectives(PricesinEuro) Commercial ProposedControldesignenvironment solutionCoreSW 1950.- 0.-ControlSW 1000.- 0.-GraphicalGUI 3000.- 0.-Codegenerator 7500.- 0.-RTtarget 3000.- 0.-RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsObjectivesRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsOutline1RapidControllerPrototyping2LinuxRTAI3Scilab/ScicosandLinuxRTAI4Implementation5Examples6ConclusionsRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsIntroductionControlDesignLoopspecificationmodellingidentificationcontroldesignsimulationimplementationverificationRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsIntroductionRapidControllerPrototyping-Requirements2maincomponents1AnOSwithhardreal-timefeatures2AComputerAidedControlSystemDesignenvironmentincludingacodegeneratorLinuxRTAI+RTAI-Lab+Scilab/ScicosRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBasicsTheLinuxRTAIprojectHardreal-timeextensiontotheLinuxOSBasedontheADEOSpipeline(withsomeimprovements!)FreeOpenSourceSoftware(FOSS)Implementationofhardreal-timecontrollersusinggeneralpurposehardwareSamePCforthecontrollerdesign,thehardreal-timecontrollertaskandthesoftreal-timemonitortaskHardreal-timeinkernelanduserspaceDistributedcontrolthroughthenetrpcmoduleRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBasicsLinuxRTAI-FeaturesLatency: < 10sdependingontheHWTypicalsamplingfrequencies: 1 . . . 10kHzRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsRTAI-LabTheGUIapplication-xrtailabRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsRTAI-LabTheGUIapplication-xrtailabPCwithHRTtaskandxrtailabPCwithHRTtask PCwithxrtailabNetworkUDP/IPRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsRTAI-LabTheGUIapplication-xrtailabPCwithHRTtaskandxrtailabPCwithHRTtask PCwithxrtailabNetworkUDP/IPRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsRTAIexample1SystemscontrolledwithLinuxRTAIhttp://www.inrialpes.fr/sedCycab(INRIA)BipedRobot(INRIA)RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsRTAIexample2NationalRadioAstronomyObservatorycontrolledwithLinuxRTAI-WestVirginiahttp://www.gb.nrao.edu/43m/RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsAdd-onsAdd-onsforScilab/ScicosThelinkbetweenScilab/ScicosandLinuxRTAIisimplementedthrough:Acodegenerator RTAICodeGen.sci.Artmain.c(mainleforthereal-timetask)specicfortheScilab/Scicosenvironment.AnexternaltemplateMakeleAnewscicospaletteRTAI-Lib.cosf.Macrosforthenewblocks(Scicosinterfacefunctions).ARTAIlibraryspecicforthenewScicosblocks(Scicosimplementationfunctions).RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorRTAICodeGen.sciThecodegeneratorusedinRTAIisamodicationofthestandardScicoscodegeneratorOnlystand-alonegenerationwithspecicmainprocedure(rtmain.c)SensorsandactuatorsareintegratedintheScicosblockdiagramasspeciccustomperipheralblocksEachblockcanbeidentiedbyanamewhichisthenreferredinRTAI-LabRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegenerationSine SineSCOPEScopeSCOPEScopecomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI D/Acomedi0 CH0COMEDI D/ADesignSuperblockRTAICodegen.sciCodeCompilingandLinkrtmain.c libsciblk.a ScilablibHardreal-timestand-aloneexecutableRTexecRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegenerationSine SineSCOPEScopeSCOPEScopecomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI D/Acomedi0 CH0COMEDI D/ADesignSuperblockRTAICodegen.sciCodeCompilingandLinkrtmain.c libsciblk.a ScilablibHardreal-timestand-aloneexecutableRTexecRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegenerationSine SineSCOPEScopeSCOPEScopecomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI D/Acomedi0 CH0COMEDI D/ADesignSuperblockRTAICodegen.sciCodeCompilingandLinkrtmain.c libsciblk.a ScilablibHardreal-timestand-aloneexecutableRTexecRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegenerationSine SineSCOPEScopeSCOPEScopecomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI D/Acomedi0 CH0COMEDI D/ADesignSuperblockRTAICodegen.sciCodeCompilingandLinkrtmain.c libsciblk.a ScilablibHardreal-timestand-aloneexecutableRTexecRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegenerationSine SineSCOPEScopeSCOPEScopecomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI D/Acomedi0 CH0COMEDI D/ADesignSuperblockRTAICodegen.sciCodeCompilingandLinkrtmain.c libsciblk.a ScilablibHardreal-timestand-aloneexecutableRTexecRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegeneration-DetailsSuperblockrtai.genstandalone.cmd rtai.makmodel.c model Cblocks.c MakeleRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegeneration-DetailsSuperblockrtai.genstandalone.cmd rtai.makmodel.c model Cblocks.c MakeleRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegeneration-DetailsSuperblockrtai.genstandalone.cmd rtai.makmodel.c model Cblocks.c MakeleRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorCodegeneration-DetailsSuperblockrtai.genstandalone.cmd rtai.makmodel.c model Cblocks.c MakeleRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorTargetspecicles-Thegenlertai.makstandalone.cmdRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorTargetspecicles-Thecmdle[CCode,FCode]=gen_blocks()[Code,Code_common]=make_standalone42();files=write_code(Code,CCode,FCode,Code_common);Makename=rt_gen_make(rdnom,files,archname);ok=compile_standalone();RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThecodegeneratorTargetspecicles-Themakleall: ../$$MODEL$$...CC = gccCC_OPTIONS = -O -DNDEBUG -Dlinux -DNARROWPROTO -D_GNU_SOURCEMODEL = $$MODEL$$OBJSSTAN = rtmain.o common.o $$MODEL$$.o $$OBJ$$SCILIBS = $(SCIDIR)/libs/scicos.a $(SCIDIR)/libs/poly.a $(SCIDIR)/libs/calelm.a$(SCIDIR)/libs/blas.a $(SCIDIR)/libs/lapack.a $(SCIDIR)/libs/os_specific.aOTHERLIBS =ULIBRARY = $(RTAIDIR)/lib/libsciblk.a $(RTAIDIR)/lib/liblxrt.aCFLAGS = $(CC_OPTIONS) -O2 -I$(SCIDIR)/routines -I$(SCIDIR)/routines/scicos $(C_FLAGS) -DMODEL=$(MODEL) -DMODELN=$(MODEL).crtmain.c: $(RTAIDIR)/share/rtai/scicos/rtmain.c $(MODEL).ccp $< .../$$MODEL$$: $(OBJSSTAN) $(ULIBRARY)gcc -static -o $@ $(OBJSSTAN) $(SCILIBS) $(ULIBRARY) -lpthread $(COMEDILIB) -lm@echo "### Created executable: $(MODEL) ###"RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsScicosblocksThenewScicospaletteSineSquareSteptest.datextdataSENSSENSORSCOPEScopeMETERMeterLEDLedACTACTUATORMBX1Mbx Send OvwMBX1Mbx Rcv no blkMBX1Mbx Send ifMBX1Mbx rcv blkcomedi0 CH0COMEDI A/Dcomedi0 CH0COMEDI D/Acomedi0 CH0COMEDI DIcomedi0 CH0COMEDI DOSEM1SEM waitSEM1SEM signalBlockC RTAI0Fifoout0FifoinRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsScicosblocksSpecicblocksforRTAI-LabSCOPEScopeSCOPEScopeMETERMeterMETERMeterLEDLEDLEDLEDRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsScicosblocksSpecicblocksforRTAI-LabSCOPEScopeSCOPEScopeMETERMeterMETERMeterLEDLEDLEDLEDRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsScicosblocksSpecicblocksforRTAI-LabSCOPEScopeSCOPEScopeMETERMeterMETERMeterLEDLEDLEDLEDRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsScicosblocksSpecicblocksforRTAI-LabSCOPEScopeSCOPEScopeMETERMeterMETERMeterLEDLEDLEDLEDRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsOtherpalettesAdditionalpalettesRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThemainleThemainlertmain.c3threads:MainthreadrtMainHardRTthreadrtBaseRateCommunicationthreadwiththeGUIclientapplicationrtHostInterfaceRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsThemainleThertBaseRatethreadWaitTimingEventEnd?YNHARD realtimeSOFT realtimeSOFT realtimeNAME(MODEL,_isr)(double t);NAME(MODEL,_init)();NAME(MODEL,_end)();RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsAddingnewblocksAddinganewblockEachnewblockneedsAninterfacefunction(.sci)Animplementationfunction(.c)RapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsTheinvertedpendulumTheInvertedPendulumParticularoftheRFencoderM1i11RFreceiverDriverCAN BUSPC with HRTcontrollerEncoder+RF senderReduced orderobseverKlqryuTheScicosschemeSCOPEScopeSafety block11Real PlantLQR_controllerInput_refSwingup_controllerSine0.21SwitchABSRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsTheinvertedpendulumTheInvertedPendulumParticularoftheRFencoderM1i11RFreceiverDriverCAN BUSPC with HRTcontrollerEncoder+RF senderReduced orderobseverKlqryuTheScicosschemeSCOPEScopeSafety block11Real PlantLQR_controllerInput_refSwingup_controllerSine0.21SwitchABSRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsTheinvertedpendulumTheInvertedPendulumParticularoftheRFencoderM1i11RFreceiverDriverCAN BUSPC with HRTcontrollerEncoder+RF senderReduced orderobseverKlqryuTheScicosschemeSCOPEScopeSafety block11Real PlantLQR_controllerInput_refSwingup_controllerSine0.21SwitchABSRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsTheinvertedpendulumTheInvertedPendulumParticularoftheRFencoderM1i11RFreceiverDriverCAN BUSPC with HRTcontrollerEncoder+RF senderReduced orderobseverKlqryuTheScicosschemeSCOPEScopeSafety block11Real PlantLQR_controllerInput_refSwingup_controllerSine0.21SwitchABSRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsTheinvertedpendulumTheInvertedPendulumParticularoftheRFencoderM1i11RFreceiverDriverCAN BUSPC with HRTcontrollerEncoder+RF senderReduced orderobseverKlqryuTheScicosschemeSCOPEScopeSafety block11Real PlantLQR_controllerInput_refSwingup_controllerSine0.21SwitchABSRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsTheinvertedpendulumTheInvertedPendulumParticularoftheRFencoderM1i11RFreceiverDriverCAN BUSPC with HRTcontrollerEncoder+RF senderReduced orderobseverKlqryuTheScicosschemeSCOPEScopeSafety block11Real PlantLQR_controllerInput_refSwingup_controllerSine0.21SwitchABSRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBall onbeamBallonBeamTheScicosschemeScopeSCOPEScopeBall on beam Controllore + Osservatore11Ksiginp.datextdataTheanti-windupcontrollerSaturazione11112211Mux C + O Directy=Cx+Dux+=Ax+BuSum++C + O Feedbacky=Cx+Dux+=Ax+Bu33TheCANopenblocksExpressionMathemati..0x02encoderEpos0x02motor IEpos00x02Epos Analog1122 1111X01sINIT ENCPHI01sINIT ENCden(z)num(z)synccanopenEposRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBall onbeamBallonBeamTheScicosschemeScopeSCOPEScopeBall on beam Controllore + Osservatore11Ksiginp.datextdataTheanti-windupcontrollerSaturazione11112211Mux C + O Directy=Cx+Dux+=Ax+BuSum++C + O Feedbacky=Cx+Dux+=Ax+Bu33TheCANopenblocksExpressionMathemati..0x02encoderEpos0x02motor IEpos00x02Epos Analog1122 1111X01sINIT ENCPHI01sINIT ENCden(z)num(z)synccanopenEposRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBall onbeamBallonBeamTheScicosschemeScopeSCOPEScopeBall on beam Controllore + Osservatore11Ksiginp.datextdataTheanti-windupcontrollerSaturazione11112211Mux C + O Directy=Cx+Dux+=Ax+BuSum++C + O Feedbacky=Cx+Dux+=Ax+Bu33TheCANopenblocksExpressionMathemati..0x02encoderEpos0x02motor IEpos00x02Epos Analog1122 1111X01sINIT ENCPHI01sINIT ENCden(z)num(z)synccanopenEposRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBall onbeamBallonBeamTheScicosschemeScopeSCOPEScopeBall on beam Controllore + Osservatore11Ksiginp.datextdataTheanti-windupcontrollerSaturazione11112211Mux C + O Directy=Cx+Dux+=Ax+BuSum++C + O Feedbacky=Cx+Dux+=Ax+Bu33TheCANopenblocksExpressionMathemati..0x02encoderEpos0x02motor IEpos00x02Epos Analog1122 1111X01sINIT ENCPHI01sINIT ENCden(z)num(z)synccanopenEposRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBall onbeamBallonBeamTheScicosschemeScopeSCOPEScopeBall on beam Controllore + Osservatore11Ksiginp.datextdataTheanti-windupcontrollerSaturazione11112211Mux C + O Directy=Cx+Dux+=Ax+BuSum++C + O Feedbacky=Cx+Dux+=Ax+Bu33TheCANopenblocksExpressionMathemati..0x02encoderEpos0x02motor IEpos00x02Epos Analog1122 1111X01sINIT ENCPHI01sINIT ENCden(z)num(z)synccanopenEposRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsBall onbeamVideosSampleVideosRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsConclusionsConclusionsOpensource!!!Completeandstable.Abletosolvecomplexcontrolproblemsinasimpleway.ItrunsparalleltoaMATLAB/Simulink/RTWenvironmentinmystudentlaboratoryRapidControllerPrototyping LinuxRTAI Scicos Implementation Examples ConclusionsQuestionsQuestions?ThankYouwww.rtai.orgwww.dti.supsi.ch/bucher/scilab.htmlwww.dti.supsi.ch/smt/laboO4.html