Preserve signal names upon conversion to discrete-time by sawyerbfuller · Pull Request #797 · python-control/python-control
I suggest following the conventions used in linearize():
- Use
copykeyword to control whether signal names are copied (default can be True, although forlinearizeit is False for some reason). - Use
namekeyword to set the system name. Ifnameis not specified and ifcopyisFalse, a generic name <sys[id]> is generated with a unique integer id. IfcopyisTrue, the new system name is determined by adding the prefix and suffix strings inconfig.defaults['iosys.linearized_system_name_prefix']andconfig.defaults['iosys.linearized_system_name_suffix'], with the default being to add the suffix '$linearized'.
Doing this for sample(), the default name of the new system could be the old system with $sampled appended (and overridable via something like iosys.sample_system_name_prefix and iosys.sample_system_name_suffix.
Also, we might want to override the sample() method in LinearIOSystem so that sampling a linear input/output system gives a linear input/output system (rather than just a StateSpace system). This won't matter much since StateSpace is converted to LinearIOSystem if it is connected to anything, but would be a bit cleaner (and points to the fact that we should probably merge StateSpace and LinearIOSystem at some point, as pointed out already in issue #786).