control design and simulation module concept · if you are new to the control design and simulation...

100
Control Design and Simulation Module June 2008, 371894C-01 Simulation is a process that involves using software to recreate and analyze the behavior of dynamic systems. You use the simulation process to lower product development costs by accelerating product development. You also use the simulation process to provide insight into the behavior of dynamic systems you cannot replicate conveniently in the laboratory. For example, simulating a jet engine saves time, labor, and money compared to building, testing, and rebuilding an actual jet engine. You can use the LabVIEW Control Design and Simulation Module to simulate a dynamic system or a component of a dynamic system. For example, you can simulate only the plant while using hardware for the controller, actuators, and sensors. If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition to the topics contained in this help file, the LabVIEW Control Design User Manual contains information about using LabVIEW to design, analyze, and deploy controllers for dynamic systems. The following table describes the tasks you can perform with the Control Design and Simulation Module and the components you use for these tasks. Task Component Design, analyze, and deploy controllers for dynamic system models Control Design VIs and functions. You also can use the Control Design MathScript functions to design and analyze controllers. Configure simulation parameters, including the ordinary differential equation (ODE) solver, and define the simulation as part of a LabVIEW block diagram Simulation Loop Build , simulate, and deploy dynamic system models , including models developed with the Simulation functions

Upload: others

Post on 23-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ControlDesignandSimulationModuleJune2008,371894C-01Simulationisaprocessthatinvolvesusingsoftwaretorecreateandanalyzethebehaviorofdynamicsystems.Youusethesimulationprocesstolowerproductdevelopmentcostsbyacceleratingproductdevelopment.Youalsousethesimulationprocesstoprovideinsightintothebehaviorofdynamicsystemsyoucannotreplicateconvenientlyinthelaboratory.Forexample,simulatingajetenginesavestime,labor,andmoneycomparedtobuilding,testing,andrebuildinganactualjetengine.YoucanusetheLabVIEWControlDesignandSimulationModuletosimulateadynamicsystemoracomponentofadynamicsystem.Forexample,youcansimulateonlytheplantwhileusinghardwareforthecontroller,actuators,andsensors.IfyouarenewtotheControlDesignandSimulationModule,considercompletingtheGettingStartedwithSimulationtutorial.Inadditiontothetopicscontainedinthishelpfile,theLabVIEWControlDesignUserManualcontainsinformationaboutusingLabVIEWtodesign,analyze,anddeploycontrollersfordynamicsystems.ThefollowingtabledescribesthetasksyoucanperformwiththeControlDesignandSimulationModuleandthecomponentsyouuseforthesetasks.

Task ComponentDesign,analyze,anddeploycontrollersfordynamicsystemmodels

ControlDesignVIsandfunctions.YoualsocanusetheControlDesignMathScriptfunctionstodesignandanalyzecontrollers.

Configuresimulationparameters,includingtheordinarydifferentialequation(ODE)solver,anddefinethesimulationaspartofaLabVIEWblockdiagram

SimulationLoop

Build,simulate,anddeploydynamicsystemmodels,includingmodelsdevelopedwiththe

Simulationfunctions

Page 2: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

LabVIEWSystemIdentificationToolkitortheControlDesignandSimulationModule.Executeoffline,RapidControlPrototype(RCP),andHardware-in-the-Loop(HIL)configurationsGenerateandcombineinputandfeedbacksignalsCollectanddisplaysimulationdata

Trimandlinearizeanonlineardynamicsystemmodel

Trim&LinearizeVIs;LinearizeSubsystemdialogbox

Determinetheoptimalparametersforadynamicsystemmodel,givenasetofconstraints

OptimalDesignVIs

ConvertamodeldevelopedinTheMathWorks,Inc.Simulink®applicationsoftwareintoLabVIEWblockdiagramcode

SimulationModelConverter

©2002–2008NationalInstrumentsCorporation.Allrightsreserved.

Page 3: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Version8.6Features(ControlDesignandSimulationModule)RefertotheLabVIEW8.6FeaturesandChangestopicforinformationaboutnewfeaturesinLabVIEW8.6.Refertothereadme_ControlandSim.htmlfile,locatedinthelabview\readmedirectory,foracompletelistofnewfeaturesandchanges,informationaboutupgradeandcompatibilityissuesspecifictodifferentversionsoftheControlDesignandSimulationModule,andinformationaboutknownissueswiththeControlDesignandSimulationModule8.6.

Page 4: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

UsingSimulationSubsystemsOutsideaSimulationLoopYounowcanplaceasimulationsubsystemonablockdiagramoutsideaSimulationLoop.IfyourunasimulationsubsystemonablockdiagramoutsideaSimulationLoop,thesimulationsubsystemexecutesonestepoftheordinarydifferentialequationsolvereachtimethesimulationsubsystemiscalled.

Page 5: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

PlacingConstraintsonanMPCControllerUsetheCDCreateMPCControllerVItocreateanMPCcontrollermodelwithconstraintsdefinedusingeitherthedualoptimizationorbarrierfunctionmethod.UsetheCDUpdateMPCWindowVItoprovidesetpointanddisturbanceprofilestotheMPCcontrollerduringimplementation.YoualsocanusetheCDSetMPCControllerVItoupdatespecifiedparameters,includinganyconstraints,ofanMPCcontrolleratruntime.RefertotheLabVIEWControlDesignUserManualformoreinformationaboutsettingconstraintsforanMPCcontroller.

Page 6: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ImplementationPaletteChangesTheControlDesign»Implementationpalettehasthefollowingchanges:

TheCDDiscreteStochasticState-SpacefunctionreplacestheCDDiscreteStochasticState-Space(External)functionandtheCDDiscreteStochasticState-Space(Internal)function.UsetheCDDiscreteStochasticState-SpacefunctionoutsideaSimulationLoop.UsethenewDiscreteStochasticState-SpacefunctioninsideaSimulationLoop.TheCDDiscreteObserverfunctionreplacestheCDPredictiveObserverfunction,theCDCurrentObserverCorrectorVI,andtheCDCurrentObserverPredictorVI.TheCDCurrentObserverCorrectorVIandtheCDCurrentObserverPredictorVInolongerareonthepalettebutstillworkinVIsyoucreatedinapreviousversionoftheControlDesignandSimulationModule.UsetheCDDiscreteObserverfunctionoutsideaSimulationLoop.UsethenewDiscreteObserverfunctioninsideaSimulationLoop.TheCDDiscreteKalmanFilterfunctionreplacestheCDDiscreteRecursiveKalmanCorrectorVIandtheCDDiscreteRecursiveKalmanPredictorVI.TheCDDiscreteRecursiveKalmanCorrectorVIandtheCDDiscreteRecursiveKalmanPredictorVInolongerareonthepalettebutstillworkinVIsyoucreatedinapreviousversionoftheControlDesignandSimulationModule.UsetheCDDiscreteKalmanFilterfunctionoutsideaSimulationLoop.UsethenewDiscreteKalmanFilterfunctioninsideaSimulationLoop.

TheSimulation»CDImplementationpalettehasbeenremoved.ThechangestotheControlDesign»ImplementationpalettealsoapplytotheSimulation»CDImplementationpalette.Additionally,theCDContinuousObserverfunctionandtheCDContinuousRecursiveKalmanFilterfunctionnowareontheSimulation»ContinuousLinearSystemspalette.

Page 7: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

LabVIEWControlDesignAssistant3.0UsetheinteractiveLabVIEWControlDesignAssistanttodevelopmodelsthatreflectthebehaviorofsingle-inputsingle-output(SISO)systems.UsingtheControlDesignAssistant,youcanloadorcreateamodelofaplant,analyzethetimeorfrequencyresponse,andthensynthesizeacontroller.TheControlDesignAssistanthaswindowsinwhichyoucanimmediatelyseethemathematicalequationandgraphicalrepresentationthatdescribethemodel.Youalsocanviewtheresponsedataandtheconfigurationofthecontroller.SelectTools»ControlDesignandSimulation»LaunchControlDesignAssistanttolaunchtheControlDesignAssistantfromLabVIEW.

Page 8: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

MathScriptNodeontheSimulationDiagramYounowcanplaceaMathScriptNodedirectlyonasimulationdiagram.

Page 9: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

RelatedDocumentation(ControlDesignandSimulationModule)ThefollowingdocumentscontaininformationthatyoumightfindhelpfulasyouusetheLabVIEWControlDesignandSimulationModule.

GettingStartedwithLabVIEW—Thismanualcontainsanin-depthintroductiontoLabVIEW,includingseveraltutorialsthatshowcaseLabVIEWfeatures.LabVIEWFundamentals—ThismanualprovidesinformationaboutLabVIEWprogrammingconcepts,techniques,features,VIs,andfunctionsyoucanusetocreatemanytypesofapplications.LabVIEWControlDesignUserManual—ThismanualcontainsinformationaboutusingLabVIEWtodesign,analyze,anddeploycontrollersfordynamicsystems.GettingStartedwiththeLabVIEWReal-TimeModule—Thismanualintroducestheconceptsnecessarytocreatereal-timesimulations.Real-TimeExecutionTraceToolkitdocumentation.NI-CANHardwareandSoftwareManualNI-DAQmxHelpLabVIEWControlDesignandSimulationModuleReadme—Usethisfiletolearnimportantlast-minuteinformation,includinginstallationandupgradeissues,compatibilityissues,changesfromthepreviousversion,andknownissueswiththeControlDesignandSimulationModule.OpenthisreadmebyselectingStart»AllPrograms»NationalInstruments»LabVIEW»Readmeandopeningreadme_ControlandSim.htmlorbynavigatingtothelabview\readmedirectoryandopeningreadme_ControlandSim.html.LabVIEWControlDesignandSimulationModuleexampleVIs—Refertothelabview\examples\ControlandSimulationdirectoryforexampleVIsthatdemonstratecommontasksusingtheControlDesignandSimulationModule.YoualsocanaccesstheseVIsbyselectingHelp»FindExamplesandselectingToolkitsandModules»ControlandSimulationintheNIExampleFinderwindow.

Page 10: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

AdditionalLabVIEWdocumentation.YoumusthaveAdobeReader6.0.1orlaterinstalledtovieworsearchthePDFversionsofthesemanuals.RefertotheAdobeSystemsIncorporatedWebsitetodownloadAcrobatReader.RefertotheNationalInstrumentsProductManualsLibraryforupdateddocumentationresources.YoumustinstallthePDFstoaccessthemfromthishelpsystem.

NoteThefollowingresourcesofferusefulbackgroundinformationonthegeneralconceptsdiscussedinthisdocumentation.Theseresourcesareprovidedforgeneralinformationalpurposesonlyandarenotaffiliated,sponsored,orendorsedbyNationalInstruments.Thecontentoftheseresourcesisnotarepresentationof,maynotcorrespondto,anddoesnotimplycurrentorfuturefunctionalityintheControlDesignandSimulationModuleoranyotherNationalInstrumentsproduct.Åström,K.,andT.Hagglund.1995.PIDcontrollers:theory,design,andtuning.2ded.ISA.Balbis,Luisella.2006.Predictivecontroltoolkit.UKACCcontrol,2006.Minisymposia:87–96.Bertsekas,DimitriP.1999.NonlinearProgramming.2ded.Belmont,MA:AthenaScientific.Dorf,R.C.,andR.H.Bishop.2001.Moderncontrolsystems.9thed.UpperSaddleRiver,NJ:PrenticeHall.Franklin,G.F.,J.D.Powell,andA.Emami-Naeini.2002.Feedbackcontrolofdynamicsystems.4thed.UpperSaddleRiver,NJ:PrenticeHall.Franklin,G.F.,J.D.Powell,andM.L.Workman.1998.Digitalcontrolofdynamicsystems.3ded.MenloPark,CA:AddisonWesleyLongman,Inc.Kuo,BenjaminC.1992.DigitalControlSystems.2ded.Ft.Worth:SaundersCollege.Nise,NormanS.2000.Controlsystemsengineering.3ded.NewYork:JohnWiley&Sons,Inc.Ogata,Katsuhiko.1995.Discrete-timecontrolsystems.2ded.EnglewoodCliffs,N.J.:PrenticeHall.

Page 11: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Ogata,Katsuhiko.2001.Moderncontrolengineering.4thed.UpperSaddleRiver,NJ:PrenticeHall.Zhou,Kemin,andJohnC.Doyle.1998.Essentialsofrobustcontrol.UpperSaddleRiver,NJ:PrenticeHall.

Thefollowingbookscontaininformationabouttheordinarydifferentialequation(ODE)solverstheControlDesignandSimulationModuleuses.

Ascher,U.M.,andL.R.Petzold.1998.Computermethodsforordinarydifferentialequationsanddifferential-algebraicequations.Philadelphia:SocietyforIndustrialandAppliedMathematics.Shampine,LawrenceF.1994.Numericalsolutionofordinarydifferentialequations.NewYork:Chapman&Hall,Inc.

Page 12: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

OrdinaryDifferentialEquationSolvers(ControlDesignandSimulationModule)Becausemanydynamicsystemmodelsconsistofdifferentialequations,youmustsolvethesedifferentialequationstoobservethebehaviorofthesimulatedsystem.LabVIEWincludesseveralordinarydifferentialequation(ODE)solversthatsolvetheseequations.Beforeyousimulateadynamicsystemmodel,youmustspecifyandconfiguretheODEsolverforthatsimulation.ODEsolversusemethodstoapproximatethesolutiontoadifferentialequation.TheODEsolversimplementthesemethodsinavarietyofways,eachwithvariousstrengthsandweaknesses.DefiningcharacteristicsofanODEsolverincludethefollowingqualities:

AccuracyororderStabilityComputationalspeedUseofafixedtimestepsizeversusavariabletimestepsizeUseofasinglestepversusmultiplestepsSuitabilityforstiffproblems

Page 13: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ConsiderationsforEmbeddedTargets(ControlDesignandSimulationModule)IfyouinstallLabVIEWforaparticularembeddedtarget,youcanusetheLabVIEWControlDesignandSimulationModuletodevelopandexecutesimulationsonthattarget.RefertothedocumentationforthetargetyoupurchasedforinformationaboutdevelopingandexecutingVIsonthattarget.Whendevelopingasimulationforanembeddedtarget,takethefollowingfactorsintoconsideration:

YoucannotusetheTrim&LinearizeVIsorOptimalDesignVIswhendevelopingonanembeddedtarget.Therefore,LabVIEWdoesnotdisplaythesepaletteswhenyouareinanembeddedcontext.YoucanuseaConditionalDisablestructuretoenablereal-worldI/OwhenthesimulationisontheembeddedtargetandsimulatedI/OwhenthesamesimulationisrunningonaWindowscomputer.Usingthismethod,youdonothavetomodifytheVImanuallytousedifferentI/Ocodewhenyouswitchtargets.UseasfewSimulationfunctionsaspossible.CombineasmanysequentialtransformationsaspossibleintoasingleSimulationfunction.Forexample,insteadofusingthreeState-Spacefunctionstodescribeacontrollermodel,combinethosefunctionsintoasingleState-Spacefunction.

NoteYoucanusetheModelInterconnectionVIstocombinedynamicsystemmodels.

Considerthespeed/memorytrade-offwhenusingsimulationsubsystems.Usingfewersimulationsubsystemsmightincreaseexecutionspeedbutmightrequireyoutoduplicatecodeelsewhereonthesimulationdiagram.Considerusingfixedstep-sizeordinarydifferentialequation(ODE)solvers,thatis,thesolversnotmarked(variable).Variablestep-sizeODEsolversintroducecomputationaloverheadwhenchangingstepsizes.

NoteTheControlDesignandSimulationModuledoesnotguaranteeaccuracywhenusingtheBDForRosenbrock

Page 14: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ODEsolversonembeddedtargets.Ifthesesolversappeartoproduceinaccurateresultsonanembeddedtarget,chooseanotherODEsolver.

Page 15: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Glossary(ControlDesignandSimulationModule)A B C D E F H I L M N O P R S T

LabVIEWGlossary

Page 16: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

AAckermann Atechniqueforplacingpolesinasystemmodel.Usethe

CDAckermannVItoimplementthistechnique.actuator Aphysicaldevicethatappliesthecontrolactiontotheplant.auto-covariance

Ameasureofhowcloselyavalueofastochasticprocess,suchasnoise,varieswiththesubsequentvalueofthatprocess.

Page 17: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Bbalancedsystemmodel

AsystemmodelwithidenticalcontrollabilityandobservabilitydiagonalGrammians.UsetheCDBalanceState-SpaceModel(Diagonal)VIandtheCDBalanceState-SpaceModel(Grammians)VItobalanceastate-spacesystemmodel.

Bodeplot

Aplotthatshowsthegainandphasemarginsofasystemmodelforacommonfrequencyrange.Bodeplotsshowhowcloseasystemmodelistoinstability.UsetheCDBodeVItocreateaBodeplotforasystemmodel.

Page 18: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

CCGD CommonGraphDescription.TheformattheSimulation

ModelConverterusestostoreeachsystem,subsystem,block,andlinefromamodeldevelopedinTheMathWorks,Inc.Simulink®simulationenvironment.

constraints Seeinequalityconstraints.continuousmodel

Adynamicsystemmodelthatrepresentsreal-worldsignals,whichvarycontinuouslywithtime.Youcharacterizeacontinuousmodelbydifferentialequations.Seealsodiscretemodel.

controller Adevicethatregulatestheoperationofadynamicsystem.cost Thescalarvaluethatresultsfromsolvingacostfunction.costfunction

Aperformancemeasureyouwanttominimizewhendesigningoptimalparameters.Acostfunctionisafunctionalequationthatmapsasetofpointsinatimeseriestoasinglescalarvalue.

Page 19: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Ddesign Seeoptimaldesign.directfeedthrough

Arelationshipbetweenafunctioninputandafunctionoutputinwhichthefunctionusestheinputatthecurrentsteptocalculatetheoutputatthecurrentstep.Seealsoindirectfeedthrough.

discretemodel

Adynamicsystemmodelthatrepresentssignalsthataresampledatdiscontinuousintervalsintime.Youcharacterizeadiscretemodelbydifferenceequations.Seealsocontinuousmodel.

distributedparametermodel

Aphysicalmodelthatyoucandescribewithpartialdifferentialequations.Seealsolumpedparametermodel.

dynamicsystem

Asystemwhosebehaviorvarieswithtime.

dynamicsystemmodel

Adifferentialordifferenceequationthatrepresentsthebehaviorofallorpartofadynamicsystem.

Page 20: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Eempiricalmodeling

Amodelingtechniqueinwhichyouuseexperimentaldatatodefineadynamicsystemmodel.Seealsophysicalmodeling.

Page 21: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Ffeedbackcycle

Acycleinwhichdatafloworiginatesfromanoutputofafunctionorsubsystemandterminatesasaninputofthesamefunctionorsubsystem.Seealsoindirectfeedthrough.

Page 22: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

HHIL Hardware-in-the-loop.Asimulationconfigurationinwhichyoutest

acontrollerimplementationwithasimulatedsystem.SeealsoRCP.

Page 23: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Iindirectfeedthrough

Arelationshipbetweenafunctioninputandafunctionoutputinwhichthefunctiondoesnotusetheinputatthecurrentsteptocomputetheoutputatthecurrentstep.Seealsodirectfeedthrough.

inequalityconstraints

Anyrestrictionsyouplaceonhowtheoptimaldesignprocessdeterminesoptimalparametervalues.Youcandefineinequalityconstraintsforthecontrolaction,theoutput,therateofchangeofthecontrolaction,andtherateofchangeoftheoutput.

InputNode AcollectionofinputterminalsattachedtotheSimulationLoop.UsetheInputNodetoconfiguresimulationparametersprogrammatically.SeealsoOutputNode.

Page 24: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Llinearmodel Adynamicsystemmodelthatobeystheprinciplesof

superpositionandhomogeneity.Seealsononlinearmodel.

linearize Aprocedurethatapproximatesthebehaviorofanonlinearmodel.Seealsotrim.

lumpedparametermodel

Aphysicalmodelyoucandescribewithanordinarydifferentialequation.Seealsodistributedparametermodel.

Page 25: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Mmodel Seedynamicsystemmodel.

Page 26: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Nnonlinearmodel

Adynamicsystemmodelthatdoesnotobeytheprinciplesofsuperpositionorhomogeneity.Seealsolinearmodel.

Page 27: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Ooffline Asimulationconfigurationinwhichyouusesoftwaretosimulate

thecontrollerandthesystemyouwanttocontrol.Nohardwareisinvolvedinanofflinesimulation.

optimaldesign

Theprocessofselectingparametervaluesthatmaximizeameasureofperformance.

OutputNode

AnoutputterminalontheSimulationLoop.UsetheOutputNodetoviewanyerrorsthesimulationdiagramgenerates.SeealsoInputNode.

Page 28: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Pparameterbounds

Anyrestrictionsyouplaceonpossibleparametervaluesduringtheoptimaldesignprocess.Theoptimaldesignprocessdoesnotconsideranyparametervaluesoutsidetheboundsyoudefine.

parameterdesign

Seeoptimaldesign.

parametermesh

Asetofpointsthatdefinesthedistributionpatternsofsetsofparametervaluesandthenumberofsetstogenerate.

period TheamountoftimeinwhichadiscretelinearSimulationfunctionmustcomplete.

physicalmodeling

Amodelingtechniqueinwhichyouusethelawsofphysicstodefineadynamicsystemmodel.Seealsoempiricalmodeling.

plant Adynamicsystemwhosebehavioryouwanttoobserve,replicate,ormanipulate.

Page 29: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

RRCP Rapidcontrolprototype.Asimulationconfigurationinwhichyou

testplanthardwarewithasoftwaremodelofthecontroller.SeealsoHIL.

Page 30: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Ssimulationdiagram

ALabVIEWdiagramthatallowsyoutouseSimulationfunctionswithinaSimulationLooporsimulationsubsystem.Asimulationdiagram,likeotherLabVIEWdiagrams,hasthefollowingsemanticproperties:Theorderofoperationsisnotcompletelyspecifiedbytheuser.Theorderofoperationsisimpliedbydatainterdependencies.Afunctioncanexecuteonlyafterallnecessaryinputshavebecomeavailable.Outputsaregeneratedafterafunctioncompletesexecution.

SimulationLoop

Thestructurethatexecutesthesimulationdiagramovermultipletimesteps.

skew TheamountoftimebywhichyouwanttodelaytheexecutionofadiscretelinearSimulationfunction.

SQP SequentialQuadraticProgramming.Ageneral-purposenumericaloptimizationalgorithm.

subsystem AsectionofasimulationdiagramyourepresentwithasingleiconinsteadofmultipleSimulationfunctionsandwires.

Page 31: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Ttime-invariantmodel

Adynamicsystemmodelwhoseparametersdonotchangewithtime.

time-variantmodel

Adynamicsystemmodelwhoseparameterschangewithtime.

trim Aprocedurethatsearchesforthevaluesofstatesandinputsthatproduceoutputand/orstatederivativeconditionsyouspecify.Seealsolinearize.

Page 32: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

BuildingandConfiguringSimulations(ControlDesignandSimulationModule)UsetheLabVIEWControlDesignandSimulationModuletobuildasimulationdiagram,whichgraphicallydisplaysadynamicsystemmodelinLabVIEW.YoubuildandexecuteasimulationdiagrambyplacingSimulationfunctionsandotherLabVIEWVIsandstructuresinsidetheSimulationLoop.Thesimulationdiagramthenusesanordinarydifferentialequation(ODE)solvertocomputethebehaviorofthedynamicsystemmodel.ThesimulationdiagramsupportsstandardLabVIEWdebuggingtechniques.Youcanuseexecutionhighlighting,breakpoints,probes,customprobes,andsingle-steppingonthesimulationdiagram.

(Windows)Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.

Page 33: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ConceptsUsethisbooktolearnaboutconceptsintheLabVIEWControlDesignandSimulationModule.RefertotheHow-Tobookforstep-by-stepinstructionsforusingtheControlDesignandSimulationModule.

(Windows)Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.

Page 34: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

UnderstandingDynamicSystemModels(ControlDesignandSimulationModule)Adynamicsystemmodelisamathematicalrepresentationofthedynamicsbetweentheinputsandoutputsofadynamicsystem.Yougenerallyrepresentdynamicsystemmodelswithdifferentialordifferenceequations.Thefollowingfigureshowsasampledynamicsystem.

Thedynamicsysteminthepreviousfigurerepresentsaclosed-loopsystem,alsoknownasafeedbacksystem.Inclosed-loopsystems,thecontrollermonitorstheoutputoftheplantandadjuststheactuatorstoachieveaspecifiedresponse.Youcanusephysicallawsorexperimentaldatatodevelopadynamicsystemmodel.Thefollowingsectionsdescribefeaturesofboththephysicalmodelingandtheempiricalmodelingtechniques.

Page 35: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

PhysicalModelsThelawsofphysicsdefinethephysicalmodelofasystem.Thefollowingsectionsdescribevariousclassificationsandfeaturesofphysicalmodels.LumpedversusDistributedParameterModelsIfyoucanuseanordinarydifferentialequationtodescribeaphysicalsystem,theresultingmodelisalumpedparametermodel.Ifyoucanuseapartialdifferentialequationtodescribeasystem,theresultingmodelisadistributedparametermodel.LinearversusNonlinearModelsDynamicsystemmodelsareeitherlinearornonlinear.Alinearmodelobeystheprincipleofsuperpositionandhomogeneity.Thefollowingequationsaretrueforlinearmodels.y1=f(u1)

y2=f(u2)

f(u1+u2)=f(u1)+f(u2)=y1+y2f(au1)=af(u1)=ay1whereu1andu2arethesysteminputs,y1andy2arethesystemoutputs,andaisaconstant.Conversely,nonlinearmodelsdonotobeytheprinciplesofsuperpositionorhomogeneity.Nonlineareffectsinreal-worldsystemsincludesaturation,dead-zone,friction,backlash,andquantizationeffects;relays;switches;andratelimiters.Manyreal-worldsystemsarenonlinear,thoughyoucanlinearizenonlinearmodelstosimplifyadesignoranalysisprocedure.Time-VariantversusTime-InvariantModelsDynamicsystemmodelsareeithertime-variantortime-invariant.Theparametersofatime-variantmodelchangewithtime.Forexample,youcanuseatime-variantmodeltodescribethemassofanautomobile.Asfuelburns,themassofthevehiclechangeswithtime.Conversely,theparametersofatime-invariantmodeldonotchangewithtime.Foranexampleofatime-invariantmodel,considerasimplerobot.Generally,thedynamiccharacteristicsofrobotsdonotchangeovershort

Page 36: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

periodsoftime.ContinuousversusDiscreteModelsDynamicsystemmodelsareeithercontinuousordiscrete.Bothcontinuousanddiscretesystemmodelscanbelinearornonlinearandtime-invariantortime-variant.Continuousmodelsdescribehowthebehaviorofasystemvariescontinuouslywithtime,whichmeansyoucanobtainthepropertiesofasystematanycertainmomentfromthecontinuousmodel.Discretemodelsdescribethebehaviorofasystematseparatetimeinstants,whichmeansyoucannotobtainthebehaviorofthesystembetweenanytwosamplingpoints.Continuoussystemmodelsareanalog.Youderivecontinuousmodelsofaphysicalsystemfromdifferentialequationsofthesystem.Thecoefficientsofcontinuousmodelshaveclearphysicalmeanings.Forexample,youcanderivethecontinuoustransferfunctionofaresistor-capacitor(RC)circuitifyouknowthedetailsofthecircuit.ThecoefficientsofthecontinuoustransferfunctionarethefunctionsofRandCinthecircuit.Youusecontinuousmodelsifyouneedtomatchthecoefficientsofamodeltosomephysicalcomponentsinthesystem.Discretesystemmodelsaredigital.Youderivediscretemodelsofaphysicalsystemfromdifferenceequationsorbyconvertingcontinuousmodelstodiscretemodels.Incomputer-basedapplications,signalsandoperationsaredigital.Therefore,youcanusediscretemodelstoimplementadigitalcontrollerortosimulatethebehaviorofaphysicalsystematdiscreteinstants.Youalsocanusediscretemodelsintheaccuratemodel-baseddesignofadiscretecontrollerforaplant.

Page 37: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

EmpiricalModelsEmpiricalmodelsusedatagatheredfromexperimentstodefinethemathematicalmodelofasystem.Tosomedegree,physicalmodelsareempiricalbecauseyouexperimentallydeterminecertainconstantsusedtodevelopthemodel.Avarietyofempiricalmodelingmethodsexist.Onemethodofempiricalmodelingusestablesofexperimentaldatathatrepresentthesystemyouwanttomodel.Anothermethodfordevelopingmodelsusessystemidentificationmethods.Systemidentificationmethodsusemeasureddatatocreatedifferentialordifferenceequationrepresentationsthatmodelthedata.

NoteYoucanusetheLabVIEWSystemIdentificationToolkittoconstructmodelsbyusingsystemidentificationmethods.

Page 38: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

LinearModelFormsYoucanusetheControlDesignandSimulationModuletorepresentcontinuousanddiscretelinearmodelsinthefollowingthreeforms:

TransferFunction—Thesemodelsusepolynomialfunctionstodefinetherelationshipbetweentheinputsandoutputsofadynamicsystem.Youanalyzetransferfunctionmodelsinthefrequencydomain.Zero-Pole-Gain—Thesemodelsaretransferfunctionmodelsthatyourewritetoshowthegainandthelocationsofthezerosandpolesofthedynamicsystem.Youanalyzezero-pole-gainmodelsinthefrequencydomain.State-Space—Thesemodelsrepresentthedynamicsystemintermsofphysicalstates.Continuousstate-spacemodelsusefirst-orderdifferentialequationstodescribethedynamicsystem,whereasdiscretestate-spacemodelsusefirst-orderdifferenceequations.Youanalyzestate-spacemodelsinthetimedomain.

Page 39: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

SISOvs.MIMOModelsWhenyouconfigureacontinuousordiscretetransferfunction,zero-pole-gain,orstate-spacefunction,youcanusetheconfigurationdialogboxtospecifywhetherafunctionissingle-inputsingle-output(SISO)ormultiple-inputmultiple-output(MIMO).SISOmodelshaveonlyoneinputandoneoutput,whereasMIMOmodelshavetwoormoreinputsoroutputs.YoumakethischoicebyselectingtheappropriateoptionfromthePolymorphicinstancepull-downmenu.

Page 40: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ConfiguringSimulationParameters(ControlDesignandSimulationModule)TheSimulationLoop,showninthefollowingfigure,containstheparametersthatdefinethebehaviorofthesimulation.

Youcanconfigurethesesimulationparametersbyusingthefollowingtwomethods:

UsingtheConfigureSimulationParametersdialogboxWiringvaluestotheInputNode

Youalsocanuseacombinationofthesetwomethodsinthesamesimulationdiagram.However,valuesthatyouprogrammaticallyconfigureoverrideanyequivalentsettingsthatyoumakeintheConfigureSimulationParametersdialogbox.

TipUsetheOutputNodetoviewanyerrorsthatoccurduringtheexecutionoftheSimulationLoop.UsetheGetSimulationParametersfunctiontodisplaytheparametersyouconfigureforthesimulation.

TheSimulationLoopisaversionoftheTimedLoop.Bothloopscaniteratedeterministicallyaccordingtoaperiodandpriorityyoudefine.However,theSimulationLoopalsoexecutesthesimulationdiagramaccordingtotheordinarydifferentialequation(ODE)solveryouchoose.TheinsideoftheSimulationLoopalsohasapaleyellowbackgroundtodistinguishthesimulationdiagramfromtheLabVIEWblockdiagram.

Page 41: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Similartootherloopsandstructures,youcanusetunnelstopassdatainandoutoftheSimulationLoop.

Page 42: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ConfiguringSimulationParametersProgrammaticallyThefollowingfigureshowshowyouconfigureasimulationdiagramprogrammatically.

ThepreviousfigureshowshowthegrayboxesontheInputNodedisplayanyvaluesthatyouconfigureintheConfigureSimulationParametersdialogbox.Valuesthatyouconfigureprogrammaticallydonothavegrayboxes.

Page 43: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

UsingSimulationFunctionsandVIs(ControlDesignandSimulationModule)TheLabVIEWControlDesignandSimulationModuleincludesbothfunctionsandVIs.TheSimulationfunctionsaretheelementsthatcompriseasimulationmodel.Usethesefunctionstoperformtaskssuchasdefiningdynamicsystemmodels,generatingandcombininginputsignals,andanalyzinganddisplayingsimulationdata.YoucanconfiguremostSimulationfunctionsusingtheconfigurationdialogboxofthatfunction.AfteryouplaceaSimulationfunctiononthesimulationdiagram,double-clickthatfunctiontolaunchitsconfigurationdialogbox.Youalsocanlaunchthisdialogboxbyright-clickingtheSimulationfunctionandselectingConfigurationfromtheshortcutmenu.Forexample,thefollowingfigureshowstheconfigurationdialogboxfortheSineSignalfunction.

TheParameterssectionlistsalltheparametersthatyoucanconfigure

Page 44: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

fortheSineSignalfunction.WhenyouselectaparameterfromtheParameterssection,theParameterInformationsectiondisplaysacontrolyoucanusetosetthevalueofthatparameter.UsetheParametersourcecontroltospecifythesourceoftheparametervalue.IfyouselectConfigurationDialogBox,LabVIEWremovesthatinputfromthesimulationdiagram.Youthenmustsetthevalueforthisparameterintheconfigurationdialogbox.IfyouselectTerminal,LabVIEWdisplaysaninputterminalforthatparameteronthesimulationdiagram,andyoucanwirevaluestothisinputtoconfiguretheSimulationfunction.TheparametersyouspecifyforaSimulationfunctionareuniquetothatfunction.Ifyoucreatemultipleinstancesofthesamefunction,youcansetdifferentparametervaluesforeachinstance.

