Model creation

This document begins explaining the problem to solve to have a better understanding on how to create the models. Later the implementation for Pspice and Simulink is presented with an example for each.

Problem explanation

The problem in mind can be represented as shown below. There is an experiment conducted where there are some parameters p that needs to be determined and are unknown. A model of the system is developed and is fed the same inputs. For the case where p’ is close to p the output of the experiment and the model will be similar. An error function is created between the different outputs of the model.

In the diagram above it is shown what could be the way to determine the parameters of an electrical machine. A set of voltages, v(t) are fed to the motor and the currents i(t) are recorded. Then the same voltages v(t) are given to a model where the parameters p’ can be varied.

An objective function is created by comparing the outputs i(t) of model and experiment. As the parameters estimations p’ are closer to p the error decreases and the optimization can converge to a result that minimizes the error.

All the problems to be solved are like this and the different implementation in Pspice and Simulink is shown later. It is important to understand that the model must receive the same inputs as the experiment and that the parameters to vary are what needs to be determined. If the model is not correctly designed you cannot expect correct results.

The experiment inputs are designed within the model (for example the designing of v(t)) and the parameters p’ are left as inputs that the Optimization Tool can set. All the models will be created this way and the implementation in Pspice and Simulink is shown below.

Pspice implementation

As stated before we must create a model that has the same inputs as the experiment and can provide outputs to be measured. The actual inputs of the model will be the parameters to vary. Below it is shown an IGBT dynamic turn-on/turn-off test model designed in Pspice.

.TEMP 125

* Options

.options vntol=1e-6  itl4=100 itl1=2000 itl2=2000
.options reltol=0.01 abstol=1e-9

* Libraries
.lib igbt003.lib
.lib Diode_6xL4491A.lib
.inc params.inc
.param T={398}

* passive elements
L  Vdd  C 103uH IC=148A  ; Initial current
XD001 4 3 Diode_6xL4491A

* Bus bar
Lbus_u Vdd 1 10n
Lbus_l 11 0 10n

* Commutation path
Lc_u 1 2 2n
Rc_u 2 3 1m
Le_u 4 5 4n
Re_u 5 C 1m
Lc_l C 7 2n
Rc_l 7 8 1m
Le_l 9 10 4n
Re_l 10 11 1m

* generators changing with time
Vd   Vdd 0  PWL 0,50V 0.5us,1095V ; main DC generator ramps-up only once ;1100 is the DC voltage

*Control voltages
Vgate G1_on  G1_off  PWL 0us,-10V 5us,-10V 5.015us,+15V 15us,+15V 15.015us,-10V

Ron G1_on 12  1.2
Roff G1_off 13 3.375
Ls_gate_on 12 G1 30n
Ls_gate_off 13 11 30n

*IGBT
XDUT1 8 G1 9 IGBT003 PARAMS: CELL_AREA=10 CELL_TEMP=398
+ t2=500n tB=200n+ t3=150n t4=1u
+ KpM=55 VtoM=5.1 RsM=0.3m gammaB=.003 gamma3=.009 gamma2=0.001
+ gamma = 0.2 Vnc = 0.1 

* Analysis
.tran  0 20us 0 5ns  UIC
.probe
.end

 

The model performs a switching test on an igbt. The input can be considered the gate control and the outputs are the voltage Vce and the current trough the transistor over time, Ic. In order to let the Optimization Tool use this model we must specify the parameters and also write the outputs.

Parameters

To specify a parameters simply add varParam(number) for as much parameters as you want. For the first one write varParam(1), for the second varParam(2) and so on. For example if we want to estimate the parameters:

{t2, tb, t3, t4, gammab, gamma3, gamma2}

Then we can modify the IGBT part where those parameters are present and we would put it as:

*IGBT
XDUT1 8 G1 9 IGBT003 PARAMS: CELL_AREA=10 CELL_TEMP=398
+ t2=varParam(1) tB=varParam(2)
+ t3=varParam(3) t4=varParam(4)
+ KpM=55 VtoM=5.1 RsM=0.3m gammaB=varParam(5) gamma3=varParam(6) gamma2=varParam(7)
+ gamma = 0.2 Vnc = 0.1 

 

It is important from this point on that we follow the same order with the parameters if we need to have more simulations. Also, when we create the configuration file the same order must be maintain in the variables values and names.

Outputs

Finally you need to add a line telling Pspice to save the variables you want to have as outputs. For example in this circuit we want to have Vce = v(8)-v(9) and the current Ic = I(XDUT1:1). To do so we can simply add before the .end statement:

.print tran V(8,9) I(XDUT1:1)

 

We must use the .print statement followed of the type of simulation. Usually it will be either dc or tran for steady-state values and transient phenomena respectively. It will be the same as the type of simulation ran. We can try to simulate the Pspice circuit (without the addition of parameters to determine with varParam()) and check in the .out file if the outputs are the desired. We must also know which output is which in the column later to specify the order in the Optimization tool.

The circuit is now fully defined and will look like this after all the modifications:

.TEMP 125

* Options

.options vntol=1e-6  itl4=100 itl1=2000 itl2=2000
.options reltol=0.01 abstol=1e-9

* Libraries
.lib igbt003.lib
.lib Diode_6xL4491A.lib
.inc params.inc
.param T={398}

* passive elements
L  Vdd  C 103uH IC=148A  ; Initial current
XD001 4 3 Diode_6xL4491A

* Bus bar
Lbus_u Vdd 1 10n
Lbus_l 11 0 10n

* Commutation path
Lc_u 1 2 2n
Rc_u 2 3 1m
Le_u 4 5 4n
Re_u 5 C 1m
Lc_l C 7 2n
Rc_l 7 8 1m
Le_l 9 10 4n
Re_l 10 11 1m

* generators changing with time
Vd   Vdd 0  PWL 0,50V 0.5us,1095V ; main DC generator ramps-up only once ;1100 is the DC voltage

*Control voltages
Vgate G1_on  G1_off  PWL 0us,-10V 5us,-10V 5.015us,+15V 15us,+15V 15.015us,-10V

Ron G1_on 12  1.2
Roff G1_off 13 3.375
Ls_gate_on 12 G1 30n
Ls_gate_off 13 11 30n

*IGBT
XDUT1 8 G1 9 IGBT003 PARAMS: CELL_AREA=10 CELL_TEMP=398
+ t2=varParam(1) tB=varParam(2)
+ t3=varParam(3) t4=varParam(4)
+ KpM=55 VtoM=5.1 RsM=0.3m gammaB=varParam(5) gamma3=varParam(6) gamma2=varParam(7)
+ gamma = 0.2 Vnc = 0.1 

* Analysis
.tran  0 20us 0 5ns  UIC
.print tran V(8,9) I(XDUT1:1)
.probe
.end

 

If we run the Pspice file without the varParam() we can see in the middle of the .out file something like this:

****     TRANSIENT ANALYSIS               TEMPERATURE =   27.000 DEG C

****************************************************************

  TIME        V(8,9)      I(XDUT1:1) 

   0.000E+00   7.784E+03   7.230E+01

   5.000E-09   6.636E+01   8.182E+01

   1.000E-08   1.671E+02   7.875E+01

   1.500E-08   2.644E+02   6.154E+01

 

So we can see that the first column is the time, the second the voltage that we wanted and the third the current. In the optimization tool if we want to the curve v(8,9) = f(t) we would put 1 in xvar as it is the time and 2 in yvar as it is Vce. For the current it would be 1 and 3 respectively.

Simulink implementation

Simulink models may be a bit easier since are designed with blocks.

Parameters

Each parameter can be accessed in the model by referencing its position in a vector denoted as p using the same order as specified before with the varParam(). So to use the first parameter in the model simply write p(1) and for the second p(2) and so on.

Outputs

For the outputs you must create a bus that has all the variables to save. You can add the clock block if you want to save the time also. The bus must converge to a “save to workspace” block with name “simout” and the save format must be “Timeseries”. An example with a PMSM is shown below:

The objective is to estimate the parameters:

{R,Lq,Ld,Lmpm}

They can be used in Simulink by calling its position in the p vector and are fed to the machine model. The voltages given in the experiment have been recorded and are given also to the model that will predict a current in d and q that is compared with the experimental one in Parameter Optimizer.

The current and speed of the current period is also fed to the model because in this particular system the outputs depend of the previous instants and therefore a small error will pile up and produce wrong estimations so after each estimation of idq the program sets the previous current as the one from the experiment and not the actual predicted current. Parameter optimizer however will only see the model estimations.

The outputs are the current in d and q and since we also want the time the clock block is added to the bus. Later in Parameter Optimizer to access the yvars for id we would put it as 2 as it is the second in the output and for iq a 3 since the time was set as the first.