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.

C-Script syntax types

0 votes
I am starting to program in C script block and I have questions:

When defining a variable in 'code declarations,' why are there two syntax types? For example, this: '#define PREV_INPUT DiscState(0)' and the other syntax '#define DELAY ParamRealData(0, 0)'. My question is: How do we interpret or understand the arguments in 'DiscState(0)' and 'ParamRealData(0, 0)'? I understand that the following syntax 'DiscState(i)' and 'ParamRealData(i, j)' refers to the ith and jth values, respectively. Another question is: In what cases is it better to use the first notation or the second notation?

Thank you.
asked Jan 11 by Rodrigo (12 points)

1 Answer

0 votes

The syntax between your two examples is the same in that it uses the #define preprocessor directive.  It seems you are confused by the last argument in the #define directive. In the examples you referenced, the last argument refers to pre-defined C-Macros in PLECS. The different macros allow you to access block data such as input/output signals, parameters, and states.

Refer to the C-Scripts + C-Script Macros section of the PLECS Manual for a description of the available macros.  The graphic pasted below shows a subset of the available macros.


answered Jan 12 by Bryan Lieblick (1,795 points)
edited Jan 12 by Bryan Lieblick