NoteDiscretesimulationfunctionshaveadditionalparametersyouusetoconfiguretheperiodandskewofthefunction.

InadditiontotheSimulationfunctions,theControlDesignandSimulationModuleincludesVIs.UsetheseVIstoperformtasksindirectlyrelatedtothesimulation,suchastrimmingandlinearizingadynamicsystemmodelordesigningoptimalparametersforadynamicsystemmodel.

Page 45: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DynamicSimulationFunctionsThefollowingSimulationfunctionsaredynamicelementsthatdependontheordinarydifferentialequation(ODE)solveryouspecify.

IntegratorTransferFunctionZero-Pole-GainState-Space

Page 46: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ConfiguringDiscreteSimulationFunctions(ControlDesignandSimulationModule)TheDiscreteLinearSystemsfunctionshaveasampleperiod(s)parameterandasampleskew(s)parameter.Theseparametersarelocatedintheconfigurationdialogboxofthatfunction.Thesampleperiod(s)parametersetsthelengthofthestepsizeofthatfunction.Thesampleskew(s)parameterdelaystheexecutionofthatfunction.ThefollowingfigureshowshowthesetwoparametersaffecttheexecutionofadiscreteSimulationfunction.

Thesampleperiod(s)ofadiscretefunctionmustbeamultipleofthediscretestepsizeofthesimulation.Toconfigurethisoveralldiscretestepsize,double-clicktheInputNodeoftheSimulationLooptolaunchtheConfigureSimulationParametersdialogbox.OntheSimulationParameterspage,youcanentertheDiscreteStepSize(s)orautomaticallyconfigurethediscretestepsizeofthesimulation.

NoteIfyouenteravalueof–1forthesampleperiod(s)parameterofaSimulationfunction,thatfunctioninheritsthesamestepsizeasdefinedintheConfigureSimulationParametersdialogbox.

Page 47: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Generating,Collecting,andDisplayingSimulationData(ControlDesignandSimulationModule)TheLabVIEWControlDesignandSimulationModuleincludesseveralfunctionsyouusetogenerate,collect,anddisplaysimulationdata.Thefollowingsectionsprovideinformationaboutusingthesefunctions.

Page 48: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

GeneratingandCombiningSignalsUsetheSignalGenerationfunctionstogeneratemanydifferenttypesofsignals,includingsine,ramp,step,pulse,andchirpsignals.Thesefunctionsareusefulwhenyouwanttoseehowadynamicsystemrespondstoaparticulartypeofinput.Forexample,theStepSignalfunctiongeneratesastepsignal,whichyoucommonlyusetotestcontrollerperformance.EachSignalGenerationfunctionhasconfigurationoptionsyoucanusetofittheneedsofaparticularsituation.UsetheSignalArithmeticfunctionstoadd,subtract,multiply,anddividesignals.

Page 49: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

CollectingandIndexingSimulationDataTostoreallorpartofasignalhistoryovertheentiresimulationforlateranalysis,usetheCollectorfunction.Thisfunctionstoresvaluesinanarray,similartotheauto-indexingoutputtunnelofaForLoop.However,whereasLabVIEWindexesForLooparraysbytheloopiteration,theControlDesignandSimulationModuleindexesCollectorarraysbysimulationtime.Therefore,afterthesimulationfinishes,youcanseethevaluesthatcorrespondwithcertainpointsintime.TheoppositeoftheCollectorfunctionistheIndexerfunction,whichtakesanarrayofdataandreturnsthecorrectvaluebasedonthesimulationtime.Forexample,youcandefineanarbitrarysignalasanarrayoftimestampsandvaluesateachtimestamp.YouthenwirethisarraytotheInputinputofanIndexerfunction.Whenyourunthesimulation,thisfunctionreturnsthecorrectarrayvalueatthecorrecttime.Ifyoudonotdefineavalueforaspecifictime,thisfunctionlinearlyinterpolatestheexpectedresultaccordingtoseveraloptionsyoucanspecify.TheIndexerfunctionoperatessimilarlytotheauto-indexinginputtunnelofaForLoop,exceptLabVIEWindexesForLooparraysbyloopiterationinsteadofsimulationtime.

Page 50: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DisplayingSimulationDataTheSimTimeWaveformfunctionandBufferXYGraphfunctionoperatesimilarlytotheLabVIEWWaveformChartandXYGraphobjects.However,whereasLabVIEWdisplaystheloopiterationonthex-axisoftheseobjects,theSimulationversionsofthesefunctionsproperlydisplaysimulationtimeonthex-axis.Thisdistinctionisimportantwhenyouareusingavariablestep-sizeordinarydifferentialequation(ODE)solver.Inthissituation,thesimulationmightnotreturnavalueateveryloopiteration,duetochangesinthestepsize.However,theLabVIEWWaveformChartstillplotsavalueeveryloopiteration.TheSimTimeWaveformfunctioncorrectsthisbehaviorandproperlydisplaysunevenly-spacedvaluesonthex-axis.ThefollowingfigureshowshowaSimTimeWaveformChartandaLabVIEWWaveformChartdisplaytheoutputofthePulseSignalfunctionwhensimulatedfor30secondsusingavariablestep-sizeODEsolver.

Page 51: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

NoticetheirregularitiesintheLabVIEWWaveformChartwhencomparedtotheSimTimeWaveformChart.

NoteWhenyouplaceaSimTimeWaveformfunctionorBufferXYGraphfunctiononthesimulationdiagram,LabVIEWautomaticallycreatesachartorgraphobjectconnectedtothefunctionoutput.

Page 52: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

StoringPrecalculatedDatainLookupTablesLookuptablesareusefulfordefiningsetsofexperimentaldata,suchastheresultofafunction,andthenretrievingthatdatawithoutcalculatingthefunction.Ifyoustorethedatainalookuptable,thesimulationdoesnothavetocomputethefunctioneverytimestep.Instead,youcallthelookuptabletoobtaintheappropriatevalue.Inthissituation,youimprovecomputationperformancebyreducingtheneedtocalculatefunctionsateachiterationoftheSimulationLoop.Alookuptableconsistsoftwodatasets:asetoftablevaluesandacorrespondingsetofdatavalues.Whenyouspecifyaninputvalue,thelookuptablematchesthatinputvaluetoatablevalueandreturnstheappropriatedatavalue.Forexample,consideralookuptablewithtablevaluesof[015]anddatavaluesof[428].Ifyouspecifyaninputvalueof0,thelookuptablereturns4.Ifyouspecifyaninputvalueof5,thelookuptablereturns8.Youalsocanconfigurehowthelookuptableoperatesifyouspecifyaninputvaluethatdoesnotexistasatablevalue.Forexample,youcanconfigurealookuptabletointerpolateorextrapolatetheappropriatedatavaluefromtheavailabletablevalues.UsetheMethodparameteroftheLookupTablesfunctionstodefinethisbehavior.Thisexampleusesaone-dimensionallookuptable;however,theControlDesignandSimulationModulealsoincludesfunctionsthatimplementtwo-andthree-dimensionallookuptables.

Page 53: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

TransferringDataBetweenSimulationLoopIterationsUsetheMemoryfunctiontotransferthevalueofasignalfromoneiterationoftheSimulationLooptothenext.ThisfunctionbehavessimilarlytoashiftregisteryoucanplaceonaWhileLoop.ThisfunctionispolymorphicandacceptsanydatatypeyouwiretotheInitialValueinput.Toimplementafixed-timedelay,usetheDiscreteUnitDelayfunction.

Page 54: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ChangingFunctionIconStyles(ControlDesignandSimulationModule)YoucanchangetheiconstyleofaSimulationfunctiononthesimulationdiagram.Right-clickaSimulationfunctionandselectIconStylefromtheshortcutmenutodisplaythefollowingoptions:

Static—DisplaystheSimulationfunctionasastandardVI.Dynamic—DisplaystheSimulationfunctionasanobjectthatyoucanresize.Dynamiciconsalsodisplayapreviewoftheircontents.Forexample,aSineSignalfunctionwithadynamicicondisplaysasinewavewiththefrequency,amplitude,andphasethatyouconfigure.TextOnly—DisplaystheSimulationfunctionasalistofparametervalues.Express—DisplaystheSimulationfunctionwithalistofparametersbelowtheicon.Youcanresizetheparameterlisttodisplaymoreinputsandoutputs.Thisiconstylealsoshowsparametervaluesdirectlyonthesimulationdiagram.

Page 55: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DeterminingFeedthroughBehaviorandDefiningFeedbackCycles(ControlDesignandSimulationModule)TherelationshipbetweenafunctioninputandoutputdefinesthefeedthroughbehaviorofthatI/Opair.AnI/Opaircanhaveindirect,direct,orparameter-dependentfeedthroughbehavior.IfanI/Opairhasindirectfeedthroughbehavior,youcancreateafeedbackcyclebetweenthatinputandoutput.AnI/Opairwithdirectfeedthroughbehaviordoesnotallowafeedbackcycle.Thefollowingsectionsprovidemoreinformationaboutthesebehaviors.

Page 56: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

IndirectFeedthroughandFeedbackCyclesWhereasLabVIEWVIsexecuteonlyafterreceivingthevalueofallinputstothatVI,manySimulationfunctionscanexecutewithoutreceivingthevalueofcertaininputs.ConsideraSimulationfunctionwithinputuandoutputy.Atanytimestep,ifthefunctiondoesnotrequirethevalueofutocomputethevalueofy,uhasindirectfeedthroughtoy.Whenindirectfeedthroughexistsbetweenuandy,youcancreateafeedbackcyclebetweentheseparameters.Inafeedbackcycle,thevalueofyattimetreliesonthevalueofuattimet–dt,t–dt2,andsoon.

Forexample,theinputparameteroftheIntegratorfunctionhasindirectfeedthroughtotheoutputparameter.Youcancreateafeedbackcyclebetweenthisinputandoutput.Thefollowingfigureshowsthisbehavior:

YoucanuseoneormoreSimulationfunctionsandotherLabVIEWfunctionsinafeedbackcycleaslongasatleastoneSimulationfunctioninthefeedbackcyclehasindirectfeedthroughbehavior.Theindirectfeedthroughfunctioncanstartthedataflowbyexecutingthefunctionoutputatthecurrentstepbeforereceivinganinputfromthecycleatthecurrentstep.Therefore,theinputatthecurrentstepandtheoutputatthecurrentstepmustnotdependoneachotherdirectlyinatleastonefunctioninthecycle.ThefollowingSimulationfunctionshaveatleastoneI/Opairwithindirectfeedthrough.

DiscreteKalmanFilterDiscreteObserver

Page 58: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DirectFeedthroughIfafunctionoutputyrequiresaninputuinordertoexecute,uhasdirectfeedthroughtoy.Youcannotcreateafeedbackcyclebetweeninputsandoutputswithdirectfeedthrough.Forexample,theinitialconditionparameteroftheIntegratorfunctionhasdirectfeedthroughbehaviortotheoutputparameter.Thisfunctionrequiresavaluefortheinitialconditionparameterinordertocalculatetheoutputparameter.Otherfunctions,suchasFriction,requirethevaluesofallinputsinordertoexecute.Ifyouattempttocreateafeedbackcyclebetweenaninputandoutputwithdirectfeedthrough,thewireappearsbroken.Thefollowingfigureshowsthisbehavior:

