pcdshub / lcls-twincat-optics

TwinCAT 3 Motion Control for LCLS Optics
https://pcdshub.github.io/lcls-twincat-optics/
Other
0 stars 6 forks source link

Piezo Tuning #7

Open jsheppard95 opened 4 years ago

jsheppard95 commented 4 years ago

Pitch moves seem to meet requirements, but sometimes take ~10 s even for small adjustments. Need to work on tuning to reduce this. Need a better understanding of the control mechanism/system state.

Using built in Beckhoff PI control loop in FB_PiezoControl.ACT_Controller : FB_CTRL_PI

mseaberg commented 4 years ago

I think it would be worth trying out FB_CTRL_PID. Looks like probably the only modification you would need to make is add a couple more parameters to stPIParams in ST_PiezoAxis. Should be equivalent to PI loop operation if tTv is set to zero.

jsheppard95 commented 4 years ago

Yes its definitely worth trying. We're not entirely sure what the consequences of this are given that we have this inner PI loop which I would guess is a lot more Voltage-centric. I.e the error is likely defined as e_inner(t) = Vset - Vact, but then Vset is tied to the output of a outer PI loop who's error e_outer = PitchSetPos - PitchActPos, so its hard to develop a quantitative way of determining the gain parameters.

But maybe I'm thinking about it too hard and we should just take a more qualitative approach, i.e just add the Tv term and see what happens.

Regardless, I don't think we can try this now given that we were told to not update FEE deployed code/control things remotely. But its definitely worth trying once we regain access.

mseaberg commented 4 years ago

My guess is that you can ignore the inner PI loop because it probably reaches the setpoint and stabilizes very quickly. Regarding controlling things remotely, there's some chance this policy will change and mirror pitch tuning is something valuable that could take advantage of this.

In terms of better understanding, once we can move things again we can take some data and try to analyze the control loop. From the PID settings we should be able to understand the transfer function of the controller, and combined with the measurement we should be able to understand the transfer function of the mirror pitch itself. I've done some of this a few years ago and should be able to refresh my memory.

jsheppard95 commented 4 years ago

That sounds great, I would definitely appreciate working through this with you as I have not done this before and these seem like valuable skills. I'll discuss controlling this remotely with my group to see when we could get an opportunity to do so, and then we can discuss more details about this measurement. I imagine we would want to drive the system in open loop to characterize its natural response for a given setpoint position, i.e its natural step response? Or maybe just with the proportional term?

mseaberg commented 4 years ago

Ok, sounds good. Making measurements in both open loop and closed loop will definitely give more information.

jsheppard95 commented 4 years ago

I discussed the prospect of doing remote work on the pitch mechanism with Alex today, and he did agree the piezo element is low enough of risk to do some controller work without direct FEE access, but I'm wondering if its necessary to start this while we are still off site. I'm mostly nervous about moving motors off site because I've never done that before, and my gut reaction is that's not the best idea. That being said, waiting until we're back on site would still only mean we're acquiring data from the XPP control room, which I suppose is not that different from doing so from home. What are your thoughts on this?

Regardless, I should add that I'm currently taking an online course in control theory (i.e designing controllers through system/stability analysis), but I'm just now in Week 3/7. While I'm sure this course will not cover everything, I do think I'll be in better shape to help if we wait until I get a little farther, which may be good enough reason to wait until we are back on site.

I'm open to other thoughts/plans, and maybe we should also discuss with the mechanical folks?

mseaberg commented 4 years ago

I think as long as all the relevant people are aware and in agreement (in this case I would say Bill, Alex, May Ling, and Corey), I don't see an issue with moving motors off site. Let's put the topic on the xtes-homs Slack channel, and send the link as an email to the relevant people to make sure they all see it. While it's not urgent, I figured if we're able to get the tuning done now it would be helpful since things are going to get a bit hectic after we turn the beam back on.

That's great you're taking the course! I guess I would say with that in mind it would be best not to spend many hours on tuning now, but that it wouldn't hurt to record some data and try a few things.