Monthly Archive for August, 2009

XNAV system

I’ve been working on XNAV system – on-board computer display software for X-30, capable of doing a lot of interesting things. Right now it can calculate and predict orbit, it shows all required orbital elements, updating live from the simulator.

IMG_0027a

There are some issues right now, the orbit prediction is slightly imprecise because of the way I am calculating velocity vector (I am calculating spacecraft position in global coordinate system, tied to Earth. Velocity vector is normalized difference between current and previous position multiplied by velocity magnitude, speed received from simulator). I will rewrite this to use coordinates and velocities from local OpenGL coordinate system of X-Plane, rotated so it becomes global coordinate system.

There is also slight change of some variables over time – most likely because constants I used slightly differ from the ones X-Plane uses.

X-30 hydraulics

I’ve misinterpreted how hydraulic system would work, it actually works entirelly differently than I expected, so the simulation is different. I slightly updated scheme too, thanks to my friend Wraith for helping me with the hydraulics.

hydraulic_system

The elevons are now connected to hydraulic system, tomorrow I’m gonna finish same for rudder and nose gear. And add some pressure relief valves, and slightly improve pump simulation.

X-30 Venture hydraulic scheme

I completed hydraulic system scheme – I will start writing simulation tomorrow. It is driven by two electric pumps. Flight control surfaces use double-way valves – if you want elevon to go up, you input pressure to servo that rotates it up, if you want it to go down you input pressure to servo that rotates it down. The scheme can be found here (check out next post for more details)

The system itself will be simulated using same Ohm laws as for electric circuit, except voltage becomes pressure, current becomes flow, and resistance remains to be just resistance.

X-30 Venture electric system, again

Okay, simulating AC and DC circuits together was slightly more complex, for some reason I ignored the fact that inverters actually change voltage, and amperes in AC are not same in DC (due to inverter). This does not influece tests with loads conducted before (I used actual load on power source), but I am now using different equations.

I will try to describe how me and my dad received final equations for the entire scheme, including inverter, AC contour, and DC contour.

First, the scheme can be simplified into a simplier scheme – all parallel loads can be computed as one load. The resulting scheme looks like kinda like this:
1

U1 is voltage drop on nodes in DC circuit, I1 is current through DC part of circuit (the electric buses DC1 and DC2), I2 is current through inverters 1 and 2 – and essentially this is current that is flowing through AC contour. But for now we just assume that it flows through some load. Itotal = I1 + I2
R1 is resistance of DC contour, Rвн is internal power source resistance, R3 is resistance of AC contour.
W~ (also written as W3) is power of AC circuit – in watts.
E is voltage of our power source, electromotive force.

These is DC contour we have now (with AC part simplified to just some load):
sm1

We can immidiately write these equations: I1 = U1 / R1, I2 = U1 / Rвн (simple ohm laws). Also we can write equation for U1: U1 = E – Itotal * Rвн, which same as U1 = E – I1 * Rвн – I2 * Rвн.
Now we want to find out voltage drop on AC current, and we want to determine DC current flowing through invertor, and then AC circuit (well two of them). First of all, power on both sides is equal (duh): W1 = W~ (where W1 = U1 * I2), which is same as U1 * I2 = W~, and that means that I2 = W~ / U1. Hey, that’s neat!

Okay, now lets put that in our equation: U1 = E – I1 * Rвн – Rвн * W~ / U1 (look at picture below for these equations written in better form).
2

Putting some other equations stated earlier into this equation gives us U1 = E – Rвн * U1 / R1 – Rвн * W~ / U1. Wait, but we know E (a constant), Rвн (a constant), R1 can be determined (it’s one of parameters input – R1 = (28^2) / Wdc, where Wdc is power in watts consumed by entire DC contour), W~ is also known (power that all AC devices consume). Let’s just multiply the equation by U1, and receive quadratic equation:

(1 + Rвн / R1)*(U1^2) – E * U1 + W~ * Rвн = 0. One of solutions that make sense for us is: U1 = (E + Sqrt(E^2 – 4 * W~ * Rвн * (1 + Rвн / R1))) / 2. That is the solution! Basically by knowing U1 we can find out all other things.

We can find out current that is flowing through AC circuit using equation: W~ = I * Eac, where Eac = U1 * (115/28) is electromotive force for AC circuit, if you look at the circuit separately from DC part (invertor becomes AC power source):
3

This is the AC contour we have now (you could see it on previous picture though):
sm2

This method does not account for any power losses inside invertors themselves – that would require simulating invertor insides, which can be neglected because of high loads. By the way, fun thing – I accidently turned on hydraulic pumps with wrong motor load, it added up to 14kW load. It resulted in voltage dropping to about 25 volts, with noticable dimming of electric instruments! The electric current flowing through power source was 510 amperes!

Right now hydraulic pumps are 3kW each, which results in [111.9V, 8.7A] AC load, [27.2V, 75.9A] DC load, and that is correct. It is a lot, but not too much.

I added new panel on the left side of cockpit (you have to rotate your view to see it), it allows you to turn certain electric buses on and off:
panelf1_6

By the way, there are some more remaining equations, you can see them in the final code implementation.
Continue reading ‘X-30 Venture electric system, again’

X-30 Venture new textures

I fixed electric system for X-30 Venture! Now it’s more correct, and guess what? It actually closely matches Space Shuttle electric systems parameters (in terms of voltage and current). You can read about it in detail here.

In few words: X-30 Venture under 2kW load gets [31.6V, 93.0A], Space Shuttle gets [32.5V, 61.5A]. X-30 Venture under 14kW load gets [27.5V, 501A], Orbiter gets [27.5V, 436A]. Doesn’t seem that close? Think again, I’m only simulating DC nodes. AC nodes are actually different – 14kW here would give you slightly higher resistance than 14kW of DC current. It is higher by square root of two.

But I completed AC circuits simulation (by the way, the bug in electric system was that I slightly improperly treated electric scheme), but I still have to attach all AC electric buses to power source. After that I will fix hydraulic pumps, and hydraulic system simulation.

It is funny and curious that hydraulic system (the actual pipes and hydraulic liquid flow) can be simulated using Ohm’s laws for DC currents. Current here becomes liquid flow, voltage (difference of potentials) becomes difference of pressures, and charge becomes liquid volume. Yes, this will make hydraulic system actually respond to control surface movements in best way ever – you can see pressure changes and drops from different sensors as you roll your spacecraft to the left into further chassis integrity loss and your death. That, and also hydraulic pumps will have a jump of RPM as your start rolling – angular accelerations influence the motors (they are aligned on Y axis right now).

In other news I’ve started working on new textures for X-30 Venture – they will actually feature thermal protection layer visible (with each tile in your view), and they are more high-res. You can see some pictures of how it looks so far (red things aren’t textured yet, so are engines):
top
bottom
tiles

X-30 Venture EPDC

I’ve been working on electric power and distribution control system for X-30. So far I got simulation portion done (at least for the DC currents), and later I will also add AC nodes. Right now the entire power system adds up to 18 different fuses, just for the electric nodes.

This is scheme of electric nodes (every unit is fused, the correct fuse values will be determined later):
EPDC

It is simulated using simple Ohm laws. For example, this is piece of code that currently simulates DC, AVC, MFD buses (based on power source):

  -- Calculate watts consumed by every master node
  set(dc1_watts,(get(mfd1_watts)+get(avc1_watts))*get(dc1_enabled)*get(dc1_fuse_state))
  set(dc2_watts,(get(mfd2_watts)+get(avc2_watts))*get(dc2_enabled)*get(dc2_fuse_state))

  -- Power source select
  local PWR_V = 32.5*get(powersource_enabled)
  local PWR_r = 0.01 --resistance of power input

  -- Calculate resistances of all nodes
  local MFD1_R = (28^2) / (get(mfd1_watts)+1e-9)
  local AVC1_R = (28^2) / (get(avc1_watts)+1e-9)
  local MFD2_R = (28^2) / (get(mfd2_watts)+1e-9)
  local AVC2_R = (28^2) / (get(avc2_watts)+1e-9)

  MFD1_R = MFD1_R / (get(mfd1_enabled)*get(mfd1_fuse_state)*get(dc1_enabled)*get(dc1_fuse_state) + 1e-6)
  AVC1_R = AVC1_R / (get(avc1_enabled)*get(avc1_fuse_state)*get(dc1_enabled)*get(dc1_fuse_state) + 1e-6)
  MFD2_R = MFD2_R / (get(mfd2_enabled)*get(mfd2_fuse_state)*get(dc2_enabled)*get(dc2_fuse_state) + 1e-6)
  AVC2_R = AVC2_R / (get(avc2_enabled)*get(avc2_fuse_state)*get(dc2_enabled)*get(dc2_fuse_state) + 1e-6)

  -- Calculate resistances of master nodes
  local DC1_R = 1 / (1 / MFD1_R + 1 / AVC1_R)
  local DC2_R = 1 / (1 / MFD2_R + 1 / AVC2_R)

  DC1_R = DC1_R / (get(dc1_enabled)*get(dc1_fuse_state) + 1e-9)
  DC2_R = DC2_R / (get(dc2_enabled)*get(dc2_fuse_state) + 1e-9)

  -- Calculate resistance of power source node (FIXME: AC stuff)
  local PWR_R = 1 / (1 / DC1_R + 1 / DC2_R)

  set(powersource_current,PWR_V / (PWR_R + PWR_r))
  set(powersource_voltage,get(powersource_current) * PWR_R)

  -- Calculate voltages on master nodes
  set(dc1_current,get(powersource_voltage) / (DC1_R))
  set(dc2_current,get(powersource_voltage) / (DC2_R))
  set(dc1_voltage,get(dc1_current) * DC1_R)
  set(dc2_voltage,get(dc2_current) * DC2_R)

  --voltage and current over dc1 elements
  set(mfd1_current,get(dc1_voltage) / MFD1_R)
  set(avc1_current,get(dc1_voltage) / AVC1_R)
  set(mfd1_voltage,get(mfd1_current) * MFD1_R)
  set(avc1_voltage,get(avc1_current) * AVC1_R)

  --voltage and current over dc2 elements
  set(mfd2_current,get(dc2_voltage) / MFD2_R)
  set(avc2_current,get(dc2_voltage) / AVC2_R)
  set(mfd2_voltage,get(mfd2_current) * MFD2_R)
  set(avc2_voltage,get(avc2_current) * AVC2_R)

(Updated with working code…)