Question about Initialization Error Regarding Numeric Loop #187
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Answer from Hantao, The initialization error is caused by the numeric loop when initializing the model. A similar issue occurs in the EXAC1 model (in exac1.py). Since the FEX is a piece-wise function, the explicit initialization cannot be derived directly. For such variables, we need to solve the initial values by iteration, just like how we solve the DAE. Therefore, we need to assign iteration equations In the EXAC1, three variables are involved in the iteration initial values issue, all of them need to be assigned self.IN = Algeb(tex_name='I_N',
info='Input to FEX',
v_str='1',
v_iter='KC * XadIfd - INT_y * IN',
e_str='ue * (KC * XadIfd - INT_y * IN)',
diag_eps=True,
)
self.FEX = Piecewise(u=self.IN,
points=(0, 0.433, 0.75, 1),
funs=('1', '1 - 0.577*IN', 'sqrt(0.75 - IN ** 2)', '1.732*(1 - IN)', 0),
info='Piecewise function FEX',
)
self.FEX.y.v_str = '1'
self.FEX.y.v_iter = self.FEX.y.e_str
... ...
self.INT = Integrator(u='ue * (LA_y - VFE)',
T=self.TE,
K=1,
y0=0,
info='Integrator',
)
self.INT.y.v_str = 0.1
self.INT.y.v_iter = 'INT_y * FEX_y - vf0' One more thing is that, in the @cuihantao Regards, |
Beta Was this translation helpful? Give feedback.
Answer from Hantao,
The initialization error is caused by the numeric loop when initializing the model. A similar issue occurs in the EXAC1 model (in exac1.py).
Since the FEX is a piece-wise function, the explicit initialization cannot be derived directly. For such variables, we need to solve the initial values by iteration, just like how we solve the DAE. Therefore, we need to assign iteration equations
v_iter
and start valuesv_str
for them.In the EXAC1, three variables are involved in the iteration initial values issue, all of them need to be assigned
v_iter
andv_str
: