Board index FlightGear Development Aircraft

Definition file location

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Definition file location

Postby kgwedi » Thu Jul 15, 2021 12:36 pm

I am a very frustrated newby trying to modify an existing aircraft. I was trying to add a kx165 and a ki206 to a Grob109. I gave up. They never got electrical power.
Now I am trying to add a garmin196 to a Grob109b.
in this document:
~/fgdata/Aircraft/Instruments-3d/garmin196/doc/doc-en.htm
It says:
To install the Garmin 196, you must declare the nasal in the definition file of the aircraft.

<nasal>
<garmin196>
<file>Aircraft/Instruments-3d/garmin196/garmin196.nas</file>
</garmin196>
</nasal>

What is a "definition file", and where do I learn about one?
Thanks in advance...
kgwedi
 
Posts: 13
Joined: Tue Jul 13, 2021 5:44 am

Re: Definition file location

Postby wkitty42 » Thu Jul 15, 2021 1:59 pm

start with the craft's -set.xml file and go from there... that file starts the chain of files that are loaded to make a complete craft...
eg: grob109-set.xml
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Definition file location

Postby WoodSTokk » Thu Jul 15, 2021 2:13 pm

The definition file is the '*-set.xml' file located in the main directory of the aircraft.
In your case the file is named 'g109-set.xml'.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: Definition file location

Postby kgwedi » Thu Jul 15, 2021 2:52 pm

Thank you for the great answers.
when ever I put :

<nasal>
<garmin196>
<file>Aircraft/Instruments-3d/garmin196/garmin196.nas</file>
</garmin196>
</nasal>

into the g109-set.xml
then the aircraft won't load, it says this aircraft is not downloaded. When I remove the nasal lines, it loads fine.
Last edited by kgwedi on Thu Jul 15, 2021 3:05 pm, edited 1 time in total.
kgwedi
 
Posts: 13
Joined: Tue Jul 13, 2021 5:44 am

Re: Definition file location

Postby kgwedi » Thu Jul 15, 2021 3:53 pm

My fault....I was only indenting 1 space in the g109-set.xml file instead of 2.
All now loads properly, except the Garmin 196, the ki266 DME, and the ki206 vor indicator all still have no power.
Any hints on the cause of that lack of electricity? My kx165 has power and using the "/" it show enabled and working fine.
Thank you guys very much.
kgwedi
 
Posts: 13
Joined: Tue Jul 13, 2021 5:44 am

Re: Definition file location

Postby Johan G » Thu Jul 15, 2021 9:08 pm

kgwedi wrote in Thu Jul 15, 2021 3:53 pm:My fault....I was only indenting 1 space in the g109-set.xml file instead of 2.

Something else must be at play. Indentation should not make any difference in either XML or Nasal files.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Definition file location

Postby WoodSTokk » Fri Jul 16, 2021 12:14 am

Have now loaded the G109 and a short look into '/systems/electrical/' show that not all props are wired up.
Working props under '/systems/electrical':
alternator show the voltage of the alternator
amps shows the load of the alternator
volts shows the active volts on the power rail (28V if alternator is active, around 24V and falling on battery)
mainbusvolts show the voltage on the mainbus (same as volts if the main switch is on, otherwise 0)
Right of the ignition-key you have 2 circuitbreaker.
The left CB is for the alternator to load the battery.
The right CB is the mainbus.

Working props under '/systems/electrical/outputs':
fuel-pump controlled by fuel-pump switch
instr-lights controlled by instument light switch
land-light controlled by landing light switch
nav-lights controlled by navigation/position light switch
strobe controlled by the strobe light switch
turn-coordinator receive power by the mainbus

I dont know how the instrument work and from where they are that you want integrate.
The garmin need at least a gps instrumentation. There is one, but i dont know if it is working.
There is also a nav radio and dme instrumentation. But they doesnt work, because '/systems/electrical/outputs/nav' and '/systems/electrical/outputs/dme' are not set. So you should investigate the electric system of the aircraft and wire the nav radio and dme to the mainbus.
Then at least the internal radios are working. You can check it by hand if you set this 2 properties to a positive value equal or greater then 1.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: Definition file location

Postby kgwedi » Sun Jul 18, 2021 4:08 pm

WoodSTokk,
Thank you very much for your lesson. I appreciate your time and effort.
I have been using c++, NASAL, and xml to try to fix my radio problem, but I see you are only using xml files.
Are older aircraft like the Grob109 using xml only? Can I do everything with this aircraft using XML?
I need to go learn PropertyLists.
Again Sir, I thank you.
kgwedi
 
Posts: 13
Joined: Tue Jul 13, 2021 5:44 am

Re: Definition file location

Postby WoodSTokk » Sun Jul 18, 2021 6:06 pm

Its not all possible with XML, but most thinks.
The origin of every aircraft is the *-set.xml file and it is allways located in the main directory of the aircraft.
If you read this file, you will find <sim>…</sim>. Thats the main layer and it include some special-tags for other staff:
<flight-model> stipulate the FDM (Flight Dynamic Model): YaSim, JSBsim, etc…
<aero> tells the FDM the name of the file that the FDM should load (the aero dynamic behavior of the aircraft)
and so on.
There can also be some include=… parameter. This include the named file exactly on this position.
This enables us to split all information over more smaller files.
XML-files can load AC-file (3d models). In the AC-file are only the models build up of some or many objects.
In the XML-file we can write animation and bind it to the named objects or apply effects on it.
And there are other XML-files that contains calculations, known as filters.
This XML-files are also specified in the *-set.xml or a XML-file that 'include' it.
You can fint it under <sim><systems><autopilot>… or <sim><systems><property-rule>….
The difference is, that filters loaded as <autopilot> run with 120Hz, so they will 120 times per seconds calculated.
The filter loaded as <property-rule> will be calculated only once per frame.
It can be that the *-set.xml file also has a <nasal>…</nasal> layer (outside of <sim>).
In this layer, you can load nasal scripts.
All in all, the XML-files define the property-tree in-sim. You can define new properties, assign values to it or load filters that continuously calculate new values for it.
So the most files that you will find in a aircraft directory are XML, AC, nasal and texture files like PNG and WAV sound files.