Noticethedifferencebetweenthepreviousfigureandthefigureshowingthefeedbackcycle.

Page 59: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Parameter-DependentFeedthroughSeveralfunctionshavefeedthroughbehaviorthatdependsonhowyouconfiguretheparametersofthatfunction.Forexample,considertheTransferFunctionfunction.Thefeedthroughbehaviorofthisfunctiondependsontheorderofthenumeratoranddenominatorpolynomialequationsyouspecify.ThefollowingSimulationfunctionshaveatleastoneI/Opairwithparameter-dependentfeedthrough.

TransferFunctionZero-Pole-GainState-SpaceDiscreteFilterDiscreteIntegratorDiscreteTransferFunctionDiscreteZero-Pole-GainDiscreteState-Space

Ifyouusetheconfigurationdialogboxtodefinetheparametersofthesefunctions,suchasthenumeratoranddenominatorofatransferfunction,LabVIEWautomaticallydeterminestheappropriatefeedthroughbehavioranddisplaysthischoiceintheFeedthroughpull-downmenu.However,ifyouuseblockdiagramterminalstodefinetheparametersofthesefunctions,youmustsetthefeedthroughbehaviormanually.AllSimulationfunctionsnotmentionedinthissectionorintheIndirectFeedthroughandFeedbackCyclessectionhavedirectfeedthrough.

Page 60: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

PlacingLabVIEWVIs,Functions,andStructuresontheSimulationDiagram(ControlDesignandSimulationModule)YoucanuseamajorityofLabVIEWVIsandfunctionstodescribeadynamicsystemmodel.However,youcannotplacecertainstructures,suchastheWhileLoop,ForLoop,orEventstructure,directlyonthesimulationdiagram.Instead,youcanplacethesestructuresinasubVI,whichyouthenplaceonthesimulationdiagram.Bydefault,theControlDesignandSimulationModuleexecutesVIsandExpressVIsascontinuousfunctions.YoucanchangethisbehaviorbyusingtheSubVINodeSetupdialogbox.Tolaunchthisdialogbox,right-clicktheobjectandselectSubVINodeSetupfromtheshortcutmenu.YoucanconfigureaVItoexecuteatonlymajortimestepsoftheODEsolver,atbothmajorandminortimestepsoftheODEsolver,asadiscretefunction,oratinitializationofthesimulationdiagram.

Page 61: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

UsingCaseStructuresontheSimulationDiagramYoucanplaceaCasestructuredirectlyonthesimulationdiagram.Thevalueyouwiretotheselectorterminaldetermineswhichmodeltoevaluate.Ifaninput-outputpaironanysubdiagramofthecasestructurecontainsdirectfeedthrough,youcannotcreateafeedbackcyclebetweenthatinputandoutput.NationalInstrumentsrecommendsyouuseafixedstep-sizeordinarydifferentialequation(ODE)solverwhenusingaCasestructureonthesimulationdiagram.

NoteYoucannotplacefrontpanelterminalsinsideaCasestructureonasimulationdiagram.

Page 62: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

How-ToThisbookcontainsstep-by-stepinstructionsandotherinformationthatmightbeusefulasyouusetheLabVIEWControlDesignandSimulationModule.RefertotheConceptsbooktolearnaboutrelatedconcepts.

(Windows)Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.

Page 63: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ModularizingtheSimulationDiagram(ControlDesignandSimulationModule)TheLabVIEWControlDesignandSimulationModulesupportssimulationsubsystems,whichyouusetomodularizeandencapsulateportionsofthesimulationdiagram.YoucreatesimulationsubsystemssimilarlytocreatingsubVIs.

(Windows)Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.

Page 64: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

TypesofSimulationSubsystems(ControlDesignandSimulationModule)Simulationsubsystemsprovideawaytomodularizesimulationdiagramcode.Bycombiningseveralfunctionsintoasubsystem,youreducetheamountofspaceneededonthesimulationdiagram,makingthesimulationeasiertonavigatevisually.Simulationsubsystemsalsoareusefulforvalidating,distributing,andreusingportionsofthesimulationdiagram.YoucanusemanySimulationVIsandfunctionsonlyonasimulationdiagram,suchaswithinaSimulationLoop.Becausesimulationsubsystemsmodularizesimulationdiagramcode,youcanusetheSimulationVIsandfunctionsinsimulationsubsystemsaswell.TheentireblockdiagramofasimulationsubsystemispaleyellowliketheinsideofaSimulationLoop.WhenyouuseSimulationVIsandfunctionsinasimulationsubsystem,youplacetheVIsandfunctionsdirectlyonthesubsystemblockdiagramratherthanwithinaSimulationLoop.Youcanrunsimulationsubsystemsasstand-aloneVIs,withinaSimulationLooporanothersimulationsubsystem,oronablockdiagramoutsideaSimulationLoop.

Page 65: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

RunningaSubsystemasaStand-AloneVIWhenyourunasimulationsubsystemasastand-aloneVI,youconfigurethesimulationparametersbyselectingOperate»ConfigureSimulationParameterstolaunchtheConfigureSimulationParametersdialogbox.YoualsocanconfiguretheexecutionandappearanceofthesubsystembyselectingFile»VIProperties.Whenrunningasimulationsubsystemasastand-aloneVI,youcanusestandardLabVIEWdebuggingtechniques,suchasexecutionhighlighting,breakpoints,probes,andsingle-stepping.YoucannotusethesetechniquesonasubsystemthatiswithinanotherSimulationLoop.Youalsocannotstepintothesubsystem.However,youcansetabreakpointontheentiresubsystembyright-clickingthesubsystemandselectingBreakpoint»SetBreakpointfromtheshortcutmenu.Youalsocanuseaprobeoracustomprobetomonitorthesubsystemoutput.ThefollowingfigureshowsthesimulationdiagramofasimulationsubsystemNewton.vi,whichobtainsthepositionofamassbyusingNewton'sSecondLawofMotion.

Inthepreviousfigure,thissubsystemhasfrontpanelcontrolsandindicators,soyoucanrunthissubsystembyclickingtheRunbutton.BecauseNewton.vidoesnothaveaSimulationLoop,youconfigurethe

Page 66: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

parametersofthissubsystembyselectingOperate»ConfigureSimulationParameters.

Page 67: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

RunningaSubsysteminaSimulationLoopIfyourunasimulationsubsysteminsideaSimulationLoop,thesimulationsubsysteminheritstheparametersfromtheSimulationLoop.ThefollowingfigureshowsNewton.viincludedwithintheSimulationLoopofanothersimulationdiagram.

Inthepreviousfigure,theparametersoftheSimulationLoopoverrideanyparametersyouconfiguredspecificallyforNewton.vi.

NoteYoucreatethissubsystemandthisVIintheGettingStartedwithSimulationtutorial.

Page 68: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

RunningaSubsystemOutsideaSimulationLoopIfyourunasimulationsubsystemonablockdiagramoutsideaSimulationLoop,thesimulationsubsystemexecutesonestepoftheordinarydifferentialequation(ODE)solvereachtimethesimulationsubsystemiscalled.Forexample,ifyouplacethesimulationsubsysteminaTimedLoop,onestepoftheODEsolverexecutesateachiterationoftheloop.Youcanuseonlyfixedstep-sizeODEsolversforasimulationsubsystemoutsideaSimulationLoop.SpecifythetimestepusingtheStepSize(s)configurationoptionofthesubsystem.

TipIfyoucreateanapplicationwithasimulationsubsysteminsideaTimedLoopandthendeploytheapplicationtoareal-timetarget,settheStepSize(s)ofthesubsystemequaltotheperiodoftheTimedLoop.

WhenyouplaceasimulationsubsystemonablockdiagramoutsideaSimulationLoop,theiconofthesimulationsubsystemappearsintheExpressstylebydefault.Youcanwirevaluestotheparametersofthesimulationsubsystemtoconfigurethesimulationsubsystemprogrammatically.

NoteTheStaticandDynamiciconstylesaredisabledforsubsystemsoutsideaSimulationLoop.

Youalsocanconfiguretheparametersofthesimulationsubsysteminteractively.Double-clickthesimulationsubsystemtolaunchtheconfigurationdialogboxofthatsimulationsubsystem.Inthisconfigurationdialogbox,youcanconfigurethespecificparametersofthesimulationsubsystemaswellasthefollowinggeneralsimulationparameters:

InitialTime(s)—SpecifiesthetimeatwhichtostarttheODEsolver.ODESolver—SpecifiesthetypeofODEsolverthesimulationuses.Nan/InfCheck—SpecifiesthatyouwanttheControlDesignandSimulationModuletocheckthesimulationvaluesfornotanumber(NaN)andinfinite(Inf)values.TheControlDesignandSimulationModulereturnsanerrorifitencountersaNaNorInfvalue.

Page 69: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

StepSize(s)—Specifiestheinterval,inseconds,betweenthetimesatwhichtheODEsolverevaluatesthemodelandupdatesthemodeloutput.DiscreteStepSize(s)—Specifiesthebasetimestepsize,inseconds,forthesimulation.AutoDiscreteTime—AutomaticallycalculatestheDiscreteStepSize(s).

TheseparametersareidenticaltoparametersyoucanconfigureintheConfigureSimulationParametersdialogboxofaSimulationLoop.Intheconfigurationdialogboxofasimulationsubsystem,theseparametersappearassub-itemsoftheSimulationParametersitemintheParameterstree.Ifthesimulationsubsystemalreadycontainsaparameterwiththesamenameasoneofthegeneralsimulationparameterslistedabove,LabVIEWappendsthegeneralsimulationparameternamewithanunderscore.ThefollowingfigureshowsNewton.vionablockdiagramoutsideaSimulationLoop.

Page 70: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Inthepreviousfigure,theTimedLoopdetermineswhenNewton.viexecutesthenextstepoftheODEsolver.BecauseNewton.viisoutsideaSimulationLoop,youcanconfigurethesimulationparameters,includingtheODEsolvertouse,bydouble-clickingthesimulationsubsystem.IfyourunasimulationsubsystemoutsideaSimulationLoop,youcanreinitializethesimulationsubsystembysettingtheInitializeinputofthesimulationsubsystemtoTRUE.ThisinputrestartstheODEsolverfromthespecifiedInitialTime(s).TheInitializeinputisavailableforasimulationsubsystemonlywhenthesubsystemisnotinsideaSimulationLooporanothersimulationsubsystem.

Page 71: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

PolymorphicSubsystemsIfyoucreateoneormoresubsystemsthatperformthesameoperationondifferentdatatypes,youcanpackagethosesubsystemstogethertocreateapolymorphicsubsystem.ApolymorphicsubsystemisasingleVIthatpointstooneormoresubsystems,calledinstances.Eachinstanceacceptsadifferentdatatypeforasingleinputoroutputterminal.LabVIEWautomaticallyselectsthecorrectinstancebasedontheinputdatatype.Forexample,onesubsystemcouldoperateonadouble-precisionfloatingpointnumber,whileanothersubsystemperformsthesameoperationona16-bitinteger.Insteadofplacingbothsubsystemsonthesimulationdiagram,youcancreateapolymorphicsubsystemthatautomaticallychoosesthecorrectinstance.Forapolymorphicsubsystemtowork,eachinstanceofthepolymorphicsubsystemmustbeasimulationsubsystem.YoucannotcreateapolymorphicsubsystemwithbothVIsandsubsystemsasinstances.Also,eachsubsystemmusthaveanidenticalconnectorpanepattern.Additionally,thenamesofcorrespondinginputparametersforeachinstancemustbeidentical.

