Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to work with snapshots correctly?

Hello all,

for performance reasons, we have been trying to initialize our network once and then save a snapshot. Afterwards, we are going to run lots (up to hundreds) of simulations based on that snapshot. However, what we encountered so far seems a little strange:

If the simulations start from the snapshot they are not 100% steady, how they would be if we did the initialization in the same process.

We performed some testing on 5 different ways to run the simulation: 1. reference simulation - just initialize and simulate in one run 2. snapshot at t=-0.002 and no second initialization when running 3. snapshot at t=0.0 and no second initialization when running 4. snapshot at t=-0.002 and second initialization when running 5. snapshot at t=0.0 and second initialization when running

We also defined a simulation error that is defined as the maximum change of a bus voltage during the entire simulation (we would expect the voltage to be constant when there is no fault or other event). This means an error of 0 represents the expected and best behavior.

Using the SAVNW sample case we discovered the following: Method 1 is always fastest and has an error smaller than 1e-6 Method 2 turns instable and has an error around 1.0 Methods 3, 4 and 5 are similar in runtime and error value. They come pretty close to method 1

Our conclusion so far: Snapshots only work without another initialization if they have simulated at least one timestep.

Then we applied a comparable analysis to our actual grid case which contains lots of custom models. There we realized that method 3 only has an error value around 1e-2 instead of 1e-6. This is something that can be seen in the voltage diagrams that it is slightly fluctuating instead of being steady.

This effect can probably be blamed on the custom models to be not conserve it initialized state with a snapshot file. But these custom models are third party and we cannot fix them.

Therefore, our conclusion is that we do not get the expected advantage from using snapshot files. The only improvement is that we do not need the dyr file for the actual run step and can already prepare our channel definitions.

Runtime wise we do not get any benefit since we need to run init again in every simulation to maintain exact results.

Does anybody know whether this is expected or whether we might be doing something wrong?

This is the init code we use:

n_iteration = 100  # Number of max. iterations
acceleration = 0.30  # acceleration sfactor used in the network solution
tolerance = 0.0001  # Convergence Tolerance
integration_step = 0.001  # Simulation time step[s]

_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()

psspy.read(0, raw_file)
psspy.fnsl([0, 0, 0, 1, 1, 0, 0, 0])
psspy.dyre_new([1, 1, 1, 1], dyr_file, '', '', '')
psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
psspy.cong(0)
psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])

psspy.chsb(0, 1, [-1, -1, -1, 1, 13, 0])  # Add voltage channel

psspy.save(result_name + '.sav')

psspy.strt_2([0, 1], result_name + '.out')

if sim_to_t0:
    psspy.run(0, 0.0, 10000, 10, 0)  # this is to test the different methods

psspy.snap([-1, -1, -1, -1, -1], result_name + '.snp')

And the simulation run looks like this:

psspy.case(base + '.sav')
psspy.rstr(base + '.snp')

if args.second_init:
     psspy.strt_2([0, 1], base + '.out')
psspy.run(0, args.seconds, 10000, 10, 0)

How to work with snapshots correctly?

Hello all,

for performance reasons, we have been trying to initialize our network once and then save a snapshot. Afterwards, we are going to run lots (up to hundreds) of simulations based on that snapshot. However, what we encountered so far seems a little strange:

If the simulations start from the snapshot they are not 100% steady, how they would be if we did the initialization in the same process.

We performed some testing on 5 different ways to run the simulation: 1. reference simulation - just initialize and simulate in one run 2. snapshot at t=-0.002 and no second initialization when running 3. snapshot at t=0.0 and no second initialization when running 4. snapshot at t=-0.002 and second initialization when running 5. snapshot at t=0.0 and second initialization when running

We also defined a simulation error that is defined as the maximum change of a bus voltage during the entire simulation (we would expect the voltage to be constant when there is no fault or other event). This means an error of 0 represents the expected and best behavior.

Using the SAVNW sample case we discovered the following: Method 1 is always fastest and has an error smaller than 1e-6 Method 2 turns instable and has an error around 1.0 Methods 3, 4 and 5 are similar in runtime and error value. They come pretty close to method 1

Our conclusion so far: Snapshots only work without another initialization if they have simulated at least one timestep.

