Board index FlightGear Development Aircraft Flight dynamics model

JSBSim switch won't work …  Topic is solved

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

Re: JSBSim switch won't work …

Postby S&J » Mon Sep 05, 2022 2:32 pm

I can't even do that.

When folk have an agenda, personal history has taught me that PM's have a habit of not being private.

But I'm sure those folk that PM'd you about me could help.
"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 switch won't work …

Postby TheEagle » Mon Sep 05, 2022 2:34 pm

Okay, if you think so … then send me an email to thefgfseagle(at)gmail(dot)com, please.
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 switch won't work …

Postby wkitty42 » Mon Sep 05, 2022 4:08 pm

TheEagle wrote in Mon Sep 05, 2022 12:39 pm:The problem was simply that I was first reading from feather-pos-norm (which was set before by JSBSim to the value of /controls/engines/engine/propeller-feather) and THEN writing to it - had I done it the other way around, it would have worked (and does now !). As always, a dumb mistake … sorry.

can we see (all of) the final code involved, please?
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: JSBSim switch won't work …

Postby TheEagle » Mon Sep 05, 2022 4:25 pm

If you spare me with your mandatory XKCD ! ;)
Code: Select all
      <fcs_function>
         <function>
            <ifthen>
               <property>propulsion/engine/reverser</property>
               <table>
                  <independentVar lookup="row">fcs/throttle-cmd-norm</independentVar>
                  <tableData>
                     0.28   -10.5
                     0.38   -0.5
                  </tableData>
               </table>
               <ifthen>
                  <property>fcs/feather-pos-norm</property>
                  <sum>
                     <property>propulsion/engine/blade-angle</property>
                     <product>
                        <property>simulation/channel-dt</property>
                        <value>10</value>
                     </product>
                  </sum>
                  <property>propulsion/engine/blade-angle</property>
               </ifthen>
            </ifthen>
         </function>
         <output>propulsion/engine/blade-angle</output>
         <clipto>
            <min>-10.5</min>
            <max>86</max>
         </clipto>
      </fcs_function>
      
      <switch>
         <default value="0"/>
         <test value="1">
            fcs/advance-cmd-norm LT 0.4
         </test>
         <output>/controls/engines/engine/propeller-feather</output>
      </switch>
      
      <switch>
         <default value="1"/>
         <test logic="OR" value="0">
            propulsion/engine[0]/reverser == 1
            fcs/feather-pos-norm == 1
         </test>
         <output>propulsion/engine[0]/constant-speed-mode</output>
      </switch>
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 switch won't work …

Postby wkitty42 » Mon Sep 05, 2022 4:45 pm

TheEagle wrote in Mon Sep 05, 2022 4:25 pm:If you spare me with your mandatory XKCD ! ;)

sure :lol:
so if i'm reading properly, the original code you were questioning was right and working properly? the problem was another block of code (that other switch?) being after the one you questioned when it should have been before the one you questioned?
Last edited by wkitty42 on Mon Sep 05, 2022 6:15 pm, edited 1 time in total.
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: JSBSim switch won't work …

Postby TheEagle » Mon Sep 05, 2022 5:19 pm

Yep, exactly ! Sometimes, the right sequence is critical …
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 switch won't work …

Postby wkitty42 » Mon Sep 05, 2022 6:16 pm

TheEagle wrote in Mon Sep 05, 2022 5:19 pm:Yep, exactly ! Sometimes, the right sequence is critical …

yep... logical flow is important... especially in top-down code formats...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Previous

Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 1 guest