Board index FlightGear Development Aircraft Flight dynamics model

JSBsim function name not valid  Topic is solved

Good sims require good FDMs (the "thing" that makes an aircraft behave like an aircraft).

JSBsim function name not valid

Postby TheEagle » Thu Oct 21, 2021 5:32 pm

I have the following function in my engine file:
Code: Select all
   <function name="volumetric-efficiency">
       <table>
           <independentVar>atmosphere/density-altitude</independentVar>
           <tableData>
                 0           0.7037
                1000     0.698
                5000     0.67
                10000   0.637
                15000   0.6069
                17000   0.5962
            </tableData>
        </table>
   </function>

I cannot find anything wrong on it, yet JSBsim tells me it is:
Code: Select all
Malformed function name with number: 0 and property name: volumetric-efficiency but no "#" sign for substitution
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: JSBsim function name not valid

Postby benih » Thu Oct 21, 2021 6:03 pm

I think you need to wrap it in an fcs_function
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: JSBsim function name not valid

Postby TheEagle » Thu Oct 21, 2021 6:43 pm

No, I've seen a function of the same form at the same place in the engine file of the Citation II from Ysop. The engine isn't part of the FCS.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: JSBsim function name not valid

Postby S&J » Thu Oct 21, 2021 7:15 pm

You're going to need an engine system file, so you might as well go ahead and make one, and add
Code: Select all
      <fcs_function>
         <function>
            <table>
               <independentVar>atmosphere/density-altitude</independentVar>
               <tableData>
                  0       0.7037
                  1000    0.698
                  5000    0.67
                  10000   0.637
                  15000   0.6069
                  17000   0.5962
               </tableData>
            </table>
         </function>
         <output>propulsion/engine[0]/volumetric-efficiency</output>         
      </fcs_function>
"Stay away from negative people.They have a problem for every solution." - Albert Einstein
S&J
 
Posts: 794
Joined: Wed Aug 26, 2020 7:31 pm

Re: JSBsim function name not valid

Postby TheEagle » Thu Oct 21, 2021 7:17 pm

Okay, but now I still don't know why that error is thrown (also, the function has no effect, as expected)
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: JSBsim function name not valid

Postby S&J » Thu Oct 21, 2021 9:04 pm

Have you called up the engine system file in the fdm ?
Here I have between the end of the propulsion section and start of the aerodynamics section

Code: Select all
</propulsion>

   <system file = "Continental/TSIO-520-R"/>

 <aerodynamics>
"Stay away from negative people.They have a problem for every solution." - Albert Einstein
S&J
 
Posts: 794
Joined: Wed Aug 26, 2020 7:31 pm

Re: JSBsim function name not valid

Postby TheEagle » Thu Oct 21, 2021 9:37 pm

I have that function inside the engine file. I saw this work in another engine file, but it doesn't work in mine …
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: JSBsim function name not valid

Postby S&J » Thu Oct 21, 2021 9:46 pm

Show us the file then, lets have a look at it.
"Stay away from negative people.They have a problem for every solution." - Albert Einstein
S&J
 
Posts: 794
Joined: Wed Aug 26, 2020 7:31 pm

Re: JSBsim function name not valid

Postby TheEagle » Thu Oct 21, 2021 9:54 pm

Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: JSBsim function name not valid

Postby S&J » Thu Oct 21, 2021 10:08 pm

ok, my mistake...

I meant the example of the working code
"Stay away from negative people.They have a problem for every solution." - Albert Einstein
S&J
 
Posts: 794
Joined: Wed Aug 26, 2020 7:31 pm

Re: JSBsim function name not valid

Postby TheEagle » Thu Oct 21, 2021 10:19 pm

Code: Select all

<!--
  Rev. 0.11: Quickfix to have 200lbs at sealevel. to be more defined for descent
  Rev. 0.12: data derived from ref.7
  Rev. 0.121: bypassratio
  Rev. 0.13: manual adaptions
  Rev. 0.M1: pure manual based on 0.13 and aero version 0.01122
  File:     JT15D-4.xml
  Author:   AeromatiC++ v 3.3.11

  See: http://wiki.flightgear.org/JSBSim_Engines#FGTurbine

  Inputs:
    name:                    JT15D-4
    type:                    Turbine Engine
    thrust:                  2500.0 lbf
    bypass ratio:            2.300:1
    overall pressure ratio:  14.5:1
    augmented?               no
    injected?                no

  Outputs
    tsfc:                    0.7
    engine weight:           565.8 lbs
    engine length:           4.2 ft
    engine diameter:         2.3 ft
-->

