Customization > SySim- SysML model execution > Modeling a SySim model execution > How to use Signals for communicating between SySim control blocks
  
How to use Signals for communicating between SySim control blocks
Sending a Signal from a SySim Control Block:
Define the SysML Signal.
Define an Interface Block with a Reception for that Signal. Apply the <<DirectedFeature>> stereotype to the Reception and set the \u201cfeatureDirection\u201d to either \u201crequired\u201d or \u201cprovidedrequired\u201d.
Create a Proxy Port on the Control Block typed by the Interface Block (the port must be stereotyped with ether <<SySim OutputPort>> or <<SySim InputOutputPort>>).
From the Control Block code, send the signal with the following syntax:
(ASAL) send <signal name> (<signal parameters>) to <port name>;
(VB) <port name>.SendEvent(New <signal name> (<signal parameters>))
Receiving a Signal into a SySim control block to trigger a State Machine:
Define the SysML Signal (can be the same as defined above).
Define an Interface Block with a Reception for that Signal. Apply the <<DirectedFeature>> stereotype to the Reception and set the \u201cfeatureDirection\u201d to either \u201cprovided\u201d or \u201cprovidedrequired\u201d.
Create a Proxy Port on the Control Block typed by the Interface Block (the port must be stereotyped with either <<SySim InputPort>> or <<SySim InputOutputPort>>).
Create a SignalEvent and assign its Signal association to reference the Signal to receive.
Use the SignalEvent as a trigger in the State Machine.
When a Signal is sent to a Proxy Port (typed by an Interface Block), the Signal is received if:
The Interface Block has a Reception for the Signal.
The featureDirection of the Reception is either \u201cprovided\u201d or \u201cprovidedrequired\u201d, if the Proxy Port is not Conjugated, or either \u201crequired\u201d or \u201cprovidedrequired\u201d if the Proxy Port is Conjugated.
Such Reception can be defined either on the Interface Block itself, or on a superclass of the Interface Block, i.e. on another Interface Block that generalizes the Interface Block that actually types the Proxy Port.
The Reception can be associated either to the Signal sent to the Proxy Port, or to any Signal superclass that Signal inherits from.
When a Signal is sent to a Proxy Port, but it cannot be received because the above is not true, the signal is discarded.
When a signal is discarded, SySim logs the occurrence both in the Excel execution log (if active), and in the simulation log accessible by means of the Errors button on the simulation form.