[Emulink] Fixed issue in creation per_function, improved state_machine.j...

...s structure