fischertechnik / plc_training_factory_24v

Training Factory Industry 4.0 (24V)
27 stars 18 forks source link

Compressor of VGR wont start via SCL #1

Closed SamedAga closed 3 years ago

SamedAga commented 3 years ago

Hi there,

I am currently trying to understand the SCL Code for the FT plc factory. One thing I want to do, is to move the VGR to a random position (which works fine) and pick up a part (which doesnt seem to work). The moving part works fine. I'm using the Node RED environment as the backend (move to Position). I've added a new position in HMI VGR - Positions for that. The next step would be to start the compressor and the vacuum to pick the part. For that I've added some code inside _PRG_VGR_SetPositioning (which is used to move the VGR via Node RED). For some odd reason, the compressor doesn't seem to start. The variable _QX_VGR_CompressorQ7 stays at FALSE the entire time. However the VGR will pick up a part from the DSI, when I place a part there. My guess is, that somewhere in the SCL code, _QX_VGR_CompressorQ7 is forced to FALSE, whenever I activate move to Position in the Node RED environment. But I couldn't find where.

Here my code (in _PRG_VGR_SetPositioning ) to test the compressor:

[...]        
        110: // Position vertical Axis + Offset
                ...
                #li_StepCase := 111; // ADDED THIS HERE
            END_IF;

// this part should activate the compressor wait 4 seconds and then turn it off.
        111: // activate Compressor
             // start compressor
            "QX_VGR_Compressor_Q7" := TRUE;
            #li_StepCase := 112;

        112: // wait sequence
            #lx_Start_TON_Wait := TRUE;
            #lt_TON_Wait := T#4000ms;

            IF #lfb_TON_Wait.Q THEN
                #lx_Start_TON_Wait := FALSE;
                #li_StepCase := 113;
            END_IF;

        113:
            // turn off the compressor
            "QX_VGR_Compressor_Q7" := FALSE;
            #li_StepCase := 114;

        114: // wait sequence
            #lx_Start_TON_Wait := TRUE;
            #lt_TON_Wait := T#3500ms;

            IF #lfb_TON_Wait.Q THEN
                #lx_Start_TON_Wait := FALSE;
                #li_StepCase := 120;
            END_IF;

        120: // Deciding which doing
        ...
[...]

Thanks,

Samed

SamedAga commented 3 years ago

Found the problem. In the initialization process of PRG_VGR_Ablauf the Compressor is forced to FALSE leading to explained behavior in previous post. To solve that, either uncomment (not recommended) or create a IF state checking if x_Set_Pos_Activ is TRUE.