Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Usage of C-Script Macro SignalInput(int, init) in "Code Declarations"

0 votes
368 views

Hi all,

I'd like to copy data at C-Script-input-ports to MyFunctions.c code.
Since this is a boring job, I need to do very often, I decided to write a helper to do so.
This helper need to access "SignalInput()" macro, which seems to be defined in "Output function code" section only.
How to access this in a helper-function as descripted below?

Some pseudo code:

<code declarations>
#define <MyFunctions.c>
#define <copyInputsToMyFunctionsHelper.c>
</code declarations>

The file copyInputsToMyFunctionsHelper.c consists of:

void coypData(int port,  MyFunctions::DataStruct* data){
   int i = 0;
   data->element = SignalInput(port, i++);
   ......
}

 

<Output function code>
copyData(0, &datastructA);
copyData(1, &datastructB);
......

// calc. something with datastructA...
// assign to SignalOutport( port, index)
</Output function code>

Thank You!

Marcel

asked Mar 9, 2021 by marcel (12 points)
Hello, it's not clear what you are trying to do. Can you provide a more complete example?

Please log in or register to answer this question.

...