Then we applied a comparable analysis to our actual grid case which contains lots of custom models. There we realized that method 3 only has an error value around 1e-2 instead of 1e-6. This is something that can be seen in the voltage diagrams that it is slightly fluctuating instead of being steady.

This effect can probably be blamed on the custom models to be not conserve it initialized state with a snapshot file. But these custom models are third party and we cannot fix them.

Therefore, our conclusion is that we do not get the expected advantage from using snapshot files. The only improvement is that we do not need the dyr file for the actual run step and can already prepare our channel definitions.

Runtime wise we do not get any benefit since we need to run init again in every simulation to maintain exact results.

Does anybody know whether this is expected or whether we might be doing something wrong?

This is the init code we use:

n_iteration = 100  # Number of max. iterations
acceleration = 0.30  # acceleration sfactor used in the network solution
tolerance = 0.0001  # Convergence Tolerance
integration_step = 0.001  # Simulation time step[s]

_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()

psspy.read(0, raw_file)
psspy.fnsl([0, 0, 0, 1, 1, 0, 0, 0])
psspy.dyre_new([1, 1, 1, 1], dyr_file, '', '', '')
psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
psspy.cong(0)
psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])

psspy.chsb(0, 1, [-1, -1, -1, 1, 13, 0])  # Add voltage channel

psspy.save(result_name + '.sav')

psspy.strt_2([0, 1], result_name + '.out')

if sim_to_t0:
    psspy.run(0, 0.0, 10000, 10, 0)  # this is to test the different methods

psspy.snap([-1, -1, -1, -1, -1], result_name + '.snp')

And the simulation run looks like this:

psspy.case(base + '.sav')
psspy.rstr(base + '.snp')

if args.second_init:
     psspy.strt_2([0, 1], base + '.out')
psspy.run(0, args.seconds, 10000, 10, 0)

How to work with snapshots correctly?

Hello all,

for performance reasons, we have been trying to initialize our network once and then save a snapshot. Afterwards, we are going to run lots (up to hundreds) of simulations based on that snapshot. However, what we encountered so far seems a little strange:

If the simulations start from the snapshot they are not 100% steady, how they would be if we did the initialization in the same process.

We performed some testing on 5 different ways to run the simulation: 1. reference simulation - just initialize and simulate in one run 2. snapshot at t=-0.002 and no second initialization when running 3. snapshot at t=0.0 and no second initialization when running 4. snapshot at t=-0.002 and second initialization when running 5. snapshot at t=0.0 and second initialization when running

We also defined a simulation error that is defined as the maximum change of a bus voltage during the entire simulation (we would expect the voltage to be constant when there is no fault or other event). This means an error of 0 represents the expected and best behavior.

Using the SAVNW sample case we discovered the following: Method 1 is always fastest and has an error smaller than 1e-6 Method 2 turns instable and has an error around 1.0 Methods 3, 4 and 5 are similar in runtime and error value. They come pretty close to method 1

Our conclusion so far: Snapshots only work without another initialization if they have simulated at least one timestep.

Then we applied a comparable analysis to our actual grid case which contains lots of custom models. There we realized that method 3 only has an error value around 1e-2 instead of 1e-6. This is something that can be seen in the voltage diagrams that it is slightly fluctuating instead of being steady.

This effect can probably be blamed on the custom models to be not conserve it its initialized state with a snapshot file. But these custom models are third party and we cannot fix them.

Therefore, our conclusion is that we do not get the expected advantage from using snapshot files. The only improvement is that we do not need the dyr file for the actual run step and can already prepare our channel definitions.

Runtime wise we do not get any benefit since we need to run init again in every simulation to maintain exact results.

Does anybody know whether this is expected or whether we might be doing something wrong?

This is the init code we use:

n_iteration = 100  # Number of max. iterations
acceleration = 0.30  # acceleration sfactor used in the network solution
tolerance = 0.0001  # Convergence Tolerance
integration_step = 0.001  # Simulation time step[s]

_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()

psspy.read(0, raw_file)
psspy.fnsl([0, 0, 0, 1, 1, 0, 0, 0])
psspy.dyre_new([1, 1, 1, 1], dyr_file, '', '', '')
psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
psspy.cong(0)
psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])

psspy.chsb(0, 1, [-1, -1, -1, 1, 13, 0])  # Add voltage channel

psspy.save(result_name + '.sav')

