Работа с другими приложениями

Импорт данных - обзор

VisSim uses the import block to import information from many different file types generated by other applications. These include data files (.DAT), MatLab and MatLab-like files (.MAT and .M), and 8-bit or 16-bit sound files (.WAV).

The import block reads data points from the specified input file into the system model and translates them into scalar, vector, or matrix output signals. The data can be either fixed interval or asynchronous.

The import block is particularly useful for comparing experimental data with simulated results and for inserting trial control data from an external source.

Подготовка входного файла

The input file can contain a header line to describe the separation of data points. The following table describes the header line format:

For this type of interval Use this format
Fixed interval #I=start-time, end-time, increment
Asynchronous interval #T=number (time-column)

Настройка импортирующего блока

Importing data involves dragging an import block into the work area and setting up the block to reference the input file.

To import data:

  1. From the Signal Producer category in the Blocks menu, drag an import block into the work area.
  2. Choose Edit > Block Properties.
  3. Click the mouse over the import block.
    The Import Properties dialog box appears.
    #########
  4. Choose the import options, then click on the OK button, or press enter.
Indicates the file to be used as input to VisSim. You can specify .DAT, .M, .MAT, or .WAV files. If you do not know the name or location of the input file, click on the Select File button to locate and choose a file.

To browse or edit the input file, click on the Browse Data button after you select a file.
File Name
When you specify a .WAV file, you can play the sounds you imported by clicking on the Play Sound button. Play Sound
In a multi-column file, you can choose the column that corresponds to the top-most connector tab. The default value 1 corresponds to the first column. Start Column
Indicates the type of data to be imported. Type
Controls the dimensionality of the output signals. The choices are scalar, vector, and matrix. Dimension
Interpolates between two data points, instead of using the last known data value. Thus, if the data point is 5 at t1, and 15 at t2, then at t1.5, the data point is 10 with, 5 with no interpolation. Interpolate
Infers the next unknown data point based on the difference between the last two known data points. Extrapolate
Indicates the time interval between data points in the input file. If the input file was generated by VisSim using the export block, VisSim automatically reads the time interval information from the file header and sets the parameter accordingly. Data Point Time Delta
Indicates that data points occur in fixed intervals. Enter the interval in the corresponding box. This is the default setting. Fixed Interval
Indicates that data points occur in irregular time intervals. Enter the column containing the time data points in the corresponding box. Valid column numbers are 1 through 16. Time Data Column
Provides read-only information about the imported data. The Start Time and End Time fields indicate when VisSim starts and stops recording data. The Data Point Count field indicates the maximum number of data points to be read into VisSim. If the input file was generated in VisSim using the export block, VisSim automatically reads the data point count from the file header and sets the field accordingly. The maximum number of data points that can be read into VisSim is 250 million . Data File Info

 

Экспорт данных. Обзор

The export block writes 1 to sixteen signals to an output file in .DAT, .M, .MAT, or .WAV file format. The output file can subsequently be used as input to VisSim or to a variety of other programs, such as MatLab and Microsoft Excel. The following information is written to the file:

Data points that represent signal values. Data points are stored as ASCII text.

Time interval information that applies to the data points.

Настройка экспортирующего блока

Exporting data involves dragging an export block into the work area and setting up the block to reference the output file.

To export data:

  1. From the Signal Consumers category in the Blocks menu, drag an export block into the work area.
  2. Choose Edit > Block Properties.
  3. Click the mouse over the export block.
    The Export Properties dialog box appears.
    #########
  4. Choose the export options, then click on the OK button, or press enter.
Indicates the name of the export file into which data points are to be written. You can type the file name directly into this box or select one using the Select File button. If you do not specify a data file, VisSim writes the data points to a file using the same name as your current block diagram. VisSim applies the .DAT extension to the file and stores it in your current directory.

For information on other file formats for exported data, see File formats for exported data.

If you click on the Browse Data button, the file specified in the Data File Name box is opened for you to examine or edit.
Data File Name
Indicates that data points occur in fixed intervals. The default interval used will be taken from the simulation step size. You can specify a different interval, however, it should be a multiple of the simulation step size, because the export block does not interpolate. Data is only exported at integral multiples of the simulation step size. This automatic adjustment is invisible when it occurs, which means it is not reflected in either the export block’s dialog box or the data file header. You can see the adjustment only when you open the data file.

If you import the output file into a simulation, you should edit the file header to reflect the interval at which the data was actually exported. The import block will interpolate as needed, retaining the timing of the original simulation run. Use the Browse Data button to open the data file for editing. The format of the data header file should be as follows:

#I = start-time, end-time, increment
Fixed Interval
Indicates that data will be recorded based on the state of the external trigger input. When External Trigger is activated, VisSim adds a round input connector tab to the export block. A zero value on the trigger inhibits data recording. A value of 1 causes a data point to be recorded.

Valid column numbers are 1 through 16, inclusive.
External Trigger
When activated, Periodic Data Flush writes the data in the export buffers to the specified data file at intervals established with Flush Interval. Periodic Data Flush and Flush Interval
Suppresses writing the data header to the export file. Suppressing the data header may be necessary if the export file is to be imported into a software product other than VisSim. For information on the data header, see Header information. Suppress VisSim Header
Specifies the column separation character in the export file, which allows for compatibility with other applications. Recognized column separators are tabs, new lines, spaces, commas, semi-colons, and colons. Field Separator
Specifies (for .DAT, .M, .MAT files) the maximum number of significant digits printed regardless of the decimal point. The default is 15.

For .WAV files, use Digits Of Precision to indicate whether the sound file is 8-bit or 16-bit. Enter 8 for 8-bit sound files or 16 for 16-bit sound files.
Digits of Precision
Appends the exported data to the end of a specified file, instead of re-writing the file at the start of each new simulation run. This parameter is useful for multi-run applications, such as data acquisition, Monte Carlo simulations, and neural network training. Append to File
Specifies a comment that is placed at the beginning of the exported data file. A comment is limited to 180 characters. Comment
Provides read-only information about the export file. The Start Time and End Time fields indicate when VisSim starts and stops writing data points to the export file. These settings are obtained from the current settings of Range Start and Range End in the Simulation Properties dialog box.

The Max Data Points field indicates the maximum number of data points to be written to the export file. The default is 512 data points. The maximum number of data points that can be written to file is 250 million.
Data File Info

Форматы экспортируемых данных

You can export data in .DAT, .M, .MAP, .MAT, and .WAV file formats. The following special considerations apply to map files and wave files:

If you want to create an output file to be used as input to the map block, you must specify the .MAP extension.

You can create 8-bit and 16-bit sound files. You specify the bit count in the Digits of Precision box. Provided you have the appropriate hardware configuration and software drivers installed, you can preview the sound by clicking on the Play Sound button.

Информация в заголовке файла

The header information indicates whether the data is fixed or variable interval; the valid time range over which the data is collected; the actual fixed interval; and the time column for variable interval data. The following formats are used:

Fixed Interval #I = start-time, end-time, increment
Variable Interval #T= number (time-column)

 

Интерфейс VisSim-MatLab - обзор

The VisSim-MatLab interface allows you to access MatLab to perform matrix calculations and transfer variables between the two applications. VisSim provides three interface blocks:

To use the VisSim-MatLab interface, MatLab version 5+ must be installed on your computer. All the blocks are located under the Blocks > MatLab Interface.

Исполнение выражений MatLab-а

The MatLab Expression block evaluates MatLab expressions using the MatLab engine. The MatLab Expression block accepts any number of matrix inputs and produces a single matrix output.

With MatLab expressions, you can more easily execute matrix operations. To illustrate a simple element multiply using the MatLab Expression block, consider the following example:

>> a = [1 2 3 4]

a =

1 2 3 4

>> b = 22

b =

22

Here, two matrices a and b are defined in the MatLab workspace. To multiply the matrices by a four element VisSim matrix ([1 2 3 4]), you set up your diagram as shown below:

#########

Ввод MatLab-выражений

Setting up a MatLab expression

The MatLab Expression Block Properties dialog box lets you set up your expression:

#########

Indicates a MatLab expression. A MatLab expression consists of one or more MatLab tokens. You enter expressions according to the syntax rules for the MatLab language. If you’re unfamiliar with the language, refer to the MatLab documentation.

The MatLab Expression block accepts any number of matrix inputs and produces a single matrix output. You reference the inputs in the expression using the notation $1 for input 1, $2 for input 2, and so on.
MatLab Expression
Gets the expression result from MatLab for the first time step. Execute Expression Once at Sim Start

 

Чтение и запись переменных MatLab-а

To read and write MatLab variables, use the MatLab Read Variable and MatLab Write Variable blocks. For example:

#########

Here, the MatLab variable a is read into VisSim. The display block shows that a is a 1 * 4 matrix.

To write a variable to MatLab:

#########

This time, the variable e is a 2 * 2 matrix, as shown in the MatLab command window.

Считывание переменных MatLab-а в VisSim

  1. Choose Tools > MatLab Connect.
  2. Click on the MatLab Read Variable block.
  3. Click the mouse in the workarea.
  4. Choose Edit > Block Properties and click on the MatLab Read Variable block.
    The MatLab Read Variable Block Properties dialog box appears.
    #########
  5. Do the following:
  6. To verify that the data has been properly passed to VisSim, do the following:

