1
0
Fork 0

c172p updates

removed action-sim.nas
+ nose gear scissor animation computation now via interpolation xml
+ main gear rotation due to compression now via interpolation xml
+ moved NAV0 and NAV1 needle deflection filters to pseudo-autopilot xml
+ moved pannel and instrument lights control to light.nas
+ the remaining tank setlisteners are now in tank.nas

pa24-250 updates
+ landing light animation now modeled after pa22 landing lights
This commit is contained in:
Dave Perry 2011-02-13 14:19:17 -07:00
parent 93f55e6926
commit 08463481c9
8 changed files with 266 additions and 149 deletions

View file

@ -0,0 +1,87 @@
<PropertyList>
<entry>
<ind>0.000</ind>
<dep>0.000</dep>
</entry>
<entry>
<ind>0.050</ind>
<dep>2.799</dep>
</entry>
<entry>
<ind>0.100</ind>
<dep>5.504</dep>
</entry>
<entry>
<ind>0.150</ind>
<dep>8.130</dep>
</entry>
<entry>
<ind>0.200</ind>
<dep>10.688</dep>
</entry>
<entry>
<ind>0.250</ind>
<dep>13.187</dep>
</entry>
<entry>
<ind>0.300</ind>
<dep>15.637</dep>
</entry>
<entry>
<ind>0.350</ind>
<dep>18.044</dep>
</entry>
<entry>
<ind>0.400</ind>
<dep>20.415</dep>
</entry>
<entry>
<ind>0.450</ind>
<dep>22.755</dep>
</entry>
<entry>
<ind>0.500</ind>
<dep>25.068</dep>
</entry>
<entry>
<ind>0.550</ind>
<dep>27.360</dep>
</entry>
<entry>
<ind>0.600</ind>
<dep>29.635</dep>
</entry>
<entry>
<ind>0.650</ind>
<dep>31.896</dep>
</entry>
<entry>
<ind>0.700</ind>
<dep>34.147</dep>
</entry>
<entry>
<ind>0.750</ind>
<dep>36.393</dep>
</entry>
<entry>
<ind>0.800</ind>
<dep>38.635</dep>
</entry>
<entry>
<ind>0.850</ind>
<dep>40.878</dep>
</entry>
<entry>
<ind>0.900</ind>
<dep>43.126</dep>
</entry>
<entry>
<ind>0.950</ind>
<dep>45.381</dep>
</entry>
<entry>
<ind>1.000</ind>
<dep>47.647</dep>
</entry>
</PropertyList>

View file

@ -0,0 +1,87 @@
<?xml version = '1.0' encoding = 'UTF-8' ?>
<PropertyList>
<entry>
<ind>0.000</ind>
<dep>0.000</dep>
</entry>
<entry>
<ind>0.050</ind>
<dep>1.305</dep>
</entry>
<entry>
<ind>0.100</ind>
<dep>2.583</dep>
</entry>
<entry>
<ind>0.150</ind>
<dep>3.836</dep>
</entry>
<entry>
<ind>0.200</ind>
<dep>5.067</dep>
</entry>
<entry>
<ind>0.250</ind>
<dep>6.276</dep>
</entry>
<entry>
<ind>0.300</ind>
<dep>7.467</dep>
</entry>
<entry>
<ind>0.350</ind>
<dep>8.639</dep>
</entry>
<entry>
<ind>0.400</ind>
<dep>9.794</dep>
</entry>
<entry>
<ind>0.450</ind>
<dep>10.934</dep>
</entry>
<entry>
<ind>0.500</ind>
<dep>12.059</dep>
</entry>
<entry>
<ind>0.550</ind>
<dep>13.171</dep>
</entry>
<entry>
<ind>0.600</ind>
<dep>14.270</dep>
</entry>
<entry>
<ind>0.650</ind>
<dep>15.357</dep>
</entry>
<entry>
<ind>0.700</ind>
<dep>16.433</dep>
</entry>
<entry>
<ind>0.750</ind>
<dep>17.498</dep>
</entry>
<entry>
<ind>0.800</ind>
<dep>18.554</dep>
</entry>
<entry>
<ind>0.850</ind>
<dep>19.601</dep>
</entry>
<entry>
<ind>0.900</ind>
<dep>20.639</dep>
</entry>
<entry>
<ind>0.950</ind>
<dep>21.668</dep>
</entry>
<entry>
<ind>1.000</ind>
<dep>22.691</dep>
</entry>
</PropertyList>

