Advanced Question Simulated Solar Panels And Batteries

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,696
Reaction score
1,354
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Would it be possable to create a space ship in orbiter that would "charge" "batteries" from solar pannels. What I mean is, I want to have simulated batteries, which only can be recharged when the ship is not in earth's shadow. The panels would recharge the batteries at some set regharge rate.
I cant think of a good way to do this. Anyone?
 

Zatnikitelman

Addon Developer
Addon Developer
Joined
Jan 13, 2008
Messages
2,302
Reaction score
6
Points
38
Location
Atlanta, GA, USA, North America
Well Dragonfly's got the power code, and I think Mustard's new solar modules have the sun-tracking code. I don't know how the sun-tracking code works, but maybe if it knows when teh sun goes behind the horizon it could work.
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,696
Reaction score
1,354
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Well Dragonfly's got the power code, and I think Mustard's new solar modules have the sun-tracking code. I don't know how the sun-tracking code works, but maybe if it knows when the sun goes behind the horizon it could work.

It involves an algorithm which would use the exact time as well as all orbital information to determine sun location reletave to pannels.

Now that I say that, I think that I could use a similar algorithm to determine times when the spacecraft is in shadow.

Thank you for the inspiration.

-Matt
 

Andy44

owner: Oil Creek Astronautix
Addon Developer
Joined
Nov 22, 2007
Messages
7,620
Reaction score
7
Points
113
Location
In the Mid-Atlantic states
Well, Orbiter tracks when you are in shadow internally. Surely there must be a way to tap into that info.
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
It involves an algorithm which would use the exact time as well as all orbital information to determine sun location reletave to pannels.
Not even that complicated. Just do a Global2Local of <0,0,0> (since in the Orbiter global coordinate system the sun is by definition at <0,0,0>)--that will give you the location of the sun in local vessel coordinates. Then, use trig to determine the angles you need for the solar panels.

Now that I say that, I think that I could use a similar algorithm to determine times when the spacecraft is in shadow.
You could use a similar method to determine "in shadow"--you could check to see if the vector between your vessel and the sun comes within r of a celestial body, where r is that celestial body's radius. You could confine the search to your vessel's reference body, its parent body (if it's a moon), and all its moons.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,626
Reaction score
2,344
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
You could use a similar method to determine "in shadow"--you could check to see if the vector between your vessel and the sun comes within r of a celestial body, where r is that celestial body's radius. You could confine the search to your vessel's reference body, its parent body (if it's a moon), and all its moons.

You would also need to take in account the size of the moon and the size of the sun, as the sun is no point source of light.

But still the effort is not too high. You can reduce the number of checks by only using those planets/moons, which are close enough to have an effect of more than 5%...
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,696
Reaction score
1,354
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
You would also need to take in account the size of the moon and the size of the sun, as the sun is no point source of light.

But still the effort is not too high. You can reduce the number of checks by only using those planets/moons, which are close enough to have an effect of more than 5%...

Yep, all the other planets and moons would be too small to worry about.
Thanks for the help guys, for some reason I can never figure out things the easy way. I guess that's why we have the forum.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,626
Reaction score
2,344
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Yep, all the other planets and moons would be too small to worry about.
Thanks for the help guys, for some reason I can never figure out things the easy way. I guess that's why we have the forum.

If you want to make it complex, calculate the angle of incidence of the sun light on the solar array, as well as solar array temperature as both has big impacts on the electrical power production...:rofl:
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
See my post here for a "sunset" type function I wrote a while ago. Note that it does not allow for the size of the sun, ie, "sunset" occurs when the centre of the sun passes below the horizon.

As far as sun tracking goes, that is not too hard - just make friends with vectors ;)
 
Top