update use/computation of sys._isstatic()#1117
Conversation
sawyerbfuller
left a comment
There was a problem hiding this comment.
This looks good. But a question that comes to mind is should tf’s new _isstatic method get put in iosys.py instead (and the explanatory comment moved to its init)? If so, I think NonlinearIOSystem should also get a _static field. Statesp.py also suffers from multiple implementations of isstatic (the first when the dt field is processed in process_io_keywords) but this may just be unavoidable complexity.
One thing to consider is terminology : is a time-varying stateless system considered to be static?
|
I asked ChatGPT how we should think about "static". I thought the answer was pretty good:
Based on that, I think we should adopt the following definition: A static I/O system model is a model in which the output |
|
Also, I've looked into where this concept is used. There are a couple of instances:
|
d99ac61 to
ce77e6b
Compare
|
Looks good, with just a couple of clarifying questions. |
Nice. and pretty good answer. It looks like Matlab has an isstatic function, perhaps a future PR could turn |
|
I thought about making |
This small PR addresses #1090, where there was a redundant calculation for whether a transfer function is static (constant) or not.
This fixes that by saving the computation done ininitand using it later ifsys._isstatic()is called. I also found a spot innlsyswhere there was a (simple) redundant computation, so converted that to a call tosys._isstatic().Following the discussion below, the current PR does the following:
_isstatic()method fromInputOutputSystemtoNonlinearIOSystemandTransferFunction. This is because the way in which the checks are done is different for systems with a state versus transfer functions.NonlinearIOSystem(includingStateSpace, which is a subclass), a systemsysis static ifsys.nstatesis zero, so this is what_isstatic()checks.TransferFunction, a systemsysis static if the numerator and denominator polynomials are all zero order. This is computed when the system is constructed and store in the private instance variable_static.FrequencyResponseData, the_isstatic()method is not defined (mainly because it isn't used anywhere).The main uses of the static property for a system are described in more detail in the comments below.