homedefinitionsarticles | forumemail 

Mechatronics Design with NX Motion and Matlab

Razvan Panaitescu and Mathias Oppelt

Introduction

There are many unknowns during the design phase of a machine development cycle. Is the machine going to meet the requirements? Is it going to achieve the productivity and precision expected by the end-user? Unfortunately many of these “unknowns” can only be answered after the prototype of the new machine is built; and with each iteration of the prototype, new questions (and answers) emerge.

Developing these prototypes consumes the majority of the time and finances budgeted for the machine design. A better way would be to simulate the closed-loop operation of each component in the system, tweaking elements of the design on the fly to arrive at the best possible design. Until recently, mechanical and electronic system simulators only allowed designers to simulate part of the overall design in open-loop configurations. As a result, engineers questioned how accurately a simulation program could predict the dynamic behavior of the product? Is simulation truly less costly than building and fixing afterwards? And what is the probability that, once the machine optimized, the first “prototype” will be the final machine?

Siemens’ NX Motion Simulation, which is part of NX Suite, enables designers to connect mechanical simulation with control simulations and to allow designers to co-simulate in both the NX environment and Matlab, giving designers fast and realistic insight into the dynamic machine and control behavior of a system modeled in almost any 3D CAD software. With the release of NX6, the user has the ability to integrate mechanical simulations of all controls and drives with any Matlab/Simulink control structure in a Co-Simulation environment. This unified simulation environment allows the designer to dynamically analyze the complete machine, while predicting performance, resulting in faster, more complete prototypes with shorter development schedules.

Control optimization is critical for a machine to achieve maximum performance, but control also depends heavily on the machine’s mechanical design. To optimized control signals and architecture, designers start by analyzing and modeling the mechanical elements of the plant body. This analysis begins with the extraction of all important modes and mode-shapes of the mechanical system, which then permits a State-Space formulation of the system between a vector of torque/force inputs (one for each actuator) and a vector of several speed/position outputs as measured at different points in the system.

Once the input-output dynamic representation of the mechanics is completed, this plant body enables the Mechatronics designer to optimize the controller during the next steps of the design process.

A good Mechatronic simulation reveals design issues early in the development process, allowing the designer to explore multiple design alternatives and virtual prototype iterations, bringing the product to market faster with less development cost, higher precision, and increased productivity. The purpose of this paper is to describe how NX Motion conducts controller-integrated simulations as part of a complete Mechatronic machine analysis.
 
 
Figure 1. The major cost will be defined in the development phase. The highest gain for savings in the final machine costs is during the development phase. Simulations can help to identify the best machine concept faster.


Figure 2. Siemens NX6 mechatronic co-simulation capabilities integrated into the NX suite of PLM software enables tighter integration between mechanical and electronic engineering, reducing both the time required to explore iterative designs, and the cost of prototyping the system.

NX 6 Mechatronic Simulation Workflow


To prevent a development disaster, a Mechatronic design approach has to be used to verify implementation concepts early in the design phase. NX offers designers a seamless environment to simulate Mechatronic designs.

The following summarizes Mechatronic design flows with NX:
a)    A mechanical 3D model represents the input in the design process; this model is usually created by mechanical designers and can be executed in the NX Modeling environment.
b)    Once a 3D model of the machine is completed, the Mechatronic engineer switches to the NX Motion environment and builds the functional model by creating bodies and connections between the machine elements in motion. This represents the Multi-Body-Dynamics Simulation phase where the machine is open-loop controlled under ideally shaped excitation inputs.
c)    This simulation model will be used to run a model identification process in Co-Simulation with Matlab. The system is identified in a mathematical view by defining the relationships between inputs, outputs, and states. The system becomes one component of the closed-loop control model that simulates the machine’s operation under real production conditions, while allowing the designer to optimally tune the controller to maximize performance.
d)    In the final phase, a complete controller integrated simulation validates the controlled dynamic behavior of the product. This simulation shows the performance of the product and further development steps can be decided quickly and easily.

Before NX6, machine simulation capabilities ended with Multi-Body-Dynamics Simulation – in other words, a system operating in ‘perfect,’ non-reality-based conditions. Although less complicated, these simulations could offer only a vague and ideal image of how the mechanics would behave in the real world. The overall Mechatronic design solves the real-world challenges facing machine designers that struggle to connect mechanical and electronic design capabilities. With NX6, the Mechatronic engineer now takes charge of the design; he has the know-how and the ability to analyze the connections between different disciplines: mechanics, electronics and controls. With NX6 Motion and Matlab he can finally produce the “real-life” simulations and close multiple iterations on the development spiral to truly accelerate the system design schedule.


Mechanical Modeling in NX Motion