Page 72: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

TrimmingandLinearizingNonlinearModels(ControlDesignandSimulationModule)Manyreal-worlddynamicsystemmodelsarenonlinear.Ifyouwanttodesignacontrollerforanonlinearmodel,youmustfirstlinearizethatmodel.Linearizinganonlinearmodelinvolvesapproximatingthebehaviorofthatmodelaroundanoperatingpoint.Theoperatingpointisthesetoftheinputsandstatesofthemodel.Whenyoulinearizeamodel,theresultisalineartime-invariant(LTI)state-spacemodel.

NoteYoucandesignacontrollerforLTImodelsusingtheControlDesignVIsandfunctions.

Trimmingamodelinvolvessearchingforvaluesofmodelinputsandstatesthatsatisfyanyconditionsyouspecify.Forexample,youcanspecifythatthemodeloutputsorstatederivativesmusthaveacertainvalue.Trimmingthemodelusingtheseconditionsreturnsthevaluesoftheinputsandstatesthat,whengiventothemodel,producetheoutputsandstatederivativesyouspecified.Youalsocantrimamodeltodetermineanoperatingpointaboutwhichyoulinearizethemodel.TheLabVIEWControlDesignandSimulationModuleprovidesseveralmethodsfortrimmingandlinearizingmodels.Youcaninteractivelytrimandlinearizeamodel.Youalsocanprogrammaticallytrimandprogrammaticallylinearizeamodel.

NoteTheabovemethodsoperateoncontinuoussimulationsubsystems.Therefore,youmustcreateasimulationsubsystemthatrepresentsthemodelbeforetrimmingorlinearizingthatmodel.

(Windows)Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.

Page 73: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ExecutingSimulationsinRealTime(ControlDesignandSimulationModule)YoucanusetheLabVIEWControlDesignandSimulationModulewiththeLabVIEWReal-TimeModuleandvariousNationalInstrumentsreal-time(RT)targetstoimplementsimulationsandcontrollersinrealtimewithreal-worldinputsandoutputs.Forexample,youcancombinethissoftwareandhardwaretodesignandimplementarapidcontrolprototype(RCP)orhardware-in-the-loop(HIL)configuration.YouconfigurethetimingSimulationLoopaccordingtotheneedsofthesimulation.TheControlDesignandSimulationModulecanexecuteVIsonhardwaretargetsrunningthereal-timeoperatingsystem(RTOS)oftheArdencePharLapEmbeddedToolSuite(ETS)orWindRiverVxWorks.

NoteTheControlDesignandSimulationModulesupportsonlyETSandVxWorkstargetswithatleast32MBofRAM.

TheReal-TimeModuleincludestheGettingStartedwiththeLabVIEWReal-TimeModulemanual,whichintroducestheconceptsnecessarytocreatereal-timeapplications.TheReal-TimeModuledocumentationalsoincludestopicsaboutorganizingandmanagingprojects,creatingdeterministicapplications,andsharingdataindeterministicapplications.

(Windows)Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.

Page 74: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Offline,RCP,andHILConfigurations(ControlDesignandSimulationModule)Thefollowingsectionsprovideanoverviewoftheprocessyoumightusetosimulateadynamicsystem.Thefollowingsectionsalsodescribeexamplesofofflinesimulations,rapidcontrolprototyping(RCP)configurations,andhardware-in-the-loop(HIL)configurations.

Page 75: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

OfflineSimulationAnofflinesimulationisonethatisnotconnectedtoanyhardware.YouusetheLabVIEWControlDesignandSimulationModuletosimulateallpartsofthedynamicsystem,includingthecontroller,thesystemyouwanttocontrol,andanyinputsoroutputs.Thefollowingfigurerepresentsasimulationofanofflinecontrolsystem.

IfyouarerunninganofflinesimulationonaWindowscomputer,NationalInstrumentsrecommendsyouplaceacheckmarkintheSynchronizeLooptoTimingSourcecheckboxontheTimingParameterspageoftheConfigureSimulationParametersdialogboxforoptimalperformance.

Page 76: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

RapidControlPrototypeConfigurationAnRCPconfigurationreplacesthesimulatedsystemwithanactualsystem.Usethisconfigurationtotestmultiplecontrolleralgorithmswithoutbuildingthecontrolleragaineverytimeyoumakeachange.Inthissituation,thesimulatedcontrollerisconnectedtohardwareactuatorsandhardwaresensors.ToconvertanofflinesimulationtoanRCPconfiguration,removethesystemmodelfromthesimulation.Replacethesysteminputwithanoutputfromahardwaredevice,andreplacethesystemoutputwithaninputfromahardwaredevice.ThefollowingfigurerepresentsanRCPconfiguration.

Inthepreviousfigure,thesimulatedcontrollerusesNationalInstrumentsreal-timehardware,suchasaDAQdevice,tosenddatatothehardwaresystem.

Page 77: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Hardware-in-the-LoopConfigurationAHILconfigurationinvolvestheactualcontrollerprovidinginputtoasimulatedsystem.Usethisconfigurationtotestacontrolleronasystemwithoutactuallyhavingthatsystemavailable.Forexample,ifyouweretestinganenginecontrolunit(ECU)foracar,youcouldtesttheECUwithouthavingtobuildthecarmultipletimes.HILconfigurationsalsoareusefulfortestingcontrollersunderextremeconditionsthatyoucannotreplicateconvenientlyinalaboratory.ToconvertanofflinesimulationtoaHILconfiguration,removethecontrollermodelfromthesimulation.Replacethecontrollerinputwithanoutputfromahardwaredevice,andreplacethecontrolleroutputwithaninputfromahardwaredevice.TheresultissimilartotheRCPconfiguration,exceptwiththecontrollermodel,notthesystemmodel,replacedwithphysicalhardwareinputsandoutputs.ThefollowingfigureshowsaHILconfigurationoftheexampleinthepreviousfigure.

Inthepreviousfigure,thecontrollerusesNationalInstrumentsreal-timehardware,suchasaDAQdevice,tosenddatatothesimulatedsystem.

Page 78: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DeterministicODESolvers(ControlDesignandSimulationModule)Runningasimulationorcontrollerinrealtimemeansthatthesimulationtimemustequalthewall-clocktimeateachpointthatthesimulationorcontrollerinteractswiththerealworld.Generally,thesephysicalinteractionpointscorrespondtothesamplingpointsoftheinputandoutputhardware.Therefore,ateachsamplingtime,thesimulationtimemustequalthewall-clocktime.Tomeetthereal-timedeadline,youcanconfiguretheLabVIEWControlDesignandSimulationModuletoexecutedeterministicallybyplacingastrictupperboundontheexecutiontimeoftheSimulationLoop.NationalInstrumentsalsorecommendsyouconfiguretheSimulationLooptouseafixedstep-sizeordinarydifferentialequation(ODE)solver.TheseODEsolversaredeterministic,whichensuresthatblockdiagramcoderunningateachtimestepmeetsthedeadlinesimposedbythetimingofthehardwareinputsandoutputs.TheControlDesignandSimulationModuleincludesthefollowingdeterministicODEsolvers:

Runge-Kutta1RungeKutta2Runge-Kutta3Runge-Kutta4DiscreteStatesOnly

Variablestep-sizeODEsolversarenotappropriateforreal-timeapplicationsbecausethesesolversadjustthestepsizebasedontheestimatederrorofthesolution.Thisadjustmentrequiresadditionalcomputationalresources,whichcaninterferewiththetimingrequirementsofareal-timeapplication.

Page 79: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ConsiderationsforETSTargets(ControlDesignandSimulationModule)IfyouareexecutingasimulationonanArdencePharLapEmbeddedToolSuite(ETS)target,NationalInstrumentsrecommendsyoulettheLabVIEWControlDesignandSimulationModulecalculatethenecessaryvalueofthesimulationperiod.Toautomaticallycalculatetheperiod,placeacheckmarkintheAutoPeriodcheckbox,whichislocatedontheTimingParameterspageoftheConfigureSimulationParametersdialogbox.Whenyoufollowthisprocedure,othertaskscantocontinuetoexecutewhenthesimulationisnotscheduledtoexecute.

Page 80: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

LabVIEWProjectsandSharedVariables(ControlDesignandSimulationModule)Toexecuteasimulationonareal-time(RT)target,youmustcreateaproject.AprojectprovidesawaytomanageVIs,RTtargets,dependencies,buildspecifications,andotherfilesrelatedtotheproject.UsetheProjectExplorerwindow,availablebyselectingFile»NewProject,tomanagethecontentsofaproject.Anothercomponentofareal-timesimulationisthesharedvariable.YoucreatesharedvariablestosimplifytheprocessofsharinglivedatabetweentheWindowscomputerandtheRTtarget.FormoreinformationabouttheLabVIEWprojectandthesharedvariable,includingtutorialsthatintroduceyoutotheseconcepts,refertotheGettingStartedwiththeLabVIEWReal-TimeModuledocument,locatedinthelabview\manualsdirectory.IfyouhavenotinstalledtheLabVIEWReal-TimeModule,youcanaccessthisdocumentatni.com/manuals.

Page 81: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

OptimizingDesignParameters(ControlDesignandSimulationModule)Oneimportantapplicationofsimulatingdynamicsystemmodelsisusingthesimulationtodetermineparametervaluesthatmaximizesomemeasureofperformance.TheLabVIEWControlDesignandSimulationModuleincludestheSIMOptimalDesignVI,whichyoucanusetoobtainparametersthatminimizeacostfunctionwhilesatisfyingconstraintsonadynamicsystem.YoucanusethisVIwithbothlinearandnonlinearsystems,althoughtheControlDesignandSimulationModuleincludespre-definedoptionsforonlylinearsystems.Designproblemscanrangefromdesigningphysicalelements,suchassprings,todesigningmoreabstractelementssuchascontrollersordigitalfilters.Correspondingly,performancespecificationsmightrangefromsimplemechanicallimitsonoutputstomoresophisticatedrequirementssuchasfrequencydomainnormsforcontrolledsystems.Forexample,whendesigningasuspensionsystemforacar,youmustselectastiffnessconstantforaspringandadampingconstantforadissipativeelement.Thegoalistofindaparametersetthatprovidesmaximumcomfort.Thisoptimalparametersetcorrespondstoaperformancemeasure,suchastheaveragedeviationofthepassengerfromadesiredheightasthecartravelsdowntheroad.Youuseparameterdesigntodeterminethisoptimalparametersetwhiletakingintoaccountthedynamicsofthesystemandtheexpectedoperatingconditionsanddisturbances.Youcanuseseveraltechniquestodeterminethisparameterset.Forsomeproblems,youmightbeabletocomputetheoptimumanalytically.However,analyticalsolutionstypicallyaredifficultorimpossibletocompute.Insuchcases,youcanusenumericaloptimizationinstead.ApowerfulandgeneralpurposenumericaloptimizationalgorithmisSequentialQuadraticProgramming(SQP).TheSIMOptimalDesignVIusesthisalgorithm.ThisVIprovidesdomain-specificfunctionsyoucanusetoperformparameteroptimizationfordesignpurposes.Specifically,youcanusethisVItodetermineoptimalparametersfromfinite-horizontime-domaindynamicssimulations.Thefollowingexpressionsdefinethenonlinearoptimizationproblem.min(J(p))

