Satellite generation in Latest release... (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


jkgarner -> Satellite generation in Latest release... (10/12/2021 4:36:12 PM)

I have been successfully creating satellites under version 1.15.5 (Pro) with no issues
As we upgraded to the latest version (2), our satellite generation code stopped working.

For example, say I wish to create a SAR Satellite using TOPAZ (dbid 95) as a template and match it to a TLE that I pulled from the Internet:

In version 1.15.5 I would execute code like the following snippet:
ScenEdit_AddUnit({type='Satellite', side='US', guid='18957U', dbid=95 name='COSMOS 1932', Latitude='0',Longitude='0'})
local satU = ScenEdit.GetUnit({side='US', name='COSMOS 1932'})
local newTLE = 'COSMOS 1932\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 329.9962 0059909 254.4223 105.0217 13.79684050628349'
satU:updateorbit({TLE=newTLE})

Worked like a charm.

In version 2, it returns an error from the ScenEdit_AddUnit:

Script:
ScenEdit_AddUnit({type='Satellite', side='US', dbid=95 name='COSMOS 1932', Latitude=0,Longitude=0})
Result:
ScenEdit_AddUnit 0 : ,Unable to create new unit. Reason: Object reference not set to an instance of an object.



Based on information in the forums, I tried a few other tests:

Script:
ScenEdit_AddUnit({type='Satellite', side='US', dbid=95, name='COSMOS 1932', guid='5',Latitude=0,Longitude=0})
Result:
ScenEdit_AddUnit 0 : ,Unable to create new unit. Reason: Object reference not set to an instance of an object.

Script:
ScenEdit_AddUnit({type='Satellite', side='US', dbid=95, name='COSMOS 1932', orbit='5', Latitude=0,Longitude=0})
Result:
ScenEdit_AddUnit 0 : ,Unable to create new unit. Reason: The given key was not present in the dictionary.

Script:
ScenEdit_AddUnit({type='Satellite', side='US', dbid=95, name='COSMOS 1932', orbit='5',guid='5', Latitude=0,Longitude=0})
Result:
ScenEdit_AddUnit 0 : ,Unable to create new unit. Reason: There is no row at position 0.

I short, there seems to have been a change between version 1.15.5 and version 2 with regards to Satellite creation/processing from Lua, which causes the code not to work. Any ideas what has changed or how I should alter my (once functional) scripts to get them to function in the latest build?

[&:]




jkgarner -> RE: Satellite generation in Latest release... (10/12/2021 8:16:16 PM)

So further testing shows that if you pass the number 1 to the guid AND the orbit, the satellite creates. This is in keeping with what KnightHawk75 was describing in in his post https://www.matrixgames.com/forums/tm.asp?m=4843765&mpage=1&key=Satellite

This represents a severe limitation as to what can be created... basically if it does nto already exist in the database, you can't create it.

The following code shows that a satellite can be created IF the orbit number is 1 and teh GUID is 1. If you need more than 1 satellite, then it will not work. (The guids will collide!):

--local newTLE = 'COSMOS 1932\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 329.9962 0059909 254.4223 105.0217 13.79684050628349'

local newTLE = {}
newTLE[1] = 'TEST SAT #1\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 169.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[2] = 'TEST SAT #2\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 189.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[3] = 'TEST SAT #3\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 209.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[4] = 'TEST SAT #4\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 229.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[5] = 'TEST SAT #5\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 249.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[6] = 'TEST SAT #6\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 269.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[7] = 'TEST SAT #7\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 289.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[8] = 'TEST SAT #8\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 309.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[9] = 'TEST SAT #9\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 329.9962 0059909 254.4223 105.0217 13.79684050628349'
newTLE[10] = 'TEST SAT #10\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 349.9962 0059909 254.4223 105.0217 13.79684050628349'
local satData = {}
local i = 0
while i < 10 do
    i = i + 1
	local offset = -5
    local satName = 'TEST SAT #'..i
    print('creating satellite: '..satName)
    local e,p = pcall(ScenEdit_AddUnit,{type='Satellite', side='US', guid=i+offset, dbid=95, orbit=i+offset, name=satName, Latitude='0',Longitude='0'})
	if e == true then
		local satU = ScenEdit_GetUnit({name=satName, side='US'})
		local newTLE = satName..'\n1 18957U 88019A   20179.87780374 -.00000067  00000-0  19462-4 0  9999\n2 18957  65.0451 329.9962 0059909 254.4223 105.0217 13.79684050628349'
		satU:updateorbit({TLE=newTLE[i]})
		satData[i] = satU.guid
		print('created satellite #'..i)
	else
		print('error generated by call #'..i..'.  Message follows:')
		print(p)
		print('')
	end	
end
local i =0
while i < 10 do
	i = i + 1
	if satData[i] ~= nil then
		print('Satellite GUID = '..satData[i])
	end
end


Change the offset value to select which of the array you load, but only 1 will load.

Pro version 1.15.5 did not have this limitation. We were able to set specific string GUID when creating the satellite, and it worked.

Whatever was done previously to get satellites working prior to version 1.15.5, may need to be reaccompished against version 2.




KnightHawk75 -> RE: Satellite generation in Latest release... (10/12/2021 10:13:15 PM)

Yup things have been kinda broke\hobbled in CMO with AddUnit when dealing with Sats in this regard since CMO release as I, and now you have pointed out (Though I swear I've added multiple using non-conflicting guid/obritid's that match the orbits, but it depends what you're adding to avoid the id collisions), hopefully some day the sat-guid generation in Lua issue\bug gets addressed.




michaelm75au -> RE: Satellite generation in Latest release... (10/13/2021 1:56:25 AM)

Have you lodged a ticket with Matrix for the Pro issue? There is a dedicated group to support Pro users.




jkgarner -> RE: Satellite generation in Latest release... (10/13/2021 2:54:24 AM)

I saw the dedicated group/forum for prop. I was not sure that was where to log it, so I sent Paul an e-mail, pointing him to this thread. Hopefully that will suffice.




michaelm75au -> RE: Satellite generation in Latest release... (10/14/2021 12:44:57 PM)

I have been looking at this and think I have found an issue. If it worked in the old Pro version, someone may have fixed the issue in that version.




jkgarner -> RE: Satellite generation in Latest release... (10/14/2021 2:34:51 PM)

It worked in Pro 1.15.5.
I never tested it in older versions.
So I can't say whether it was broken in the older versions and then fixed, (which means it was reintroduced in CMO and version 2) or if it is new to CMO and version 2.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.0625