Assign model the file name of the MapleSim model we want to analyze.
Use MapleSim[LinkModel] to link to the MapleSim model.
Inspect the available parameters.
Use the GetCompiledProc export of A to assign the module that will be passed to ParameterSweep. Assign nominal values for the three model parameters of interest.
Call ParameterSweep, using C1. Specify that the parameter R will be varied from 3.1 to 5.2, the parameter L will be varied from 1.2 to 3.5, and the parameter C to take values 4, 5, and 6. The number of elements used for R and L is five each, from the default of num_points. The C_opts argument specifies that the simulation should be for 1 second.
The list results contains 75 elements (). Inspect the first element.
Plot the output versus time for all simulations. To do that, generate a list of two-column matrices with the first column being the time and the second column being the output of interest. The seq command is used to sequentially access the Matrices in results. The expression A[..,[1,2]] corresponds to the appropriate sub-block of a Matrix. In this case, all rows (..) and the first and second columns, ([1,2]). Because each Matrix is already two-columns, we could have used the simpler notation A, however, if the system has more than one output (probe), we would then use the notation A[..,[1,k]], where k is the column of interest.
>
|
plot([seq(A[..,[1,2]], A=results)]);
|
Using the use_array option makes it easy to plot a slice of the results.
Plot all results with the first parameter (R) fixed at its second value and the second parameter (L) fixed at its third value.
Passing the ret_record option to ParameterSweep causes it to return a record which can be used to determine the values of the swept parameters.
Print the discrete values of the swept parameters.
>
|
for i to nops(results:-params) do
printf("%a = %a\n", results:-params[i], results:-values[i]);
end do:
|
R = [3.1, 3.625000000, 4.150000000, 4.675000000, 5.200000000]
L = [1.2, 1.775000000, 2.350000000, 2.925000000, 3.500000000]
C = [4, 5, 6]
| |