finish first runable version tested with d_003.R. Change some global variable assign method in functions by using assign('DAE', DAE, envir = .GlobalEnv)