1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andreas93 [3]
3 years ago
6

Create a C language program that can be used to construct any arbitrary Deterministic Finite Automaton corresponding to the FDA

definition above. a. Create structs for the: automaton, a state, and a transition. For example, the automaton should have a "states" field, which captures its set of states as a linked list.
Engineering
1 answer:
otez555 [7]3 years ago
5 0

Answer:

see the explanation

Explanation:

/* C Program to construct Deterministic Finite Automaton */

#include <stdio.h>

#include <DFA.h>

#include <stdlib.h>

#include <math.h>

#include <string.h>

#include <stdbool.h>

struct node{

struct node *initialStateID0;

struct node *presentStateID1;

};

printf("Please enter the total number of states:");

scanf("%d",&count);

//To create the Deterministic Finite Automata

DFA* create_dfa DFA(){

  q=(struct node *)malloc(sizeof(struct node)*count);

  dfa->initialStateID = -1;

  dfa->presentStateID = -1;

  dfa->totalNumOfStates = 0;

  return dfa;

}

//To make the next transition

void NextTransition(DFA* dfa, char c)

{

  int tID;

  for (tID = 0; tID < pPresentState->numOfTransitions; tID++){

       if (pPresentState->transitions[tID].condition(c))

      {

          dfa->presentStateID = pPresentState->transitions[tID].toStateID;

          return;

      }

  }

  dfa->presentStateID = pPresentState->defaultToStateID;

}

//To Add the state to DFA by using number of states

void State_add (DFA* pDFA, DFAState* newState)

{  

  newState->ID = pDFA->numOfStates;

  pDFA->states[pDFA->numOfStates] = newState;

  pDFA->numOfStates++;

}

void transition_Add (DFA* dfa, int fromStateID, int(*condition)(char), int toStateID)

{

  DFAState* state = dfa->states[fromStateID];

  state->transitions[state->numOfTransitions].toStateID = toStateID;

  state->numOfTransitions++;

}

void reset(DFA* dfa)

{

  dfa->presentStateID = dfa->initialStateID;

}

You might be interested in
What are some advantages of generating electrical energy from tides instead of from fossil fuels
harina [27]

Answer:

Efficent at low speeds.

Explanation:

Since water is 1,000 times more dense than air, electricity can generated from tides much more efficiently at slower speeds than wind turbines can.

7 0
3 years ago
Oil with a density of 800 kg/m3 is pumped from a pressure of 0.6 bar to a pressure of 1.4 bar, and the outlet is 3 m above the i
Naddik [55]

Answer:

23.3808 kW

20.7088 kW

Explanation:

ρ = Density of oil = 800 kg/m³

P₁ = Initial Pressure = 0.6 bar

P₂ = Final Pressure = 1.4 bar

Q = Volumetric flow rate = 0.2 m³/s

A₁ = Area of inlet = 0.06 m²

A₂ = Area of outlet = 0.03 m²

Velocity through inlet = V₁ = Q/A₁ = 0.2/0.06 = 3.33 m/s

Velocity through outlet = V₂ = Q/A₂ = 0.2/0.03 = 6.67 m/s

Height between inlet and outlet = z₂ - z₁ = 3m

Temperature to remains constant and neglecting any heat transfer we use Bernoulli's equation

\frac {P_1}{\rho g}+\frac{V_1^2}{2g}+z_1+h=\frac {P_2}{\rho g}+\frac{V_2^2}{2g}+z_2\\\Rightarrow h=\frac{P_2-P_1}{\rho g}+\frac{V_2^2-V_1^2}{2g}+z_2-z_1\\\Rightarrow h=\frac{(1.4-0.6)\times 10^5}{800\times 9.81}+\frac{6.67_2^2-3.33^2}{2\times 9.81}+3\\\Rightarrow h=14.896\ m

Work done by pump

W_{p}=\rho gQh\\\Rightarrow W_{p}=800\times 9.81\times 0.2\times 14.896\\\Rightarrow W_{p}=23380.8\ W

∴ Power input to the pump 23.3808 kW

Now neglecting kinetic energy

h=\frac{P_2-P_1}{\rho g}+z_2-z_1\\\Righarrow h=\frac{(1.4-0.6)\times 10^5}{800\times 9.81}+3\\\Righarrow h=13.19\ m\\

Work done by pump

W_{p}=\rho gQh\\\Rightarrow W_{p}=800\times 9.81\times 0.2\times 13.193\\\Rightarrow W_{p}=20708.8\ W

∴ Power input to the pump 20.7088 kW

6 0
3 years ago
A four-cylinder, four-stroke internal combustion engine has a bore of 3.7 in. and a stroke of 3.4 in. The clearance volume is 16
Bad White [126]

Answer:

the net work per cycle \mathbf{W_{net} = 0.777593696}  Btu per cycle

the power developed by the engine, W = 88.0144746 hp

Explanation:

the information given includes;

diameter of the four-cylinder bore = 3.7 in

length of the stroke = 3.4 in

The clearance volume = 16% = 0.16

The cylindrical volume V_2 = 0.16 V_1

the crankshaft N rotates at a speed of  2400 RPM.

At the beginning of the compression , temperature T_1 = 60 F = 519.67 R    

and;

Otto cycle with a pressure =  14.5 lbf/in² = (14.5 × 144 ) lb/ft²

