Hi, I'm new to SCL. Please don't say: use STL or something, the reason that I want to make it in SCL is because I can put formulas in it without ACCU thinking. I have to be able to show it to other people who are not programmers. So, I know STL, LAD, and FBD, but I'm new is SCL.
First I'll try to explain a bit:
We have 2 kind of carpets, loper and tapijt. Tapijt is the actual carpet where machines have to work.
So, when we start the machine now, everything starts. But to reduce the energy consumption, they want to start the several machine in the line when the carpet is located there.
So TAPIJT = Production and LOPER = the precarpet (just garbage).
We have a sensor connected on an INPUT that can say at the beginnening of the line that it's a production or loper.
So, when production starts, INPUT = 0, then a pulse sensor that gives 0,4 m/puls counts the meters.
When we arrive at a machine (DIST = distance to machine) - minus the predistance of 2m for example, then TAPIJT is 1, that machine has to start all burners, sprays or whatever. The endpoint is also calculated.
The problem is now, this WORKS, but..., if 2 or 3 short peaces of production are running in the line, then this will not work.
So in a max of 3 short productions we have to think something out. I am thinking on, calculating the beginpoint, endpoint of each peace ... and using a database...
Other ideas ?
This is my code until now (like I said, I'm a beginner who bought an SCL license, so I really want to keep it in SCL):
First I'll try to explain a bit:
We have 2 kind of carpets, loper and tapijt. Tapijt is the actual carpet where machines have to work.
So, when we start the machine now, everything starts. But to reduce the energy consumption, they want to start the several machine in the line when the carpet is located there.
So TAPIJT = Production and LOPER = the precarpet (just garbage).
We have a sensor connected on an INPUT that can say at the beginnening of the line that it's a production or loper.
So, when production starts, INPUT = 0, then a pulse sensor that gives 0,4 m/puls counts the meters.
When we arrive at a machine (DIST = distance to machine) - minus the predistance of 2m for example, then TAPIJT is 1, that machine has to start all burners, sprays or whatever. The endpoint is also calculated.
The problem is now, this WORKS, but..., if 2 or 3 short peaces of production are running in the line, then this will not work.
So in a max of 3 short productions we have to think something out. I am thinking on, calculating the beginpoint, endpoint of each peace ... and using a database...
Other ideas ?
This is my code until now (like I said, I'm a beginner who bought an SCL license, so I really want to keep it in SCL):
FUNCTION FC007: VOID
VAR_INPUT
INPUT :BOOL;
RUN: BOOL;
PULS_FP: BOOL;
PULS_LENGTE: REAL;
DIST_NAAR: REAL;
DIST_VOOR: REAL;
DIST_NA: REAL;
DIST_AGG: REAL;
END_VAR
VAR_OUTPUT
LOPER: BOOL;
TAPIJT: BOOL;
POS_NAAD_Loper: REAL;
POS_NAAD_Tapijt: REAL;
END_VAR
VAR_TEMP
PULS: REAL;
END_VAR
BEGIN
IF PULS_FP THEN
PULS := 1;
ELSE
PULS := 0;
END_IF;
IF RUN AND INPUT THEN // LOPER TELLING
POS_NAAD_Loper:= POS_NAAD_Loper + (PULS * PULS_LENGTE);
POS_NAAD_Tapijt:= 0;
END_IF;
IF RUN AND NOT INPUT THEN // TAPIJT TELLING
POS_NAAD_Tapijt:= POS_NAAD_Tapijt + (PULS * PULS_LENGTE);
POS_NAAD_Loper:= 0;
END_IF;
IF DIST_NAAR-DIST_VOOR < POS_NAAD_Tapijt AND DIST_NAAR + DIST_NA + DIST_AGG > POS_NAAD_Loper THEN // EVALUATIE TAPIJT OF VOORLOPER
TAPIJT:= True;
LOPER:= False;
ELSE
LOPER:= True;
TAPIJT:= False;
END_IF;
END_FUNCTION