#46 and #48 added code for `writesxmodel`. The code uses duplications for state and input variables that should be easy to share.