<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
<debug>true</debug>
<!-- limit time step -->
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/delta-sec</output>
<input>
<property>/sim/time/delta-sec</property>
</input>
<max>0.05</max>
</filter>
<!-- fuselage z (up) acceleration in m/s^2
we get -g in unaccelerated flight, and large negative numbers on touchdown -->
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/a_f</output>
<input>
<expression>
<product>
<property>/accelerations/pilot/z-accel-fps_sec</property>
<value>0.3048</value> <!-- FT2M -->
</product>
</expression>
</input>
</filter>
<!--
# compute total mass of one wing, using the average fuel mass in both wing tanks.
# The averaging factor 0.5 is lumped into fuel_frac_on_2
me.m = me.m_dw + me.fuel_frac_on_2 * (getprop(me.fuel_node_left) + getprop(me.fuel_node_right));
-->
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/m</output>
<input>
<expression>
<sum>
<property>/a/m_dw</property>
<product>
<property>/a/fuel_frac_on_2</property>
<sum>
<property>/consumables/fuel/tank/level-kg</property>
<property>/consumables/fuel/tank[1]/level-kg</property>
</sum>
</product>
</sum>
</expression>
</input>
</filter>
<!-- lift force. Convert to N and use 1/2 (one wing only) -->
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/F_l</output>
<input>
<expression>
<product>
<property>/fdm/jsbsim/forces/fbz-aero-lbs</property>
<product>
<property>/environment/gravitational-acceleration-mps2</property>
<value>0.226796</value> <!-- LB2KG / 2-->
</product>
</product>
</expression>
</input>
</filter>
<!-- z_ofs = getprop("/environment/gravitational-acceleration-mps2") * me.m_dw / me.k; -->
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/z-ofs</output>
<input>
<expression>
<div>
<product>
<property>/environment/gravitational-acceleration-mps2</property>
<property>/a/m_dw</property>
</product>
<property>/a/k</property>
</div>
</expression>
</input>
</filter>
<!--
me.z = (2.*me.z1 - me.z2 + dt * ( (me.d * me.z1 - dt * (F_l + me.k * me.z1)) / me.m + dt *
a_f)) / (1. + me.d * dt / me.m);
-->
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/z</output>
<input>
<expression>
<div>
<sum>
<difference>
<product>
<value>2.</value>
<property>/a/z1</property>
</product>
<property>/a/z2</property>
</difference>
<product>
<property>/a/delta-sec</property>
<sum>
<div>
<difference>
<product>
<property>/a/d</property>
<property>/a/z1</property>
</product>
<product>
<property>/a/delta-sec</property>
<sum>
<property>/a/F_l</property>
<product>
<property>/a/k</property>
<property>/a/z1</property>
</product>
</sum>
</product>
</difference>
<property>/a/m</property>
</div>
<product>
<property>/a/delta-sec</property>
<property>/a/a_f</property>
</product>
</sum>
</product>
</sum>
<sum>
<value>1.</value>
<product>
<property>/a/d</property>
<div>
<property>/a/delta-sec</property>
<property>/a/m</property>
</div>
</product>
</sum>
</div>
</expression>
</input>
</filter>
<!--
z2 = z1
z1 = z
z-m = z + z_ofs
-->
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/z2</output>
<input>
<property>/a/z1</property>
</input>
</filter>
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/a/z1</output>
<input>
<property>/a/z</property>
</input>
</filter>
<filter>
<type>gain</type>
<gain>1.</gain>
<output>/sim/model/wing-flex/z-m</output>
<input>
<expression>
<sum>
<property>/a/z</property>
<property>/a/z-ofs</property>
</sum>
</expression>
</input>
</filter>
</PropertyList>
<PropertyList>
<a include="Systems/wingflexer-params.xml"/>
<sim>
<systems>
<property-rule n="100">
<name>wing flexer property rule</name>
<path>Systems/wingflexer.xml</path>
</property-rule>
</systems>
<sim>
Johan G wrote in Mon Jan 26, 2015 10:54 pm:Doing it using property rules has a few great advantages, in particular doing it at FDM rate
our beloved wiki wrote:The FlightGear xml based autopilot system can run at FDM rate or at frame rate. Using a <autopilot> tag in your aircraft's -set.xml adds the autopilot at FDM rate, using a <property-rule> runs the same configuration at frame rate.
and without being affected by Nasals garbage collection. I suspect it will also work better with reset and re-init.
As for doing it somewhere else than in /sim/systems the only thing I can think of is try and see.
Hooray wrote in Tue Jan 27, 2015 6:40 pm:property rules don't run at FDM rate, they run at frame rate, quoting the wiki...
1. I'm using the gain filter to compute /some/property = f(/some/other/property). Is there a better way?
2. Is there something like listeners (as in Nasal) for stuff that rarely ever changes?
3. Can I load the PropertyList to a path other than /sim/systems? E.g., to /sim/model/wingflexer?
BTW, adding the file as a property-rule let the filters run at frame rate. Use <autopilot> instead of <property-rule> and updates happen at FDM rate.
Not very self explaining, I admit. It's a tribute to history.
radi wrote in Wed Jan 28, 2015 10:57 am:Indeed, it's overkill and not very readable. So a new filter that integrates z" + a z' + b z = c would make things a lot easier. I'll look into that -- where in SG/FG should I look first?
Users browsing this forum: No registered users and 3 guests