Project Multistage2015 - Development Thread

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,390
Reaction score
577
Points
153
Location
Vienna
Do you mean contribution to the code? Well for the time being I have this steps in my mind:

1) gather feedbacks from beta testers to see if the module is properly reproducing the vinka's one and correct eventual issues
2) finish the implementations I have in mind, especially the peg autopilot.
3) modify what is needed for orbiter2015.

Well, that's more like a roadmap, not how we can contribute.

Actually I let the code public so in the future, when the new "orbiter2028" will come out and I will be away or anything anybody can start from there and renew the multistage, for the moment I was not thinking of a repository or something "live" for multiple inputs.

Yeah, sure, that's the spirit of all this vinka replacements. I don't think that a repository is necessary immediately, my question was more geared towards this scenario:

  1. Some user mentions a bug/request.
  2. Some developer knows how to fix it, makes code-changes, and gets a working version.
  3. Now he wants to show you that changes, so you can integrate/merge it into your current work-in-progress to have it active in the next release. Or drop it and explain why.
How do you imagine the step 3 should happen? Posting ZIPs here in the thread? Email?


Of course any help is appreciated and will be credited, if you check I also credited the functions and the inputs I had simply reading the forum in order not to disappoint anyone.

Perfect.

I know that relevant to programming I still have millions of Kilometers to do, but it's an hobby and I'm simply enjoying the learning curve :compbash: :lol:

Well, what you presented here is already a pretty big part of the road you're traveling.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
This code part is accessing out of bounds if there are more than 4 "ENG_x"
entries in the scenario file.
Code:
    //engines///
    int nbeng;
    for(nbeng=0;nbeng<32;nbeng++){
    sprintf(engtxt,"ENG");
    sprintf(buff,"_%i",nbeng+1);
    strcat(engtxt,buff);
    GetPrivateProfileString(boostertxt, engtxt, buffreset, dataparsed, MAXLEN, filename);
    if(strncmp(dataparsed,buffreset,MAXLEN-5)==0){
    booster[b].nEngines=nbeng;        
    break;
        }else{
    CharToVec(dataparsed,&booster[b].eng[nbeng]);
        }
    }
"booster.eng[nbeng]" might access outside of eng bounds, wich is declared as beeng 4 elemens in size:
Code:
struct BOOSTER{
    //...
    VECTOR3 eng[4];
    //...
};
Seems like you accidentally mixed BOOSTER and STAGE ...

---------- Post added at 21:19 ---------- Previous post was at 21:11 ----------

Another thing cppcheck[1] found:

-- ------------------------------------------------------------------
In line 423 of Multistage2015.cpp
-- ------------------------------------------------------------------
Using 'sizeof' for array given as function argument returns the size of a pointer.
It does not return the size of the whole array in bytes as might be expected.
For example, this code:
Code:
int f(char a[100]) {
  return sizeof(a);
}
returns 4 (in 32-bit systems) or 8 (in 64-bit systems)
instead of 100 (the size of the array in bytes).
-- ------------------------------------------------------------------

I strongly recomment using static code analysis tools! And cppcheck is quite nice for C++

/Kuddel

----
[1] http://cppcheck.sourceforge.net/
 
Last edited:

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Thanks for both pointing me the booster engine bug and for showing cppcheck which is extremely useful!
 

PhantomCruiser

Wanderer
Moderator
Tutorial Publisher
Joined
Jan 23, 2009
Messages
5,600
Reaction score
165
Points
153
Location
Cleveland
Man, not that you've mentioned boosters; I think I have a request.

Would it be possible to have engines of a different size on the same stage? As in the case with a Kosmos rocket 2nd stage there is one main engine with 4 verniers. In MS2 (to the best of my knowledge) all the engines are set as the same size and thrust rating. To use MS2 I've got to fake it, just use the main motor and the others are just there as candy.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Man, not that you've mentioned boosters; I think I have a request.

Would it be possible to have engines of a different size on the same stage? As in the case with a Kosmos rocket 2nd stage there is one main engine with 4 verniers. In MS2 (to the best of my knowledge) all the engines are set as the same size and thrust rating. To use MS2 I've got to fake it, just use the main motor and the others are just there as candy.

yep, not too difficult, I think I can do this in the following way:

I'll add an additional parameter to engine definition which will determine the diameter scale, so it will be possible to define engines in two ways:

ENG_X=(xx,yy,zz)

and

ENG_Y=(xx,yy,zz,K), with K scale parameter for engine diameter.
Default value will be k=1, if you want a larger engine you will put like ENG_Y=(xx,yy,zz,1.5)

