I know that macros CAN run simultaneously (we have enough examples of that with macros that call each other...
By the way, I forgot to mention that I also have a question or two about macros calling other macros... and maybe someone can shed some light in that area as well:
First off, why is a separate delay needed
before a macro "call"? In fact, why is a delay needed at all? (It seems like if there is an inherent need for such a delay, then there
ought to be a macro step designed for calling other macros - that would automatically handle any required delays, synchronizations, etc.
Second, the act of calling one macro from another revisits the question of how macros interact with each other, specifically in this case, whether the "called" macro behaves like a subroutine, suspending execution of the "calling" macro until the "called" macro finishes, or if the "called" macro is simply triggered and then both macros continue to run. (The behavior of my system
appears to support the subroutine theory, yet that behavior would be contradictory to the general concensus here that
all macros run when they are triggered, regardless of any other macros that may be executing, so...
)
To further support the theory that at least some macros actually preempt or block each other in some cases, I have one macro scenario that gives me fits:
In order to automagically cycle through several cameras that are needed in order to cover a certain area here, I have a simple looping macro that turns on a camera, delays for several seconds, then turns on the next camera, repeating the steps for each of the cameras, and then looping back by calling itself. A flag gets tested at the beginning of the macro, and this allows an external macro to abort the loop - as when the motion sensor issues an off command. The aggravating problem is that the Off command is
supposed to trigger a macro that sets the "abort flag", preventing the looping macro from restarting... but it appears that the Off-response macro often does not run (thus, the abort flag does not get set, and the loop continues to reiterate). This is true regardless of whether the Off-macro gets triggered during the several-second delay periods of the looping macro, or if it gets triggered when the looping macro is actually switching cameras (i.e. - when it is issuing PLC commands). Repeatedly firing the Off macro (with several seconds between each try)
usually aborts the loop
eventually, but sometimes not. This behavior seems to indicate that the looping macro is actually blocking the Off-response macro from executing in many cases. More puzzle...
(Actually, the
preferred operation would be for the loop to abort
immediately upon the execution of the Off-command - but I don't see a way to accomplish that, so the abort-flag method is a work-around).