code: function initialise(model, instance, autoInitialiseModel) {
      if (autoInitialiseModel === void 0) { autoInitialiseModel = true; }
      if (instance) {
          // initialise the state machine model if necessary
          if (autoInitialiseModel && model.clean === false) {
              initialise(model);
          }
          exports.console.log("initialise " + instance);
          // enter the state machine instance for the first time
          invoke(model.onInitialise, undefined, instance);
      }
      else {
          exports.console.log("initialise " + model.name);
          // initialise the state machine model
          model.accept(new InitialiseElements(), false);
          model.clean = true;
      }
  }
docs: Initialises a state machine instance and/or [[StateMachine]] model.
  
  Passing just the [[StateMachine]] model will initialise the model, passing the [[StateMachine]] model and instance will initialse the instance and if necessary, the model.
  @param model The [[StateMachine]] model. If autoInitialiseModel is true (or no instance is specified) and the model has changed, the model will be initialised.
  @param instance The optional state machine instance to initialise.
  @param autoInitialiseModel Defaulting to true, this will cause the model to be initialised prior to initialising the instance if the model has changed.