vcSignal
Signal is the basic implementation for signal type behaviors which can simulate wiring, send a value to other signals and trigger events.
See in: Overview
Module: vcBehaviors
Parent: vcBehavior
Children: vcBooleanSignal, vcComponentSignal, vcIntegerSignal, vcMatrixSignal, vcRealSignal, vcStringSignal
Referenced by: vcSimSignalField.Signal
Properties
Learn how to use properties here. The properties are also inherited from the parent class.
| Name | Type | Access | Description |
| AutomaticReset | Boolean | RW | Gets or sets a value defining if the signal is reset to its default value when simulation is reset. |
| Connections | vcList | RW | Gets or sets a list of Python script behaviors within a component that will process received signals.See moreThe scripts should have a OnSignal(signal: vcSignal) method, which gets called when the signal is triggered. |
Methods
Learn how to use methods here. The methods are also inherited from the parent class.
| Name | Return Type | Parameters | Description |
| connect | Boolean | vcSignal signal, Optional Keyword[connectInGui = Boolean] | Connects signals.See moreParameters: signal (vcSignal): The signal to connect to this signal. connectInGui (Boolean): When true, the created connection will be visible in GUI. Exceptions: RuntimeError: When either of the nodes owning the signals has not been initialized. Returns: Boolean: Returns True on success, otherwise False. |
| disconnect | Boolean | vcSignal signal, Optional Keyword[disconnectInGui = Boolean] | Disconnects signals.See moreParameters: signal (vcSignal): The signal to disconnect from this signal. disconnectInGui (Boolean): When true, the signal is disconnected also in GUI. Returns: Boolean: Returns True on success, otherwise False. |
Events
Learn how to use events here. The events are also inherited from the parent class.
| Name | Parameters | Description |
| OnSignal | vcSignal signal | Triggered when the signal itself is triggered, thereby invoking all Connections. Parameters: signal (vcSignal): The signal that was triggered. |
Example: Wait Signal Behavior Value
""" Waits until a signal reaches a specified value during simulation. The simulation time is consumed until the signal behavior is triggered and has the specified value. It uses vcBooleanSignal.waitFor() with the waitTrigger keyword set to True, which ensures the method waits for a value update event before checking the condition. """ import vcCore as vc async def OnRun(): comp = vc.getComponent() trig_signal = comp.findBehavior("TriggerSignal") await trig_signal.waitFor(True, waitTrigger = True)
Example: Write Signal Behavior Value
""" This example shows how to write a signal behavior value.""" import vcCore as vc async def OnRun(): comp = vc.getComponent() start_process_sig = comp.findBehavior("StartProcessSignal") start_process_sig.signal(True)