Question about Block definition and use #178
Answered
by
cuihantao
jinningwang
asked this question in
Internal Design
Replies: 1 comment 4 replies
-
It looks like you did not specify name. You specified tex_name.
Name was supposed to be automated. When you write self.aaa = Algeb(…), the program captures aaa and set it to this instance. The name will be used later when populating equations.
When using a block, name needs to be specified as the prefix of names of the comprising variables. I couldn’t remember more details for now.
Regards,
Hantao Cui
…On Sep 20, 2021, 5:22 PM -0500, Jinning Wang ***@***.***>, wrote:
Hi Hantao,
I develop a new block PIDAWHardLimit, and try to use it in AC8B.
1. the andes prep said "Must specify name for PIDAWHardLimit instance." I checked the existing code and don't think name for a block is mandatory, may I ask is there any rule I didn't follow?
File "/Users/jinningwang/Documents/work/andes/andes/core/block.py", line 463, in __init__
name=name, tex_name=tex_name, info=info,
File "/Users/jinningwang/Documents/work/andes/andes/core/block.py", line 362, in __init__
u=self.ui, K=self.kd, T=self.kd)
File "/Users/jinningwang/Documents/work/andes/andes/core/block.py", line 124, in __setattr__
raise ValueError(f"Must specify `name` for {self.class_name} instance.")
ValueError: Must specify `name` for PIDAWHardLimit instance.
2. Although I specify a name for the PID in model AC8B, it still runs into error:
self.PIDAW = PIDAWHardLimit(u=self.vi, kp=self.kP, ki=self.kI, kd=self.kD,
aw_lower=self.VPMIN, aw_upper=self.VPMAX,
lower=self.VPMIN, upper=self.VPMAX,
tex_name='PID', info='PID', name='PIDAW',
)
Error parsing equation "(None - PIDAW_xd_x) "for AC8B.PIDAW_xd_x
More detail:
The definition in AC8B is:
self.PIDAW = PIDAWHardLimit(u=self.vi, kp=self.kP, ki=self.kI, kd=self.kD,
aw_lower=self.VPMIN, aw_upper=self.VPMAX,
lower=self.VPMIN, upper=self.VPMAX,
tex_name='PID', info='PID',
)
Part of the init definition is attached below, and the full definition is in the commit 87d2fe2 of my 'Dynamic Model' PR.
class PIDAWHardLimit(PIController):
... ...
def __init__(self, u, kp, ki, kd, aw_lower, aw_upper, lower, upper, no_lower=False, no_upper=False,
ref=0.0, x0=0.0, name=None, tex_name=None, info=None):
PIDController.__init__(self, u=u, kp=kp, ki=ki, kd=kd, ref=ref, x0=x0,
name=name, tex_name=tex_name, info=info,
)
self.lower = dummify(lower)
self.upper = dummify(upper)
self.aw_lower = dummify(aw_lower)
self.aw_upper = dummify(aw_upper)
... ...
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.
4 replies
Answer selected by
jinningwang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Hantao,
I develop a new block
PIDAWHardLimit
, and try to use it inAC8B
.andes prep
said "Must specifyname
for PIDAWHardLimit instance." I checked the existing code and don't thinkname
for a block is mandatory, may I ask is there any rule I didn't follow?PID
in model AC8B, it still runs into error:More detail:
The definition in
AC8B
is:Part of the init definition is attached below, and the full definition is in the commit 87d2fe2 of my 'Dynamic Model' PR.
Regards,
Jinning
Beta Was this translation helpful? Give feedback.
All reactions