furnace automatic control based on manual control

I need someone help I try to create a automatic control of the furnace Im done with manual control and I need to create a sub-system to control the button who switching between two math. models after corrections (you have to see a code) I explain all the lines in the manual section in code its javaScript in Promotic I have one idea if we try to calculate the non-heating model (at the 226 sec this last step of the model) and some how compare the desired temperature with the calculated temperature of the non-heating model at 226 sek.

if anyone helps me I will be grateful

I will stay tuned here if someone need more informations

Im student not expert sorry.

var oData,TeplotaAlarm,oindexerAuto229,alarm,oindexer3,ForceStart,pamet,pametTeplota1,myVar,pametTeplota,zapinaniePece,pomocBool,TeplotaManualDobeh,rozdielManual,tlacidloON_OFF,auto,zosilnenieManual,omodelovaTeplota,opozadovanaTeplota,oindexer,oindexer2,omodelTrue,ovypocetPozad,odeltaKoeficientu,osilaZosilnenia,ominimalnaPrevadzkovaTeplota,omatematickyModel,orozdiel,omodel;

oData = pMe.Pm("../Data");
		
if (Pm.GetBit(oData.Item("status").Value, 0))
{
//deklaracia načitania hodnot
	omodelovaTeplota = oData.Item("modelovaTeplota"); //Premena pre vypocet modelu 
	opozadovanaTeplota = oData.Item("pozadovanaTeplota"); // Pomocna premenna pre vypocet silyZosilnenia a vypocetPozad
	oindexer = oData.Item("indexer"); //časovač prveho Modelu 
	oindexer2 = oData.Item("indexer2"); //časovač druheho Modelu (dobehu)
oindexer3 = oData.Item("indexer3");
	omodelTrue = oData.Item("modelTrue"); //switch
	ovypocetPozad = oData.Item("vypocetPozad"); //vypocet pozadovanej teploty 
	odeltaKoeficientu = oData.Item("deltaKoeficientu"); // rozidel Modelu dobehu s modelom nábehu sluzi na korekciu dat 
	osilaZosilnenia = oData.Item("silaZosilnenia"); // vypocet sily zosilnenia 
	ominimalnaPrevadzkovaTeplota = oData.Item("minimalnaPrevadzkovaTeplota"); //minimalna prevadzkova teplota 
	omatematickyModel = oData.Item("matematickyModel"); //matematicky model
	orozdiel = oData.Item("rozdiel"); // rozdiel hodnot a vypocet teploty pre prepnutie na model dobehu 
	omodel = oData.Item("model"); // Pomocna premenna 
	pomocBool = oData.Item("pomocBool"); //ešte sa nepoužíva 
	zapinaniePece = oData.Item("zapinaniePece"); 
  zosilnenieManual = oData.Item("zosilnenieManual");
  auto  = oData.Item("auto");
  tlacidloON_OFF  = oData.Item("tlacidloON_OFF");
  rozdielManual  = oData.Item("rozdielManual"); 
  TeplotaManualDobeh  = oData.Item("TeplotaManualDobeh");
  pametTeplota = oData.Item("pametTeplota");
    ForceStart = oData.Item("ForceStart");
  pametTeplota1 = oData.Item("pametTeplota1");
 pamet = oData.Item("pamet");
 alarm = oData.Item("alarm");
 TeplotaAlarm = oData.Item("TeplotaAlarm");
 oindexerAuto229 = oData.Item("oindexerAuto229");
//////////////////////////////////////////																																										

if(ForceStart == true){
oindexer3.Value = oindexer3.Value + 1 ; //this section its for static wait 5 seconds 
if(oindexer3.Value==5){
zapinaniePece.Value = true;
}}
//////////////////////////////////////////

//start of the manual section 
if(auto.Value == false ) {  // je vypnute automaticke riadenie

																																																			
																																																									


				if(tlacidloON_OFF.Value == true && zapinaniePece.Value == true){ 
				//IF button to switching between on off (2 math. models) "tlacidloON_OFF.Value" 
				//this is for a static waiting "zapinaniePece.Value == true"
				omodelovaTeplota.Value = 0.29706*oindexer.Value - 5.6367*Pm.Exp(-17.88*oindexer.Value) - 44.071*Pm.Exp(-0.051501*oindexer.Value) + 148.99; 
				// the first math. model (temp growing) button are ON
				
				omodelovaTeplota.Value = omodelovaTeplota.Value + pametTeplota.Value; 
				// the output of temp as "omodelovaTeplota.Value" and "pametTeplota.Value" this is used for a memory when we try to start heeting again
				pamet.Value = omodelovaTeplota.Value; 
				//creating a momery var.  for the next in IF down 
				
//////////////////////////////////////////				
				if(omodelovaTeplota.Value >= TeplotaAlarm.Value){ 
alarm.Value = 1;
}
				
				oindexer.Value = oindexer.Value +1 ;    // this section its for alarm alert not important to calculations
				oindexer2.Value = 1;
		 	  if(oindexer2.Value > 1){
		 	 
				}
				}
//////////////////////////////////////////



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
							if(tlacidloON_OFF.Value == false && zapinaniePece.Value == true){ 
							// heeting is off "tlacidloON_OFF.Value == false"  this var "zapinaniePece.Value == true" its not inportant (asking the system if forceStart is really on)
												
													pamet.Value = omodelovaTeplota.Value;
													 //memory 
													
													if(oindexer2.Value == 2){ 
													// when we got into the 2s we need calculation for line 102
					pametTeplota1.Value = pamet.Value - omodelovaTeplota.Value;
													}
																												
											if(oindexer2.Value == 1){ 
											//this calculation is done only once bacause we need fill the var for next calculations 
										
											omatematickyModel.Value = (570.27 - (32.982*Pm.Exp(-6.0965*oindexer2.Value)) - (368.62 * Pm.Exp(-0.0032784 * oindexer2.Value)) - (0.58382 * oindexer2.Value)); 
											// calculation of math. model when heeting is off 
											zosilnenieManual.Value =( (omodelovaTeplota.Value - 100) / 100); 
											/*percentage amplification as "zosilnenieManual.Value" we need to calculate percentage amplification
											 bacause we need use the math. model after amplification (its between 100-200 when we stop the math. model of heeting at 150C we know the power of the non-heeting model is 50%) */
											rozdielManual.Value = (omatematickyModel.Value - omodelovaTeplota.Value); 
											//this is var for next cal. "rozdielManual.Value" = math.model(non-heeting) "omatematickyModel.Value" - temp as output "omodelovaTeplota.Value" from the system
											oindexer.Value = 1; 
											//timer
											oindexer2.Value = 1;
											//timer
											}
					
					
				
					
		          omatematickyModel.Value = (570.27 - (32.982*Pm.Exp(-6.0965*oindexer2.Value)) - (368.62 * Pm.Exp(-0.0032784 * oindexer2.Value)) - (0.58382 * oindexer2.Value)); 
		          // the calculation of math. model of non-heeting  
						  omodelovaTeplota.Value = (omatematickyModel.Value*zosilnenieManual.Value)+rozdielManual.Value;
						   // calculations of model after amplification // added from the last step "zosilnenieManual.Value" "rozdielManual.Value" its form line 97

						  omodelovaTeplota.Value = omodelovaTeplota.Value + pametTeplota1.Value;
						   // output of system "pametTeplota1.Value" this var are used as memory from for jumping between models its filled with last temp from output 
						  
							oindexer2.Value = oindexer2.Value +1 ; 
							// timer ++
							
							
							pametTeplota.Value = Pm.Abs(omodelovaTeplota.Value - 107.4283);
						// this var "pametTeplota.Value" its used in the math. model of heeting  in line 57/58 and the number 107.4283 its math. model of heeting in first sec.
							

if(omodelovaTeplota.Value >= TeplotaAlarm.Value){ 
alarm.Value = 1;
}
// this is just for a alarm again 

							}}}

