Search the archive:
YaBB - Yet another Bulletin Board
 
   
 
Page Index Toggle Pages: 1
Send Topic Print
makemdl code (Read 380 times)
Jan 21st, 2011 at 3:12am

rich1959   Offline
Colonel
I Like Flight Simulation!

Posts: 15
*****
 
Hi all
  A new kid on the block. so thought I would say hi.and see if I could  find
a little help or a pointed in the right way.
this is a default makemdl.xml code.that I would like to control with
THROTTLE POSITION. I only want it to work the first 20%.
I only want workable suggestion so I can learn to put it togather,
that my way learning Wink

            Rich







- <part>
  <name>engine_rocker_arm</name>
- <animation>
- <parameter>
- <code>
  (A:GENERAL ENG ELAPSED TIME:1,RPM) (A:GENERAL ENG RPM:1,RPM) * 100 %
- <!--
                (A:PROP RPM:1,RPM) 60 / (A:GENERAL ENG ELAPSED TIME, millisecond) * 100 %
                (A:PROP RPM:1,RPM) 60 / (E:ABSOLUTE TIME, second) * 100 %
                (A:GENERAL ENG ELAPSED TIME:1,RPM) 60 / (E:ABSOLUTE TIME, second) * 100 %


  -->
  </code>
  </parameter>
  </animation>
  </part>
 
IP Logged
 
Reply #1 - Jan 21st, 2011 at 3:44am

JakesF14   Offline
Colonel
Blistering Barnacles!
South Africa

Gender: male
Posts: 1866
*****
 
Hi,
From what I understand, you want to make your engine Rocker only animate (work) when the throttle is 20% and less?

I am not an xml expert, but try this: I haven't test it:

Rename your part to Rocker01, and then in your MakeMDLparts.xml, add this script:

Code:
<part>
      <name>rocker01</name>
      <animation>
         <parameter>
            <code>
                (A:GENERAL ENG ELAPSED TIME:1,RPM) (A:GENERAL ENG RPM:1,RPM) * 100 %
                (A:PROP RPM:1,RPM) 60 / (A:GENERAL ENG ELAPSED TIME, millisecond) * 100 %
                (A:PROP RPM:1,RPM) 60 / (E:ABSOLUTE TIME, second) * 100 %
                (A:GENERAL ENG ELAPSED TIME:1,RPM) 60 / (E:ABSOLUTE TIME, second) * 100 %
		(A:GENERAL ENG THROTTLE LEVER POSITION, percent) 20 &lt;
            </code>
         </parameter>
      </animation>
   </part> 



Hope it work. let me know, if it don't work, I can try and figure out something else.

enjoy!
 

...
IP Logged
 
Reply #2 - Jan 22nd, 2011 at 3:50am

rich1959   Offline
Colonel
I Like Flight Simulation!

Posts: 15
*****
 
Hi JakesF14
   thanks for the come back. your code stared me thinking in