Запись переменных в MatLab

  1. Choose Tools > MatLab Connect.
  2. Click on the MatLab Write Variable block.
  3. Click the mouse in the workarea.
  4. Choose Edit > Block Properties and click on the MatLab Write Variable block.
    The MatLab Write Variable Block Properties dialog box appears.
    #########
  5. Do the following:
  6. Feed matrix input into the MatLab Write Variable block.
  7. Choose Simulate > Go, or press the ######### button.
  8. To verify that the variable has been passed to MatLab, do the following:

Передача данных с применением ActiveX

VisSim offers the ActiveX read and ActiveX write blocks for real-time, interprocess communication. Using these blocks, you can exchange data with other applications that support ActiveX. The ActiveX read block receives data from the Active X container; the ActiveX write block sends data to an ActiveX container.

Required files

To register properly, the VisSim ActiveX control requires the following files:

File Location
MFC42.DLL \WINDOWS\SYTEM
MSVCRT.DLL \WINDOWS\SYSTEM
OLEAUT32.DLL \WINDOWS\SYSTEM
VSMIPCD.DLL \VISSIM45

Принимающий блок ActiveX

The ActiveX read block links source information in an application file to a VisSim block diagram. The source application must be an ActiveX container.

#########

Indicates the name of the ActiveX control. Click on the down arrow to choose from existing names. Name
Indicates the current value for the ActiveX control. This is a read-only box. Value

Создание ActiveX-связи для чтения данных в VisSim

Follow this general procedure when you want to read data into VisSim. Because each application may handle ActiveX controls differently, see that application’s documentation for specific instructions.

After you have established your link between the application and VisSim, run the simulation to begin transmitting data.

  1. In the application, insert the VisSim ActiveX control or OLE object.
  2. The following element appears in the workspace:
    #########
  3. To manipulate the data:

    The VisSim IPC Control Properties dialog box appears.

    #########

  4. Do the following:
  5. Start VisSim and open the appropriate block diagram.
  6. Click on Blocks > Real Time > ActiveX read.
  7. Click the mouse where you want the ActiveX read block to be inserted.
  8. Choose Edit > Block Properties.
  9. Click on the ActiveX read block.
  10. In the Name box, click on the down arrow and select the name of the ActiveX control that you specified in the corresponding VisSim IPC Control Properties dialog box (step 3).
  11. Click on the OK button, or press enter.
  12. Run the simulation.

Передающий блок ActiveX

The ActiveX write block links source information in a VisSim block diagram to another application. The destination application must be an ActiveX container.

#########

Indicates the name of the ActiveX control. Click on the down arrow to select from a list of active names, or type in a new one. Name
Indicates a value for the signal. Typically, the value is set dynamically by the application. Value

Создание ActiveX-связи для записи данных в ActiveX контейнер

  1. Start VisSim and open the appropriate block diagram.
  2. Click on Blocks > Real Time > ActiveX write.
  3. Click the mouse where you want the ActiveX write block to be inserted.
  4. Choose Edit > Block Properties.
  5. Click on the ActiveX write block.
    The VisSim ActiveX Write Block Properties dialog box appears.
    #########
  6. Do the following:
  7. Switch to the destination application and open the file in which you want to create a link.
  8. Insert the VisSim ActiveX control or OLE object.
  9. Invoke the VisSim IPC Control Properties dialog box. For most applications, you click the right mouse button over VisSim::IPC var and select VisSim IPC Control Object; then click on Properties.
    The VisSim IPC Control Properties dialog box appears.
    #########
  10. Do the following:
  11. To manipulate the data:
  12. Return VisSim and run the simulation.

Специфичные функции VisSim-а

VisSim-specific functions

VisSim supports two functions for ActiveX design:

The getlpcValue function gets the 64-bit floating point value associated with the named data item. The setlpcValue function sets the 64-bit floating point value associated with the named data item.

Пример использования ActiveX-связи

The following example demonstrates how to send data to Excel, manipulate the data and return it to VisSim in real time.

In the VisSim window, the ActiveX write block named level writes a sinusoidal signal to Excel. The value is displayed in cell C3. Cell C4 displays the value of C3 plus 2. The sum is sent back to VisSim through the ActiveX read block named poo.

A subroutine, shown in the Microsoft Visual Basic window, gets the data from level and displays it in cell C3; then writes the data from C4 to poo. This simple subroutine only updates the value of C4 and sends the data to VisSim each time you click the mouse on a different cell.

