GetPsimValue() can't get parameters of PID block

Altair Forum User
Altair Forum User
Altair Employee
edited August 2023 in Community Q&A

I am making a general dll block that need to get parameters of PID blocks in the project. But following code returns 0.0 and the status is -5.

tmp = GetPsimValue(nThreadIndex, AppPtr, "S2", "Proportional gain", status);

I also tried C Block, click the Insert GetPsimValue button pops up a Insert GetPsimValue dialog box but the name of the PID blocks doesn't list in the Available element name.

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2023

    The GetPSIMValue is not meant for this sort of parameter pass. PSIM Version 11 updated the C block to enable this sort of variable parameter pass using the 'Variables' button

    For the DLL you need to use REQUESTUSERDATA() function, there are three example circuits in PSIM that have this.

    examples\custom dll\embedded software block\code\comparator.cpp
    examples\custom dll\general_dll_block1\code\TestBlock.cpp
    examples\custom dll\general_dll_block2\code\TestBlock2.cpp