To illustrate the Mechatronic design and simulation process, Siemens engineers designed the Mechatronic Demo-Unit (Figure 3). The Demo-Unit is a two-mass oscillator built around two motors (one of which is acting as a pure inertial load) connected axially with a flexible aluminum rod.
As mentioned earlier, the Mechatronics simulation process begins with a 3D CAD model. CAD models are pure geometry. They show an unconnected representation of surfaces and lines associated with a particular assembly. For a dynamic simulation the elements of the design must become bodies with a precise mass and/or inertia. These bodies should exhibit a certain degree of flexibility (when necessary), and include elements that permit movement along the rigid-body direction of motion, while suppressing the appropriate degrees of freedom and accounting for material and design based variations in rigidity and damping.

In dynamic simulations, the value of the simulation is determined by how much it mimics the operation of a real machine, which is a result of how accurately the following three sets of parameters are defined:
-    Mass/inertia of links (bodies)
-    Stiffness/damping/friction of the connections between bodies
-    Flexibility of the bodies that cannot be considered rigid.

The mass and/or inertia of bodies are inherited from the 3D model. If designers set the correct material properties, mass information is automatically transmitted to the NX Motion simulation model and no adjustments are necessary.

Determining the correct stiffness and damping values for a component can require some experience. In some cases, the data is available from catalogues, but all too often the catalogue data is inaccurate and inconsistent with real life measurements. Something to consider when searching for stiffness and damping values is that a reliable simulation result spanning the bandwidth of the motion profile depends mainly on low-stiffness elements. These elements produce lower mechanical resonances that impact the overall system simulation, design, and effectiveness more than the high-stiffness connections. Work is underway to include flexible bodies in the upcoming release of NX 7.0.

To compensate for the effect of flexible bodies, designers working in NX break down low-stiffness elements into connected bodies that represent the overall stiffness of the original body. If the influence of the flexible bodies is significant, NX’s Advanced Simulation environment can be used to do more complete FE-Analysis of the part.
In addition to the general simulation considerations listed above, NX6 builds a Mechatronic simulation from 3D CAD data based on the following steps:
1.    Define links (bodies) of the motion mechanism.
2.    Define joints (bearings, mountings, etc.) of the motion mechanisms and degrees of freedom.
3.    Set up connections between the links with generalized stiffness objects called “bushings.”
4.    Identify flexibilities (flexible bodies) and split them into smaller rigid bodies to be connected through a bushing element.
5.    Include parts (bodies) that do not come with the 3D model, but are important for the simulation (e.g. the encoder system which is connected to the motor implicitly)

This process is illustrated in Figure 4. The only degree of freedom (rotation) is handled by two revolute joints located between the rotor and stator on both motors. The suppressed degrees of freedom are made of bushing elements with a defined rotational and Cartesian stiffness. Obviously, the rotational stiffness matters most when it comes to the Demo-Unit design.

If the geometry of the model is correct and the right material is chosen, NX will calculate the mass and inertias by itself. However, in NX Motion the user can define the mass and inertia for each link, overwriting the calculated data from the geometry as necessary.

Electric motors present a special case. Due to the motor’s complex construction with multiple materials, the rotor inertia cannot be calculated automatically based solely on material density data. Therefore, the motor inertia must be entered manually, using the values supplied by the manufacturer in its catalogue.

Figure 5 shows the inertia and stiffness values for the bodies considered in our model.

Our observations showed that the first approximation of the system with an automatic calculation of inertias and entering rough stiffness values yields very good results for the low eigenfrequencies of the system, which are critical for dynamic analysis of our system. Hence, a conclusion can be drawn: the original CAD data, containing just the geometry, would give good results in a complete Mechatronic analysis as a first approximation model. This “first approximation” takes minimal time, allowing the designer to run a system optimization analysis shortly after finishing the 3D model draft.


Figure 3. Model of the Mechatronic Demo-Unit


Figure 4. Simulation model of the Mechatronic Demo-Unit


Figure 5. Inertia and Stiffness values for the Mechatronic demo setup


Figure 6. Drag and Drop integration of the NX Motion Plant block into any Simulink controller scheme(w/o shaft flexibility)

Co-Simulation in NX6 Motion


The Co-Simulation function of NX6 Motion enables the designer to combine the mechanical plant model with the drive and controller models for a complete Mechatronic simulation. By adding specific controllers to the mechanical NX model, the designer can further optimize the dynamics of the system.
To add controllers and run a controller-integrated simulation, the designer must:
1.    Define the mechanical model as described in the section above
2.    Define the controller scheme file (Simulink file .mdl) in the NX solver parameter dialog box
3.    Define sampling time for the controller in NX
4.    Run the control integration: Drag and drop the NX Motion plant block in Simulink into the controller scheme, connect the inputs and outputs and save the file (Figure 6)
5.    Solve the Co-Simulation