#########

 

DDE - обзор

By creating dynamic data exchange (DDE) links, you can share information in one file with several other files, and you need only maintain the original file; the other files are updated automatically. For example, if you store data in a Microsoft Excel spreadsheet, you can use that data in a VisSim block diagram. When you update the spreadsheet, VisSim automatically updates the data in the block diagram when you run a simulation.

You create DDE links by copying a selection from one application (referred to as the source or server) and pasting it into another one (referred to as the destination or client) using the Paste Link or Paste Special command. Before you can create a link, the source file must be saved to disk.

VisSim offers three blocks for creating DDE links:

You can create DDE links only between VisSim and other Windows applications that support DDE linking. Some applications do support DDE links, but do not support creating the links by copying and pasting selections. When this is the case, you can still create a link by entering the link address directly to both the source and destination files.

Создание DDE-связи от приложения к VisSim-у

Follow this procedure when the source information for the link is contained in an application other than VisSim.

To create a DDE link from an application into VisSim:

  1. In the application, select the information you want linked to your block diagram, and from the Edit menu, choose the Copy command.
  2. The selected information is copied to the Clipboard.
  3. Switch to VisSim and open the block diagram in which you want to create a DDE link.
  4. Do one of the following:
  5. Click on the Paste Link button and choose the options you want. (For information on the options, see the descriptions below.)
Indicates the name of the source application (server) and the type of information (topic). For example, Excel|FOO.XLS indicates an Excel spreadsheet named FOO.

If the source application supports Copy Link, VisSim automatically fills in this parameter when you click on the Paste Link button.

If the source application does not support Copy Link, you must enter the source application name and topic name directly to this box. Use the same names that the source file uses as its server and topic names. Separate the names with a pipe (|) character.
Server|Topic
This option does not apply to the DDEreceive block. Send Item
Indicates a name that references cells, cell ranges, values, or a field of data in the source file. For example, R1C1 references the information in the cell occupying row 1, column 1 of an Excel spreadsheet.

If the source application supports Copy Link, VisSim automatically fills in this parameter when you click on the Paste Link button.

If the source application does not support Copy Link, you must enter the same name that the source file uses as its item name.
Receive Item
This option does not apply to the DDEreceive block. Data Timeout
Indicates how often the DDEreceive block requests information from the linked application. If you enter the value 1, DDEreceive requests information once per sec; if you enter 10, DDEreceive requests information once every 10 sec; and so on. If you do not enter a value, DDEreceive updates at each time step of the simulation by default. Custom Update Interval
This option does not apply to the DDEreceive block. Poke Data
Suspends the simulation until the DDEreceive block receives a message with updated data.

The DDEreceive block has a buffer that contains the current value of the block. If the block is not synchronous, at every time step, DDEreceive supplies whatever value is in its buffer. When Synchronous Operation is turned on and the DDEreceive block has not received updated data since the last time step, DDEreceive waits until it receives a new message with updated data.
Synchronous Operation
Controls the dimensionality of the data exiting the DDEreceive block. The choices are scalar, vector (n x m), or matrix (m x n). Output Dimension
Applies a bitmap image to the DDEreceive block. You can type the file name directly into the Name box or select one by pressing on the Select Bitmap button. Bitmap
  1. Click on the OK button, or press enter.
  2. Choose Simulate > Go to update the link.

Создание DDE-связи от VisSim-а к приложению

Follow this procedure when the source information for the link is contained in a block diagram.

To create a DDE link from a VisSim block to another application:

  1. In VisSim, wire a DDEsend block to the output of the block that contains the information you want linked to another application.
  2. Choose Edit > Block Properties and click the mouse over the DDEsend block.
    The DDE Send Link Configure dialog box appears.
    #########
  3. In the Send Item box, enter a name. The default name is simDataIn.
    Note: When the block diagram contains multiple links to other applications (that is, the diagram contains more than one DDEsend block), the name you enter in the Send Item box must be unique to that block diagram. If it’s not unique, VisSim will not pass the correct information to the application.
  4. Choose the options you want. (For information on the options, see the descriptions below.)
