PLCgen: event functions should not directly write to input variable
We should create a temporary local variable in the function, copy the input variable value to it, write that local variable and the function, and return the value of the local variable.
Addressses #679
Edited by Dennis Hendriks