User Guide 024: Difference between revisions
(Created page with "13 Appendix C: Matlab Scripting Scipting refers to the automation of running multiple CMS runs with dif-ferent parameters, without manually having to create and edit each alte...") |
No edit summary |
||
Line 1: | Line 1: | ||
13 Appendix C: Matlab Scripting | =13 Appendix C: Matlab Scripting= | ||
Scipting refers to the automation of running multiple CMS runs with dif-ferent parameters, without manually having to create and edit each alter-native. The scripting process can include the following steps: | Scipting refers to the automation of running multiple CMS runs with dif-ferent parameters, without manually having to create and edit each alter-native. The scripting process can include the following steps: | ||
1. Setting up alternatives | |||
2. Creating batch file | :1. Setting up alternatives | ||
3. Plotting and analyzing results | |||
:2. Creating batch file | |||
:3. Plotting and analyzing results | |||
Scripting can be done using a variety of software programs. The examples shown here were written in Matlab because it is widely used, easy to read and convenient for plotting and analyzing results. | Scripting can be done using a variety of software programs. The examples shown here were written in Matlab because it is widely used, easy to read and convenient for plotting and analyzing results. | ||
Setting Up Alternatives | |||
In this example, 4 cases or alternatives (Figure 5.11.1) are set up using the Matlab script below. The script copies the base setup files into subfolders and then modifies specific CMS-Flow cards in the *.cmcards file. The set-tings for each case are setup using a structure variable with field names corresponding to each CMS-Flow card (e.g. TIME_SERIES_INCREMENT). Separating each case into its own subfolder keeps the input and output separate and also allows for the different cases to be run at the same time. | =Setting Up Alternatives = | ||
In this example, 4 cases or alternatives (Figure 5.11.1) are set up using the Matlab script below. The script copies the base setup files into subfolders and then modifies specific CMS-Flow cards in the *.cmcards file. The set-tings for each case are setup using a structure variable with field names corresponding to each CMS-Flow card (e.g. <span style="color:#0000FF"> TIME_SERIES_INCREMENT)</span>. Separating each case into its own subfolder keeps the input and output separate and also allows for the different cases to be run at the same time. | |||
figure d-1 | figure d-1 |
Revision as of 20:07, 2 May 2015
13 Appendix C: Matlab Scripting
Scipting refers to the automation of running multiple CMS runs with dif-ferent parameters, without manually having to create and edit each alter-native. The scripting process can include the following steps:
- 1. Setting up alternatives
- 2. Creating batch file
- 3. Plotting and analyzing results
Scripting can be done using a variety of software programs. The examples shown here were written in Matlab because it is widely used, easy to read and convenient for plotting and analyzing results.
Setting Up Alternatives
In this example, 4 cases or alternatives (Figure 5.11.1) are set up using the Matlab script below. The script copies the base setup files into subfolders and then modifies specific CMS-Flow cards in the *.cmcards file. The set-tings for each case are setup using a structure variable with field names corresponding to each CMS-Flow card (e.g. TIME_SERIES_INCREMENT). Separating each case into its own subfolder keeps the input and output separate and also allows for the different cases to be run at the same time.
figure d-1
matlab example
The script above requires the subroutine below.
matlab script
Creating a Batch File Although it is possible to launch CMS from Matlab a batch file is prefera-ble to use a batch file because it allows running all of the cases without opening Matlab.
matlab script
The following text shows what the resulting batch file (*.bat) looks like
example
To run the batch file, simply double click on the file and each case will launch separately in its own MS-DOS window. Plotting The following example reads the Observation Point time series output file (*_eta.txt) and plots the 3rd column corresponding to the second observation point.
example