Indicates the name of the source application (server) and the type of source information (topic). This parameter defaults to VisSim|name-of-block-diagram. The server name must always be VisSim. Server|Topic
Indicates a name for the source information. The destination file uses this name in its item field. To maintain multiple DDE links from a single block diagram, the name you enter must be unique. The information in this box defaults to simDataIn. Send Item
This option does not apply to the DDEsend block. Receive Item
This option does not apply to the DDEsend block. Data Timeout
Overrides the time step interval for sending data to the destination application. If you enter the value 1, DDEsend sends data once per sec; if you enter 10, DDEsend sends data once every 10 sec; and so on. If you do not enter a value, DDEsend sends data at each time step of the simulation. You can use Custom Update Interval only when Poke Data is activated. Custom Update Interval
Sends data to the destination application at every time step, regardless of whether it is ready to receive the data. When Poke Data is not activated, data is sent only when the destination application requests it. You can override the time step interval for sending data with the Custom Update Interval. Poke Data
Controls the dimensionality of the data entering the DDEsend block. The choices are scalar, vector (n x m), or matrix (m x n). Output Dimensions
Applies a bitmap image to the DDEsend block. You can type the file name directly into the Name box or select one by pressing on the Select Bitmap button. Bitmap
  1. Click on the Copy Link button.
  2. Click on the OK button, or press enter.
  3. Switch to the destination application and open the file in which you want to create a link.
  4. Position the insertion point where you want to insert the information.
  5. Choose Edit > Paste Link.
    Note: Some applications have a Paste Special command instead of a Paste Link command. Refer to the application's documentation for information on linking.
  6. Switch back to the block diagram, and choose Simulate > Go to update the link.

Создание двунаправленной DDE-связи

The DDE block is a combination of the DDEreceive block and DDEsend block: the DDE block can both send and receive information. As a server, the DDE block passes source information to another application to work on. As a client, the DDE block receives updated information back from the application.

To create a two-way DDE link

Use this procedure when you want VisSim to fill in the name of the server and topic pair of the destination application.

  1. Create the link to pass information from the application to VisSim:
    1. In the application, select the information you want linked to your VisSim block diagram, and choose Edit > Copy.
    2. The information is copied to the Clipboard.
    3. Switch to VisSim and open the block diagram in which you want to link the copied information.
    4. From the Blocks menu under DDE, drag a DDE block into the work area.
    5. Choose Edit > Block Properties and click the mouse over the DDE block.
      The DDE Link Configure dialog box appears.
    6. Choose the Paste Link button and the additional options you want. (For information on the options, see Using the DDE Link Configure dialog box.)
    7. Click on the OK button, or press enter.
  2. Create the link to pass information from VisSim back to the application:
    1. In VisSim, wire the block (containing the information you want linked to the other application) to the DDE block.
    2. Choose Edit > Block Properties and click the mouse over the DDE block.
      The DDE Link Configure dialog box appears.
    3. In the Send Item box, enter a unique name.
    4. Choose the Copy Link button and the additional options you want. (For information on the options, see Using the DDE Link Configure dialog box .)
    5. Click on the OK button, or press enter.
    6. Switch back to the application file.
    7. Move the insertion point to where you want to insert the information.
    8. Choose Edit > Paste Link.
      Note: Some applications have a Paste Special command instead of a Paste Link command. Refer to the application's documentation for information on linking.

Диалог конфигурации DDE-связи

The DDE Link Configure dialog box provides options for establishing a DDE link, specifying the source information, indicating the time-out interval, and more.

#########

Indicates the name of the application (server) and the type of information (topic) to which you’re establishing a link. For example, VBDDE|NNET sends data to and receives data from the application called VBDDE on the NNET topic. Use the pipe (|) character to separate the server from the topic. Server|Topic
Indicates a name for the source information. The destination file uses this name for its item field. To maintain multiple DDE links from a single block diagram, the name you enter must be unique. The information in this box defaults to simDataIn Send Item
Indicates a name that references cells, cell ranges, values, or a field of data in the source file. For example, R1C1 references the information in the cell occupying row 1, column 1 of an Excel spreadsheet.

If the source application supports Copy Link, VisSim automatically fills in this parameter when you click on the Paste Link button.

If the source application does not support Copy Link, you must enter the same name that the source file uses as its item name.
Receive Item
Overrides the time step interval for sending and receiving information. If you enter 1, DDE requests and sends information once per sec; if you enter 10, DDE requests and sends information once every 10 sec; and so on. If you do not enter a value, DDE updates at each time step of the simulation. Custom Update Interval
Indicates the time, in sec, that VisSim will wait to receive simulation time step data from the client. The default is two sec. Data Timeout
This option does not apply to the DDE block. Poke Data
This option does not apply to the DDE block. Synchronous Operation
Controls the dimensionality of the data entering and exiting the block. The choices are scalar, vector (n x m), or matrix (m x n). Output Dimension
Applies a bitmap image to the DDE block. You can type the file name directly into the Name box or select one by pressing on the Select Bitmap button. Bitmap

Создание DDE-связи с приложениями без механизма копирования и вставки настроек связи

