Hi,
We had similar problem on our modbus kit. We want to be sure about
hierarchy of components related to the modbus. For example, the modbus
device must be under the modbus network and the modbus point must be
under the modbus device and like so. So we need to remove the
component if it is placed against the hierarchy. There is no mechanism
in the workbench to solve it. So we have to solve it dynamically in
the sedona code. Let me try to describe you our solution. We added
some code to start() method of the component. It checks if it's
parent's type is suitable or not. If not, it writes a value to a
register to show there is a problem about the placement. Then, when
execute() method of the component worked, it checks the register and
if it says there is a problem about the placement, the component
removes itself. The command is "Sys.app.remove(this)". So, if there is
a placement problem, the component removes itself from the
application, you cannot put it to unsuitable place.
You may use similar technique in your code. You must check if there is
same component placed before in start() method. If yes, remove it in
the first execution. The problem is, you have to scan all the
component list if there a duplicate one. This may take too much time.
I wish this may be helpful,
regards