1. printf problem (???)

TO: Euphoria society...---...,INTERNET:euphoria at miamiu.acs.muohio.edu
   =


-------- Forwarded Message -------- =




>From:    Karlheinz Nester <Karlheinz_Nester at COMPUSERVE.COM>
>Subject: Help on converting to EUPHORIA
>
>   printf(1," %-1s %5.2f",{m[z][con]),f[4]/1000})  (concat X1 and X2)
                                     ^ --> unexpected ')', expecting '}'

delete the ) and it should run fine. (?)
-----------------------------------------------------------------------
< To the helpful Euphorian responding to my help message,

< sorry, the ")" is a typing error.The combination doesn't work.
< The two calls have to be seperated,seems that I can't form this
< type of printf.
< is there hope to use this "construct" ?? =

< TIA Karlheinz (Charlie)
< here the running version : =

-- motasy.ex 23.6.98 Test concat printf
-------------------------------------------------------------------------=
-
sequence f,m
integer quantity
constant P2 =3D 1,U =3D 2,I =3D 3,pf =3D 4,n =3D 5,fn =3D 6,con =3D 7
-------------------------------------------------------------------------=
--
clear_screen()
-------------------------------------------------------------------------=
--
function acs(atom c)   -- arccosinus in radians
  return  1.5708 - 2 * arctan(c/(1 + sqrt(1 - c * c)))
end function
-------------------------------------------------------------------------=
--
m=3D{   -- nameplate data
   {3  ,380,6.9 ,0.84,960,50,"w"},
   {4  ,380,8.8 ,0.84,960,50,"w"},
   {5.5,380,11.5,0.85,960,50,"w"},
   {7.5,380,15.6,0.85,960,50,"w"},
   {11 ,380,22.5,0.86,960,50,"w"},
   {15 ,380,30  ,0.86,960,50,"w"}
  }
puts(1,"  3-phase Induction motors \n")
puts(1,"  P2   nn    Un  fn  pf    I     con  Q      T      S     eff\n")=

puts(1,"  kW   RPM   V   Hz   %    A          kvar   Nm     kVA    %\n\n"=
)

quantity =3D 6

for z =3D 1 to quantity do
f=3D{      -- formulas
   {sqrt(3) * m[z][U] * m[z][I] * m[z][pf]},             -- P1
   {sqrt(3) * m[z][U] * m[z][I]},                        -- apparent powe=
r
   {m[z][P2] /(sqrt(3) * m[z][U] * m[z][I] * m[z][pf])}, -- efficiency
   {sqrt(3) * m[z][U] * m[z][I] * sin(acs(m[z][pf]))},   -- reactive powe=
r
   {(m[z][P2] * 1000) / (0.1045 * m[z][n])}              -- nominal torqu=
e
  }
   printf(1," %5.2f %-4.0f ",{m[z][P2],m[z][n]})         -- P2 , nn
   printf(1," %-3.0f %2.0f ",{m[z][U],m[z][fn]})         -- Un , fn
   printf(1," %-2.2f %6.2f ",{m[z][pf],m[z][I]})         -- pf , I
-- printf(1," %-1s %5.2f ",{m[z][con],f[4]/1000}) f[4].. always 0.00 !
 printf(1," %-1s ",m[z][con])                            -- con O.K
 printf(1," %5.2f ",f[4]/1000)                           -- Q   O.K
   printf(1," %6.2f ",f[5])                              -- mn
   printf(1," %5.2f ",f[2]/1000)                         -- S
   printf(1," %-3.2f\n",f[3] * 100000)                   -- eff
end for
-------------------------------------------------------------------------=
--
  =



 =



 =

new topic     » topic index » view message » categorize

2. printf problem (???)

From:    Karlheinz Nester
Subject: printf problem (???)

> The two calls have to be seperated,seems that I can't form this
> type of printf.
> is there hope to use this "construct" ??

     Indeed, there is hope.  I stuck a ? f[4] statement in there
just to see what was happening.  The number showed up properly, but
f[4] is not an atom, it is a sequence with a length of 1 containing
an atom.  Try this:

    printf(1," %-1s %5.2f ",{m[z][con],f[4][1]/1000})

You'll notice that is consistent with your other lines, which
subscript f twice.

   Incidentally, using printf() to display a sequence formatted
as a number always results in 0.00, I think...

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu