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:
Name | Description |
---|---|
![]() | Start the C server |
![]() | Shutdown connection |
![]() | Function that gets information from the view |
![]() | Function that send information to the view |
Type | Name | Default | Description |
---|---|---|---|
Integer | nPort | Port number |
Type | Name | Description |
---|---|---|
Integer | fd | Socket descriptor |
function startCServer "Start the C server" input Integer nPort "Port number"; output Integer fd "Socket descriptor"; external "C"; end startCServer;
Type | Name | Default | Description |
---|---|---|---|
Integer | fd | Socket descriptor |
Type | Name | Description |
---|---|---|
Integer | sdStatus | Status of the connection |
function shutdownConnection "Shutdown connection" input Integer fd "Socket descriptor"; output Integer sdStatus "Status of the connection"; external "C"; end shutdownConnection;
Type | Name | Default | Description |
---|---|---|---|
Integer | fd | Socket descriptor | |
Integer | lenCKI | Lenght of the arrays CK/I |
Type | Name | Description |
---|---|---|
Real | CK[lenCKI] | CK[i]=1 implies that the variable associated to the interactive control identified by the number i has changed its value |
Real | I[lenCKI] | Vector with the new values of the interactive variables modified due to a user action |
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;
Type | Name | Default | Description |
---|---|---|---|
Integer | fd | Socket descriptor | |
Integer | len | Length of array O | |
Real | O[len] | Array containing the value of the interactive graphic properties sent to the view | |
Integer | intLen | Length of the array intO | |
Real | intO[intLen] | Array containing the value of the interactive colors sent to the view | |
Integer | num | Number that identifies the component sending the values |
Type | Name | Description |
---|---|---|
Integer | out | =1 if the main window of the view has been closed |
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;