Hi MATLAB Community,
I want to create a component, consisting of multiple blocks, that I can re-use multiple times in multiple models. I want this component to be able to take on different parameters for each instance of it that I create (think resistors having different resistances), but for all instances of the component to be changed if I make a fundamental change to its internal composition.
For example, say I have a component consisting of a resistor, a voltage meter, and a scope (I'm using SimPowerSystems). I want to be able to add this component to several models. However, say I change the voltage meter to a current meter — I want this change to be reflected everywhere; that is, everywhere I've used this component.
And, an additional consideration: every time I add this component to a model, I want the names of internal blocks (say, the scope in my example) to be unique. So, say I add component1 to a model (containing "Scope1")… if then I add another component to the same model, I want its scope to be called "Scope2", without me having to manually change the name.
What do you recommend — subsystems, libraries, or model referencing? Using the InitFcn callback of the component to automatically change the name?
Thanks so much everyone, I appreciate your help and hopefully my description was reasonably clear.
J.
Best Answer