Can I use save/load functions in the python API?

Keelan_Brydon
Keelan_Brydon Altair Community Member

Hi there,

I am working with the Psim-Python API, and I would like to use the PSIM "save" function to pause and save my state in the simulation, and then the "load" function to continue the simulation from where I left off. I am wondering if it is possible to set the save and load flags through python?

Tagged:

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • Hi @Keelan_Brydon,

    I know this is possible using the legacy PSIM scripting method with C. The same functions should be implemented with the Python API, so I will suggest the approach we have used until now.

    You can navigate to Script » Script Tool » Help » Simulation Functions»Simulate

    image.png image.png

    Looking forward to your feedback.

    BR,

    Nikos

  • Ignacio_Santana
    Ignacio_Santana Altair Community Member

    Hi NikosDimitrakopoulos,

    @Keelan_Brydon and I were working using the Python API, but when we call the simulation from Python using the command below, the system doesn't save the simulation:

    d3 = dict(Simview=-1, proportional_gain=kp, intergral_gain=ki, vout_set_point_volts=48
    , buck_inductor_H=0.1e-3, buck_capacitor_F=0.1e-3, switching_frequency_hz=100e3,
    TOTALTIME = SIM_TIME, SAVEFLAG = 1)

    result = psim.PsimSimulate(BUCK_SIM_SIMULATION_FILE, BUCK_SIM_RESULT_FILE_SMV, **d3)

    Please let us know if we are doing something wrong, or if there is another way of doing it. the version of the package we are using is 2024.0:

    name='psimapipy',
    description='A Python package for Altair PSIM Python APIs and commands',
    version='2024.0',
    url='https://www.altair.com/PSIM',
    author='Altair Engineering',
    packages=['psimapipy'],
    package_data={"psimapipy": ["*.pyc"]}…
    

    Thank you very much,

    Ignacio

  • Dear @Ignacio_Santana,

    We identified an issue with the Python Save/Load flags. Here is a workaround until the issue is fixed in next version with expected release in May:

    Please don't skip  "-i"  "-o"  "-v"

    As it won't work without them

    Hope this helps!

    BR,

    Nikos

  • Ignacio_Santana
    Ignacio_Santana Altair Community Member

    Dear NikosDimitrakopoulos,

    Thank you for sharing this information. We'll Save/Load our simulation using this command until the new version is released.

    Thank you again,

    Ignacio Santana

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.