- Graph Drawing
Ph.D., Bud, Zhang, Tan May Fox, Wenzu Ph.D., Ling M.Sc. · 2012
The Output block currently displays numerical data to the screen via a message box using an AfxMessageBox() function call. This mechanism is suitable only if specic numerical data values need to be veried, but typically, the user wants to see a graphical relation between the dependent variable, e.g., f(t), f(t), or F(t), for scalar, vector, and matrix functions, respectively, and the independent variable t. That is, the output signal-a scalar, vector, or matrix value-is to be plotted with respect to time for all time points of the simulation. The following instructions indicate how graph-like drawing is added to the DiagramEng project to display the data of the Output block in a separate view window. The general steps to add this functionality are as listed while specic details are provided in the sections that follow: 1. Adding structure to display an empty view window 2. Supplementing existing classes to access Output block data 3. Plotting data as a text string 4. Plotting numerical data as a graph 5. Deleting an Output block and its view 6. Adding functionality to the Output block dialog window Various steps are required toward implementing functionality to draw a graph in a window associated with the Output block to display its contained accumulated simulation signal data. In an article titled “Multiple Document Interface Applications, Serialization and Multiple View Support” by Mahmood, the author mentions that when providing different view types to a document: (1) different pointers-toCDocTemplate objects need to be declared in the CNameApp class, (2) pointers-to-CMultiDocTemplate objects need to be created in the CNameApp::InitInstance() function, and then (3) the pointersto-CMultiDocTemplate are passed to the CMainFrame class to generate the different views (here Name denotes the application name and for the current project it is DiagramEng) [1].