-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding deltas to ATMs #72
Conversation
@@ -10,7 +10,7 @@ | |||
<TargetSelect TargetId="2">{66689887-CCBD-452C-AC9A-039D997C6E66}</TargetSelect> | |||
<TargetSelect TargetId="2">{3EBB9639-5FF3-42B6-8847-35C70DC013C8}</TargetSelect> | |||
<TargetSelect TargetId="2">{520DE751-9DB6-47CB-8240-BD5C466E7E64}</TargetSelect> | |||
<LicenseDevice DongleHardwareId="2" DongleDevice="#x03020002" DongleLevel="50" DongleSystemId="{CBBB2953-6251-050D-F24B-D23248A8B21C}"/> | |||
<LicenseDevice DongleHardwareId="2" DongleDevice="#x03020002" DongleLevel="90"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did something strange happen to your license config?
The level changed the system id vanished
fbStateSetup(stPositionState:=fbTM1K2.stOut, fPosition:=-16.00, fDelta:=10, sPmpsState:='TM1K2:ATM-OUT'); | ||
fbStateSetup(stPositionState:=fbTM1K2.stTarget1, fPosition:=-39.124, fDelta:=10, sPmpsState:='TM1K2:ATM-TARGET1'); | ||
fbStateSetup(stPositionState:=fbTM1K2.stTarget2, fPosition:=-53.5, fDelta:=10, sPmpsState:='TM1K2:ATM-TARGET2'); | ||
fbStateSetup(stPositionState:=fbTM1K2.stTarget3, fPosition:=-67.874, fDelta:=10, sPmpsState:='TM1K2:ATM-TARGET3'); | ||
fbStateSetup(stPositionState:=fbTM1K2.stTarget4, fPosition:=-82.25, fDelta:=10, sPmpsState:='TM1K2:ATM-TARGET4'); | ||
fbStateSetup(stPositionState:=fbTM1K2.stTarget5, fPosition:=-96.623, fDelta:=10, sPmpsState:='TM1K2:ATM-TARGET5'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is implemented correctly.
All of the ranges overlap here. It doesn't necessarily need to be fixed, the scientists might prefer this. It should be documented.
I ordered them in reverse because it made the overlaps easier for me to spot.
t5: (-106.623, -86.623)
t4: (-92.125, -72.25)
t3: (-77.874, -57.874)
t2: (-63.5, -43.5)
t1: (-49.124, -29.124)
out: (-26, -6)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know about the overlap. How do you think it will react in terms of faults in case of overlap between states ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the code will "pick one state" in the overlap region.
I do not know how the faults will react, maybe nothing bad will happen at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe!? I will actually try to fix it and try to avoid overlaps by tuning delta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll approve now and I'll approve again if you decide to tune the deltas
fbStateSetup(stPositionState:=fbTM2K2.stOut, fPosition:=5.3, fDelta:=5, sPmpsState:='TM2K2:ATM-OUT'); | ||
fbStateSetup(stPositionState:=fbTM2K2.stTarget1, fPosition:=-15.5, fDelta:=10, sPmpsState:='TM2K2:ATM-TARGET1'); | ||
fbStateSetup(stPositionState:=fbTM2K2.stTarget2, fPosition:=-36.5, fDelta:=10, sPmpsState:='TM2K2:ATM-TARGET2'); | ||
fbStateSetup(stPositionState:=fbTM2K2.stTarget3, fPosition:=-52.0, fDelta:=7, sPmpsState:='TM2K2:ATM-TARGET3'); | ||
fbStateSetup(stPositionState:=fbTM2K2.stTarget4, fPosition:=-60.5, fDelta:=10, sPmpsState:='TM2K2:ATM-TARGET4'); | ||
fbStateSetup(stPositionState:=fbTM2K2.stTarget5, fPosition:=-77.0, fDelta:=10, sPmpsState:='TM2K2:ATM-TARGET5'); | ||
fbStateSetup(stPositionState:=fbTM2K2.stTarget6, fPosition:=-96.6, fDelta:=10, sPmpsState:='TM2K2:ATM-TARGET6'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented correctly again, some overlaps again
t6: (-106.6, -86.6)
t5: (-87.0, -67.0)
t4: (-70.5, -50.5)
t3: (-59.0, -45.0)
t2: (-46.5, -26.5)
t1: (-25.5, -5.5)
out: (0.3, 10.3)
Do you need help resolving the tmc merge conflict? |
@ZLLentz yes please if you have time, can you please help resolve the conflicts and merge the PR ? Thank you!! |
Ok I will try to push a merge resolution commit to your branch |
Today I learned that VSCode has a really useful git merge conflict resolution editor |
Thanks @ZLLentz I would like to know about this VSCode merge conflict tool as well :) |
Link to docs: https://code.visualstudio.com/docs/sourcecontrol/overview#_3way-merge-editor There's probably a way to do this all in VSCode but here's what I did instead:
|
Something wrong with this 'merge' or code, PLC is crashing when I deploy master... |
This PR's effective diff is just setting the |
Could it due to ppm updates @KaushikMalapati ? Both these PRs are being deployed together. I had tested my PR on PLC and it was fine. @KaushikMalapati did you test you code on PLC ? |
I'm able to run my branch (before 'master' merge from Zach which had new changes from Kaushik) fine on the PLC. [(https://github.com/jyotiphy/lcls-plc-kfe-rix-motion/commit/1a1944cdad28d93d34c58a0118c808aebeeb74bf)] |
I didn't test the if defined and updated IM4K2 function blocks, I only checked that it built without error. I could try running https://github.com/KaushikMalapati/lcls-plc-kfe-rix-motion/tree/responsive and see if it crashes @jyotiphy. If it does, it would mean the ppm code is the problem. If not then it might be something to do with the merge |
@KaushikMalapati okay, go ahead test it on PLC and let me know how it goes. I just tested my branch and it seems to be working fine. |
Oh page fault... that's why PLC is crashing. Check your code and any calculations. Divide by 0 error anywhere ? |
I think it's the mod calculations like at https://github.com/pcdshub/lcls-twincat-common-components/blob/696a827d7f7836cf073dc747b06876632e4c9ae2/lcls-twincat-common-components/Library/Devices/PPM/FB_PPM_PowerMeter.TcPOU#L236. Since the array is one-indexed, whenever udBackgroundVoltageBufferIndex is a multiple of one hundred it tries to index into the array at zero, causing a page fault. This would explain why it takes some time for the crash to happen since udBackgroundVoltageBufferIndex is incremented once a second. I think a solution would be to index into the array like this |
I agree with that adjustment, sorry for missing that on review (I guess my brain is used to always-0-indexed arrays from other languages) |
@ZLLentz I was testing the "delta" implementation last night and it seems like after setpoint, motor is moving only about 2mm, both directions (and not what I had defined on the code). Is there any default set somewhere for Delta which is not being overwritten with this implementation or I'm missing something here ? I think, currently PLC is running Kaushik's branch, so Delta update is not on PLC. Once Kauhsik's PR is finalized, merged and deployed, maybe you can give it a quick try as well and see if you can re-produce this issue ? |
Maybe you're getting trolled by autosave... let me check |
Description
Adding delta for TM1K2 and TM2K2 states setpoints.
Motivation and Context
More targets are added to the ATMs and scientists need more flexibility to move through states during commissioning experiments.
How Has This Been Tested?
Didn't test yet
Where Has This Been Documented?
Nope
Screenshots (if appropriate):
Pre-merge checklist
Always Newest
pre-commit
(alternativelypre-commit run --all-files
)