PRATYAHARA Joystick Potentiometer -D203B-R2 5K 2-Axis 2D Monitor Keyboard Ball Joyrode Controller for Photographic Film Tool visit to see usb list chrome://usb-internals/ needs experimental enabled in the browser chrome://flags see usb2.html for an example of reading from an esp32 outputting text The software model currently aims to simulate the tri-foiler travelling upright in a straight line. Ultimately it will be extended to simulate turning left and right. The software model code defines an object it calls a Vessel. A vessel has Mass Moment of Inertia Centre of Gravity 8 foil objects Two propellors. The main struts, the horizontal foil between the struts and the two wings comprise the forward foils. The rudder blade and the two wings either side at the bottom comprise the aft foils. The aft foils form a single assembly that can rotate independently relative to the body of the vessel. Each foil is defined with 4 corners in 3-dimensional space. A foil can be symmetric or asymmetric. The configuration function performs two actions. It rotates the rudder assembly relative to the body of the vessel and then rotates the whole vessel about the centre of gravity. A collection of functions calculates the forces generated by the motion of each foil as it moves through the water. The simulation works by repeatedly calculating the forces generated by the foils, the propellors and gravity applying them to the vessel for a small time to calculate new values for the following 5 properties. 1. The horizontal speed. 2. The vertical speed. 3. The speed of rotation in the XZ plane. 4. The pitch. 5. The height of the centre of gravity above the water line. A single set of these actions is called an iteration. At the end of each iteration some or all of the 5 properties will have changed. The vessel is reconfigured at the end of each iteration before the new forces are recalculated. Javascript model works by repeatedly appliying forces to a mass for small periods of time and observing the results An automatic (closed loop serveo system with proportional gain) was implemented to control the vessel and, as was expected, the system hunted. This is due to the the delay caused by the javascript calculations. It might be possible to eliminate the hunting by applying derivative and proportional gain in the feedback loop. We could minimise the delay by running the model in a separate process and using the existing HTML/javascript pages to display a picture every few milliseconds. The separate process would be written in C++. For more speed, much of the processing could be delegated the the graphics processor. For ultimate speed, the separate process could run on a separate, dedicated PC. The HTML/javascript page would read the current status of the model using HTTP - the delay involved in getting the picture will be inconsequential. Reducing the processing time of each iteration will not necessarily eliminate the hunting completely. Derivative and proportional gain calculations my still be required. ------------------------------------------ Vertical state when travelling in a straight line The feed back loop must maintain a fixed main foil depth At any given instant the vessel has horizontalSpeed verticalSpeed angularSpeed mainFoilDepth Assuming initial level flight (verticalSpeed: 0, angularSpeed: 0) a sequence of 3 changes will always be required. a. Change the rudder elevator angle to pull the stern up/down to decrease/increase the angle of attack of the main foil and start the vessel climbing. This will impart angular momentum to the vessel. b. At an appropriate time, change the rudder elevator angle to remove the angular momentum. c. Change change the rudder elevator angle to maintain level flight. To make the correction, the feedback loop must calculate the values of each change and for how long to apply each of them. In real life the problem is more complicated. The sensors on the trifoiler will yield horizontalSpeed verticalSpeed angularSpeed mainFoilDepth verticalSpeed and horizontal speed may or may not be zero. mainFoil depth may or may not be at the required set point. THE RUDDER ELEVATOR ACCELERATES/DECELERATES THE VESSEL ANGULAR VELOCITY although it does have a side effect of increasing/decreasing total lift. Question. Can we control the height of the vessel by controlling its angular velocity? First objective. Can we act to maintain zero angular speed. Observe the sensors. Detect pitch and compute angular speed and angular acceleration. The error is the angular speed. To reduce the speed to zero in one second, say, we need to apply We can compute the force at the rudder required to neutralise the angular acceleration. We can compute the force at the rudder to reduce the angular speed by a proportion. We can then compute the required change of elevator angle required. ----------------------------- I have had some success with controlling the angular speed of the vessel. However due to the nature of the environment (varying immersed depth) the ideal model quickly rises or falls outside the working limits. It is very difficult to choose an elevator value for a given rideHeight/knots/thrust triple that will result in level flight. This makes tuning of the 'omega pid' difficult. Rather than spending time on trying to extend the available test time I propose to work on the next phase which will allow the driver to request a small plus or minus value set point for controlled omega value. The driver will be ----------------------------------------------------------------------------------------------------------- Regarding the automatic ride height control. When the vessel is foiling, it is mainly supported by the main foil. Assuming the vessel is flying above or below the required ride height, the angle of attack of the main foil will need to be changed slightly to make a correction. Because the main foil is fixed to the vessel with no moving parts, this requires the whole vessel to be rotated slightly in the XZ plane (X forward, Y up). This can only be achieved by applying a change to the rudder elevator angle. The vessel has considerable moment of inertia so the rudder elevator has to do work to get the vessel rotating in the vertical plane. Unfortunately, when the desired main foil angle of attack has been achieved, the vessel will continue rotate because of it's inertia. A change to the elevator angle will need to be applied to reduce reduce the rate of rotation to zero. In the meantime, the angle of attack will continue to change, so, somehow, the second change will need to be calculated and applied before the desired new angle of attack is reached. For this reason, a PID controller, taking as input the ride height (or the immersion depth of the main foil), is unlikely to work successfully. The hypothesis was advanced that it should be possible to control the rate of fore/aft rotation with a PID controller. This was tested using the software model. Results were encouraging. Given initial starting parameters that resulted in a direction of travel parallel to the surface of the water, the PID controller was able to maintain an angular velocity of zero. Applying a forced momentary change in elevator angle caused a fixed rate of climb (or descent) which was then maintained until the vessel climbed out of the water or the hull contacted the surv=face. This needs to be investigated further but it seems feasible that a second PID controller could maintain a constant ride height by automatically adjusting the set-point of the first PID controller. ---------------------------------------------------------------------------- 3D model Works differently. Model is moving through space. Model is rotating in space. Model has its own x-axis the centre line of the vessel, its own z-axis (up when the vessel is floating level) and its own y-axis (beam to beam). Positive x is forward. Positive y is port. Positive z is up when the vessel is floating level. All 3 vessel axes pass through the vessel centre of gravity. Every iteration (millisecond), the status of each foil is calculated. Positions in space of corners and centre of pressure. Position in space of each motor centre of effort. Force (vector) of each foil and each motor. The previous status is remembered and used to calculate the velocity of the centre of pressure of each foil. The force (vector) generated by each foil consists of lift and drag forces which are computed using formulas provided by the client. The direction of lift forces are assumed to be perpendicular to velocity of the foil centre of pressure and in a plane that contains the velocity vector and a vector that is normal to the plane of the foil. Drag forces are assumed to be in a direction opposite to the velocity of the centre of pressure of the foil. The acceleration of the centre of gravity is calculated by summing all the force vectors. This allows the new vessel velocity and position of the centre of gravity to be calculated. The lift and drag force vectors of each foil and motor are summed to calculate a single force vector. This force vector is resolve into 3 vectors parallel to the vessel x, y and z axes. For each foil and motor the moments about the 3 vessel axes is calculated. The 3 angular accelerations (about x, axis, y axis and z-axis) of the vessel are calculated. Subsequently the 3 new angular speeds can be calculated and then the new heading, pitch and roll can be calculated. The new yaw angle is calculated as the difference between the heading and the x value of the velocity of the centre of gravity.