How do I use the GetPsimValue insert and SetRunTimeValue insert buttons in block C and what role should I play?

parkjc5325
parkjc5325 New Altair Community Member
edited November 2023 in Community Q&A

Hello. 

Let me ask you a question.

How do I use the insert GetPsimValue  and insert  SetRunTimeValue buttons in C block  and what role should I play?

I don't understand even if I look at tutorials or explanatory materials.

Can you tell me what these buttons are?

 

Thank you.

Tagged:

Answers

  • NikosDimitrakopoulos
    NikosDimitrakopoulos
    Altair Employee
    edited November 2023

    Dear User,

    Let me first provide you with the definitions of what those functions do and then a simple example to showcase the potential.

    Insert GetPsimValue

    Retrieve the parameter value of an element in the same schematic but outside the C block. This button will open a dialog which lists all the elements on one side, and the parameters of each element on the other side.

    Insert SetRunTimeValue
    Set the parameter value of an element during simulation runtime. This button will open a dialog which lists all the elements on one side, and the parameters of each element on the other side.

    I suspect that those definitions do not mean much to you, so let me provide a simple example:

    Let us consider a simple sinusoidal voltage source block inside a simulation containing a "C block" and a step source. The Vsin source contains the following values and parameters:

    image

    In certain simulations, it's helpful to read parameters from within the C block for calculations and change block parameters while the simulation runs to test different scenarios.

    In this example, we have a step function, and we will double the amplitude of the Vsin source (50V to 100V) when the step source transitions from 0 to 1. We can read the "Tstep" parameter of the step source.

    image

    image

    And then we can use this "Tstep" info to change the peak amplitude of the Vsin to 100V while the simulation is running and after the "Tstep" point.

    image

    The results are the following:

    image

     

    I am also attaching the simulation file to this reposnse.

    BR,

    Nikos Dimmitrakopoulos

  • parkjc5325
    parkjc5325 New Altair Community Member
    edited November 2023

    Thank you. Thanks to you, I understood.

    It really helped me a lot.

    Have a nice day!

  • NikosDimitrakopoulos
    NikosDimitrakopoulos
    Altair Employee
    edited November 2023

    Thank you. Thanks to you, I understood.

    It really helped me a lot.

    Have a nice day!

    Happy to help!

  • Denys Ovsiyenko_21270
    Denys Ovsiyenko_21270 New Altair Community Member
    edited November 2023

    Hi Nikos, 

    I am also interested on C block of PSIM. I replicated your example and I have two questions:

    1. What is the difference between C Block and Simplified C Block?

    2. I wan to use a C block along with SimCoder capabilities. Therefore I want to Insert GetPsimValue of DSP clock speed defined with DSP Clock F28004x block. Apparently, being the same procedure as with the previous ones, it gives me an error when I have to Check Code.  

    What could be happening? I leave the screenshots of the steps as well as the error message. Additionally you have the .psimsch in .zip format attached here.

    image

    image

    image

  • NikosDimitrakopoulos
    NikosDimitrakopoulos
    Altair Employee
    edited November 2023

    Hi Nikos, 

    I am also interested on C block of PSIM. I replicated your example and I have two questions:

    1. What is the difference between C Block and Simplified C Block?

    2. I wan to use a C block along with SimCoder capabilities. Therefore I want to Insert GetPsimValue of DSP clock speed defined with DSP Clock F28004x block. Apparently, being the same procedure as with the previous ones, it gives me an error when I have to Check Code.  

    What could be happening? I leave the screenshots of the steps as well as the error message. Additionally you have the .psimsch in .zip format attached here.

    image

    image

    image

    Hi Denys,

    Thanks for reaching out!

    To answer your question:

    1. The simplified C block has two major differences with the C block.

    a) It is easier to use as it provides a friendlier GUI. The t ,delt variables are easily accessible and the strict C environment is generally abstracted.

    b)The simplidied C block can be used for automatic code generation, while the C block can't. To make sure you know which blocks can be used for code gen, you can navigate to Options >> Settings >> Advanced, if the option box "Show image next to elements that can be used for code generation" is checked, a small "CG" image will appear next to these elements that can be used for code generation.

    image

    2. Every block in PSIM has a "Help" button. I often find this very informative. In the case of the simplified C block, if you click on help, you will observe that the InsertGetPSIMValue and InsertSetRunTimeValue are not supported for automatic code generation.


    image

    That means that you cannot get the clock speed inside the simiplified c block.

    Hope that helps!

    Best regards,

    Nikos

  • Denys Ovsiyenko_21270
    Denys Ovsiyenko_21270 New Altair Community Member
    edited November 2023

    Hi Denys,

    Thanks for reaching out!

    To answer your question:

    1. The simplified C block has two major differences with the C block.

    a) It is easier to use as it provides a friendlier GUI. The t ,delt variables are easily accessible and the strict C environment is generally abstracted.

    b)The simplidied C block can be used for automatic code generation, while the C block can't. To make sure you know which blocks can be used for code gen, you can navigate to Options >> Settings >> Advanced, if the option box "Show image next to elements that can be used for code generation" is checked, a small "CG" image will appear next to these elements that can be used for code generation.

    image

    2. Every block in PSIM has a "Help" button. I often find this very informative. In the case of the simplified C block, if you click on help, you will observe that the InsertGetPSIMValue and InsertSetRunTimeValue are not supported for automatic code generation.


    image

    That means that you cannot get the clock speed inside the simiplified c block.

    Hope that helps!

    Best regards,

    Nikos

    Thank you! Very helpful answer.

    Best, 

    Denys