at work, a customer aksed for a "logic diagram" of parts of our PLC code, which is written in structured text.
It should show the logic of specific code parts from input to output (including parameters etc.) in binary logic like depiction, similar to FBD (function block diagram).
I could not really find good examples or professional software to create them. I tried Microsoft Visio, Aucotec Engineering Base and dozen of online drawing tools, but none of them really would work for creating these diagrams on a bigger scale and for comercial use. Also, the code is already written, so rewriting it in something like CFC (continuous function chart) or FBD like mentioned above is not an option.
I will attach a screenshot of an example diagram how it should look like. The example is done in Visio, but creating dozens of pages this way would take far too much time and would not be very nice to maintain.
Do you have any recomendations on maybe even free software to do this with?

If no specific software, does someone have an idea for something like "data fields" in Visio or etc. to manage the In-/Outputs and variables to not have to edit them all over every time?

Logic diagram example - BrakeControl

Sample code (structured text):

IF stSettings.bExists THEN
  IF stSettings.eMode = E_OPMode.eOPModeOpen OR stSettings.eMode = E_OPMode.eOPModeClose THEN
    // close brake manual - only possible if below max braking rpm and hydraulic closed
    bCloseBrake := stSettings.eMode = E_OPMode.eOPModeClose AND stIO.stGenerator.IstGen_Speed.fPercent < stSettings.fStartRev AND itfHydCtrl.IsClosed;
    IF stIOs.IbBrake_Auto AND stIOs.IbBrake_Worn AND  
       (itfTurbCtrl.State = E_TurbState.eTurbStateFault OR 
        itfTurbCtrl.State = E_TurbState.eTurbStateStop OR
        itfTurbCtrl.State = E_TurbState.eTurbStateReady )           
        IF stIO.stGenerator.IstGen_Speed.fPercent < stSettings.fStartRev AND itfHydCtrl.IsClosed THEN
            bCloseBrake := TRUE;

    IF stIOs.IbBrake_Auto AND NOT stIOs.IbBrake_Worn AND itfTurbCtrl.ManualMode THEN    
        IF stIO.stGenerator.IstGen_Speed.fPercent < stSettings.fStartRev AND  stIO.stPenstock.IbBypass_Closed 
            AND stIO.stPenstock.IbMIV_Closed AND itfHydCtrl.IsClosed THEN
            bCloseBrake := TRUE;


IF bBrakeRelease THEN
    bCloseBrake := FALSE;
stIOs.QbBrake_On := bCloseBrake;

Your Answer


Browse other questions tagged or ask your own question.