Hello everyone, I am new to the Siemens family and just starting to learn STL programming. I have been experimenting for the past two days and have successfully scaled a block in STL. Now, I am facing a challenge with a scaling block for a tank level sensor that controls the start and stop of a pump (for learning purposes). My task is to compare the current level value with predefined low and high setpoints, and then activate a boolean tag to either start or stop the pump command. However, I am struggling with converting the real/float values from the scale block to a true or false value for controlling the motor. Any advice or insight on this issue would be greatly appreciated. Below is my current code for reference: // Eng Range Calculation "L High Engineering Limits" "L Low Engineering Limits" -RT "Engineering Range" // Raw Data Calculation "L Raw Data High Limit" "L Raw Data Low Limit" -RT "Raw Data Range" // Raw Data per Unit Calculation //"Raw Data Range" //"Engineering Range" /RT "Raw Data per unit" // Scaling Formula "Analog Input" ITDT "AI INT DINT" "L AI INT DINT" DTRT "AI DINT Real" "L AI DINT Real" "L Raw Data Low Limit" -RT "AI SUB" "L AI SUB" "Raw Data per unit" /RT "AI ADD" // Adding Results with Low Eng Unit "L AI ADD" "Low Engineering Limits" +RT "Output Scale"
It has been a while since I worked on S7, but in S5, the process is straightforward. Use the "Output Scale" function to load the actual level at 10.0 and the low level at the same time. If the level is greater than or equal to the low level threshold, the "Low Level" flag will be activated. Instead of reloading the level, consider using TAK to exchange values in the accumulators. Set the high level threshold at 100.0. While the syntax for comparing floats may differ between S5 and S7, it was G in S5 and likely R in S7.
In response to Toks89, the task at hand involves comparing the current level value with predetermined high and low level setpoints, and then activating a boolean tag to either start or stop the pump command. This entails writing logic code, for which I recommend using LAD or FBD instead of STL. Programming in LAD or FBD is not only easier but also simpler to troubleshoot. It's worth noting that while STL is still available in S7-1500 for compatibility reasons, it is considered a deprecated language in the realm of S7 programming. Regardless of the PLC model you are using, opting for LAD or FBD for general logic coding is advised for improved efficiency and ease of maintenance.
JesperMP highlighted the diminishing relevance of STL in the context of learning S7 programming. This observation certainly resonates with those in the field. While Latin may have its place for some, it's not the foundation on which beginners should build their programming knowledge.
Hi there, welcome to the Siemens community! STL can indeed be a bit challenging when you initially get into it. I think what you might be missing here is the comparator functions. While your scaling block has done its job to get your float values, now you need to create a comparison to your setpoints to generate a true or false. Something like if your "Output Scale" value is lower than the predefined low limit or higher than the high limit, your boolean tag for "Pump Command" can be set either True (when within limits) or False (out of limits), controlling the motor start or stop. Use the STL comparator functions like "<" and ">", and BTI function to convert to boolean. Hope that sets you on the right track! Don't hesitate to ask if you have further questions.
Welcome to the Siemens community, glad to see you making progress with STL programming! To turn your real/float output to a boolean, you could add an extra step at the end of your current logic. After scaling, compare the 'Output Scale' with your defined setpoints using a Greater Than or Less Than block. If the output level is greater than your 'high set-point', the comparison will output a 'true', indicating that activation of the pump is necessary. Similarly, you can use less than condition for your 'low set-point', in which case 'true' would mean the pump needs to be turned off. So, the output of these comparison blocks can directly feed into your pump On/Off command. Happy programming!
✅ Work Order Management
✅ Asset Tracking
✅ Preventive Maintenance
✅ Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Answer: - To convert analog values to a boolean tag in STL programming, you need to compare the current level value with predefined low and high setpoints and then activate a boolean tag based on the comparison result. This process involves using conditional statements to determine whether to start or stop the pump command.
Answer: - Scaling a tank level sensor in Siemens STL programming involves comparing the current analog input values with the predefined engineering range limits and raw data limits. By applying the appropriate scaling formula and logic, you can convert the analog values to a format that can be used to control the pump motor.
Answer: - To implement a control logic in STL programming for activating the pump based on tank level readings, you need to compare the current tank level values with the low and high setpoints. Based on this comparison, you can set a boolean tag to either start or stop the pump command. This logic ensures that the pump operation is controlled effectively based on the sensor readings.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.