The results of the simulation can be displayed in NX6 and/or saved to a Matlab file (.mat) as well. The easy integration between the two programs and ability to save all Matlab signals means that the Matlab functions signal analysis can be used later outside the NX6 Co-Simulation environment, eliminating the need for the user to constantly switch between Matlab and NX; controller tuning can be refined after running the system identification process. This functionality also allows a total modal analysis of the mechanical NX simulation model as described in the next section.
Controller Integrated Simulation
The major benefit of NX Motion 6 is the ability to accept Simulink driven inputs and pass system outputs back to the Matlab environment for a controller-integrated simulation. The input-output relationship is encapsulated in the Plant Block, which is solved for every simulation time step. Once the Co-Simulation is over, the user may observe the results using NX animation and trace capabilities.

Many times the mechanics don’t change, and the purpose of the simulation is to optimize the controller parameters and trace the output behavior under different motion inputs. For this task, the designer stores the input-output dynamic behavior of the plant model in a Simulink block and, without opening NX, runs the simulation process directly from Simulink.

In order to extract the dynamics of the mechanical plant and have it available for further system simulation purposes in Matlab, we have to identify and then estimate the mechanics using the following procedure.

Modal Analysis and System Identification Procedure


To simulate a system, an input-output model must be mathematically defined and implemented. Some identification methods use time domain input and output data of the system; other methods use the frequency domain input and output data to generate frequency response function representations of the system. The latter process is also known as Modal Analysis and offers a representation of the dynamic characteristics of a system, its eigenfrequencies and eigenshapes.

Modal analysis is generally associated with modal testing. Modal testing is a process to determine the dynamic characteristics of an existing structure/system via measuring its Frequency Response Function (FRF). To produce an FRF, the designer must excite the system with an input signal that encompasses a sufficiently large frequency spectrum and then measure the output for further correlation. There are many signal types which can be used for modal analysis e.g. Impulse, Noise, Chirp, Sinus, PRBS, etc. A PRBS (Pseudo Random Binary Signal) is a random sequence of impulse functions and has a white noise like characteristic that excites all frequencies. Siemens uses PRBS in the field to test and plot frequency response functions on drives and machines.

For our discussion, we shall use a PRBS-type test signal applied to the input of our NX model to generate a system identification and model estimation. The signal shape is created with a tool created in Matlab that can generate any time domain vector for various input signals (Impulse, Step, Sinus, Square Wave, Chirp, Noise and PRBS). The signal is stored in a .mat file and used in a Simulink Co-Simulation template file, which is generated by integrating the NX Plant Block with a Simulink template and by saving output data of the simulation. System identification and model estimation are then performed and the frequency response function plotted, as depicted in Figure 7.

After running a simulation within the Co-Simulation environment and collecting the input and output data, the model estimation technique can be used to generate a linear state-space representation from the simulation model.
The estimation process with NX Motion and Matlab can be summed up in the following steps, assuming the mechanics were modeled in NX Motion as discussed previously:
1.    Integrate the NX Motion Plant block into the Simulink template for system estimation. (Figure 7)
2.    Define an input signal and save it in the input1.mat file
3.    Solve the Co-Simulation in NX Motion; the output.mat file will be created automatically.
4.    Estimate a state-space system from the frequency response function of the Plant using the input and output data, where

The frequency response also can be obtained from the real system, using the embedded capabilities of Siemens drive systems. Figure 8 shows the real system FRF (blue) versus the simulation model FRF (green). As the simulation model matches very well the characteristics of the real machine, we conclude that it can be used for all further calculation. From the calculated FRF, using simple identification procedures available in Matlab, the system matrices (A, B, C and D) can be obtained for a complete state-space representation.
Tuning a Speed and Position Controller
Now, the controller design can be completed either using NX as the main interface, or directly in the Matlab/Simulink environment by exporting the plant model into a Discrete State-Space block that contains the identified matrices A, B, C, and D.

To illustrate this improved simulation and design environment, we added a simple speed and position control system to our Mechatronic Demo. This controller scheme contains a Proportional-Integral (PI) speed controller and a Proportional (P) position controller sequenced in a typical Cascade structure.
Both representations are equivalent, but the advantage of the first one (Figure 8) is that the state-space representation of our system allows controller tuning only in Simulink, without driving the simulation from NX. Once the controller is tuned and the output characteristics meet the requirements, we can animate the whole system by running a Co-Simulation from NX Motion, using the recently optimized parameters of the control structure.

Figure 11 compares the differences between the system responses to a similar ramp profile in position using the state-space model (blue) and the NX Plant Block (red). The two responses superimpose very well thus we can say that the difference between using the State-Space model of the Plant or the NX Plant Block is negligible and the two methods can be used interchangeably with identical results.
Mechatronic optimization and tuning of control systems favors the frequency representation of closed-loop characteristics. Without much detail on tuning principles, which fall outside the scope of this paper, the results of the tuning process are described below. The difference between two controller settings -- a good and a bad parameter set -- is shown in Figure 12.



