MC developers information

COMMUNICATION FOR CONTROL SYSTEM: MASTER CONTROL. Back to TOP

PORTS USED:

A: Multicast Remote Port

B: UPD local slow port

C: UDP Local port

D: Multicast Local Port

E: Device COMM PORT

R: Random local port number

IP address:

F: Device computer IP address

G: MC computer IP address

H: Multicast IP

MAIN Loop:

MC Launches and queries database to find the Multicast Remote Port, UPD local slow port, UDP Local port and Multicast Local Port for the chosen Experiment.

STATE: Setup: UDP Initialize

MC Opens Multicast Local Port (Broadcast Shot Number) (REF: MC Multicast) using its own IP (D-G)

MC Opens UDP Local Port Connection (UDP Fast Response) (REF: UDP ID Fast) using its own IP (C-G)

MC Opens UDP Local Slow port Connection (UDP Slow Response) (REF: UDP ID Slow) using its own IP (B-G)

MC gets basic properties of all devices for the experiment: These include for communication, the ipaddress and commport.

IPaddress: The computer on which the device is to be launched (F)

Commport: the TCP device Remote port (E)

On the first call or if a new device is selected, MC will get Basic Properties of the selected device which includes the ipaddress(F) and commport(E). (Active Device Basic Properties)

MC creates the command to send based on the Device and Active Variable selected.

STATE: active variable tcp close

MC closes the Active Variable TCP connection to the Device using REF: active variable tcp (In the first Run, nothing will be closed) (E-F:TCP)

STATE: active variable tcp open

MC opens TCP connection to the remote TCP port of the Device using the commport of the device with Device IP address and subscribes to the Active Variable. (REF: active variable tcp) (Port opened on Remote computer (E-F:TCP))

MC also opens a local TCP port using a random port number (Meant for a device on the same computer) (R-G)

STATE: Main: Send Command

MC uses the UDP Local Port Connection (REF: UDP ID Fast) to send the command to the Active Device using device IPaddress(F) and devcie Comm port(E). (This is writing to the same number port on Remote computer)(E-F:UDP)

MC does an immediate Read on the UDP Local Port Connection( REF: UDP ID Fast) and determines if the command was accepted

NOTE: The TCP connection to the device to subscribe to the Active Variable data and the UDP Local Port connection used to send the command to the device uses the SAME PORT NO.

STATE:Main:Wait for Command Execution

MC waits for a response from the device for the active variable data. For this purpose it reads the FGV UDP SLOW.

Meanwhile, In a different Loop far far away...

MC reads the UDP Local Slow port connection (REF:UDP ID slow) for slow responses and adds to the FGV UDP SLOW. (FGV is Functional Global Variable)

Back in Main Loop

If a SCAN is started

STATE: start scan

MC queries database to get Multicast IP address (H) for the chosen experiment (Populates the Network.MCast Address cluster element)

STATE: Get UDP Listen Ports

MC retrieves commport (all Es) of all devices and opens UDP connections using its own IP. (Thus these will be all local ports unique for each device)(all Es-G) (REF: Listen UDP)

NOTE: These unique local UDP ports for devices are used to receive "I am Ready for Scan" messages from all devices once they have completed their pre-scan settings. (e.g. Set camera to triggered mode, set Save to yes). The results are displayed to the user in a list called "Devices not ready for Scan"

MC prepares the Multicast command to set every device in Scan Mode

STATE: Scan: Send Multicast

MC uses the REF:MC Multicast to send the multicast message to the MCast Address (H) and Mcast remote port (A). (H-A)

STATE: Scan: Check Devices Ready

MC reads all the unique device local UDP connections (all Es-G)(REF: Listen UDP) to determine if the devices are ready for Scan

MC closes all the unique device local UDP connections (all Es-G)(REF: Listen UDP) after read is complete.

STATE: Get TCP Listen Ports

MC opens TCP connections to all devices using their IP addresses(F) and comm ports (E). (E-F:TCP) (REF: TCP Ports)

MC writes to all devices using the (REF: TCP Ports)

STATE: Main: Send Command

MC uses the UDP Local Port Connection (REF: UDP ID Fast) to send the command to the Active Device using its IPaddress(F) and Comm port(E). (This is writing to the same number port on Remote computer)(E-F:UDP)

MC does an immediate Read on the UDP Local Port Connection( REF: UDP ID Fast) and determines if the command was accepted

NOTE: The TCP connection to the device to subscribe to the Active Variable data and the UDP Local Port connection used to send the command to the device uses the SAME PORT NO.

STATE:Main:Wait for Command Execution

MC waits for a response from the device for the active variable data. For this purpose it reads the FGV UDP SLOW.

STATE: Send shot number

MC uses the MC Multicast REF:MC Multicast to send the multicast message to the MCast Address (H) and Mcast remote port (A). (H-A)

STATE: Fire

MC uses the UDP Local Port Connection (REF: UDP ID Fast) to send the command to the Shot Control Device using its IPaddress(F) and Comm port(E). (This is writing to the same number port on Remote computer for Shot Control Device)(E-F:UDP)

MC reads the above port to verify if the Fire command was accepted

STATE: Collect TCP data

MC uses the TCP connections to all devices using their IP addresses(F) and comm ports (E). (E-F:TCP) (REF: TCP Ports) to read TCP data from all devices.

STATE: MAIN: End Scan

MC prepares the Scan End command

STATE: Scan: Send Multicast

MC uses the REF:MC Multicast to send the multicast message to the MCast Address (H) and Mcast remote port (A). (H-A)

STATE: Close UDP MultiListen

MC closes the TCP connections to all devices (E-F:TCP) (REF: TCP Ports) to read TCP data from all devices.

Third LOOP at the bottom of Main Loop uses the TCP connections to all devices using their IP addresses(F) and comm ports (E). (E-F:TCP) (REF: TCP Ports) to read TCP data from all devices when TCP wait all is disabled.

DEVICE COMMUNICATION:

1. Above the main Loop, the Device makes a DB call to get the comm port(E) of the device after receiving its name. This port number is passed to UDP Listerener and UDP Writer Vis,

2. The UDP Listener will determine the IP address (This is the IP address of the MC: G) and port based on the communication ID.

3. The UDP Listener receives UDP data and creates an immediate response and writes back to the same port(E) and device IP.

4. UPD Listener will also increment the port couint by 1 (Same as (B)) and add the device IP and incremented port count to the UDF FGV.

5. In UDP Writer, the slow UDP port (B) and IP address(G) is used to write the Slow Reposne back.

6. TO BE COMPLETED