Model-Based Design for Mechatronics
April 27, 2008
Challenges of Developing Mechatronic Systems
Most engineers are surprised to learn that the term mechatronics isnearly 40 years old. It was first used in1969 by Tetsuro Mori, anengineer at the Yaskawa Company, to describe a system composed ofmechanical and electrical elements that is controlled by an embeddedsystem (Figure 1). In today's world it is rare to findelectromechanical devices without some kind of embedded system. Theintelligence from an embedded system delivers enhanced performance,reduced energy consumption, better reliability, and safer operation,which are key differentiators and value drivers for a piece ofequipment.
Model-Based Design for Mechatronics_ImageA
The benefits of an embedded system come at a price. As mechatronicsystems take advantage of more powerful microprocessors, which providethe intelligence for embedded systems, the interaction between hardwareand software becomes more complex. Managing this complexity can provechallenging to hardware and software engineering teams, who staterequirements, describe problems, and test and implement solutions indifferent ways. In addition, engineers must design closed-loop controlstrategies to compensate for electromechanical interactions andexternal disturbances, as well as incorporate open-loop supervisorycontrol for operational requirements, such as start-up and shutdown,personnel and equipment safety, and fault detection and remediation.
In most traditional design approaches, engineers test software onhardware prototypes, addressing software validation very late in thedevelopment process. Errors found in hardware or software at this stagecreate costly delays and may be time consuming to trace back to theirroot cause. Errors related to incomplete, incorrect, or conflictingrequirements may even necessitate a fundamental redesign.
Improved Development Using Model-Based Design
Model-Based Design simplifies the development of mechatronic systemsby providing a common environment for design and communication acrossdifferent engineering disciplines. Model-Based Design extends thecomputer-aided engineering (CAE) world with an additional perspectiveon system-level design. Just as computer-aided design (CAD) provides ageometric or static description of equipment, Model-Based Designincorporates the dynamics and performance requirements needed toproperly describe the system. Because this approach is software driven,engineers can fluidly investigate competing designs and explore newconcepts without the overhead of extensive hardware investment.Engineers can continuously test the design as it evolves, checking itagainst requirements and finding mistakes earlier in the developmentprocess when they are easier and less costly to correct. In addition,Model-Based Design automates code generation for the embedded system byeliminating the need to hand code the open- and closed-loop controlalgorithms.
Model-Based Design uses a system-level model that defines anexecutable specification by uniquely describing the natural andcontrolled behavior of the equipment in a mathematical form. Engineerscan execute the model by simulating the actual dynamics and performanceof the system. The model specifies an unambiguous mathematicaldefinition of the expected performance of the mechatronic system. As anexecutable specification, the system-level model provides a clearadvantage over written documents, which, because they are subject tointerpretation, can lead to requirements that are missing, redundant,or in conflict with other requirements.
Written requirements will always exist, but engineers can link theirelectronic formats to the system-level model and help establishcompliance to standards such as ISO 9001 or IEC 61508. Tracingrequirements from the written specifications to the system-level modelclarifies how the engineer interpreted the requirement. Electroniclinks between requirements and the model let engineers connect testcriteria to test cases used throughout the development process.
Developing the System-Level Model
A block diagram is a natural approach for expressing a system-levelmodel . The model has inputs-signals provided by external agencies, andoutputs-measures of what the system is actually doing. The inputs andoutputs represent real values, such as voltage, temperature, and pH.
Inside the model, the blocks represent mathematical operationsbetween the input and output signals of the model. Some blocks, calledthe plant or process, represent the natural behavior of the mechatronicsystem. For example, the model may contain a block representing amotor. The mathematical model of the motor may be fairly simple, simplytaking a voltage input and converting it to an output torque. The motormodel complexity can increase by adding more inputs to the model, suchas noise in the voltage, or by adding more parameters, such astemperature and magnetic saturation affects. A single block or a groupof blocks, filtering and processing signals based on output errors orevents occurring in the model, can represent the compensation orcontrol in the system.
The basis of a system-level model is a lumped parameter mathematicalmodel that describes the physics of the system. Ordinary differentialequations (ODEs) and differential algebraic equations (DAEs) expressthe input-to-output relationship of the mechatronic systems. In themotor example, an ODE describes the relationship of the voltage inputto the shaft output torque. Differential equations are acomputationally efficient way to describe lumped dynamics, as opposedto using a partial differential equation-based modeling tool, such asfinite element analysis (FEA). FEA software could be used to solve forthe torque-induced stress distribution at a key slot in the motor shaft.
Using ODEs to describe the system-level behavior of a mechatronicsystem involving multiple engineering disciplines does not come withoutchallenges. Expressing system behavior mathematically requires that youhave knowledge of the physics underlying the system. The reality ofmechatronics is that all systems are nonlinear and you must account forhysteresis, friction, and thermal effects exhibited by the realmechatronic equipment.
Improving the System-Level Model
When the mathematics of the system becomes too difficult or timeconsuming to develop, engineers can turn to other ways of system-levelmodeling. A common method to supplement a first-principles approach isdata-driven empirical modeling, such as system identification or neuralnetworks. These black-box approaches use measured input-output data toconstruct linear or nonlinear ODE forms of the system behavior forincorporation into the system-level model. These approaches do not givea complete insight into the physics of the system, but can yieldaccurate descriptions of the system dynamics within the region of thetest data. Measured data can also improve the accuracy of a firstprinciples mathematical model by using parameter estimation techniques.This gray-box modeling involves optimization techniques to adjust modelparameters, such as a friction coefficient, to match the model outputwith the test data.
Model-Based Design lets engineers start with a less detailedsystem-level model and incrementally increase its fidelity asdevelopment progresses. A proof-of-concept model represented as alower-order ODE may be all that is required initially to help engineersquickly eliminate concepts with little promise. For stronger ideas,they can add fidelity by incorporating subcomponents provided bysuppliers to more quickly evaluate the best combinations of components.Models evolve into a combination of multiple domains, providing onlythe needed detail to ensure performance under the operationalconditions expressed in the requirements documents.
CAD meets Model-Based Design as engineers increase model fidelity byusing mass and inertia properties of a mechanical system translatedfrom a three-dimensional CAD assembly file. Engineers can replaceapproximate mathematical representations with blocks that represent themechanical bodies and linkages translated automatically from the CADfile. In addition to speeding the development of complex mechanicalsystem-level models, this approach ensures that the system designersand the mechanical engineers use an agreed-upon common model behaviorupon that will represent the actual mechatronic system when built.
Developing the Control Strategy
After describing the system's natural behavior, the next step is todevelop and evaluate a control strategy, which can incorporate manylevels of open- and closed-loop control within the mechatronic system.The open-loop control, which includes all interface, mode, logic, andsupervisory control, is how engineers implement the safe operation,fault detection, and recovery features. The closed-loop control canrange in sophistication from algorithms for a basicproportional-integral-derivative (PID) compensator to an implementationof a multivariable linear-quadratic-Gaussian (LQG) controller.
The open-loop control performs supervisory control and mode controlwithin the equipment and addresses the interaction of the operator withequipment. Equipment designers using more powerful microprocessors candevelop complex user interfaces that provide greater control over theoperation of the equipment. As a result, developers can createincreasingly sophisticated self-diagnostics, fault-detection, andsafety-shutdown systems within the equipment. Model-Based Design helpsengineers develop and test the increasingly complex open-loop controlsystem against the system-level model. Simulation lets testing beginearly in the design process to improve the ergonomics of the equipmentand find any scenarios that may cause equipment damage or create unsafeconditions.
A mechatronic system can employ a number of closed-loop controlsystems operating over a range of conditions. Using a system-levelmodel helps in designing and tuning the controllers in control loopsthat exhibit coupled behavior. Tuning the controllers in hardware isdifficult and time consuming, and often results in detuning the systembelow expected performance to prevent instability. A system-level modellets engineers analyze the interaction of the control loops, developdecoupling strategies, and tune compensator gains with a variety ofapproaches that rely on direct and optimization-based techniques.
At this stage, the system-level model exposes dynamic instabilitiesthat are physically or economically infeasible to eliminate by usingclosed-loop compensation methods. The model makes it easy to identifyand adjust physical parameters, such as mass, length, and capacitance,that cause instability. As a result, problems can be found during theless expensive software -simulation stage, rather than during testingof physical prototypes.
Model-Based Design helps engineers perform cost trade-off studieswithin the control system. The system-level model is an analysis toolfor deciding whether a less expensive sensor with greater toleranceprovide the desired levels of accuracy and performance. Engineers canevaluate practically any component used in mechatronic systems for costversus impact of the system performance.
Continuous Testing and System Verification
Continuous testing and verification throughout the developmentprocess involves defining and using standard tests in conjunction withthe control system design process. Using standard tests or a testharness ensures that engineers test the evolving system-level model ina consistent manner and with the same set of measures. Test criteriasuch as pass/fail and tolerance bands are associated with a testthrough electronic links to requirement documents. Continuous testingwith a standard test harness immediately exposes the impact of anydesign change on system outputs and helps quickly trace the change tothe cause.
In addition, engineers can use the test harness to determine whetherthey have full-model coverage, a measure of how completely the testharness exercises all of the operational scenarios of the equipment.Verifying that the standard tests will completely exercise the systemfor all operating conditions during the modeling phase assuresdevelopers that the tests are complete and correct before testingbegins on the physical prototype. ModelBased Design helps engineerscreate complete tests that they can use during all stages of thedevelopment process and into production testing.
System-Level Model Elaboration for Deployment
Once the control design strategy has been developed and tested insimulation, engineers further elaborate the model for deployment.Deployment refers to converting the control algorithms into C code,hardware description language (HDL), or an IEC 61131-3 language, suchas structured text (ST), for executing on a real-time system. Thisprocess involves converting the control algorithms from a continuous(analog) to a discrete (digital), often fixed-point, format. During thecontinuous testing, engineers test the digital form of the controlalgorithms against the continuous form of the plant to ascertainwhether the digital conversion adversely affects the desiredperformance to the system.
Model elaboration lets engineers examine other aspects of convertingto digital signals. System designers model the input/output (I/O)device drivers and any A/D and D/A converters to ensure that nocorruption or aliasing of signals will occur in the actualimplementation of the system. Mechatronic systems often use acombination of different processors that operate at different speedsand sampling rates. The system-level model lets engineers simulate andtest various combinations to assess cost and implementation options,such as using a field-programmable gate array (FPGA) instead of adigital signal processor (DSP), or fixed-point calculations instead offloating-point calculations.
Testing Mechatronic Systems Using a Real-Time System
Testing the system-level model on a real-time system is the nextstep in Model-Based Design. In this stage, engineers automaticallyconvert the system-level model into C code, HDL, or PLC code. Engineersmay generate code for the control algorithms, the plant model, or both,depending on how they choose to test the system. In Model-Based Design,automatically converting the system-level model to code eliminates theneed for system engineers to be code-writing experts, prevents theintroduction of errors, and saves time.
The process of automatic code generation is analogous to generatinga tool path for machining a part from a three-dimensional CAD file. Ifan error is found in the part after machining, the engineer checks andmodifies the CAD file and regenerates the code for the tool path. InModel-Based Design, engineers change the code via the system-levelmodel, a natural environment for trouble shooting the system. Theyupdate and test the model and regenerate the code.
Using dedicated real-time test systems, real-time testing involvestwo kinds of testing: rapid prototyping (RP) and hardware-in-the-loop(HIL). During this testing, engineers can collect data in real time andmodify parameters in the code as the test runs. Table 1 shows some ofthe options for real-time testing and illustrates the testingflexibility that lets engineers catch critical and time-consumingmistakes before actual hardware is available. As stated earlier,tracing mistakes to their source is much easier since the system-levelmodel is the specification, tied directly to the requirements documents.
Testing Type | Control Algorithms | Plant Model |
Hardware-in-the-loop | Expressed in code on a target microprocessor | Expressed in code on a real-time system |
Rapid prototyping | Expressed in code on a | Real hardware |
real time system |
Table 1. Rapid prototyping and hardware-in-the loop testing scenarios.
During rapid prototyping, the real-time system connects to realhardware. Because the control system in the model contains all of theneeded I/O in most cases, the system-level model automatically createsthe code for these features, eliminating the need for engineers to handcode them. HIL testing deploys the plant model of the equipment to areal-time system. In this situation, engineers deploy the controlalgorithms to a real-time test system or to the intended targetprocessor, and connect to the plant model, which also runs inreal-time. HIL testing can also be accomplished by using the simulatedplant model running on the desktop or workstation computer.
Production Quality Code Generation
Model-Based Design lets engineers use the system-level model todeploy the control algorithms in C code, HDL, or PLC code, targetingthe production processor or other real-time system. The code generationprocess optimizes the production quality code for a specific processor.It differs from the code used in real-time testing because the processstrips out all parameters needed during testing and optimizes the codefor a minimum footprint to reduce memory overhead and maximizecomputational speed. Engineers have control over the code generationprocess to include data objects, user-defined storage classes, types,and aliases. In addition, customizing the code format to conformautomatically to a company's software style guide helps make theoptimization complete and simplifies the use of the code by softwareengineers, usually responsible for integrating the code into a largercode set.
Summary
Model-Based Design is CAE for system-level design of mechatronicsystems. Engineers develop and test a behavioral model of theirequipment in software with these benefits:
The capability to inexpensively design and test multipleapproaches without a costly commitment to prototype hardware early inthe development process.
A collaborative designenvironment using a common executable specification that connects torequirement documents and lets all multiple engineering disciplinescommunicate in a common language.
The ability to reduce development costs by easily finding and correcting errors during an early simulation stage.
Thecapability to develop complex embedded systems that provide greatercustomer value, product quality, and sophistication in mechatronicsystems.
About the Author
You May Also Like