psspy.strt_2([0, 1], result_name + '.out')

if sim_to_t0:
    psspy.run(0, 0.0, 10000, 10, 0)  # this is to test the different methods

psspy.snap([-1, -1, -1, -1, -1], result_name + '.snp')

And the simulation run looks like this:

psspy.case(base + '.sav')
psspy.rstr(base + '.snp')

if args.second_init:
     psspy.strt_2([0, 1], base + '.out')
psspy.run(0, args.seconds, 10000, 10, 0)

How to work with snapshots correctly?

Hello all,

for performance reasons, we have been trying to initialize our network once and then save a snapshot. Afterwards, we are going to run lots (up to hundreds) of simulations based on that snapshot. However, what we encountered so far seems a little strange:

If the simulations start starts from the snapshot they are not 100% steady, how they would be if we did the initialization in the same process.

We performed some testing on 5 different ways to run the simulation: 1. reference simulation - just initialize and simulate in one run 2. snapshot at t=-0.002 and no second initialization when running 3. snapshot at t=0.0 and no second initialization when running 4. snapshot at t=-0.002 and second initialization when running 5. snapshot at t=0.0 and second initialization when running

We also defined a simulation error that is defined as the maximum change of a bus voltage during the entire simulation (we would expect the voltage to be constant when there is no fault or other event). This means an error of 0 represents the expected and best behavior.

Using the SAVNW sample case we discovered the following: Method 1 is always fastest and has an error smaller than 1e-6 Method 2 turns instable and has an error around 1.0 Methods 3, 4 and 5 are similar in runtime and error value. They come pretty close to method 1

Our conclusion so far: Snapshots only work without another initialization if they have simulated at least one timestep.

Then we applied a comparable analysis to our actual grid case which contains lots of custom models. There we realized that method 3 only has an error value around 1e-2 instead of 1e-6. This is something that can be seen in the voltage diagrams that it is slightly fluctuating instead of being steady.

This effect can probably be blamed on the custom models to be not conserve its initialized state with a snapshot file. But these custom models are third party and we cannot fix them.

Therefore, our conclusion is that we do not get the expected advantage from using snapshot files. The only improvement is that we do not need the dyr file for the actual run step and can already prepare our channel definitions.

Runtime wise we do not get any benefit since we need to run init again in every simulation to maintain exact results.

Does anybody know whether this is expected or whether we might be doing something wrong?

This is the init code we use:

n_iteration = 100  # Number of max. iterations
acceleration = 0.30  # acceleration sfactor used in the network solution
tolerance = 0.0001  # Convergence Tolerance
integration_step = 0.001  # Simulation time step[s]

_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()

psspy.read(0, raw_file)
psspy.fnsl([0, 0, 0, 1, 1, 0, 0, 0])
psspy.dyre_new([1, 1, 1, 1], dyr_file, '', '', '')
psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
psspy.cong(0)
psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])

psspy.chsb(0, 1, [-1, -1, -1, 1, 13, 0])  # Add voltage channel

psspy.save(result_name + '.sav')

psspy.strt_2([0, 1], result_name + '.out')

if sim_to_t0:
    psspy.run(0, 0.0, 10000, 10, 0)  # this is to test the different methods

psspy.snap([-1, -1, -1, -1, -1], result_name + '.snp')

And the simulation run looks like this:

psspy.case(base + '.sav')
psspy.rstr(base + '.snp')

if args.second_init:
     psspy.strt_2([0, 1], base + '.out')
psspy.run(0, args.seconds, 10000, 10, 0)

How to work with snapshots correctly?

Hello all,

for performance reasons, we have been trying to initialize our network once and then save a snapshot. Afterwards, we are going to run lots (up to hundreds) of simulations based on that snapshot. However, what we encountered so far seems a little strange:

If the simulations starts from the snapshot they are not 100% steady, how they would be if we did the initialization in the same process.

We performed some testing on 5 different ways to run the simulation: 1. simulation:

  1. reference simulation - just initialize and simulate in one run 2. run
  2. snapshot at t=-0.002 and no second initialization when running 3. running
  3. snapshot at t=0.0 and no second initialization when running 4. running
  4. snapshot at t=-0.002 and second initialization when running 5. snapshot at t=0.0 and second initialization when running

  5. snapshot at t=0.0 and second initialization when running

