func NewIndependentInstance(instanceID string, flowURI string, flow *definition.Definition, instRecorder *stateInstanceRecorder, logger log.Logger) (*IndependentInstance, error) {
	var err error
	inst := &IndependentInstance{}
	inst.Instance = &Instance{}
	inst.attrs = make(map[string]interface{})
	inst.master = inst
	inst.id = instanceID
	inst.stepID = 0
	inst.workItemQueue = support.NewSyncQueue()
	inst.flowDef = flow
	inst.flowURI = flowURI
	inst.flowModel, err = getFlowModel(flow)
	if err != nil {
		return nil, err
	}
	inst.logger = logger
	inst.status = model.FlowStatusNotStarted
	inst.changeTracker = NewInstanceChangeTracker(inst.id, 0)
	inst.changeTracker.FlowCreated(inst)
	inst.taskInsts = make(map[string]*TaskInst)
	inst.linkInsts = make(map[int]*LinkInst)
	inst.instRecorder = instRecorder
	return inst, nil
}
New creates a new Flow Instance from the specified Flow
package instance
import (
	"errors"
	"fmt"
	"strconv"
	"time"
	"github.com/project-flogo/flow/state"
	"github.com/project-flogo/core/support"
	"github.com/project-flogo/core/support/log"
	"github.com/project-flogo/core/support/trace"
	"github.com/project-flogo/flow/definition"
	"github.com/project-flogo/flow/model"
	flowsupport "github.com/project-flogo/flow/support"
)
type IndependentInstance struct {
	*Instance
	id            string
	stepID        int
	workItemQueue *support.SyncQueue  
	wiCounter     int
	changeTracker ChangeTracker
	flowModel   *model.FlowModel
	patch       *flowsupport.Patch
	interceptor *flowsupport.Interceptor
	subflowCtr int
	subflows   map[int]*Instance
	startTime  time.Time
	instRecorder *stateInstanceRecorder
}