View file

@ -2286,8 +2286,8 @@
<animation>
<type>rotate</type>
<object-name>TopLink</object-name>
<property>gear/gear[0]/compression-rotation-deg</property>
<factor>-1</factor>
<property>gear/gear[0]/compression-norm</property>
<factor>3.0</factor>
<center>
<x-m>-0.95412</x-m>
<y-m>0.0</y-m>
@ -2295,16 +2295,17 @@
</center>
<axis>
<x>0.0</x>
<y>1.0</y>
<y>-1.0</y>
<z>0.0</z>
</axis>
<interpolation include="GearScissorInterpolation.xml"/>
</animation>
<animation>
<type>rotate</type>
<object-name>BottomLink</object-name>
<property>gear/gear[0]/compression-rotation-deg</property>
<factor>1</factor>
<property>gear/gear[0]/compression-norm</property>
<factor>3.0</factor>
<center>
<x-m>-1.02349</x-m>
<y-m>0.0</y-m>
@ -2315,6 +2316,7 @@
<y>1.0</y>
<z>0.0</z>
</axis>
<interpolation include="GearScissorInterpolation.xml"/>
</animation>
<animation>
@ -2322,8 +2324,7 @@
<object-name>fairing3</object-name>
<object-name>RightWheelStrut</object-name>
<object-name>RightWheel</object-name>
<property>gear/gear[2]/compression-rotation-deg</property>
<factor>1.0</factor>
<property>gear/gear[2]/compression-norm</property>
<center>
<x-m>0.711</x-m>
<y-m>0.4518</y-m>
@ -2334,6 +2335,7 @@
<y>0.0</y>
<z>0.0</z>
</axis>
<interpolation include="MainRotationInterpolation.xml"/>
</animation>
<animation>
@ -2341,18 +2343,18 @@
<object-name>fairing2</object-name>
<object-name>LeftWheelStrut</object-name>
<object-name>LeftWheel</object-name>
<property>gear/gear[1]/compression-rotation-deg</property>
<factor>-1.0</factor>
<property>gear/gear[1]/compression-norm</property>
<center>
<x-m>0.711</x-m>
<y-m>-0.4518</y-m>
<z-m>-0.70</z-m>
</center>
<axis>
<x>1.0</x>
<x>-1.0</x>
<y>0.0</y>
<z>0.0</z>
</axis>
<interpolation include="MainRotationInterpolation.xml"/>
</animation>
<!--Lights-->

View file

