Written by Dave Martin
• 12/27/2023
• Read Time : 3 min.

# Mathcad Community Challenge November 2023: Mechanical Engineering

In a surprise twist of events, the winner of this month’s challenge is… me. For some reason, this challenge did not appeal to the audience. In the last third of the month, I began posting steps in the progress of my solution, hoping to inspire someone to build on my work. Alas, there were no takers.

## The challenge

This month's challenge was a mechanical engineering problem. A key is a mechanical component used to transfer power between a rotating shaft and a machine component (in this example, a flywheel).

The challenge was to create a worksheet that performs the following:

• Calculate the torque that can be transmitted by the reduced shaft diameter (the diameter not including the keyway).
• Calculate the shear stress and compressive stress on the key and shaft.
• (Optional) Using the technique presented by Dr. Heffernan in this video, include a simple image of the shaft and key with a transparent background. The image does not have to be to scale. The transparent background is the important part.
• (Optional) Create a Chart Component or X-Y Plot of the shear stress as function of the breadth/width of the key. (Or for more intuitive communication, plot the ratio of shear stress relative to the yield strength in shear as a function of the key. Assume that the material fails in shear at half the nominal yield strength.)
• (Optional) Use Combo Boxes, Tables, Matrices, or other methods to turn this into a “working” worksheet, where users can select different materials, design factors, torque cycles, or other factors of their choosing.

## The solution

The main part of the challenge was fairly straightforward: calculate the torque capacity of the shaft, the compressive stress of the key onto the crankshaft, and the shear stress in the key. The torque capacity required an intermediate step of calculating the moment of inertia. But other than that, I solved for these values with just variables and math expressions.

When tackling later steps in the challenge, I realized that I had been shortsighted. I had to turn the math expressions into functions, which I should have done from the start. Functions provide much more flexibility.

View the full worksheet on the PTC Community now.

One of Mathcad’s greatest strengths for engineering calculations, especially when compared to tools like Microsoft Excel, is the ability to document your worksheet. Being inspired by previous submissions, I used text fonts, text color, and Areas to help readability and organization.

The first optional challenge was to add an image using the technique demonstrated by Dr. Heffernan in the Mathcad for Civil Engineers webinar. It involves creating an image manually in PowerPoint, saving that image to a picture file, and then inserting the image into a worksheet.

This imported image has a transparent background and looks simply fantastic against Mathcad’s graph paper interface. I recommend everyone learn this technique and use it whenever possible.

## Communicating results to your audience

The second optional challenge was to graph the shear stress versus key width using either the X-Y Plot or Chart Component. I prefer Chart Components because they offer so many more formatting options for generating publication-ready graphs and can be exported to standard image file formats.

It doesn’t matter how good your results are if your audience doesn’t understand them. That’s why I prefer normalizing stress results relative to the yield strength. In the second Chart Component, I added a second Y-axis expression with a value of 1 and changed its formatting to a dashed red line. This helps convey to people with less of a technical background what’s safe and what isn’t.

## Working worksheets

Generally, I find that worksheets fall into three categories: a solution to a specific problem, teaching tools, and “working worksheets.” The latter means that the worksheet behaves like a form where people can vary the inputs for a standardized problem to drive problem development. Key sizing is a task that certain engineers may need to perform over and over again.

Combo Boxes from the Input/Output tab can be used for this purpose. However, there are other techniques you can use, like tables and matrices with lookup functions. “Working worksheets” can be embedded into Creo Parametric parts and assemblies to drive 3D CAD geometry. When you create a worksheet, think about how you can make it reusable for yourself and others and how you can leverage it for future problems.

## My lessons

The first thing I realized is how much I have learned from the Mathcad community and those who have participated in previous challenges. If you look at my worksheets, there are techniques that came from previous submissions. I highly encourage everyone to download previous challenge entries to see how you can improve your own work.

Secondly, I was reminded of something I used to tell all my Introduction to Pro/ENGINEER and Introduction to Creo students: The more thinking you do upfront, the fewer problems you’ll have later. I jumped in and created my worksheets essentially on the fly. Just a few minutes of planning would have generated better results.

## What’s next

Join us in 2024 for a brand-new challenge in an area we’ve never explored before: statistics!