A DDE link consists of a three-part link address contained in both the source (server) and destination (client) files. An example of such an address is shown below:

#########

Most applications, including VisSim, automatically create the link address using the Copy Link and Paste Link commands. If, however, the application with which you're linking supports DDE but not the Copy Link and Paste Link commands, you can still create a DDE link by typing the link address directly into the source and destination files. Just make sure that the server, topic, and item names are the same in source and destination files.

Refer to the descriptions of the DDE, DDEreceive, and DDEsend blocks for information on how to enter these fields directly into the blocks. Refer to the documentation for the other application for entering link addresses.

Статические модели - обзор

To create a look-up table, VisSim relies on the map block. There are two ways to set up a map block:

The Lookup Table wizard automates the process of setting up a map block by guiding you through the steps for specifying a data source, activating interpolation or extrapolation, and choosing the data file’s dimensionality.

The purpose of the Lookup Table wizard and map block is to allow you to encapsulate nonlinear behaviors through direct measurements. You can, for example, use laboratory data or a manufacturer’s component performance data directly in a simulation.

Спецификация источника данных

Whether you use the Lookup Table wizard or set up the map block manually, you must create the data source, typically referred to as a map file. A map file is a multi-column ASCII data file from which the input signals are mapped to the desired output domain. Signals can be separated by commas, spaces, tabs, vertical bars, colons, semicolons, or slashes.

A map file can be a one-, two-, or three-dimensional file.

Создание файла с одномерной таблицей (1D)

A one-dimensional map file has one independent variable, but can have from one to 16 dependent variable outputs. The first column is an independent variable range. The numbers in the independent variable column must be either increasing in order or decreasing in order, but not both. Each additional data column you supply in the map file yields an additional dependent variable. Use the Edit > Add Connector command to add an output connector for each dependent variable column in the resulting map block.

A one-dimensional matrix is limited to 8,000 rows. Lines that are prefaced with a semi-colon (;) are treated as comments.

Создание файла с двумерной таблицей (2D)

A two-dimensional map file has two independent variables and one dependent variable output. The first row contains the domain points for the first independent variable; and the first column (excluding the column member in row 1) represents the second independent variable. The position (1,1) must be left blank.

Like one-dimensional mapping, the independent variable values must be either monotically increasing or decreasing.

A two-dimensional matrix is limited to 90 rows by 90 columns (or, a maximum of 89 * 89 data points).

Lines that are prefaced with a semi-colon (;) are treated as comments.

An example of a two-dimensional map file is shown below.

  10 11 20 25
-5 -5 -2 1 20
2 2 5 7 10
3 3 7 8 5
4 4 9 10 2
5 5 11 15 -5

In the above matrix, the first row represents the domain points of the first independent variable, and the first column represents the domain points of the second independent variable. The entries represent the dependent variable values at the corresponding values of independent variables 1 and 2. For example, for ######### = 10, ######### = 2, the output is 2; for ######### = 10.5, ######### = 2.5, the output is 4.25.

Создание файла с 3D-таблицей

A three-dimensional map file has three independent variables and one dependent variable output. The format of the first seven lines is as follows:

Line Format
1 Starts with #3D
2 Indicates the size of dimension 1
3 Indicates the interpolation points of dimension 1
4 Indicates the size of dimension 2
5 Indicates the interpolation of dimension 2
6 Indicates the size of dimension 3
7 Indicates the interpolation of dimension 3

