Bug Report with LVGate #189
-
Hi Hantao, There is an initialization bug with Below are the diagram and the code snippet. self.HVG = HVGate(u1=self.UEL,
u2=self.LA_y,
info='HVGate for under excitation',
)
self.LVG = LVGate(u1=self.HVG_y,
u2=self.OEL,
info='LVGate for under excitation',
) The Could you please check the related function? Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Thanks for reporting. This is a bug.
In LVGate, we need to make sure that the Selector is evaluated before updating the equation. Inside the definition of LVGate, move the selector to before the variable, the provide discrete=self.sel to the variable. See if this helps.
If not, we need to look at the input to the initialization equation.
If you put a breakpoint in the initialization equation for LVG_y in ~/.andes/pycode/ESAC1A, you can check the values of the arguments used for evaluating that equation for initial value.
I suspect that the values input to that initialization function is different than the final output. That is, there is a sequence issue.
…On Sep 29, 2021, 6:32 PM -0500, Jinning Wang ***@***.***>, wrote:
Hi Hantao,
There is an initialization bug with LVGate. I was developing ESAC1A, and the code was in my test branch exctest.
Below are the diagram and the code snippet.
self.HVG = HVGate(u1=self.UEL,
u2=self.LA_y,
info='HVGate for under excitation',
)
self.LVG = LVGate(u1=self.HVG_y,
u2=self.OEL,
info='LVGate for under excitation',
)
The LVGate should output the lower value as design. I set UEL=-999 and OEL=999, so the final output should be the input value LA_y. However, the actual output is 0. It was wired.
Could you please check the related function?
Regards,
Jinning
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Hi Hantao, I modified the ...
self.sl = Selector(self.u1, self.u2, fun=np.minimum.reduce,
info='LVGate Selector',
)
self.y = Algeb(info='LVGate output', tex_name='y', discrete=self.sl)
self.vars = {'sl': self.sl, 'y': self.y}
... However, the bug was still there. Then I checked the pycode, the def LVG_y_ia(HVG_y, OEL, LVG_sl_s1, LVG_sl_s0):
return (HVG_y*LVG_sl_s0 + LVG_sl_s1*OEL) The sequence seems correct, but the bug remains there. |
Beta Was this translation helpful? Give feedback.
-
I placed a breakpoint at It turns out that both |
Beta Was this translation helpful? Give feedback.
-
The bug was fixed by modifying the
Thanks for Hantao's help! |
Beta Was this translation helpful? Give feedback.
The bug was fixed by modifying the
LVGate
definition as below:Thanks for Hantao's help!