if you want a smaller engine: ENG_Y=(xx,yy,zz,0.75)

if you don't put anything k will be 1.

what do you think?
 

PhantomCruiser

Wanderer
Moderator
Tutorial Publisher
Joined
Jan 23, 2009
Messages
5,600
Reaction score
165
Points
153
Location
Cleveland
Love it! That'll open up a whole slew of shelved projects of mine.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Gravity Turn Computational Evaluation

Hi guys,

while fixing the reported bugs and waiting for other bugs/requests to come, I've started the automatic guidance autopilot implementation, which is actually the main reason why I started this project.

Let's say that the last step of this will be easy because I already have it ready for the jarvis, which is the last stage PEG autopilot.

In the middle there will be the re-implementation of the multistage PEG autopilot. I have it working for three stages rockets, but I have to test it on general launcher.

At start I'm finishing to implement a new feature:
as we know the rockets should follow the gravity turn while in the atmosphere, in order to avoid drag and structural failures. This gravity turn is difficult to calculate and is highly effected by initial pitch angle. Therefore I have implemented (and for now it seems to work properly) the computational evaluation of gravity turn.
It is essentially based on the following papers:

https://globaljournals.org/GJSFR_Volume12/6-Computational-Algorithm-for-Gravity.pdf
http://www.princeton.edu/~stengel/MAE342Lecture3.pdf

Since it is a computational method it is a trial and error system which start with a low initial pitch angle (70*) and check if ther rocket is capable to perform the gravity turn and reach 35km of altitude (point from which the peg will take the control). If with the pitch angle it does not reach 35km then it increases the pitch angle of 1 degree and check again until it finds a solution (if any).

This will lead to have a trajectory optimization even if rockets are user defined as in this case.

My idea is then to implement the new autopilot as a call of the current one, like
Code:
-6=engine(0,100,6)
0=peg(300,220,51.57)
with first digit of peg as target apogee, second digit as target perigee and third as target inclination
 

K_Jameson

Active member
Joined
Dec 30, 2009
Messages
1,064
Reaction score
3
Points
38
Hi Fred,
glad to see that your work is going well. FOI developing is not dead!

Unfortunately I have little time for developing, that I prefer to spend in my little projects, leaving no room for the beta testing of your ms2015. Usually my beta testings are fairly "aggressive" and this requires time...
Anyway, I hope to join the other beta testers soon...


Keep up the good work, and Hail the Probe!
:hailprobe:
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,676
Reaction score
900
Points
128
Location
Code 347
Hi Fred,
just tested the multistage2015.dll with my LADEE add-on and performance seems pretty much the same as using multistage2.dll. Exhaust/flame visuals look better with multistage2015.

Only slight difference I noticed was with the initial ROLL command in the guidance file - multistage2.dll turns the launcher to the initial pitch angle (72 in this case) slightly quicker and then uses default KILLROT function for ~1 sec before beginning the PITCH sequence.
Using multistage2015.dll, the turn is slightly slower, resulting in slightly more vertical velocity at the start of the PITCH sequence, which means the gravity turn is not aligned so well, but overall performance is pretty much the same as multistage2.dll.

The launcher is a MinotaurV, 3 stages, no boosters. Here are the .ini and guidance.txt for reference. Tested on Orbiter2010-P1, Windows8.1.

Code:
[MISC]
cog=4.36
FOCUS=1

[TEXTURE_LIST]
TEX_1=Exhaust2

[PARTICLESTREAM_1]
NAME=Delta320contrail
SRCSIZE=3
SRCRATE=32
V0=125
SRCSPREAD=0.1
LIFETIME=2
GROWTHRATE=7
ATMSLOWDOWN=1
LTYPE=DIFFUSE
LEVELMAP=LVL_PSQRT
LMIN=0
LMAX=1
ATMSMAP=ATM_PLOG
AMIN=1e-5
AMAX=1
TEX=contrail1

[PARTICLESTREAM_2]
NAME=Delta320contrail2
SRCSIZE=3.0
SRCRATE=14
V0=160
SRCSPREAD=0.02
LIFETIME=0.3
GROWTHRATE=10
ATMSLOWDOWN=0.4
LTYPE=EMISSIVE
LEVELMAP=LVL_PSQRT
LMIN=0
LMAX=1
ATMSMAP=ATM_PLOG
AMIN=1e-5
AMAX=1
TEX=contrail3

