*/
public void preinitialize() throws IllegalActionException {
// Check parameters.
_checkParameters();
ArrayToken stateNames = (ArrayToken) stateVariableNames.getToken();
int n = stateNames.length();
int m = inputPortList().size();
int r = outputPortList().size();
// FIXME: Why does this get the token and then do nothing with the value?
//DoubleMatrixToken initial = (DoubleMatrixToken) initialStates
// .getToken();
try {
_workspace.getWriteAccess();
removeAllEntities();
removeAllRelations();
// Create the model
Integrator[] integrators = new Integrator[n];
String[] states = new String[n];
IORelation[] stateRelations = new IORelation[n];
Expression[] equations = new Expression[n];
// Integrators and feedback expressions
for (int i = 0; i < n; i++) {
states[i] = ((StringToken) stateNames.getElement(i))
.stringValue().trim();
integrators[i] = new Integrator(this, states[i]);
integrators[i].initialState.setExpression("initialStates(0,"
+ i + ")");
stateRelations[i] = new TypedIORelation(this, "relation_"