How to simulate aging effect on back to back inverters in HSPICE - circuit
I am trying to simulate the effect of aging in the back-to-back inverters (SRAM PUF). I want to see the starting up of the back-to-back inverter's start-up voltage with transistor aging effect, wherein in one case the output initial from the 2 inverters is 1 0 and in another case, the output case will be 0 1.
How to do this in hspice. I know a little about the MOSRA test, but I am not sure how to use that to get the intended aging effect.
I have written a back-to-back inverter hspice netlist. but the output is always same with the simulation. How to flip the output with aging simulation. Any help is appreciated.
* PUF
vdd vdd gnd dc 1v
Mp1 out2 out1 vdd vdd pmos w= 90nm l= 45nm
Mn1 out2 out gnd gnd nmos w=45nm l= 45nm
Mp2 out1 out2 vdd vdd pmos w= 90nm l= 45nm
Mn2 out1 out2 gnd gnd nmos w=45nm l= 45nm
*transient analysis
.model p1_ra mosra level=1
+tit0 = 5e-8 titfd = 7.5e-10 tittd = 1.45e-20
+tn = 0.25
.appendmodel p1_ra mosra p1 pmos
.mosra reltotaltime= 1e8
.tran .1ps 5ns
.options post
.print V(out2) V(out1)
* PTM Low Power 45nm Metal Gate / High-K / Strained-Si
* nominal Vdd = 1.1V
.model nmos nmos level = 54
+version = 4.0 binunit = 1 paramchk= 1 mobmod = 0
+capmod = 2 igcmod = 1 igbmod = 1 geomod = 1
+diomod = 1 rdsmod = 0 rbodymod= 1 rgatemod= 1
+permod = 1 acnqsmod= 0 trnqsmod= 0
+tnom = 27 toxe = 1.8e-009 toxp = 1.5e-009 toxm = 1.8e-009
+dtox = 3e-010 epsrox = 3.9 wint = 5e-009 lint = 0
+ll = 0 wl = 0 lln = 1 wln = 1
+lw = 0 ww = 0 lwn = 1 wwn = 1
+lwl = 0 wwl = 0 xpart = 0 toxref = 1.8e-009
+vth0 = 0.62261 k1 = 0.4 k2 = 0 k3 = 0
+k3b = 0 w0 = 2.5e-006 dvt0 = 1 dvt1 = 2
+dvt2 = 0 dvt0w = 0 dvt1w = 0 dvt2w = 0
+dsub = 0.1 minv = 0.05 voffl = 0 dvtp0 = 1e-010
+dvtp1 = 0.1 lpe0 = 0 lpeb = 0 xj = 1.4e-008
+ngate = 1e+023 ndep = 3.24e+018 nsd = 2e+020 phin = 0
+cdsc = 0 cdscb = 0 cdscd = 0 cit = 0
+voff = -0.13 nfactor = 1.6 eta0 = 0.0125 etab = 0
+vfb = -0.55 u0 = 0.049 ua = 6e-010 ub = 1.2e-018
+uc = 0 vsat = 130000 a0 = 1 ags = 0
+a1 = 0 a2 = 1 b0 = 0 b1 = 0
+keta = 0.04 dwg = 0 dwb = 0 pclm = 0.02
+pdiblc1 = 0.001 pdiblc2 = 0.001 pdiblcb = -0.005 drout = 0.5
+pvag = 1e-020 delta = 0.01 pscbe1 = 8.14e+008 pscbe2 = 1e-007
+fprout = 0.2 pdits = 0.08 pditsd = 0.23 pditsl = 2300000
+rsh = 5 rdsw = 210 rsw = 80 rdw = 80
+rdswmin = 0 rdwmin = 0 rswmin = 0 prwg = 0
+prwb = 0 wr = 1 alpha0 = 0.074 alpha1 = 0.005
+beta0 = 30 agidl = 0.0002 bgidl = 2.1e+009 cgidl = 0.0002
+egidl = 0.8 aigbacc = 0.012 bigbacc = 0.0028 cigbacc = 0.002
+nigbacc = 1 aigbinv = 0.014 bigbinv = 0.004 cigbinv = 0.004
+eigbinv = 1.1 nigbinv = 3 aigc = 0.015211 bigc = 0.0027432
+cigc = 0.002 aigsd = 0.015211 bigsd = 0.0027432 cigsd = 0.002
+nigc = 1 poxedge = 1 pigcd = 1 ntox = 1
+xrcrg1 = 12 xrcrg2 = 5
+cgso = 1.1e-010 cgdo = 1.1e-010 cgbo = 2.56e-011 cgdl = 2.653e-010
+cgsl = 2.653e-010 ckappas = 0.03 ckappad = 0.03 acde = 1
+moin = 15 noff = 0.9 voffcv = 0.02
+kt1 = -0.11 kt1l = 0 kt2 = 0.022 ute = -1.5
+ua1 = 4.31e-009 ub1 = 7.61e-018 uc1 = -5.6e-011 prt = 0
+at = 33000
+fnoimod = 1 tnoimod = 0
+jss = 0.0001 jsws = 1e-011 jswgs = 1e-010 njs = 1
+ijthsfwd= 0.01 ijthsrev= 0.001 bvs = 10 xjbvs = 1
+jsd = 0.0001 jswd = 1e-011 jswgd = 1e-010 njd = 1
+ijthdfwd= 0.01 ijthdrev= 0.001 bvd = 10 xjbvd = 1
+pbs = 1 cjs = 0.0005 mjs = 0.5 pbsws = 1
+cjsws = 5e-010 mjsws = 0.33 pbswgs = 1 cjswgs = 3e-010
+mjswgs = 0.33 pbd = 1 cjd = 0.0005 mjd = 0.5
+pbswd = 1 cjswd = 5e-010 mjswd = 0.33 pbswgd = 1
+cjswgd = 5e-010 mjswgd = 0.33 tpb = 0.005 tcj = 0.001
+tpbsw = 0.005 tcjsw = 0.001 tpbswg = 0.005 tcjswg = 0.001
+xtis = 3 xtid = 3
+dmcg = 0 dmci = 0 dmdg = 0 dmcgt = 0
+dwj = 0 xgw = 0 xgl = 0
+rshg = 0.4 gbmin = 1e-010 rbpb = 5 rbpd = 15
+rbps = 15 rbdb = 15 rbsb = 15 ngcon = 1
.model pmos pmos level = 54
+version = 4.0 binunit = 1 paramchk= 1 mobmod = 0
+capmod = 2 igcmod = 1 igbmod = 1 geomod = 1
+diomod = 1 rdsmod = 0 rbodymod= 1 rgatemod= 1
+permod = 1 acnqsmod= 0 trnqsmod= 0
+tnom = 27 toxe = 1.82e-009 toxp = 1.5e-009 toxm = 1.82e-009
+dtox = 3.2e-010 epsrox = 3.9 wint = 5e-009 lint = 0
+ll = 0 wl = 0 lln = 1 wln = 1
+lw = 0 ww = 0 lwn = 1 wwn = 1
+lwl = 0 wwl = 0 xpart = 0 toxref = 1.82e-009
+vth0 = -0.587 k1 = 0.4 k2 = -0.01 k3 = 0
+k3b = 0 w0 = 2.5e-006 dvt0 = 1 dvt1 = 2
+dvt2 = -0.032 dvt0w = 0 dvt1w = 0 dvt2w = 0
+dsub = 0.1 minv = 0.05 voffl = 0 dvtp0 = 1e-011
+dvtp1 = 0.05 lpe0 = 0 lpeb = 0 xj = 1.4e-008
+ngate = 1e+023 ndep = 2.44e+018 nsd = 2e+020 phin = 0
+cdsc = 0 cdscb = 0 cdscd = 0 cit = 0
+voff = -0.126 nfactor = 1.8 eta0 = 0.0125 etab = 0
+vfb = 0.55 u0 = 0.021 ua = 2e-009 ub = 5e-019
+uc = 0 vsat = 90000 a0 = 1 ags = 1e-020
+a1 = 0 a2 = 1 b0 = 0 b1 = 0
+keta = -0.047 dwg = 0 dwb = 0 pclm = 0.12
+pdiblc1 = 0.001 pdiblc2 = 0.001 pdiblcb = 3.4e-008 drout = 0.56
+pvag = 1e-020 delta = 0.01 pscbe1 = 8.14e+008 pscbe2 = 9.58e-007
+fprout = 0.2 pdits = 0.08 pditsd = 0.23 pditsl = 2300000
+rsh = 5 rdsw = 250 rsw = 75 rdw = 75
+rdswmin = 0 rdwmin = 0 rswmin = 0 prwg = 0
+prwb = 0 wr = 1 alpha0 = 0.074 alpha1 = 0.005
+beta0 = 30 agidl = 0.0002 bgidl = 2.1e+009 cgidl = 0.0002
+egidl = 0.8 aigbacc = 0.012 bigbacc = 0.0028 cigbacc = 0.002
+nigbacc = 1 aigbinv = 0.014 bigbinv = 0.004 cigbinv = 0.004
+eigbinv = 1.1 nigbinv = 3 aigc = 0.0097 bigc = 0.00125
+cigc = 0.0008 aigsd = 0.0097 bigsd = 0.00125 cigsd = 0.0008
+nigc = 1 poxedge = 1 pigcd = 1 ntox = 1
+xrcrg1 = 12 xrcrg2 = 5
+cgso = 1.1e-010 cgdo = 1.1e-010 cgbo = 2.56e-011 cgdl = 2.653e-010
+cgsl = 2.653e-010 ckappas = 0.03 ckappad = 0.03 acde = 1
+moin = 15 noff = 0.9 voffcv = 0.02
+kt1 = -0.11 kt1l = 0 kt2 = 0.022 ute = -1.5
+ua1 = 4.31e-009 ub1 = 7.61e-018 uc1 = -5.6e-011 prt = 0
+at = 33000
+fnoimod = 1 tnoimod = 0
+jss = 0.0001 jsws = 1e-011 jswgs = 1e-010 njs = 1
+ijthsfwd= 0.01 ijthsrev= 0.001 bvs = 10 xjbvs = 1
+jsd = 0.0001 jswd = 1e-011 jswgd = 1e-010 njd = 1
+ijthdfwd= 0.01 ijthdrev= 0.001 bvd = 10 xjbvd = 1
+pbs = 1 cjs = 0.0005 mjs = 0.5 pbsws = 1
+cjsws = 5e-010 mjsws = 0.33 pbswgs = 1 cjswgs = 3e-010
+mjswgs = 0.33 pbd = 1 cjd = 0.0005 mjd = 0.5
+pbswd = 1 cjswd = 5e-010 mjswd = 0.33 pbswgd = 1
+cjswgd = 5e-010 mjswgd = 0.33 tpb = 0.005 tcj = 0.001
+tpbsw = 0.005 tcjsw = 0.001 tpbswg = 0.005 tcjswg = 0.001
+xtis = 3 xtid = 3
+dmcg = 0 dmci = 0 dmdg = 0 dmcgt = 0
+dwj = 0 xgw = 0 xgl = 0
+rshg = 0.4 gbmin = 1e-010 rbpb = 5 rbpd = 15
+rbps = 15 rbdb = 15 rbsb = 15 ngcon = 1
.end
Related
Low of specific period (eg: 20 jan 2015 to 15 nov 2021)
This script draws ATH on chart with date and duration I want to store low of period as well (like high shown in label) to show (high-low) range in the same label. The period does not end today, but as per script. indicator("Previous Year(s) ATH", overlay = true) num_years = input.int(1, title = "Number of years back", minval = 1) var float ATH = high var int ATH_time = time var float[] ATH_vals = array.new_float() var int[] ATH_time_vals = array.new_int() var int[] ATH_time_change_vals = array.new_int() ATH := math.max(ATH, high) if ta.change(ATH) != 0 ATH_time := time array.unshift(ATH_vals, ATH) array.unshift(ATH_time_vals, time) array.unshift(ATH_time_change_vals, ATH_time) var float ATH1Y = na if barstate.isconfirmed search_time = time - 31536000000 * num_years for i = 0 to array.size(ATH_time_vals) - 1 if array.get(ATH_time_vals, i) < search_time ATH1Y := array.get(ATH_vals, i) ATH1Y_time = array.get(ATH_time_change_vals, i) y = year(ATH1Y_time) m = month(ATH1Y_time) d = dayofmonth(ATH1Y_time) days_ago = (time - ATH1Y_time) / 86400000 date_text = str.tostring(y) + "/" + str.tostring(m) + "/" + str.tostring(d) + " : " + str.tostring(ATH1Y) + "\nDays Ago : " + str.tostring(math.round(days_ago, 2)) if ATH > ATH1Y and ATH[3] <= ATH1Y[3] label.new(x = bar_index[3], y = ATH[3], text = date_text, style = label.style_label_lower_right) break ATH_val = ATH > ATH1Y ? na : ATH1Y buy_signal = ATH > ATH1Y and ATH[3] <= ATH1Y[3] plotshape(buy_signal, color = color.green, location = location.belowbar, size = size.small, style = shape.triangleup) plot(ATH_val, title = "ATH", style = plot.style_linebr)
Scipy optimize.minimize with multi- parameters
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import linalg, optimize %matplotlib inline Data load data = pd.read_csv("D:/Stat/TimeSeries/KRW_month_0617_1.csv",index_col="Date") / 100 para = open("D:/Stat/TimeSeries/KRW_month_0617_1.txt").readlines()[0:2] data.index = pd.to_datetime(data.index) Parameters cond = [] params = [] time = [] for i in para: j = i.split() for k in j: cond.append(k) cond = cond[1:] for i in range(len(cond)): cond[i] = round(float(cond[i]),4) params = cond[0:23] time = cond[23:] maturity = np.array(time[1:]) timegap = 1/cond[23] Functions We need def Paramcheck(Params, checkStationary = 1): result = 0 Kappa = np.array([[params[20],0,0], [0,params[21],0], [0,0,params[22]]]) Sigma = np.array([[params[1],0,0], [params[2],params[3],0], [params[4],params[5],params[6]]]) State = np.array([params[7], params[8], params[9]]) Lambda = params[0] SigmaEps = np.identity(10) for i in range(10): SigmaEps[i][i] = params[i+10] for i in range(len(Sigma)): if Sigma[i][i] < 0: result = 1 for j in SigmaEps: if np.any(SigmaEps) < 0: result = 1 if Lambda < 0.05 or Lambda > 2: result = 1 elif State[0] < 0: result = 1 elif Kappa[0][0] < 0: result = 1 if result == 0 and checkStationary > 0: if max(np.linalg.eigvals(-Kappa).real) > 0: result = 2 return result def CheckDet(x): if x == np.inf or x == np.nan: result = 1 elif x < 0: result = 2 elif abs(x) < 10**-250: result = 3 else: result = 0 return result def NS_factor(lambda_val, maturity): col1 = np.ones(len(maturity)) col2 = (1 - np.exp(-lambda_val*maturity))/(lambda_val*maturity) col3 = col2 - np.exp(-lambda_val*maturity) factor = np.array([col1,col2,col3]).transpose() return factor def DNS_Kalman_filter(Params, *args): N = Paramcheck(Params) if N == 0: Kappa = np.array([[params[20],0,0], [0,params[21],0], [0,0,params[22]]]) Sigma = np.array([[params[1],0,0], [params[2],params[3],0], [params[4],params[5],params[6]]]) State = np.array([params[7], params[8], params[9]]) Lambda = params[0] SigmaEps = np.identity(10) for i in range(10): SigmaEps[i][i] = params[i+10] Obs_Yield = args[0] Obs_Date = args[1] Timegap = args[2] Obs_Mty = args[3] Finalstate = args[4] Mty_length = len(Obs_Mty) B = NS_factor(lambda_val = Lambda,maturity = Obs_Mty) H_large = SigmaEps **2 N_obs = len(Obs_Date) LLH_vec = np.zeros(N_obs) phi1 = linalg.expm(-Kappa*Timegap) phi0 = (np.identity(3)-phi1) # State Eigenvalues = np.linalg.eig(Kappa)[0] Eigen_vec = np.linalg.eig(Kappa)[1] Eigen_vec_inv = np.linalg.inv(Eigen_vec) S = Eigen_vec_inv # Sigma # Sigma.transpose() # Eigen_vec_inv.transpose() Atilde = np.dot(Sigma[0], Sigma[0]) Btilde = np.dot(Sigma[1], Sigma[1]) Ctilde = np.dot(Sigma[2], Sigma[2]) Dtilde = np.dot(Sigma[0], Sigma[1]) Etilde = np.dot(Sigma[0], Sigma[2]) Ftilde = np.dot(Sigma[1], Sigma[2]) res1= Atilde* Obs_Mty* Obs_Mty/6 res2= Btilde*(1/(2*Lambda**2) - (1-np.exp(-Lambda*Obs_Mty))/(Lambda**3*Obs_Mty) + (1- np.exp(-2*Lambda*Obs_Mty))/(4*Lambda**3*Obs_Mty)) res3= Ctilde*(1/(2*Lambda**2) + np.exp(-Lambda*Obs_Mty)/(Lambda**2)- Obs_Mty*np.exp(-2*Lambda*Obs_Mty)/(4*Lambda) - 3*np.exp(-2*Lambda*Obs_Mty)/(4*Lambda**2) - 2*(1-np.exp(- Lambda*Obs_Mty))/(Lambda**3*Obs_Mty) + 5*(1- np.exp(-2*Lambda*Obs_Mty))/(8*Lambda**3*Obs_Mty)) res4= Dtilde*(Obs_Mty/(2*Lambda) + np.exp(-Lambda*Obs_Mty)/(Lambda**2) - (1-np.exp(- Lambda*Obs_Mty))/(Lambda**3*Obs_Mty)) res5= Etilde*(3*np.exp(-Lambda*Obs_Mty)/(Lambda**2) + Obs_Mty/(2*Lambda)+Obs_Mty*np.exp(- Lambda*Obs_Mty)/(Lambda) - 3*(1-np.exp(-Lambda*Obs_Mty))/(Lambda**3*Obs_Mty)) res6= Ftilde*(1/(Lambda**2) + np.exp(-Lambda*Obs_Mty)/(Lambda**2) - np.exp(-2*Lambda*Obs_Mty)/(2*Lambda**2) - 3*(1-np.exp(- Lambda*Obs_Mty))/(Lambda**3*Obs_Mty) + 3*(1- np.exp(-2*Lambda*Obs_Mty))/(4*Lambda**3*Obs_Mty)) val = res1 + res2 + res3 + res4 + res5 + res6 V_mat = np.zeros([3,3]) V_lim = np.zeros([3,3]) for i in range(3): for j in range(3): V_mat[i][j] = S[i][j]*(1-np.exp(-(Eigenvalues[i] + Eigenvalues[j])*Timegap))/(Eigenvalues[i] + Eigenvalues[j]) V_lim[i][j] = S[i][j]/(Eigenvalues[i] + Eigenvalues[j]) Q = (Eigen_vec # V_mat # Eigen_vec.transpose()).real Sigma_lim = (Eigen_vec # V_lim # Eigen_vec.transpose()).real for i in range(N_obs): y = Obs_Yield[i] xhat = phi0 + phi1 # State y_implied = B # xhat v = y - y_implied + val Sigmahat = phi1 # Sigma_lim # phi1.transpose() + Q F = B # Sigmahat # B.transpose() + H_large detF = np.linalg.det(F) if CheckDet(detF) > 0: N = 3 break Finv = np.linalg.inv(F) State = xhat + Sigmahat # B.transpose() # Finv # v Sigma_lim = Sigmahat - Sigmahat # B.transpose() # Finv # B # Sigmahat LLH_vec[i] = np.log(detF) + v.transpose() # Finv # v if N == 0: if Finalstate: yDate = Obs_Date[-1] result = np.array([yDate,State]) else: result = 0.5 * (sum(LLH_vec) + Mty_length*N_obs*np.log(2*np.pi)) else: result = 7000000 return result I made a code that does Arbitrage Free Nelson-Siegel model. Data is return rates of bond (1Y,1.5Y, ... ,20Y). I wanna optimize that function with scipy optimize.minimize function with fixed *args. Suppose that Initial parmas are verified that it's close to optimized params from empirical experiments using Dynamic Nelson-Siegel Model. LLC_new = 0 while True: LLC_old = LLC_new OPT = optimize.minimize(x0=params,fun=DNS_Kalman_filter, args= (data.values,data.index,timegap,maturity,0)) params = OPT.x LLC_new = round(OPT.fun,5) print("Current LLC: %0.5f" %LLC_new) if LLC_old == LLC_new: OPT_para = params FinalState = DNS_Kalman_filter(params,data.values,data.index,timegap,maturity,True) break Result is Current LLC: -7613.70146 Current LLC: -7613.70146 LLC(log-likelihood value) isn't maximized. It's not a result I desire using Optimizer. Is there any solution for that? In R, there is optim() function works as similar as scipy.optimize.minimize() which works really well. I also have a R code for that very similar to this Python code.
Any suggestions to make python code faster?
My present code takes too much time to execute say N=100000 values. Last time I tried it took around 4 hrs. Which is too much computing time. If someone can suggest anything to make the code a little faster? def gen_chain(N): coordinates = np.loadtxt('saw.txt', skiprows=0) return coordinates def lj(rij2): sig_by_r6 = np.power(sigma / rij2, 3) sig_by_r12 = np.power(sig_by_r6, 2) lje = 4.0 * epsilon * (sig_by_r12 - sig_by_r6) return lje def fene(rij2): return (-0.5 * K * R**2 * np.log(1 - ((np.sqrt(rij2) - r0)**2 / R**2))) def total_energy(coord): # Non-bonded e_nb = 0 for i in range(N): for j in range(i - 1): ri = coord[i] rj = coord[j] rij = ri - rj rij2 = np.dot(rij, rij) if (np.sqrt(rij2) < rcutoff): e_nb += lj(rij2) # Bonded e_bond = 0 for i in range(1, N): ri = coord[i] rj = coord[i - 1] rij = ri - rj rij2 = np.dot(rij, rij) e_bond += fene(rij2) return e_nb + e_bond def move(coord): trial = np.ndarray.copy(coord) for i in range(N): delta = (2.0 * np.random.rand(3) - 1) * max_delta trial[i] += delta return trial def accept(delta_e): beta = 1.0 / T if delta_e <= 0.0: return True random_number = np.random.rand(1) p_acc = np.exp(-beta * delta_e) if random_number < p_acc: return True return False if __name__ == "__main__": # FENE parameters K = 40 R = 0.3 r0 = 0.7 # LJ parameters sigma = 0.624 epsilon = 1.0 # MC parameters N = 100 # number of particles rcutoff = 2.5 * sigma max_delta = 0.01 n_steps = 100000 T = 0.5 coord = gen_chain(N) energy_current = total_energy(coord) traj = open('traj.xyz', 'w') for step in range(n_steps): if step % 1000 == 0: traj.write(str(N) + '\n\n') for i in range(N): traj.write("C %10.5f %10.5f %10.5f\n" % (coord[i][0], coord[i][1], coord[i][2])) print(step, energy_current) coord_trial = move(coord) energy_trial = total_energy(coord_trial) delta_e = energy_trial - energy_current if accept(delta_e): coord = coord_trial energy_current = energy_trial traj.close() I know it cannot be compared to C/C++.Therefore, please don't suggest to use any other language. I also welcome suggestions regarding some unnecessary objects.
While loop comparing two variables
I'm trying to find and print the minimum value for n that satisfies ca >= cb: ap = 80000 bp = 200000 at = 1.03 bt = 1.015 n = 1 ca = ap*at*n cb = bp*bt*n while cb > ca: n = n + 1 print(n) The code just runs and prints n + 1 indefinitely, though. What is the correct approach to this problem?
ap = 80000 bp = 200000 at = 1.03 bt = 1.015 n = 1 ca = ap*at*n cb = bp*bt*n while cb > ca: n += 1 ca = ap*at*n cb = bp*bt*n This won't converge though.
Matlab read specified lines and create a structure
Suppose we have a txt file containing the following data (output.txt): MC Sim: x1 = 28.87 x2 = 28.87 x3 = 24.02 C = 51 Iter = 1 S = 3.00 M= 26.77 C = 51 Iter = 2 S = 7.85 M= 32.70 C = 51 Iter = 3 S = 18.62 M= 46.85 MC Sim: x1 = 28.87 x2 = 28.87 x3 = 19.65 C = 51 Iter= 1 S = 3.00 M = 22.28 C = 51 Iter= 2 S = 3.77 M = 25.10 C = 51 Iter= 3 S = 4.99 M = 28.89 C = 51 Iter= 4 S = 8.40 M = 35.78 C = 51 Iter= 5 S = 12.13 M = 46.22 C = 51 Iter= 6 S = 27.95 M = 72.74 I would like to read some lines and create a specified strucure from the values it contains, automatically. For example, suppose we want to a create the following structure using the values of S & M between lines 3 and 5: Iter1.S = the value of S at line 3 (3.00) Iter1.M = the value of M at line 3 (26.77) Iter2.S = the value of S at line 4 (7.85) Iter2.M = the value of M at line 4 (32.70) Iter3.S = the value of S at line 5 (18.62) Iter3.M = the value of M at line 5 (46.85) Please pay attention the name of each field should be a concatenated string containing the variable name Iter and its value, e.g. Iter1 = Iter+1 .