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
}}}