[PARTICLESTREAM_3]
NAME=Delta320contrail3
SRCSIZE=4.0
SRCRATE=40
V0=120.0
SRCSPREAD=0.05
LIFETIME=0.25
GROWTHRATE=0.8
ATMSLOWDOWN=0
LTYPE=EMISSIVE
LEVELMAP=LVL_PSQRT
LMIN=0
LMAX=1
ATMSMAP=ATM_PLOG
AMIN=1e-5
AMAX=1
TEX=contrail3

[STAGE_1]
Height=8.72
Diameter=2.34
EmptyMass=4211
FuelMass=48809
Thrust=2248889 ;;;2024000 ;;;1606590
BurnTime=52.4 ;;;;58
off=(0,0,0)
MeshName="ladee/minotaurv_stg1"
ENG_TEX=Exhaust2
ENG_1=(0,0,-4.9)
ENG_DIAMETER=1.5
ENG_PSTREAM1=Delta320contrail
ENG_PSTREAM2=Delta320contrail3
speed=(0,0,-2)
rot_speed=(0,0,0)
PITCHTHRUST=80000
YAWTHRUST=80000
ROLLTHRUST=20000

[STAGE_2]
Height=6.23
Diameter=2.34
EmptyMass=2900
FuelMass=24900
Thrust=973000
BurnTime=78
off=(0,0,7.733)
MeshName="ladee/minotaurv_stg2"
ENG_1=(0,0,-4.7)
ENG_DIAMETER=1.5
ENG_TEX=Exhaust2
ENG_PSTREAM1=Delta320contrail
ENG_PSTREAM2=Delta320contrail3
IGNITE_DELAY=1
PITCHTHRUST=5300
YAWTHRUST=5300
ROLLTHRUST=5300
speed=(0,0,-2)
rot_speed=(0,0,0)

[STAGE_3]
Height=3.41
Diameter=2.34
EmptyMass=1400
FuelMass=6800
Thrust=303450 ;;;289000
BurnTime=71.5
OFF=(0,0,10.774)
MeshName="ladee/minotaurv_stg3"
ENG_1=(0,0,-2.6)
ENG_DIAMETER=1.5
ENG_TEX=Exhaust2
ENG_PSTREAM1=Delta320contrail
ENG_PSTREAM2=Delta320contrail3
IGNITE_DELAY=1
PITCHTHRUST=2000
YAWTHRUST=2000
ROLLTHRUST=1000
speed=(0,0,-1)
rot_speed=(0,0,0)

[FAIRING]
N=2
MeshName="ladee/minotaurv_fair"
Diameter=2.34
Height=6.36
angle=0
off=(0,0,15.565)
EMPTYMASS=500

[PAYLOAD_1]
MeshName="ladee/minotaurv_stg4;ladee/star37fm;ladee/ladee"
OFF=(0,0,12.92);(0,0,14.732);(0,0,16.772)
speed=(0,0,0.3)
rot_speed=(0,0,0)
Module="Vessels/ladee/minotaurv_stg4"
name="MinotaurV_Stg4"
Diameter=2.34
Height=4
Mass=3739
RENDER=1

Code:
-10=PlaySound(Sound\Vessel\countdown1.wav)
-1=engine(0,80,1)
0=engine(80,100,57)
5=roll(3,89,90,72,1)
15.0=pitch(71.95, 69.01, 5.0)
20.0=pitch(69.01, 65.24, 5.0)
25.0=pitch(65.24, 61.95, 5.0)
30.0=pitch(61.95, 59.10, 5.0)
35.0=pitch(59.10, 56.63, 5.0)
40.0=pitch(56.63, 54.46, 5.0)
45.0=pitch(54.46, 52.60, 5.0)
50.0=pitch(52.60, 50.99, 5.0)
55.0=pitch(50.99, 46.18, 5.0)
57=engine(100,100,0.1)
60.0=pitch(46.18, 36.83, 5.0)
65.0=pitch(36.83, 32.42, 5.0)
70.0=pitch(32.42, 29.76, 5.0)
75.0=pitch(29.76, 27.29, 5.0)
80.0=pitch(27.29, 24.87, 5.0)
85.0=pitch(24.87, 22.54, 5.0)
90.0=pitch(22.54, 20.30, 5.0)
95.0=pitch(20.30, 18.12, 5.0)
100.0=pitch(18.12, 16.04, 5.0)
105.0=pitch(16.04, 14.01, 5.0)
110.0=pitch(14.01, 12.09, 5.0)
115.0=pitch(12.09, 10.21, 5.0)
120.0=pitch(10.21, 8.40, 5.0)
125.0=pitch(8.40, 6.66, 5.0)
130.0=pitch(6.66, 4.98, 5.0)
135.0=pitch(4.98, 0.33, 5.0)
140.0=pitch(0.33, 0.00, 5.0)
145.0=pitch(0.00, 0.00, 5.0)
150.0=pitch(0.00, 0.00, 5.0)
155.0=pitch(0.00, 0.00, 5.0)
160.0=pitch(0.00, 0.00, 5.0)
163=fairing()
165.0=pitch(0.00, -0.00, 5.0)
170.0=pitch(-0.00, 0.00, 5.0)
175.0=pitch(0.00, -0.00, 5.0)
180.0=pitch(-0.00, 0.00, 5.0)
185.0=pitch(0.00, 0.36, 5.0)
190.0=pitch(0.36, 3.14, 5.0)
195.0=pitch(3.14, 6.93, 5.0)
200.0=pitch(6.93, 12, 5.0)
205.0=pitch(12, 12, 5.0)
210.0=pitch(12, 12, 5.0)
210=engine(0,0,234)
212=jettison()