Page 82: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

hl≤H(p)≤hupl≤p≤puwherepisaparametervalue,J(p)isacostfunction,andH(p)isasetofconstraints.TheobjectiveoftheSQPalgorithmistominimizeJ(p)andsatisfytheconstraintsdefinedbyhl≤H(p)≤huwhilekeepingpwithinspecifiedminimumandmaximumvalues.DesigningasystemusingtheSQPalgorithminvolvesthefollowingsteps:

1. Constructingthedynamicsystemmodelandspecifyingthecomponentofthatmodelforwhichyouwanttofindoptimalparametervalues.

2. Definingaperformancemeasure,alsoknownasacostfunction,youwanttominimize.

3. Defininganyconstraintsonthedynamicsystemthatanyfeasibleparametervaluesmustsatisfy.

4. Definingminimumandmaximumvaluesforeachparameter.5. Definingasetofinitialparametervaluesandaninitialparameters

mesh,whichgeneratesadditionalsetsofinitialparametervalues.6. ExecutingtheSQPalgorithm,usingtheinformationyouspecified

insteps1through5,byrunningtheSIMOptimalDesignVI.Thecostfunction,inequalityconstraints,andcomponenttooptimizemakeuptheProblemSpecificationparameteroftheSIMOptimalDesignVI.Foreachoption,youcanchoosefrompre-definedtypesorspecifyacustomizedversion.

NoteTheControlDesignandSimulationModuleincludesacasestudythatdeterminestheoptimalparametersforaproportional-integral-derivative(PID)controller.

Page 83: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ConstructingtheDynamicSystemModel(ControlDesignandSimulationModule)Bydefault,theSIMOptimalDesignVIcomputesoptimaldesignparametersforaproportional-integral-derivative(PID)controllerplacedinaclosed-loopdynamicsystem.Thefollowingfigureshowsthiscontrollerandthedynamicsystemstructure.

F1,F2,C,G1,G2,andSconsistoftransferfunctionsandassociatedinformation,suchasdelaysandsamplingtime.YoucanusetheSIMConstructDefaultSystemVItoconstructthesetransferfunctionsandspecifyreferenceinputsignalsr,ru,andry.ThisVIreturnsthenecessarydynamicsysteminformationintheSystemDataoutput,whichyouthencanwiretotheSystemDatainputoftheSIMOptimalDesignVI.TheSIMOptimalDesignVIthenexcitesthesystemusingthedefinedinputsandobtainsthetimeresponse.UsetheSystemresponsetypeparameteroftheSIMOptimalDesignVItospecifyifyouwantthisVItoreturnoptimalparametervaluesforC,F1,orF2.Bydefault,CisaparallelPIDcontrollerdefinedbythefollowingequation:

where =0.01,Uisthecontrolaction,sistheLaplacevariable,andKP,KI,andKDaretheproportional,integral,andderivativegains,respectively.YoualsocandefineacustomtypeofsystemresponsedatayouwanttooptimizebyusingVItemplates.Toaccessthesetemplates,select

Page 84: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

File»NewtolaunchtheNewdialogbox.ThenselectVI»FromTemplate»Simulation»OptimalDesignfromtheCreateNewtree.Double-clickSystemResponse(ModifyControllerOnly)tomodifyonlythestructureofthecontroller.Double-clickSystemResponse(General)todefineanewdynamicsystemstructure.Ifyoudefineanewdynamicsystemstructure,theblockdiagramcodeyouwritemustgeneratetheoutputvectoryandthetimevectorTime.Thecodealsomustgeneratethecontrolactionvectoruunlesstheoptimizationproblemdoesnotrequireacontrolaction.Forexample,ifyouusetheSIMOptimalDesignVItodesignthephysicalparametersofamechanism,youdonotneedtospecifyacontrolaction.Inthissituation,ensurethecostfunctionandinequalityconstraintsyouspecifydonottakeacontrolactionintoaccount.

Page 85: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DefiningaCostFunction(ControlDesignandSimulationModule)Acostfunctionistheperformancemeasureyouwanttominimize.Examplesofcostincludetotalpowerconsumption,integratederror,anddeviationfromareferencevalueofasignal.Thecostfunctionisafunctionalequation,whichmapsasetofpointsinatimeseriestoasinglescalarvalue.Thisscalarvalueisthecost.UsetheCosttypeparameteroftheSIMOptimalDesignVItospecifythetypeofcostfunctionyouwantthisVItominimize.TheLabVIEWControlDesignandSimulationModuleincludesthefollowingtypesofcostfunctions:

IE—Acostfunctionthatintegratestheerror.IAE—Acostfunctionthatintegratestheabsolutevalueoftheerror.ISE—Acostfunctionthatintegratesthesquareoftheerror.ITAE—Acostfunctionthatintegratesthetimemultipliedbytheabsolutevalueoftheerror.ITE—Acostfunctionthatintegratesthetimemultipliedbytheerror.ITSE—Acostfunctionthatintegratesthetimemultipliedbythesquareoftheerror.ISTE—Acostfunctionthatintegratesthesquareofthetimemultipliedbythesquareoftheerror.LQ—Alinearquadraticcostfunction.SumofVariances—Acostfunctionbasedonthevarianceoftheerrormultipliedbythevarianceofthecontrolaction.

YoualsocandefineacustomcostfunctionusingaVItemplate.Toloadthistemplate,intheNewdialogbox,selectVI»FromTemplate»Simulation»OptimalDesign»ComputeCostfromtheCreateNewtree.Theblockdiagramofthistemplatecontainsseveralparametersincludingthecontrolactionu,thedynamicsystemoutputy,anarrayofinputsignals,andatimeseriesvector.Youalsocanspecifyanyweightsonanypartofthecostfunction.

Page 86: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

Afteryoudefinetheseparameters,youcanwriteLabVIEWblockdiagramcodetomanipulatetheparametersaccordingtothecostfunction.Forexample,thefollowingequationdefinestheIEcostfunction.

wheree(t)isthemeasurederror,Nisthetotalnumberofsamplesinthetimeresponse,nisthecurrenttimeresponsesample,andiistheindexofthecurrentoutput.YoucanviewtheVIthatimplementsthiscostfunctioninthelabview\vi.lib\Simulation\OptimizationBasedDesign\Costdirectory.

NoteIfyoucreateacostfunctionVIthatdoesnottakethecontrolactionintoaccount,donotdeletetheuparameterfromtheblockdiagram.DeletingthisparameterbreakstheconnectorpanestructureonwhichtheSIMOptimalDesignVIdepends.Instead,leavetheparameterunwired.

AfteryousavethecustomcostfunctionasaVI,youmustspecifythelocationofthecustomfunctionintheProblemSpecificationparameteroftheSIMOptimalDesignVI.SelectUserdefinedfortheCosttypeparameterandspecifythepathtotheVIintheFilepathuserdefinedcustomcostcalculationpathcontrol.

Page 87: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DefiningInequalityConstraints(ControlDesignandSimulationModule)Inequalityconstraintsrepresenttrade-offsimplicitintheproblemspecification.Forexample,youmightbeabletoremoveerrorsinacontrolloopbyapplyingaverylargecontrolaction.However,thenecessarycontrolactionmightbeimpossibletoachieveintherealworld.IfyouspecifyconstraintsonthecontrolactionbeforeexecutingtheSequentialQuadraticProgramming(SQP)algorithm,youcaneliminateoptimalvaluesthatrequireanunfeasiblecontrolaction.

NoteConstraintsaddagreatdealofcomplexitytotheoptimizationproblem.Ifpossible,minimizethenumberofconstraintsbeforeexecutingtheSQPalgorithm.Onestrategytominimizethenumberofconstraintsinvolvesfirstfindingoptimalvalueswithnoconstraints,thengraduallyaddingconstraintsanddeterminingtheleastamountofconstraintsrequiredforthedynamicsystem.

Becausetheoptimizationproblemisbasedonafinite-horizontime-domainsimulation,youspecifytheinequalityconstraintsasenvelopesthatboundthetimeresponseofthecontrolactionandtheoutput.Youalsocanplaceinequalityconstraintenvelopesontherateofchangeofthecontrolactionandtherateofchangeoftheoutput.Theseenvelopesarepiecewiselinearcurvesthatspecifytheupperandlowerlimitsonasignalduringthesimulation.TheSIMOptimalDesignVIthencalculatesH(p)astheminimumandmaximumdistanceofthetimeseriespointsfromtheseenvelopes.UsetheInequalityConstraintsparameteroftheSIMOptimalDesignVItodefinetheseenvelopes.Thisparameterspecifiestheupperandlowerconstraintenvelopesonthefollowingfourareasofthedynamicsystem:thecontrolaction,theoutput,therateofchangeofthecontrolaction,andtherateofchangeoftheoutput.

NoteYoucanusetheGraphicallySpecifyInequalityConstraintsVI,locatedinthelabview\examples\ControlandSimulation\Simulation\OptimalControlDesign\GraphicallySpecifyInequalityConstraintsdirectory,todrawtheupperandlowerenvelopes.ThisVIreturnsasetofpointsyouthencanwiretothe

Page 88: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

InequalityConstraintsparameter.

Forexample,consideranoutputyi(t)constrainedbyenvelopes,asshowninthefollowingfigure.

A,B,C,andDarepointsthatdefinetheupperenvelopeUEi(t),andE,F,G,andHarepointsthatdefinethelowerenvelopeLEi(t).TheSIMOptimalDesignVIthenconstrainsyi(t)tothefollowingrelationship:

LEi(t)<yi(t)<UEi(t)

ThisVIencodesthisconstraintbycomputingtheclearancebetweentheoutputandeachenvelope.TheupperclearanceUCiisdefinedasmax(UEi(t)–yi(t)).ThelowerclearanceLCiisdefinedasmax(yi(t)–LEi(t)).Theseclearancesclarifythattheconstraintsmustbepositive,asthefollowingrelationshipsshow:–ε<UCi<∞

–ε<LCi<∞

whereε=1E–21.Youalsocanplaceconstraintsontherateofchangeofcontrolactionsandoutputs.Ifatleastfivepointsareavailable,thisVIcomputestheseratesofchangeusingthefollowingequation:

wheretisthesimulationtime,histhespacebetweentimesteps,andf(t)

Page 89: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

isanoutputorcontrolactionsignal.Atboundaries,oriffewerthanfivepointsareavailable,thisVIusesthefollowingequationsinstead:

or

YoucanuseaVItemplatetospecifycustomcalculationsforimplementingtheinequalityconstraints.Toloadthistemplate,intheNewdialogbox,selectVI»FromTemplate»Simulation»OptimalDesign»ComputeInequalityConstraintsfromtheCreateNewtree.Toseeanexampleofhowtodefineandmanipulatetheseparameters,opentheSIMoptComputeInequalityConstraints(Default)VI,locatedinthelabview\vi.lib\Simulation\OptimizationBasedDesign\Constraintsdirectory.ThisVIimplementstheinequalityconstraintsthepreviousequationsspecified.AfteryousavethecustominequalityconstraintcalculationsasaVI,youmustspecifythelocationofthecustomfunctionintheProblemSpecificationparameteroftheSIMOptimalDesignVI.SelectUserdefinedfortheInequalityconstraintstypeparameterandspecifythepathtotheVIintheFilepathuserdefinedinequalityconstraintspathcontrol.