Figure 7. Model estimation process with NX Motion and Matlab

Figure 8. Bode Diagram of the simulation model (green) and the real machine measurement (blue)

Figure 9. Simple position and speed control system in Simulink with the estimated State-Space model

Figure 10. Simple position and speed control system in Simulink with the NX Motion Plant Block

Figure 11. Step response of the tuned controller with the State-Space model and the NX Motion Block


Figure 12. Controller Parameters

Mechanical Design Optimization


Most of dynamic performance requirements can be influenced by optimally tuning the controller loops, but not always. Achieving specific machine dynamics mostly depends on the mechanical structure and the motion input profiles.

During the conceptual phase, some changes in the mechanics may be necessary to improve the dynamic result and the overall performance and productivity of the machine. The earlier in the design these changes are made, the easier and more effective the changes will be. The advantage of making these changes in model versus tangible prototype is that models can be reused and modified in size and structure without incurring any manufacturing costs, scrapping parts, or building new prototypes.

As previously stated, dynamics, including performance and productivity, are influenced by the dimensions and the material properties (inertia/mass) of the bodies in motion as well as the connection properties (stiffness and damping) between them. To show how easily we can verify, predict, and improve the performance of different concepts we created two case scenarios for our simple demo. In the first case we changed the material of the connecting rod from aluminum to iron and in the second case we doubled its diameter while keeping aluminum as the material. For both concepts the controllers were re-tuned and the performances were analyzed in comparison to the original system.

Material Change
A Material Change will affect the both the inertia and stiffness of the rod. NX does the inertia calculation automatically. The rod stiffness, however, with the new material conditions needs to be recalculated and manually updated. The stiffness of a cylindrical rod is proportional to the shear modulus of the material. Between the shear modulus of aluminum and iron is a factor of 2.987 which we can use the recalculate the stiffness. Now we can look at the influence of the material to the first eigenfrequency. Thus the eigenfrequency will increase by 46%.

Figure 17. Effect of the rod material to the first eigenfrequency
Through the higher eigenfrequency, we can increase the Kv gain of the controller and hence increase the performance of the system.
New Kv = 48 1/s

Figure 18. Effect of the diameter of the rod to the first eigenfrequency
This system allows us to increase Kv to the following value.

New Kv = 70 1/s

Dimension Change
A change in dimensions will also affect the inertia and the stiffness of the rod. The inertia and the stiffness of a cylindrical rod are proportional to d4, where d is the diameter of the rod. This means that a rod with a double diameter will be 16 times stiffer than the original rod and having 16 times the inertia of the original rod. Now we can recalculate the stiffness and inertia for the rod and investigate the influence to the first eigenfrequency. We can also remodel the rod and let the calculation of the inertia be done by NX.
With the diameter change the first eigenfrequency will double.

Figure 19. Effect of the rod material to the ramp response performance

Figure 20. Effect of the double rod diameter to the ramp response performance



Figure 13. Frequency response of the speed controller system     


Figure 14. Frequency response of the position controller system

Figure 15. Step response of the speed controller systems

Figure 16. Ramp response of the position controller systems

Conclusion and Perspective


The purpose of this paper was to show the capabilities of NX6 in performing Mechatronic design and simulations. Here is a summary of features and functionalities that NX6 offers to the Mechatronic engineer:
-    A strong Matlab/Simulink Co-Simulation environment as the basis for any Mechatronic analysis;
-    System identification methods can be applied to estimate a State-Space model of the mechanical plant;
-    Estimated State-Space models can be used for controller design and tuning. This gives the ability to perform the whole tuning process exclusively in Simulink, using Matlab functions for controller tuning, which can dramatically reduce simulation times compared to the NX6’s intrinsic Co-Simulation feature;
-    Validation and visualization of the controlled system using NX Motion;
-    Quick validation of mechanical changes and efficient system optimization.

Figure 21. Functions and the derived capabilities of NX6 in Co-Simulation with Matlab

References


1.    H.Groß, J. Hamann, W. Wiegärtner: „Elektrische Vorschubantriebe in der Automatisierungstechnik“, Siemens AG, 2006
2.    J. He, Z.-F. Fu: „Modal Analysis“, Butterworth-Heinemann, 2001
3.    Lunze, Jan: „Regelungstechnik 1“, Springer-Lehrbuch, 6. Auflage 2007
4.    Katayama, Tohru: „Subspace Methods for System Identification“, Springer-Verlag London, 2005
5.    Matlab/Simulink R2007b Documentation
6.    NX 6.0 Documentation