Industry Online Support
Technical Forum
10/25/2013 1:24 PM  
Joined: 2/2/2013 Last visit: 12/6/2023 Posts: 4 Rating: (0) 
Hello. I need to make a curve that consist of 5 individual adjustable points. With linear scaling inbetween them. Please look at attached picture. Is this something that is easely done? I have the "calc" block for a linear curve, but I just cant wrap my head around hov to use these to get the result I need. Im stuck here so I would really appreciate all the help I can get. I need both outside temp and PVtemp on each point to be adjustable. Really looking forward to some good advice! regards, Tom 
10/25/2013 1:53 PM  
Joined: 1/28/2009 Last visit: 12/9/2023 Posts: 6827 Rating: (1351) 
Hello, from products in range of SIMATIC,I can say "NONLIN" function from PID Professional package has the same functionality you want.But that package is used for S7 300/400 in TIA Portal.Same discussion we had before here.You have option of checking OSCAT library.But, for a programmer, that should not be really difficult to make such a function if points are limited.It is peicewise linear approximation of a arbitary function,define boundreis and in each boundry define the Y=AX+B formula. Hope these comments help Hamid Hosseini 
10/27/2013 5:41 PM  
Joined: 9/8/2009 Last visit: 7/17/2023 Posts: 1410 Rating: (149) 
It can be done in many ways,.... if you need only linear lines between points is very simple. Below ispart of my program which calculates setpoint temperature in relation to days. T=(TnTn_1)/(dndn_1)*(ddn_1)+Tn_1 where: T..setpoint Tn...setpoint temperature for nth point Tn_1..setpoint temperature for (n1)th point dndn_1...difference of time between nth point and(n1)th point d..currenttime #CurveHours:=SINT_TO_DINT(#CurveCalcDays)*24+#CurveCalcHours; (* T=(TnTn_1)/(dndn_1)*(ddn_1)+Tn_1 *) #CurveVentOFF:=false; #CurveHeatOFF:=false; IF #CurveEnable THEN IF (#CurveHours<72) THEN //>3 #CurveVentOFF:=true; #CurveHeatOFF:=true; ELSIF (#CurveHours>=72) AND (#CurveHours<24) THEN //3 to 1 //dn=24 //dn_1=72 //dndn_1=48 #CurveVentOFF:=true; #Temp_SP:=(#CurveTempSP[1]#CurveTempSP[0])*(DINT_TO_REAL(#CurveHours)+72.0)/48.0+#CurveTempSP[0]; ELSIF (#CurveHours>=24) AND (#CurveHours<0) THEN //1 t0 0 //dn=0 //dn_1=24 //dndn_1=24 #CurveVentOFF:=true; #Temp_SP:=(#CurveTempSP[2]#CurveTempSP[1])*(DINT_TO_REAL(#CurveHours)+24.0)/24.0+#CurveTempSP[1]; ELSIF (#CurveHours>=0) AND (#CurveHours<72) THEN //0 to 3 //dn=72 //dn_1=0 //dndn_1=72 #Temp_SP:=(#CurveTempSP[3]#CurveTempSP[2])*(DINT_TO_REAL(#CurveHours)+0.0)/72.0+#CurveTempSP[2]; ELSIF (#CurveHours>=72) AND (#CurveHours<168) THEN //3 to 7 //dn=168 //dn_1=72 //dndn_1=96 #Temp_SP:=(#CurveTempSP[4]#CurveTempSP[3])*(DINT_TO_REAL(#CurveHours)72.0)/96.0+#CurveTempSP[3]; ELSIF ............. for you : ELSIF (#OutsideTemp>=OutTemp[1]) AND (#OutsideTemp<OutTemp[2] ) THEN #Temp_SP:=(#CurveTempSP[2]#CurveTempSP[1])*(#OutsideTemp  OutTemp[1]) /(OutTemp[2] OutTemp[1] )+#CurveTempSP[1]; and so on if, if only i didn't make a mistake. 
Last edited by: Marko Bursic at: 10/27/2013 6:06 PM 

This contribution was helpful to1 thankful Users 
Follow us on