Lines 8 through n are elements of dimension 3 matrices of (dimension 1 columns) * (dimension 2 rows). Lines that are prefaced with double hyphens (--), double slashes (//), or commas (,) are treated as comments.

Dependent variables are linearly interpolated for independent variable values between map points, and linearly extrapolated for values beyond the bounds of the table using the last two points in the table. This feature can be used for static function approximation with measured data or for device calibration, such as thermocouple-voltage-to-temperature conversion.

Использование Мастера статических моделей

Using the Lookup Table wizard

You can use the Lookup Table wizard to create or change a look-up table.

Создание статических моделей с Мастером

  1. Choose Tools > Import > Lookup Table.
  2. The Get Data dialog box appears.
    #########
  3. In the Lookup Table Data box, enter the name of the map file to be used as input. You can type the name directly into the text box, or select one using the Select Data File button.
  4. Click on the Next button, or press enter.
    The Interpolation/Extrapolation dialog box appears.
    #########
  5. Under Interpolation Settings, make the desired selections.
If you select This occurs
Interpolation Allows dependent variables to be linearly interpolated for independent variable values between data points.
Extrapolation Allows dependent variables to be linearly extrapolated for values beyond the bounds of the table using the last two data points in the table.
  1. Click on the Next button, or press enter.
    The Map Dimensions dialog box appears.
    #########
  2. Choose the dimensionality of the map file.
  3. Click on the Next button, or press enter.
    The Create Map Block dialog box appears.
    #########
  4. Click on the Finish button, or press enter.
    VisSim displays the current block diagram. Attached to the pointer is a dashed rectangle representing the newly-created map block.
  5. Click the mouse to insert the map block in your diagram.

Использование блока 'таблица'

You can set up a look-up table or change an existing onel without using the Lookup Table wizard. You can alternatively insert a map block directly into your diagram and specify the data source, map dimensionality, and whether data is interpolated or extrapolated through the block’s Properties dialog box.

Вставка блока 'таблица'

Insert a map block

  1. Choose Blocks > Nonlinear.
  2. Click on the map block.
  3. Click in the work area where you want to insert the map block.

Установка, просмотр или изменение параметров блока 'таблица'

Set up, view, or change map block parameters

  1. Choose Edit > Block Properties.
  2. Click the mouse over the map block.
    The Map Properties dialog box appears.
    #########
  3. In the Map File Name box, enter the name of the map file. You can type in a file name directly into this box or select one using the Select File button. To open the specified file with the default text editor, click on the Browse Data button
  4. Under Map Dimensions, select the dimensionality of the map file.
  1. In the Type box, click on the down arrow and select the type of data read in from the map file.
  2. Select one, both, or neither of the following options depending on how you want the data interpreted.
Choose this To do this
Interpolate Allows dependent variables to be linearly interpolated for independent variable values between data points. This feature can be used for static function approximation with measured data or for device calibration, such as thermocouple-voltage-to-temperature conversion.
Extrapolate Allows dependent variables to be linearly extrapolated for values beyond the bounds of the table using the last two data points in the table. This feature can be used for static function approximation with measured data or for device calibration, such as thermocouple-voltage-to-temperature conversion.
  1. Click on the OK button or press enter.

Изображение WMF - обзор

One of the most common image file formats for the PC is the Windows Matafile Format (WMF). WMF files are vector files that yield high clarity and resolution when printed on high resolution devices.

When VisSim saves a diagram as a WMF file, it uses the number of colors available to your monitor. In general, you can use the generated WMF file in any application that recognizes this file format; however, in some cases, if you have set the size of your monitor’s color palette to greater than 256 colors, you may experience trouble printing or displaying the WMF file from the other application. In the unlikely event that this occurs, simply change the size of you color palette to 256 colors and resave the diagram.

Сохранение экрана в WMF-фале

When you save a VisSim diagram as a WMF file, VisSim saves only the current level of the diagram and strips away common window elements (including title bars, menu bars, and scroll bars). You should also keep in mind that the WMF file is a picture of the diagram; therefore, none of the block diagram information is preserved.

To save a VisSim diagram as a WMF file:

  1. Go to the level of the diagram that you want saved as a WMF file.
  2. Choose File > Save As Metafile.
  3. In the Save In box, enter or select the directory in which the WMF file is to be saved.
  4. In the File Name box, enter a name for the WMF file.
  5. Click on the OK button, or press enter.

Вставка WMF-файла в другое приложение

To insert a WMF file in another application, you use a command like Import, Insert, or Picture. For example, to insert a WMF file in a Word document, you use the Picture command under the Insert menu. Similarly, to insert a WMF file in a Pagemaker document, you use the Place command under the File menu. Because each application has its own unique method for inserting WMF files, you must read that application’s documentation for its particular procedure.

Below is an example of a WMF file of a VisSim diagram that has been inserted in a Word document.

#########

Exchanging information with Mathcad 2000

The primary purpose of embedding a Mathcad document is to run a simulation in VisSim that depends on one or more Mathcad calculations. These calculations could be performed:

Use of the inx and outx keywords

The fundamental means of setting up the exchange of data between a VisSim simulation and an embedded Mathcad document is the use of the keywords inx, and outx in the embedded Mathcad document.

Note that all keywords must be lowercase.

Embedding Mathcad documents

You can embed existing objects from files or insert new blank objects and create the information right in your diagram. To do so, you use the Insert Mathcad Object command in the Tools menu.

The following procedures explain how to embed objects in a VisSim diagram. For a step-by-step example on embedding a Mathcad document in a VisSim diagram, see the example under “Examples,” later in this document.

Embed an existing Mathcad document

  1. Choose Tools > Insert Mathcad Object > From File.
    The Find Mathcad Document dialog appears.
    #########
  2. Find and select the Mathcad document (.MCD) you want to embed in your VisSim diagram.
  3. Click on the OK button, or press enter.

Embed a new Mathcad document

  1. Choose Tools > Insert Mathcad Object >New.
  2. VisSim opens a Mathcad window in which to create an embedded Mathcad document.
  3. Create the document. For information on using Mathcad, see your Mathcad documentation.
  4. Click outside the Mathcad document to return to VisSim.

Editing and updating Mathcad documents

You can edit an embedded Mathcad document directly from VisSim, or you can invoke Mathcad as a separate, stand-alone application. To update the embedded Mathcad document and return to the VisSim environment, simply click outside the Mathcad document.

Edit an embedded Mathcad document directly from VisSim

  1. Do one of the following:
  2. From the drop-down menu, choose Mathcad Object > Edit.
  3. VisSim opens a Mathcad window with the Mathcad document.
  4. Make the changes you want. For information on using Mathcad, see your Mathcad documentation.
  5. Click outside the Mathcad document to update the Mathcad document and return to VisSim.

Invoke Mathcad as a stand-alone application

  1. Click the right mouse button on the embedded Mathcad document.
  2. From the drop-down menu, choose Mathcad Object > Open.
  3. VisSim opens a Mathcad window with the Mathcad document.
  4. Make the changes you want. For information on using Mathcad, see your Mathcad documentation.
  5. To update the Mathcad document and return to VisSim, do the following:

Scaling and cropping embedded Mathcad documents

You can resize an embedded Mathcad document by scaling or cropping it. When you scale an embedded Mathcad document, the text within the block is also scaled. When the dimensions of the embedded Mathcad document are much larger than the text, you can adjust the size of the block by cropping its sides. The size of the text within the block is not affected by this action.

Scale an embedded Mathcad document manually

  1. Click on the embedded Mathcad document.
  2. Position the pointer over one of the handles on the block.
  3. Hold down the mouse button and drag until the block is the size you want.
  4. Click outside the Mathcad document to return to VisSim.

Scale an embedded Mathcad document using the Mathcad Properties dialog box

  1. Click right mouse button over the embedded Mathcad document.
  2. In the drop-down menu, choose Properties.
  3. The Mathcad Properties dialog box appears.
  4. Click on the View tab.
  5. To scale the block with respect to its original size, activate the Relative To Original Size option.
  6. In the Scale box, select the scaling factor.
  7. Click on the Apply button to preview the new size.
  8. Click on the OK button to make the change permanent.

Crop an embedded Mathcad document manually

  1. Double-click on embedded Mathcad document.
  2. Position the pointer over one of the handles on the block.
  3. Hold down the mouse button and drag until the block is the size you want.
  4. Click outside the Mathcad document to return to VisSim.

Reset the size of an embedded Mathcad document

You can use this method when you cropped the embedded Mathcad document or when you scaled in manually.

  1. Click the right mouse button on the embedded Mathcad document.
  2. From the drop-down menu, choose Reset Size.

Examining the properties of an embedded Mathcad document

The Mathcad Properties dialog box lists the size of your embedded Mathcad document, and allows you to control the general appearance of the document in your VisSim diagram. You can also use the Mathcad Properties dialog box to scale the corresponding embedded document. This feature is described under Scale an embedded Mathcad document using the Mathcad Properties dialog box.

Access general information about an embedded Mathcad document

You can display the size and location of the embedded Mathcad document.

  1. Click right mouse button over the embedded Mathcad document.
  2. In the drop-down menu, choose Properties.
  3. The Mathcad Properties dialog box appears.
  4. Click on the General tab.

Control the appearance of an embedded Mathcad document

You can display the size and location of the embedded Mathcad document.

  1. Click right mouse button over the embedded Mathcad document.
  2. In the drop-down menu, choose Properties.
  3. The Mathcad Properties dialog box appears.
  4. Click on the View tab.
  5. Do the following:
To Do this
Display the contents of the embedded Mathcad document Activate the Display As Editable Information option.
Display a Mathcad icon Activate the Display As Icon option. Click on the Change Icon button to select the type of icon to be displayed.
  1. Click on the OK button.

Changing the number of connector tabs on an embedded Mathcad document

To add or delete connectors to an embedded Mathcad document, follow the standard procedures for adding or deleting connectors on VisSim blocks, as described under Add and remove connector tabs.

Troubleshooting

This section contains information that may help you work through problems you encounter.

Server Busy message

Occasionally, when VisSim loads the Mathcad interface OLE control for the first time, you may experience a delay and the appearance of the following message:

#########

Just click on the Retry button several 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.

Examples

Examples of Mathcad interacting with VisSim are located in the …/MATHCAD_EXAMPLES directory: