Jump to content
Sign in to follow this  
Dozer

Simulating electrical systems

Recommended Posts

I'm trying to simulate an aircraft's electrical system from scratch in a plugin. I'm struggling to get my head round the physical laws. As far as I can work out, these two rules both apply and form a circular argument:

 

1 - the amount of current consumed by the load (landing lights, radios, the tea urn etc) depends on the supply voltage.

2 - the supply voltage (from a battery) depends on the current drawn by the load.

 

Is the best way to just iterate those steps a couple of times? Perhaps to begin with the previous frame's current/voltage, get a new current from the load model using the old voltage, then a new voltage from the supply model using the new current?

Share this post


Link to post
Share on other sites

The current consumed by the load depends on the overall parallel resistance of all your electrical consumers. The supply voltage will be a constant supply - up to the rated load of the generator/ battery. It's like in your house - the more lights you have switched on, the greater your current draw - but your supply voltage always remains constant.

 

Beyond the rated load, you'll get an overload condition. This is where things get interesting. I haven't looked into the physics of overloads, but I'm guessing that the higher current will result in:

 

- Higher Temperatures in your generator windings and therefore higher internal resistance.

- Reduced RPM in your generator (the governor can't maintain a constant speed anymore), and therefore reduced supply voltage / AC frequency

 

- For batteries higher currents mean higher temperatures which will generally increase its internal resistance - thereby reducing the circuit supply voltage.

 

I think overload conditions are only worth thinking about if you have reduced generator capacity. If you have full generator capacity, I'm guessing your circuit breakers will trip long before any overload condition exists.

Share this post


Link to post
Share on other sites

Jack, I recommend you start by researching 'Ohms law', "circuit analysis" or "network analysis". Any discussion of a circuit/electrical system will revolve around these concepts and terminology. Your generalizations aren't quite correct but you're on a good track and a bit of reading will help it sink in more I think. I'm not trying to duck the issue, but a topic like this usually comes after 5 months or so of educational study...there is a lot to take in. If you can afford it, this is a great book.

 

http://www.amazon.com/Aircraft-Electricity-Electronics-Student-Study/dp/0028018605/ref=sr_1_cc_1?s=aps&ie=UTF8&qid=1354590391&sr=1-1-catcorr&keywords=aircraft+electricity

Share this post


Link to post
Share on other sites

Thanks for the help but the aircraft's supply voltage definitely isn't constant. Batteries produce less volts when under load. If the battery is healthy the difference is small though. The manual I'm working from has a procedure for testing the health of the batteries - turn on the instrument and nav lights and check the battery voltage is above a minimum, then turn on the fuel pumps and check it drops no more than 0.75V. Perhaps I'm overestimating the variation in supply voltage...

 

The (DC) generators produce a nearly-constant voltage, but that's because they have an active voltage regulator circuit/device, the nature of which I'm trying to find out (along with any interesting failure modes). They're not AC generators with a constant-speed drive, this aircraft is a bit too old for that breakthrough!

 

I think, under an overload condition, the generators will just overheat and trigger the master warning. It is then up to the crew to shed load, turn off malfunctioning generators, and if necessary continue on battery power alone.

 

I'm realising the more complex problem is how to resolve the flow of current when different voltage sources are connected together. It might be simpler than I realise...edit: whoops, missed your reply there Tom. Thanks for the recommendation, I'll see if they'll ship that book to Australia...

Share this post


Link to post
Share on other sites

I can only edit my post once then Avsim?

 

Thanks Tom, I've ordered that book, found it for a reasonable price used on Amazon from a vendor who ships to Australia, which is always a nice bonus. Shipping cost more than the book!

 

edit: perhaps I should have spent more on shipping. My order has been shipped, estimated delivery date between 1 and 2 MONTHS - what am I supposed to do til then? I know - Tom, I'll PM you my phone number, you can call me up and read the book to me over the phone ;)

 

Revelation of the day: Thevenin's Theorem, which as I understand it means 'put a small resistor in series with each voltage source and then use Kirchhoff's laws to determine how much current flows in and out of each generator/battery'. I haven't successfully grasped the maths of this though, let alone expressing the idea in C++.

 

(while I'm editing the post, might as well add, I think I'm getting to grips with Kirchhoff now!)

Share this post


Link to post
Share on other sites

Dozer, I think you will find you probably won't need Thevenin/Kirchoff for your final simulation....you COULD, but it all dependes on what properties you'd like to model. Here's the reason. Electrical systems on aircraft have already been designed....which means that loads have been determined, generators and batteries have already been sized and selected and the systems has been designed to just "work". There are variations of course, these are usually due to manufacturing and assembly tolerances, operating variances and/or wear, but the system has nominal values it was designed around. Using Thevenin/Kirchoff is the kind of thing the electrical engineer does to design the system and select power sources, determine wire sizes, generator capacity, heat dissipation, etc. Because that is already done, you do not necessarily need to repeat that aspect of it. Doing a network analysis would require knowledge of every single component's resistance / reactance values and you just won't be able to get that. Now if you so choose, you can certainly write your own "circuit simulator" with these variables in place...but this is a more of a exercise in and of itself as opposed to supporting the end goal of simulating an aircraft electrical sim for practical usage.

 

Now I know you love a good programming challenge though and clearly love to learn and you are definitely a bit more into electronics than I so I won't tell you which way you should go because given your dabblings in cockpit building, you will, without a doubt, need to know Thevenin/Kirchoff/Ohm type stuff. At IXEG, we discusseed how indepth to go and decided to labor under a fundamental assumption that from a pilot perspective, the aircraft is a "state machine". A pilot doesn't care what heat dissipation values are...or voltage variations, only that something works or it doesn't, they can use it or they can't. The thing about computers is they don't exhibit variability like the real world does...so no matter which way you go, you'll have to randomize some value. You can choose to randomize current and say, "ok, the current is too high, now the component fails"....or you can simply randomize the component and say, "the component fails" as x-plane default does. In the first case, you'd have to track multiple variables and run multiple calculations all to realize one outcome > "the component is failed". OR you can simply randomize a variable for the component and simply say it fails. Why it fails in inconsequential to the pilot, and in the 2nd case, you use a lot less computing power. The programming strategy in this situation is different than a circuit analysis approach. The good thing with a circuit approach is it is adaptable to any configuration....and while we didn't go down the circuit analysis path to determine currents and voltages, we did come up with a configurable network representation that accomplishes the same but without resorting to voltage/current calculations....we lean on the designed values that were calculated by the original engineer. He did the work, we just represent it in sim.

 

So that's our perspective and approach, take it for what you will. I would still dig deep into it though given your cockpit work. I can guarantee I'll be knocking on your doorstep one day to talk about hardware building with the Teensy and the 737.

 

-Tom K

Laminar / IXEG

Share this post


Link to post
Share on other sites

Thanks Alan, that was a good article.

 

Thanks for the detailed reply Tom! I see what you mean about using randomness and noise for systems which don't directly impact on the flying experience. But going by what's written in the pilot's manual for this particular aircraft (the de Havilland Dominie), figuring out what's happening to the electrical system is a fairly significant part of the pilot's workload, even without any failures (or consequences from misuse!). I've assumed the most straightforward way to simulate this stuff is to model things on a volts-amps-and-ohms level but I'll look again and see if a more empirical solution would work.

 

Incidentally, re the 737 and hardware - there's a bug with Teensy where it cannot cope with dataref idents longer than 58 characters, or 55/54 for array datarefs. I've written a plugin which creates aliases of datarefs to get round this issue, but if the i737 can use short dataref idents for stuff likely to be used by hardware, life will be easier for users. I think Paul said he'll fix this issue, but it's a lot of work for him on a relatively low-priority issue, so I don't know how soon this is likely to be addressed.

Share this post


Link to post
Share on other sites
If you can afford it, this is a great book.

 

http://www.amazon.co...aft electricity

 

Nooo! It arrived a few days ago, but this is the study guide - it's just contextless questions with the answers written at the back! Did you mean to recommend this one?

 

http://www.amazon.com/Electricity-Electronics-Technology-published-Paperback/dp/B00A0705MQ

 

I've been stalled for ages on this project, not for any great technical reason I don't think, just lost a lot of focus and vision for life generally a month or so ago. My last great revelation was that, as the batteries NEVER reach above ~25V no matter their state of charge or their current, and the generators are voltage-regulated to ~28V, the current flow will always be into the batteries when the generators are running. So figuring out how to model a charging battery, as well as a discharging one, this is the next step. I just need to turn off the browser and launch the compiler, which I will be doing, starting from... now.

Share this post


Link to post
Share on other sites

Hey Jack...yea man, I'm sorry. I did mean the regular one. I wasn't even aware there was a student study guide. The covers are the same and I guess I just did a quick glance. Again I apologize.

Share this post


Link to post
Share on other sites

No worries, I should have used the 'check inside' feature. I'll order again for the correct item!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...