We also defined a simulation error that is defined as the maximum change of a bus voltage during the entire simulation (we would expect the voltage to be constant when there is no fault or other event). This means an error of 0 represents the expected and best behavior.

Using the SAVNW sample case we discovered the following: Method 1 is always fastest and has an error smaller than 1e-6 Method 2 turns instable and has an error around 1.0 Methods 3, 4 and 5 are similar in runtime and error value. They come pretty close to method 1

Our conclusion so far: Snapshots only work without another initialization if they have simulated at least one timestep.

Then we applied a comparable analysis to our actual grid case which contains lots of custom models. There we realized that method 3 only has an error value around 1e-2 instead of 1e-6. This is something that can be seen in the voltage diagrams that it is slightly fluctuating instead of being steady.

This effect can probably be blamed on the custom models to be not conserve its initialized state with a snapshot file. But these custom models are third party and we cannot fix them.

Therefore, our conclusion is that we do not get the expected advantage from using snapshot files. The only improvement is that we do not need the dyr file for the actual run step and can already prepare our channel definitions.

Runtime wise we do not get any benefit since we need to run init again in every simulation to maintain exact results.

Does anybody know whether this is expected or whether we might be doing something wrong?

This is the init code we use:

n_iteration = 100  # Number of max. iterations
acceleration = 0.30  # acceleration sfactor used in the network solution
tolerance = 0.0001  # Convergence Tolerance
integration_step = 0.001  # Simulation time step[s]

_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()

psspy.read(0, raw_file)
psspy.fnsl([0, 0, 0, 1, 1, 0, 0, 0])
psspy.dyre_new([1, 1, 1, 1], dyr_file, '', '', '')
psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
psspy.cong(0)
psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])

psspy.chsb(0, 1, [-1, -1, -1, 1, 13, 0])  # Add voltage channel

psspy.save(result_name + '.sav')

psspy.strt_2([0, 1], result_name + '.out')

if sim_to_t0:
    psspy.run(0, 0.0, 10000, 10, 0)  # this is to test the different methods

psspy.snap([-1, -1, -1, -1, -1], result_name + '.snp')

And the simulation run looks like this:

psspy.case(base + '.sav')
psspy.rstr(base + '.snp')

if args.second_init:
     psspy.strt_2([0, 1], base + '.out')
psspy.run(0, args.seconds, 10000, 10, 0)

How to work with snapshots correctly?

Hello all,

for performance reasons, we have been trying to initialize our network once and then save a snapshot. Afterwards, we are going to run lots (up to hundreds) of simulations based on that snapshot. However, what we encountered so far seems a little strange:

If the simulations starts from the snapshot they are not 100% steady, how they would be if we did the initialization in the same process.

We performed some testing on 5 different ways to run the simulation:

  1. reference simulation - just initialize and simulate in one run
  2. snapshot at t=-0.002 and no second initialization when running
  3. snapshot at t=0.0 and no second initialization when running
  4. snapshot at t=-0.002 and second initialization when running
  5. snapshot at t=0.0 and second initialization when running

We also defined a simulation error that is defined as the maximum change of a bus voltage during the entire simulation (we would expect the voltage to be constant when there is no fault or other event). This means an error of 0 represents the expected and best behavior.

Using the SAVNW sample case we discovered the following: following:

  • Method 1 is always fastest and has an an error smaller than 1e-6 1e-6
  • Method 2 2 turns instable and has an error error around 1.0 1.0
  • Methods 3, 4 and 5 are are similar in runtime and error value. value. They come pretty close to method 1

Our conclusion so far: Snapshots only work without another initialization if they have simulated at least one timestep.

Then we applied a comparable analysis to our actual grid case which contains lots of custom models. There we realized that method 3 only has an error value around 1e-2 instead of 1e-6. This is something that can be seen in the voltage diagrams that it is slightly fluctuating instead of being steady.

This effect can probably be blamed on the custom models to be not conserve its initialized state with a snapshot file. But these custom models are third party and we cannot fix them.

Therefore, our conclusion is that we do not get the expected advantage from using snapshot files. The only improvement is that we do not need the dyr file for the actual run step and can already prepare our channel definitions.

Runtime wise we do not get any benefit since we need to run init again in every simulation to maintain exact results.

