zaky Posted November 8 Posted November 8 Hi All I am working on PTP metrics for our production facilities. see the formula i am working on Condition Pre created : //$po = 'Plant output' //$p2 = 'Planning' $ps = $po == 0 and $p2==0 Formula $a = $p2.setUnits(' ') $b = $po.setUnits(' ') $PTP_100 = 100.toSignal() $PTP_Calc = abs(100 - ((abs($a - $b) / $a) * 100)) $PTP = $PTP_Calc.splice($PTP_100, $ps) $PTP.setUnits('%') it worked just find. I get 0% if my production is 0. but I want to get 0% as well if my plan is 0, but my production output >0 (Producing) I tried multiple method but it doesn't work. need help
Solution Thorsten Vogt Posted November 8 Solution Posted November 8 Hello zaky, did you try $PTP = $PTP_Calc.splice(0.toSignal(), $a == 0).splice($PTP_100, $ps) That should insert 0 when your plan is 0 and 100 when plan and production equal 0. Regards, Thorsten
zaky Posted November 21 Author Posted November 21 it worked! thanks but i found something odd. if the plan was only 10 for example. but the actual production output is 60 example. it will ready >400%. which is matermatically correct, but not applicable on operation report. ideally, this was suppose to be 0% if it's exceed 100%. tried to add the splice but it's error. and I couldn't figure out the matemathical algoritm. can you help? this is the current formula $a = $p2.setUnits(' ') $b = $po.setUnits(' ') $PTP_100 = 100.toSignal() $PTP_Calc = abs(100 - ((abs($a - $b) / $a) * 100)) $PTP = $PTP_Calc.splice(0.toSignal(), $a == 0).splice($PTP_100, $ps) $PTP.setUnits('%')
Thorsten Vogt Posted November 22 Posted November 22 Hi zaky, I guess you could change to $PTP = $PTP_Calc.splice(0.toSignal(), $a == 0 or $PTP_Calc > 100).splice($PTP_100, $ps) This should insert 0 when your plan is 0 or $PTP_Calc is greater than 100 and insert 100 when plan and production equal 0. Regards, Thorsten
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now