I am running a time dependent simulation and I want to change the sign of a variable when a certain event occurs. I have defined a variable called u and I need to be able to make the statement u=-u. I have tried many variations of this: u=if(event, -u,u) but this gives a circular dependency error. I have also tried adding 'withsol' to this statement but that does not work either. Does anyone know how I might accomplish this?
↧