Hi guys I need your help “furnace control” Hi guys, I have no ideas to progress can someone help me fine the right way ?

I try to make control of furnace in javaScript IDE: Promotic 9.0.13

I have already done the manual control based on two mathematical models (heating and non-heating)

and I have no ideas how I can make automatic control sub-system can anyone help me? I will sand the the trial version to tests every line is commented in English

the project : http://www.mediafire.com/file/wvzhnsvv4od6tfj/TrialProjectF.rar/file

var oData,TeplotaAlarm,oindexerAuto229,alarm,oindexer3,ForceStart,pamet,pametTeplota1,myVar,pametTeplota,zapinaniePece,pomocBool,TeplotaManualDobeh,rozdielManual,tlacidloON_OFF,auto,zosilnenieManual,omodelovaTeplota,opozadovanaTeplota,oindexer,oindexer2,omodelTrue,ovypocetPozad,odeltaKoeficientu,osilaZosilnenia,ominimalnaPrevadzkovaTeplota,omatematickyModel,orozdiel,omodel;

oData = pMe.Pm("../Data");
		
if (Pm.GetBit(oData.Item("status").Value, 0))
{
//some var from here are not used 
	omodelovaTeplota = oData.Item("modelovaTeplota"); //Var. for model calculation
	opozadovanaTeplota = oData.Item("pozadovanaTeplota"); // support var for calculations of silyZosilnenia and vypocetPozad
	oindexer = oData.Item("indexer"); //the timer for heating model
	oindexer2 = oData.Item("indexer2"); //the timer for non-heating model
oindexer3 = oData.Item("indexer3"); //timer for 5sek wait and its displayed time 
	omodelTrue = oData.Item("modelTrue"); //switch
	ovypocetPozad = oData.Item("vypocetPozad"); // calculation of required temp (not used)
	odeltaKoeficientu = oData.Item("deltaKoeficientu"); // The difference between the ramp-down model and the ramp-up model is used for correction
	osilaZosilnenia = oData.Item("silaZosilnenia"); // calculation power of amplification
	ominimalnaPrevadzkovaTeplota = oData.Item("minimalnaPrevadzkovaTeplota"); //minimum required temp 
	omatematickyModel = oData.Item("matematickyModel"); //math.model var
	orozdiel = oData.Item("rozdiel"); //difference of values calculated temperature for switching to the deceleration model
	omodel = oData.Item("model"); // support var (not used)
	pomocBool = oData.Item("pomocBool"); //not used now
	zapinaniePece = oData.Item("zapinaniePece");  //forceStart button true/false 
  zosilnenieManual = oData.Item("zosilnenieManual");  //amplification of non-heating model in manual section
  auto  = oData.Item("auto"); // button True/False
  tlacidloON_OFF  = oData.Item("tlacidloON_OFF"); // button True/False
  rozdielManual  = oData.Item("rozdielManual");  //not used 
  TeplotaManualDobeh  = oData.Item("TeplotaManualDobeh"); //not used
  pametTeplota = oData.Item("pametTeplota"); // used to hold the output of temp from models 
    ForceStart = oData.Item("ForceStart"); // Force start button 
  pametTeplota1 = oData.Item("pametTeplota1");// used to hold the output of temp from models 
 pamet = oData.Item("pamet"); //memory
 alarm = oData.Item("alarm"); //alarm (no inportant)
 TeplotaAlarm = oData.Item("TeplotaAlarm"); //alarm (no inportant)
 oindexerAuto229 = oData.Item("oindexerAuto229"); // my tries to make a automatic control base od non-heating model in the last step in 226sec. its mean :: (262.6144tempFrom226sek - difference = outlet temperature if(outlet temperature <= desired temperature)

//////////////////////////////////////////																																										

if(ForceStart == true){
oindexer3.Value = oindexer3.Value + 1 ; //this section its for static wait 5 seconds 
if(oindexer3.Value==5){
zapinaniePece.Value = true;
}}
//////////////////////////////////////////

//start of the manual section 
if(auto.Value == false ) {  // je vypnute automaticke riadenie

																																																			
																																																									


				if(tlacidloON_OFF.Value == true && zapinaniePece.Value == true){ 
				//IF button to switching between on off (2 math. models) "tlacidloON_OFF.Value" 
				//this is for a static waiting "zapinaniePece.Value == true"
				omodelovaTeplota.Value = 0.29706*oindexer.Value - 5.6367*Pm.Exp(-17.88*oindexer.Value) - 44.071*Pm.Exp(-0.051501*oindexer.Value) + 148.99; 
				// the first math. model (temp growing) button are ON
				
				omodelovaTeplota.Value = omodelovaTeplota.Value + pametTeplota.Value; 
				// the output of temp as "omodelovaTeplota.Value" and "pametTeplota.Value" this is used for a memory when we try to start heeting again
				pamet.Value = omodelovaTeplota.Value; 
				//creating a momery var.  for the next in IF down 
				
//////////////////////////////////////////				
				if(omodelovaTeplota.Value >= TeplotaAlarm.Value){ 
alarm.Value = 1;
}
				
				oindexer.Value = oindexer.Value +1 ;    // this section its for alarm alert not important to calculations
				oindexer2.Value = 1;
		 	  if(oindexer2.Value > 1){
		 	 
				}
				}
//////////////////////////////////////////



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
							if(tlacidloON_OFF.Value == false && zapinaniePece.Value == true){ 
							// heeting is off "tlacidloON_OFF.Value == false"  this var "zapinaniePece.Value == true" its not inportant (asking the system if forceStart is really on)
												
													pamet.Value = omodelovaTeplota.Value;
													 //memory 
													
													if(oindexer2.Value == 2){ 
													// when we got into the 2s we need calculation for line 102
					pametTeplota1.Value = pamet.Value - omodelovaTeplota.Value;
													}
																												
											if(oindexer2.Value == 1){ 
											//this calculation is done only once bacause we need fill the var for next calculations 
										
											omatematickyModel.Value = (570.27 - (32.982*Pm.Exp(-6.0965*oindexer2.Value)) - (368.62 * Pm.Exp(-0.0032784 * oindexer2.Value)) - (0.58382 * oindexer2.Value)); 
											// calculation of math. model when heeting is off 
											zosilnenieManual.Value =( (omodelovaTeplota.Value - 100) / 100); 
											/*percentage amplification as "zosilnenieManual.Value" we need to calculate percentage amplification
											 bacause we need use the math. model after amplification (its between 100-200 when we stop the math. model of heeting at 150C we know the power of the non-heeting model is 50%) */
											rozdielManual.Value = (omatematickyModel.Value - omodelovaTeplota.Value); 
											//this is var for next cal. "rozdielManual.Value" = math.model(non-heeting) "omatematickyModel.Value" - temp as output "omodelovaTeplota.Value" from the system
											oindexer.Value = 1; 
											//timer
											oindexer2.Value = 1;
											//timer
											}
					
					
				
					
		          omatematickyModel.Value = (570.27 - (32.982*Pm.Exp(-6.0965*oindexer2.Value)) - (368.62 * Pm.Exp(-0.0032784 * oindexer2.Value)) - (0.58382 * oindexer2.Value)); 
		          // the calculation of math. model of non-heeting  
						  omodelovaTeplota.Value = (omatematickyModel.Value*zosilnenieManual.Value)+rozdielManual.Value;
						   // calculations of model after amplification // added from the last step "zosilnenieManual.Value" "rozdielManual.Value" its form line 97

						  omodelovaTeplota.Value = omodelovaTeplota.Value + pametTeplota1.Value;
						   // output of system "pametTeplota1.Value" this var are used as memory from for jumping between models its filled with last temp from output 
						  
							oindexer2.Value = oindexer2.Value +1 ; 
							// timer ++
							
							
							pametTeplota.Value = Pm.Abs(omodelovaTeplota.Value - 107.4283);
						// this var "pametTeplota.Value" its used in the math. model of heeting  in line 57/58 and the number 107.4283 its math. model of heeting in first sec.
							

if(omodelovaTeplota.Value >= TeplotaAlarm.Value){ 
alarm.Value = 1;
}
// this is just for a alarm again 

							}}}

Please do not create multiple topics for the same question. I have merged your topics.