Signal Manager

The Signal Manager is used to automatically link imported signals to specific PLC Signals within your realvirtual.io project. Additionally, Signals that are not linked can be deleted or deactivated. Depending on your rules for automatic connection, an appropriate script must be added. The Signal Manager also offers the possibility to automatically create signals in your realvirtual.io project if no suitable signals are found in the already existing and previously imported signals.

If you have thousands of unused and unconnected Signals in your project after importing the signals, you can significantly improve the startup time of your simulation if you disable or delete unconnected Signals.

How to use the signal manager

To use the Signal Manager, it must be added as a component to the game object that contains the imported signals as subcomponents (and usually the interface itself).

To get an overview of the number of connected and unconnected signals, you can select “Check Signals”. This will update the information displayed in the Signal Manager.

Component elements

AutoConnectLevels In the “AutoConnectLevels” list you specify for which game objects (and child objects) the signal connection should be performed. This way you avoid checking and connecting parts of the simulation model where you don’t want to perform an automatic signal creation or connection.

Check signals. Updates the signal information.

Disable unconnected signals Disables all unconnected Signals.

Enable Unconnected Signals Enables all unconnected Signals.

Delete Unconnected Signals Deletes all unconnected Signals.

Delete automatically created signals. Deletes all automatically created Signals, connected or disconnected.

Start and connect signal creation Starts the automatic connection of Signals. Signals that are not found are created automatically. To use automatic signal connection and creation, you need to define your own custom user scripts that implement your connection and naming rule (see below).

User scripts

The signal manager uses the custom script to assign the Signals. This script must be of type “AutoConnectBase”. Within the script you define how the matching should be done. One possibility is to use the definition of kinematic groups to assign the signals to a drive or a gripper, for example. The use of EditorUtility.SetDirty is necessary to update the editor. Below you will find a corresponding code example:

 namespace realvirtual.io
{
    public partial class AutoConnectExample : AutoConnectBase
    {
        public override bool AutoConnect(BehaviorInterface component)
        {
            var connected = false;
            var signalname = "";
            Debug.Log($" Checking AutoConnect for " +component.name);

            /// Here you can define your connection rules, create signals and assign them to the behavior models
            Kinematic kin = component.GetComponent<Kinematic>();

            if (component.GetType() == typeof(Gripper))
            {
                signalname = kin.GroupName + "_Oeffnen";   // define Signal name based on custom rule
                var signal = GetOrCreateSignal<PLCOutputBool>(signalname);   // create the signal if not already there
                ((Gripper)component).OpenGripper = signal; // connect the signal to the behavior model
                EditorUtility.SetDirty(component);
                connected = true;
                
                signalname= kin.GroupName + "_Schliessen";   // define Signal name based on custom rule
                signal = GetOrCreateSignal<PLCOutputBool>(signalname);   // create the signal if not already there
                ((Gripper)component).CloseGripper = signal; // connect the signal to the behavior model
                EditorUtility.SetDirty(component);
                connected = true;
            }
            if (component.GetType() == typeof(Drive_FollowPosition))
            {
                signalname = kin.GroupName + "_Position";
                var drivesignal = GetOrCreateSignal<PLCOutputFloat>(signalname);
                ((Drive_FollowPosition)component).Position = drivesignal; // connect the signal to the behavior model
                EditorUtility.SetDirty(component);
                connected = true;
            }
            return connected;
        }
    }
}

After import and matching you can check the matching it by using “Check for unconnected Signals”. According to that it is possible to delete automatically created or unconnected signals.

© 2022 in2Sight GmbH https://realvirtual.io - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.

Last updated