This commit is contained in:
wikano
2025-12-04 23:08:12 +01:00
parent 869f498daf
commit 1532753042
3 changed files with 191 additions and 30 deletions

View File

@@ -65,6 +65,7 @@ END_PROGRAM
PROGRAM automate_controle_commande_ld PROGRAM automate_controle_commande_ld
VAR VAR
P1_enc : BOOL; P1_enc : BOOL;
WAIT2 : TIME;
P1_run : BOOL; P1_run : BOOL;
P2_enc : BOOL; P2_enc : BOOL;
P2_run : BOOL; P2_run : BOOL;
@@ -79,9 +80,20 @@ PROGRAM automate_controle_commande_ld
TON1 : TON; TON1 : TON;
secours_c_ok : BOOL; secours_c_ok : BOOL;
CTU0 : CTU; CTU0 : CTU;
TON2 : TON;
CTU1 : CTU;
CTU2 : CTU;
req_enc_ok : BOOL;
WAIT15 : TIME;
TON3 : TON;
R_TRIG1 : R_TRIG; R_TRIG1 : R_TRIG;
_TMP_GT33_ENO : BOOL; _TMP_GT42_ENO : BOOL;
_TMP_GT33_OUT : BOOL; _TMP_GT42_OUT : BOOL;
R_TRIG2 : R_TRIG;
_TMP_EQ54_OUT : BOOL;
_TMP_EQ53_OUT : BOOL;
_TMP_AND45_ENO : BOOL;
_TMP_AND45_OUT : BOOL;
END_VAR END_VAR
Pump_def := NOT(P1_run) AND P1_enc OR NOT(P2_run) AND P2_enc OR NOT(P3_run) AND P3_enc; Pump_def := NOT(P1_run) AND P1_enc OR NOT(P2_run) AND P2_enc OR NOT(P3_run) AND P3_enc;
@@ -90,11 +102,23 @@ PROGRAM automate_controle_commande_ld
secours := TON0.Q; secours := TON0.Q;
only_one_run := NOT(P3_run) AND NOT(P2_run) AND P1_run OR NOT(P3_run) AND P2_run AND NOT(P1_run) OR P3_run AND NOT(P2_enc) AND NOT(P1_run); only_one_run := NOT(P3_run) AND NOT(P2_run) AND P1_run OR NOT(P3_run) AND P2_run AND NOT(P1_run) OR P3_run AND NOT(P2_enc) AND NOT(P1_run);
Pump_def := TRUE; Pump_def := TRUE;
TON1(IN := TRUE, PT := WAIT13); TON2(IN := TRUE, PT := WAIT13);
R_TRIG1(CLK := ); R_TRIG1(CLK := );
CTU0(CU := R_TRIG1.Q, R := true); CTU1(CU := R_TRIG1.Q, R := true);
_TMP_GT33_OUT := GT(EN := TON1.Q, IN1 := CTU0.Q, IN2 := 1, ENO => _TMP_GT33_ENO); _TMP_GT42_OUT := GT(EN := TON2.Q, IN1 := CTU1.CV, IN2 := 1, ENO => _TMP_GT42_ENO);
secours_c_ok := _TMP_GT33_OUT; secours_c_ok := _TMP_GT42_OUT;
secours := TRUE;
TON1(IN := TRUE, PT := WAIT2);
R_TRIG2(CLK := P1_enc OR P2_enc OR P3_enc);
CTU0(CU := R_TRIG2.Q, R := true);
_TMP_EQ54_OUT := EQ(CTU0.CV, 1);
CTU2(R := NOT(P1_enc) OR NOT(P2_enc) OR NOT(P3_enc), PV := 1);
_TMP_EQ53_OUT := EQ(CTU2.CV, 1);
_TMP_AND45_OUT := AND(EN := TON1.Q, IN1 := _TMP_EQ54_OUT, IN2 := _TMP_EQ53_OUT, ENO => _TMP_AND45_ENO);
req_enc_ok := _TMP_AND45_OUT;
only_one_run := TRUE;
TON3(IN := TRUE, PT := WAIT15);
only_one_run := NOT(TON3.Q);
END_PROGRAM END_PROGRAM

