Mathcad Interface
Mathcad Interface
Table of Contents
Before you begin ................................................................................................... 3 Exchanging information with VisSim and Mathcad 2000+..................................... 3
Embedding Mathcad documents ............................................................................................................. 3 Editing and updating Mathcad documents .............................................................................................. 4 Scaling and cropping embedded Mathcad documents ............................................................................ 5 Changing the number of connector tabs on an embedded Mathcad document........................................ 5
Troubleshooting ........................................................................................................ 5
Server Busy message............................................................................................................................... 5 Incorrect results....................................................................................................................................... 6
1.
2. 3. 4.
Activate the Create from File option. Click on the Browse button to find the Mathcad document (.mcd) you want to embed in your VisSim diagram. Click on the OK button, or press ENTER. To embed a new Mathcad document Choose Tools > Insert Mathcad Object. The Insert Object dialog appears.
1.
2. 3. 4.
Activate the Create New option. In the Object Type list box, select Mathcad Document. Choose the OK button, or press ENTER.
1. 2. 3.
4.
1. 2. 3. 4.
1. 2. 3. 4.
Troubleshooting
This section contains information that may help you work through problems you encounter.
Just click on the Retry button a few times. Once the control is fully loaded, you will not see this message for the rest of your session.
Incorrect results
The most common reason for getting unexpected results when using an embedded Mathcad document is due to input/output mismatch caused by incorrect numbering. When you are entering an expression or equation in an embedded Mathcad document, it is important to remember that the input and output keywords begin with the index of 0, and not 1. In other words, the first (that is, top) input connector on the embedded Mathcad document is represented in the Mathcad expressions by the keyword in0; the second input by the keyword in1, and so on. Similarly on the output side, the first (that is, top) output of the embedded Mathcad document takes the value defined by the keyword out0; the second output takes the value of out1, and so on. For examples of setting up the input-output relationship in an embedded Mathcad document, see the preconfigured examples in the /MATHCAD_EXAMPLES directory. Brief descriptions of these examples can be found under Pre-configured examples.
VisSim creates a Mathcad object window. The environment automatically changes to the standard Mathcad editing work-area. 4. In the Mathcad object window, type the following expression:
out0 := in0 + in1
Important: The keywords out0, in0, and in1 must be lowercase. 5. 6. Click outside the Mathcad object window to return to the VisSim editing environment. The menus automatically change back to VisSim menus. Attach one more input connector tab to the embedded Mathcad document.
7.
Wire two const blocks (Blocks > Signal Producer > const) to the inputs on the embedded Mathcad document and set their parameter values to 3 and 4; then wire a numerical display block (Blocks > Signal Consumer > display) to the output on the embedded Mathcad document to see the result.
8. 9.
Choose Simulate > Simulation Properties. The Simulation Properties dialog box appears. Set the Start and End values to 0 and 1, respectively.
10. Click on the OK button, or press ENTER. 11. Choose Simulate > Go, or click on the Run button in the toolbar. You can alternatively press the F5 key on your keyboard. 12. VisSim passes the values of the constants you have selected to Mathcad via the embedded Mathcad document, obtains the computed output value, and displays it in the display block.
Pre-configured examples
Several pre-configured examples have been included to help you use and evaluate the Mathcad simulation interface. These examples are located in the .../MATHCAD_EXAMPLES directory in which VisSim/Comm 4.5 was installed, and are briefly described below.