~~~ EDIT ~~~

In case of the G109 the electrical system is managed by a nasal script.
Open the file Nasal/g109-electrical.nas and scroll to line 255:
Code: Select all
    # Radio
    load += 6.0;

There is only the load, but the voltage will not be set.
I changed it to this:
Code: Select all
    # Radio
    setprop("/systems/electrical/outputs/comm", main_bus_volts);
    setprop("/systems/electrical/outputs/nav", main_bus_volts);
    setprop("/systems/electrical/outputs/dme", main_bus_volts);
    setprop("/systems/electrical/outputs/adf", main_bus_volts);
    setprop("/systems/electrical/outputs/transponder", main_bus_volts);
    load += 6.0;

This lines give voltage on the radios as soon as the battery or alternator comes on line.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: Definition file location

Postby kgwedi » Mon Jul 19, 2021 1:41 pm

Once again, I thank you. Your advice worked perfect, and I learned a lot.
My vor is working.
The DME not so much.

In the ki266.xml file, It says:
========
This instrument needs the file
Aircraft/Instruments-3d/ki266/ki266.nas
to be included in your -set.xml nasal section
like this:

<nasal>
<YourAircraft>
<file>Aircraft/Instruments-3d/ki266/ki266.nas</file>
</YourAircraft>
</nasal>

and at least one instance of the ki266 class to be created
in your aircraft nasal code like this:
ki266.new(0); # for your first dme at /instrumentation/dme[0]
ki266.new(1); # if you have another at /instrumentation/dme[1]
Maintainer: Torsten Dreyer
======

I put the <nasal> part into the g109-set.xml file, and now while flying, using the "/" , the dme shows the distance, time, and speed, but the displays are all "none"
The second part about the Ki266.new(0); doesn't make sense.
It tells "What" to do, but not "How", Where" or "Why".

The only "/instrumentation/dme" file is an xml file, NOT a nasal file.
I put the "ki266.new(0);: line in many places, both in nasal files, and in xml files, but all are still lacking the display values.

Rather that showing me "where" to do this, could you show me where I can "learn" where to put this line. Is it a NASAL thing, or an XML thing. It says it is a nasal thing, going into an xml file. I am confused.
kgwedi
 
Posts: 13
Joined: Tue Jul 13, 2021 5:44 am

Re: Definition file location

Postby WoodSTokk » Mon Jul 19, 2021 8:51 pm

I'm not a nasal guru, so i needed some attempt to work.

In the file g109-base.xml scroll to the end, there is the nasal-load block:
Code: Select all
  <nasal>
    <doors>
      <file>Aircraft/Grob-G109/Nasal/doors.nas</file>
    </doors>
    <g109>
      <file>Aircraft/Instruments-3d/ki266/ki266.nas</file>
      <file>Aircraft/Grob-G109/Nasal/light.nas</file>
      <file>Aircraft/Grob-G109/Nasal/liveries.nas</file>
      <file>Aircraft/Grob-G109/Nasal/g109-electrical.nas</file>
      <file>Aircraft/Grob-G109/Nasal/instruments.nas</file>
      <file>Aircraft/Grob-G109/Nasal/g109.nas</file>
      <file>Aircraft/Grob-G109/Models/Interior/Panel/Instruments/Transponder/Transponder.nas</file>
      <file>Aircraft/Grob-G109/Nasal/te-vario.nas</file>
    </g109>
    <immat>
      <file>Aircraft/Grob-G109/Nasal/immat.nas</file>
    </immat>
  </nasal>


Check it carefully, i have insert a line at the start of the list.
First i had it at the end, but this doesnt work.
I think its a race condition. If you call the function to create a DME, the file must allready be loaded.
Therefor i insert it at the top.

Then open the file Nasal/instruments.nas and scroll to the end.
There is allready a listener to fire up a function.
I added a second line for the DME:
Code: Select all
######################### Fire it up ############################################
setlistener("/sim/signals/electrical-initialized",initialize);
setlistener("/sim/signals/electrical-initialized", ki266.new(0));

Now its working here.

PS: in my opinion a nasal script for this little function is to heavy.
The same functionality can also be achieved only with animations.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: Definition file location

Postby kgwedi » Mon Jul 19, 2021 9:55 pm

You really know this stuff :-)
Thank you for doing this.....

Image

All working great. I think it would have taken me about 20 years to figure that out :-)
Now I will do some serious IFR flying. Maybe later add an ADF.
Also in the future is fixing a Flight Dynamics abnormality with YASim in the Grob109.
But all that is another day.
Sir, you are a gentleman and a wonderful advocate for FlightGear. And you have my thanks.
Should I some how "share" this modified aircraft with the FG community? Is that even done, or is it a silly thought?
Again..Thanks.
kgwedi
 
Posts: 13
Joined: Tue Jul 13, 2021 5:44 am

Re: Definition file location

Postby WoodSTokk » Tue Jul 20, 2021 4:27 am

The original author of this aircraft is Emmanuel Baranger (aka Helijah).
Maybe he will include your updates and improve this aircraft.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye


Return to Aircraft

Who is online

Users browsing this forum: No registered users and 18 guests