Исходный текст программы


/* str6 */
/* Выработка тепла */
/* Молдавизолит. г. Тирасполь */

#include <stdio.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include «titlet.h»
#include «d6.h»
#define ANAL 1

void d6(void);
void grafr();
float pp3();
void vxd1();
void vost1();
void ocinf();
void uchet();
void fdt();
void mes();
void sv();
void teplo();
long lsee();
struct zps mo6[]={
{&d6,60,RAVR6,3,IVR6,IVD6,IVT6,»mainnsi»,»d6″,0}
};
#include «bibt.c»
#include «blog.c»
char far *tg = (char far *) 328;

main(argc,argv)
int argc;
char *argv[];
{
int prog,i,f1;

static int *AIM6[4]={IVR6,IVD6,IVT6,NULL};
static int INT6[3]={60,60,60};

*tg=’0′;
switch(argc){
case 7:
par5=atoi(argv[6]);
case 6:
par4=atoi(argv[5]);
case 5:
case 4:
otmn=atoi(argv[3]);
case 3:
par1=atoi(argv[2]);
case 2:
prog=atoi(argv[1]);
}

vost1(GE,1);

vost(GN6,K6);
pinf(AIM6,INT6);

/***********************************/
/* Формирование массива энтальпии */

if((f1=_open(«ental»,4))==-1)
{
sprintf(buf_mes,»%s: vost:не открыт файл %s»,
name_prog,»ental»);
mes(buf_mes,1);

}

_read(f1,ent,sizeof(ent));
_close(f1);

/***********************************/

if(par1==4 || par1==3 )
{
set_data(IMR6, MPR6, KOLS6);
set_data1(IMD6, MPD6, KOLD6);
set_data1(IMT6, MPT6, KOLT6);
logr(IMR6,MTPR6,FMTPR6,KOLS6,NEDR6,IVR6,RAVR6);
loga(IMD6,MTPD6,FMTPD6,KOLD6,NEDD6,IVD6);
loga(IMT6,MTPT6,FMTPT6,KOLT6,NEDT6,IVT6);
}

PZAP(mo6,1,otmn,argv[4]);

switch (prog){
case 0:
case 1:
if(*tg!=’0′) { *tg=’0′;exit(1);}
/*printf(«d6»);*/
set_data(IMR6, MPR6, KOLS6);
set_data1(IMD6, MPD6, KOLD6);
set_data1(IMT6, MPT6, KOLT6);

if(par1==0 || (par1==3 && par2==2))
logr(IMR6,MTPR6,FMTPR6,KOLS6,NEDR6,IVR6,RAVR6);

if(par1==0 || (par1==3 && par2==2) ||
(par1==4 && par2==2) || par1==2)

{ loga(IMD6,MTPD6,FMTPD6,KOLD6,NEDD6,IVD6);
loga(IMT6,MTPT6,FMTPT6,KOLT6,NEDT6,IVT6);
}

d6();
default: break;
}
/* printf(«str6:end\n»);*/

exit(0);
}

void sv()
{
static struct st GE[1]={{«E»,E,34}};
int kcyt,kcy1,s17,vrem,i;
struct tm *p;
long int t;
time(&t);
p=localtime(&t);
E[1]=p->tm_sec;
E[2]=p->tm_min;
E[3]=p->tm_hour;
E[4]=p->tm_yday+1;
E[5]=E[3]*60+E[2];
E[6]=p->tm_mday;
E[7]=p->tm_mon+1;
E[8]=p->tm_year%100;
E[10]=KCYTOK;
E[9]=minu(E[5]);
E[12]=KOLSM;
for(i=0;i<E[12];i++)
E[13+i]=KSM[i];
E[11]=ncm(E[5]);
vxd1(GE,1);
}

/* d6.c */

void d6(void)

