furnace automatic control based on manual control
Tags: javascript
Published: 2021-01-25 16:54:07

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 

							}}}
```