Henric

MrPLC Member
  • Content count

    18
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Henric

  • Rank
    Sparky

Profile Information

  • Country Sweden
  1. STL question

    The L-area is the temparea.. The compiler sometimes uses this area.. For example when doing "Advanced networks.." Example code: A #variable_01 = L 6.0 A L 6.0 BLD 102 L S5T#1S SD "T176" A L 6.0 A "T176" = #variable_02 R #variable_01 This code uses variable_01 to both start the timer and then in series with the timer in the same network.. Looks like this in ladder: variable_01 T176 --| |------------------(SD) | | T176 variable_02 |----| |-------( ) | variable_01 |---( R ) IF we had separated the code to look this way: Network 1 variable_01 T176 --| |------------------(SD) Network 2 T176 variable_02 ----| |-------( ) | variable_01 |---( R ) The compiler wouldnt need to use temp variables and the STL would look like this: Network 1 A #variable_01 L S5T#1S SD "T176" Network 2 A "T176" = #variable_02 R #variable_01 Do I make any sense??
  2. Dont have the logix tool.. But when you ask about how to design i can provide an example... Did a similar program like you had but did some redesigns just to make it simpler for me.. First I thought about the sequence of events to happen then i drew a grafcet over this.. Then translated it to ladder and the result you have in attached pdf.. In my example the startbutton and the fill startbutton is momentary pushbuttons, the automatic fill and single cycle is switches (on/off) When you write more and more industrial programs the bits that today drives the outputs just will be orders to a motor/valve object to start/open and that object will handle its own alarms etc etc.. This code is today normally done as a FB(I work with siemens so the termonology may be wrong here) A typical motor FB could have these inputs Auto/Man AutoStart ManStart FeedbackCoil OverloadContact SafetyInterlock And these outputs Overload_Alarm Feedback_Alarm Coil Logix.pdf
  3. Mitsubish FX3u - GX IEC developer.

    Now we have several soulutions, this is the fun with plcs but shouldnt be needed with this trivial problem.. 64k steps is much compared to 8k steps or what the small mitsu cpus have but its still small if one thinks of how cheap memory is today.. But as we all know the FX series has been here many years and I for one would like to se an upgrade to make them more competable with siemens cpus.. And i think the ladder editor in GxIEC sucks.. Compared to Siemens.. I mean i shouldnt be bothered with overlapping connectors, overlapping symbol names etc etc.. if an element needs more space give it more space automaticly.. The ST editor i dont like either I want to declare my variables in the code.. As for doing the for next loop and using the "standard" function that was neat but if working with reals i would prefer my soulution, why? When working with reals i think my soulution gets better accuracy.. And if i must change the code or add some functionallity i think my code compared to that in beijers block is more readable.. But thats my personal opinion.. In a perfect world I wouldnt need my function just do 16 calls of beijers and we would be home free..
  4. Mitsubish FX3u - GX IEC developer.

    Divide by zero shouldnt happen if one have given the raw max - raw min values.. But i shoud simulate to se what will happen if these are zero.. If that gives me some troubles it isnt a problem to test against zero.. but the code gets a little bit more bulky.. Sadly these small mitsu plc has so little memory.. One shouldnt have to bother about memory these days.. Made a MotorBlock earlier today in ST to make it movable to all platforms.. But it takes slightly over 1000steps so using that in a fx cpu is impossible.. I mean i have to have some room for other logic to..
  5. Mitsubish FX3u - GX IEC developer.

    No life tested some again and it seems that one assignement takes 10 steps.. In this case we would have 32 DINTvalues (RawMin,RawMax) wich will do 320steps and 32 reals (ScaledMin,ScaledMax) this sums up to total of 640 steps for assignements.. 640+490 makes 1130steps for scaling 16 values with different rawmax/min and scaledmax/min values.. If the rawmin/rawmax always would be the same this variable would not have to be an array and the code would reduce some..
  6. Mitsubish FX3u - GX IEC developer.

    Made som modifications and this code uses only 490steps for 16scalings.. One disadvantage is one must assign the array parameters outside the block.. dont know how many steps this could be.. Attention this code is written as Siemens scl in mitsu the variabel declarations is done in the header and the keyword begin isnt used.. FUNCTION SCALE_TO_REAL16 : Array[1..16] of REAL VAR_INPUT Raw_In : Array[1..16] of DINT; Raw_Min : Array[1..16] of DINT; Raw_Max : Array[1..16] of DINT; Scaled_Max : Array[1..16] of REAL; Scaled_Min : Array[1..16] of REAL; END_VAR VAR i : INT; Input : DINT; END_VAR BEGIN FOR i:=1 TO 16 BY 1 DO IF Raw_In[i]>Raw_Max[i] THEN Input:=Raw_Max[i]; ELSIF Raw_In[i]<Raw_Min[i] THEN Input:=Raw_Min[i]; ELSE Input:=Raw_In[i]; END_IF; SCALE_TO_REAL16[i] := (Scaled_Max[i] - Scaled_Min[i]) / DINT_TO_REAL(Raw_Max[i] - Raw_Min[i]) * DINT_TO_REAL(Input - Raw_Min[i]) + Scaled_Min[i]; END_FOR; END_FUNCTION
  7. Mitsubish FX3u - GX IEC developer.

    Try to do this function in ST it should use less resources than beijers scale_int function.. The scale_int function is in a way really bloated just open it and look.. FUNCTION SCALE_TO_REAL : REAL VAR_INPUT Raw_In : DINT; Raw_Min : DINT; Raw_Max : DINT; Scaled_Min : REAL; Scaled_Max: REAL; END_VAR VAR_TEMP Input : DINT; END_VAR BEGIN IF Raw_In>Raw_Max THEN Input:=Raw_Max; ELSIF Raw_In<Raw_Min THEN Input:=Raw_Min; ELSE Input:=Raw_In; END_IF; SCALE_TO_REAL := (Scaled_Max - Scaled_Min) / DINT_TO_REAL(Raw_Max - Raw_Min) * DINT_TO_REAL(Input - Raw_Min) + Scaled_Min; END_FUNCTION
  8. Function blocks

    all code from gx iec can also be used in gx developer just dump it in a plc and upload the code only thing that can be a problem is that all the code becomes instruction list...
  9. UPDATE CPU LIBRARY

    In the Hw manager of Step7 it sure is possible updating the hardware catalog.. Doesnt remember how but its a few klicks and it downloads all the new hardware over internet then you install.. If you try search the help this shouldnt be a problem..
  10. STL to Ladder

    edda your ladder looks alright.. Now we are three swedes:) haha
  11. Encoders are connected to SM 321 Digital Input.

    What type of signal does the pulse encoders provide?? What is the resolution of the encoder?? And so on.... Much information missing to answer your question...
  12. baby PLC

    www.heapg.com Look at the XLe or XLt Both a PLC and HMI price 300 dollars and up
  13. Step 7 V5.3 SP3 upgrade problems

    try to download and install SP2 first and then SP3??
  14. question about FC

    The program: OB1: A "in" S M 0.1 A "AUTO/MAN SELECTOR" FP M 0.0 R M 0.1 CC FC 1 A "in" FN M 0.1 R M 0.0 CC FC 2 AN "in" R M 0.0 R M 0.1 R M 0.2 R M 0.3 R M 0.4 R M 0.5 R M 0.6 R M 0.7 FC1: A "EMPTY SENSOR" S M 0.4 R M 0.5 A M 0.4 S "INLETVALVE" R "OUTLETVALVE" A "FULL SENSOR" S M 0.5 R M 0.4 A M 0.5 S "OUTLETVALVE" R "INLETVALVE" FC2: A "MAN-INLET KEY" = "INLETVALVE" A "MAN-OUT KEY" = "OUTLETVALVE" What do you want the program to do how should it work?
  15. Programming Advice

    every time a motor changes it state and you have power (running to not running or vice versa) save the motors status to a word or doubleword. example motor 1running motor 3 running rest of = 0000 0000 0000 0101 when power comes back you compare bit for bit with corresponding motor and start them if they had status 1 before.. do you get it??