Does anybody know whether this is expected or whether we might be doing something wrong?

This is the init code we use:

n_iteration = 100  # Number of max. iterations
acceleration = 0.30  # acceleration sfactor used in the network solution
tolerance = 0.0001  # Convergence Tolerance
integration_step = 0.001  # Simulation time step[s]

_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()

psspy.read(0, raw_file)
psspy.fnsl([0, 0, 0, 1, 1, 0, 0, 0])
psspy.dyre_new([1, 1, 1, 1], dyr_file, '', '', '')
psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
psspy.cong(0)
psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])

psspy.chsb(0, 1, [-1, -1, -1, 1, 13, 0])  # Add voltage channel

psspy.save(result_name + '.sav')

psspy.strt_2([0, 1], result_name + '.out')

if sim_to_t0:
    psspy.run(0, 0.0, 10000, 10, 0)  # this is to test the different methods

psspy.snap([-1, -1, -1, -1, -1], result_name + '.snp')

And the simulation run looks like this:

psspy.case(base + '.sav')
psspy.rstr(base + '.snp')

if args.second_init:
     psspy.strt_2([0, 1], base + '.out')
psspy.run(0, args.seconds, 10000, 10, 0)

How to work with snapshots correctly?

Hello all,

for performance reasons, we have been trying to initialize our network once and then save a snapshot. Afterwards, we are going to run lots (up to hundreds) of simulations based on that snapshot. However, what we encountered so far seems a little strange:

If the simulations starts from the snapshot they are not 100% steady, how they would be if we did the initialization in the same process.

We performed some testing on 5 different ways to run the simulation:

  1. reference simulation - just initialize and simulate in one run
  2. snapshot at t=-0.002 and no second initialization when running
  3. snapshot at t=0.0 and no second initialization when running
  4. snapshot at t=-0.002 and second initialization when running
  5. snapshot at t=0.0 and second initialization when running

We also defined a simulation error that is defined as the maximum change of a bus voltage during the entire simulation (we would expect the voltage to be constant when there is no fault or other event). This means an error of 0 represents the expected and best behavior.

Using the SAVNW sample case we discovered the following:

  • Method 1 is always fastest and has an error smaller than 1e-6
  • Method 2 turns instable and has an error around 1.0
  • Methods 3, 4 and 5 are similar in runtime and error value. They come pretty close to method 1

Our conclusion so far: far: Snapshots only work without another initialization if they have simulated at least one timestep.

Then we applied a comparable analysis to our actual grid case which contains lots of custom models. There we realized that method 3 only has an error value around 1e-2 instead of 1e-6. This is something that can be seen in the voltage diagrams that it is slightly fluctuating instead of being steady.

This effect can probably be blamed on the custom models to be not conserve its initialized state with a snapshot file. But these custom models are third party and we cannot fix them.

Therefore, our conclusion is that we do not get the expected advantage from using snapshot files. The only improvement is that we do not need the dyr file for the actual run step and can already prepare our channel definitions.

Runtime wise we do not get any benefit since we need to run init again in every simulation to maintain exact results.

Does anybody know whether this is expected or whether we might be doing something wrong?

This is the init code we use:

n_iteration = 100  # Number of max. iterations
acceleration = 0.30  # acceleration sfactor used in the network solution
tolerance = 0.0001  # Convergence Tolerance
integration_step = 0.001  # Simulation time step[s]

_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()

psspy.read(0, raw_file)
psspy.fnsl([0, 0, 0, 1, 1, 0, 0, 0])
psspy.dyre_new([1, 1, 1, 1], dyr_file, '', '', '')
psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
psspy.cong(0)
psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])

psspy.chsb(0, 1, [-1, -1, -1, 1, 13, 0])  # Add voltage channel

psspy.save(result_name + '.sav')

psspy.strt_2([0, 1], result_name + '.out')

if sim_to_t0:
    psspy.run(0, 0.0, 10000, 10, 0)  # this is to test the different methods

psspy.snap([-1, -1, -1, -1, -1], result_name + '.snp')

And the simulation run looks like this:

psspy.case(base + '.sav')
psspy.rstr(base + '.snp')

if args.second_init:
     psspy.strt_2([0, 1], base + '.out')
psspy.run(0, args.seconds, 10000, 10, 0)