{
int sr,i;
int RQ = 0;

switch(par1){
case 0:

if(prov(IVR6,RAVR6,TRCR6)==1) break;
if(prov(IVR6,RAVQ6,TRCQ6)==1) break;
A6:
anal(RABD6,IMD6,LSID6,KOLD6,IVD6,RAVD6);
int1(IMD6,IVD6,LSID6,RAVD6,RABD6,REZD6,KOLD6,RAVR6,1,
FNSID6,NSID6);

for(i=0; i<4; i++)
IMT6[ SV_iis[i][2]] = IMT6[ SV_iis[i][1]] — (IMR6[ SV_iis[i][0]]/TRCR6[0]);

anal(RABT6,IMT6,LSIT6,KOLT6,IVT6,RAVT6);
int1(IMT6,IVT6,LSIT6,RAVT6,RABT6,REZT6,KOLT6,RAVR6,0);

if(par1==4 && par2==2) break;
if(par1==4 && par2==1) goto U6;

/* ****************************************************************
Формирование основного массива TRCR6 */

for(i=0; i<KOLC6; i++)
TRCR6[i+1] = IMR6[i];

/* **************************************************************** */

U6:
uchet(TRCR6, RABR6,KOLC6);
intrv(REZR6,RABR6,IVR6,RAVR6,KOLC6,SMR6,0,
NULL,NULL,0,»0″,GOD6);

if(par1==4 && par2==1) goto UC1;
teplo(KOL_W,&RQ,IMR6,LSIT6,TRSQ6,SV6_W,KFB);
teplo(KOL_D,&RQ,IMR6,LSIT6,TRSQ6,SV6_D,KFD);
teplo(KOL_M,&RQ,IMR6,LSIT6,TRSQ6,SV6_M,KFM);
ental(LSID6,IMR6,TRSQ6,SEN6,KOL_P);

/* ***********************************************************

Формирование дополнителъного массива TRCQ6 по формулам
сложения и вычитания */

TRCQ6[1] = TRSQ6[1] — TRSQ6[3];
TRCQ6[2] = TRSQ6[4] — TRSQ6[6];
TRCQ6[3] = TRSQ6[7] — TRSQ6[9];
TRCQ6[4] = TRSQ6[10] — TRSQ6[12];
TRCQ6[5] = TRSQ6[13] — TRSQ6[14];
TRCQ6[6] = TRSQ6[15] — TRSQ6[16];
TRCQ6[7] = TRSQ6[23] — TRSQ6[24];
TRCQ6[8] = TRSQ6[25] — TRSQ6[26];
TRCQ6[9] = TRSQ6[27] — TRSQ6[28];
TRCQ6[10] = TRSQ6[29] — TRSQ6[30];
TRCQ6[11] = TRSQ6[37] — TRSQ6[38];
TRCQ6[12] = TRSQ6[39] — TRSQ6[40];
TRCQ6[13] = TRSQ6[41] — TRSQ6[42];

TRCQ6[15] = TRSQ6[45] — TRSQ6[46];
TRCQ6[16] = TRSQ6[49] — TRSQ6[50];
TRCQ6[17] = TRSQ6[51] — TRSQ6[52];
TRCQ6[18] = TRSQ6[53] — TRSQ6[54];
TRCQ6[19] = TRSQ6[55] — TRSQ6[56];
TRCQ6[20] = TRSQ6[57] — TRSQ6[58];
TRCQ6[21] = TRSQ6[59] — TRSQ6[60];
TRCQ6[22] = TRSQ6[61] — TRSQ6[62];
TRCQ6[23] = TRSQ6[63];
TRCQ6[24] = TRSQ6[64];
TRCQ6[25] = TRSQ6[65];
TRCQ6[26] = TRSQ6[66];
TRCQ6[27] = TRSQ6[1] -TRSQ6[2];
TRCQ6[28] = TRSQ6[4] -TRSQ6[5];
TRCQ6[29] = TRSQ6[7] -TRSQ6[8];
TRCQ6[30] = TRSQ6[10] -TRSQ6[11];
TRCQ6[31] = TRSQ6[17] — TRSQ6[18];
TRCQ6[32] = TRSQ6[19] — TRSQ6[20];
TRCQ6[33] = TRSQ6[21] — TRSQ6[22];
TRCQ6[34] = TRSQ6[43] — TRSQ6[44];
TRCQ6[35] = TRSQ6[47] — TRSQ6[48];
TRCQ6[36] = TRSQ6[31] — TRSQ6[32];
TRCQ6[37] = TRSQ6[33] — TRSQ6[34];
TRCQ6[38] = TRSQ6[35] — TRSQ6[36];
TRCQ6[41] = TRSQ6[67];
TRCQ6[42] = TRSQ6[68];
TRCQ6[43] = TRSQ6[69];
TRCQ6[44] = TRSQ6[70];

TRCQ6[14] = TRCQ6[33] — TRCQ6[34];
TRCQ6[39] = TRCQ6[16] + TRCQ6[17] + TRCQ6[18];
TRCQ6[40] = TRCQ6[19] + TRCQ6[20] + TRCQ6[21] + TRCQ6[22];
TRCQ6[45] = TRCQ6[27] + TRCQ6[31];
TRCQ6[46] = TRCQ6[28] + TRCQ6[29] + TRCQ6[30] + TRCQ6[32];
TRCQ6[47] = TRCQ6[12] + TRCQ6[13] + TRCQ6[15] + TRCQ6[34];
TRCQ6[48] = TRCQ6[16] + TRCQ6[17] + TRCQ6[18] + TRCQ6[33];
TRCQ6[48] += TRCQ6[35] + TRCQ6[37];
TRCQ6[49] = TRCQ6[19] + TRCQ6[20] + TRCQ6[21] + TRCQ6[22];
TRCQ6[49] += TRCQ6[38];
TRCQ6[50] = TRCQ6[11] + TRCQ6[12] + TRCQ6[13] + TRCQ6[14];
TRCQ6[50] += TRCQ6[16] + TRCQ6[17] + TRCQ6[18] + TRCQ6[19];
TRCQ6[50] += TRCQ6[20] + TRCQ6[21] + TRCQ6[22] + TRCQ6[27];
TRCQ6[50] += TRCQ6[28] + TRCQ6[29] + TRCQ6[30] + TRCQ6[31];
TRCQ6[50] += TRCQ6[32] + TRCQ6[33] + TRCQ6[34] + TRCQ6[35];
TRCQ6[50] += TRCQ6[36] + TRCQ6[37] + TRCQ6[38] + TRCQ6[41];
TRCQ6[50] += TRCQ6[42] + TRCQ6[43] + TRCQ6[44] ;
TRCQ6[51] = TRCQ6[1 ] + TRCQ6[ 2] + TRCQ6[ 3] + TRCQ6[ 4];
TRCQ6[51] += TRCQ6[ 5] + TRCQ6[ 6] + TRCQ6[ 7] + TRCQ6[ 8];
TRCQ6[51] += TRCQ6[ 9] + TRCQ6[10] + TRCQ6[11] + TRCQ6[12];
TRCQ6[51] += TRCQ6[13] + TRCQ6[14] + TRCQ6[16] + TRCQ6[17];
TRCQ6[51] += TRCQ6[18] + TRCQ6[19] + TRCQ6[20] + TRCQ6[21];
TRCQ6[51] += TRCQ6[22] + TRCQ6[23] + TRCQ6[24] + TRCQ6[25];
TRCQ6[51] += TRCQ6[26] + TRCQ6[34] + TRCQ6[35];
/* ************************************************************ */

UC1:
uchet(TRCQ6,RABQ6,KOLCQ6);
grafr(GQ6,RAVR6,KOLNQ6);
intrv(REZQ6,RABQ6,IVR6,RAVQ6,KOLCQ6,SMQ6,1,
GQ6,SOTQ6,KOLNQ6,FNSIQ6,GODQ6);
vihod(IVR6,RAVR6,1,TRSR6,TRCR6,KOLC6,IMR6,KOLS6);
vihod(IVR6,RAVQ6,0,TRSQ6,TRCQ6,KOLCQ6);
vxd(GN6,K6);
break;
case 1:
rasg(FNSIQ6,REZQ6,GQ6,IVR6,RAVQ6,KOLNQ6,0,SOTQ6,KOLCQ6,
SMQ6,0);
vxd(GN6,K6);
break;
case 2:
vost1(GND6,KD6);
pusk(REZQ6,SMQ6,RAVQ6,0,IVR6,IMR6,KOLCQ6,KOLS6,1,
FNSIQ6,GQ6,KOLNQ6,SOTQ6,GODQ6);
pusk(REZR6,SMR6,RAVR6,1,IVR6,IMR6,KOLC6,KOLS6,0,
«0»,NULL,0,NULL,GOD6);
puska(REZD6,IVD6,IMD6,RAVD6,LSID6,KOLD6,RAVR6,1,
FNSID6,NSID6);
puska(REZT6,IVT6,IMT6,RAVT6,LSIT6,KOLT6,RAVR6,0);
vxd(GN6,K6);
break;
case 3:
TRCQ6[0]=pp3(par4,par3,RAVQ6);
if(datch(IVR6,RAVR6,TRCR6,TRS,IMR6,KOLS6)==1) break;
goto A6;

case 4:
if((sr=sredn(TRCQ6,IVR6,RAVQ6,REZQ6,KOLCQ6))==1) break;
if((sr=sredn(TRCR6,IVR6,RAVR6,REZR6,KOLC6))==1) break;
if(sr==2) goto U6;
ocinf(IVR6,IMR6,KOLS6);
goto A6;
case 6:
korag(REZD6,FNSID6,RAVD6,NSID6,KOLD6);
vost1(GND6,KD6);
vxd(GN6,K6);
}
}