I hope you can make your PEG autopilot work for multistage2015.dll - that would be great!

Best regards,
Brian
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Anyway, I hope to join the other beta testers soon...

I am waiting the comments of an expert like you! Join soon :thumbup:

Only slight difference I noticed was with the initial ROLL command in the guidance file - multistage2.dll turns the launcher to the initial pitch angle (72 in this case) slightly quicker and then uses default KILLROT function for ~1 sec before beginning the PITCH sequence.
Using multistage2015.dll, the turn is slightly slower, resulting in slightly more vertical velocity at the start of the PITCH sequence, which means the gravity turn is not aligned so well, but overall performance is pretty much the same as multistage2.dll.

Yep, I know. The thing is that in ms2015 there is an actual roll program, since the rocket points towards the correct direction and roll to get the proper attitude, while in vinka it pitches down to the specified angle and then yaws to the launch azimuth. I know there is a small difference, maybe I'll tune it up to minimize it.

I hope you can make your PEG autopilot work for multistage2015.dll - that would be great!

You can count on it, it's the reason why I'm doing this :lol:

Thank you for the test and for the feedback!!

Love it! That'll open up a whole slew of shelved projects of mine.

Hi Phantom, I added the feature mentioned, tested and it's working, when I will post the next release (shortly enough I hope) it will be included :thumbup:
 

Michael_Chr

New member
Joined
Jul 16, 2013
Messages
153
Reaction score
0
Points
0
Location
Virklund
MS2015 Additional features

I was thinking in the meantime to the additional features asnd that's my ideas:
- as said autonomous guidance computer as in Jarvis DLL (it will be the biggest feature)
- failures (I could leave this for last I think)
- Mach 1 Vapours with simple ini calls
- possibility to have rotated payloads (actually missing and could be very useful)
- ullage effects with simple ini calls
- possibility to have "live" payloads: with an option the payload will actually load itself and will not be a dead mesh

comments or any other ideas are more than welcome!

cheers
Fred

Hi Fred
Im currently using Velcro for a little project mine making a lifting rocket. The reason for not using multistage is because of the lack of ability to rotate the payload mesh and secondly that velcro allows having a "live" payload (as opposed to a "dead" mesh). I have monitored this thread closely with interest and have seen that you might be tinkering with having rotated as well as "live" payloads. Based on your current documentation I guess you havnt implemented those features yet - since in the current cycle you are "only" (sorry for lack of better words - because this is a mighty task you have taken upon your self) aiming at replicating Vinkas multistage as well as improving the autopilot. Just to let you know that there is still a "market" for your addon espescially with the improvements you have illustrated. :thumbup:
Best regards
Michael
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Hi Michael thanks!

Actually those two options are in my top list for the 1.0 version release.

I'm finishing to work on the autopilot (which is the most difficult thing) and then i'll implement exactly those two features so the 1.0 version will have them.

The vinka's replica was just the first step: the starting point on which (once working) i wanted to add new features like these!

Cheers!

Fred
 

Interceptor

Well-known member
Joined
Mar 28, 2008
Messages
2,718
Reaction score
76
Points
63
Location
Michigan,Florida
Hello fred18,I have tested your multistage2015,with alot of the FOI addons,and other stuff too,and here is what I have to say,first off I have to say that the roll program on most of the rockets I have tested this on is a lot more efficeint,I really like the the new booster seperation,and spinning animation,I also like the new text info on the hud.now for the problems.All of the FOI launchpads,and smoke animations for them the timing is way off,also so is the COG for the rockets,and alot of the spacecraft3 moving animations on launchpads are not woking correctly anymore,I have also noticed the boosters,and LES on some rockets spin wildly out of control, But the multistage 2015 autopilot seems to work well.Thanks for making this,and I hope you can Iron out the bugs,I am no expert,but I just wanted to give you my two cents,since I know that you have worked very hard on this. thanks:cheers:

