I wanted to know how a C-script can have multiple inputs for it. For example, I have a few output signals a,b,c that I want to be inputted into the C-Script constantly like a function, but the current C-Script box only has 1 input channel and 1 output channel. Is there any way to change this so it takes in multiple different signals instead of me having to use a multiplexer/demux that would cause the signals to not be the original ones that I want them to be. Essentially, I want the C-Script block in PLECS to be able to take in more than 1 input channel. Is this possible and how would I approach it?
The C-Script block accepts multiple, vectorized inputs. You can set the “Number of inputs” field as a vector which will specify the width of each input. Within the C-Script you can access the desired input signal using the “InputSignal(int i, int j)” macro, where the first argument is the input signal and the second argument the j’th element of the i’th input signal (zero indexed). In the screenshot below InputSignal(2, 1) would return 4.
A similar indexing approach is applied to output signals as well.