Page 90: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DefiningParameterBounds(ControlDesignandSimulationModule)Parameterboundsareconstraintsonparametervaluesbeingoptimized.Forexample,whilesearchingforthebestvalueofaspringconstant,youmightknowthatspringsareavailableonlywithcertainphysicalproperties.Inthiscase,youcanspecifythattheparameterkmuststaywithinminimumandmaximumvalues.ParameterboundsareimportantbecausetheseboundsdefinetheparameterspaceinwhichtheSequentialQuadraticProgramming(SQP)algorithmsearchesforoptimalvalues.UsetheParameterBoundsparameteroftheSIMOptimalDesignVItospecifyminimumandmaximumvaluesforeachparameter.

Page 91: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

DefiningInitialParameterValuesandaMesh(ControlDesignandSimulationModule)Afteryoudefinetheparameterspaceusingtheminimumandmaximumvaluesofeachparameter,youmustspecifytheinitialvaluesofeachparameter.TheseinitialparametervaluesdeterminewheretheSequentialQuadraticProgramming(SQP)algorithmbeginsthesearchforoptimalvalues.However,ifyouchooseonlyasingleinitialsetofinitialvalues,theSQPalgorithmmightreturnlocaloptimalvalues.Localoptimalvaluesarevaluesthatminimizethecostfunctionwithinonlyasubsetofparameterspace.LocaloptimalvaluesarenotthetruesolutiontotheSQPalgorithmbecausethetrueoptimalvaluesmightexistoutsidetheparameterspacethealgorithmsearched.Tomitigatethisproblem,youcanexecutetheSQPalgorithmseveraltimes,usingadifferentsetofinitialparametervalueseachtime.Ifyouusealargeenoughrangeofinitialparametervalueswithinthegivenparameterspace,youcanberelativelyconfidentthattheSQPalgorithmfindstheglobaloptimalvalues.Youcanimplementthisstrategybydefininganinitialparametersmesh.Theinitialparametersmeshdefinesthedistributionpatternofthesesetsofinitialvaluesandthetotalnumberofinitialvaluesetstogenerate.Youcanchoosefromfourpatternsdependingontheneedsoftheproblem:Uniformgrid,Uniformrandom,Quasirandom,andRandomwalk.Eachpatternhasuniquecharacteristicsandstrengths.Forexample,thesimplestpossibleoptionistheuniformgrid,whichgeneratesaspecifiednumberofequally-spacedlocationsintheparameterspace.However,theuniformrandomandquasirandomoptionsoftenprovidebettercoverageoftheparameterspacewhileusingafewernumberofpointsthantheuniformgridoption.Therandomwalkoptionbiasesthesearchtoexploreclosetotheinitialvaluesbuteventuallyexploresalargerregionofparameterspace.Thisoptionisusefulifyouthinkaparticularparameterspacecontainstheoptimalvaluesandyouwanttofocusonacertainregionofthatspace,suchasthecenter.UsetheInitialParametersparameteroftheSIMOptimalDesignVItospecifyinitialparametervalues.UsetheInitialParametersMeshparameterofthisVItodefineaninitialparametersmesh.

Page 92: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

ExecutingtheSQPAlgorithm(ControlDesignandSimulationModule)TheSIMOptimalDesignVIusesaninternalsimulationdiagramtoobtainthefinite-horizontime-domainresponseofthedynamicsystemmodel.UsetheSolverParametersparameterofthisVItoconfigurethesimulation.YoualsocanconfiguretheSequentialQuadraticProgramming(SQP)algorithmusingthebeginningstate,cnosettings,andstoppingcriteriaparameters.ThisVIreturnsthefollowinginformation:

Signals—Thefinite-horizontime-responsedatafortheoutputandcontrolactionofthedynamicsystem,evaluatedateachpointspecifiedintheOptimalparametersarray.Designparameters—Thesetofparametervaluesthatminimizethespecifiedcostfunction.Thesevaluesaretheoptimalparametervalues.Designcost—TheresultofthespecifiedcostfunctionifyouapplythevaluesfromtheDesignparametersarray.Optimalparameters—Alistofpossibleoptimalparametervalues.EachcolumnofthisarraycorrespondstooneparameteryouspecifiedintheParameterBoundsarray.EachrowofthisarraycorrespondstooneexecutionoftheSQPalgorithm.Optimalcosts—TheresultsofthespecifiedcostfunctionthatcorrespondtoeachrowoftheOptimalparametersarray.

TheSQPalgorithmtakesaslongtoexecuteastheproductofthenumberoffunctionevaluationsandtheruntimeofthesimulation.Ifyouspecifyonlyonesetofinitialparametervalues,thealgorithmmustsolve,onaverage,between30and200functions.ThefrontpaneloftheSIMOptimalDesignVIincludesaCurrentDatapagethatyoucanusetomonitortheprogressofthealgorithmastheVIruns.ThispageupdateseachtimetheSQPalgorithmexecutesfromonesetofinitialparametervalues.TheOptimalDesignParameterspageofthisVIalsoincludestheBestParameters(InfeasibleConstraints)andBestcost(Infeasibleconstraints)parameters.Theseparametersreturnoptimalparametervaluesandtheassociatedcostfunctionresultwithnoconstraints.This

Page 93: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

informationcanbeusefulwhenrevisingtheconstraintenvelopes.IfthedynamicsystemhasconstraintsandtheSQPalgorithmdoesnotreturnfeasibleoptimalvalues,tryensuringthatthespecifiedcostfunctionremainsconstantwhenparametervaluesareoutsidethefeasiblerange.Thismethodhelpsyousetreasonableparameterbounds.Additionally,reducingsystemdiscontinuitieshelpstheSQPalgorithmexecuteprecisely.Youcanuseseveralmethodstoreducediscontinuities,forexample,avoidingsaturationeffectsandratelimitersinthesystemmodel.

Page 94: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

UsingtheSimulationModelConverter(ControlDesignandSimulationModule)YoucanusetheSimulationModelConvertertoconverta.mdlfile,developedinTheMathWorks,Inc.Simulink®simulationenvironment,intoaLabVIEWVIthatconsistsofasimulationdiagramcontainingLabVIEWfunctions,wires,andsimulationsubsystemscorrespondingtothecontentsofthe.mdlfile.Aspartoftheconversionprocess,theSimulationModelConverterusestheMathWorks,Inc.MATLAB®applicationsoftwareandtheSimulinkapplicationsoftwaretocompilethe.mdlfileandexecuteany.mfilesthatyouspecifyinthedialogbox.IftheMATLABsoftwareortheSimulinksoftwareisnotinstalledonthesamecomputerastheLabVIEWControlDesignandSimulationModule,theresultsoftheconversionmightbelessaccurate.

NoteTheSimulationModelConvertercannotconvertdiagramsdevelopedwithTheMathWorks,Inc.Stateflow®applicationsoftwareorotherSimulinkblocksets.

(Windows)Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.

Page 95: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

CommonWarnings(ControlDesignandSimulationModule)IftheSimulationModelConvertercannotfindavalueforaparameterinthe.mdlfileitisconverting,LabVIEWdisplaysawarning.Inthesecases,theSimulationModelConverterusesthedefaultvalueoftheparameterinthecorrespondingLabVIEWfunction.

NoteInsomecases,theSimulationModelConvertercannotfindavalueforaparameterbecausetheparametercontainsanexpressioninsteadofaconstantvalue.IftheMathWorks,Inc.MATLAB®softwareisinstalledonthecomputer,theSimulationModelConverterattemptstoevaluatetheMATLABsoftwareexpressionsinthe.mdlfilepriortoconvertingthefile.IftheSimulationModelConvertersuccessfullyevaluatestheexpression,theSimulationModelConverterusestheresultofthatevaluationastheparametervalueanddoesnotproduceawarning.

TheSimulationModelConvertercannotfullyconvertallfunctionsofeverymodeltoLabVIEWblockdiagramcode.IftheSimulationModelConverterencountersablockitcannotconvert,youreceiveawarning.Inthesecases,theSimulationModelConvertercreatesaplaceholdersimulationsubsystem.YoumustcreateasimulationsubsystemusingaLabVIEWVItoaccomplishthesamefunctionalityastheblocktoreplacethisplaceholdersimulationsubsystem.BecauseLabVIEWisstrictaboutdatatypes,theconvertedsimulationsubsystemmighthavebrokenwires.Inthiscase,addblockdiagramcodetoconvertbetweenconverteddatatypes.

Page 96: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

UnsupportedBlocks(ControlDesignandSimulationModule)TheSimulationModelConverterdialogboxcannotconvertthefollowingblocksusedinTheMathWorks,IncSimulink®applicationsoftware.Inthesecases,theSimulationModelConvertercreatesaplaceholdersimulationsubsystem.YoumustcreateasimulationsubsystemusingaLabVIEWVItoaccomplishthesamefunctionalityastheblocktoreplacethisplaceholdersimulationsubsystem.

AlgebraicConstraintAtomicSubsystemBand-LimitedWhiteNoiseConfigurableSubsystemEnabledEnabledandTriggeredForSubsystemFromWorkspaceFunction-CallFunction-CallGeneratorIfIfActionSubsystemInterpolation(n-D)usingPreLook-UpLook-UpTable(n-D)MemoryMergeModelInfoPreLook-UpIndexSearchProbeRandomNumberRateTransitionRepeatingSequenceS-FunctionS-FunctionBuilderSwitchCaseActionSubsystem

Page 97: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

SwitchCaseToWorkspaceTriggeredWhileIteratorSubsystem

Page 98: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

AdditionalImportantInformation(ControlDesignandSimulationModule)TrademarksPatents

Page 99: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

TrademarksNationalInstruments,NI,ni.com,andLabVIEWaretrademarksofNationalInstrumentsCorporation.RefertotheTermsofUsesectiononni.com/legalformoreinformationaboutNationalInstrumentstrademarks.MATLAB®,Stateflow®,andSimulink®areregisteredtrademarksofTheMathWorks,Inc.Otherproductandcompanynamesmentionedhereinaretrademarksortradenamesoftheirrespectivecompanies.MembersoftheNationalInstrumentsAlliancePartnerProgramarebusinessentitiesindependentfromNationalInstrumentsandhavenoagency,partnership,orjoint-venturerelationshipwithNationalInstruments.

Page 100: Control Design and Simulation Module Concept · If you are new to the Control Design and Simulation Module, consider completing the Getting Started with Simulation tutorial. In addition

PatentsForpatentscoveringNationalInstrumentsproducts,refertotheappropriatelocation:Help»Patentsinyoursoftware,thepatents.txtfileonyourmedia,orni.com/patents.Youareonlypermittedtousethisproductinaccordancewiththeaccompanyinglicenseagreement.AllrightsnotexpresslygrantedtoyouinthelicenseagreementaccompanyingtheproductarereservedtoNI.Further,andwithoutlimitingtheforgoing,nolicenseoranyrightofanykind(whetherbyexpresslicense,impliedlicense,thedoctrineofexhaustionorotherwise)isgrantedunderanyNIpatents.