VirtualLabBuilder.src.CServer

Communication functions

Information


 

CServer package

CServer package package includes Modelica functions encapsulating external C-functions. The goal of these external C-functions is to communicate the execuble C-file generated by Dymola and the graphic user interface (java program automatically generated during the initialization process). The communication is based on a client-server architecture. The Java and the C program are the client and the server respectively. The communication is performed using TCP sockets. The external C-functions perform the following communication tasks:

Package Content

NameDescription
VirtualLabBuilder.src.CServer.startCServer startCServer Start the C server
VirtualLabBuilder.src.CServer.shutdownConnection shutdownConnection Shutdown connection
VirtualLabBuilder.src.CServer.getVarValues getVarValues Function that gets information from the view
VirtualLabBuilder.src.CServer.sendOutput sendOutput Function that send information to the view


VirtualLabBuilder.src.CServer.startCServer

Start the C server

Inputs

TypeNameDefaultDescription
IntegernPort Port number

Outputs

TypeNameDescription
IntegerfdSocket descriptor

Modelica definition

function startCServer "Start the C server" 
 input Integer nPort "Port number";
  
 output Integer fd "Socket descriptor";
  
 external "C";
  
end startCServer;

VirtualLabBuilder.src.CServer.shutdownConnection

Shutdown connection

Inputs

TypeNameDefaultDescription
Integerfd Socket descriptor

Outputs

TypeNameDescription
IntegersdStatusStatus of the connection

Modelica definition

function shutdownConnection "Shutdown connection" 
 input Integer fd "Socket descriptor";
 output Integer sdStatus "Status of the connection";
  
 external "C";
end shutdownConnection;

VirtualLabBuilder.src.CServer.getVarValues

Function that gets information from the view

Inputs

TypeNameDefaultDescription
Integerfd Socket descriptor
IntegerlenCKI Lenght of the arrays CK/I

Outputs

TypeNameDescription
RealCK[lenCKI]CK[i]=1 implies that the variable associated to the interactive control identified by the number i has changed its value
RealI[lenCKI]Vector with the new values of the interactive variables modified due to a user action

Modelica definition

function getVarValues "Function that gets information from the view" 
  input Integer fd "Socket descriptor";
  input Integer lenCKI "Lenght of the arrays CK/I";
  
  output Real CK[lenCKI] 
    "CK[i]=1 implies that the variable associated to the interactive control identified by the number i has changed its value";
  output Real I[lenCKI] 
    "Vector with the new values of the interactive variables modified due to a user action";
external "C";
end getVarValues;

VirtualLabBuilder.src.CServer.sendOutput

Function that send information to the view

Inputs

TypeNameDefaultDescription
Integerfd Socket descriptor
Integerlen Length of array O
RealO[len] Array containing the value of the interactive graphic properties sent to the view
IntegerintLen Length of the array intO
RealintO[intLen] Array containing the value of the interactive colors sent to the view
Integernum Number that identifies the component sending the values

Outputs

TypeNameDescription
Integerout=1 if the main window of the view has been closed

Modelica definition

function sendOutput "Function that send information to the view" 
 input Integer fd "Socket descriptor";
 input Integer len "Length of array O";
 input Real O[len] 
    "Array containing the value of the interactive graphic properties sent to the view";
 input Integer intLen "Length of the array intO";
 input Real intO[intLen] 
    "Array containing the value of the interactive colors sent to the view";
 input Integer num "Number that identifies the component sending the values";
 output Integer out "=1 if the main window of the view has been closed";
  
 external "C";
  
  
end sendOutput;

HTML-documentation generated by Dymola Tue Jul 24 18:58:14 2007.