Drilling Modeling and Simulation
Real-time analysis of drillstring dynamics data is necessary to optimize surface drilling parameters and reduce vibration-related problems. However, there are complications in accessing the high frequency downhole data generated by the telemetry systems. It is also a challenge to derive the drillstring model due to the complexity of the vibration modes.
Watch a demonstration of the drillstring and bottom hole assembly (BHA) formulated in Simscape™ and Simulink®. You will see models of (a) the torsional and stick-slip dynamics of the drillstring system associated with the top drive and (b) the swirling motions and stick-slip dynamics of the BHA. The modeling is greatly simplified and accelerated because of multiple prebuilt blocks in Simscape libraries such as Flexible Beam and Spatial Contact Force.
Once a physics-based drilling model has been obtained, you can see it used to excite torsional vibrations and you can study the responses. This model forms the foundation for future workflows for creating digital twins and developing control strategies or predictive maintenance studies.
Published: 27 Oct 2020
Hello. My name is Inho Kim. I'm an application engineer at MathWorks. Today we will talking about modeling drilling systems with Simulink, by going through multiple demos that I built under the Simulink in the Simscape environment.
Before I joined MathWorks, I worked in Halliburton three years. Half was in the corporate innovation team, and half was sperry drilling. Most my job spending over there was building the physics-based model for control systems design.
So the demos that I will show you-- these are all what I actually spent time on for three years. And there are very difficult times to build a lot of custom codes, but I realized that when I moved to MathWorks, I found many are useful tools that I could use to save hundreds of hours and a lot of moneys over there. So I want to share my experience with you in this talk.
So as you can see, the tool we're using is-- the foundation is MATLAB and Simulink. And Simscape is under this foundation, and there are multiple toolboxes. And today we'll probably more focusing on the multibody, but I will give you some resources at the end of this talk. OK?
So this is agenda for today. We'll start with a drillstring example. Then we'll talk about physics-based modeling in MathWorks Toolchains, why we are modeling this, and then how we can use those models. Then I will do a little bit of demo about how to import existing CAD models into Simulink. Then we will talk about some interesting blocks that we can use in Simscape Multibody. And using those blocks, I made another demo with a bottom hole assembly vibration example. Then we will talk about how to update the physics-based model to the digital twin, which representing the real systems for a better use. Then we'll wrap up this talk with some resources we can reach. OK?
So let's move to MATLAB. So I'm using a project. You may don't know what is this. This called MATLAB project. It can be called a Simulink project. It contains all those files that you need for doing certain projects. So you can see, there are different types of files, like STEP files. These are the designs and M files, and getting information of those models. And then, the slx file, this is Simulink file.
So basically, when I just open up the project, it will run these parameters that it requires to run the simulation. Because in the workspace, there are parameters already loaded. I just click this, or put up the model. And this side, you can see the model, and then some dials and indicators. And that's just a start, and then see what we can see. Right now, I'm running 150 seconds of simulation by clicking one button. It will open up the mechanics explorer to show the animations.
So what you're seeing over here in the top left, this is the bottom hole assembly, and the drill bit side. And then this is the top drive side. And this is the bottom view of the BHA. And then this is top view of the top drive. So you can see, there's something happening. This B side is rotating and then stop, and rotating and stop. And then the top drive is consistently rotating at the same RPM. This called, in the drilling industry, stick-slip behavior. Although these pipes are like 7 inches OD, it's steel pipes. But when the length of this entire system is longer and longer, you can imagine this is kind of like a wire. So whenever the force or torque-- demanding torque-- is increasing very far away from the power source, then you can see the twisting effect of entire structure when it increase the elastic energy, and then release it. That's why, you can see over here in this measurement, the top drive speed is constant, but the instrument RPM is actually fluctuate-- stop, and then it actually three times. Then top drive speed, and they come down and stop. This is one of the serious dynamics where drilling industry wants to solve. OK?
So let's go through a little bit about this model. And you can see there are subsystems, and then the special blocks. You can see, these black lines are Simulink. And then this grayish line is Simscape Multibody domain. Let's go into the top drive. There are two subsystems. I just commented out. Right now, I'm using simplified version of top drive, so that it's just accepting the RPM, there's the rate limiter, and then we integrate it to give the motion into the desirable joint, to rotate [AUDIO OUT] drive side.
Or we can actually do this more sophisticated model the AC drive. You can see different colors of lines. This is electrical-- Simscape electrical-- and then this green line is Simscape mechanical. And there's a couple between those two domains with this PMSM drive. This is a more sophisticated way of designing this. You can imagine that any subsystem can be expended with different domains.
And over here, I'm showing you, this is all of Simulink-based calculations that you're presenting stick-slip behavior. And there are regions we need to consider doing the dynamics-- there's static, and then there's transition, and then kinetic. So it can see, this switch is changing the situation. And then also, there are signs over there.
So basically, what this calculation is doing is finding out the friction based on this situation. And then it multiplies the normal force. So weight on bit, over here, is the normal force acting on the pit side. And also I'm adding, over here, some information using the Signal editor, which is actually in the next version of Signal Builder. Using this tool, you can simply make some signals by just adding points. And then it can run. You can make multiple different scenarios.
So I'm just adding up the control value-- weight on bit control value-- and some scenarios, and then multiply that normal force to the friction that goes into the torque demand. That's where the stick-slip happening. So you can imagine, there is too much normal force than stick-slip happening. And then entire system will be fluctuating like this.
Let me rerun this simulation, and then see what we can do with this controller. So, to real time, you can actually change this simulation. So where stick-slip start-- In the field, drillers just do like 10% increased speed, and then see whether they can get out of the stick-slip. If that doesn't work, then they do 10% more. And still doesn't work, then they decrease the weight on bit to get out of this region.
So as you can see, this is very unscientific way of getting out of this kind of dynamics. By using the simulator, we can actually try to learn what's the behavior, and then get some better strategy. And then, once we confirm this model is actually reflecting the real system, we can build the controller using this plan model. That's the whole idea.
Let's go back to slides and talk about-- a little bit about physics-based modeling. So MathWorks Toolchains-- You can build a physics-based model with different ways. So symbolic equation way, and then a script or function-based using the partial differential equation toolboxes. This is where I used to spend my time on.
And there are different ways. It's Simulink. You already saw that stick-slip behavior can be calculated with Simulink blocks, or you can just drop it in Simscape blocks, which actually representing the real systems. You don't have to build from scratch about, like, partial differentiation equation, or any logic.
So where we can use these models? First, we can do-- Once we make this physics-based modeling, we can confirm, or verification, or validation of each component, and then connect them together and see whether we can run this system in the design phase. Or, using this plan model, we can do the control system design using traditional control systems design toolboxes, or reinforcement learning. These days, a lot of pipe goes in over there. Reinforcement learning requires robust plan model, which can be built in the Simulink and Simscape. Or we can do the predictive maintenance-- exploring some other domains where we can change some components to see what kind of data we can get out of, and then do the classification of damage. Or further, we can use this model to estimate the remaining useful life, using RUL calculations.
So a lot of our cases, we have some systems designed already. Or the systems that we are trying to integrate with our new systems, there are already existing as produced by different vendors. And for example, if you think about the rig system, not only single company can build entire system. There are multiple vendors-- multiple companies are collaborate together that make this entire system. So if you want to test it out your own system, you cannot rely on only the field data set. You want to know about how the physics scores will affect on your system. So in that case, you can bring some CAD model, and then bring those into the Simulink environment.
So let me show you some example. So this is SOLIDWORKS model. I don't have drilling industry-specific ones that I could build. But I just bring this four-cylinder model. So you can see, there is some degree of freedom. There are components, or parts. And then those are defined as what's called mates. And you can see, this lower block was fixed-- with this F, indicate that this is fixed for global coordinate system. And then everything else are on top of that. This has a relationship between those two parts.
So we offer some plugins-- free softwares you can use. This is MATLAB Documentation. You see over here, we have the plugins for the Autodesk Inventor, Claro, Parametric, and then SOLIDWORKS. So we have the link for that plug-ins. Once you install these plugins, you can find out the Simscape Multibody link under the tools, especially in the SOLIDWORKS.
So once we just export that-- I already did it. Just let me just do it again. What it will do is it will go to each individual part, and then build a STEP file. And then also, it will generate the xml file, which contains all those information between parts. And that xml file is what we will use in the MATLAB, and bring the model into the Simulink environment.
Let's wait a little bit, and then be done. We can go over here.
OK. There are a couple of constraints is not support-- this the difference between the definition of mates and the Simulink. So a couple of, like, offset designs-- those are not really or some joint element in the Simulink. So those can be automatically ignored.
So the function that we will use is smimport. And we have this xml file over here. [AUDIO OUT] --just run it, or bring all those subsystems, the parts, and then automatically connect them together. So basically, this is the equivalent system with the SOLIDWORKS model. So if I just run-- hit button right now, I don't have any actuator, or whatever.
But just changing a few points, and then here. So Simulink environment is not for this kind of detailed designs, but we are doing this simulation, and make the simulation environment. The reason why this crankshaft is moving like this is because we already set it up-- this entire environment-- with the gravity. So if we look into this mechanism configuration, you can see that gravity is y direction negative. So over here-- the coordinate system-- the y positive is up, and then gravity is acting downward. That's why this crankshaft is moving due to the gravity.
Let's add a very simple actuator in this cylinder. This cylinder is called three, which you can find out by clicking over here-- this cylinder. And then we want to see whether, if we add some force in the Simulink, what's happening over here. Just Actuation, we put Provide Input, and then we just try to make the motion, or make it calculated. Then it will open up some port-- this is a physical signal port. So when we try to put some signal in, we need to have some convergence between Simulink and then physical signal. This, and then-- because this is cylinder four, so let's define as our sine wave.
And then amplitude one is too small-- maybe 10. And then let's make it some realistic value for here. If you run the system, now it's moving, but it's not high correct force or the frequency. So you get some idea over here already that design of experiment can be happening by just changing these two parameters. So we can find out what kind of values for the force and the frequency requires to run this simulation correctly.
This is a pretty cool tool, so that you don't have to build an entire system from scratch. You can imagine like how many cylindrical joints over here, or the prismatic joints-- If you want to build everything, it will take a lot of time. But as you can see, all those STEP files are imported from the file generating the SOLIDWORKS, so you can just use it directly.
Close this. So, new slides.
So there are a couple of interesting Simscape Multibody blocks which I want to introduce. One was the flexible beam element, and another one is the special contact force. So as you-- maybe you remember that the stick-slip drillstring example, I use this general flexible beam. Let me just go back. So I use the block over here we used to-- When we tried to build this kind of flexible dynamics, so we had to use rigid body slow element, and then do the lump mass modeling. But over here, this single block is actually helping us to build the entire system. Right now, what you are seeing over here is 914 meters, which is the equivalent with 3,000 feet. You can just build one single block to representing this long system. Stiffness and inertia you can just define over here, as you can see. Density and the Young's modulus is representing a steel structure. And then you can just update it. You can get all those calculated values for rigidity or the momentum. It does show automatically.
If you want to see better estimation of this bending or torsional element, you can actually increase the number of elements. Right now I have 10. Obviously if you increase this element, then the simulation time will be a little bit slower, because we need to calculate more calculations. But nonetheless, it's really easier than if you can imagine that you build the entire system with lumps mass model, and huge size of sparse matrix for stiffness, and damping, and mass.
Another one that I want to show you is a new block over here. This is really interesting block. So the penetration is kind of issue for building this kind of dynamics. As you can see, this block actually-- We can just define the normal force for the stiffness and the damping. This block is actually using the simple force equation, so that when the penetration happening, they proportionally increase the stiffness, and then make the repel force to get out of those kind of collusion reasons.
And also there is a friction force you can define between those two elements. The one that I show you in the drillstring example-- the stick-slip friction can be actually changed with this single block. This one is actually opening up a huge opportunity for us to study about what's happening in the down hole. Usually, we don't know what's happening. And because of our telemetry system is very, very low frequency, it is just imagination what's happening. But if we can build any model to representing those kind of physics, we can see what's happening.
Over here. This is another model that can simulate the BHA vibration. So you can see, there are multiple subsystems, these representing each individual strings. So we have a BHA, and then there are like five more pipes over there. And inside over there, we have contact force blocks between the pipe versus the drill on the oil well. And let me just run it. It's much easier to then call up the parameters.
To explain what this model do-- Again, it opens up the mechanics explorer, and showing that-- So this drill pipe is-- how I design it is-- the BHA part is a little bit thicker. And then the pipe side is thinner, because the drilling well is always the same, following the OD of the drill bit. So BHA usually has narrow gap, and then the pipe has a larger gap. And when the stick-slip happening, now you can see, there is very irregular vibration happening. So when we don't have any stick-slip, this kind of vibration will never happen. But because of stick-slip, we have this vibration can destroy actually entire multi-million dollars of bottom hole assembly components.
I didn't stop over here, actually. I added some components within the BHA. So the rectangular-- or cubic-- element is actually representing the IMU, the initial measurement unit, in the BHA. I placed two IMUs, one near the thicker pipe, and then another one is a thinner pipe. And then we can measure the dynamics by using this three axis inertial measurement unit block in the aerospace blocks that we can use. So we can just bring those information in. That actually results this signal.
So what you're seeing over here-- left hand side-- is just rotation. And then the middle one is the exhalation. And then the right one is the angular velocity. So basically, what this means is you can actually regenerate what the sensors in the down hole can see. Using this information, we will learn about what's happening really in the down hole. And if we understand the dynamics of down hole systems, we can build the control system to get out of this kind of vibration situations.
Then finally, we have parameter estimation. So usually when we try to build the physics-based model, we just use the parameters with some specific data, and this doesn't really reflecting your system. Let me just open up another example over here. Because we don't have any real data set for the drilling equipment, so we just use the motor drive example.
So what you're seeing over here has-- state of this plot. So you see over here, you have the controlled voltage source, and an H bridge, and then the DC motor. And the DC motor-- When you try to make this physics-based model, you don't know exact parameters for, for example, armature resistance or inductance, or the back EMF constant, or a mechanical component, like the inertial damping. So what we can do is you can use the parameter estimation tool to make it estimate the real value. So if I just run one time with the default values-- As you can see, this is input signal, this is the motor output shaft velocity. You can see the yellow line is the simulated theta, and then [AUDIO OUT] is collected from the field. So there is a lot of discrepancy between those two.
And this parameter estimation tool can help to optimize the values of the parameters. I can hit the wrong button. That takes a little bit of time. So I just made this video. So let's go through this one. So basically, the same example and same parameter estimation program-- it's actually doing the iteration for the optimization problem to solve this error-- try to minimize the error between simulation and the field data. So as you can see, it's already converged over here, getting smaller error. [AUDIO OUT] Give a couple more seconds.
And then eventually, when the error goes under the threshold, we set it up that will stop the optimization. And then can find out what those parameters. The value will normally stored in the workspace. Right now, I didn't run the parameter estimation tool, so it's default values. But it will change once you're doing the parameter estimation.
So we went through on multiple examples today. It was very quick. There are lots of more talk we can do for each individual demo. But because of time limit, we need to stop over here. But Simscape is not only limited to some electrical or mechanical or multibody. There are other domains, like thermal liquid, or two phase fluid, or hydraulics, or even electromagnetics.
We have many shipping examples. You can find out in the MATLAB Documentations. If you really want to learn about how to use the Simulink and Simscape to build some physics-based models for a bigger project, we offer training courses. And then even, if you have a very short time to finish up your project, we have consulting service.