# How to add initial states to a circuit simulation using powerlib.

8 views (last 30 days)
Francio on 23 Apr 2013
Answered: Joel Van Sickel on 11 Dec 2020
I am having trouble adding initial states to inductors/capacitors on simulations using powergui for all the circuits I have tried to simulate. I had all kinds of issues:
- Adding the initial current/voltage directly at the RLC branch block culminates into an error message when I run the simulation that states that the initial value is being ignored.
- The powergui: "initial settings" menu either says that "There is no state variable at this model" or gets stuck at "Calculating stating variables" and displays a long warning message at the command window.
Please bear in mind that I have been struggling with this for hours and I have read the documentation on it and it has been of no help since it simply doesn't work as shown in the explanation.
Francio on 23 Apr 2013
The following warning messages are shown (the first parts about the continuos states always shows up, even when there are no initial states, maybe it's related but I have tried discrete ODE solvers also and the problem persisted).
_Warning: The model 'example' does not have continuous states, hence Simulink is using the solver 'FixedStepDiscrete' instead of solver 'ode3'. You can disable this diagnostic by explicitly specifying a discrete solver in the solver tab of the Configuration Parameters dialog, or by setting the 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics tab of the Configuration Parameters dialog > In C:\Program Files\MATLAB\R2012b\toolbox\physmod\powersys\powersys\private\power_init_pr.p>power_init_pr at 125 In power_init at 68 In C:\Program Files\MATLAB\R2012b\toolbox\physmod\powersys\powersys\private\power_initstates_pr.p>EvaluateTheModel at 636 In C:\Program Files\MATLAB\R2012b\toolbox\physmod\powersys\powersys\private\power_initstates_pr.p>power_initstates_pr at 35 In power_initstates at 24 In C:\Program Files\MATLAB\R2012b\toolbox\physmod\powersys\powersys\powergui.p>InitialStatesSettingButton_Callback at 132 In C:\Program Files\MATLAB\R2012b\toolbox\physmod\powersys\powersys\powergui.p>powergui at 87 _

Joel Van Sickel on 11 Dec 2020
This often happens if you specify too many initial states and the system cannot actually find a way to realistically start at those states. There are tools in powergui to help calculate initial states for certain devices. However, if your system is complex enough, you may not be able to control all of the initial states and must settle for driving the system to the correct operating point during simulaiton. Howevef, you should try removing all initial states, and slowly adding them in one at a time, and find out which ones are problematic.