Most engineers are surprised to learn that the term mechatronics is nearly 40 yearsold. It was first used in 1969 by Tetsuro Mori, an engineer at the Yaskawa Co., todescribe a system composed of mechanical and electrical elements thatis controlled by an embedded system (Figure1 below ).
In today's world it is rare to find electromechanical deviceswithout some kind of embedded system. The intelligence from an embeddedsystem delivers enhanced performance, reduced energy consumption,better reliability, and safer operation, which are key differentiatorsand value drivers for a piece of equipment.
|Figure1: Mechatronics is a synergy of mechanical and electrical systemscontrolled by an embedded system.|
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 prove challenging to hardware andsoftware engineering teams, who state requirements, describe problems,and test and implement solutions in different ways.
In addition, engineers must design closed-loopcontrol strategies to compensate for electromechanicalinteractions and external disturbances, as well as incorporateopen-loop supervisory control for operational requirements, such asstart-up and shutdown, personnel and equipment safety, and faultdetection 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.
Model-based design (Figure 2 below )simplifies the development of mechatronic systems by providing a commonenvironment for design and communication across different engineeringdisciplines. Model-baseddesign extends the CAE world with an additionalperspective on system-level design.
|Figure2: Model-based design places the system-level model at the center ofthe development process.|
Just as CAD provides a geometric orstatic description of equipment, model-based design incorporates thedynamics and performance requirements needed to describe the systemproperly. Because this approach is software driven, engineers canfluidly investigate competing designs and explore new concepts withoutthe overhead of extensive hardware investment.
Engineers can continuously test the design as it evolves, checkingit against 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 closed- and open-loop control algorithms.
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 mathematical definition of theexpected performance of the mechatronic system. As an executablespecification, the system-level model provides a clear advantage overwritten documents, which, because they are subject to interpretation,can lead to requirements that are missing, redundant, or in conflictwith other requirements.
Tracing requirements from the written specifications to the system-level model clarifies how the engineer interpreted the requirement.Electronic links between requirements and the model let engineersconnect test criteria to test cases used throughout the developmentprocess.
A block diagram is a natural approach for expressing a system- levelmodel (Figure 3 below ). Themodel 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.
|Figure3: A block diagram provides an intuitive view of a system-level model.|
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 a motor.The mathematical model of the motor may be fairly simple, simply takinga voltage input and converting it to an output torque. The motor modelcomplexity can increase by adding more inputs to the model, such asnoise in the voltage, or by adding more parameters, such as temperatureand magnetic saturation affects.
A single block or a group of blocks, filtering and processingsignals based on output errors or events occurring in the model, canrepresent the compensation or control in the system.
The basis of a system-level model is a lumped parameter mathematicalmodel that describes the physics of the system. Ordinary differential equations (ODEs)and differential algebraic equations express the input-to-output relationship of the mechatronic systems.
In the motor example, an ODE describes the relationship of thevoltage input to 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.
Finite element analysis software could be used to solve for thetorque-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.
|Table1. The options for real-time testing give flexibility to catch criticaland time-consuming mistakes before actual hardware is available.|
Improving the 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 first principlesmathematical model by using parameter estimation techniques. Thisgraybox 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 incorporatingsubcomponents provided by suppliers to more quickly evaluate the bestcombinations of components. Models evolve into a combination ofmultiple domains, providing only the needed detail to ensureperformance under the operational conditions expressed in therequirements documents. CAD meets model-based design as engineersincrease model fidelity by using mass and inertia properties of amechanical system translated from a three-dimensional CAD assemblyfile.
Engineers can replace approximate mathematical representations withblocks that represent the mechanical bodies and linkages translatedautomatically from the CAD file.
In addition to speeding the development of complex mechanical systemlevel models, this approach ensures that the system designers and themechanical engineers use an agreed-upon common model behavior upon thatwill represent the actual mechatronic system when built.
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 can range in sophistication from algorithmsfor a basic proportional-integral-derivative compensator to animplementation of a
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 create increasingly sophisticatedself-diagnostics, fault-detection, and safety-shutdown systems withinthe equipment. Model-based design helps engineers develop and test theincreasingly complex open-loop control system against the system-levelmodel.
Simulation lets testing begin early in the design process to improvethe ergonomics of the equipment and find any scenarios that may causeequipment damage or create unsafe conditions.
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 model lets engineers analyze the interaction of thecontrol loops, develop decoupling strategies, and tune compensatorgains with a variety of approaches that rely on direct andoptimization-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 capacitancethat cause instability.
As a result, problems can be found during the less expensivesoftware -simulation stage, rather than during testing of physicalprototypes.
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.
Testing, system verification
Continuous testing and verification throughout the development processinvolves defining and using standard tests in conjunction with thecontrol system design process.
Using standard tests or a test harness ensures that engineers testthe evolving system- level model in a consistent manner and with thesame set of measures. Test criteria such as pass/fail and tolerancebands are associated with a test through electronic links torequirement documents.
Continuous testing with a standard test harness immediately exposesthe impact of any design change on system outputs and helps quicklytrace the change to the 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 thesystem for all operating conditions during the modeling phase assuresdevelopers that the tests are complete and correct before testingbegins on the physical prototype. Model-based design helps engineerscreate complete tests that they can use during all stages of thedevelopment process and into production testing.
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,
This process involves converting the control algorithms from acontinuous (analog) to a discrete (digital), often fixed-point, format.During the continuous testing, engineers test the digital form of thecontrol algorithms against the continuous form of the plant toascertain whether the digital conversion adversely affects the desiredperformance of the system. Model elaboration lets engineers examineother aspects of converting to digital signals.
System designers model the I/O device drivers and any ADCs and DACsto ensure that no corruption or aliasing of signals will occur in theactual implementation 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 and test variouscombinations to assess cost and implementation options, such as usingan FPGA instead of a DSP, or fixed-point calculations instead offloating-point calculations.
Testing mechatronic systems
Testing the system-level model on a real-time system is the next stepin model-based design. In this stage, engineers automatically convertthe system-level model into C code, HDL or
Engineers may generate code for the control algorithms, the plantmodel or both, depending on how they choose to test the system. Inmodel-based design, automatically converting the system-level model tocode eliminates the need for system engineers to be code-writingexperts, prevents the introduction 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 troubleshooting 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 and hardware-in-the-loop (HIL).During this testing, engineers can collect data in real time and modifyparameters in the code as the test runs.
Table 1 earlier shows someof the 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 easiersince the system-level model is the specification, tied directly to therequirements documents. During rapid prototyping, the real-time systemconnects to real hardware.
Because the control system in the model contains all of the neededI/O in most cases, the system-level model automatically creates thecode 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 control algorithms to areal-time test system or to the intended target processor, and connectto the plant model, which also runs in real-time. HIL testing can alsobe accomplished by using the simulated plant model running on thedesktop or workstation computer.
Production quality code
Model-based design lets engineers use the system-level model to deploythe control algorithms in C code, HDL, or PLC code, targeting theproduction processor or other real-time system.
The code generation process optimizes the production quality codefor a specific processor. It differs from the code used in real-timetesting because the process strips out all parameters needed duringtesting and optimizes the code for a minimum footprint to reduce memoryoverhead and maximize computational speed.
Engineers have control over the code generation process to includedata objects, user-defined storage classes, types, and aliases. Inaddition, customizing the code format to conform automatically to acompany's software style guide helps make the optimization complete andsimplifies the use of the code by software engineers, usuallyresponsible for integrating the code into a larger code set.
Model-based design is computer aided engineering for systemlevel designof mechatronic systems. Engineers develop and test a behavioral modelof their equipment in software with the following benefits:
1. The capability toinexpensively design and test multiple approaches without a costlycommitment to prototype hardware early in the development process.
2. A collaborative designenvironment using a common executable specification that connects torequirement documents and lets all multiple engineering disciplinescommunicate in a common language.
3. The ability to reducedevelopment costs by easily finding and correcting errors during anearly simulation stage.
4. The capability to developcomplex embedded systems that provide greater customer value, productquality, and sophistication in mechatronic systems.
Tony Lennon is Industry MarketingManager at The MathWorks.