@ -1,137 +0,0 @@
##
# action-sim.nas Updates various simulated features every frame
##
# Initialize local variables
var H = nil;
var L = nil;
var phi = nil;
var C = nil;
# set up filters for these actions
var cdi0_lowpass = aircraft.lowpass.new(0.5);
var cdi1_lowpass = aircraft.lowpass.new(0.5);
var gs0_lowpass = aircraft.lowpass.new(0.5);
var gs1_lowpass = aircraft.lowpass.new(0.5);
# Properties
var propNav0 = props.globals.getNode("instrumentation/nav[0]", 1);
var propNav1 = props.globals.getNode("instrumentation/nav[1]", 1);
var navLights = props.globals.getNode("controls/lighting/nav-lights", 1);
var instrumentsNorm = props.globals.getNode("controls/lighting/instruments-norm", 1);
var instrumentLightFactor = props.globals.getNode("sim/model/material/instruments/factor", 1);
var panelLights = props.globals.getNode("controls/lighting/panel-norm", 1);
var dhN_ft = props.globals.getNode("gear/gear[0]/compression-ft", 1);
var dhR_ft = props.globals.getNode("gear/gear[2]/compression-ft", 1);
var dhL_ft = props.globals.getNode("gear/gear[1]/compression-ft", 1);
var propGear0 = props.globals.getNode("gear/gear[0]", 1);
var propGear1 = props.globals.getNode("gear/gear[1]", 1);
var propGear2 = props.globals.getNode("gear/gear[2]", 1);
# Associate Nodes
var cdiNAV0 = propNav0.getNode("heading-needle-deflection", 1);
var cdiNAV1 = propNav1.getNode("heading-needle-deflection", 1);
var gsNAV0 = propNav0.getNode("gs-needle-deflection-norm", 1);
var gsNAV1 = propNav1.getNode("gs-needle-deflection-norm", 1);
var filteredCDI0 = propNav0.getNode("filtered-cdiNAV0-deflection", 1);
var filteredCDI1 = propNav1.getNode("filtered-cdiNAV1-deflection", 1);
var filteredGS0 = propNav0.getNode("filtered-gsNAV0-deflection", 1);
var filteredGS1 = propNav1.getNode("filtered-gsNAV1-deflection", 1);
var nose_link_rot = propGear0.getNode("compression-rotation-deg", 1);
var left_main_rot = propGear1.getNode("compression-rotation-deg", 1);
var right_main_rot = propGear2.getNode("compression-rotation-deg", 1);
var init_actions = func {
filteredCDI0.setDoubleValue(0.0);
filteredCDI1.setDoubleValue(0.0);
filteredGS0.setDoubleValue(0.0);
filteredGS1.setDoubleValue(0.0);
# Make sure that init_actions is called when the sim is reset
setlistener("sim/signals/reset", init_actions);
# Request that the update fuction be called next frame
settimer(update_actions, 0);
}
var update_actions = func {
# Note: R2D and FT2M are unit conversion factors defined in $FG_ROOT/Nasal/globals.nas
# R2D (radians to degrees) FT2M (feet to meters)
##
# Compute the scissor link angles due to nose strut compression
##
var theta = 0.0;
# Compute the angle the nose gear scissor rotates due to nose gear strut compression
H = 0.240626; # Nose gear oleo strut extended length in m
L = 0.194716; # Nose gear scissor length in m
phi = 0.666058;
C = dhN_ft.getValue()*FT2M;
if (C > 0.0) {
theta = scissor_angle(H,C,L,phi)*R2D;
}
# Compute compression induced main gear rotations
#
# constants
var R_m = 0.919679;
var h0 = 0.63872;
var theta0_rad = 0.803068;
# Right main
var delta_h = dhR_ft.getValue()*FT2M;
var right_alpha_deg = ( math.acos( (h0 - delta_h)/R_m ) - theta0_rad )*R2D;
# Left main
var delta_h = dhL_ft.getValue()*FT2M;
var left_alpha_deg = ( math.acos( (h0 - delta_h)/R_m ) - theta0_rad )*R2D;
# Outputs
instrumentLightFactor.setDoubleValue(instrumentsNorm.getValue());
panelLights.setDoubleValue(instrumentsNorm.getValue());
filteredCDI0.setDoubleValue( cdi0_lowpass.filter(cdiNAV0.getValue()));
filteredCDI1.setDoubleValue(cdi1_lowpass.filter(cdiNAV1.getValue()));
filteredGS0.setDoubleValue(gs0_lowpass.filter(gsNAV0.getValue()));
filteredGS1.setDoubleValue(gs1_lowpass.filter(gsNAV1.getValue()));
nose_link_rot.setDoubleValue(theta);
right_main_rot.setDoubleValue(right_alpha_deg);
left_main_rot.setDoubleValue(left_alpha_deg);
settimer(update_actions, 0);
}
var scissor_angle = func(H,C,L,phi) {
var a = (H - C)/2/L;
# Use 2 iterates of Newton's method and 4th order Taylor series to
# approximate theta where sin(phi - theta) = a
var theta = phi - 2*a/3 - a/3/(1-a*a/2);
return theta;
}
# Setup listener call to start update loop once the fdm is initialized
#
setlistener("sim/signals/fdm-initialized", init_actions);
#
# Listeners to tie the /consumables/fuels/tank[]/selected to
# /fdm/jsbsim/propulsion/tank[]/priority
setlistener("consumables/fuel/tank[0]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[0]/priority", selected.getBoolValue() ? 1 : 0);
});
setlistener("consumables/fuel/tank[1]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[1]/priority", selected.getBoolValue() ? 1 : 0);
});

