Jump to content

Sigma Binary


Sigma88

Recommended Posts

When i try to focus on the Duna-Ike barycenter, My focus goes to Laythe. I can still select Duna though, but it requires a lot of clicking.

EDIT: If you get the tracking station camera close to Duna, it usually focuses on Duna on the first try.

Edited by TheJewelOfJool
Link to comment
Share on other sites

When i try to focus on the Duna-Ike barycenter, My focus goes to Laythe. I can still select Duna though, but it requires a lot of clicking.

EDIT: If you get the tracking station camera close to Duna, it usually focuses on Duna on the first try.

this is weird, I'll look into it

edit:

works fine for me. try a clean install and let me know if the problem is still there

Edited by Sigma88
Link to comment
Share on other sites

Does this formula work for gas giants the same as rocky planets? Gut feeling thought it shouldn't be the same for both.


@Body
[*]
{
@Properties:HAS[#geeASL[],~mass[]]
{
mass = #$radius$
@mass != 2
@mass *= #$geeASL$
@mass /= 6.67384e-11
@mass *= 9.81
}
}

Edited by Svm420
Link to comment
Share on other sites

Does this formula work for gas giants the same as rocky planets? Gut feeling thought it shouldn't be the same for both.


@Body
[*]
{
@Properties:HAS[#geeASL[],~mass[]]
{
mass = #$radius$
@mass != 2
@mass *= #$geeASL$
@mass /= 6.67384e-11
@mass *= 9.81
}
}

yes it will work just fine.

That piece of code is needed because some modders rather use geeASL rather than mass (I don't have any idea why).

Since my mod needs to read the value "mass", I had to add that code in order to calculate it using geeASL.

Is there some particular reason why you don't think it will work for gas giants?

Link to comment
Share on other sites

As to why some modders use GeeASL as opposed to mass, it's because it's a hell of a lot easier to figure out how much gravity you want on a planet using GeeASL than having to figure it out using mass.

Link to comment
Share on other sites

I'll work on every feature listed in the poll, I just made the poll to see what people wanted more.

A 3 body system would sure be interesting, with 3 bodies however you have many different setups, so I will need to make a template for each setups.

The only setups I know are these three:

[TABLE=width: 800]

[TR]

[TD]7yw38bW.png[/TD]

[TD][TABLE=width: 600]

[TR]

[TD]This should be really easy to make since the majority of the code will be the same as the template for the binary already possible with the current template.

-EDIT-

this is actually already possible to do with the current template, see bottom of the page for instructions[/TD]

[/TR]

[/TABLE]

[/TD]

[/TR]

[TR]

[TD]1T1pa69.png[/TD]

[TD][TABLE=width: 600]

[TR]

[TD]I don't really know the math about this one.

I know it will work for bodies of equal mass in perfectly circular orbits and equally spaced (120 degrees apart)

But that is a bit limiting, so if anyone knows the math (or where to find it) please contact me[/TD]

[/TR]

[/TABLE]

[/TD]

[/TR]

[TR]

[TD]3_body_figure_8_20fps.gif[/TD]

[TD][TABLE=width: 600]

[TR]

[TD]I'm not sure I can get this to work, but I'm working on it.

BTW, if anyone has any idea of the math behind this I can use all the help I can get[/TD]

[/TR]

[/TABLE]

[/TD]

[/TR]

[/TABLE]

If there are other examples I'm not aware of them, and if you know feel free to ask for them posting some link where I can read about them.

-edit-

ternary example 1

In order to get a ternary system of 3 planets (where Red is the biggest, Green is the middle sized, Blue is the smaller)

1 - Paste a copy of the template.cfg anywhere in the gamedata folder

2 - Rename it, to avoid overwriting it later

3 - open the file and edit the following lines


[...]
@Body[[B][COLOR=#ff0000]Red[/COLOR][/B]]
{
SigmaBinary = Primary
}
@Body[[COLOR=#00ff00][B]Green[/B][/COLOR]]
{
SigmaBinary = Secondary
}
[...]
@Body[[COLOR=#ffa500][B]Sun[/B][/COLOR]]
{
SigmaBinary = Reference
}
[...]

4 - Paste another copy of the original template.cfg anywhere in the gamedata folder

5 - In this file, edit the following lines:


@Kopernicus:NEEDS[SigmaBinary]:AFTER[[COLOR=#ff0000][B]Squad[/B][/COLOR]]
[...]
@Body[[COLOR=#00ff00][B]Green[/B][/COLOR]]
{
SigmaBinary = Primary
}
@Body[[COLOR=#0000ff][B]Blue[/B][/COLOR]]
{
SigmaBinary = Secondary
}
[...]
@Body[[B][COLOR=#ff0000]Red[/COLOR][/B]]
{
SigmaBinary = Reference
}
[...]

6 - I haven't tested this, so it may not work ;)

7 - I have now tested this, and it works ;)

8 - SoI calculation may not work with this method

9 - You can easily set the sphereOfInfluence with a MM patch

Edited by Sigma88
Link to comment
Share on other sites

yes it will work just fine.

That piece of code is needed because some modders rather use geeASL rather than mass (I don't have any idea why).

Since my mod needs to read the value "mass", I had to add that code in order to calculate it using geeASL.

Is there some particular reason why you don't think it will work for gas giants?

I meant realistically. i know the code will work all the same in game, but shouldn't the formulas be different in reality? I mean I have no knowledge so this is all my feelings. Shouldn't rocky planets be necessarily more dense and therefore have different/higher mass in the same radius as a gas giant?

Link to comment
Share on other sites

I meant realistically. i know the code will work all the same in game, but shouldn't the formulas be different in reality? I mean I have no knowledge so this is all my feelings. Shouldn't rocky planets be necessarily more dense and therefore have different/higher mass in the same radius as a gas giant?

yes the density of gas giants is way lower than terrestrial planets.

but the code in question makes use of geeASL (which is, gee force At Surface Level) where "surface level" basically means "radius"

and the mass/geeASL/radius relationship is the same for both rocky and gaseous planets

Link to comment
Share on other sites

I'm having issues with this mod; I'm creating a binary gas planet system and when I add a binary config to the system I get a massive SOI for the main body in for the system.

Here's the code, I will upload an image after Imgur isn't over capacity:

  ////////////////////////////////////////////////////////////////////////////////////////////////
// Requires SigmaBinary - KSPForum Thread: http://forum.kerbalspaceprogram.com/threads/127820 //
////////////////////////////////////////////////////////////////////////////////////////////////

@Kopernicus:NEEDS[SigmaBinary]:AFTER[SigmaBinary]
{

// INSTRUCTIONS:
// Copy this cfg anywhere into the GameData folder
// Set the name of the two bodies you want to turn into a binary system plus the reference body

@Body[Yof] // Put here the name of the heavies body (eg: Pluto)
{
SigmaBinary = Primary // Don't change this line
}
@Body[Sawob] // Put here the name of the lightest body (eg: Charon)
{
SigmaBinary = Secondary // Don't change this line
}
@Body[Sun] // Put here the name of the body around which your binary system orbits (eg: Sun)
{
SigmaBinary = Reference // Don't change this line
}

// Now sit back and enjoy your binary system

// Sigma



////////////////////////////////////////////
// You don't need to read past this point //
////////////////////////////////////////////



// This part creates the barycenter

+Body[SigmaBarycenter]
{
SigmaBinary = Barycenter
@name = #$/Body:HAS[#SigmaBinary[Primary]]/name$$/Body:HAS[#SigmaBinary[Secondary]]/name$
#/Body:HAS[#SigmaBinary[Primary]]/Orbit {}
}

// This part sets the Primary body

@Body:HAS[#SigmaBinary[Primary]]
{
@Properties
{
%solarRotationPeriod = false
}
@Properties:HAS[#tidallyLocked[true]]
{
%rotationPeriod = #$../Orbit/semiMajorAxis$
@rotationPeriod != 3
@rotationPeriod /= #$/Body:HAS[#SigmaBinary[Reference]]/Properties/mass$
@rotationPeriod *= 5.91539767275773e11
@rotationPeriod != 0.5
%rotates = true
!tidallyLocked = DEL
}
@Properties:HAS[~sphereOfInfluence[]]
{

// Calculate the SoI (only if it's not already explicitly set)

sphereOfInfluence = #$mass$
@sphereOfInfluence /= #$/Body:HAS[#SigmaBinary[Reference]]/Properties/mass$
@sphereOfInfluence != 0.4
@sphereOfInfluence *= #$../Orbit/semiMajorAxis$
}
@Orbit
{

// Set orbital parameters

@referenceBody = #$/Body:HAS[#SigmaBinary[Barycenter]]/name$
%inclination = #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/inclination$
%eccentricity = #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/eccentricity$
%longitudeOfAscendingNode = #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/longitudeOfAscendingNode$
%argumentOfPeriapsis = #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/argumentOfPeriapsis$
@argumentOfPeriapsis += 180
%meanAnomalyAtEpoch = #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/meanAnomalyAtEpoch$
%epoch = #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/epoch$

// Set new semiMajorAxis

%semiMajorAxis = #$/Body:HAS[#SigmaBinary[Secondary]]/Properties/mass$
@semiMajorAxis += #$../Properties/mass$
@semiMajorAxis != -1
@semiMajorAxis *= #$/Body:HAS[#SigmaBinary[Secondary]]/Properties/mass$
@semiMajorAxis *= #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/semiMajorAxis$
}
}

// This part shrinks the SoI of the Secondary body when it's too big
// If the original body have the SoI already explicitly set, this part won't change anything

@Body:HAS[#SigmaBinary[Secondary]]
{
@Properties:HAS[~sphereOfInfluence[]]
{
%sphereOfInfluence = #$mass$
@sphereOfInfluence /= #$/Body:HAS[#SigmaBinary[Primary]]/Properties/mass$
@sphereOfInfluence != 0.4
@sphereOfInfluence *= #$../Orbit/semiMajorAxis$
%maxSoI = 1
}
@Properties:HAS[#maxSoI[1]]
{
%maxSoI = #$../Orbit/semiMajorAxis$
@maxSoI *= 2
@maxSoI += #$/Body:HAS[#SigmaBinary[Primary]]/Orbit/semiMajorAxis$
@maxSoI /= #$../Orbit/eccentricity$
@maxSoI -= #$/Body:HAS[#SigmaBinary[Primary]]/Orbit/semiMajorAxis$
@maxSoI -= #$../Orbit/semiMajorAxis$
@maxSoI -= #$../Orbit/semiMajorAxis$
@maxSoI *= #$../Orbit/eccentricity$
@maxSoI /= 2
@maxSoI -= #$sphereOfInfluence$
}
@Properties:HAS[#maxSoI[<0]]
{
@sphereOfInfluence += #$maxSoI$
}
}

// This part sets Barycenter's mass, description and SoI

@Body:HAS[#SigmaBinary[Barycenter]]
{
@Properties
{
description = #This is the Barycenter of the $/Body:HAS[#SigmaBinary[Primary]]/name$-$/Body:HAS[#SigmaBinary[Secondary]]/name$ System.

// Set mass

%mass = #$/Body:HAS[#SigmaBinary[Primary]]/Orbit/semiMajorAxis$
@mass /= #$/Body:HAS[#SigmaBinary[Secondary]]/Orbit/semiMajorAxis$
@mass != 3
@mass *= #$/Body:HAS[#SigmaBinary[Primary]]/Properties/mass$

// Set Sphere of Influence

%sphereOfInfluence = #$/Body:HAS[#SigmaBinary[Primary]]/Orbit/eccentricity$
@sphereOfInfluence += 1
@sphereOfInfluence != 0.5
@sphereOfInfluence *= #$/Body:HAS[#SigmaBinary[Primary]]/Orbit/semiMajorAxis$
@sphereOfInfluence *= -1
@sphereOfInfluence += #$/Body:HAS[#SigmaBinary[Primary]]/Properties/sphereOfInfluence$
}
}

// This part clears temporary stuff

@Body
[*]
{
!SigmaBinary = DEL
@Properties
{
!maxSoI = DEL
}
}
}

Link to comment
Share on other sites

could you please send me the configs of the planets also?

I need those to understand if there's something wrong :)

btw, is this the only template you have put into gamedata? I've found a bug with this version which will screw up the planets if you try to load more than 1 template.cfg at the same time

(fix will come soon, with the next release)

Edited by Sigma88
Link to comment
Share on other sites

ah yes, I see what's wrong.

The part of the code which is supposed to calculate the mass from geeASL and radius it's actually bugged :D

(so much for all my previous messages)

a fix will come in my next release (just wait a couple of minutes ;) )

edit: well, maybe a little more than a couple :)

in the meantime, try adding the "mass" to your planets

it's simple to calculate

mass = ((radius^2)*geeASL)*(9.81 / 6.67384e-11)

Edited by Sigma88
Link to comment
Share on other sites

You only need to supply GeeASL, mass or gravParameter, Kopernicus will calculate the other ones for you ;)

yes, but my mod will need to read the mass before kopernicus calculates it. that's why I added that piece of code ;)

Oh, and btw....


Sigma Binary[v0.2] is now available

Download

[Dropbox] (Kerbal Stuff link coming soon)

ChangeLog

[TABLE=width: 700]

[TR]

[TD]


[B]v0.2.0[/B]
- Fixed mass calculation from geeASL+radius
- Fixed a bug which didn't allow for the use of more than one template.cfg file
- Added an example for the Kopernicus feature "baryCenter"
- [B][COLOR=#ff0000]template.cfg was changed, old versions won't work with this release[/COLOR][/B]

[/TD]

[/TR]

[/TABLE]

make sure you update everything, even the copies of template.cfg you may have created for yourself/your mod

Edited by Sigma88
Link to comment
Share on other sites

No, it made more problems: Stars that I've created and both Yof and Sawob have infinite SOIs as well as every probe I had (2 of them, at least), and the planets orbiting the stars were revolving over 9000 times a second (as well as Sawob)!

Maybe I should Try the Kopernicus BaryCenters, those might work - might.

- - - Updated - - -

And yes, I did update the configs.

- - - Updated - - -

Nope, nothing works - not even Kopernicus barycenters.

Link to comment
Share on other sites

are you using the same configs as before for yof and sawob?

I'll check them out now

edit:

I mean the configs you sent me via dropbox, not the "template.cfg" :)

edit2:

I can see that something weird is going on.

I'm not sure what it is tho.

SoIs are not infinite, these are the parameters I've found.

tell me if you see the same numbers (more or less)


[B] name = Yof[/B]
semiMajorAxis = 60193599.1111116
eccentricity = 0
inclination = 0
meanAnomalyAtEpoch = 0
epoch = 0
argumentOfPeriapsis = 180
LongitudeAscendingNode = 0
orbitColor = 0.500, 0.500, 0.100, 1.000
GeeASL = 0.600014388561249
Radius = 10000000
Mass = 8.81951055132002E+24
sphereOfInfluence = 6588148736
rotationPeriod = 36000
solarDayLength = 36004.37890625


[B] name = Sawob[/B]
semiMajorAxis = 541742392
eccentricity = 0
inclination = 0
meanAnomalyAtEpoch = 0
epoch = 0
argumentOfPeriapsis = 0
LAN = 0
GeeASL = 0.300007192261128
Radius = 5000000
Mass = 1.10243877587716E+24
sphereOfInfluence = 235807072.258495
rotationPeriod = 36000
solarDayLength = 36004.3785080549


[B] bodyName = YofSawob[/B]
semiMajorAxis = 137547120640
eccentricity = 0
inclination = 0
meanAnomalyAtEpoch = 0
epoch = 0
argumentOfPeriapsis = 0
LAN = 0
GeeASL = 82306499934.4681
Radius = 1
Mass = 1.20980935624383E+22
sphereOfInfluence = 6527955292.39727
rotationPeriod = 1E+100

Edited by Sigma88
Link to comment
Share on other sites

well, the planets loaded fine for me.

But I have problems using a ship to go from one planet to the other

EDIT

I've found a little issue with 0.2

I have edited the fix directly into the dropbox files so if you have downloaded 0.2 before reading this message download it again

sorry for the inconvenience

Edited by Sigma88
Link to comment
Share on other sites

The Planets around the stars I've created still go insane.

I haven't even made a Template for Yof and Sawob yet.

does the issue show up only with my mod installed?

If so, could you send me some of the configs?

What would happen if I added in a 2nd moon to a binary system, but not have it in the binary config as a body?

The new moon will keep orbiting in stock-way.

for example, if you choose kerbin and the moon.

minmus will remain in orbit around kerbin, with the same parameters

Link to comment
Share on other sites

This is a test for the new OP, don't look at it!

 

Sigma-Binary.svg KSP-1.0.5-orange.svg dev.version-%40GitHub-lightgrey.svg total.svg

Sigma Binary

 

This mod will let you turn custom and/or stock bodies into binary systems,

without the need to do all the calculations yourself.

This also will allow any user to decide between playing with or without binary systems.

 


6r0ejKf.png
                                                                                                                                                            Double Duna image for illustrative purposes only.

 

 

Required Mods

 

 

 

 

Supported Mods

 

 

 


 

Supported by

 

 

Downloads

 Latest Release
a7Abccw.png
@GitHub

If you want to contribute to my caffeine addiction:
iSFDI5f.png r8916yD.png
Don't expect anything in return other than my sincere gratitude. :)

 

Changelog

v1.4.0

- Barycenter name now accounts for cbNameLater
- Secondary orbit line is now drawn relative to the barycenter
- template.cfg now deactivates if there are missing bodies
- Fixed calculation of minimum SphereOfInfluence
- Fixed calculations when finalizeOrbit is used
- Moved clean-up of temp values from :FINAL to :FOR[SigmaCleanUp]
- Fixed names of config files to account for linux case sensitivity


v1.3.3

- Added conversion of meanAnomalyAtEpochD (deg) to meanAnomalyAtEpoch (rad)


v1.3.2

- Fixed mass calculation from gravParameter
- Barycenters doesn't generate cache files
- Fix for stars used as Primary bodies


v1.3.1

- Added compatibility with templateless planets
- Added code to remove duplicate values


v1.3.0

- Now Requires KSP 1.0.5
- Now Requires Kopernicus Beta 0.5
- Template.cfg and DunaIke.cfg are now in separate downloads
- Folder structure changed
- Overhauled the code to reflect Kopernicus changes


v1.2.1

- Bug Hotfix


v1.2.0

- Improved definition of template parameters
- Improved calculation of mass for planets
- Improved compatibility with GalacticNeighborhood


v1.1.1

- Improved compatibility with planet packs


v1.1.0

- Now Requires Kopernicus 0.4
- Refined RSS compatibility
- Added compatibility with finalizeOrbits
- Removed useless code from StockFix.cfg
- Fixed tidal lock issue in StockFix.cfg
- Increased barycenters radius to 61m to solve a Tracking Station Bug
- Renamed the folder from "BinaryExpansion" to "Binary"


v1.0.2

- Hotfix updating .version file for KSP-AVC compatibility


v1.0.1

- Hotfix for RSS compatibility


v1.0.0

- First Release (non beta)
- Added compatibility with RSS and other Rescale Mods not 100% compatible yet
- Added an exception for ISRU contracts on barycenters
- Other minor changes to the code


v0.2.4

- removed kopernicus cache file generation for barycenters


v0.2.3

- changed the calculation of sphereOfInfluence for every body in the binary system
- added a check to make sure the SoI of the secondary body never reaches the primary's surface


v0.2.2

- added code to calculate mass from gravParameter if both mass and geeASL are not set
- changed the value of G (universal gravitational constant) from 6.67384e-11 to 6.674e-11


v0.2.1

- Fixed mass calculation from geeASL+radius (for reals this time)


v0.2.0

- Fixed mass calculation from geeASL+radius
- Fixed a bug which didn't allow for the use of more than one template.cfg file
- Added an example for the Kopernicus feature "baryCenter"
- template.cfg was changed, old versions won't work with this release
- removed "baryCenter = true" parameter from barycenters


v0.1.0

- Fixed the calculation of:
    Sphere Of Influence
    Planet rotationPeriod
    Orbital Parameters
- Added "baryCenter = true" parameter to barycenters
- Removed calculation of "flightGlobalIndex" since it's useless


v0.0.4

- First Beta Release

 

 

Info and FAQs

 

Config Structure

Spoiler

@Kopernicus:BEFORE[SigmaBinary]
{
	@Body[Ike]
	{
		SigmaBinary
		{
			name = x
			primaryLocked = true
			redrawOrbit = true
			Properties
			{
				description = x
				selectable = true
			}
			Orbit
			{
				mode = x
				icon = x
				color = r,g,b,a
			}
		}
	}
}

 

You only need to add the SigmaBinary {} node to the Secondary Body of your system. All the other settings are optional.

How to use this mod

  1. Download the mod (link at the bottom of the page)
  2. If you have an old installation delete the folder "Binary" found in GameData\Sigma\
  3. Install the mod by merging the GameData folder from the archive with the one in your KSP install.
  4. To make a binary system add the node "SigmaBinary" to the secondary body in the Kopernicus/Body Node.

 

If you want to add this to your mod

  1. Add the node "SigmaBinary" to the secondary body of your binary system.
  2. Put a link to this mod into your thread so people may choose to download this mod if they want binary systems.

 

Other Questions

- Can I move the Sun?
No.

- Will this mod mess up Stock Planets?
No. This mod doesn't add any binary system at all.

- Can I bundle SigmaBinary into my mod?
You are free to (= I encourage you to) bundle your version of the "template.cfg" file in order to make your mod compatible with SigmaBinary, however I would rather if you didn't bundle the whole mod.

- Is it possible to create ternary systems?
You can create some multiple systems but it's a little harder to set up, feel free to ask for more info in the thread. 

- Is this mod compatible with RSS?
Yes, but you need to add the SigmaBinary node yourself.


I'll put in here any frequent question I receive.
If you have any question about the mod feel free to post down here or PM me.

 

 

Credits

  • @sarbian for ModuleManager
  • @Thomas P. for Kopernicus
  • @NathanKell for his help with my many questions regarding planets and stuff
  • @cybutek for KSP-AVC
  • @KillAshley for answering questions I had while developing the mod
  • @Thomas P. (again) for taking the time of replying to my questions regarding Kopernicus
  • @nightingale for adding SigmaBinary compatibility to Contract Configurator
  • @Pkmniako for designing the new download button and signature banner
  • @Olympic1 for taking care of CKAN compatibility

 

 

License

88x31.png

 

Edited by Sigma88
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...