Board index FlightGear Development Aircraft Systems

Autostart piston engine in JSBSim

Modeling aircraft systems, like electrical stuff, hydraulics, pneumatics? Feel free to ask support.

Autostart piston engine in JSBSim

Postby abassign » Sun May 01, 2016 11:06 pm

I would do the autostart of a piston engine in jsbsim, I put in the -set file this code:

Code: Select all
 <engines>
  <engine>
   <rpm type="double">2000</rpm>
   <magnetos type="int">3</magnetos>
   <mixture type="double">1</mixture>
   <running type="bool">true</running>
  </engine>
 </engines>


The engine start, but after 3-5 seconds stop :(

in the JSBSim file configuration the engine is declare with this code:

Code: Select all
<propulsion>
   <engine file="Isotta-Fraschini-AS-5">
    <location unit="IN">
      <x>  36.00 </x>
      <y>   0.00 </y>
      <z>   0.00 </z>
    </location>
    <orient unit="DEG">
      <pitch> 0.00 </pitch>
      <roll>  0.00 </roll>
      <yaw>   0.00 </yaw>
    </orient>
    <feed>0</feed>
    <thruster file="Piaggio-Pegna-PC7-thruster">
     <sense> 1 </sense>
     <location unit="IN">
       <x>  36.00 </x>
       <y>   0.00 </y>
       <z>   0.00 </z>
     </location>
     <orient unit="DEG">
       <pitch> 0.00 </pitch>
       <roll>  0.00 </roll>
       <yaw>   0.00 </yaw>
     </orient>
    </thruster>
  </engine>
  <tank type="FUEL" number="0">
     <location unit="IN">
       <x> 181.11 </x>
       <y>   0.0 </y>
       <z>   0.0 </z>
     </location>
     <capacity unit="LBS"> 283.59 </capacity>
     <contents unit="LBS"> 141.79 </contents>
  </tank>
 </propulsion>


The engine file is this:

Code: Select all
<?xml version="1.0"?>
<!--
  File:     Isotta-Fraschini-Asso500.xml
  Author:   Aero-Matic v 0.82

  Inputs:
    name:           Isotta-Fraschini-Asso500
    type:           piston
    power:          777.78 hp
    augmented?      no
    injected?       no
-->

<piston_engine name="Isotta-Fraschini-Asso500">
  <minmp unit="INHG">          6.0 </minmp>
  <maxmp unit="INHG">         28.5 </maxmp>
  <displacement unit="IN3"> 1477.78 </displacement>
  <maxhp>        777.78 </maxhp>
  <cycles>         12.0 </cycles>
  <idlerpm>      700.0 </idlerpm>
  <maxrpm>      2800.0 </maxrpm>
  <maxthrottle>    1.0 </maxthrottle><!-- Deprecated -->
  <minthrottle>    0.1 </minthrottle><!-- Deprecated -->
  <sparkfaildrop>  0.1 </sparkfaildrop>
  <volumetric-efficiency> 0.85 </volumetric-efficiency>
 <!-- Optional items that affect engine performance -->
 <!-- Defining <bsfc> over-rides the built-in horsepower calculations -->
 <!--<bsfc>           0.45 </bsfc>-->
  <stroke unit="IN">  5.9  </stroke>
  <bore unit="IN">    5.51 </bore>
  <cylinders>         12.0  </cylinders>
  <compression-ratio> 5.5 </compression-ratio>
</piston_engine>


And the propeller file is this:

Code: Select all
<?xml version="1.0"?>
<!-- Generated by Aero-Matic v 1.1

     Inputs:
                horsepower: 777.78
                     pitch: fixed
            max engine rpm: 2800
        prop diameter (ft): 7.9166666666667

     Outputs:
              max prop rpm: 2370.06
                gear ratio:    1.18
                       Cp0: 0.093858
                       Ct0: 0.131401
       static thrust (lbs): 2051.89
-->

<propeller name="prop">
  <ixx>  10.00 </ixx>
  <diameter unit="IN">  95.0 </diameter>
  <numblades> 4 </numblades>
  <gearratio>  1.18 </gearratio>
  <p_factor>   7.51 </p_factor>

  <table name="C_THRUST" type="internal">
     <tableData>
       0.0   0.1432
       0.1   0.1373
       0.2   0.1314
       0.3   0.1209
       0.4   0.1085
       0.5   0.0957
       0.6   0.0774
       0.7   0.0587
       0.8   0.0318
       1.0  -0.0108
       1.2  -0.0564
       1.4  -0.1014
     </tableData>
  </table>


  <table name="C_POWER" type="internal">
     <tableData>
       0.0   0.0962
       0.1   0.0962
       0.2   0.0939
       0.3   0.0916
       0.4   0.0863
       0.5   0.0791
       0.6   0.0726
       0.7   0.0610
       0.8   0.0498
       1.0   0.0178
       1.2  -0.0284
       1.4  -0.0856
       1.6  -0.1453
     </tableData>
  </table>

<!-- thrust effects of helical tip Mach -->
<table name="CT_MACH" type="internal">
  <tableData>
    0.85   1.0
    1.05   0.8
  </tableData>
</table>


What is the solution?
abassign
 
Posts: 809
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: Autostart piston engine in JSBSim

Postby sanhozay » Mon May 02, 2016 12:14 am

I'd guess you need to select the fuel tank? (consumables/fuel/tank[0]/selected)
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: Autostart piston engine in JSBSim

Postby erik » Mon May 02, 2016 3:56 pm

I think you need to specify the initial amount of fuel just the below <engines> section:

Code: Select all
 <consumables>
  <fuel> <!-- 13365 litres -->
   <tank n="0">
    <level-gal_us archive="y">497.0715</level-gal_us>
   </tank>
  </fuel>
 </consumables>
erik
 
Posts: 1520
Joined: Thu Nov 01, 2007 1:41 pm

Re: Autostart piston engine in JSBSim

Postby Thorsten » Mon May 02, 2016 5:17 pm

At least for my rocket engines, it actually works fine if the tank content is specified in the JSBSim config file

Code: Select all
<tank type="FUEL" number="0">
     <location unit="IN">
       <x> 181.11 </x>
       <y>   0.0 </y>
       <z>   0.0 </z>
     </location>
     <capacity unit="LBS"> 283.59 </capacity>
     <contents unit="LBS"> 141.79 </contents>
  </tank>


should result in a half-full tank without the need to set any consumables.
Thorsten
 
Posts: 11106
Joined: Mon Nov 02, 2009 8:33 am

Re: Autostart piston engine in JSBSim

Postby daveculp » Tue May 03, 2016 6:44 pm

I just checked the autostart process with my A-1H Skyraider and it works well. I think the problem might be (I don't have time today to inspect the code) that some controls need to be set in the "controls" node, otherwise the values you set may be overwritten when the controls initialize. I use:

Code: Select all
<controls>
  <engines>
    <engine n="0">
      <magnetos>3</magnetos>
      <propeller-pitch>1.0</propeller-pitch>
      <mixture>1.0</mixture>
    </engine>
  </engines>
</controls>


... and later ...

Code: Select all
<engines>
  <engine n="0">
    <rpm type="double">600.0</rpm>
    <running type="bool">true</running>
  </engine>
</engines>
User avatar
daveculp
 
Posts: 503
Joined: Sun Feb 24, 2013 1:50 am
Location: Las Vegas, USA
Callsign: DCulp
Version: 2017.3.1
OS: Ubuntu 17.10

Re: Autostart piston engine in JSBSim

Postby abassign » Tue May 03, 2016 9:06 pm

daveculp wrote in Tue May 03, 2016 6:44 pm:I just checked the autostart process with my A-1H Skyraider and it works well. I think the problem might be (I don't have time today to inspect the code) that some controls need to be set in the "controls" node, otherwise the values you set may be overwritten when the controls initialize. I use:


David thank, work perfect!

This is may code (your code I put in the end)

Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>

<PropertyList include="Piaggio-PC7-common.xml">
 
  <sim>
   
    <description>Piaggio Pegna PC7 (JSBSim)</description>
   
    <tags>
      <tag>Piaggio Pegna PC7</tag>
      <tag>Single Engine</tag>
      <tag>Motor</tag>
    </tags>
   
    <author>Hideaki Ozawa (3D), Adriano Bassignana (FDM)</author>
    <status>alpha</status>
    <aircraft-version>0.1</aircraft-version>
   
    <rating>
      <FDM type="int">     1 </FDM>
      <systems type="int"> 0 </systems>
      <cockpit type="int"> 1 </cockpit>
      <model type="int">   4 </model>
    </rating>
   
    <flight-model>jsb</flight-model>
    <!-- JSBSim start file -->
    <aero>Piaggio-PC7-JSBSim</aero>
   
    <model>
      <path>Aircraft/Piaggio-PC7/Models/Piaggio-PC7.xml</path>
    </model>
   
    <startup>
      <splash-texture>Aircraft/Piaggio-PC7/Piaggio-PC7.png</splash-texture>
    </startup>
   
    <menubar include="Dialogs/Piaggio-PC7.xml"/>
   
    <sound>
      <path type="string">Aircraft/Piaggio-PC7/Sounds/Piaggio-PC7-Sound.xml</path>
    </sound>
   
  </sim>
 
  <controls>
    <engines>
      <engine n="0">
   <magnetos>3</magnetos>
   <propeller-pitch>1.0</propeller-pitch>
   <mixture>1.0</mixture>
      </engine>
    </engines>
  </controls>
 
  <engines>
    <engine n="0">
      <rpm type="double">600.0</rpm>
      <running type="bool">true</running>
    </engine>
  </engines>
 
</PropertyList>


And now when start the program, the motor is running. This is a very good condition for the test fly with this new airplane.

Grazie David :)
abassign
 
Posts: 809
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x


Return to Systems

Who is online

Users browsing this forum: No registered users and 3 guests