)veryfewtoolssupportco-simulationofcontrolsystemsandreal-timescheduling.Anearly,tick-basedprototypeofTRUETIMEwaspresentedin[EkerandCervin,].Sinceitwasnotevent-basedthisearlyversionhadverylittlesupportforinterrupthandlingandcouldnothandlefine-grainedsimulationdetails.Also,therewasnosupportforsimulationofnetworks.TheRTSIMreal-timeschedulingsimulator(astandaloneC++program)hasrecentlybeenextendedwithatsofthistypeoftemporalnon-determinismoncontrolperformanceareoftenveryhard,ifnotimpossible,toinvestigateanalytically.Anaturalapproachisthentoinsteadusesimulation.However,todayssimulationtoolsmakeitdifficulttosimulatethetruetemporalbehaviorofcontrolloops.Whatisnormallydoneistointroducetimedelaysinthecontrollooprepresentingaverage-caseorworst-casedelays.InthispaperthenewsimulationtoolboxTRUETIMEispresented.TRUETIME,whichisbasedonMATLAB/Simulink,makesitpossibletosimulatethetemporalbehaviorofamultitaskingReal-timekernelcontainingcontrollertasks.ThecontrollertaskscontrolprocessesmodeledasordinarySimulinkblocks.Differentschedulingpoliciesmaybeused,e.g.,priority-drivenordeadline-drivenscheduling.Theexecutiontimesofthecontrollertaskscanbemodeledasbeingconstantortime-varying,usingsomesuitableprobabilitydistribution.Theeffectsofcontextswitchingandinterrupthandlingaretakenintoaccount,aswellastasksynchronizationusingeventsandmonitors.WithTRUETIMEitisalsopossibletosimulatethetimingbehaviorofcommunicationnetworksusedin,e.g.,networkedcontrolloops.TRUETIMEcanbeusedforseveralpurposes:toinvestigatethetrueeffectsoftimingnon-determinismoncontrolperformance,todevelopcompensationschemesthatadjustthecontrollerdynamicallybasedonmeasurementsofactualtimingvariations,toexperimentwithnew,moreflexibleapproachestodynamicscheduling,e.g.,feedbackscheduling[Ekeretal.,]andQuality-of-Service(QoS)basedschedulingapproaches,andtosimulateevent-basedcontrolsystems,e.g.,combustionenginecontrolsystemsanddistributedcontrollers.FigureTheinterfacestotheSimulinkblocks.TheScheduleandMonitorsportsprovideplotsoftheallocationofcommonresources(CPU,monitors,network)duringthesimulation..RelatedworkWhilenumeroustoolsexistthatsupporteithersimulationofcontrolsystems(e.g.Simulink)orsimulationofreal-timescheduling(e.g.STRESS[Audsleyetal.,GandDRTSS[StorchandLiu,])veryfewtoolssupportco-simulationofcontrolsystemsandreal-timescheduling.Anearly,tick-basedprototypeofTRUETIMEwaspresentedin[EkerandCervin,].Sinceitwasnotevent-basedthisearlyversionhadverylittlesupportforinterrupthandlingandcouldnothandlefine-grainedsimulationdetails.Also,therewasnosupportforsimulationofnetworks.TheRTSIMreal-timeschedulingsimulator(astandaloneC++program)hasrecentlybeenextendedwitha干扰节点影响,往返延迟(从采样到执行延迟)将相当稳定。假设,在这种情况下,往返延时等于.毫秒,这将产生满意控制性能。其次,考虑干扰节点影响。进一步假设,有一个干扰,高优先级活动(周期毫秒,执行时间毫秒)在控制器节点执行。现在该往返延迟在平均和时变上将会更长。这使得控制性能降低,在图中可以看到仿真阶跃响应。该控制器节点中线程和通过网络传输消息执行可以在图中详细参考研究。图具有时间驱动传感器节点、事件驱动执行器和控制器节点分布式控制系统。干扰节点产生随机高优先级扰动影响网络。直流伺服电机传感器节点执行器节点干扰节点控制器节点网络图具有干扰计算机任务网络信息发送阶跃响应图调度特写咸湿佬共有资源分配:网络(上)和控制计算机(下)不同调度策略将产生不同执行和传输方式,因此产生不同控制性能。利用TrueTime就可以很容易地研究它们,以及不同延迟和抖动补偿方案。子任务调度为了减少控制延迟,控制算法传统上分为两个独立部分,计算输出和更新状态。在第一部分当测量数据检测到,该控制信号就会计算并发送到过程。在其他部分控制器内部状态将会被更新。一个提高多个控制任务调度方案年在Cervin提出,该方案将控制任务计算输出部分和更新状态部分分为不同任务。在这项计划中,计算输出部分被给予了比更新状态部分更高优先级。该方法缺点是上下文切换次数增加。这个例子说明了如何使用TrueTime来评估两种不同调度策略以及考虑到上下文切换影响在内它们对控制性能影响。这个问题涉及到在单个CPU上同时控制三个倒立摆。每个摆是由连续时间公式()描述。三种不同采样周期离散控制器将依据理想带宽、和rad/s,分别对应、和ms采样周期而设计。这些控制器以状态反馈为基础并在离散状态空间构建上执行,例如见[strmandWittenmark,]。在改进后调度仿真中控制器包含了四个代码段。第一段执行计算输出部分。在第二段设备被驱动跟随调用内核来降低更新状态部分优先级。第三段将更新状态而最后一段复位计算输出部分优先级。第一、三段执行时间分别是和ms。第二、四段被模拟为具有零执行时间。对于一个完整上下文切换时间被设定为ms。图使用传统和改进调度低速(低优先级)摆积分损耗iJ。不管上下文切换数量增加,由于使用改进调度使得损耗大大减少。图使用改进后调度计划计算机调度。对于低优先级线程控制延时与其他线程大致相同。内核图显示了上下文切换时间。这两个调度计划将用s来仿真,并且二次积分函数()()tiiJtsdsi=,,()被记录下来,i表示几级摆。使用传统和改进调度低速(低优先级)摆积分损耗iJ如图所示。不管上下文切换数量增加,由于使用改进调度使得损耗大大减少。由图可以看出,在计算机调度上低优先级线程控制延时大约等于其他两个线程,即同为ms。结论本文介绍了TrueTime,一个用于控制和实时系统代码符号基于事件模拟器。该模拟捕捉实况、实时控制器任务及时行为、动态控制和调度策略,可以从控制性能角度进行评估。.致谢这项工作已经得到了卢斯卡——应用软件研究瑞典创新局资助中心和瑞典教育研究网络支持。参考文献Abeni,L.andG.Buttazzo():―整合多媒体硬实时系统应用。―在届电机及电子学工程师联合会实时系统研讨会论文集。马德里,西班牙。strm,K.J.andB.Wittenmark():计算机控制系统,第三版。硕士论文。Audsley,N.,A.Burns,M.Richardson,andA.Wellings():―压力,一个硬实时系统模拟器。‖软件实践和经验,:,-页。Cervin,A.():―改进调度控制任务。‖在第届Euromicro会议实时系统论文集,-页。英国约克。Eker,J.andA.Cervin():―Matlab工具箱中对实时控制系统协调设计。―在第六届国际实时计算系统和应用会议上,第-页。香港,中国体育河。Eker,J.,P.Hagander,andK.Erikrzn():―一个用于实时控制任务反馈调度‖控制工程实践训练,:,第至页。Palopoli,L.,L.Abeni,andG.Buttazzo():―实时控制系统分析:一个综合方法。―在届电机及电子学工程师联合会实时系统研讨会论文集。佛罗里达州奥兰多。Storch,M.F.andJ.W.S.Liu():―DRTSS:一个复杂实时系统仿真框架。―在第二届IEEE实时技术及应用研讨会,第-页。tsofthistypeoftemporalnon-determnismoncontrolperformanceareoftenveryhard,ifnotimpossible,toinvestigateanalytically.Anaturalapproachisthentoinsteadusesimulation.However,todayssimulationtoolsmakeitdifficulttosimulatethetruetemporalbehaviorofcontrolloops.Whatisnormallydoneistointroducetimedelaysinthecontrollooprepresentingaverage-caseorworst-casedelays.InthispaperthenewsimulationtoolboxTRUETIMEispre外文原文和译文thIFACWorldCongressonAutomaticControl,Barcelona,Spain,July.TrueTime:SimulationofControlLoopsUndeSharedComputerResourcesDanHenriksson,AntonCervin,KarlErikrznDepartmentofAutomaticControlLundInstituteofTechnologyBox,SELund,Sweden{dan,anton,karlerik}@control.lth.seAbstractThepaperpresentsTRUETIME,aMATLAB/Simulink-basedsimulatorforreal-timecontrolsystems.TRUETIMEmakesitpossibletosimulatethetemporalbehaviorofmultitaskingreal-timekernelscontainingcontrollertasksandtostudytheeffectsofCPUandnetworkschedulingoncontrolperformance.ThesimulatedReal-timekernelisevent-drivenandcanhandleexternalinterruptsaswellasfine-grainedDetailssuchascontextswitches.Arbitraryschedulingpoliciesmaybedefined,andthecontroltasksmaybeimplementedusingCfunctions,Mfunctions,orSimulinkblockdiagrams.AnumberofexamplesthatillustratetheuseofTRUETIMEarepresented..IntroductionMostcomputercontrolsystemsareembeddedsystemswherethecomputerisacomponentwithinalargerengineeringsystem.Thecontrollersareoftenimplementedasoneorseveraltasksonamicroprocessorusingareal-timekernelorareal-timeoperatingsystemDRTOSE.Inmostcasesthemicroprocessoralsocontainsothertasksforotherfunctions,e.g.,communicationanduserinterfaces.ThekernelorOStypicallyusesmultiprogrammingtomultiplextheexecutionofthedifferenttasksonasingleCPU.TheCPUtimeandthecommunicationbandwidth,hence,canbeviewedassharedresourceswhichthetaskscompetefor.Computer-basedcontroltheorynormallyassumesequidistantsamplingintervalsandnegligibleorconstantcontroldelays,i.e.,thelatencybetweenthesamplingoftheinputstothecontrollerandthegenerationoftheoutputs.However,thiscanseldombeachievedinpractice.Tasksinterferewitheachotherthroughpreemptionandblockingduetocommunication.Executiontimesmaybedata-dependentorvarydueto,e.g.,theusesofcaches.Theresultofthisisjitterinsamplingperiodsandlatencies.Anadditionalcauseofthistemporalnon-determinismistheincreasinguseofcommercialoff-the-shelf(COTS)componentsincontrolsystems,e.g.,generalpurposeoperatingsystemssuchasWindowsandLinuxandgeneralpurposenetworkprotocolssuchasEthernet.Thesearedesignedtooptimizeaverage-caseperformanceratherthanworst-caseperformance,andthereforeincreasethenon-determinism.Theeffectsofthistypeoftemporalnon-determinismoncontrolperformanceareoftenveryhard,ifnotimpossible,toinvestigateanalytically.Anaturalapproachisthentoinsteadusesimulation.However,todayssimulationtoolsmakeitdifficulttosimulatethetruetemporalbehaviorofcontrolloops.Whatisnormallydoneistointroducetimedelaysinthecontrollooprepresentingaverage-caseorworst-casedelays.InthispaperthenewsimulationtoolboxTRUETIMEispresented.TRUETIME,whichisbasedonMATLAB/Simulink,makesitpossibletosimulatethetemporalbehaviorofamultitaskingReal-timekernelcontainingcontrollertasks.ThecontrollertaskscontrolprocessesmodeledasordinarySimulinkblocks.Differentschedulingpoliciesmaybeused,e.g.,priority-drivenordeadline-drivenscheduling.Theexecutiontimesofthecontrollertaskscanbemodeledasbeingconstantortime-varying,usingsomesuitableprobabilitydistribution.Theeffectsofcontextswitchingandinterrupthandlingaretakenintoaccount,aswellastasksynchronizationusingeventsandmonitors.WithTRUETIMEitisalsopossibletosimulatethetimingbehaviorofcommunicationnetworksusedin,e.g.,networkedcontrolloops.TRUETIMEcanbeusedforseveralpurposes:toinvestigatethetrueeffectsoftimingnon-determinismoncontrolperformance,todevelopcompensationschemesthatadjustthecontrollerdynamicallybasedonmeasurementsofactualtimingvariations,toexperimentwithnew,moreflexibleapproachestodynamicscheduling,e.g.,feedbackscheduling[Ekeretal.,]andQuality-of-Service(QoS)basedschedulingapproaches,andtosimulateevent-basedcontrolsystems,e.g.,combustionenginecontrolsystemsanddistributedcontrollers.FigureTheinterfacestotheSimulinkblocks.TheScheduleandMonitorsportsp 外文原文和译文15thIFACWorldCongressonAutomaticControl,Barcelona,Spain,July2002.TrueTime:SimulationofControlLoopsUndeSharedComputerResourcesDanHenriksson,AntonCervin,KarlErikÅrzénDepartmentofAutomaticControlLundInstituteofTechnologyBox118,SE22100Lund,Sweden{dan,anton,karlerik}@control.lth.seAbstractThepaperpresentsTRUETIME,aMATLAB/Simulink-basedsim