= 2088 lb/ft²

The maximum temperature in the cycle is 5200 R

From the given information; the change in volume is:

V_1-V_2 = \dfrac{\pi}{4}D^2L

V_1-0.16V_1= \dfrac{\pi}{4}(3.7)^2(3.4)

V_1-0.16V_1= 36.55714291

0.84 V_1 =36.55714291

V_1 =\dfrac{36.55714291}{0.84 }

V_1 =43.52040823 \ in^3 \\ \\  V_1 = 43.52 \ in^3

V_1 = 0.02518 \ ft^3

the mass in air ( lb) can be determined by using the formula:

m = \dfrac{P_1V_1}{RT}

where;

R = 53.3533 ft.lbf/lb.R°

m = \dfrac{2088 \ lb/ft^2 \times 0.02518 \ ft^3}{53.3533 \ ft .lbf/lb.^0R  \times 519 .67 ^0 R}

m = 0.0018962 lb

From the tables  of ideal gas properties at Temperature 519.67 R

v_{r1} =158.58

u_1 = 88.62 Btu/lb

At state of volume 2; the relative volume can be determined as:

v_{r2} = v_{r1}  \times \dfrac{V_2}{V_1}

v_{r2} = 158.58 \times 0.16

v_{r2} = 25.3728

The specific energy u_2 at v_{r2} = 25.3728 is 184.7 Btu/lb

From the tables of ideal gas properties at maximum Temperature T = 5200 R

v_{r3} = 0.1828

u_3 = 1098 \ Btu/lb

To determine the relative volume at state 4; we have:

v_{r4} = v_{r3} \times \dfrac{V_1}{V_2}

v_{r4} =0.1828 \times \dfrac{1}{0.16}

v_{r4} =1.1425

The specific energy u_4 at v_{r4} =1.1425 is 591.84 Btu/lb

Now; the net work per cycle can now be calculated as by using the following formula:

W_{net} = Heat  \ supplied - Heat  \ rejected

W_{net} = m(u_3-u_2)-m(u_4 - u_1)

W_{net} = m(u_3-u_2- u_4 + u_1)

W_{net} = m(1098-184.7- 591.84 + 88.62)

W_{net} = 0.0018962 \times (1098-184.7- 591.84 + 88.62)

W_{net} = 0.0018962 \times (410.08)

\mathbf{W_{net} = 0.777593696}  Btu per cycle

the power developed by the engine, in horsepower. can be calculated as follows;

In the  four-cylinder, four-stroke internal combustion engine; the power developed by the engine can be calculated by using the expression:

W = 4 \times N'  \times W_{net

where ;

N' = \dfrac{2400}{2}

N' = 1200 cycles/min

N' = 1200 cycles/60 seconds

N' = 20 cycles/sec

W = 4 × 20 cycles/sec ×  0.777593696

W = 62.20749568 Btu/s

W = 88.0144746 hp

8 0
3 years ago
The vertical and horizontal poles at the traffic-light assembly are erected first. Determine the additional force and moment rea
konstantin123 [22]

Answer:

1. Az=258 lb

2. My=3440 ft lb

3. ∑Mz= 0

Explanation:

∑ Fx= Ax=0

∑ Fy= Ay=0

∑ Fz= Az-86-86-86

Az=258 lb

∑Mx=86 X 31 +Mx=0

Mx=2666 ft lb

∑My=86 X 40 +My=0

My=3440 ft lb

∑Mz= 0

6 0
4 years ago
The local atmospheric pressure is measured with a water barometer. If the water column is measured to be 30 ft, what is the atmo
ella [17]

Answer:

The atmospheric pressure in atm=0.885 atm

Explanation:

Given that

Local pressure (h)= 30 ft of water height     ( 1 ft= 0.3048 m)

We know that pressure in given by

  P=ρgh

We know that ρ of water is 1000\dfrac{kg}{m^3}

So pressure

P=1000(9.81)(9.144)

P=89.7026 \dfrac{N}{m^2}

We know that 1000 Pa=0.00986 atm

So P=0.885 atm

The atmospheric pressure in atm=0.885 atm

8 0
3 years ago
Other questions:
  • Technician A says that thrust angle refers to the direction the front wheels are pointing. Technician B says that scrub radius r
    11·1 answer
  • Thermosetting polymers are polymers that becomes soft and pliable when heated. ( True , False )
    8·2 answers
  • When using levers like scissors or hedge clippers, what can be done to increase the cutting force so that you don’t have to sque
    5·1 answer
  • Two technicians are discussing a vehicle that will not start. Tech A states that a problem with the immobilizer system may be th
    9·1 answer
  • Which field in a Transmission Control Protocol (TCP) header is chosen from ephemeral ports?
    11·1 answer
  • 4. At what temperature does an engine run cleanest with least wear?
    11·1 answer
  • What word is typically written at the bottom of a cover letter to indicate an
    12·2 answers
  • 2. Ang sangay na nagbibigay-kahulugan sa mga batas ng bansane
    8·1 answer
  • Prelest! Introduction to Engineering and Technology 1 Select the correct answer. What technological invention allowed for the pr
    5·1 answer
  • The controller determines if a(n) _________ exists by calculating the difference between the SP and the PV.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!