View File

@@ -88,6 +88,7 @@ END_PROGRAM
PROGRAM automate_controle_commande_ld PROGRAM automate_controle_commande_ld
VAR VAR
P1_enc : BOOL; P1_enc : BOOL;
WAIT2 : TIME;
P1_run : BOOL; P1_run : BOOL;
P2_enc : BOOL; P2_enc : BOOL;
P2_run : BOOL; P2_run : BOOL;
@@ -102,9 +103,20 @@ PROGRAM automate_controle_commande_ld
TON1 : TON; TON1 : TON;
secours_c_ok : BOOL; secours_c_ok : BOOL;
CTU0 : CTU; CTU0 : CTU;
TON2 : TON;
CTU1 : CTU;
CTU2 : CTU;
req_enc_ok : BOOL;
WAIT15 : TIME;
TON3 : TON;
R_TRIG1 : R_TRIG; R_TRIG1 : R_TRIG;
_TMP_GT33_ENO : BOOL; _TMP_GT42_ENO : BOOL;
_TMP_GT33_OUT : BOOL; _TMP_GT42_OUT : BOOL;
R_TRIG2 : R_TRIG;
_TMP_EQ54_OUT : BOOL;
_TMP_EQ53_OUT : BOOL;
_TMP_AND45_ENO : BOOL;
_TMP_AND45_OUT : BOOL;
END_VAR END_VAR
Pump_def := NOT(P1_run) AND P1_enc OR NOT(P2_run) AND P2_enc OR NOT(P3_run) AND P3_enc; Pump_def := NOT(P1_run) AND P1_enc OR NOT(P2_run) AND P2_enc OR NOT(P3_run) AND P3_enc;
@@ -113,11 +125,23 @@ PROGRAM automate_controle_commande_ld
secours := TON0.Q; secours := TON0.Q;
only_one_run := NOT(P3_run) AND NOT(P2_run) AND P1_run OR NOT(P3_run) AND P2_run AND NOT(P1_run) OR P3_run AND NOT(P2_enc) AND NOT(P1_run); only_one_run := NOT(P3_run) AND NOT(P2_run) AND P1_run OR NOT(P3_run) AND P2_run AND NOT(P1_run) OR P3_run AND NOT(P2_enc) AND NOT(P1_run);
Pump_def := TRUE; Pump_def := TRUE;
TON1(IN := TRUE, PT := WAIT13); TON2(IN := TRUE, PT := WAIT13);
R_TRIG1(CLK := ); R_TRIG1(CLK := );
CTU0(CU := R_TRIG1.Q, R := true); CTU1(CU := R_TRIG1.Q, R := true);
_TMP_GT33_OUT := GT(EN := TON1.Q, IN1 := CTU0.Q, IN2 := 1, ENO => _TMP_GT33_ENO); _TMP_GT42_OUT := GT(EN := TON2.Q, IN1 := CTU1.CV, IN2 := 1, ENO => _TMP_GT42_ENO);
secours_c_ok := _TMP_GT33_OUT; secours_c_ok := _TMP_GT42_OUT;
secours := TRUE;
TON1(IN := TRUE, PT := WAIT2);
R_TRIG2(CLK := P1_enc OR P2_enc OR P3_enc);
CTU0(CU := R_TRIG2.Q, R := true);
_TMP_EQ54_OUT := EQ(CTU0.CV, 1);
CTU2(R := NOT(P1_enc) OR NOT(P2_enc) OR NOT(P3_enc), PV := 1);
_TMP_EQ53_OUT := EQ(CTU2.CV, 1);
_TMP_AND45_OUT := AND(EN := TON1.Q, IN1 := _TMP_EQ54_OUT, IN2 := _TMP_EQ53_OUT, ENO => _TMP_AND45_ENO);
req_enc_ok := _TMP_AND45_OUT;
only_one_run := TRUE;
TON3(IN := TRUE, PT := WAIT15);
only_one_run := NOT(TON3.Q);
END_PROGRAM END_PROGRAM

View File