a different way. I found a line of code in make mdl, and with a little tweaking, it is working it start and stop with throttle
position. the only thing is it work in REVERSE.and I can not
reverse it. I do need some Help



   <part>
      <name>rocker01</name>
       <animation>
         <parameter>
            <code>
                (A:GENERAL ENG ELAPSED TIME:1,RPM) (A:GENERAL ENG RPM:1,RPM) * 15 %
                (A:GENERAL ENG THROTTLE LEVER POSITION:1, part) s0 0 &gt;= if{ l0 * 50 + } els{ l0         
                
           </code>
         </parameter>
      </animation>
   </part>

   Rich
how did you put your code in a window

 
IP Logged
 
Reply #3 - Jan 22nd, 2011 at 2:24pm

Fr. Bill   Offline
Colonel
I used to have a life;
now I have GMax!
Hammond, IN

Gender: male
Posts: 962
*****
 
Your script is missing the final curly-brace to close the expression. To post using the code box, highlight your entry then click the
#
button on the editor's toolbar!
Code:
  <part>
      <name>rocker01</name>
       <animation>
         <parameter>
            <code>
                (A:GENERAL ENG ELAPSED TIME:1,RPM) (A:GENERAL ENG RPM:1,RPM) * 15 %
                (A:GENERAL ENG THROTTLE LEVER POSITION:1, part) s0 0 &gt;= if{ l0 * 50 + } els{ l0 }      
           </code>
         </parameter>
      </animation>
   </part>  

 

Bill
... Gauge Programming - 3d Modeling Eaglesoft Development Group Intel Core 2 Quad Q6600-4GB DDR2 Crucial PC6400-800 GB SATA-ATI Radeon HD2400 Pro 256MB DX10 NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
...
IP Logged
 
Reply #4 - Jan 23rd, 2011 at 3:07am

rich1959   Offline
Colonel
I Like Flight Simulation!

Posts: 15
*****
 
FR Bill
  thanks for tips but still no joy. the code works right and does what I want but in reverse,
it animate from about 30% to 100%. I need it to animate from 0% TO 20 OR 30% OF
The throttle lever.
I think the answer might be in the  s0  l0  code but any thing I tried did not work.
  thanks for you help
              Rich
Code:
  <part>
      <name>rocker01</name>
       <animation>
         <parameter>
            <code>
                (A:GENERAL ENG ELAPSED TIME:1,RPM) (A:GENERAL ENG RPM:1,RPM) * 15 %
                (A:GENERAL ENG THROTTLE LEVER POSITION:1, part) s0 0 &gt;= if{ l0 * 50 + } els{ l0 }
            </code>
         </parameter>
      </animation>
   </part>  


 
IP Logged
 
Reply #5 - Jan 24th, 2011 at 3:05am

JakesF14   Offline
Colonel
Blistering Barnacles!
South Africa

Gender: male
Posts: 1866
*****
 

Hey, How about trying the throttle position as percentage, like this:

Code:
<part>
      <name>rocker01</name>
       <animation>
         <parameter>
            <code>
                (A:GENERAL ENG ELAPSED TIME:1,RPM) (A:GENERAL ENG RPM:1,RPM) * 15 %
                (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) 30 &lt;
            </code>
         </parameter>
      </animation>
   </part>   



as said, I'm not a Boffin. Fr Bill is the master of XML coding!

 

...
IP Logged
 
Reply #6 - Jan 24th, 2011 at 3:15am

rich1959   Offline
Colonel
I Like Flight Simulation!

Posts: 15
*****
 
Hi
well I got it working by changing the word part to percent.
I would like to thank you both for your help
      RICH
Code:
  <part>
    <name>rocker01</name>
	<animation>
	   <parameter>
	    <code>
            (A:GENERAL ENG ELAPSED TIME:1,RPM) (A:GENERAL ENG RPM:1,RPM) * 15 %
            (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) s0 0 &gt;= if{ l0 * 50 + } els{ l0 }

           </code>
         </parameter>
       </animation>
   </part> 


 
IP Logged
 
Reply #7 - Jan 24th, 2011 at 6:11am

JakesF14   Offline
Colonel
Blistering Barnacles!
South Africa

Gender: male
Posts: 1866
*****
 
Pleasure! Im also most of the time active on fsworld.co.za chat function if you want a quicker answer.

Enjoy!
 

...
IP Logged
 
Reply #8 - Mar 1st, 2011 at 1:14am

rich1959   Offline
Colonel
I Like Flight Simulation!

Posts: 15
*****
 
HI Back for some more of that wonderfull help
   FATHER bill if you read this I WOULD LIKE TO SAY thanks YOU for your TUT
on center off switchs.

  I have 5 of them working, this one is a nose wheel Tiller control and by it self work
grat, but when I coupled it to the THROTTLES control gauge. It only see the down
cleck and missis the up cleck. and I have ran out of ideas

              Richard

    fs9, makemdl,  fsds351






Code:
   <part>
      <name>Tiller</name>
      <animation>
         <parameter>
         <code>50 (A:Rudder Position,enum) 50 * +</code>
            <lag>900</lag>
         </parameter>
      </animation>
        <mouserect>
            <cursor>Hand</cursor>
            <tooltip_text>Tiller_Left/Right_cleck</tooltip_text>                                                <mouse_flags>LeftSingle+RightSingle+LeftRelease+RightRelease+DownRepeat</mouse_flags>
            <callback_code>
                  (M:Event) 'LeftSingle' scmp 0 ==
                       if{ 1 (>A:Rudder Position, enum) (>K:RUDDER_LEFT) }
                 (M:Event) 'LeftRelease' scmp 0 ==
                       if{ 0 (>A:Rudder Position, enum) (>K:RUDDER_CENTER) }
                 (M:Event) 'RightSingle' scmp 0 ==
                       if{ -1 (>A:Rudder Position, enum) (>K:RUDDER_RIGHT) }
                 (M:Event) 'RightRelease' scmp 0 ==
                       if{ 0 (>A:Rudder Position, enum) (>K:RUDDER_CENTER) }
            </callback_code>
      </mouserect>
   </part>
 




Code:
<Gauge Name="db-THROTTLES2" Version="1.0">
   <Image Name="throttles_background.bmp"/>
   <Element>
      <Shift>
         <Value>(A:TAILWHEEL LOCK ON,bool) if{ g2 } (A:AIRSPEED INDICATED, Knots) 20 &gt; if{ g2 }  (A:Rudder deflection pct,percent) 4 / s0 2 &gt; if{ l0   2 - (A:General Eng2 Throttle Lever Position, percent) + 163 * (&gt;K:THROTTLE1_SET) g2 } l0 -2 &lt; if{ l0 /-/  2 - (A:General Eng1 Throttle Lever Position, percent) + 163 * (&gt;K:THROTTLE2_SET) g2 }:2 0</Value>
      </Shift>
   </Element>
</Gauge> 

 
IP Logged
 
Reply #9 - Mar 11th, 2011 at 3:37pm

Fr. Bill   Offline
Colonel
I used to have a life;
now I have GMax!
Hammond, IN

Gender: male
Posts: 962
*****
 
You can't modify A:variables!

1 (>A:Rudder Position, enum)

This will do nothing at all.

Did you mean to use:

1 (>L:Rudder Position, enum)
 

Bill
... Gauge Programming - 3d Modeling Eaglesoft Development Group Intel Core 2 Quad Q6600-4GB DDR2 Crucial PC6400-800 GB SATA-ATI Radeon HD2400 Pro 256MB DX10 NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
...
IP Logged
 
Reply #10 - Mar 13th, 2011 at 12:54am

rich1959   Offline
Colonel
I Like Flight Simulation!

Posts: 15
*****
 
HI fr. Bill
   thanks for the come back. Ok I changed the A to L and got a mix bag.
On the plus side the tiller wheel no longer follow my rudder pedals.
But minus side the tiller wheel moved like a toggle switch (on off )
with the A prefix, the tiller wheel follow the slow rudder Position.
so the sim is controling,  how this code works and is far more realest,
so I would perfer to keep the A prefix.

Rudder Position, is listed in Parameters.doc
The L prefix had no effect on how the Throttle gauge work.

also I tried (A:Rudder deflection pct,percent) the tiller didn't
work as well and no effect on how the Throttle gauge work

  So back to original question. when I try to used the Throttle control
gauge. It only reads the LeftSingle+RightSingle and does not read
LeftRelease+RightRelease. But if I tap the mouse button I just Release
the Throttle will return to idle.

New Question  Can one add a Condition to A 3 Position spring loaded switch?
if so, would you have a working model that I could used as a reference.


        thanks  RICH
 
IP Logged
 
Reply #11 - Mar 14th, 2011 at 12:07pm

Fr. Bill   Offline
Colonel
I used to have a life;
now I have GMax!
Hammond, IN

Gender: male
Posts: 962
*****
 
Everything listed in the "parameters.doc" file are read only variables. You cannot "set" or "control" read only variables. Period.

How you control stuff is listed in the "EventIDs.doc" file.

In simpler words, this: (>K:RUDDER_LEFT) controls this: (A:Rudder Position,percent), which is why the script you've tried actually did rotate with the rudder control.

I'm not clear on what any throttle position would have to do with either rudder control or tiller steering though!

Working examples of XML scripts are in the "Working XML Code Library..." forum at freeflight design:

http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?board=XML
 

Bill
... Gauge Programming - 3d Modeling Eaglesoft Development Group Intel Core 2 Quad Q6600-4GB DDR2 Crucial PC6400-800 GB SATA-ATI Radeon HD2400 Pro 256MB DX10 NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
...
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print