View file

@ -5,4 +5,26 @@ aircraft.light.new("sim/model/c172p/lighting/strobes", [0.015, 1.985], strobe_sw
# beacons ===========================================================
var beacon_switch = props.globals.getNode("controls/lighting/beacon", 1);
aircraft.light.new("sim/model/c172p/lighting/beacon-top", [0.10, 0.90], beacon_switch);
aircraft.light.new("sim/model/c172p/lighting/beacon-top", [0.10, 0.90], beacon_switch);
# Control both panel and instrument light intensity with one property
var instrumentsNorm = props.globals.getNode("controls/lighting/instruments-norm", 1);
var instrumentLightFactor = props.globals.getNode("sim/model/material/instruments/factor", 1);
var panelLights = props.globals.getNode("controls/lighting/panel-norm", 1);
var update_intensity = func {
instrumentLightFactor.setDoubleValue(instrumentsNorm.getValue());
panelLights.setDoubleValue(instrumentsNorm.getValue());
settimer(update_intensity, 0);
}
# Setup listener call to start update loop once the fdm is initialized
#
setlistener("sim/signals/fdm-initialized", update_intensity);
# Make sure that update_intensity is called when the sim is reset
setlistener("sim/signals/reset", update_intensity);

View file

@ -0,0 +1,12 @@
#
# Listeners to tie the /consumables/fuels/tank[]/selected to
# /fdm/jsbsim/propulsion/tank[]/priority
setlistener("consumables/fuel/tank[0]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[0]/priority", selected.getBoolValue() ? 1 : 0);
});
setlistener("consumables/fuel/tank[1]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[1]/priority", selected.getBoolValue() ? 1 : 0);
});

View file

@ -0,0 +1,40 @@
<PropertyList>
<filter>
<name>CDI0 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[0]/heading-needle-deflection</input>
<output>instrumentation/nav[0]/filtered-cdiNAV0-deflection</output>
</filter>
<filter>
<name>CDI1 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[1]/heading-needle-deflection</input>
<output>instrumentation/nav[1]/filtered-cdiNAV1-deflection</output>
</filter>
<filter>
<name>GS0 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[0]/gs-needle-deflection-norm</input>
<output>instrumentation/nav[0]/filtered-gsNAV0-deflection</output>
</filter>
<filter>
<name>GS1 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[1]/gs-needle-deflection-norm</input>
<output>instrumentation/nav[1]/filtered-gsNAV1-deflection</output>
</filter>
</PropertyList>

View file

@ -71,6 +71,10 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<autopilot>
<path>Aircraft/c172p/Systems/KAP140.xml</path>
</autopilot>
<autopilot>
<name>NAV-GS-needle-Filters</name>
<path>Aircraft/c172p/Systems/NAVandGSfilters.xml</path>
</autopilot>
<electrical>
<!-- null electrical system path here so we can use a nasal based -->
<!-- model defined later in the nasal section of this file. -->
@ -169,7 +173,7 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<file>Aircraft/c172p/Nasal/immat.nas</file>
<file>Aircraft/c172p/Nasal/doors.nas</file>
<file>Aircraft/c172p/Nasal/light.nas</file>
<file>Aircraft/c172p/Nasal/action-sim.nas</file>
<file>Aircraft/c172p/Nasal/tanks.nas</file>
<file>Aircraft/c172p/Nasal/ki266.nas</file>
<script><![CDATA[
ki266.new(0);