@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<project xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ns1="http://www.plcopen.org/xml/tc6_0201"> <project xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ns1="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2025-11-14T09:46:22"/> <fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2025-11-14T09:46:22"/>
<contentHeader name="Unnamed" modificationDateTime="2025-12-04T22:50:02"> <contentHeader name="Unnamed" modificationDateTime="2025-12-04T23:07:16">
<coordinateInfo> <coordinateInfo>
<fbd> <fbd>
<scaling x="10" y="10"/> <scaling x="10" y="10"/>
@@ -678,7 +678,7 @@
<derived name="TON"/> <derived name="TON"/>
</type> </type>
</variable> </variable>
<variable name="secours_c_ok"> <variable name="req_secours_ok">
<type> <type>
<BOOL/> <BOOL/>
</type> </type>
@@ -708,6 +708,16 @@
<BOOL/> <BOOL/>
</type> </type>
</variable> </variable>
<variable name="WAIT15">
<type>
<TIME/>
</type>
</variable>
<variable name="TON3">
<type>
<derived name="TON"/>
</type>
</variable>
</localVars> </localVars>
</interface> </interface>
<body> <body>
@@ -837,25 +847,25 @@
<variable>Pump_def</variable> <variable>Pump_def</variable>
</coil> </coil>
<leftPowerRail localId="13" width="10" height="40"> <leftPowerRail localId="13" width="10" height="40">
<position x="60" y="210"/> <position x="70" y="240"/>
<connectionPointOut formalParameter=""> <connectionPointOut formalParameter="">
<relPosition x="10" y="20"/> <relPosition x="10" y="20"/>
</connectionPointOut> </connectionPointOut>
</leftPowerRail> </leftPowerRail>
<inVariable localId="14" width="50" height="30" negated="false"> <inVariable localId="14" width="50" height="30" negated="false">
<position x="70" y="270"/> <position x="80" y="300"/>
<connectionPointOut> <connectionPointOut>
<relPosition x="50" y="10"/> <relPosition x="50" y="10"/>
</connectionPointOut> </connectionPointOut>
<expression>WAIT7</expression> <expression>WAIT7</expression>
</inVariable> </inVariable>
<coil localId="8" negated="false" width="21" height="20" executionOrderId="0"> <coil localId="8" negated="false" width="21" height="20" executionOrderId="0">
<position x="150" y="220"/> <position x="160" y="250"/>
<connectionPointIn> <connectionPointIn>
<relPosition x="0" y="10"/> <relPosition x="0" y="10"/>
<connection refLocalId="13"> <connection refLocalId="13">
<position x="150" y="230"/> <position x="160" y="260"/>
<position x="70" y="230"/> <position x="80" y="260"/>
</connection> </connection>
</connectionPointIn> </connectionPointIn>
<connectionPointOut> <connectionPointOut>
@@ -864,14 +874,14 @@
<variable>Pump_def</variable> <variable>Pump_def</variable>
</coil> </coil>
<block localId="15" typeName="TON" instanceName="TON0" width="50" height="60"> <block localId="15" typeName="TON" instanceName="TON0" width="50" height="60">
<position x="240" y="200"/> <position x="250" y="230"/>
<inputVariables> <inputVariables>
<variable formalParameter="IN"> <variable formalParameter="IN">
<connectionPointIn> <connectionPointIn>
<relPosition x="0" y="30"/> <relPosition x="0" y="30"/>
<connection refLocalId="8"> <connection refLocalId="8">
<position x="240" y="230"/> <position x="250" y="260"/>
<position x="171" y="230"/> <position x="181" y="260"/>
</connection> </connection>
</connectionPointIn> </connectionPointIn>
</variable> </variable>
@@ -879,10 +889,10 @@
<connectionPointIn> <connectionPointIn>
<relPosition x="0" y="50"/> <relPosition x="0" y="50"/>
<connection refLocalId="14"> <connection refLocalId="14">
<position x="240" y="250"/> <position x="250" y="280"/>
<position x="180" y="250"/> <position x="190" y="280"/>
<position x="180" y="280"/> <position x="190" y="310"/>
<position x="120" y="280"/> <position x="130" y="310"/>
</connection> </connection>
</connectionPointIn> </connectionPointIn>
</variable> </variable>
@@ -902,12 +912,12 @@
</outputVariables> </outputVariables>
</block> </block>
<coil localId="16" negated="false" width="21" height="20"> <coil localId="16" negated="false" width="21" height="20">
<position x="340" y="220"/> <position x="350" y="250"/>
<connectionPointIn> <connectionPointIn>
<relPosition x="0" y="10"/> <relPosition x="0" y="10"/>
<connection refLocalId="15" formalParameter="Q"> <connection refLocalId="15" formalParameter="Q">
<position x="340" y="230"/> <position x="350" y="260"/>
<position x="290" y="230"/> <position x="300" y="260"/>
</connection> </connection>
</connectionPointIn> </connectionPointIn>
<connectionPointOut> <connectionPointOut>
@@ -1395,7 +1405,7 @@
<connectionPointOut> <connectionPointOut>
<relPosition x="21" y="10"/> <relPosition x="21" y="10"/>
</connectionPointOut> </connectionPointOut>
<variable>secours_c_ok</variable> <variable>req_secours_ok</variable>
</coil> </coil>
<coil localId="12" negated="false" width="21" height="20" executionOrderId="0"> <coil localId="12" negated="false" width="21" height="20" executionOrderId="0">
<position x="570" y="240"/> <position x="570" y="240"/>
@@ -1744,6 +1754,109 @@
</connectionPointOut> </connectionPointOut>
<variable>req_enc_ok</variable> <variable>req_enc_ok</variable>
</coil> </coil>
<leftPowerRail localId="56" width="10" height="40" executionOrderId="0">
<position x="60" y="450"/>
<connectionPointOut formalParameter="">
<relPosition x="10" y="20"/>
</connectionPointOut>
</leftPowerRail>
<inVariable localId="58" width="60" height="30" negated="false" executionOrderId="0">
<position x="70" y="510"/>
<connectionPointOut>
<relPosition x="60" y="20"/>
</connectionPointOut>
<expression>WAIT15</expression>
</inVariable>
<coil localId="59" negated="false" width="21" height="20" executionOrderId="0">
<position x="150" y="460"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="56">
<position x="150" y="470"/>
<position x="70" y="470"/>
</connection>
</connectionPointIn>
<connectionPointOut>
<relPosition x="21" y="10"/>
</connectionPointOut>
<variable>only_one_run</variable>
</coil>
<block localId="60" typeName="TON" instanceName="TON3" width="50" height="60" executionOrderId="0">
<position x="240" y="440"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="59">
<position x="240" y="470"/>
<position x="171" y="470"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="PT">
<connectionPointIn>
<relPosition x="0" y="50"/>
<connection refLocalId="58">
<position x="240" y="490"/>
<position x="230" y="490"/>
<position x="230" y="530"/>
<position x="130" y="530"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="Q">
<connectionPointOut>
<relPosition x="50" y="30"/>
</connectionPointOut>
</variable>
<variable formalParameter="ET">
<connectionPointOut>
<relPosition x="50" y="50"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<coil localId="62" negated="true" width="21" height="20">
<position x="350" y="460"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="60" formalParameter="Q">
<position x="350" y="470"/>
<position x="290" y="470"/>
</connection>
</connectionPointIn>
<connectionPointOut>
<relPosition x="21" y="10"/>
</connectionPointOut>
<variable>only_one_run</variable>
</coil>
<comment localId="63" height="40" width="120">
<position x="210" y="540"/>
<content>
<xhtml:p><![CDATA[req_failure]]></xhtml:p>
</content>
</comment>
<comment localId="61" height="40" width="140">
<position x="210" y="320"/>
<content>
<xhtml:p><![CDATA[req_delai_grace]]></xhtml:p>
</content>
</comment>
<comment localId="64" height="40" width="110">
<position x="290" y="150"/>
<content>
<xhtml:p><![CDATA[set_pump_def]]></xhtml:p>
</content>
</comment>
<comment localId="65" height="40" width="140">
<position x="860" y="160"/>
<content>
<xhtml:p><![CDATA[set_only_one_run]]></xhtml:p>
</content>
</comment>
</LD> </LD>
</body> </body>
</pou> </pou>