---------- Post added at 04:59 AM ---------- Previous post was at 03:44 AM ----------

Hi again fred18,I noticed you added a couple more commands for the guidance file, inverse,and spin rate,and duration,can you write a sample guidance file showing how these two commands would work when launching a space shuttle type craft upside down,and then rolling,or spinning to heads up position before orbit is achieved.Thanks

---------- Post added at 06:05 AM ---------- Previous post was at 04:59 AM ----------

Can you please add an option to have a different key for fairing seperation,I always want to see what my framerate is during the sim,but can't because its' the same key for both.
 
Last edited:

boogabooga

Bug Crusher
Joined
Apr 16, 2011
Messages
2,999
Reaction score
1
Points
0
The "live" payload option would be really useful.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
The "live" payload option would be really useful.

There will be: I already did it. In the jarvis dll package with antares or delphinus there were live payloads on board, I'll simply replicate that system :thumbup:
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Back from summer holidays and starting a bit of coding again, will give updates soon.

In the meantime I never replied to interceptor, here it is:

Hello fred18,I have tested your multistage2015

Thanks! :tiphat:

I have to say that the roll program on most of the rockets I have tested this on is a lot more efficeint
Good! I think that its strong point is that it's a bit more realistic.

I really like the the new booster seperation,and spinning animation
Actually the only difference with the old system is that ms2015 works rigorously on what is written in the ini code, while vinka has some bugs (or checks if the values are within some limits, I don't know this)

I also like the new text info on the hud.
Thanks, some more information will come on the hud.

All of the FOI launchpads,and smoke animations for them the timing is way off,
Noted this, I have to check but this should not be related to ms2015. Pads, smoke etc effects of the FOI launchers were ruled by an additional module of which I don't have the code. I will check in details this to see if there is a link or not anyway.

also so is the COG for the rockets,and alot of the spacecraft3 moving animations on launchpads are not woking correctly anymore,
spacecraft3 animation or anything else is not related to ms2015, they must have some issue by themselves. Anyway can you be a bit more specific with the COG problem? this is important and related to ms2015, if there is a problem there it must be solved!

I have also noticed the boosters,and LES on some rockets spin wildly out of control,
I think that this is related to wrong values in the ini files. I don't know why but I saw around vinka file with huge numbers for rot speed separation of boosters etc. I did not introduce any limit to those numbers because it may be used to create some wanted effect.

But the multistage 2015 autopilot seems to work well.Thanks for making this,and I hope you can Iron out the bugs,I am no expert,but I just wanted to give you my two cents,since I know that you have worked very hard on this. thanks:cheers:

Thank you for your support! comments and feedbacks are always extremely precious for the addon development! doesn't matter if they come from experts or not!

Hi again fred18,I noticed you added a couple more commands for the guidance file, inverse,and spin rate,and duration,can you write a sample guidance file showing how these two commands would work when launching a space shuttle type craft upside down,and then rolling,or spinning to heads up position before orbit is achieved.Thanks
Sure! good point! I will include an example in the 1.0 release!

Can you please add an option to have a different key for fairing seperation,I always want to see what my framerate is during the sim,but can't because its' the same key for both.
I changed the key in orbiter for the framerate, I put [Y], it's almost unused to most of the addons, I strongly suggest you to do the same :thumbup:


Cheers! :cheers:
Fred
 

Interceptor

Well-known member
Joined
Mar 28, 2008
Messages
2,718
Reaction score
76
Points
63
Location
Michigan,Florida
Hi fred18,ok the cog problem,this is off the top of my head,and I can check the numbers later this evening for you,so for instance the Boosters,and ET tank for resolve international addon that are multistage2 the cog is set to 28.8,but with multistage2015,I had to set it to 34.8.Thanks
 

Interceptor

Well-known member
Joined
Mar 28, 2008
Messages
2,718
Reaction score
76
Points
63
Location
Michigan,Florida
Hi fred18,I did some more testing,and noticed that the orbiter Francophone rockets the Ariane 5,and,6,and all of them I have tested are not working properly with multistage2015,and what I mean is it works but no text pop up on the left bottom of the screen,and no text info on the hud,I think multistage2 is working still,but it totally ignores multistage2015.
 
Last edited:

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Check the scenario file.

Usually this addons have their own .cfg file which resend anyway to the multistage2 module.

In the scenario file, after the name of the vessel and the column (":") put multistage2015 and it should work. In case post here the scenario file and i will indicate you where to write it
 
Top