<turbine_engine name="JT15D-4">
  <milthrust> 2500.0 </milthrust>
  <bypassratio>     2.900 </bypassratio>
  <tsfc>            0.702 </tsfc>
  <bleed>           0.03</bleed>
  <idlen1>         45.0 </idlen1>
  <idlen2>         49.0 </idlen2>
  <maxn1>         104.0 </maxn1>
  <maxn2>          96.0 </maxn2>
  <augmented>         0 </augmented>
  <injected>          0 </injected>

  <function name="IdleThrust">
   <table>
    <independentVar lookup="row">velocities/mach</independentVar>
    <independentVar lookup="column">atmosphere/density-altitude</independentVar>
    <tableData>
         -10000     0     10000   20000   30000   40000   50000   90000
     0.0  0.0430  0.02  0.0528  0.0694  0.0899  0.1183  0.1467  0
     0.2  0.0500  0.023  0.0335  0.0544  0.0797  0.1049  0.1342  0
     0.4  0.0040  -0.015  0.0020  0.0272  0.0595  0.0891  0.1203  0
     0.6 -0.0804 -0.0804 -0.0560 -0.0237  0.0276  0.0718  0.1073  0
     0.8 -0.2129 -0.2129 -0.1498 -0.1025  0.0474  0.0868  0.0900  0
     1.0 -0.2839 -0.2839 -0.1104 -0.0469 -0.0270  0.0552  0.0800  0
    </tableData>
   </table>
  </function>

  <function name="MilThrust">
   <table>
    <independentVar lookup="row">velocities/mach</independentVar>
    <independentVar lookup="column">atmosphere/density-altitude</independentVar>
    <tableData>
          -10000       0 10000   20000   30000   40000  50000   90000
      0.0  1.260   1.020 0.859   0.588   0.366   0.211  0.163   0.000
      0.1  1.1     0.917 0.794   0.552   0.353   0.209  0.163   0.000
      0.2  1.112   0.850 0.748   0.523   0.337   0.206  0.163   0.000
      0.3  1.050   0.797 0.641   0.493   0.327   0.203  0.163   0.000
      0.4  1.034   0.758 0.611   0.477   0.327   0.204  0.163   0.000
      0.5  1.020   0.725 0.588   0.466   0.327   0.203  0.163   0.000
      0.6  1.002   0.686 0.575   0.458   0.328   0.209  0.163   0.000
      0.7  1.000   0.650 0.556   0.451   0.340   0.216  0.167   0.000
      0.8  1.004   0.618 0.542   0.441   0.346   0.225  0.173   0.000 
      0.9  1.000   0.595 0.503   0.425   0.340   0.222  0.167   0.000
      1.0  1.023   0.836 0.354   0.145   0.000   0.000  0.000   0.000
      1.2  1.034   0.856 0.379   0.156   0.000   0.000  0.000   0.000
      1.4  1.030   0.865 0.405   0.169   0.000   0.000  0.000   0.000
    </tableData>
   </table>
</function>

</turbine_engine>

This is working in another aircraft.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: JSBsim function name not valid

Postby S&J » Fri Oct 22, 2021 12:46 am

I wonder if it's because those functions don't exist in the engine properties, so it's ok to create them.

You're attempting to create a property that already exists.

What happens if you change the function name by adding a 2 to the end of the name ?
"Stay away from negative people.They have a problem for every solution." - Albert Einstein
S&J
 
Posts: 794
Joined: Wed Aug 26, 2020 7:31 pm

Re: JSBsim function name not valid

Postby erik » Fri Oct 22, 2021 8:33 am

My gut feeling: the minus sign. You might want to try to replace it with an underscore.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: JSBsim function name not valid  

Postby Gijs » Fri Oct 22, 2021 8:50 am

Looking at the JSBSim source, you cannot simply use tables for whatever parameter you want inside the engine config files, as JSBSim expects single values for the vast majority. For piston engines, the only tables that are accepted in the config file seem to be named COMBUSTION and MIXTURE (see source).

However, the volumetric-efficiency parameter appears to be exposed on the property tree, so you can adjust it at run-time. This should be done outside the engine config file though, for example in a system file, like S&J hinted at.

To explain why your example engine works the way it does: it's a turbine engine, for which IdleThrust and MilThrust are explicitly defined as tables in the source code (together with AugThrust, Injection, N1SpoolUp, N1SpoolDown, N2SpoolUp and N2SpoolDown). Note that there is also a <milthrust> value, but that is used differently in the calculations and is indeed expected to be a single value (not a table). See how both that one and the table are there in the JT15D-4: the table does not replace the single value, it augments it.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10


Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 2 guests