Share this

Research and Implementation of Virtual Design of Cam Mechanisms Based on MATLAB and VRML

2026-04-06 07:24:46 · · #1
Abstract: This paper combines the Virtual Reality Toolbox of Matlab software, the M-programming language, and VRML technology to develop a system capable of virtual designing various commonly used cam mechanisms. Through a simple graphical user interface, this system provides users with parametric design, 3D modeling, and virtual motion simulation for various common cams. It also features auxiliary parameter optimization, performance analysis, and graphical data output. Users can interactively operate the real-time generated virtual scene of the cam mechanism and control the simulation process. Practice shows that the virtual design system developed using this method can effectively utilize the advantages of both VRML and MATLAB, significantly reducing development difficulty and intensity, and shortening development time. Keywords: VRML, MATLAB, Object-oriented programming, Cam mechanism, Virtual design Introduction Cam mechanisms are important transmission mechanisms widely used in various mechanical products, and their design and manufacturing have always been a hot topic in kinematics. Since version 6.1, Matlab has integrated the Virtual Reality Toolbox, which allows for visual operation and interactive control of virtual scenes generated by VRML technology, providing a new possibility for the realization of virtual design. After in-depth research on MATLAB software, Virtual Reality Modeling Language (VRML), virtual design systems, and cam mechanisms, the author conceived the idea of ​​combining MATLAB and VRML to develop a virtual design system for cam mechanisms. A framework for a virtual design system for cam mechanisms was established, and a system capable of virtual designing various commonly used cam mechanisms was developed. 1. Basic Technology Introduction This software is programmed using the M language provided by MATLAB on the Windows 2000/NT platform. VRML technology is used to realize the 3D modeling of cam mechanisms, and the virtual scene interaction and simulation are achieved through the interface provided by MATLAB's Virtual Reality Toolbox. 1.1 Virtual Reality and VRML Technology Virtual Reality (VRML) refers to a virtual environment that provides multiple sensory stimuli and interactive operations by comprehensively utilizing computer graphics systems and various display and control interface devices. It is an advanced human-computer interaction system. Virtual Reality has characteristics such as multi-sensory, immersion, interaction, and autonomy, conforming to people's natural interaction habits and forming the basis of virtual design. VRML (Virtual Reality Modeling Language) is a 3D modeling and rendering graphical descriptive language developed by SGI. In December 1997, it was recognized as an international standard by the International Organization for Standardization (ISO) JYCI/SC24 committee (ISO/IEC 14772-1:1997). VRML is a text-based, graphically descriptive 3D modeling and rendering language, simpler than any programming language for creating virtual scenes. It defines most concepts in 3D applications through nodes, such as light sources, viewpoints, geometry, fog, material properties, and texture mapping. It features strong interactivity, platform independence, open source code, small size, and high versatility. VRML provides 6+1 degrees of freedom, allowing movement and rotation in three directions, and can also establish hyperlinks with other 3D spaces. 1.2 MATLAB and its Virtual Reality Toolbox MATLAB is a software product developed by MathWorks for education, engineering, and scientific computing, and is an internationally recognized standard computing software in the control community. MATLAB primarily consists of three parts: the MATLAB main program, the Simulink dynamic simulation system, and various MATLAB toolboxes. The main program includes five parts: the MATLAB language (M language), the development environment, graphics handles, mathematical function libraries, and application programming interfaces (APIs). Simulink is a software package used for modeling, simulating, and analyzing dynamic systems, offering advantages such as intuitiveness, convenience, and flexibility. MATLAB toolboxes are collections of M-files written in M ​​language to address the specific needs of different professional fields, facilitating the solution of common problems within those fields. Currently, MATLAB has over 50 toolboxes and functional modules, capable of solving problems in many professional fields. These toolboxes can also call each other within the MATLAB environment, greatly expanding MATLAB's capabilities across various domains. Since version 6.1, MATLAB has integrated the Virtual Reality Tolbox, extending the capabilities of MATLAB and Simulink to virtual reality graphics. Using standard VRML technology, 3D scenes can be generated through MATLAB and Simulink environments. The Virtual Reality Toolbox provides flexible MATLAB interfaces for connecting to the virtual reality world. Through these interfaces, it is easy to control various nodes in the virtual scene, thus providing an effective solution for MATLAB to perform visualization operations and interact with dynamic systems in a 3D virtual reality environment. This paper uses MATLAB version 6.5.1, the corresponding Simulink version 5.1, and the Virtual Reality Toolbox 3.1. 2. Software Design Philosophy This virtual design system integrates the generation of working surface data points for various commonly used cams; 3D graphics modeling, display, observation, and control; motion simulation of cam mechanisms; performance analysis of cam mechanisms; dynamic interactive operation between the user and the virtual scene; pressure angle, curvature, and optimization analysis; data visualization; design result saving; and system help, among other functions. The most basic design philosophy of the system development is to utilize the relatively mature functions and strengths of MATLAB and VRML to reduce the difficulty of implementing the virtual design system, simplify the implementation process, and shorten the system development cycle. The system design generally follows the object-oriented design philosophy, adopts a modular design method, and is implemented using MATLAB's high-level object-oriented programming language—M language. During program implementation, relevant computational and graphics functions in MATLAB are used to realize the system's numerical calculation and visualization functions; MATLAB's graphical user interface (GUI) technology is used to develop the human-computer interface for user interaction with the system; VRML scene files are generated in real time through programming; VRML's 3D modeling and graphics rendering functions are used to realize the system's 3D graphics and interactive control functions; and the simli-simulation model in MATLAB and relevant interface functions in the Virtual Reality Toolbox are used to realize the dynamic simulation of the cam mechanism in a virtual scene. 3. System Functional Modules This system contains eight functional modules: startup module, main interface module, parameter input module, motion law module, optimization analysis module, parameter verification module, virtual prototype generation module, and simulation model module. Each functional module will complete its predetermined function through its included programs. The descriptions of each functional module are as follows: Startup Module: This module consists of the system startup program camvdstart.ll. This program primarily uses a command-line based approach to construct a welcome screen for system startup, displaying information such as the system's development organization and copyright details. The main interface module, composed of the program `camvirtualdesign.ll`, runs together with related programs in the parameter input module, forming the main interface for the virtual design of cam mechanisms for user interaction. Similar to the startup program, `camvirtualdesign.ll` also primarily uses a command-line based approach to construct the graphical user interface. It provides the basic framework for user interaction and is also the fundamental module for system calls and management of other modules. Based on the principles of user convenience and concise window settings, this module, through enhanced sharing and real-time refresh methods and technologies, centralizes the interactive interfaces for various cam mechanism designs onto a single main interface. Users can complete the entire process of designing, analyzing, and simulating various cam mechanisms simply by operating on the main interface, thus greatly reducing the number of human-machine interface windows, ensuring a simple system interface, and facilitating user operation. The parameter input module provides corresponding parameter input interfaces according to different cam mechanism types to complete the input of various parameters for the cam mechanism. This functional module contains multiple subroutine modules, each generating a graphical interface displayed in the "Cam Mechanism Parameter Input Area" provided by the main interface module. The interfaces provided by each subroutine are interconnected; only one subroutine can be called at a time, meaning only the interface provided by one subroutine can be displayed. Interfaces from previously called subroutines will be cleared. The Motion Law Module is implemented by the motion law subroutine `movementrule.ll`. This program uses the `s-tch...case` structure to include dimensionless expressions for displacement, velocity, acceleration, and jerk of 16 commonly used motion laws. When this program is called, it calculates the values ​​of the corresponding dimensionless expressions based on the passed motion law identifier and returns them to the calling function or workspace. The Optimization Analysis Module consists of several optimization analysis subroutines corresponding to various cam mechanism types. These subroutines perform optimization analysis on the content required for different types of cam mechanisms, calculating and analyzing using corresponding mathematical expressions, and then displaying the results graphically in the integrated display area using the `plot` visualization command function. Users can operate, observe, and analyze the graphics in the comprehensive display area by using the relevant buttons in the general button area to help select more ideal parameters. The parameter verification module checks and verifies the pressure angle and radius of curvature of various cam mechanisms to ensure their performance. Since the parameters to be verified differ for different cam mechanisms, and the expressions for each verification also differ, this module contains several different subroutines. The virtual prototype generation module is a crucial functional module of the system. It contains several subroutines that calculate the spatial coordinate values ​​of the working surfaces of various cam mechanisms using the "equal rotation angle method," and then automatically generate corresponding virtual prototype VRML files for the cam and follower based on certain constraints. These VRML files are then equipped with background, lighting, viewpoint, and scene information to form a complete virtual scene VRML file for the cam mechanism. This functional module is the foundation for the system's 3D visualization and virtual dynamic simulation. During implementation, the software uses a polyhedral boundary representation to define and store the shape information of the cam. Thus, after obtaining the spatial coordinates of the cam working contour curve through the data models of each cam mechanism, the spatial modeling of the cam working surface is realized through relevant nodes in VRML, thereby achieving the three-dimensional modeling of the cam and cam mechanism. The implementation process follows the flow of "planning the geometric structure of the cam mechanism → obtaining motion and geometric parameters → taking step lengths and determining equidivided angles → dimensionless processing → calling the motion law subroutine → calculating the boundary coordinates of the working surface → calculating the cam boundary coordinates → calculating the follower coordinates → data processing → planning the virtual scene structure → VRML file generation". The simulation model module contains various SimLink simulation models of different cam mechanisms. During virtual simulation, the corresponding model is called according to different cam types to achieve control and motion simulation of the cam mechanism in the virtual scene. The system forms an organic whole through the calling and data transfer between the above eight functional modules, thereby completing the virtual design of various cam mechanisms. The calling relationship and working mechanism of the system functional modules are shown in Figure 1. 4 System Implementation Select the system startup program cmnvdstart.m to run. After displaying the startup interface for a few seconds, the system will automatically enter the main interface of the cam mechanism virtual design. After the user selects the type of cam mechanism to be designed using radio buttons and drop-down menus on the main interface, the parameter input area of ​​the main interface will refresh and display the design parameter input interface for the selected cam mechanism. Through this interface, users can design some commonly used cam mechanisms. Figure 2 shows the human-machine interface captured when designing a cylindrical cam with a roller direct-acting follower. The right side is the main design interface, while the left side is an IE browser with the blaxxun CC3D plugin that automatically opens when 3D display and dynamic simulation are required. Users can freely drag and drop the browser and adjust its size, and also interact with the virtual scene within it. During the design process, the system will provide users with information on parameter optimization, performance analysis, etc., through the comprehensive display area. As shown in Figure 2, the comprehensive display area displays the dimensionless motion characteristic diagram of the selected follower's motion law. The "zoom switch" and "grid display" buttons on the right side can be used to zoom in and out, and to show or turn off the background grid. Figure 3 shows the analysis examples of auxiliary optimization in the integrated display area when designing a disc cam mechanism. Figure 3b shows a partial magnification of Figure 3a with the grid display enabled. For the verification of the pressure angle or radius of curvature, the system will provide the verification results and improvement suggestions via a pop-up information box. Additionally, if the user makes a mistake in setting or incorrectly setting design parameters, or performs an error operation, the system will also provide an error message via a pop-up information box. After the cam mechanism is initially designed, the user can use the mouse to perform comprehensive interactive operations and observations of the designed cam mechanism in a virtual scene, and use the "3D Simulation" and "Stop Simulation" buttons to perform virtual dynamic simulation and control the simulation process. At this time, the "Performance Analysis" button can be used to observe some motion parameter characteristics of the cam movement in the integrated display area. Figures 4 and 5 show the disc cam mechanism with a pointed bottom direct-acting follower and the arc-surface indexing cam mechanism designed using this system. The parameters, graphics, and other data of the cam mechanism that is satisfactory in the design can be saved to the user-specified folder via the "Save Data" button. 5. Conclusion VRML is a standard and widely used virtual reality technology with advantages such as powerful functionality, open source code, and ease of implementation. MATLAB software is powerful, with simple yet rich language statements, open format, and good scalability. Its integrated virtual reality toolbox extends the excellent capabilities of MATLAB/Simlink to the virtual world created by VRML. Combining MATLAB and VRML to develop a virtual design system for cam mechanisms can rationally utilize the existing advantages of both MATLAB software and VRML technology, absorbing their respective strengths, thereby effectively reducing the difficulty and intensity of software development, and is of great significance for shortening the software development cycle and improving software performance. The implementation of this system enables users to quickly design and virtually simulate various commonly used cam mechanisms, and also lays a practical foundation for developing other virtual design systems based on MATLAB and VRML.
Read next

CATDOLL Charlotte Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22