When a simulation scheme must be prepared it must be described in the SIMCOS language. It can be "drawn" using an enclosed block library graphics tool but more often it is entered as a program using one of text editors, e.g. Edit enclosed with DOS. Whichever form of entry of the model is used, the first phase of simulation reprocesses it into space of states form and rewrites the program into Fortran and prepares files with input parameters. This Fortran program is compiled into an executable file and executed. The executable program reads parameter values from input files, performs the simulation and writes requested calculated values into another file. When it terminates, SIMCOS takes control again and can display results as a graphic plot. The "heart" of the executable is function INTEG which can solve differential equations using one of several numerical methods. First it reads necessary values from files then it calls the function DERIV where the model is actually described as series of functions of its derivatives. The returned values are used at the selected numerical method. Requested calculated results are written into the file and the whole procedure is repeated until the termination condition is satisfied.
Example
Continuous simulation of dead time is not a trivial task and usually we use one of Padé approximations. We will simulate Padé approximation of 2nd order and 4th order: Input signal is a unit step, communication interval equals 0.01s, length simulation run is 5s, results will be compared with output of built-in discrete functiondelay. y1 is a result of simulation of Padé approximation of 2nd order, y2 is a result of simulation of Padé approximation of 4th order and y3 is result of the discrete function delay. When transfer functions of both Padé approximation are developed using one of simulation schemes, the model can be described with the following program:
program pade constant tm=1.0 constant tfin=5 array del variable t=0.0 u=step u11d=12/*u-12/*y1 u11=integ u21d=u11-u*6/tm-y1*6/tm u21=integ y1=u21+u u12d=u*1680/-y2*1680/ u12=integ u22d=u12-u*840/-y2*840/ u22=integ u32d=u22+u*180/-y2*180/ u32=integ u42d=u32-u*20/tm-y2*20*tm u42=integ y2=u42+u y3=delay cinterval ci=0.01 hdr Pade approximation of dead time prepar y1,y2,y3 output 10,y1,y2,y3 termt end
After the simulation run is finished the results can be displayed as plots. It is possible to trace values of plots, select which plots to display, turning on a grid, zoom etc.