org.openmodelica.simulation.core.network
Class SimulationControlClient

java.lang.Object
  extended by org.openmodelica.simulation.core.network.SimulationControlClient

public class SimulationControlClient
extends java.lang.Object

Simulation Control Client is a TCP/IP based communication unit to control a simulation runtime using message parsing As default the ip of a simulation runtime control server is localhost (127.0.0.1) and the port is 10501. The user can change the port

Author:
EADS Innovation Works, Parham Vasaiely, Parham.Vasaiely@gmx.de

Constructor Summary
SimulationControlClient()
           
 
Method Summary
static void checkConnection()
          Checks if a connection to a simulation runtime control server is established otherwise it will connect to a runtime
static void clearAll(java.lang.String seq)
          Sends a shutdown message to the runtime and closes all open sockets and servers.
static boolean send_changetime_Message(java.lang.String seq, java.lang.String time)
          Changes the simulation time and goes back to a specific time step
static boolean send_changevalue_Message(java.lang.String seq, java.lang.String time, java.lang.String fullQualifiedName, java.lang.String value)
          Changes the value of the appended parameters and stets the simulation time back to the point where the user clicked in the UI
static boolean send_pause_Message(java.lang.String seq)
          Pauses the running simulation
static boolean send_setcontrolclienturl_Message(java.lang.String seq, java.lang.String ccPort)
          Changes the IP and port of the Control Server.
static boolean send_setfilter_Message(java.lang.String seq, java.util.ArrayList<ModelicaProperty> plotProperties)
          Sets the filter for variables and parameters which should send from OMI to the client UI Note: Please maintain the following operation order to avoid problems while simulating: 1. setcontrolclienturl, 2. settransferclienturl, 3. setfilter
static boolean send_settransferclienturl_Message(java.lang.String seq, java.lang.String tcPort)
          Changes the IP and port of the Control Server.
static boolean send_shutdown_Message(java.lang.String seq)
          Shuts the simulation down
static boolean send_start_Message(java.lang.String seq)
          Starts or continues the simulation
static boolean send_stop_Message(java.lang.String seq)
          Stops the running simulation and resets all values to the beginning
static boolean send_useindex_Message(java.lang.String seq)
          TODO
static void setRuntime_ControlServerPort(int newPort)
          Changes the default port if a simulation runtime control server is also using a non default port
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulationControlClient

public SimulationControlClient()
Method Detail

setRuntime_ControlServerPort

public static void setRuntime_ControlServerPort(int newPort)
Changes the default port if a simulation runtime control server is also using a non default port

Parameters:
newPort - New simulation runtime control server port

send_changevalue_Message

public static boolean send_changevalue_Message(java.lang.String seq,
                                               java.lang.String time,
                                               java.lang.String fullQualifiedName,
                                               java.lang.String value)
Changes the value of the appended parameters and stets the simulation time back to the point where the user clicked in the UI

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
time -
fullQualifiedName -
value -
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_changetime_Message

public static boolean send_changetime_Message(java.lang.String seq,
                                              java.lang.String time)
Changes the simulation time and goes back to a specific time step

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
time -
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_setcontrolclienturl_Message

public static boolean send_setcontrolclienturl_Message(java.lang.String seq,
                                                       java.lang.String ccPort)
Changes the IP and port of the Control Server. Otherwise the default configuration will be used. NOTE 1: in this version the ip will be localhost (127.0.0.1) Note 2: Please maintain the following operation order to avoid problems while simulating: 1. setcontrolclienturl, 2. settransferclienturl, 3. setfilter

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
ccPort -
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_settransferclienturl_Message

public static boolean send_settransferclienturl_Message(java.lang.String seq,
                                                        java.lang.String tcPort)
Changes the IP and port of the Control Server. Otherwise the default configuration will be used. NOTE 1: in this version the ip will be localhost (127.0.0.1) Note 2: Please maintain the following operation order to avoid problems while simulating: 1. setcontrolclienturl, 2. settransferclienturl, 3. setfilter

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
tcPort -
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_setfilter_Message

public static boolean send_setfilter_Message(java.lang.String seq,
                                             java.util.ArrayList<ModelicaProperty> plotProperties)
Sets the filter for variables and parameters which should send from OMI to the client UI Note: Please maintain the following operation order to avoid problems while simulating: 1. setcontrolclienturl, 2. settransferclienturl, 3. setfilter

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
plotProperties -
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_useindex_Message

public static boolean send_useindex_Message(java.lang.String seq)
TODO

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_start_Message

public static boolean send_start_Message(java.lang.String seq)
Starts or continues the simulation

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_pause_Message

public static boolean send_pause_Message(java.lang.String seq)
Pauses the running simulation

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_stop_Message

public static boolean send_stop_Message(java.lang.String seq)
Stops the running simulation and resets all values to the beginning

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

send_shutdown_Message

public static boolean send_shutdown_Message(java.lang.String seq)
Shuts the simulation down

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.
Returns:
true if message was send correctly (This is only the TCP communication reply not the runtime reply! A correct operation reply from the runtime is done#seq#end)

checkConnection

public static void checkConnection()
                            throws java.net.UnknownHostException,
                                   java.io.IOException
Checks if a connection to a simulation runtime control server is established otherwise it will connect to a runtime

Throws:
java.net.UnknownHostException
java.io.IOException

clearAll

public static void clearAll(java.lang.String seq)
Sends a shutdown message to the runtime and closes all open sockets and servers.

Parameters:
seq - A sequence number is helpful to manage operation request and reply, a UI has to send a sequence number combined with an operation.