sl_postprocess
Make postprocessing customizations when building custom block library
Syntax
sl_postprocess(h)
Description
sl_postprocess(h)
takes a handle to the custom block
library, h
, and allows you to make library postprocessing
customizations (for example, add a forwarding table).
If a Simscape™ file package being built contains a sl_postprocess.m
file, then sscbuild
calls sl_postprocess
once the
block library (package_name
_lib
) is
generated but before it is saved to disk. If sl_postprocess
generates
an error, the library does not build.
You can include a sl_postprocess.m
file at
any level in the library package. At the top level, it makes postprocessing
changes to the whole custom block library. Similarly, if the sl_postprocess.m
file
resides in a sublibrary in the package, it takes a handle to that
sublibrary and makes the corresponding changes.
Examples
If you rename a block or change a parameter name, you need to
add a forwarding table to update old models that reference the block.
However, if you manually add a forwarding table to a custom library,
it will get overwritten every time you rebuild the library. Instead,
include a sl_postprocess.m
file in the library
package, which will add the forwarding table automatically upon rebuilding
the library:
- +MySimscape |-- sl_postprocess.m |-- +Mechanical | |-- spring.ssc | |-- ...
The sl_postprocess.m
file contains a forwarding
table:
function sl_postprocess(h) % Forwarding table for the spring block ft = { {'MySimscape_lib/Mechanical/Ideal Spring', 'MySimscape_lib/Mechanical/Rotational Spring'} } set_param(h, 'ForwardingTable', ft); end
This forwarding table indicates that the custom block name for
the spring.ssc
component has changed from 'Ideal
Spring'
to 'Rotational Spring'
.
Note that if you have customized the library names using lib.m
files,
you have to use these custom names in the forwarding table (for example, 'Mechanical
Library'
instead of 'Mechanical'
).
Version History
Introduced in R2010a